From 884f7a503f2aba902e67bde32c5735c22aa1ce56 Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 13 Mar 2015 14:34:00 +0000 Subject: [PATCH] Allow for single quotes in vicidial_list and custom_ data fields Added db schema version mismatch warning in System Settings git-svn-id: svn://192.168.202.10@2301 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 3 + agc_2-X/trunk/bin/AST_VDhopper.pl | 27 +-- .../trunk/bin/VICIDIAL_IN_new_leads_file.pl | 17 +- agc_2-X/trunk/docs/AGENT_API.txt | 5 +- agc_2-X/trunk/docs/NON-AGENT_API.txt | 5 +- agc_2-X/trunk/www/agc/api.php | 122 +++++----- agc_2-X/trunk/www/agc/vdc_db_query.php | 97 ++++---- agc_2-X/trunk/www/agc/vdc_form_display.php | 11 +- agc_2-X/trunk/www/vicidial/admin.php | 14 +- .../vicidial/admin_listloader_fourth_gen.php | 35 +-- .../trunk/www/vicidial/admin_modify_lead.php | 2 + .../trunk/www/vicidial/admin_search_lead.php | 7 +- .../trunk/www/vicidial/dbconnect_mysqli.php | 5 +- .../www/vicidial/lead_tools_advanced.php | 221 +++++++++--------- agc_2-X/trunk/www/vicidial/non_agent_api.php | 103 ++++---- agc_2-X/trunk/www/vicidial/sheet2tab.pl | 7 +- 16 files changed, 363 insertions(+), 318 deletions(-) diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index f80394fc..f21dd38a 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -59,6 +59,9 @@ OTHER CHANGES: agent leaves a 3way call in the agent screen. Must Have Asterisk 1.8+ for it to work. +2. Added ability to use single-quotes in vicidial_list fields. Through the + agent screen and all lead import methods + diff --git a/agc_2-X/trunk/bin/AST_VDhopper.pl b/agc_2-X/trunk/bin/AST_VDhopper.pl index b4a8dce9..ccc7f2f7 100644 --- a/agc_2-X/trunk/bin/AST_VDhopper.pl +++ b/agc_2-X/trunk/bin/AST_VDhopper.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# AST_VDhopper.pl version 2.10 +# AST_VDhopper.pl version 2.12 # # DESCRIPTION: # Updates the VICIDIAL leads hopper for the streamlined approach of allocating @@ -83,10 +83,11 @@ # 150111-1546 - Added lists option: local call time and enabled whole-campaign outbound call time holidays, Issue #812 # 150114-1204 - Optimization of gmt code, Issue #812 # 150117-1415 - Added list local call time validation +# 150312-1459 - Allow for single quotes in data fields without crashing # # constants -$build = '150117-1415'; +$build = '150312-1459'; $DB=0; # Debug flag, set to 0 for no debug messages. Can be overriden with CLI --debug flag $US='__'; $MT[0]=''; @@ -514,7 +515,7 @@ if ($CBHOLD_count > 0) $event_string = "|CALLBACKS LISTACT|$affected_rows|"; &event_logger; - $stmtA = "INSERT INTO $vicidial_hopper SET lead_id='$CA_lead_id[$CAu]',campaign_id='$CA_campaign_id[$CAu]',list_id='$CA_list_id[$CAu]',gmt_offset_now='$CA_gmt_offset_now[$CAu]',user='',state='$CA_state[$CAu]',priority='50',source='C',vendor_lead_code='$CA_vendor_lead_code[$cba]';"; + $stmtA = "INSERT INTO $vicidial_hopper SET lead_id='$CA_lead_id[$CAu]',campaign_id='$CA_campaign_id[$CAu]',list_id='$CA_list_id[$CAu]',gmt_offset_now='$CA_gmt_offset_now[$CAu]',user='',state='$CA_state[$CAu]',priority='50',source='C',vendor_lead_code=\"$CA_vendor_lead_code[$cba]\";"; $affected_rows = $dbhA->do($stmtA); if ($DB) {print "ANYONE Scheduled Callback Inserted into hopper: $affected_rows|$CA_lead_id[$CAu]\n";} $CAu++; @@ -1100,7 +1101,7 @@ if ($ANY_hopper_vlc_dup_check =~ /Y/) { @aryA = $sthA->fetchrow_array; if ( (length($aryA[0]) > 0) && ($aryA[0] !~ /^NULL/) ) - {$live_vlc .= "'$aryA[0]',";} + {$live_vlc .= "\"$aryA[0]\",";} $vlLIVE++; } $sthA->finish(); @@ -2539,12 +2540,12 @@ foreach(@campaign_id) @aryA = $sthA->fetchrow_array; $lead_id_lists .= "'$aryA[0]',"; if (length($aryA[1]) > 0) - {$vlc_lists .= "'$aryA[1]',";} + {$vlc_lists .= "\"$aryA[1]\",";} $rec_countLISTS++; } $sthA->finish(); $lead_id_lists .= "'0'"; - $vlc_lists .= "'--99999999987654321--'"; + $vlc_lists .= "\"--99999999987654321--\""; $order_stmt=''; $NEW_count = 0; $NEW_level = 0; @@ -2627,7 +2628,7 @@ foreach(@campaign_id) $REC_rec_countLEADS++; if (length($aryA[8]) > 0) - {$vlc_lists .= ",'$aryA[8]'";} + {$vlc_lists .= ",\"$aryA[8]\"";} } $sthA->finish(); } @@ -2681,7 +2682,7 @@ foreach(@campaign_id) $NEW_rec_countLEADS++; if (length($aryA[8]) > 0) - {$vlc_lists .= ",'$aryA[8]'";} + {$vlc_lists .= ",\"$aryA[8]\"";} } $OTHER_level = ($hopper_level[$i] - $NEW_rec_countLEADS); $sthA->finish(); @@ -2775,7 +2776,7 @@ foreach(@campaign_id) $rec_count++; if (length($aryA[8]) > 0) - {$vlc_lists .= ",'$aryA[8]'";} + {$vlc_lists .= ",\"$aryA[8]\"";} } $sthA->finish(); } @@ -2886,7 +2887,7 @@ foreach(@campaign_id) $w++; if (length($aryA[9]) > 0) - {$vlc_lists .= ",'$aryA[9]'";} + {$vlc_lists .= ",\"$aryA[9]\"";} } } } @@ -3006,7 +3007,7 @@ foreach(@campaign_id) $VLC_exist=0; if ( ($hopper_vlc_dup_check[$i] =~ /Y/) && (length($vlc_to_hopper[$h]) > 0) ) { - $stmtA="SELECT count(*) FROM $vicidial_hopper where vendor_lead_code='$vlc_to_hopper[$h]';"; + $stmtA="SELECT count(*) FROM $vicidial_hopper where vendor_lead_code=\"$vlc_to_hopper[$h]\";"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -3034,7 +3035,7 @@ foreach(@campaign_id) { if ($DNClead == '0') { - $stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source,vendor_lead_code) values('$leads_to_hopper[$h]','$campaign_id[$i]','READY','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0','$source_to_hopper[$h]','$vlc_to_hopper[$h]');"; + $stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source,vendor_lead_code) values('$leads_to_hopper[$h]','$campaign_id[$i]','READY','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0','$source_to_hopper[$h]',\"$vlc_to_hopper[$h]\");"; $affected_rows = $dbhA->do($stmtA); if ($DBX) {print "LEAD INSERTED: $affected_rows|$leads_to_hopper[$h]|\n";} if ($DB_detail) @@ -3048,7 +3049,7 @@ foreach(@campaign_id) ##### Auto-Alt-Dial if DNCC or DNCL are set to campaign auto-alt-dial statuses, insert lead into hopper as DNC status if ( ( ($auto_alt_dial_statuses[$i] =~ / DNCC /) && ($DNCC > 0) ) || ( ($auto_alt_dial_statuses[$i] =~ / DNCL /) && ($DNCL > 0) ) ) { - $stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source,vendor_lead_code) values('$leads_to_hopper[$h]','$campaign_id[$i]','DNC','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0','$source_to_hopper[$h]','$vlc_to_hopper[$h]');"; + $stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source,vendor_lead_code) values('$leads_to_hopper[$h]','$campaign_id[$i]','DNC','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0','$source_to_hopper[$h]',\"$vlc_to_hopper[$h]\");"; $affected_rows = $dbhA->do($stmtA); if ($DBX) {print "LEAD INSERTED AS DNC: $affected_rows|$leads_to_hopper[$h]|\n";} if ($DB_detail) diff --git a/agc_2-X/trunk/bin/VICIDIAL_IN_new_leads_file.pl b/agc_2-X/trunk/bin/VICIDIAL_IN_new_leads_file.pl index adad5077..33d75906 100644 --- a/agc_2-X/trunk/bin/VICIDIAL_IN_new_leads_file.pl +++ b/agc_2-X/trunk/bin/VICIDIAL_IN_new_leads_file.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# VICIDIAL_IN_new_leads_file.pl version 2.6 +# VICIDIAL_IN_new_leads_file.pl version 2.12 # # DESCRIPTION: # script lets you insert leads into the vicidial_list table from a TAB-delimited @@ -10,7 +10,7 @@ # # NOTE: the machine this is run on must have a servers entry in the database # -# Copyright (C) 2013 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 # # # CHANGES @@ -57,9 +57,10 @@ # 120907-1109 - Added vote17csv format # 121005-0728 - Added twotab format # 130419-2138 - Added --NANPA-ac-prefix-check and --nanpa-gmt options using add-on NANPA prefix database +# 150312-1458 - Allow single quotes in standard formats # -$version = '130419-2138'; +$version = '150312-1458'; $secX = time(); $MT[0]=''; @@ -759,8 +760,7 @@ foreach(@FILES) chomp($number); # $number =~ s/,/\|/gi; $number =~ s/\t/\|/gi; - $number =~ s/\'|\t|\r|\n|\l//gi; - $number =~ s/\'|\t|\r|\n|\l//gi; + $number =~ s/|\t|\r|\n|\l//gi; $number =~ s/\",,,,,,,\"/\|\|\|\|\|\|\|/gi; $number =~ s/\",,,,,,\"/\|\|\|\|\|\|/gi; $number =~ s/\",,,,,\"/\|\|\|\|\|/gi; @@ -1179,7 +1179,6 @@ foreach(@FILES) $number =~ s/,"0"//gi; $number =~ s/\t/\|/gi; $number =~ s/\'|\t|\r|\n|\l//gi; - $number =~ s/\'|\t|\r|\n|\l//gi; $number =~ s/\",,,,,,,\"/\|\|\|\|\|\|\|/gi; $number =~ s/\",,,,,,\"/\|\|\|\|\|\|/gi; $number =~ s/\",,,,,\"/\|\|\|\|\|/gi; @@ -2347,7 +2346,7 @@ foreach(@FILES) if ($map_count > 0) { - $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values('','$insert_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','$called_count','2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values('',\"$insert_date\",\"$modify_date\",\"$status\",\"$user\",\"$vendor_lead_code\",\"$source_id\",\"$list_id\",\"$gmt_offset\",\"$called_since_last_reset\",\"$phone_code\",\"$phone_number\",\"$title\",\"$first_name\",\"$middle_initial\",\"$last_name\",\"$address1\",\"$address2\",\"$address3\",\"$city\",\"$state\",\"$province\",\"$postal_code\",\"$country\",\"$gender\",\"$date_of_birth\",\"$alt_phone\",\"$email\",\"$security_phrase\",\"$comments\",\"$called_count\",'2008-01-01 00:00:00',\"$rank\",\"$owner\");"; if (!$T) {$affected_rows = $dbhA->do($stmtZ); } # or die "Couldn't execute query: |$stmtZ|\n"; $lead_id = $dbhA->{'mysql_insertid'}; if($DB){print STDERR "\n|$affected_rows|$stmtZ|\n";} @@ -2369,7 +2368,7 @@ foreach(@FILES) if ($multi_insert_counter > 8) { ### insert good lead into pending_transactions table ### - $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$insert_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','$called_count','2008-01-01 00:00:00','$rank','$owner');"; + $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('',\"$insert_date\",\"$modify_date\",\"$status\",\"$user\",\"$vendor_lead_code\",\"$source_id\",\"$list_id\",\"$gmt_offset\",\"$called_since_last_reset\",\"$phone_code\",\"$phone_number\",\"$title\",\"$first_name\",\"$middle_initial\",\"$last_name\",\"$address1\",\"$address2\",\"$address3\",\"$city\",\"$state\",\"$province\",\"$postal_code\",\"$country\",\"$gender\",\"$date_of_birth\",\"$alt_phone\",\"$email\",\"$security_phrase\",\"$comments\",\"$called_count\",'2008-01-01 00:00:00',\"$rank\",\"$owner\");"; if (!$T) {$affected_rows = $dbhA->do($stmtZ); } # or die "Couldn't execute query: |$stmtZ|\n"; if($DB){print STDERR "\n|$affected_rows|$stmtZ|\n";} @@ -2379,7 +2378,7 @@ foreach(@FILES) } else { - $multistmt .= "('','$insert_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','$called_count','2008-01-01 00:00:00','$rank','$owner'),"; + $multistmt .= "('',\"$insert_date\",\"$modify_date\",\"$status\",\"$user\",\"$vendor_lead_code\",\"$source_id\",\"$list_id\",\"$gmt_offset\",\"$called_since_last_reset\",\"$phone_code\",\"$phone_number\",\"$title\",\"$first_name\",\"$middle_initial\",\"$last_name\",\"$address1\",\"$address2\",\"$address3\",\"$city\",\"$state\",\"$province\",\"$postal_code\",\"$country\",\"$gender\",\"$date_of_birth\",\"$alt_phone\",\"$email\",\"$security_phrase\",\"$comments\",\"$called_count\",'2008-01-01 00:00:00',\"$rank\",\"$owner\"),"; $multi_insert_counter++; } } diff --git a/agc_2-X/trunk/docs/AGENT_API.txt b/agc_2-X/trunk/docs/AGENT_API.txt index 5889c079..35639f14 100644 --- a/agc_2-X/trunk/docs/AGENT_API.txt +++ b/agc_2-X/trunk/docs/AGENT_API.txt @@ -1,4 +1,4 @@ -AGENT API DOCUMENT Started: 2008-07-03 Updated: 2014-06-19 +AGENT API DOCUMENT Started: 2008-07-03 Updated: 2015-03-13 This document describes the functions of an API(Application Programming Interface) for the VICIDIAL Agent screen. This functionality will be rather limited at first @@ -436,6 +436,9 @@ LEAD DATA (must populate at least one) rank owner +NOTES: + - most special characters are not allowed, but single quotes are + EXAMPLE URLS: http://server/agc/api.php?source=test&user=6666&pass=1234&function=update_fields&agent_user=6666&vendor_lead_code=1234567&address1= diff --git a/agc_2-X/trunk/docs/NON-AGENT_API.txt b/agc_2-X/trunk/docs/NON-AGENT_API.txt index ae316af7..35398329 100644 --- a/agc_2-X/trunk/docs/NON-AGENT_API.txt +++ b/agc_2-X/trunk/docs/NON-AGENT_API.txt @@ -1,4 +1,4 @@ -NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2015-03-09 +NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2015-03-13 This document describes the functions of an API(Application Programming Interface) for all functions NOT directly relating to the VICIDIAL Agent screen. @@ -100,6 +100,7 @@ Changes: 150123-1611 - Fixed issue with list local call times and add_lead 150217-1404 - archive deleted callbacks to vicidial_callbacks_archive table 150309-0250 - Added ability to use urlencoded web form addresses +150313-0818 - Allow for single quotes in vicidial_list and custom data fields API Functions use the 'function' variable @@ -724,7 +725,7 @@ owner - 1-20 characters (user ID, Territory or user group) called_count - digits only, the number of attempts dialing the lead NOTES: - in order to set a field to empty('') set it equal to --BLANK--, i.e. "&province=--BLANK--" - - please use no special characters like apostrophes, quotes or amphersands + - please use no special characters like apostrophes, double-quotes or amphersands Example URL strings for API calls: http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_lead&lead_id=27&last_name=SMITH diff --git a/agc_2-X/trunk/www/agc/api.php b/agc_2-X/trunk/www/agc/api.php index 3a3e7ab1..f2cbe797 100644 --- a/agc_2-X/trunk/www/agc/api.php +++ b/agc_2-X/trunk/www/agc/api.php @@ -79,10 +79,11 @@ # 141128-0847 - Code cleanup for QXZ functions # 141216-2118 - Added language settings lookups and user/pass variable standardization # 150108-1039 - Added transfer_conf-ID of epoch to help prevent double-execution of transfer commands +# 150313-0825 - Allow for single quotes in vicidial_list and custom data fields # -$version = '2.10-45'; -$build = '150108-1039'; +$version = '2.12-46'; +$build = '150313-0825'; $startMS = microtime(); @@ -256,12 +257,10 @@ if ($non_latin < 1) $agent_user=preg_replace("/[^0-9a-zA-Z]/","",$agent_user); $function = preg_replace("/[^-\_0-9a-zA-Z]/","",$function); $value = preg_replace("/[^-\_0-9a-zA-Z]/","",$value); - $vendor_id = preg_replace("/[^-\.\_0-9a-zA-Z]/","",$vendor_id); $focus = preg_replace("/[^-\_0-9a-zA-Z]/","",$focus); $preview = preg_replace("/[^-\_0-9a-zA-Z]/","",$preview); $notes = preg_replace("/\+/"," ",$notes); $notes = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$notes); - $phone_code = preg_replace("/[^0-9X]/","",$phone_code); $search = preg_replace("/[^-\_0-9a-zA-Z]/","",$search); $group_alias = preg_replace("/[^0-9a-zA-Z]/","",$group_alias); $dial_prefix = preg_replace("/[^0-9a-zA-Z]/","",$dial_prefix); @@ -272,30 +271,49 @@ if ($non_latin < 1) $blended = preg_replace("/[^A-Z]/","",$blended); $ingroup_choices = preg_replace("/[^- \_0-9a-zA-Z]/","",$ingroup_choices); $set_as_default = preg_replace("/[^A-Z]/","",$set_as_default); + $phone_code = preg_replace("/[^0-9X]/","",$phone_code); $phone_number = preg_replace("/[^0-9]/","",$phone_number); - $address1 = preg_replace("/[^- \_0-9a-zA-Z]/","",$address1); - $address2 = preg_replace("/[^- \_0-9a-zA-Z]/","",$address2); - $address3 = preg_replace("/[^- \_0-9a-zA-Z]/","",$address3); - $alt_phone = preg_replace("/[^- \_0-9a-zA-Z]/","",$alt_phone); - $city = preg_replace("/[^- \_0-9a-zA-Z]/","",$city); - $comments = preg_replace("/[^- \_0-9a-zA-Z]/","",$comments); - $country_code = preg_replace("/[^A-Z]/","",$country_code); - $date_of_birth = preg_replace("/[^- \_0-9]/","",$date_of_birth); - $email = preg_replace("/[^-\.\:\/\@\_0-9a-zA-Z]/","",$email); - $first_name = preg_replace("/[^- \_0-9a-zA-Z]/","",$first_name); - $gender = preg_replace("/[^A-Z]/","",$gender); - $gmt_offset_now = preg_replace("/[^- \.\_0-9]/","",$gmt_offset_now); - $last_name = preg_replace("/[^- \_0-9a-zA-Z]/","",$last_name); $lead_id = preg_replace("/[^0-9]/","",$lead_id); - $middle_initial = preg_replace("/[^- \_0-9a-zA-Z]/","",$middle_initial); - $province = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$province); - $security_phrase = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$security_phrase); - $source_id = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$source_id); - $state = preg_replace("/[^- \_0-9a-zA-Z]/","",$state); - $title = preg_replace("/[^- \_0-9a-zA-Z]/","",$title); - $vendor_lead_code = preg_replace("/[^- \.\_0-9a-zA-Z]/","",$vendor_lead_code); - $rank = preg_replace("/[^-0-9]/","",$rank); - $owner = preg_replace("/[^-\.\:\/\@\_0-9a-zA-Z]/","",$owner); + $vendor_id = preg_replace('/;/','',$vendor_id); + $vendor_id = preg_replace('/\+/',' ',$vendor_id); + $vendor_lead_code = preg_replace('/;/','',$vendor_lead_code); + $vendor_lead_code = preg_replace('/\+/',' ',$vendor_lead_code); + $source_id = preg_replace('/;/','',$source_id); + $source_id = preg_replace('/\+/',' ',$source_id); + $gmt_offset_now = preg_replace('/-\_\.0-9/','',$gmt_offset_now); + $title = preg_replace('/[^- \'\_\.0-9a-zA-Z]/','',$title); + $first_name = preg_replace('/[^- \'\+\_\.0-9a-zA-Z]/','',$first_name); + $first_name = preg_replace('/\+/',' ',$first_name); + $middle_initial = preg_replace('/[^0-9a-zA-Z]/','',$middle_initial); + $last_name = preg_replace('/[^- \'\+\_\.0-9a-zA-Z]/','',$last_name); + $last_name = preg_replace('/\+/',' ',$last_name); + $address1 = preg_replace('/[^- \'\+\.\:\/\@\_0-9a-zA-Z]/','',$address1); + $address2 = preg_replace('/[^- \'\+\.\:\/\@\_0-9a-zA-Z]/','',$address2); + $address3 = preg_replace('/[^- \'\+\.\:\/\@\_0-9a-zA-Z]/','',$address3); + $address1 = preg_replace('/\+/',' ',$address1); + $address2 = preg_replace('/\+/',' ',$address2); + $address3 = preg_replace('/\+/',' ',$address3); + $city = preg_replace('/[^- \'\+\.\:\/\@\_0-9a-zA-Z]/','',$city); + $city = preg_replace('/\+/',' ',$city); + $state = preg_replace('/[^- 0-9a-zA-Z]/','',$state); + $province = preg_replace('/[^- \'\+\.\_0-9a-zA-Z]/','',$province); + $province = preg_replace('/\+/',' ',$province); + $postal_code = preg_replace('/[^- \'\+0-9a-zA-Z]/','',$postal_code); + $postal_code = preg_replace('/\+/',' ',$postal_code); + $country_code = preg_replace('/[^A-Z]/','',$country_code); + $gender = preg_replace('/[^A-Z]/','',$gender); + $date_of_birth = preg_replace('/[^-0-9]/','',$date_of_birth); + $alt_phone = preg_replace('/[^- \'\+\_\.0-9a-zA-Z]/','',$alt_phone); + $alt_phone = preg_replace('/\+/',' ',$alt_phone); + $email = preg_replace('/[^- \'\+\.\:\/\@\%\_0-9a-zA-Z]/','',$email); + $email = preg_replace('/\+/',' ',$email); + $security_phrase = preg_replace('/[^- \'\+\.\:\/\@\_0-9a-zA-Z]/','',$security_phrase); + $security_phrase = preg_replace('/\+/',' ',$security_phrase); + $comments = preg_replace('/;/','',$comments); + $comments = preg_replace('/\+/',' ',$comments); + $rank = preg_replace('/[^0-9]/','',$rank); + $owner = preg_replace('/[^- \'\+\.\:\/\@\_0-9a-zA-Z]/','',$owner); + $owner = preg_replace('/\+/',' ',$owner); $dial_override = preg_replace("/[^A-Z]/","",$dial_override); $consultative = preg_replace("/[^A-Z]/","",$consultative); $callback_datetime = preg_replace("/\+/"," ",$callback_datetime); @@ -1916,7 +1934,7 @@ if ($function == 'external_add_lead') if ($dnc_found==0 and $camp_dnc_found==0) { ### insert a new lead in the system with this phone number - $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$value',list_id='$list_id',status='NEW',user='$user',vendor_lead_code='$vendor_lead_code',source_id='$source_id',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',called_since_last_reset='N',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',rank='$rank',owner='$owner';"; + $stmt = "INSERT INTO vicidial_list SET phone_code=\"$phone_code\",phone_number=\"$value\",list_id=\"$list_id\",status=\"NEW\",user=\"$user\",vendor_lead_code=\"$vendor_lead_code\",source_id=\"$source_id\",title=\"$title\",first_name=\"$first_name\",middle_initial=\"$middle_initial\",last_name=\"$last_name\",address1=\"$address1\",address2=\"$address2\",address3=\"$address3\",city=\"$city\",state=\"$state\",province=\"$province\",postal_code=\"$postal_code\",country_code=\"$country_code\",gender=\"$gender\",date_of_birth=\"$date_of_birth\",alt_phone=\"$alt_phone\",email=\"$email\",security_phrase=\"$security_phrase\",comments=\"$comments\",called_since_last_reset=\"N\",entry_date=\"$ENTRYdate\",last_local_call_time=\"$NOW_TIME\",rank=\"$rank\",owner=\"$owner\";"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); $affected_rows = mysqli_affected_rows($link); @@ -2304,175 +2322,175 @@ if ($function == 'update_fields') if (preg_match('/phone_code/',$query_string)) { if ($DB) {echo _QXZ("phone_code set to")." $phone_code\n";} - $fieldsSQL .= "phone_code='$phone_code',"; + $fieldsSQL .= "phone_code=\"$phone_code\","; $fieldsLIST .= "phone_code,"; $field_set++; } if (preg_match('/address1/',$query_string)) { if ($DB) {echo _QXZ("address1 set to")." $address1\n";} - $fieldsSQL .= "address1='$address1',"; + $fieldsSQL .= "address1=\"$address1\","; $fieldsLIST .= "address1,"; $field_set++; } if (preg_match('/address2/',$query_string)) { if ($DB) {echo _QXZ("address2 set to")." $address2\n";} - $fieldsSQL .= "address2='$address2',"; + $fieldsSQL .= "address2=\"$address2\","; $fieldsLIST .= "address2,"; $field_set++; } if (preg_match('/address3/',$query_string)) { if ($DB) {echo _QXZ("address3 set to")." $address3\n";} - $fieldsSQL .= "address3='$address3',"; + $fieldsSQL .= "address3=\"$address3\","; $fieldsLIST .= "address3,"; $field_set++; } if (preg_match('/alt_phone/',$query_string)) { if ($DB) {echo _QXZ("alt_phone set to")." $alt_phone\n";} - $fieldsSQL .= "alt_phone='$alt_phone',"; + $fieldsSQL .= "alt_phone=\"$alt_phone\","; $fieldsLIST .= "alt_phone,"; $field_set++; } if (preg_match('/city/',$query_string)) { if ($DB) {echo _QXZ("city set to")." $city\n";} - $fieldsSQL .= "city='$city',"; + $fieldsSQL .= "city=\"$city\","; $fieldsLIST .= "city,"; $field_set++; } if (preg_match('/comments/',$query_string)) { if ($DB) {echo _QXZ("comments set to")." $comments\n";} - $fieldsSQL .= "comments='$comments',"; + $fieldsSQL .= "comments=\"$comments\","; $fieldsLIST .= "comments,"; $field_set++; } if (preg_match('/country_code/',$query_string)) { if ($DB) {echo _QXZ("country_code set to")." $country_code\n";} - $fieldsSQL .= "country_code='$country_code',"; + $fieldsSQL .= "country_code=\"$country_code\","; $fieldsLIST .= "country_code,"; $field_set++; } if (preg_match('/date_of_birth/',$query_string)) { if ($DB) {echo _QXZ("date_of_birth set to")." $date_of_birth\n";} - $fieldsSQL .= "date_of_birth='$date_of_birth',"; + $fieldsSQL .= "date_of_birth=\"$date_of_birth\","; $fieldsLIST .= "date_of_birth,"; $field_set++; } if (preg_match('/email/',$query_string)) { if ($DB) {echo _QXZ("email set to")." $email\n";} - $fieldsSQL .= "email='$email',"; + $fieldsSQL .= "email=\"$email\","; $fieldsLIST .= "email,"; $field_set++; } if (preg_match('/first_name/',$query_string)) { if ($DB) {echo _QXZ("first_name set to")." $first_name\n";} - $fieldsSQL .= "first_name='$first_name',"; + $fieldsSQL .= "first_name=\"$first_name\","; $fieldsLIST .= "first_name,"; $field_set++; } if (preg_match('/gender/',$query_string)) { if ($DB) {echo _QXZ("gender set to")." $gender\n";} - $fieldsSQL .= "gender='$gender',"; + $fieldsSQL .= "gender=\"$gender\","; $fieldsLIST .= "gender,"; $field_set++; } if (preg_match('/gmt_offset_now/',$query_string)) { if ($DB) {echo _QXZ("gmt_offset_now set to")." $gmt_offset_now\n";} - $fieldsSQL .= "gmt_offset_now='$gmt_offset_now',"; + $fieldsSQL .= "gmt_offset_now=\"$gmt_offset_now\","; $fieldsLIST .= "gmt_offset_now,"; $field_set++; } if (preg_match('/last_name/',$query_string)) { if ($DB) {echo _QXZ("last_name set to")." $last_name\n";} - $fieldsSQL .= "last_name='$last_name',"; + $fieldsSQL .= "last_name=\"$last_name\","; $fieldsLIST .= "last_name,"; $field_set++; } if (preg_match('/middle_initial/',$query_string)) { if ($DB) {echo _QXZ("middle_initial set to")." $middle_initial\n";} - $fieldsSQL .= "middle_initial='$middle_initial',"; + $fieldsSQL .= "middle_initial=\"$middle_initial\","; $fieldsLIST .= "middle_initial,"; $field_set++; } if (preg_match('/phone_number/',$query_string)) { if ($DB) {echo _QXZ("phone_number set to")." $phone_number\n";} - $fieldsSQL .= "phone_number='$phone_number',"; + $fieldsSQL .= "phone_number=\"$phone_number\","; $fieldsLIST .= "phone_number,"; $field_set++; } if (preg_match('/postal_code/i',$query_string)) { if ($DB) {echo _QXZ("postal_code set to")." $postal_code\n";} - $fieldsSQL .= "postal_code='$postal_code',"; + $fieldsSQL .= "postal_code=\"$postal_code\","; $fieldsLIST .= "postal_code,"; $field_set++; } if (preg_match('/province/i',$query_string)) { if ($DB) {echo _QXZ("province set to")." $province\n";} - $fieldsSQL .= "province='$province',"; + $fieldsSQL .= "province=\"$province\","; $fieldsLIST .= "province,"; $field_set++; } if (preg_match('/security_phrase/i',$query_string)) { if ($DB) {echo _QXZ("security_phrase set to")." $security_phrase\n";} - $fieldsSQL .= "security_phrase='$security_phrase',"; + $fieldsSQL .= "security_phrase=\"$security_phrase\","; $fieldsLIST .= "security_phrase,"; $field_set++; } if (preg_match('/source_id/i',$query_string)) { if ($DB) {echo _QXZ("source_id set to")." $source_id\n";} - $fieldsSQL .= "source_id='$source_id',"; + $fieldsSQL .= "source_id=\"$source_id\","; $fieldsLIST .= "source_id,"; $field_set++; } if (preg_match('/state/i',$query_string)) { if ($DB) {echo _QXZ("state set to")." $state\n";} - $fieldsSQL .= "state='$state',"; + $fieldsSQL .= "state=\"$state\","; $fieldsLIST .= "state,"; $field_set++; } if (preg_match('/title/i',$query_string)) { if ($DB) {echo _QXZ("title set to")." $title\n";} - $fieldsSQL .= "title='$title',"; + $fieldsSQL .= "title=\"$title\","; $fieldsLIST .= "title,"; $field_set++; } if (preg_match('/vendor_lead_code/i',$query_string)) { if ($DB) {echo _QXZ("vendor_lead_code set to")." $vendor_lead_code\n";} - $fieldsSQL .= "vendor_lead_code='$vendor_lead_code',"; + $fieldsSQL .= "vendor_lead_code=\"$vendor_lead_code\","; $fieldsLIST .= "vendor_lead_code,"; $field_set++; } if (preg_match('/rank/i',$query_string)) { if ($DB) {echo _QXZ("rank set to")." $rank\n";} - $fieldsSQL .= "rank='$rank',"; + $fieldsSQL .= "rank=\"$rank\","; $fieldsLIST .= "rank,"; $field_set++; } if (preg_match('/owner/i',$query_string)) { if ($DB) {echo _QXZ("owner set to")." $owner\n";} - $fieldsSQL .= "owner='$owner',"; + $fieldsSQL .= "owner=\"$owner\","; $fieldsLIST .= "owner,"; $field_set++; } diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index 1e84d4e7..18d90a68 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -374,10 +374,11 @@ # 150111-1544 - Added lists option: local call time(Issue #812) and added manual_dial_search_filter feature # 150114-2051 - Added list_name web url variable # 150117-1412 - Added list local call time validation +# 150312-1501 - Allow for single quotes in vicidial_list data fields # -$version = '2.10-269'; -$build = '150117-1412'; +$version = '2.12-270'; +$build = '150312-1501'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=616; $one_mysql_log=0; @@ -1812,7 +1813,7 @@ if ($ACTION == 'manDiaLnextCaLL') } if (strlen($vendor_lead_code)>0) { - $stmt="SELECT lead_id FROM vicidial_list where vendor_lead_code='$vendor_lead_code' $manual_dial_search_filterSQL order by modify_date desc LIMIT 1;"; + $stmt="SELECT lead_id FROM vicidial_list where vendor_lead_code=\"$vendor_lead_code\" $manual_dial_search_filterSQL order by modify_date desc LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00021',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -2093,7 +2094,7 @@ if ($ACTION == 'manDiaLnextCaLL') if ($lookup_empty_insert_lead > 0) { ### insert a new lead in the system with this phone number - $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',vendor_lead_code='$vendor_lead_code';"; + $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',vendor_lead_code=\"$vendor_lead_code\";"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00022',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3198,7 +3199,7 @@ if ($ACTION == 'manDiaLnextCaLL') $entry_list_id = $row[4]; $vendor_lead_code = $row[5]; - $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='QUEUE',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='MAIN',user='$user',priority='0',source='Q',vendor_lead_code='$vendor_lead_code';"; + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='QUEUE',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='MAIN',user='$user',priority='0',source='Q',vendor_lead_code=\"$vendor_lead_code\";"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00244',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5265,7 +5266,7 @@ if ($stage == "end") if ($VD_alt_dnc_count < 1) { ### insert record into vicidial_hopper for alt_phone call attempt - $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25',source='A',vendor_lead_code='$vendor_lead_code';"; + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ALT',user='',priority='25',source='A',vendor_lead_code=\"$vendor_lead_code\";"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00068',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5345,7 +5346,7 @@ if ($stage == "end") if ($VD_alt_dnc_count < 1) { ### insert record into vicidial_hopper for address3 call attempt - $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20',source='A',vendor_lead_code='$vendor_lead_code';"; + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='ADDR3',user='',priority='20',source='A',vendor_lead_code=\"$vendor_lead_code\";"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00072',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5464,7 +5465,7 @@ if ($stage == "end") { if ($alt_dial_phones_count == $Xlast) {$Xlast = 'LAST';} - $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$EA_list_id',gmt_offset_now='$EA_gmt_offset_now',state='$EA_state',alt_dial='X$Xlast',user='',priority='15',source='A',vendor_lead_code='$EA_vendor_lead_code';"; + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='HOLD',list_id='$EA_list_id',gmt_offset_now='$EA_gmt_offset_now',state='$EA_state',alt_dial='X$Xlast',user='',priority='15',source='A',vendor_lead_code=\"$EA_vendor_lead_code\";"; if ($DB) {echo "$stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00078',$user,$server_ip,$session_name,$one_mysql_log);} @@ -12127,12 +12128,12 @@ if ($ACTION == 'SEARCHRESULTSview') $searchmethodSQL=''; $lead_id=preg_replace("/[^0-9]/","",$lead_id); - $vendor_lead_code = preg_replace("/\'|\"|\\\\|;/","",$vendor_lead_code); - $last_name = preg_replace("/\'|\"|\\\\|;/","",$last_name); - $first_name = preg_replace("/\'|\"|\\\\|;/","",$first_name); - $city = preg_replace("/\'|\"|\\\\|;/","",$city); - $state = preg_replace("/\'|\"|\\\\|;/","",$state); - $postal_code = preg_replace("/\'|\"|\\\\|;/","",$postal_code); + $vendor_lead_code = preg_replace("/\"|\\\\|;/","",$vendor_lead_code); + $last_name = preg_replace("/\"|\\\\|;/","",$last_name); + $first_name = preg_replace("/\"|\\\\|;/","",$first_name); + $city = preg_replace("/\"|\\\\|;/","",$city); + $state = preg_replace("/\"|\\\\|;/","",$state); + $postal_code = preg_replace("/\"|\\\\|;/","",$postal_code); if (strlen($lead_id) > 0) { @@ -12142,7 +12143,7 @@ if ($ACTION == 'SEARCHRESULTSview') elseif (strlen($vendor_lead_code) > 0) { ### vendor ID entered, search by this - $searchSQL = "vendor_lead_code='$vendor_lead_code'"; + $searchSQL = "vendor_lead_code=\"$vendor_lead_code\""; } elseif ( (strlen($phone_number) >= 6) and (strlen($search) > 2) ) { @@ -12169,30 +12170,30 @@ if ($ACTION == 'SEARCHRESULTSview') elseif (strlen($last_name) > 0) { ### last name entered, search by this and other fields - $searchSQL = "last_name='$last_name'"; + $searchSQL = "last_name=\"$last_name\""; if (strlen($first_name) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "first_name='$first_name'"; + $searchSQL .= "first_name=\"$first_name\""; } if (strlen($city) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "city='$city'"; + $searchSQL .= "city=\"$city\""; } if (strlen($state) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "state='$state'"; + $searchSQL .= "state=\"$state\""; } if (strlen($postal_code) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "postal_code='$postal_code'"; + $searchSQL .= "postal_code=\"$postal_code\""; } } else @@ -12504,136 +12505,136 @@ if ($ACTION == 'SEARCHCONTACTSRESULTSview') } elseif (strlen($last_name) > 0) { - $searchSQL = "last_name='$last_name'"; + $searchSQL = "last_name=\"$last_name\""; if (strlen($first_name) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "first_name='$first_name'"; + $searchSQL .= "first_name=\"$first_name\""; } if (strlen($bu_name) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "bu_name='$bu_name'"; + $searchSQL .= "bu_name=\"$bu_name\""; } if (strlen($department) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "department='$department'"; + $searchSQL .= "department=\"$department\""; } if (strlen($group_name) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "group_name='$group_name'"; + $searchSQL .= "group_name=\"$group_name\""; } if (strlen($job_title) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "job_title='$job_title'"; + $searchSQL .= "job_title=\"$job_title\""; } if (strlen($location) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "location='$location'"; + $searchSQL .= "location=\"$location\""; } } elseif (strlen($first_name) > 0) { - $searchSQL = "first_name='$first_name'"; + $searchSQL = "first_name=\"$first_name\""; if (strlen($bu_name) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "bu_name='$bu_name'"; + $searchSQL .= "bu_name=\"$bu_name\""; } if (strlen($department) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "department='$department'"; + $searchSQL .= "department=\"$department\""; } if (strlen($group_name) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "group_name='$group_name'"; + $searchSQL .= "group_name=\"$group_name\""; } if (strlen($job_title) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "job_title='$job_title'"; + $searchSQL .= "job_title=\"$job_title\""; } if (strlen($location) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "location='$location'"; + $searchSQL .= "location=\"$location\""; } } elseif (strlen($bu_name) > 0) { - $searchSQL = "bu_name='$bu_name'"; + $searchSQL = "bu_name=\"$bu_name\""; if (strlen($department) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "department='$department'"; + $searchSQL .= "department=\"$department\""; } if (strlen($group_name) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "group_name='$group_name'"; + $searchSQL .= "group_name=\"$group_name\""; } if (strlen($job_title) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "job_title='$job_title'"; + $searchSQL .= "job_title=\"$job_title\""; } if (strlen($location) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "location='$location'"; + $searchSQL .= "location=\"$location\""; } } elseif (strlen($department) > 0) { - $searchSQL = "department='$department'"; + $searchSQL = "department=\"$department\""; if (strlen($group_name) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "group_name='$group_name'"; + $searchSQL .= "group_name=\"$group_name\""; } if (strlen($job_title) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "job_title='$job_title'"; + $searchSQL .= "job_title=\"$job_title\""; } if (strlen($location) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "location='$location'"; + $searchSQL .= "location=\"$location\""; } } elseif (strlen($group_name) > 0) { - $searchSQL = "group_name='$group_name'"; + $searchSQL = "group_name=\"$group_name\""; if (strlen($job_title) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "job_title='$job_title'"; + $searchSQL .= "job_title=\"$job_title\""; } if (strlen($location) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "location='$location'"; + $searchSQL .= "location=\"$location\""; } } elseif (strlen($job_title) > 0) { - $searchSQL = "job_title='$job_title'"; + $searchSQL = "job_title=\"$job_title\""; if (strlen($location) > 0) { if (strlen($searchSQL) > 10) {$searchSQL .= " and ";} - $searchSQL .= "location='$location'"; + $searchSQL .= "location=\"$location\""; } } elseif (strlen($location) > 0) { - $searchSQL = "location='$location'"; + $searchSQL = "location=\"$location\""; } else { diff --git a/agc_2-X/trunk/www/agc/vdc_form_display.php b/agc_2-X/trunk/www/agc/vdc_form_display.php index 1483df3e..33e82ada 100644 --- a/agc_2-X/trunk/www/agc/vdc_form_display.php +++ b/agc_2-X/trunk/www/agc/vdc_form_display.php @@ -29,10 +29,11 @@ # 141128-0855 - Code cleanup for QXZ functions # 141216-2116 - Added language settings lookups and user/pass variable standardization # 150114-2045 - Added list_name variable +# 150312-1502 - Allow for single quotes in vicidial_list data fields # -$version = '2.10-20'; -$build = '150114-2045'; +$version = '2.12-21'; +$build = '150312-1502'; require_once("dbconnect_mysqli.php"); require_once("functions.php"); @@ -322,7 +323,7 @@ if ($stage=='SUBMIT') if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];} elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];} - $form_field_value = preg_replace("/\'/","",$form_field_value); // remove single-quote + $form_field_value = preg_replace("/\"/","",$form_field_value); // remove double-quote $form_field_value = preg_replace("/\\b/","",$form_field_value); // remove backslashes if ( ($A_field_type[$o]=='MULTI') or ($A_field_type[$o]=='CHECKBOX') or ($A_field_type[$o]=='RADIO') ) @@ -357,11 +358,11 @@ if ($stage=='SUBMIT') { if (preg_match("/\|$A_field_label[$o]\|/i",$vicidial_list_fields)) { - $VL_update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',"; + $VL_update_SQL .= "$A_field_label[$o]=\"$A_field_value[$o]\","; } else { - $update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',"; + $update_SQL .= "$A_field_label[$o]=\"$A_field_value[$o]\","; } $SUBMIT_output .= "$A_field_name[$o]: $A_field_value[$o]
"; diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index e1ff43b9..124e8be1 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -3447,12 +3447,13 @@ else # 150218-0924 - Added link to callbacks bulk move, also now we will archive deleted callbacks # 150302-0951 - Release of 2.11 stable branch and raising trunk to 2.12 # 150307-1914 - Added login and leave3way custom sounds system settings options +# 150313-0912 - Added DB Schema Version warning if mismatched with astguiclient.conf value # # 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-478a'; -$build = '150307-1914'; +$admin_version = '2.12-479a'; +$build = '150313-0912'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -29951,7 +29952,14 @@ if ($ADD==311111111111111) echo "
\n"; echo "\n"; echo "\n"; - echo "\n"; + + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; diff --git a/agc_2-X/trunk/www/vicidial/admin_listloader_fourth_gen.php b/agc_2-X/trunk/www/vicidial/admin_listloader_fourth_gen.php index 69cbb9c4..dc2e5f1e 100644 --- a/agc_2-X/trunk/www/vicidial/admin_listloader_fourth_gen.php +++ b/agc_2-X/trunk/www/vicidial/admin_listloader_fourth_gen.php @@ -59,10 +59,11 @@ # 141118-1955 - Added more debug output # 141229-1814 - Added code for on-the-fly language translations display # 150209-2113 - Added master_list_override option to override template setting +# 150312-1505 - Allow for single quotes in vicidial_list data fields # -$version = '2.10-57'; -$build = '150209-2113'; +$version = '2.12-58'; +$build = '150312-1505'; require("dbconnect_mysqli.php"); require("functions.php"); @@ -173,7 +174,7 @@ if ( $phone_code_override == "in_file" ) { $phone_code_override = ""; } # $country_field=$_GET["country_field"]; if (!$country_field) {$country_field=$_POST["country_field"];} ### REGEX to prevent weird characters from ending up in the fields -$field_regx = "['\"`\\;]"; +$field_regx = "[\"`\\;]"; $vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|entry_list_id|'; @@ -198,8 +199,8 @@ if ($qm_conf_ct > 0) 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); + $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 { @@ -783,7 +784,7 @@ if ($OK_to_process) if (strlen($buffer)>0) { - $row=explode($delimiter, preg_replace('/[\'\"]/i', '', $buffer)); + $row=explode($delimiter, preg_replace('/[\"]/i', '', $buffer)); $pulldate=date("Y-m-d H:i:s"); $entry_date = "$pulldate"; @@ -889,7 +890,7 @@ if ($OK_to_process) # replace ' " ` \ ; with nothing $A_field_value[$o] = preg_replace("/$field_regx/i", "", $A_field_value[$o]); - $custom_SQL .= "$A_field_label[$o]='$A_field_value[$o]',"; + $custom_SQL .= "$A_field_label[$o]=\"$A_field_value[$o]\","; } } } @@ -1086,7 +1087,7 @@ if ($OK_to_process) if (strlen($custom_SQL)>3) { - $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','$list_id');"; + $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values('',\"$entry_date\",\"$modify_date\",\"$status\",\"$user\",\"$vendor_lead_code\",\"$source_id\",\"$list_id\",\"$gmt_offset\",\"$called_since_last_reset\",\"$phone_code\",\"$phone_number\",\"$title\",\"$first_name\",\"$middle_initial\",\"$last_name\",\"$address1\",\"$address2\",\"$address3\",\"$city\",\"$state\",\"$province\",\"$postal_code\",\"$country_code\",\"$gender\",\"$date_of_birth\",\"$alt_phone\",\"$email\",\"$security_phrase\",\"$comments\",0,\"2008-01-01 00:00:00\",\"$rank\",\"$owner\",'$list_id');"; $rslt=mysql_to_mysqli($stmtZ, $link); $affected_rows = mysqli_affected_rows($link); $lead_id = mysqli_insert_id($link); @@ -1105,7 +1106,7 @@ if ($OK_to_process) if ($multi_insert_counter > 8) { ### insert good record into vicidial_list table ### - $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');"; + $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('',\"$entry_date\",\"$modify_date\",\"$status\",\"$user\",\"$vendor_lead_code\",\"$source_id\",\"$list_id\",\"$gmt_offset\",\"$called_since_last_reset\",\"$phone_code\",\"$phone_number\",\"$title\",\"$first_name\",\"$middle_initial\",\"$last_name\",\"$address1\",\"$address2\",\"$address3\",\"$city\",\"$state\",\"$province\",\"$postal_code\",\"$country_code\",\"$gender\",\"$date_of_birth\",\"$alt_phone\",\"$email\",\"$security_phrase\",\"$comments\",0,\"2008-01-01 00:00:00\",\"$rank\",\"$owner\",'0');"; $rslt=mysql_to_mysqli($stmtZ, $link); if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} @@ -1114,7 +1115,7 @@ if ($OK_to_process) } else { - $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),"; + $multistmt .= "('',\"$entry_date\",\"$modify_date\",\"$status\",\"$user\",\"$vendor_lead_code\",\"$source_id\",\"$list_id\",\"$gmt_offset\",\"$called_since_last_reset\",\"$phone_code\",\"$phone_number\",\"$title\",\"$first_name\",\"$middle_initial\",\"$last_name\",\"$address1\",\"$address2\",\"$address3\",\"$city\",\"$state\",\"$province\",\"$postal_code\",\"$country_code\",\"$gender\",\"$date_of_birth\",\"$alt_phone\",\"$email\",\"$security_phrase\",\"$comments\",0,\"2008-01-01 00:00:00\",\"$rank\",\"$owner\",'0'),"; $multi_insert_counter++; } } @@ -1313,7 +1314,7 @@ if (($leadfile) && ($LF_path)) if (strlen($buffer)>0) { - $row=explode($delimiter, preg_replace('/[\'\"]/i', '', $buffer)); + $row=explode($delimiter, preg_replace('/[\"]/i', '', $buffer)); $custom_fields_row=$row; $pulldate=date("Y-m-d H:i:s"); $entry_date = "$pulldate"; @@ -1582,7 +1583,7 @@ if (($leadfile) && ($LF_path)) {fwrite($stmt_file, $stmtZ."\r\n");} $multistmt=''; */ $multi_insert_counter=0; - $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','$list_id');"; + $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values('',\"$entry_date\",\"$modify_date\",\"$status\",\"$user\",\"$vendor_lead_code\",\"$source_id\",\"$list_id\",\"$gmt_offset\",\"$called_since_last_reset\",\"$phone_code\",\"$phone_number\",\"$title\",\"$first_name\",\"$middle_initial\",\"$last_name\",\"$address1\",\"$address2\",\"$address3\",\"$city\",\"$state\",\"$province\",\"$postal_code\",\"$country_code\",\"$gender\",\"$date_of_birth\",\"$alt_phone\",\"$email\",\"$security_phrase\",\"$comments\",0,\"2008-01-01 00:00:00\",\"$rank\",\"$owner\",'$list_id');"; $rslt=mysql_to_mysqli($stmtZ, $link); $affected_rows = mysqli_affected_rows($link); $lead_id = mysqli_insert_id($link); @@ -1605,7 +1606,7 @@ if (($leadfile) && ($LF_path)) $varname=$fieldno_ary[0]."_field"; $$varname=$fieldno_ary[1]; $custom_ins_stmt.=",$fieldno_ary[0]"; - $custom_SQL_values.=",'".$custom_fields_row[$$varname]."'"; + $custom_SQL_values.=",\"".$custom_fields_row[$$varname]."\""; } } $custom_ins_stmt.=") VALUES('$lead_id'$custom_SQL_values)"; @@ -1801,7 +1802,7 @@ if (($leadfile) && ($LF_path)) if (strlen($buffer)>0) { - $row=explode($delimiter, preg_replace('/[\'\"]/i', '', $buffer)); + $row=explode($delimiter, preg_replace('/[\"]/i', '', $buffer)); $pulldate=date("Y-m-d H:i:s"); $entry_date = "$pulldate"; @@ -2060,7 +2061,7 @@ if (($leadfile) && ($LF_path)) if ($multi_insert_counter > 8) { ### insert good deal into pending_transactions table ### - $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');"; + $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('',\"$entry_date\",\"$modify_date\",\"$status\",\"$user\",\"$vendor_lead_code\",\"$source_id\",\"$list_id\",\"$gmt_offset\",\"$called_since_last_reset\",\"$phone_code\",\"$phone_number\",\"$title\",\"$first_name\",\"$middle_initial\",\"$last_name\",\"$address1\",\"$address2\",\"$address3\",\"$city\",\"$state\",\"$province\",\"$postal_code\",\"$country_code\",\"$gender\",\"$date_of_birth\",\"$alt_phone\",\"$email\",\"$security_phrase\",\"$comments\",0,\"2008-01-01 00:00:00\",\"$rank\",\"$owner\",'0');"; $rslt=mysql_to_mysqli($stmtZ, $link); if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} @@ -2069,7 +2070,7 @@ if (($leadfile) && ($LF_path)) } else { - $multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),"; + $multistmt .= "('',\"$entry_date\",\"$modify_date\",\"$status\",\"$user\",\"$vendor_lead_code\",\"$source_id\",\"$list_id\",\"$gmt_offset\",\"$called_since_last_reset\",\"$phone_code\",\"$phone_number\",\"$title\",\"$first_name\",\"$middle_initial\",\"$last_name\",\"$address1\",\"$address2\",\"$address3\",\"$city\",\"$state\",\"$province\",\"$postal_code\",\"$country_code\",\"$gender\",\"$date_of_birth\",\"$alt_phone\",\"$email\",\"$security_phrase\",\"$comments\",0,\"2008-01-01 00:00:00\",\"$rank\",\"$owner\",'0'),"; $multi_insert_counter++; } $good++; @@ -2269,7 +2270,7 @@ if (($leadfile) && ($LF_path)) } $buffer=rtrim(fgets($file, 4096)); $buffer=stripslashes($buffer); - $row=explode($delimiter, preg_replace('/[\'\"]/i', '', $buffer)); + $row=explode($delimiter, preg_replace('/[\"]/i', '', $buffer)); while ($fieldinfo=mysqli_fetch_field($rslt)) { diff --git a/agc_2-X/trunk/www/vicidial/admin_modify_lead.php b/agc_2-X/trunk/www/vicidial/admin_modify_lead.php index c6db358c..4f58e895 100644 --- a/agc_2-X/trunk/www/vicidial/admin_modify_lead.php +++ b/agc_2-X/trunk/www/vicidial/admin_modify_lead.php @@ -66,6 +66,7 @@ # 141229-1745 - Added code for on-the-fly language translations display # 150107-1729 - Added ignore_group_on_search user option # 150114-2321 - Added date_of_birth as editable field +# 150312-1506 - Fixed minor Iframe form bug related to custom fields # require("dbconnect_mysqli.php"); @@ -1050,6 +1051,7 @@ else echo "\n"; echo "\n"; echo "\n"; + echo "\n"; echo "
"._QXZ("Version").": $version
"._QXZ("SVN Version").": $svn_revision
"._QXZ("DB Schema Version").": $db_schema_version
"._QXZ("DB Schema Version").": $db_schema_version"; + if ($db_schema_version != "$ExpectedDBSchema") + { + echo "   "._QXZ("WARNING: Code expects different schema").": $ExpectedDBSchema\n"; + } + echo "
"._QXZ("DB Schema Update Date").": $db_schema_update_date
"._QXZ("Password Encryption").": $pass_hash_enabled - $pass_key - $pass_cost
"._QXZ("Auto User-add Value").": $auto_user_add_value
\n"; echo "\n"; echo "\n"; diff --git a/agc_2-X/trunk/www/vicidial/admin_search_lead.php b/agc_2-X/trunk/www/vicidial/admin_search_lead.php index 88f218d9..d8cb1c75 100644 --- a/agc_2-X/trunk/www/vicidial/admin_search_lead.php +++ b/agc_2-X/trunk/www/vicidial/admin_search_lead.php @@ -1,5 +1,5 @@ LICENSE: AGPLv2 # @@ -41,6 +41,7 @@ # 141124-1747 - Fixed issue #790 # 141229-1748 - Added code for on-the-fly language translations display # 150107-1728 - Added ignore_group_on_search user option +# 150312-1507 - Allow for single quotes in vicidial_list data fields # require("dbconnect_mysqli.php"); @@ -638,7 +639,7 @@ else $SQL_log = "$stmtA|$stmtB|$stmtC|"; $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='LEADS', event_type='SEARCH', record_id='$search_lead', event_code='ADMIN SEARCH LEAD', event_sql=\"$SQL_log\", event_notes='$DB|$SUBMIT|$alt_phone_search|$archive_search|$first_name|$last_name|$lead_id|$list_id|$log_lead_id|$log_lead_id_archive|$log_phone|$log_phone_archive|$owner|$phone|$status|$submit|$user|$vendor_id';"; + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LEADS', event_type='SEARCH', record_id='$search_lead', event_code='ADMIN SEARCH LEAD', event_sql=\"$SQL_log\", event_notes=\"$DB|$SUBMIT|$alt_phone_search|$archive_search|$first_name|$last_name|$lead_id|$list_id|$log_lead_id|$log_lead_id_archive|$log_phone|$log_phone_archive|$owner|$phone|$status|$submit|$user|$vendor_id\";"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); @@ -884,7 +885,7 @@ else $SQL_log = "$stmtA|$stmtB|$stmtC|"; $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='LEADS', event_type='SEARCH', record_id='$search_lead', event_code='ADMIN SEARCH LEAD', event_sql=\"$SQL_log\", event_notes='ARCHIVE $DB|$SUBMIT|$alt_phone_search|$archive_search|$first_name|$last_name|$lead_id|$list_id|$log_lead_id|$log_lead_id_archive|$log_phone|$log_phone_archive|$owner|$phone|$status|$submit|$user|$vendor_id';"; + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LEADS', event_type='SEARCH', record_id='$search_lead', event_code='ADMIN SEARCH LEAD', event_sql=\"$SQL_log\", event_notes=\"ARCHIVE $DB|$SUBMIT|$alt_phone_search|$archive_search|$first_name|$last_name|$lead_id|$list_id|$log_lead_id|$log_lead_id_archive|$log_phone|$log_phone_archive|$owner|$phone|$status|$submit|$user|$vendor_id\";"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); diff --git a/agc_2-X/trunk/www/vicidial/dbconnect_mysqli.php b/agc_2-X/trunk/www/vicidial/dbconnect_mysqli.php index c7d346b0..77040510 100644 --- a/agc_2-X/trunk/www/vicidial/dbconnect_mysqli.php +++ b/agc_2-X/trunk/www/vicidial/dbconnect_mysqli.php @@ -1,6 +1,6 @@ LICENSE: AGPLv2 +# Copyright (C) 2015 Matt Florell,Michael Cargile LICENSE: AGPLv2 # # CHANGES # 131016-1948 - Initial Build based upon lead_tools.php @@ -9,10 +9,11 @@ # 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 # -$version = '2.10-5'; -$build = '141229-2028'; +$version = '2.12-6'; +$build = '150312-1508'; # This limit is to prevent data inconsistancies. # If there are too many leads in a list this @@ -601,13 +602,13 @@ if ($move_submit == "move" ) $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_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_modify_date = preg_replace('/[^-_%0-9a-zA-Z]/','',$move_modify_date); - $move_security_phrase = preg_replace('/[^-_%0-9a-zA-Z]/','',$move_security_phrase); + $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); @@ -660,7 +661,7 @@ if ($move_submit == "move" ) 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' "; + $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---';} } @@ -671,7 +672,7 @@ if ($move_submit == "move" ) 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' "; + $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---';} } @@ -682,7 +683,7 @@ if ($move_submit == "move" ) 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' "; + $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---';} } @@ -693,7 +694,7 @@ if ($move_submit == "move" ) if (($enable_move_owner == "enabled") && ($move_owner != '')) { if ($move_owner == '---BLANK---') {$move_owner = '';} - $sql_where = $sql_where . " and owner like '$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---';} } @@ -704,7 +705,7 @@ if ($move_submit == "move" ) if (($enable_move_state == "enabled") && ($move_state != '')) { if ($move_state == '---BLANK---') {$move_state = '';} - $sql_where = $sql_where . " and state like '$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---';} } @@ -715,7 +716,7 @@ if ($move_submit == "move" ) 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' "; + $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---';} } @@ -813,19 +814,19 @@ if ($move_submit == "move" ) echo "\n"; echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -927,13 +928,13 @@ if ($confirm_move == "confirm") $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_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_modify_date = preg_replace('/[^-_%0-9a-zA-Z]/','',$move_modify_date); - $move_security_phrase = preg_replace('/[^-_%0-9a-zA-Z]/','',$move_security_phrase); + $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); @@ -984,7 +985,7 @@ if ($confirm_move == "confirm") 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' "; + $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---';} } @@ -995,7 +996,7 @@ if ($confirm_move == "confirm") 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' "; + $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---';} } @@ -1006,7 +1007,7 @@ if ($confirm_move == "confirm") 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' "; + $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---';} } @@ -1017,7 +1018,7 @@ if ($confirm_move == "confirm") if (($enable_move_owner == "enabled") && ($move_owner != '')) { if ($move_owner == '---BLANK---') {$move_owner = '';} - $sql_where = $sql_where . " and owner like '$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---';} } @@ -1028,7 +1029,7 @@ if ($confirm_move == "confirm") if (($enable_move_state == "enabled") && ($move_state != '')) { if ($move_state == '---BLANK---') {$move_state = '';} - $sql_where = $sql_where . " and state like '$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---';} } @@ -1039,7 +1040,7 @@ if ($confirm_move == "confirm") 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' "; + $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---';} } @@ -1104,8 +1105,8 @@ if ($confirm_move == "confirm") $SQL_log = "$move_lead_stmt|"; $SQL_log = preg_replace('/;/', '', $SQL_log); - $SQL_log = addslashes($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';"; + $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); @@ -1207,13 +1208,13 @@ if ($update_submit == "update" ) $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_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_modify_date = preg_replace('/[^-_%0-9a-zA-Z]/','',$update_modify_date); - $update_security_phrase = preg_replace('/[^-_%0-9a-zA-Z]/','',$update_security_phrase); + $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); @@ -1264,7 +1265,7 @@ if ($update_submit == "update" ) 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' "; + $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---';} } @@ -1275,7 +1276,7 @@ if ($update_submit == "update" ) 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' "; + $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---';} } @@ -1286,7 +1287,7 @@ if ($update_submit == "update" ) 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' "; + $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---';} } @@ -1297,7 +1298,7 @@ if ($update_submit == "update" ) if (($enable_update_owner == "enabled") && ($update_owner != '')) { if ($update_owner == '---BLANK---') {$update_owner = '';} - $sql_where = $sql_where . " and owner like '$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---';} } @@ -1308,7 +1309,7 @@ if ($update_submit == "update" ) if (($enable_update_state == "enabled") && ($update_state != '')) { if ($update_state == '---BLANK---') {$update_state = '';} - $sql_where = $sql_where . " and state like '$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---';} } @@ -1319,7 +1320,7 @@ if ($update_submit == "update" ) 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' "; + $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---';} } @@ -1395,19 +1396,19 @@ if ($update_submit == "update" ) echo "\n"; echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -1509,13 +1510,13 @@ if ($confirm_update == "confirm") $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_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_modify_date = preg_replace('/[^-_%0-9a-zA-Z]/','',$update_modify_date); - $update_security_phrase = preg_replace('/[^-_%0-9a-zA-Z]/','',$update_security_phrase); + $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); @@ -1566,7 +1567,7 @@ if ($confirm_update == "confirm") 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' "; + $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---';} } @@ -1577,7 +1578,7 @@ if ($confirm_update == "confirm") 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' "; + $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---';} } @@ -1588,7 +1589,7 @@ if ($confirm_update == "confirm") 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' "; + $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---';} } @@ -1599,7 +1600,7 @@ if ($confirm_update == "confirm") if (($enable_update_owner == "enabled") && ($update_owner != '')) { if ($update_owner == '---BLANK---') {$update_owner = '';} - $sql_where = $sql_where . " and owner like '$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---';} } @@ -1610,7 +1611,7 @@ if ($confirm_update == "confirm") if (($enable_update_state == "enabled") && ($update_state != '')) { if ($update_state == '---BLANK---') {$update_state = '';} - $sql_where = $sql_where . " and state like '$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---';} } @@ -1621,7 +1622,7 @@ if ($confirm_update == "confirm") 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' "; + $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---';} } @@ -1686,8 +1687,8 @@ if ($confirm_update == "confirm") $SQL_log = "$update_lead_stmt|"; $SQL_log = preg_replace('/;/', '', $SQL_log); - $SQL_log = addslashes($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='MODIFY', record_id='$update_list', event_code='ADMIN UPDATE LEADS', event_sql=\"$SQL_log\", event_notes='$update_sentence';"; + $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='MODIFY', record_id='$update_list', event_code='ADMIN UPDATE LEADS', event_sql=\"$SQL_log\", event_notes=\"$update_sentence\";"; if ($DB) {echo "|$admin_log_stmt|\n";} $admin_log_rslt=mysql_to_mysqli($admin_log_stmt, $link); @@ -1789,13 +1790,13 @@ if ( ( $delete_submit == "delete" ) && ( $delete_lists > 0 ) ) $enable_delete_security_phrase = preg_replace('/[^a-zA-Z]/','',$enable_delete_security_phrase); $enable_delete_count = preg_replace('/[^a-zA-Z]/','',$enable_delete_count); $delete_country_code = preg_replace('/[^-_%a-zA-Z0-9]/','',$delete_country_code); - $delete_vendor_lead_code = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_vendor_lead_code); - $delete_source_id = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_source_id); - $delete_owner = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_owner); + $delete_vendor_lead_code = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$delete_vendor_lead_code); + $delete_source_id = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$delete_source_id); + $delete_owner = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$delete_owner); $delete_state = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_state); $delete_entry_date = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_entry_date); $delete_modify_date = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_modify_date); - $delete_security_phrase = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_security_phrase); + $delete_security_phrase = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$delete_security_phrase); $delete_status = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_status); $delete_lead_id = preg_replace('/[^0-9]/','',$delete_lead_id); $delete_list = preg_replace('/[^0-9]/','',$delete_list); @@ -1848,7 +1849,7 @@ if ( ( $delete_submit == "delete" ) && ( $delete_lists > 0 ) ) if (($enable_delete_country_code == "enabled") && ($delete_country_code != '')) { if ($delete_country_code == '---BLANK---') {$delete_country_code = '';} - $sql_where = $sql_where . " and country_code like '$delete_country_code' "; + $sql_where = $sql_where . " and country_code like \"$delete_country_code\" "; $delete_parm = $delete_parm . "    "._QXZ("country code is like")." $delete_country_code
"; if ($delete_country_code == '') {$delete_country_code = '---BLANK---';} } @@ -1859,7 +1860,7 @@ if ( ( $delete_submit == "delete" ) && ( $delete_lists > 0 ) ) if (($enable_delete_vendor_lead_code == "enabled") && ($delete_vendor_lead_code != '')) { if ($delete_vendor_lead_code == '---BLANK---') {$delete_vendor_lead_code = '';} - $sql_where = $sql_where . " and vendor_lead_code like '$delete_vendor_lead_code' "; + $sql_where = $sql_where . " and vendor_lead_code like \"$delete_vendor_lead_code\" "; $delete_parm = $delete_parm . "    "._QXZ("vendor lead code is like")." $delete_vendor_lead_code
"; if ($delete_vendor_lead_code == '') {$delete_vendor_lead_code = '---BLANK---';} } @@ -1870,7 +1871,7 @@ if ( ( $delete_submit == "delete" ) && ( $delete_lists > 0 ) ) if (($enable_delete_source_id == "enabled") && ($delete_source_id != '')) { if ($delete_source_id == '---BLANK---') {$delete_source_id = '';} - $sql_where = $sql_where . " and source_id like '$delete_source_id' "; + $sql_where = $sql_where . " and source_id like \"$delete_source_id\" "; $delete_parm = $delete_parm . "    "._QXZ("source id code is like")." $delete_source_id
"; if ($delete_source_id == '') {$delete_source_id = '---BLANK---';} } @@ -1881,7 +1882,7 @@ if ( ( $delete_submit == "delete" ) && ( $delete_lists > 0 ) ) if (($enable_delete_security_phrase == "enabled") && ($delete_security_phrase != '')) { if ($delete_security_phrase == '---BLANK---') {$delete_security_phrase = '';} - $sql_where = $sql_where . " and security_phrase like '$delete_security_phrase' "; + $sql_where = $sql_where . " and security_phrase like \"$delete_security_phrase\" "; $delete_parm = $delete_parm . "    "._QXZ("security phrase is like")." $delete_security_phrase
"; if ($delete_security_phrase == '') {$delete_security_phrase = '---BLANK---';} } @@ -1892,7 +1893,7 @@ if ( ( $delete_submit == "delete" ) && ( $delete_lists > 0 ) ) if (($enable_delete_owner == "enabled") && ($delete_owner != '')) { if ($delete_owner == '---BLANK---') {$delete_owner = '';} - $sql_where = $sql_where . " and owner like '$delete_owner' "; + $sql_where = $sql_where . " and owner like \"$delete_owner\" "; $delete_parm = $delete_parm . "    "._QXZ("owner is like")." $delete_owner
"; if ($delete_owner == '') {$delete_owner = '---BLANK---';} } @@ -1903,7 +1904,7 @@ if ( ( $delete_submit == "delete" ) && ( $delete_lists > 0 ) ) if (($enable_delete_state == "enabled") && ($delete_state != '')) { if ($delete_state == '---BLANK---') {$delete_state = '';} - $sql_where = $sql_where . " and state like '$delete_state' "; + $sql_where = $sql_where . " and state like \"$delete_state\" "; $delete_parm = $delete_parm . "    "._QXZ("state is like")." $delete_state
"; if ($delete_state == '') {$delete_state = '---BLANK---';} } @@ -1979,19 +1980,19 @@ if ( ( $delete_submit == "delete" ) && ( $delete_lists > 0 ) ) echo "\n"; echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -2093,13 +2094,13 @@ if ( ( $confirm_delete == "confirm" ) && ( $delete_lists > 0 ) ) $enable_delete_security_phrase = preg_replace('/[^a-zA-Z]/','',$enable_delete_security_phrase); $enable_delete_count = preg_replace('/[^a-zA-Z]/','',$enable_delete_count); $delete_country_code = preg_replace('/[^-_%a-zA-Z0-9]/','',$delete_country_code); - $delete_vendor_lead_code = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_vendor_lead_code); - $delete_source_id = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_source_id); - $delete_owner = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_owner); + $delete_vendor_lead_code = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$delete_vendor_lead_code); + $delete_source_id = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$delete_source_id); + $delete_owner = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$delete_owner); $delete_state = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_state); $delete_entry_date = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_entry_date); $delete_modify_date = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_modify_date); - $delete_security_phrase = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_security_phrase); + $delete_security_phrase = preg_replace('/[^- _\'%0-9a-zA-Z]/','',$delete_security_phrase); $delete_status = preg_replace('/[^-_%0-9a-zA-Z]/','',$delete_status); $delete_lead_id = preg_replace('/[^0-9]/','',$delete_lead_id); $delete_list = preg_replace('/[^0-9]/','',$delete_list); @@ -2152,7 +2153,7 @@ if ( ( $confirm_delete == "confirm" ) && ( $delete_lists > 0 ) ) if (($enable_delete_country_code == "enabled") && ($delete_country_code != '')) { if ($delete_country_code == '---BLANK---') {$delete_country_code = '';} - $sql_where = $sql_where . " and country_code like '$delete_country_code' "; + $sql_where = $sql_where . " and country_code like \"$delete_country_code\" "; $delete_parm = $delete_parm . "    "._QXZ("country code is like")." $delete_country_code
"; if ($delete_country_code == '') {$delete_country_code = '---BLANK---';} } @@ -2163,7 +2164,7 @@ if ( ( $confirm_delete == "confirm" ) && ( $delete_lists > 0 ) ) if (($enable_delete_vendor_lead_code == "enabled") && ($delete_vendor_lead_code != '')) { if ($delete_vendor_lead_code == '---BLANK---') {$delete_vendor_lead_code = '';} - $sql_where = $sql_where . " and vendor_lead_code like '$delete_vendor_lead_code' "; + $sql_where = $sql_where . " and vendor_lead_code like \"$delete_vendor_lead_code\" "; $delete_parm = $delete_parm . "    "._QXZ("vendor lead code is like")." $delete_vendor_lead_code
"; if ($delete_vendor_lead_code == '') {$delete_vendor_lead_code = '---BLANK---';} } @@ -2174,7 +2175,7 @@ if ( ( $confirm_delete == "confirm" ) && ( $delete_lists > 0 ) ) if (($enable_delete_source_id == "enabled") && ($delete_source_id != '')) { if ($delete_source_id == '---BLANK---') {$delete_source_id = '';} - $sql_where = $sql_where . " and source_id like '$delete_source_id' "; + $sql_where = $sql_where . " and source_id like \"$delete_source_id\" "; $delete_parm = $delete_parm . "    "._QXZ("source id code is like")." $delete_source_id
"; if ($delete_source_id == '') {$delete_source_id = '---BLANK---';} } @@ -2185,7 +2186,7 @@ if ( ( $confirm_delete == "confirm" ) && ( $delete_lists > 0 ) ) if (($enable_delete_security_phrase == "enabled") && ($delete_security_phrase != '')) { if ($delete_security_phrase == '---BLANK---') {$delete_security_phrase = '';} - $sql_where = $sql_where . " and security_phrase like '$delete_security_phrase' "; + $sql_where = $sql_where . " and security_phrase like \"$delete_security_phrase\" "; $delete_parm = $delete_parm . "    "._QXZ("security phrase is like")." $delete_security_phrase
"; if ($delete_security_phrase == '') {$delete_security_phrase = '---BLANK---';} } @@ -2196,7 +2197,7 @@ if ( ( $confirm_delete == "confirm" ) && ( $delete_lists > 0 ) ) if (($enable_delete_owner == "enabled") && ($delete_owner != '')) { if ($delete_owner == '---BLANK---') {$delete_owner = '';} - $sql_where = $sql_where . " and owner like '$delete_owner' "; + $sql_where = $sql_where . " and owner like \"$delete_owner\" "; $delete_parm = $delete_parm . "    "._QXZ("owner is like")." $delete_owner
"; if ($delete_owner == '') {$delete_owner = '---BLANK---';} } @@ -2207,7 +2208,7 @@ if ( ( $confirm_delete == "confirm" ) && ( $delete_lists > 0 ) ) if (($enable_delete_state == "enabled") && ($delete_state != '')) { if ($delete_state == '---BLANK---') {$delete_state = '';} - $sql_where = $sql_where . " and state like '$delete_state' "; + $sql_where = $sql_where . " and state like \"$delete_state\" "; $delete_parm = $delete_parm . "    "._QXZ("state is like")." $delete_state
"; if ($delete_state == '') {$delete_state = '---BLANK---';} } @@ -2272,8 +2273,8 @@ if ( ( $confirm_delete == "confirm" ) && ( $delete_lists > 0 ) ) $SQL_log = "$delete_lead_stmt|"; $SQL_log = preg_replace('/;/', '', $SQL_log); - $SQL_log = addslashes($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='DELETE', record_id='$delete_list', event_code='ADMIN DELETE LEADS', event_sql=\"$SQL_log\", event_notes='$delete_sentence';"; + $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='DELETE', record_id='$delete_list', event_code='ADMIN DELETE LEADS', event_sql=\"$SQL_log\", event_notes=\"$delete_sentence\";"; if ($DB) {echo "|$admin_log_stmt|\n";} $admin_log_rslt=mysql_to_mysqli($admin_log_stmt, $link); @@ -2509,8 +2510,8 @@ if ($confirm_callback == "confirm") $SQL_log = "$callback_lead_stmt|"; $SQL_log = preg_replace('/;/', '', $SQL_log); - $SQL_log = addslashes($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='$callback_from_list', event_code='ADMIN SWITCH CALLBACKS', event_sql=\"$SQL_log\", event_notes='$callback_sentence';"; + $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='$callback_from_list', event_code='ADMIN SWITCH CALLBACKS', event_sql=\"$SQL_log\", event_notes=\"$callback_sentence\";"; if ($DB) {echo "|$admin_log_stmt|\n";} $admin_log_rslt=mysql_to_mysqli($admin_log_stmt, $link); diff --git a/agc_2-X/trunk/www/vicidial/non_agent_api.php b/agc_2-X/trunk/www/vicidial/non_agent_api.php index 028afb46..ffa7f6bb 100644 --- a/agc_2-X/trunk/www/vicidial/non_agent_api.php +++ b/agc_2-X/trunk/www/vicidial/non_agent_api.php @@ -94,10 +94,11 @@ # 150123-1611 - Fixed issue with list local call times and add_lead # 150217-1404 - archive deleted callbacks to vicidial_callbacks_archive table # 150309-0250 - Added ability to use urlencoded web form addresses +# 150313-0818 - Allow for single quotes in vicidial_list and custom data fields # -$version = '2.12-70'; -$build = '150309-0250'; +$version = '2.12-71'; +$build = '150313-0818'; $api_url_log = 0; $startMS = microtime(); @@ -401,33 +402,33 @@ if ($non_latin < 1) $source_id = preg_replace('/;/','',$source_id); $source_id = preg_replace('/\+/',' ',$source_id); $gmt_offset_now = preg_replace('/-\_\.0-9/','',$gmt_offset_now); - $title = preg_replace('/[^- \_\.0-9a-zA-Z]/','',$title); - $first_name = preg_replace('/[^- \+\_\.0-9a-zA-Z]/','',$first_name); + $title = preg_replace('/[^- \'\_\.0-9a-zA-Z]/','',$title); + $first_name = preg_replace('/[^- \'\+\_\.0-9a-zA-Z]/','',$first_name); $first_name = preg_replace('/\+/',' ',$first_name); $middle_initial = preg_replace('/[^0-9a-zA-Z]/','',$middle_initial); - $last_name = preg_replace('/[^- \+\_\.0-9a-zA-Z]/','',$last_name); + $last_name = preg_replace('/[^- \'\+\_\.0-9a-zA-Z]/','',$last_name); $last_name = preg_replace('/\+/',' ',$last_name); - $address1 = preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$address1); - $address2 = preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$address2); - $address3 = preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$address3); + $address1 = preg_replace('/[^- \'\+\.\:\/\@\_0-9a-zA-Z]/','',$address1); + $address2 = preg_replace('/[^- \'\+\.\:\/\@\_0-9a-zA-Z]/','',$address2); + $address3 = preg_replace('/[^- \'\+\.\:\/\@\_0-9a-zA-Z]/','',$address3); $address1 = preg_replace('/\+/',' ',$address1); $address2 = preg_replace('/\+/',' ',$address2); $address3 = preg_replace('/\+/',' ',$address3); - $city = preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$city); + $city = preg_replace('/[^- \'\+\.\:\/\@\_0-9a-zA-Z]/','',$city); $city = preg_replace('/\+/',' ',$city); $state = preg_replace('/[^- 0-9a-zA-Z]/','',$state); - $province = preg_replace('/[^- \+\.\_0-9a-zA-Z]/','',$province); + $province = preg_replace('/[^- \'\+\.\_0-9a-zA-Z]/','',$province); $province = preg_replace('/\+/',' ',$province); - $postal_code = preg_replace('/[^- \+0-9a-zA-Z]/','',$postal_code); + $postal_code = preg_replace('/[^- \'\+0-9a-zA-Z]/','',$postal_code); $postal_code = preg_replace('/\+/',' ',$postal_code); $country_code = preg_replace('/[^A-Z]/','',$country_code); $gender = preg_replace('/[^A-Z]/','',$gender); $date_of_birth = preg_replace('/[^-0-9]/','',$date_of_birth); - $alt_phone = preg_replace('/[^- \+\_\.0-9a-zA-Z]/','',$alt_phone); + $alt_phone = preg_replace('/[^- \'\+\_\.0-9a-zA-Z]/','',$alt_phone); $alt_phone = preg_replace('/\+/',' ',$alt_phone); - $email = preg_replace('/[^- \+\.\:\/\@\%\_0-9a-zA-Z]/','',$email); + $email = preg_replace('/[^- \'\+\.\:\/\@\%\_0-9a-zA-Z]/','',$email); $email = preg_replace('/\+/',' ',$email); - $security_phrase = preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$security_phrase); + $security_phrase = preg_replace('/[^- \'\+\.\:\/\@\_0-9a-zA-Z]/','',$security_phrase); $security_phrase = preg_replace('/\+/',' ',$security_phrase); $comments = preg_replace('/;/','',$comments); $comments = preg_replace('/\+/',' ',$comments); @@ -445,7 +446,8 @@ if ($non_latin < 1) $server_ip = preg_replace('/[^\.0-9]/','',$server_ip); $stage = preg_replace('/[^a-zA-Z]/','',$stage); $rank = preg_replace('/[^0-9]/','',$rank); - $owner = preg_replace('/[^-_0-9a-zA-Z]/','',$owner); + $owner = preg_replace('/[^- \'\+\.\:\/\@\_0-9a-zA-Z]/','',$owner); + $owner = preg_replace('/\+/',' ',$owner); $duplicate_check = preg_replace('/[^-_0-9a-zA-Z]/','',$duplicate_check); $custom_fields = preg_replace('/[^0-9a-zA-Z]/','',$custom_fields); $search_method = preg_replace('/[^-_0-9a-zA-Z]/','',$search_method); @@ -465,7 +467,6 @@ if ($non_latin < 1) $agent_full_name=preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$agent_full_name); $agent_user_group=preg_replace('/[^-_0-9a-zA-Z]/','',$agent_user_group); $phone_pass=preg_replace('/[^-_0-9a-zA-Z]/','',$phone_pass); - $email=preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$email); $custom_one=preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$custom_one); $custom_two=preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$custom_two); $custom_three=preg_replace('/[^- \+\.\:\/\@\_0-9a-zA-Z]/','',$custom_three); @@ -6019,7 +6020,7 @@ if ($function == 'add_lead') {$new_status='CBHOLD';} ### insert a new lead in the system with this phone number - $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='$new_status',user='$user',vendor_lead_code='$vendor_lead_code',source_id='$source_id',gmt_offset_now='$gmt_offset',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',called_since_last_reset='N',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',rank='$rank',owner='$owner',entry_list_id='0';"; + $stmt = "INSERT INTO vicidial_list SET phone_code=\"$phone_code\",phone_number=\"$phone_number\",list_id=\"$list_id\",status=\"$new_status\",user=\"$user\",vendor_lead_code=\"$vendor_lead_code\",source_id=\"$source_id\",gmt_offset_now=\"$gmt_offset\",title=\"$title\",first_name=\"$first_name\",middle_initial=\"$middle_initial\",last_name=\"$last_name\",address1=\"$address1\",address2=\"$address2\",address3=\"$address3\",city=\"$city\",state=\"$state\",province=\"$province\",postal_code=\"$postal_code\",country_code=\"$country_code\",gender=\"$gender\",date_of_birth=\"$date_of_birth\",alt_phone=\"$alt_phone\",email=\"$email\",security_phrase=\"$security_phrase\",comments=\"$comments\",called_since_last_reset=\"N\",entry_date=\"$ENTRYdate\",last_local_call_time=\"$NOW_TIME\",rank=\"$rank\",owner=\"$owner\",entry_list_id='0';"; if ($DB>0) {echo "DEBUG: add_lead query - $stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); $affected_rows = mysqli_affected_rows($link); @@ -6106,7 +6107,7 @@ if ($function == 'add_lead') elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];} $form_field_value = preg_replace("/\+/"," ",$form_field_value); - $form_field_value = preg_replace("/\'/","",$form_field_value); + $form_field_value = preg_replace("/;|\"/","",$form_field_value); $form_field_value = preg_replace("/\\b/","",$form_field_value); $A_field_value[$o] = $form_field_value; @@ -6118,7 +6119,7 @@ if ($function == 'add_lead') { if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) { - $CFinsert_SQL .= "$A_field_label[$o]='$A_field_value[$o]',"; + $CFinsert_SQL .= "$A_field_label[$o]=\"$A_field_value[$o]\","; } } $o++; @@ -6213,7 +6214,7 @@ if ($function == 'add_lead') else { ### insert record into vicidial_hopper for alt_phone call attempt - $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$list_id',gmt_offset_now='$gmt_offset',state='$state',user='',priority='$hopper_priority',source='P',vendor_lead_code='$vendor_lead_code';"; + $stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$VD_campaign_id',status='READY',list_id='$list_id',gmt_offset_now='$gmt_offset',state='$state',user='',priority='$hopper_priority',source='P',vendor_lead_code=\"$vendor_lead_code\";"; if ($DB>0) {echo "DEBUG: add_lead query - $stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); $Haffected_rows = mysqli_affected_rows($link); @@ -6383,7 +6384,7 @@ if ($function == 'update_lead') if ( (preg_match("/VENDOR_LEAD_CODE/",$search_method)) and (strlen($vendor_lead_code)>0) ) { $find_vendor_lead_code=1; - $vendor_lead_code_SQL = "vendor_lead_code='$vendor_lead_code'"; + $vendor_lead_code_SQL = "vendor_lead_code=\"$vendor_lead_code\""; } if ( (preg_match("/PHONE_NUMBER/",$search_method)) and (strlen($phone_number)>5) and (strlen($phone_number)<19) ) { @@ -6513,33 +6514,33 @@ if ($function == 'update_lead') { $VL_update_SQL=''; ##### BEGIN update lead information in the system ##### - if (strlen($user_field)>0) {$VL_update_SQL .= "user='$user_field',";} - if (strlen($list_id_field)>0) {$VL_update_SQL .= "list_id='$list_id_field',";} - if (strlen($status)>0) {$VL_update_SQL .= "status='$status',";} - if (strlen($vendor_lead_code)>0) {$VL_update_SQL .= "vendor_lead_code='$vendor_lead_code',";} - if (strlen($source_id)>0) {$VL_update_SQL .= "source_id='$source_id',";} - if (strlen($gmt_offset_now)>0) {$VL_update_SQL .= "gmt_offset_now='$gmt_offset_now',";} - if (strlen($title)>0) {$VL_update_SQL .= "title='$title',";} - if (strlen($first_name)>0) {$VL_update_SQL .= "first_name='$first_name',";} - if (strlen($middle_initial)>0) {$VL_update_SQL .= "middle_initial='$middle_initial',";} - if (strlen($last_name)>0) {$VL_update_SQL .= "last_name='$last_name',";} - if (strlen($address1)>0) {$VL_update_SQL .= "address1='$address1',";} - if (strlen($address2)>0) {$VL_update_SQL .= "address2='$address2',";} - if (strlen($address3)>0) {$VL_update_SQL .= "address3='$address3',";} - if (strlen($city)>0) {$VL_update_SQL .= "city='$city',";} - if (strlen($state)>0) {$VL_update_SQL .= "state='$state',";} - if (strlen($province)>0) {$VL_update_SQL .= "province='$province',";} - if (strlen($postal_code)>0) {$VL_update_SQL .= "postal_code='$postal_code',";} - if (strlen($country_code)>0) {$VL_update_SQL .= "country_code='$country_code',";} - if (strlen($gender)>0) {$VL_update_SQL .= "gender='$gender',";} - if (strlen($date_of_birth)>0) {$VL_update_SQL .= "date_of_birth='$date_of_birth',";} - if (strlen($alt_phone)>0) {$VL_update_SQL .= "alt_phone='$alt_phone',";} - if (strlen($email)>0) {$VL_update_SQL .= "email='$email',";} - if (strlen($security_phrase)>0) {$VL_update_SQL .= "security_phrase='$security_phrase',";} - if (strlen($comments)>0) {$VL_update_SQL .= "comments='$comments',";} - if (strlen($rank)>0) {$VL_update_SQL .= "rank='$rank',";} - if (strlen($owner)>0) {$VL_update_SQL .= "owner='$owner',";} - if (strlen($called_count)>0) {$VL_update_SQL .= "called_count='$called_count',";} + if (strlen($user_field)>0) {$VL_update_SQL .= "user=\"$user_field\",";} + if (strlen($list_id_field)>0) {$VL_update_SQL .= "list_id=\"$list_id_field\",";} + if (strlen($status)>0) {$VL_update_SQL .= "status=\"$status\",";} + if (strlen($vendor_lead_code)>0) {$VL_update_SQL .= "vendor_lead_code=\"$vendor_lead_code\",";} + if (strlen($source_id)>0) {$VL_update_SQL .= "source_id=\"$source_id\",";} + if (strlen($gmt_offset_now)>0) {$VL_update_SQL .= "gmt_offset_now=\"$gmt_offset_now\",";} + if (strlen($title)>0) {$VL_update_SQL .= "title=\"$title\",";} + if (strlen($first_name)>0) {$VL_update_SQL .= "first_name=\"$first_name\",";} + if (strlen($middle_initial)>0) {$VL_update_SQL .= "middle_initial=\"$middle_initial\",";} + if (strlen($last_name)>0) {$VL_update_SQL .= "last_name=\"$last_name\",";} + if (strlen($address1)>0) {$VL_update_SQL .= "address1=\"$address1\",";} + if (strlen($address2)>0) {$VL_update_SQL .= "address2=\"$address2\",";} + if (strlen($address3)>0) {$VL_update_SQL .= "address3=\"$address3\",";} + if (strlen($city)>0) {$VL_update_SQL .= "city=\"$city\",";} + if (strlen($state)>0) {$VL_update_SQL .= "state=\"$state\",";} + if (strlen($province)>0) {$VL_update_SQL .= "province=\"$province\",";} + if (strlen($postal_code)>0) {$VL_update_SQL .= "postal_code=\"$postal_code\",";} + if (strlen($country_code)>0) {$VL_update_SQL .= "country_code=\"$country_code\",";} + if (strlen($gender)>0) {$VL_update_SQL .= "gender=\"$gender\",";} + if (strlen($date_of_birth)>0) {$VL_update_SQL .= "date_of_birth=\"$date_of_birth\",";} + if (strlen($alt_phone)>0) {$VL_update_SQL .= "alt_phone=\"$alt_phone\",";} + if (strlen($email)>0) {$VL_update_SQL .= "email=\"$email\",";} + if (strlen($security_phrase)>0) {$VL_update_SQL .= "security_phrase=\"$security_phrase\",";} + if (strlen($comments)>0) {$VL_update_SQL .= "comments=\"$comments\",";} + if (strlen($rank)>0) {$VL_update_SQL .= "rank=\"$rank\",";} + if (strlen($owner)>0) {$VL_update_SQL .= "owner=\"$owner\",";} + if (strlen($called_count)>0) {$VL_update_SQL .= "called_count=\"$called_count\",";} if ( (strlen($reset_lead) > 0 && $reset_lead == 'Y') ) {$VL_update_SQL .= "called_since_last_reset='N',";} if ( (strlen($update_phone_number)>0 && $update_phone_number=='Y' && strlen($phone_number)>0) ) {$VL_update_SQL .= "phone_number='$phone_number',";} $VL_update_SQL = preg_replace("/,$/","",$VL_update_SQL); @@ -6788,7 +6789,7 @@ if ($function == 'update_lead') elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];} $form_field_value = preg_replace("/\+/"," ",$form_field_value); - $form_field_value = preg_replace("/\'/","",$form_field_value); + $form_field_value = preg_replace("/;|\"/","",$form_field_value); $form_field_value = preg_replace("/\\b/","",$form_field_value); $A_field_value[$o] = $form_field_value; @@ -6800,7 +6801,7 @@ if ($function == 'update_lead') { if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields)) { - $update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',"; + $update_SQL .= "$A_field_label[$o]=\"$A_field_value[$o]\","; } } $o++; @@ -6896,7 +6897,7 @@ if ($function == 'update_lead') if (strlen($status)<1) {$status='NEW';} ### insert a new lead in the system with this phone number - $stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='$status',user='$user',vendor_lead_code='$vendor_lead_code',source_id='$source_id',gmt_offset_now='$gmt_offset',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',called_since_last_reset='N',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',rank='$rank',owner='$owner',entry_list_id='0';"; + $stmt = "INSERT INTO vicidial_list SET phone_code=\"$phone_code\",phone_number=\"$phone_number\",list_id=\"$list_id\",status=\"$status\",user=\"$user\",vendor_lead_code=\"$vendor_lead_code\",source_id=\"$source_id\",gmt_offset_now=\"$gmt_offset\",title=\"$title\",first_name=\"$first_name\",middle_initial=\"$middle_initial\",last_name=\"$last_name\",address1=\"$address1\",address2=\"$address2\",address3=\"$address3\",city=\"$city\",state=\"$state\",province=\"$province\",postal_code=\"$postal_code\",country_code=\"$country_code\",gender=\"$gender\",date_of_birth=\"$date_of_birth\",alt_phone=\"$alt_phone\",email=\"$email\",security_phrase=\"$security_phrase\",comments=\"$comments\",called_since_last_reset=\"N\",entry_date=\"$ENTRYdate\",last_local_call_time=\"$NOW_TIME\",rank=\"$rank\",owner=\"$owner\",entry_list_id='0';"; if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";} $rslt=mysql_to_mysqli($stmt, $link); $affected_rows = mysqli_affected_rows($link); diff --git a/agc_2-X/trunk/www/vicidial/sheet2tab.pl b/agc_2-X/trunk/www/vicidial/sheet2tab.pl index 3d16cc55..f9884dbc 100644 --- a/agc_2-X/trunk/www/vicidial/sheet2tab.pl +++ b/agc_2-X/trunk/www/vicidial/sheet2tab.pl @@ -1,8 +1,8 @@ #!/usr/bin/perl # -# sheet2tab.pl - Convert spreadsheet to tab-delimited text file version 2.4 +# sheet2tab.pl - Convert spreadsheet to tab-delimited text file version 2.12 # -# Copyright (C) 2013 Matt Florell & Michael Cargile LICENSE: AGPLv2 +# Copyright (C) 2015 Matt Florell & Michael Cargile LICENSE: AGPLv2 # # Lead file conversion and scrubbing script. This is the first stage in the lead loading process. # @@ -33,6 +33,7 @@ # 100706-1244 - Reformat and add comments # 110927-1750 - Fixed issue with improperly CSV files locking up servers # 130619-2310 - Fixed missing XLSX perl module declaration +# 150312-1547 - Allow for single quotes in vicidial_list data fields # # disable when not debugging @@ -49,7 +50,7 @@ sub scrub_lead_field my $lead_field = $_[0]; # remove bad characters - $lead_field =~ s/\'|\\|\"|;|\`|\224//gi; + $lead_field =~ s/\\|\"|;|\`|\224//gi; # replace tabs and newlines with spaces $lead_field =~ s/\n|\r|\t|\174/ /gi;
"._QXZ("Lead ID").": $lead_id     "._QXZ("List ID").": $list_id
"._QXZ("Fronter").": $tsr     "._QXZ("Called Count").": $called_count