diff --git a/agc_2-X/trunk/docs/CALLER_ID_NAME_CODES.txt b/agc_2-X/trunk/docs/CALLER_ID_NAME_CODES.txt
index 19270913..518d27e7 100644
--- a/agc_2-X/trunk/docs/CALLER_ID_NAME_CODES.txt
+++ b/agc_2-X/trunk/docs/CALLER_ID_NAME_CODES.txt
@@ -1,4 +1,4 @@
-CALLER ID NAME CODES DOC Started: 2013-07-15 Updated: 2017-10-26
+CALLER ID NAME CODES DOC Started: 2013-07-15 Updated: 2018-01-23
This document is meant for reference only, and it does not contain all CID name codes possible, but more will be added over time.
@@ -27,3 +27,4 @@ BM - Real-time screen blind monitor (BM149425456200006666)
BB - Real-time screen blind barge (BB149425456200006666)
BW - Real-time screen blind whisper (BW149425456200006666)
E - Inbound Email, tracking only (E0001797980001237995)
+ACagcW - Noone in session call agent phone (ACagcW15167259066666)
diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php
index 833c1bf0..b63cc9c6 100644
--- a/agc_2-X/trunk/www/agc/vicidial.php
+++ b/agc_2-X/trunk/www/agc/vicidial.php
@@ -13230,7 +13230,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
hideDiv('DispoButtonHideA');
hideDiv('DispoButtonHideB');
hideDiv('DispoButtonHideC');
- document.getElementById("debugbottomspan").innerHTML = "" + document.vicidial_form.lead_id.value + "|" + DispoChoice + "\n"
+ document.getElementById("debugbottomspan").innerHTML = "" + document.vicidial_form.lead_id.value + "|" + DispoChoice + "\n";
button_click_log = button_click_log + "" + SQLdate + "-----dispo_set_twice---" + document.vicidial_form.lead_id.value + " " + DispoChoice + "|";
}
else
@@ -15014,6 +15014,7 @@ else
"&did_custom_five=" + did_custom_five + '' +
"&called_count=" + document.vicidial_form.called_count.value + '' +
"&email_row_id=" + document.vicidial_form.email_row_id.value + '' +
+ "&inOUT=" + inOUT + '' +
"&web_vars=" + LIVE_web_vars + '' +
webform_session;
@@ -15411,6 +15412,7 @@ else
var RGdid_custom_three = new RegExp("--A--did_custom_three--B--","g");
var RGdid_custom_four = new RegExp("--A--did_custom_four--B--","g");
var RGdid_custom_five = new RegExp("--A--did_custom_five--B--","g");
+ var RGinOUT = new RegExp("--A--inOUT--B--","g");
var RGcalled_count = new RegExp("--A--called_count--B--","g");
var RGweb_vars = new RegExp("--A--web_vars--B--","g");
@@ -15498,6 +15500,7 @@ else
encoded = encoded.replace(RGdid_custom_four,SCdid_custom_four);
encoded = encoded.replace(RGdid_custom_five,SCdid_custom_five);
encoded = encoded.replace(RGcalled_count,SCcalled_count);
+ encoded = encoded.replace(RGinOUT,inOUT);
encoded = encoded.replace(RGweb_vars, SCweb_vars);
}
diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php
index b77f7b26..dfcb630a 100644
--- a/agc_2-X/trunk/www/vicidial/admin.php
+++ b/agc_2-X/trunk/www/vicidial/admin.php
@@ -4416,8 +4416,6 @@ else
}
$admin_lists_custom = 'admin_lists_custom.php';
-if (preg_match("/cf_encrypt/",$SSactive_modules))
- {$admin_lists_custom = 'admin_lists_custom_encrypt.php';}
$x_ra_carrier = 0;
if (preg_match("/x_ra_carrier/",$SSactive_modules))
{$x_ra_carrier = 1;}
diff --git a/agc_2-X/trunk/www/vicidial/admin_header.php b/agc_2-X/trunk/www/vicidial/admin_header.php
index 9f8d80ec..14c8841b 100644
--- a/agc_2-X/trunk/www/vicidial/admin_header.php
+++ b/agc_2-X/trunk/www/vicidial/admin_header.php
@@ -1610,8 +1610,6 @@ if ($subcamp_font_size < 4) {$subcamp_font_size='11';}
if ($SScustom_fields_enabled > 0)
{
$admin_lists_custom = 'admin_lists_custom.php';
- if (preg_match("/cf_encrypt/",$SSactive_modules))
- {$admin_lists_custom = 'admin_lists_custom_encrypt.php';}
?>
0) {echo " onclick=\"window.document.location='$admin_lists_custom';\"";} ?>>
diff --git a/agc_2-X/trunk/www/vicidial/admin_lists_custom.php b/agc_2-X/trunk/www/vicidial/admin_lists_custom.php
index 573efb78..00e245ed 100644
--- a/agc_2-X/trunk/www/vicidial/admin_lists_custom.php
+++ b/agc_2-X/trunk/www/vicidial/admin_lists_custom.php
@@ -1,7 +1,7 @@
LICENSE: AGPLv2
+# Copyright (C) 2018 Matt Florell LICENSE: AGPLv2
#
# this screen manages the custom lists fields in ViciDial
#
@@ -33,22 +33,25 @@
# 141006-0903 - Finalized adding QXZ translation to all admin files
# 141230-0018 - Added code for on-the-fly language translations display
# 150626-2120 - Modified mysqli_error() to mysqli_connect_error() where appropriate
+# 150807-2233 - Added enc options
+# 151002-0650 - Fixed issue with non-enc field types
# 151007-2001 - Fixed issue with field deletion
# 160325-1431 - Changes for sidebar update
# 160404-0938 - design changes
-# 160414-1243 - Fixed translation issue with COPY form
-# 160429-1125 - Added admin_row_click option
+# 160414-1244 - Fixed translation issue with COPY form
+# 160429-1121 - 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
-# 170301-0827 - Enabled required custom fields with INBOUND_ONLY option
-# 170321-1553 - Fixed list view permissions issue #1005
+# 160510-2109 - Fixing issues with using only standard fields
+# 170228-2255 - Changes to allow URLs in SCRIPT field types
+# 170301-0828 - Enabled required custom fields with INBOUND_ONLY option
+# 170321-1554 - Fixed list view permissions issue #1005
# 170409-1558 - Added IP List validation code
# 171116-1544 - Added option for duplicate custom field entries(field_duplicate)
+# 180123-1817 - cleanup of enc code
#
-$admin_version = '2.14-37';
-$build = '171116-1544';
+$admin_version = '2.14-40';
+$build = '180123-1817';
require("dbconnect_mysqli.php");
require("functions.php");
@@ -94,6 +97,10 @@ if (isset($_GET["multi_position"])) {$multi_position=$_GET["multi_position"];
elseif (isset($_POST["multi_position"])) {$multi_position=$_POST["multi_position"];}
if (isset($_GET["field_order"])) {$field_order=$_GET["field_order"];}
elseif (isset($_POST["field_order"])) {$field_order=$_POST["field_order"];}
+if (isset($_GET["field_encrypt"])) {$field_encrypt=$_GET["field_encrypt"];}
+ elseif (isset($_POST["field_encrypt"])) {$field_encrypt=$_POST["field_encrypt"];}
+if (isset($_GET["field_show_hide"])) {$field_show_hide=$_GET["field_show_hide"];}
+ elseif (isset($_POST["field_show_hide"])) {$field_show_hide=$_POST["field_show_hide"];}
if (isset($_GET["field_duplicate"])) {$field_duplicate=$_GET["field_duplicate"];}
elseif (isset($_POST["field_duplicate"])) {$field_duplicate=$_POST["field_duplicate"];}
if (isset($_GET["source_list_id"])) {$source_list_id=$_GET["source_list_id"];}
@@ -107,7 +114,7 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
-$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active,custom_fields_enabled,enable_languages,language_method FROM system_settings;";
+$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active,custom_fields_enabled,enable_languages,language_method,active_modules FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysqli_num_rows($rslt);
@@ -121,6 +128,7 @@ if ($qm_conf_ct > 0)
$SScustom_fields_enabled = $row[4];
$SSenable_languages = $row[5];
$SSlanguage_method = $row[6];
+ $SSactive_modules = $row[7];
}
##### END SETTINGS LOOKUP #####
###########################################
@@ -152,6 +160,7 @@ if ($non_latin < 1)
$source_list_id = preg_replace('/[^0-9]/','',$source_list_id);
$field_required = preg_replace('/[^_A-Z]/','',$field_required);
+ $field_encrypt = preg_replace('/[^NY]/','',$field_encrypt);
$field_duplicate = preg_replace('/[^_A-Z]/','',$field_duplicate);
$field_type = preg_replace('/[^0-9a-zA-Z]/','',$field_type);
@@ -161,6 +170,7 @@ if ($non_latin < 1)
$field_label = preg_replace('/[^_0-9a-zA-Z]/','',$field_label);
$copy_option = preg_replace('/[^_0-9a-zA-Z]/','',$copy_option);
+ $field_show_hide = preg_replace('/[^_0-9a-zA-Z]/','',$field_show_hide);
$field_name = preg_replace('/[^ \.\,-\_0-9a-zA-Z]/','',$field_name);
$field_description = preg_replace('/[^ \.\,-\_0-9a-zA-Z]/','',$field_description);
@@ -273,6 +283,12 @@ if ( (!preg_match('/\-ALL/i', $LOGallowed_campaigns)) )
}
$regexLOGallowed_campaigns = " $LOGallowed_campaigns ";
+# check if cf_enrcypt enabled
+$hide_enc=0;
+if (!preg_match("/cf_encrypt/",$SSactive_modules))
+ {
+ $hide_enc=1;
+ }
?>
@@ -350,6 +366,10 @@ $lists_color = '#FFFF99';
$lists_font = 'BLACK';
$lists_color = '#E6E6E6';
$subcamp_color = '#C6C6C6';
+$Msubhead_color = '#E6E6E6';
+$Mselected_color = '#C6C6C6';
+$Mhead_color = '#A3C3D6';
+$Mmain_bgcolor = '#015B91';
##### END Set variables to make header show properly #####
require("admin_header.php");
@@ -373,7 +393,7 @@ $NWE = "')\"> 0)
{
-echo "$DB,$action,$ip,$user,$copy_option,$field_id,$list_id,$source_list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_duplicate";
+echo "$DB,$action,$ip,$user,$copy_option,$field_id,$list_id,$source_list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_encrypt,$field_show_hide,$field_duplicate";
}
@@ -499,7 +519,7 @@ if ( ($action == "COPY_FIELDS_SUBMIT") and ($list_id > 99) and ($source_list_id
while ($fields_to_print > $o)
{
### delete field function
- $SQLsuccess = delete_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$A_field_id[$o],$list_id,$A_field_label[$o],$A_field_name[$o],$A_field_description[$o],$A_field_rank[$o],$A_field_help[$o],$A_field_type[$o],$A_field_options[$o],$A_field_size[$o],$A_field_max[$o],$A_field_default[$o],$A_field_required[$o],$A_field_cost[$o],$A_multi_position[$o],$A_name_position[$o],$A_field_order[$o],$A_field_duplicate[$o],$vicidial_list_fields);
+ $SQLsuccess = delete_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$A_field_id[$o],$list_id,$A_field_label[$o],$A_field_name[$o],$A_field_description[$o],$A_field_rank[$o],$A_field_help[$o],$A_field_type[$o],$A_field_options[$o],$A_field_size[$o],$A_field_max[$o],$A_field_default[$o],$A_field_required[$o],$A_field_cost[$o],$A_multi_position[$o],$A_name_position[$o],$A_field_order[$o],$A_field_encrypt[$o],$A_field_show_hide[$o],$A_field_duplicate[$o],$vicidial_list_fields);
if ($SQLsuccess > 0)
{echo _QXZ("SUCCESS: Custom Field Deleted")." - $list_id|$A_field_label[$o]\n ";}
@@ -512,7 +532,7 @@ if ( ($action == "COPY_FIELDS_SUBMIT") and ($list_id > 99) and ($source_list_id
if ($copy_option=='APPEND')
{
if ($DB > 0) {echo _QXZ("Starting APPEND copy")."\n ";}
- $stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order,field_duplicate from vicidial_lists_fields where list_id='$source_list_id' order by field_rank,field_order,field_label;";
+ $stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order,field_encrypt,field_show_hide,field_duplicate from vicidial_lists_fields where list_id='$source_list_id' order by field_rank,field_order,field_label;";
$rslt=mysql_to_mysqli($stmt, $link);
$fields_to_print = mysqli_num_rows($rslt);
$fields_list='';
@@ -536,7 +556,9 @@ if ( ($action == "COPY_FIELDS_SUBMIT") and ($list_id > 99) and ($source_list_id
$A_multi_position[$o] = $rowx[13];
$A_name_position[$o] = $rowx[14];
$A_field_order[$o] = $rowx[15];
- $A_field_duplicate[$o] = $rowx[16];
+ $A_field_encrypt[$o] = $rowx[16];
+ $A_field_show_hide[$o] = $rowx[17];
+ $A_field_duplicate[$o] = $rowx[18];
$o++;
$rank_select .= "$o ";
@@ -580,7 +602,7 @@ if ( ($action == "COPY_FIELDS_SUBMIT") and ($list_id > 99) and ($source_list_id
}
### add field function
- $SQLsuccess = add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$A_field_id[$o],$list_id,$A_field_label[$o],$A_field_name[$o],$A_field_description[$o],$A_field_rank[$o],$A_field_help[$o],$A_field_type[$o],$A_field_options[$o],$A_field_size[$o],$A_field_max[$o],$A_field_default[$o],$A_field_required[$o],$A_field_cost[$o],$A_multi_position[$o],$A_name_position[$o],$A_field_order[$o],$A_field_duplicate[$o],$vicidial_list_fields,$mysql_reserved_words);
+ $SQLsuccess = add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$A_field_id[$o],$list_id,$A_field_label[$o],$A_field_name[$o],$A_field_description[$o],$A_field_rank[$o],$A_field_help[$o],$A_field_type[$o],$A_field_options[$o],$A_field_size[$o],$A_field_max[$o],$A_field_default[$o],$A_field_required[$o],$A_field_cost[$o],$A_multi_position[$o],$A_name_position[$o],$A_field_order[$o],$A_field_encrypt[$o],$A_field_show_hide[$o],$A_field_duplicate[$o],$vicidial_list_fields,$mysql_reserved_words);
if ($SQLsuccess > 0)
{echo _QXZ("SUCCESS: Custom Field Added")." - $list_id|$A_field_label[$o]\n ";}
@@ -602,7 +624,7 @@ if ( ($action == "COPY_FIELDS_SUBMIT") and ($list_id > 99) and ($source_list_id
{echo ""._QXZ("ERROR: Table does not exist")." custom_$list_id \n ";}
else
{
- $stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order,field_duplicate from vicidial_lists_fields where list_id='$source_list_id' order by field_rank,field_order,field_label;";
+ $stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order,field_encrypt,field_show_hide,field_duplicate from vicidial_lists_fields where list_id='$source_list_id' order by field_rank,field_order,field_label;";
$rslt=mysql_to_mysqli($stmt, $link);
$fields_to_print = mysqli_num_rows($rslt);
$fields_list='';
@@ -626,6 +648,9 @@ if ( ($action == "COPY_FIELDS_SUBMIT") and ($list_id > 99) and ($source_list_id
$A_multi_position[$o] = $rowx[13];
$A_name_position[$o] = $rowx[14];
$A_field_order[$o] = $rowx[15];
+ $A_field_encrypt[$o] = $rowx[16];
+ $A_field_show_hide[$o] = $rowx[17];
+ $A_field_duplicate[$o] = $rowx[18];
$o++;
}
@@ -642,7 +667,7 @@ if ( ($action == "COPY_FIELDS_SUBMIT") and ($list_id > 99) and ($source_list_id
$current_field_id = $rowx[0];
### modify field function
- $SQLsuccess = modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$current_field_id,$list_id,$A_field_label[$o],$A_field_name[$o],$A_field_description[$o],$A_field_rank[$o],$A_field_help[$o],$A_field_type[$o],$A_field_options[$o],$A_field_size[$o],$A_field_max[$o],$A_field_default[$o],$A_field_required[$o],$A_field_cost[$o],$A_multi_position[$o],$A_name_position[$o],$A_field_order[$o],$A_field_duplicate[$o],$vicidial_list_fields);
+ $SQLsuccess = modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$current_field_id,$list_id,$A_field_label[$o],$A_field_name[$o],$A_field_description[$o],$A_field_rank[$o],$A_field_help[$o],$A_field_type[$o],$A_field_options[$o],$A_field_size[$o],$A_field_max[$o],$A_field_default[$o],$A_field_required[$o],$A_field_cost[$o],$A_multi_position[$o],$A_name_position[$o],$A_field_order[$o],$A_field_encrypt[$o],$A_field_show_hide[$o],$A_field_duplicate[$o],$vicidial_list_fields);
if ($SQLsuccess > 0)
{echo _QXZ("SUCCESS: Custom Field Modified")." - $list_id|$A_field_label[$o]\n ";}
@@ -716,6 +741,7 @@ if ( ($action == "DELETE_CUSTOM_FIELD") and ($list_id > 99) and ($field_id > 0)
die('MySQL '._QXZ("connect ERROR").': '. mysqli_connect_error());
}
+
$stmt="SELECT count(*) from vicidial_lists_fields where list_id='$list_id' and field_label='$field_label';";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_to_mysqli($stmt, $link);
@@ -742,7 +768,8 @@ if ( ($action == "DELETE_CUSTOM_FIELD") and ($list_id > 99) and ($field_id > 0)
else
{
### delete field function
- $SQLsuccess = delete_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_duplicate,$vicidial_list_fields);
+ $SQLsuccess = delete_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_encrypt,$field_show_hide,$field_duplicate,$vicidial_list_fields);
+ if ($DB) {echo "delete_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_encrypt,$field_show_hide,$field_duplicate,$vicidial_list_fields); \n";}
if ($SQLsuccess > 0)
{echo _QXZ("SUCCESS: Custom Field Deleted")." - $list_id|$field_label\n ";}
@@ -854,7 +881,7 @@ if ( ($action == "ADD_CUSTOM_FIELD") and ($list_id > 99) )
}
### add field function
- $SQLsuccess = add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_duplicate,$vicidial_list_fields,$mysql_reserved_words);
+ $SQLsuccess = add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_encrypt,$field_show_hide,$field_duplicate,$vicidial_list_fields,$mysql_reserved_words);
if ($SQLsuccess > 0)
{echo _QXZ("SUCCESS: Custom Field Added")." - $list_id|$field_label\n ";}
@@ -944,7 +971,7 @@ if ( ($action == "MODIFY_CUSTOM_FIELD_SUBMIT") and ($list_id > 99) and ($field_i
else
{
### modify field function
- $SQLsuccess = modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_duplicate,$vicidial_list_fields);
+ $SQLsuccess = modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_encrypt,$field_show_hide,$field_duplicate,$vicidial_list_fields);
if ($SQLsuccess > 0)
{echo _QXZ("SUCCESS: Custom Field Modified")." - $list_id|$field_label\n ";}
@@ -1010,7 +1037,7 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
echo _QXZ("Records in this custom table").": $custom_records_count \n";
echo "\n";
- $stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order,field_duplicate from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;";
+ $stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order,field_encrypt,field_show_hide,field_duplicate from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;";
$rslt=mysql_to_mysqli($stmt, $link);
$fields_to_print = mysqli_num_rows($rslt);
$fields_list='';
@@ -1034,7 +1061,9 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
$A_multi_position[$o] = $rowx[13];
$A_name_position[$o] = $rowx[14];
$A_field_order[$o] = $rowx[15];
- $A_field_duplicate[$o] = $rowx[16];
+ $A_field_encrypt[$o] = $rowx[16];
+ $A_field_show_hide[$o] = $rowx[17];
+ $A_field_duplicate[$o] = $rowx[18];
$o++;
$rank_select .= "$o ";
@@ -1047,14 +1076,19 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
echo " "._QXZ("SUMMARY OF FIELDS").":\n";
echo "\n";
echo "";
- echo ""._QXZ("RANK")." ";
- echo ""._QXZ("LABEL")." ";
- echo ""._QXZ("NAME")." ";
- echo ""._QXZ("TYPE")." ";
- echo ""._QXZ("COST")." \n";
+ echo ""._QXZ("RANK")." ";
+ echo ""._QXZ("LABEL")." ";
+ echo ""._QXZ("NAME")." ";
+ echo ""._QXZ("TYPE")." ";
+ if ($hide_enc < 1)
+ {
+ echo ""._QXZ("ENC")." ";
+ }
+ echo ""._QXZ("COST")." \n";
echo " \n";
$o=0;
+ $total_enc=0;
while ($fields_to_print > $o)
{
$LcolorB=''; $LcolorE='';
@@ -1077,8 +1111,13 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
echo " $LcolorB$A_field_label[$o]$LcolorE ";
echo " $A_field_name[$o] ";
echo " $A_field_type[$o] ";
+ if ($hide_enc < 1)
+ {
+ echo " $A_field_encrypt[$o] ";
+ }
echo " $A_field_cost[$o] \n";
+ if ($A_field_encrypt[$o] == 'Y') {$total_enc++;}
$total_cost = ($total_cost + $A_field_cost[$o]);
$o++;
}
@@ -1091,6 +1130,10 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
echo " $o ";
echo " ";
echo " ";
+ if ($hide_enc < 1)
+ {
+ echo " $total_enc ";
+ }
echo " $total_cost \n";
}
echo "
\n";
@@ -1136,6 +1179,9 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
}
$field_HTML='';
+ $encrypt_icon='';
+ if ($A_field_encrypt[$o] == 'Y')
+ {$encrypt_icon = " ";}
if ($A_field_type[$o]=='SELECT')
{
$field_HTML .= "\n";
@@ -1180,11 +1226,36 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
if ($A_field_type[$o]=='TEXT')
{
if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';}
- $field_HTML .= " \n";
+ if ($A_field_show_hide[$o] != 'DISABLED')
+ {
+ $field_temp_val = $A_field_default[$o];
+ $field_orig_val = $A_field_default[$o];
+ if (strlen($field_temp_val) > 0)
+ {
+ if ($A_field_show_hide[$o] == 'LAST_4')
+ {$A_field_default[$o] = str_repeat("X", (strlen($field_temp_val) - 4)) . substr($field_temp_val,-4,4);}
+ elseif ($A_field_show_hide[$o] == 'LAST_3')
+ {$A_field_default[$o] = str_repeat("X", (strlen($field_temp_val) - 3)) . substr($field_temp_val,-3,3);}
+ elseif ($A_field_show_hide[$o] == 'LAST_2')
+ {$A_field_default[$o] = str_repeat("X", (strlen($field_temp_val) - 2)) . substr($field_temp_val,-2,2);}
+ elseif ($A_field_show_hide[$o] == 'LAST_1')
+ {$A_field_default[$o] = str_repeat("X", (strlen($field_temp_val) - 1)) . substr($field_temp_val,-1,1);}
+ elseif ($A_field_show_hide[$o] == 'FIRST_1_LAST_4')
+ {$A_field_default[$o] = substr($field_temp_val,0,1) . str_repeat("X", (strlen($field_temp_val) - 5)) . substr($field_temp_val,-4,4);}
+ else # X_OUT_ALL
+ {$A_field_default[$o] = preg_replace("/./",'X',$field_temp_val);}
+ }
+ $field_HTML .= _QXZ("$A_field_default[$o]")." "._QXZ("Overwrite").": $encrypt_icon\n";
+ $A_field_default[$o] = $field_orig_val;
+ }
+ else
+ {
+ $field_HTML .= " $encrypt_icon\n";
+ }
}
if ($A_field_type[$o]=='AREA')
{
- $field_HTML .= "";
+ $field_HTML .= "$encrypt_icon";
}
if ($A_field_type[$o]=='DISPLAY')
{
@@ -1194,7 +1265,31 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
if ($A_field_type[$o]=='READONLY')
{
if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';}
- $field_HTML .= "$A_field_default[$o]\n";
+
+ if ($A_field_show_hide[$o] != 'DISABLED')
+ {
+ $field_temp_val = $A_field_default[$o];
+ if (strlen($field_temp_val) > 0)
+ {
+ if ($A_field_show_hide[$o] == 'LAST_4')
+ {$A_field_default[$o] = str_repeat("X", (strlen($field_temp_val) - 4)) . substr($field_temp_val,-4,4);}
+ elseif ($A_field_show_hide[$o] == 'LAST_3')
+ {$A_field_default[$o] = str_repeat("X", (strlen($field_temp_val) - 3)) . substr($field_temp_val,-3,3);}
+ elseif ($A_field_show_hide[$o] == 'LAST_2')
+ {$A_field_default[$o] = str_repeat("X", (strlen($field_temp_val) - 2)) . substr($field_temp_val,-2,2);}
+ elseif ($A_field_show_hide[$o] == 'LAST_1')
+ {$A_field_default[$o] = str_repeat("X", (strlen($field_temp_val) - 1)) . substr($field_temp_val,-1,1);}
+ elseif ($A_field_show_hide[$o] == 'FIRST_1_LAST_4')
+ {$A_field_default[$o] = substr($field_temp_val,0,1) . str_repeat("X", (strlen($field_temp_val) - 5)) . substr($field_temp_val,-4,4);}
+ else # X_OUT_ALL
+ {$A_field_default[$o] = preg_replace("/./",'X',$field_temp_val);}
+ }
+ $field_HTML .= "$A_field_default[$o]$encrypt_icon\n";
+ }
+ else
+ {
+ $field_HTML .= "$A_field_default[$o]$encrypt_icon\n";
+ }
}
if ($A_field_type[$o]=='HIDDEN')
{
@@ -1223,7 +1318,7 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
$field_HTML .= " 'formname': 'form_custom_$list_id',\n";
$field_HTML .= " 'controlname': '$A_field_label[$o]'});\n";
$field_HTML .= "o_cal.a_tpl.yearscroll = false;\n";
- $field_HTML .= "\n";
+ $field_HTML .= "$encrypt_icon\n";
}
if ($A_field_type[$o]=='TIME')
{
@@ -1273,7 +1368,7 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
$field_HTML .= "50 ";
$field_HTML .= "55 ";
$field_HTML .= "$default_minute ";
- $field_HTML .= " ";
+ $field_HTML .= "$encrypt_icon";
}
if ($A_name_position[$o]=='LEFT')
@@ -1377,6 +1472,40 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
echo "$A_field_required[$o] \n";
echo " $NWB#lists_fields-field_required$NWE \n";
echo ""._QXZ("Field Duplicate")." $A_field_rank[$o]: $A_field_duplicate[$o] $NWB#lists_fields-field_duplicate$NWE \n";
+ if ($hide_enc < 1)
+ {
+ if ( ($custom_records_count < 1) and ( ($A_field_type[$o]=='TEXT') or ($A_field_type[$o]=='HIDDEN') or ($A_field_type[$o]=='READONLY') or ($A_field_type[$o]=='HIDEBLOB') or ($A_field_type[$o]=='AREA') or ($A_field_type[$o]=='DATE') or ($A_field_type[$o]=='TIME') ) )
+ {
+ echo ""._QXZ("Field Encrypt")." $A_field_rank[$o]: \n";
+ echo "YES \n";
+ echo "NO \n";
+ echo "$A_field_encrypt[$o] \n";
+ echo " $NWB#lists_fields-field_encrypt$NWE \n";
+ }
+ else
+ {
+ echo ""._QXZ("Field Encrypt")." $A_field_rank[$o]: $A_field_encrypt[$o]\n";
+ echo " $NWB#lists_fields-field_encrypt$NWE \n";
+ }
+ echo ""._QXZ("Field Show Hide").": \n";
+ echo "DISABLED \n";
+ echo "X_OUT_ALL \n";
+ echo "LAST_1 \n";
+ echo "LAST_2 \n";
+ echo "LAST_3 \n";
+ echo "LAST_4 \n";
+ echo "FIRST_1_LAST_4 \n";
+ echo "$A_field_show_hide[$o] \n";
+ echo " $NWB#lists_fields-field_show_hide$NWE \n";
+ }
+ else
+ {
+ echo "\n";
+ echo " \n";
+ echo " \n";
+ echo " \n";
+ }
+
echo " \n";
echo ""._QXZ("DELETE THIS CUSTOM FIELD")." ";
echo " \n";
@@ -1446,6 +1575,29 @@ if ( ($action == "MODIFY_CUSTOM_FIELDS") and ($list_id > 99) )
echo ""._QXZ("NO")." \n";
echo ""._QXZ("YES")." \n";
echo " $NWB#lists_fields-field_duplicate$NWE \n";
+ if ($hide_enc < 1)
+ {
+ echo ""._QXZ("Field Encrypt").": \n";
+ echo "YES \n";
+ echo "NO \n";
+ echo " $NWB#lists_fields-field_encrypt$NWE \n";
+ echo ""._QXZ("Field Show Hide").": \n";
+ echo "DISABLED \n";
+ echo "X_OUT_ALL \n";
+ echo "LAST_1 \n";
+ echo "LAST_2 \n";
+ echo "LAST_3 \n";
+ echo "LAST_4 \n";
+ echo "FIRST_1_LAST_4 \n";
+ echo " $NWB#lists_fields-field_show_hide$NWE \n";
+ }
+ else
+ {
+ echo "\n";
+ echo " \n";
+ echo " \n";
+ echo " \n";
+ }
echo " \n";
echo "
\n";
echo " \n";
@@ -1632,7 +1784,7 @@ echo "\n\n\n \n "._QXZ("runtime").": $RUNtime "._QXZ("se
################################################################################
##### BEGIN add field function
-function add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_duplicate,$vicidial_list_fields,$mysql_reserved_words)
+function add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_encrypt,$field_show_hide,$field_duplicate,$vicidial_list_fields,$mysql_reserved_words)
{
$table_exists=0;
$stmt="SHOW TABLES LIKE \"custom_$list_id\";";
@@ -1647,6 +1799,15 @@ function add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field
else
{$field_sql = "ALTER TABLE custom_$list_id ADD $field_label ";}
+ if ($field_encrypt=='Y')
+ {
+ # override encrypt setting for non-encryptable field types
+ if ( ( ($field_type!='TEXT') and ($field_type!='HIDDEN') and ($field_type!='READONLY') and ($field_type!='HIDEBLOB') and ($field_type!='AREA') and ($field_type!='DATE') and ($field_type!='TIME') ) or ($field_duplicate=='Y') )
+ {
+ $field_encrypt='N';
+ }
+ }
+
$field_options_ENUM='';
$field_cost=1;
if ( ($field_type=='SELECT') or ($field_type=='RADIO') )
@@ -1689,8 +1850,14 @@ function add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field
if ( ($field_type=='TEXT') or ($field_type=='HIDDEN') or ($field_type=='READONLY') )
{
if ($field_max < 1) {$field_max=1;};
- $field_sql .= "VARCHAR($field_max) ";
- $field_cost = ($field_max + $field_cost);
+ $field_maxSQL = $field_max;
+ if ($field_encrypt == 'Y')
+ {
+ if ($field_max < 8) {$field_maxSQL=30;}
+ else {$field_maxSQL = ($field_max * 4);}
+ }
+ $field_sql .= "VARCHAR($field_maxSQL) ";
+ $field_cost = ($field_maxSQL + $field_cost);
}
if ($field_type=='HIDEBLOB')
{
@@ -1704,18 +1871,37 @@ function add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field
}
if ($field_type=='DATE')
{
- $field_sql .= "DATE ";
- $field_cost = 10;
+ if ($field_encrypt == 'Y')
+ {
+ $field_sql .= "VARCHAR(30) ";
+ $field_cost = 31;
+ }
+ else
+ {
+ $field_sql .= "DATE ";
+ $field_cost = 10;
+ }
}
if ($field_type=='TIME')
{
- $field_sql .= "TIME ";
- $field_cost = 8;
+ if ($field_encrypt == 'Y')
+ {
+ $field_sql .= "VARCHAR(30) ";
+ $field_cost = 31;
+ }
+ else
+ {
+ $field_sql .= "TIME ";
+ $field_cost = 8;
+ }
}
$field_cost = ($field_cost * 3); # account for utf8 database
if ( ($field_default != 'NULL') and ($field_type!='AREA') and ($field_type!='DATE') and ($field_type!='TIME') )
- {$field_sql .= "default '$field_default'";}
+ {
+ if ( ($field_encrypt=='N') or ( ($field_encrypt=='Y') and ($field_type!='TEXT') and ($field_type!='HIDDEN') and ($field_type!='READONLY') and ($field_type!='HIDEBLOB') ) )
+ {$field_sql .= "default '$field_default'";}
+ }
if ($table_exists < 1)
{$field_sql .= ");";}
@@ -1757,7 +1943,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',field_duplicate='$field_duplicate';";
+ $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',field_encrypt='$field_encrypt',field_show_hide='$field_show_hide',field_duplicate='$field_duplicate';";
$rslt=mysql_to_mysqli($stmt, $link);
$field_update = mysqli_affected_rows($link);
if ($DB) {echo "$field_update|$stmt\n";}
@@ -1782,7 +1968,7 @@ function add_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field
################################################################################
##### BEGIN modify field function
-function modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_duplicate,$vicidial_list_fields)
+function modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_encrypt,$field_show_hide,$field_duplicate,$vicidial_list_fields)
{
$field_db_exists=0;
if ( ($field_type=='DISPLAY') or ($field_type=='SCRIPT') or (preg_match("/\|$field_label\|/i",$vicidial_list_fields)) or ($field_duplicate=='Y') )
@@ -1801,6 +1987,14 @@ function modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$fi
if ($field_duplicate=='Y')
{$field_type='TEXT';}
+ if ($field_encrypt=='Y')
+ {
+ # override encrypt setting for non-encryptable field types
+ if ( ( ($field_type!='TEXT') and ($field_type!='HIDDEN') and ($field_type!='READONLY') and ($field_type!='HIDEBLOB') and ($field_type!='AREA') and ($field_type!='DATE') and ($field_type!='TIME') ) or ($field_duplicate=='Y') )
+ {
+ $field_encrypt='N';
+ }
+ }
$field_options_ENUM='';
$field_cost=1;
@@ -1842,8 +2036,15 @@ function modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$fi
}
if ( ($field_type=='TEXT') or ($field_type=='HIDDEN') or ($field_type=='READONLY') )
{
- $field_sql .= "VARCHAR($field_max) ";
- $field_cost = ($field_max + $field_cost);
+ if ($field_max < 1) {$field_max=1;};
+ $field_maxSQL = $field_max;
+ if ($field_encrypt == 'Y')
+ {
+ if ($field_max < 8) {$field_maxSQL=30;}
+ else {$field_maxSQL = ($field_max * 4);}
+ }
+ $field_sql .= "VARCHAR($field_maxSQL) ";
+ $field_cost = ($field_maxSQL + $field_cost);
}
if ($field_type=='HIDEBLOB')
{
@@ -1857,20 +2058,41 @@ function modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$fi
}
if ($field_type=='DATE')
{
- $field_sql .= "DATE ";
- $field_cost = 10;
+ if ($field_encrypt == 'Y')
+ {
+ $field_sql .= "VARCHAR(30) ";
+ $field_cost = 31;
+ }
+ else
+ {
+ $field_sql .= "DATE ";
+ $field_cost = 10;
+ }
}
if ($field_type=='TIME')
{
- $field_sql .= "TIME ";
- $field_cost = 8;
+ if ($field_encrypt == 'Y')
+ {
+ $field_sql .= "VARCHAR(30) ";
+ $field_cost = 31;
+ }
+ else
+ {
+ $field_sql .= "TIME ";
+ $field_cost = 8;
+ }
}
$field_cost = ($field_cost * 3); # account for utf8 database
if ( ($field_default == 'NULL') or ($field_type=='AREA') or ($field_type=='DATE') or ($field_type=='TIME') )
{$field_sql .= ";";}
else
- {$field_sql .= "default '$field_default';";}
+ {
+ if ( ($field_encrypt=='N') or ( ($field_encrypt=='Y') and ($field_type!='TEXT') and ($field_type!='HIDDEN') and ($field_type!='READONLY') and ($field_type!='HIDEBLOB') ) )
+ {$field_sql .= "default '$field_default';";}
+ else
+ {$field_sql .= ";";}
+ }
$SQLexecuted=0;
@@ -1900,7 +2122,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',field_duplicate='$field_duplicate' 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',field_encrypt='$field_encrypt',field_show_hide='$field_show_hide',field_duplicate='$field_duplicate' 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";}
@@ -1925,7 +2147,7 @@ function modify_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$fi
################################################################################
##### BEGIN delete field function
-function delete_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_duplicate,$vicidial_list_fields)
+function delete_field_function($DB,$link,$linkCUSTOM,$ip,$user,$table_exists,$field_id,$list_id,$field_label,$field_name,$field_description,$field_rank,$field_help,$field_type,$field_options,$field_size,$field_max,$field_default,$field_required,$field_cost,$multi_position,$name_position,$field_order,$field_encrypt,$field_show_hide,$field_duplicate,$vicidial_list_fields)
{
$SQLexecuted=0;
diff --git a/agc_2-X/trunk/www/vicidial/admin_soundboard.php b/agc_2-X/trunk/www/vicidial/admin_soundboard.php
index 0d2640b6..6a82e983 100644
--- a/agc_2-X/trunk/www/vicidial/admin_soundboard.php
+++ b/agc_2-X/trunk/www/vicidial/admin_soundboard.php
@@ -166,8 +166,6 @@ $browser = getenv("HTTP_USER_AGENT");
$user = $PHP_AUTH_USER;
$admin_lists_custom = 'admin_lists_custom.php';
-if (preg_match("/cf_encrypt/",$SSactive_modules))
- {$admin_lists_custom = 'admin_lists_custom_encrypt.php';}
if (file_exists('options.php'))
{require('options.php');}
diff --git a/agc_2-X/trunk/www/vicidial/list_split.php b/agc_2-X/trunk/www/vicidial/list_split.php
index e221aed7..5d880ebd 100644
--- a/agc_2-X/trunk/www/vicidial/list_split.php
+++ b/agc_2-X/trunk/www/vicidial/list_split.php
@@ -439,8 +439,6 @@ if ($confirm == "confirm")
if ( $cf_chk_count > 0 )
{
$admin_lists_custom = 'admin_lists_custom.php';
- if (preg_match("/cf_encrypt/",$SSactive_modules))
- {$admin_lists_custom = 'admin_lists_custom_encrypt.php';}
$url = "http" . (isset($_SERVER['HTTPS']) ? 's' : '') . "://$_SERVER[HTTP_HOST]/vicidial/" . $admin_lists_custom . "?action=COPY_FIELDS_SUBMIT&list_id=$new_list_id&source_list_id=$orig_list©_option=APPEND";
diff --git a/agc_2-X/trunk/www/vicidial/process_report.php b/agc_2-X/trunk/www/vicidial/process_report.php
new file mode 100644
index 00000000..ce296ace
--- /dev/null
+++ b/agc_2-X/trunk/www/vicidial/process_report.php
@@ -0,0 +1,314 @@
+ LICENSE: AGPLv2
+#
+# CHANGES
+# 180114-1051 - First build
+#
+
+$startMS = microtime();
+
+$report_name='Process Report';
+
+require("dbconnect_mysqli.php");
+require("functions.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
+ elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
+if (isset($_GET["group"])) {$group=$_GET["group"];}
+ elseif (isset($_POST["group"])) {$group=$_POST["group"];}
+if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
+ elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
+ elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
+
+#############################################
+##### START SYSTEM_SETTINGS LOOKUP #####
+$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active,enable_languages,language_method FROM system_settings;";
+$rslt=mysql_to_mysqli($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$qm_conf_ct = mysqli_num_rows($rslt);
+if ($qm_conf_ct > 0)
+ {
+ $row=mysqli_fetch_row($rslt);
+ $non_latin = $row[0];
+ $webroot_writable = $row[1];
+ $SSoutbound_autodial_active = $row[2];
+ $user_territories_active = $row[3];
+ $SSenable_languages = $row[4];
+ $SSlanguage_method = $row[5];
+ }
+##### END SETTINGS LOOKUP #####
+###########################################
+
+if ($non_latin < 1)
+ {
+ $PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER);
+ $PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_PW);
+ }
+else
+ {
+ $PHP_AUTH_PW = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_PW);
+ $PHP_AUTH_USER = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_USER);
+ }
+
+$stmt="SELECT selected_language from vicidial_users where user='$PHP_AUTH_USER';";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+$sl_ct = mysqli_num_rows($rslt);
+if ($sl_ct > 0)
+ {
+ $row=mysqli_fetch_row($rslt);
+ $VUselected_language = $row[0];
+ }
+
+$auth=0;
+$reports_auth=0;
+$admin_auth=0;
+$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'',1,0);
+if ($auth_message == 'GOOD')
+ {$auth=1;}
+
+if ($auth > 0)
+ {
+ $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 7 and view_reports='1';";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $row=mysqli_fetch_row($rslt);
+ $admin_auth=$row[0];
+
+ $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 6 and view_reports='1';";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $row=mysqli_fetch_row($rslt);
+ $reports_auth=$row[0];
+
+ if ($reports_auth < 1)
+ {
+ $VDdisplayMESSAGE = _QXZ("You are not allowed to view reports");
+ Header ("Content-type: text/html; charset=utf-8");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
+ exit;
+ }
+ if ( ($reports_auth > 0) and ($admin_auth < 1) )
+ {
+ $ADD=999999;
+ $reports_only_user=1;
+ }
+ }
+else
+ {
+ $VDdisplayMESSAGE = _QXZ("Login incorrect, please try again");
+ if ($auth_message == 'LOCK')
+ {
+ $VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes");
+ Header ("Content-type: text/html; charset=utf-8");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
+ exit;
+ }
+ if ($auth_message == 'IPBLOCK')
+ {
+ $VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip";
+ Header ("Content-type: text/html; charset=utf-8");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
+ exit;
+ }
+ Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\"");
+ Header("HTTP/1.0 401 Unauthorized");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n";
+ exit;
+ }
+
+$stmt="SELECT view_reports,user_group from vicidial_users where user='$PHP_AUTH_USER';";
+$rslt=mysql_to_mysqli($stmt, $link);
+$row=mysqli_fetch_row($rslt);
+$LOGview_reports = $row[0];
+$LOGuser_group = $row[1];
+
+if ($LOGview_reports < 1)
+ {
+ Header ("Content-type: text/html; charset=utf-8");
+ echo _QXZ("You do not have permissions for process report viewing").": |$PHP_AUTH_USER|\n";
+ exit;
+ }
+
+
+##### BEGIN log visit to the vicidial_report_log table #####
+$LOGip = getenv("REMOTE_ADDR");
+$LOGbrowser = getenv("HTTP_USER_AGENT");
+$LOGscript_name = getenv("SCRIPT_NAME");
+$LOGserver_name = getenv("SERVER_NAME");
+$LOGserver_port = getenv("SERVER_PORT");
+$LOGrequest_uri = getenv("REQUEST_URI");
+$LOGhttp_referer = getenv("HTTP_REFERER");
+$LOGbrowser=preg_replace("/\'|\"|\\\\/","",$LOGbrowser);
+$LOGrequest_uri=preg_replace("/\'|\"|\\\\/","",$LOGrequest_uri);
+$LOGhttp_referer=preg_replace("/\'|\"|\\\\/","",$LOGhttp_referer);
+if (preg_match("/443/i",$LOGserver_port)) {$HTTPprotocol = 'https://';}
+ else {$HTTPprotocol = 'http://';}
+if (($LOGserver_port == '80') or ($LOGserver_port == '443') ) {$LOGserver_port='';}
+else {$LOGserver_port = ":$LOGserver_port";}
+$LOGfull_url = "$HTTPprotocol$LOGserver_name$LOGserver_port$LOGrequest_uri";
+
+$LOGhostname = php_uname('n');
+if (strlen($LOGhostname)<1) {$LOGhostname='X';}
+if (strlen($LOGserver_name)<1) {$LOGserver_name='X';}
+
+$stmt="SELECT webserver_id FROM vicidial_webservers where webserver='$LOGserver_name' and hostname='$LOGhostname' LIMIT 1;";
+$rslt=mysql_to_mysqli($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$webserver_id_ct = mysqli_num_rows($rslt);
+if ($webserver_id_ct > 0)
+ {
+ $row=mysqli_fetch_row($rslt);
+ $webserver_id = $row[0];
+ }
+else
+ {
+ ##### insert webserver entry
+ $stmt="INSERT INTO vicidial_webservers (webserver,hostname) values('$LOGserver_name','$LOGhostname');";
+ if ($DB) {echo "$stmt\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $affected_rows = mysqli_affected_rows($link);
+ $webserver_id = mysqli_insert_id($link);
+ }
+
+$stmt="INSERT INTO vicidial_report_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$LOGip', report_name='$report_name', browser='$LOGbrowser', referer='$LOGhttp_referer', notes='$LOGserver_name:$LOGserver_port $LOGscript_name', url='$LOGfull_url', webserver='$webserver_id';";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+$report_log_id = mysqli_insert_id($link);
+##### END log visit to the vicidial_report_log table #####
+
+if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
+ {
+ mysqli_close($link);
+ $use_slave_server=1;
+ $db_source = 'S';
+ require("dbconnect_mysqli.php");
+ $MAIN.="\n";
+ }
+
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($group)) {$group = array();}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+if (!isset($server_ip)) {$server_ip = '10.10.10.15';}
+
+$stmt="select distinct(serial_id) from vicidial_process_log order by serial_id desc limit 1000;";
+$rslt=mysql_to_mysqli($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysqli_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+ {
+ $row=mysqli_fetch_row($rslt);
+ $campaign_id[$i] =$row[0];
+ $i++;
+ }
+?>
+
+
+
+
+
+\n";
+echo ""._QXZ("Process Report")." \n";
+
+ $short_header=1;
+
+ require("admin_header.php");
+
+echo "";
+echo "\n\n";
+
+echo "\n\n";
+
+if (!$group)
+ {
+ echo "\n\n";
+ echo _QXZ("PLEASE SELECT A SERIAL ABOVE AND CLICK SUBMIT")."\n";
+ }
+
+else
+ {
+ $stmt="select count(*),sum(run_sec),min(run_time),max(run_time) from vicidial_process_log where serial_id='" . mysqli_real_escape_string($link, $group) . "';";
+ $rslt=mysql_to_mysqli($stmt, $link);
+ if ($DB) {echo "$stmt\n";}
+ $row=mysqli_fetch_row($rslt);
+ $TOTALcalls = sprintf("%10s", $row[0]);
+
+ echo "\n";
+ echo "---------- "._QXZ("PROCESS REPORT FOR").": $group\n";
+ echo ""._QXZ("TIME RANGE").": $row[2] - $row[3]\n";
+# echo ""._QXZ("LENGTH").": $row[1] "._QXZ("seconds")."\n";
+ echo ""._QXZ("PROCESSES").": $row[0]\n";
+ echo "\n\n";
+
+ $stmt="select run_time,run_sec,server_ip,script,process,output_lines from vicidial_process_log where serial_id='" . mysqli_real_escape_string($link, $group) . "' order by run_time limit 1000;";
+ $rslt=mysql_to_mysqli($stmt, $link);
+ if ($DB) {echo "$stmt\n";}
+ $debugs_to_print = mysqli_num_rows($rslt);
+ $i=0;
+ while ($debugs_to_print > $i)
+ {
+ $row=mysqli_fetch_row($rslt);
+
+ echo _QXZ("TIME").": $row[0] "._QXZ("LENGTH").": $row[1] "._QXZ("SERVER").": $row[2]\n";
+ echo _QXZ("SCRIPT").": $row[3] "._QXZ("PROCESS").": $row[4]\n";
+ echo _QXZ("OUTPUT").": \n$row[5]\n";
+ echo "-----------------------------------------------------------------------------------------------\n";
+
+ $i++;
+ }
+ }
+
+if ($db_source == 'S')
+ {
+ mysqli_close($link);
+ $use_slave_server=0;
+ $db_source = 'M';
+ require("dbconnect_mysqli.php");
+ }
+
+$endMS = microtime();
+$startMSary = explode(" ",$startMS);
+$endMSary = explode(" ",$endMS);
+$runS = ($endMSary[0] - $startMSary[0]);
+$runM = ($endMSary[1] - $startMSary[1]);
+$TOTALrun = ($runS + $runM);
+
+$stmt="UPDATE vicidial_report_log set run_time='$TOTALrun' where report_log_id='$report_log_id';";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+
+?>
+
+
+
+
+
+