Changed Custom Fields of SCRIPT type to allow URLs and urlencoded variables
when using --U-- and --V-- to declare variables, issue #979 git-svn-id: svn://192.168.202.10@2692 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -103,6 +103,9 @@ OTHER CHANGES:
|
||||
16. Changed Emergency Logout processes to hangup all agent session calls, and
|
||||
added better logging
|
||||
|
||||
17. Changed Custom Fields of SCRIPT type to allow URLs and urlencoded variables
|
||||
when using --U-- and --V-- to declare variables
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
#
|
||||
# functions.php version 2.12
|
||||
# functions.php version 2.14
|
||||
#
|
||||
# functions for agent scripts
|
||||
#
|
||||
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# CHANGES:
|
||||
@@ -31,6 +31,7 @@
|
||||
# 150923-2017 - Added DID custom fields
|
||||
# 160510-2151 - Fixed issues with select lists and common contents
|
||||
# 160913-0827 - Fixed issues with multiple selected values in custom fields
|
||||
# 170228-2258 - Changes to allow URLs in SCRIPT field types
|
||||
#
|
||||
|
||||
# $mysql_queries = 20
|
||||
@@ -571,9 +572,9 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB)
|
||||
|
||||
##### BEGIN parsing for vicidial variables #####
|
||||
$NOTESout='';
|
||||
if (preg_match("/--A--/",$CFoutput))
|
||||
if (preg_match("/--A--|--U--/",$CFoutput))
|
||||
{
|
||||
if ( (preg_match('/--A--user_custom_/i',$CFoutput)) or (preg_match('/--A--fullname/i',$CFoutput)) )
|
||||
if ( (preg_match('/--A--user_custom_|--U--user_custom_/i',$CFoutput)) or (preg_match('/--A--fullname|--U--fullname/i',$CFoutput)) )
|
||||
{
|
||||
$stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five,full_name from vicidial_users where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
@@ -592,7 +593,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB)
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/--A--dialed_/i',$CFoutput))
|
||||
if (preg_match('/--A--dialed_|--U--dialed_/i',$CFoutput))
|
||||
{
|
||||
$dialed_number = $phone_number;
|
||||
$dialed_label = _QXZ("NONE");
|
||||
@@ -827,6 +828,70 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB)
|
||||
$owner = trim($row[33]);
|
||||
}
|
||||
|
||||
$CFoutput = preg_replace('/--U--lead_id--V--/i',urlencode($lead_id),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--vendor_id--V--/i',urlencode($vendor_id),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--vendor_lead_code--V--/i',urlencode($vendor_lead_code),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--list_id--V--/i',urlencode($list_id),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--gmt_offset_now--V--/i',urlencode($gmt_offset_now),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--phone_code--V--/i',urlencode($phone_code),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--phone_number--V--/i',urlencode($phone_number),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--title--V--/i',urlencode($title),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--first_name--V--/i',urlencode($first_name),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--middle_initial--V--/i',urlencode($middle_initial),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--last_name--V--/i',urlencode($last_name),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--address1--V--/i',urlencode($address1),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--address2--V--/i',urlencode($address2),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--address3--V--/i',urlencode($address3),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--city--V--/i',urlencode($city),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--state--V--/i',urlencode($state),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--province--V--/i',urlencode($province),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--postal_code--V--/i',urlencode($postal_code),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--country_code--V--/i',urlencode($country_code),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--gender--V--/i',urlencode($gender),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--date_of_birth--V--/i',urlencode($date_of_birth),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--alt_phone--V--/i',urlencode($alt_phone),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--email--V--/i',urlencode($email),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--security_phrase--V--/i',urlencode($security_phrase),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--comments--V--/i',urlencode($comments),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--user--V--/i',urlencode($user),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--pass--V--/i',urlencode($pass),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--campaign--V--/i',urlencode($campaign),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--server_ip--V--/i',urlencode($server_ip),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--session_id--V--/i',urlencode($session_id),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--dialed_number--V--/i',urlencode($dialed_number),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--dialed_label--V--/i',urlencode($dialed_label),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--source_id--V--/i',urlencode($source_id),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--rank--V--/i',urlencode($rank),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--owner--V--/i',urlencode($owner),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--fullname--V--/i',urlencode($fullname),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--uniqueid--V--/i',urlencode($uniqueid),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--user_custom_one--V--/i',urlencode($user_custom_one),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--user_custom_two--V--/i',urlencode($user_custom_two),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--user_custom_three--V--/i',urlencode($user_custom_three),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--user_custom_four--V--/i',urlencode($user_custom_four),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--user_custom_five--V--/i',urlencode($user_custom_five),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--preset_number_a--V--/i',urlencode($preset_number_a),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--preset_number_b--V--/i',urlencode($preset_number_b),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--preset_number_c--V--/i',urlencode($preset_number_c),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--preset_number_d--V--/i',urlencode($preset_number_d),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--preset_number_e--V--/i',urlencode($preset_number_e),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--preset_dtmf_a--V--/i',urlencode($preset_dtmf_a),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--preset_dtmf_b--V--/i',urlencode($preset_dtmf_b),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--did_id--V--/i',urlencode($did_id),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--did_extension--V--/i',urlencode($did_extension),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--did_pattern--V--/i',urlencode($did_pattern),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--did_description--V--/i',urlencode($did_description),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--closecallid--V--/i',urlencode($closecallid),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--xfercallid--V--/i',urlencode($xfercallid),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--agent_log_id--V--/i',urlencode($agent_log_id),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--call_id--V--/i',urlencode($call_id),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--called_count--V--/i',urlencode($called_count),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--did_custom_one--V--/i',urlencode($did_custom_one),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--did_custom_two--V--/i',urlencode($did_custom_two),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--did_custom_three--V--/i',urlencode($did_custom_three),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--did_custom_four--V--/i',urlencode($did_custom_four),$CFoutput);
|
||||
$CFoutput = preg_replace('/--U--did_custom_five--V--/i',urlencode($did_custom_five),$CFoutput);
|
||||
|
||||
$CFoutput = preg_replace('/--A--lead_id--B--/i',"$lead_id",$CFoutput);
|
||||
$CFoutput = preg_replace('/--A--vendor_id--B--/i',"$vendor_id",$CFoutput);
|
||||
$CFoutput = preg_replace('/--A--vendor_lead_code--B--/i',"$vendor_lead_code",$CFoutput);
|
||||
@@ -897,6 +962,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user,$DB)
|
||||
$o=0;
|
||||
while ($fields_to_print > $o)
|
||||
{
|
||||
$CFoutput = preg_replace("/--U--$A_field_label[$o]--V--/i",urlencode($A_field_value[$o]),$CFoutput);
|
||||
$CFoutput = preg_replace("/--A--$A_field_label[$o]--B--/i","$A_field_value[$o]",$CFoutput);
|
||||
$o++;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# admin_lists_custom.php
|
||||
#
|
||||
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# this screen manages the custom lists fields in ViciDial
|
||||
#
|
||||
@@ -40,10 +40,11 @@
|
||||
# 160429-1125 - Added admin_row_click option
|
||||
# 160508-0219 - Added screen colors feature
|
||||
# 160510-2108 - Fixing issues with using only standard fields
|
||||
# 170228-2254 - Changes to allow URLs in SCRIPT field types
|
||||
#
|
||||
|
||||
$admin_version = '2.12-32';
|
||||
$build = '160510-2108';
|
||||
$admin_version = '2.14-33';
|
||||
$build = '170228-2254';
|
||||
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
@@ -156,7 +157,9 @@ if ($non_latin < 1)
|
||||
|
||||
$field_name = preg_replace('/[^ \.\,-\_0-9a-zA-Z]/','',$field_name);
|
||||
$field_description = preg_replace('/[^ \.\,-\_0-9a-zA-Z]/','',$field_description);
|
||||
$field_options = preg_replace('/[^ \.\n\,-\_0-9a-zA-Z]/', '',$field_options);
|
||||
$field_options = preg_replace('/[^ \'\&\.\n\,-\_0-9a-zA-Z]/', '',$field_options);
|
||||
if ($field_type != 'SCRIPT')
|
||||
{$field_options = preg_replace('/[^ \.\n\,-\_0-9a-zA-Z]/', '',$field_options);}
|
||||
$field_default = preg_replace('/[^ \.\n\,-\_0-9a-zA-Z]/', '',$field_default);
|
||||
} # end of non_latin
|
||||
else
|
||||
@@ -1643,7 +1646,7 @@ function add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field
|
||||
|
||||
if ($SQLexecuted > 0)
|
||||
{
|
||||
$stmt="INSERT INTO vicidial_lists_fields set field_label='$field_label',field_name='$field_name',field_description='$field_description',field_rank='$field_rank',field_help='$field_help',field_type='$field_type',field_options='$field_options',field_size='$field_size',field_max='$field_max',field_default='$field_default',field_required='$field_required',field_cost='$field_cost',list_id='$list_id',multi_position='$multi_position',name_position='$name_position',field_order='$field_order';";
|
||||
$stmt="INSERT INTO vicidial_lists_fields set field_label='$field_label',field_name='$field_name',field_description='$field_description',field_rank='$field_rank',field_help='$field_help',field_type='$field_type',field_options=\"$field_options\",field_size='$field_size',field_max='$field_max',field_default='$field_default',field_required='$field_required',field_cost='$field_cost',list_id='$list_id',multi_position='$multi_position',name_position='$name_position',field_order='$field_order';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$field_update = mysqli_affected_rows($link);
|
||||
if ($DB) {echo "$field_update|$stmt\n";}
|
||||
@@ -1783,7 +1786,7 @@ function modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$fi
|
||||
|
||||
if ($SQLexecuted > 0)
|
||||
{
|
||||
$stmt="UPDATE vicidial_lists_fields set field_label='$field_label',field_name='$field_name',field_description='$field_description',field_rank='$field_rank',field_help='$field_help',field_type='$field_type',field_options='$field_options',field_size='$field_size',field_max='$field_max',field_default='$field_default',field_required='$field_required',field_cost='$field_cost',multi_position='$multi_position',name_position='$name_position',field_order='$field_order' where list_id='$list_id' and field_id='$field_id';";
|
||||
$stmt="UPDATE vicidial_lists_fields set field_label='$field_label',field_name='$field_name',field_description='$field_description',field_rank='$field_rank',field_help='$field_help',field_type='$field_type',field_options=\"$field_options\",field_size='$field_size',field_max='$field_max',field_default='$field_default',field_required='$field_required',field_cost='$field_cost',multi_position='$multi_position',name_position='$name_position',field_order='$field_order' where list_id='$list_id' and field_id='$field_id';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$field_update = mysqli_affected_rows($link);
|
||||
if ($DB) {echo "$field_update|$stmt\n";}
|
||||
|
||||
@@ -2197,7 +2197,7 @@ if ($SSqc_features_active > 0)
|
||||
<BR>
|
||||
<A NAME="lists_fields-field_options">
|
||||
<BR>
|
||||
<B><?php echo _QXZ("Field Options"); ?> -</B><?php echo _QXZ("For the SELECT, MULTI, RADIO and CHECKBOX field types, you must define the option values in this box. You must put a list of comma separated option label and option text here with each option one its own line. The first value should have no spaces in it, and neither values should have any punctuation. For example - electric_meter, Electric Meter"); ?>
|
||||
<B><?php echo _QXZ("Field Options"); ?> -</B><?php echo _QXZ("For the SELECT, MULTI, RADIO and CHECKBOX field types, you must define the option values in this box. You must put a list of comma separated option label and option text here with each option one its own line. The first value should have no spaces in it, and neither values should have any punctuation. For example - electric_meter, Electric Meter") . ". " . _QXZ("For the SCRIPT field types, this field is where you put your script contents. You can use single quote and amphersand characters as well so that you can create links and iframe elements. If you want to put urlencoded fields in this area, make sure you use the --U-- and --V-- flags for your variables instead of using A and B, for example --U--test_field--V--."); ?>
|
||||
|
||||
<BR>
|
||||
<A NAME="lists_fields-multi_position">
|
||||
|
||||
Reference in New Issue
Block a user