Code cleanup in PHP files for QXZ functions

Added ADMIN_www_languages.pl script to parse all web files for QXZ phrases and populate DB table www_phrases

git-svn-id: svn://192.168.202.10@2213 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2014-11-28 14:28:39 +00:00
parent d44cc75272
commit 29013f08cf
24 changed files with 555 additions and 74 deletions
@@ -21,6 +21,7 @@
#
# constants
$SYSLOG=1; # log to a logfile
$DB=0;
$US='__';
$MT[0]='';
+431
View File
@@ -0,0 +1,431 @@
#!/usr/bin/perl
# ADMIN_www_languages.pl version 2.10
#
# This script is designed to traverse the vicidial and agc web directories and
# generate a list of phrases that are output from the QXZ PHP functions so that
# they can be inserted/updated in the database.
#
# NOTES: we used the following database query to set to UTF8:
# ALTER DATABASE asterisk CHARACTER SET utf8 COLLATE utf8_unicode_ci;
# you should check your table character sets:
# select TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE,TABLE_COLLATION,CREATE_OPTIONS from information_schema.`TABLES`;
# and alter them if necessary:
# ALTER TABLE audio_store_details CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
#
# Copyright (C) 2014 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 141128-0024 - First build
#
$secX = time();
# constants
$SYSLOG=1; # log to a logfile
$DB=0; # Debug flag, set to 0 for no debug messages, lots of output
$US='_';
$MT[0]='';
$QXZlines=0;
$QXZvalues=0;
$QXZvaronly=0;
$QXZlengthonly=0;
$QXZplaceonly=0;
$secT = time();
$now_date_epoch = $secT;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900);
$mon++;
if ($mon < 10) {$mon = "0$mon";}
if ($mday < 10) {$mday = "0$mday";}
if ($hour < 10) {$hour = "0$hour";}
if ($min < 10) {$min = "0$min";}
if ($sec < 10) {$sec = "0$sec";}
$file_date = "$year-$mon-$mday";
$now_date = "$year-$mon-$mday $hour:$min:$sec";
# default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf';
### begin parsing run-time options ###
if (length($ARGV[0])>1)
{
$i=0;
while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}
if ($args =~ /--help/i)
{
print "QXZanalyzer.pl - analyze php scripts for QXZ functions and contents\n";
print "\n";
print "options:\n";
print " [--help] = this help screen\n";
print " [--debug] = verbose debug messages\n";
print " [--debugX] = extra verbose debug messages\n";
print " [--agc-only] = only parse the agc directory\n";
print " [--vicidial-only] = only parse the vicidial directory\n";
print " [--QXZlines] = print full lines that include QXZ functions\n";
print " [--QXZvalues] = print only QXZ function values\n";
print " [--QXZvaronly] = print only QXZ function values with PHP variables in them\n";
print " [--QXZlengthonly] = print only QXZ function values that include a length spec\n";
print " [--QXZplaceonly] = print only QXZ function values with placeholder variables in them\n";
print " [--conffile=/path/from/root] = define astguiclient.conf config file to use\n";
print "\n";
exit;
}
else
{
if ($args =~ /--debug/i) # Debug flag
{$DB=1;}
if ($args =~ /--debugX/i) # Extra Debug flag
{$DBX=1;}
if ($args =~ /--agc-only/i) # agc flag
{$agc_only=1;}
if ($args =~ /--vicidial-only/i) # vicidial flag
{$vicidial_only=1;}
if ($args =~ /--QXZlines/i) # QXZlines flag
{$QXZlines=1;}
if ($args =~ /--QXZvalues/i) # QXZvalues flag
{$QXZvalues=1;}
if ($args =~ /--QXZvaronly/i) # QXZvaronly flag
{$QXZvaronly=1;}
if ($args =~ /--QXZlengthonly/i) # QXZlengthonly flag
{$QXZlengthonly=1;}
if ($args =~ /--QXZplaceonly/i) # QXZplaceonly flag
{$QXZplaceonly=1;}
if ($args =~ /--conffile=/i) # CLI defined file path
{
@CLIconffileARY = split(/--conffile=/,$args);
@CLIconffileARX = split(/ /,$CLIconffileARY[1]);
if (length($CLIconffileARX[0])>2)
{
$PATHconf = $CLIconffileARX[0];
$PATHconf =~ s/\/$| |\r|\n|\t//gi;
print " CLI defined conffile path: $PATHconf\n";
}
}
}
}
else
{
print "no command line options set, exiting\n";
exit;
}
### end parsing run-time options ###
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
@conf = <conf>;
close(conf);
$i=0;
foreach(@conf)
{
$line = $conf[$i];
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) )
{$PATHhome = $line; $PATHhome =~ s/.*=//gi;}
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) )
{$PATHagi = $line; $PATHagi =~ s/.*=//gi;}
if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) )
{$PATHweb = $line; $PATHweb =~ s/.*=//gi;}
if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) )
{$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;}
if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) )
{$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;}
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
$i++;
}
if (!$VASLOGfile) {$VASLOGfile = "$PATHlogs/wwwlang.$year-$mon-$mday";}
if (!$VARDB_port) {$VARDB_port='3306';}
use DBI;
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
or die "Couldn't connect to database: " . DBI->errstr;
### Grab Server values from the database
$stmtA = "SELECT count(*) FROM www_phrases;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$phrase_count = $aryA[0];
}
$sthA->finish();
$event_string = "Existing phrases: $phrase_count";
if ($DB > 0) {print "$event_string\n";}
&event_logger;
$i=0;
$f=0;
if ($vicidial_only < 1)
{
opendir(FILE, "$PATHweb/agc/");
@agcFILES = readdir(FILE);
### Loop through files first to gather list
foreach(@agcFILES)
{
$FILEparseDIR[$f] = "$PATHweb/agc/";
$FILEparseNAME[$f] = '';
$FILEparse[$f] = '';
if ( (length($agcFILES[$i]) > 2) && (!-d "$PATHweb/agc/$agcFILES[$i]") )
{
$FILEparse[$f] = "$PATHweb/agc/$agcFILES[$i]";
$FILEparseNAME[$f] = $agcFILES[$i];
$event_string = "$PATHweb/agc/$agcFILES[$i] $FILEparseNAME[$f]";
if ($DBX > 0) {print "$event_string\n";}
&event_logger;
$f++;
}
$i++;
}
}
$i=0;
if ($agc_only < 1)
{
opendir(FILE, "$PATHweb/vicidial/");
@vicidialFILES = readdir(FILE);
### Loop through files first to gather list
foreach(@vicidialFILES)
{
$FILEparseDIR[$f] = "$PATHweb/vicidial/";
$FILEparseNAME[$f] = '';
$FILEparse[$f] = '';
if ( (length($vicidialFILES[$i]) > 2) && (!-d "$PATHweb/vicidial/$vicidialFILES[$i]") )
{
$FILEparse[$f] = "$PATHweb/vicidial/$vicidialFILES[$i]";
$FILEparseNAME[$f] = $vicidialFILES[$i];
$event_string = "$PATHweb/vicidial/$vicidialFILES[$i] $FILEparseNAME[$f]";
if ($DBX > 0) {print "$event_string\n";}
&event_logger;
$f++;
}
$i++;
}
}
$event_string = "Files: $i $f";
if ($DB > 0) {print "$event_string\n";}
&event_logger;
$QXZlinecount=0;
$QXZcount=0;
$QXZcount_length=0;
$QXZcount_var=0;
$QXZcount_place=0;
$QXZcount_var_ct=0;
$QXZcount_place_ct=0;
$QXZinserts=0;
$QXZdups=0;
$f=0;
foreach(@FILEparse)
{
if (-e "$FILEparse[$f]")
{
$event_string = "file found at: $FILEparse[$f] $FILEparseNAME[$f]\n";
if ($DB > 0) {print "$event_string\n";}
&event_logger;
open(conf, "$FILEparse[$f]") || die "can't open $FILEparse[$f]: $!\n";
@conf = <conf>;
close(conf);
$i=0;
foreach(@conf)
{
$line = $conf[$i];
$line =~ s/\n|\r|\t//gi;
if ( ($line =~ /\_QXZ\(/) && ($line !~ /function \_QXZ/) )
{
$QXZlinecount++;
$QXZ_in_line = () = $line =~ /\_QXZ\(/g;
$QXZcount = ($QXZcount + $QXZ_in_line);
@eachQXZ = split(/\_QXZ\(/,$line);
$each_ct=0;
while ($each_ct <= $#eachQXZ)
{
if ($each_ct > 0)
{
@eachQXZvalue = split(/\)/,$eachQXZ[$each_ct]);
if ( ($eachQXZvalue[0] =~ /\(/) && (length($eachQXZvalue[1])>0) )
{
$temp_QXZval_str = $eachQXZvalue[0].")".$eachQXZvalue[1];
if ( ($eachQXZvalue[1] =~ /\(/) && (length($eachQXZvalue[2])>0) )
{
$temp_QXZval_str .= ")".$eachQXZvalue[2];
if ( ($eachQXZvalue[2] =~ /\(/) && (length($eachQXZvalue[3])>0) )
{
$temp_QXZval_str .= ")".$eachQXZvalue[3];
}
}
}
else
{
$temp_QXZval_str = $eachQXZvalue[0];
}
if ( ($QXZvalues > 0) && ($QXZvaronly < 1) && ($QXZlengthonly < 1) && ($QXZplaceonly < 1) )
{
$event_string = "$temp_QXZval_str";
print "$event_string\n";
&event_logger;
}
if ($temp_QXZval_str =~ /,\d|, \d/)
{
$QXZcount_length++;
if ($QXZlengthonly > 0)
{
$event_string = "$temp_QXZval_str";
print "$event_string\n";
&event_logger;
}
}
if ($temp_QXZval_str =~ /\$/)
{
$QXZcount_var++;
$var_ct_in_line = () = $temp_QXZval_str =~ /\$/g;
$QXZcount_var_ct = ($QXZcount_var_ct + $var_ct_in_line);
if ($QXZvaronly > 0)
{
$event_string = "$temp_QXZval_str";
print "$event_string\n";
&event_logger;
}
}
if ($temp_QXZval_str =~ /%\ds/)
{
$QXZcount_place++;
$place_ct_in_line = () = $temp_QXZval_str =~ /\$/g;
$QXZcount_place_ct = ($QXZcount_place_ct + $place_ct_in_line);
if ($QXZplaceonly > 0)
{
$event_string = "$temp_QXZval_str";
print "$event_string\n";
&event_logger;
}
}
$temp_QXZval_strSQL = $temp_QXZval_str;
$temp_QXZval_strSQL =~ s/\"$|^\"|^\'|\'$//gi;
$temp_QXZval_strSQL =~ s/\",.*|\',.*//gi;
$phrase_match=0;
$stmtA = "SELECT count(*) FROM www_phrases where phrase_text='$temp_QXZval_strSQL';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$phrase_match = $aryA[0];
}
$sthA->finish();
if ($phrase_match < 1)
{
$stmtA="INSERT INTO www_phrases SET phrase_text='$temp_QXZval_strSQL',php_filename='$FILEparseNAME[$f]',php_directory='$FILEparseDIR[$f]',source='www_languages_script';";
$affected_rows = $dbhA->do($stmtA);
$QXZinserts++;
$event_string = " $affected_rows|$stmtA|";
if ($DBX > 0) {print "$event_string\n";}
&event_logger;
}
else
{$QXZdups++;}
}
$each_ct++;
}
if ($QXZlines > 0)
{
$event_string = "$i|$QXZlinecount|$QXZ_in_line|$line";
print "$event_string\n";
&event_logger;
}
}
$i++;
}
}
else
{
$event_string = "File does not exist: $FILEparse[$f] $FILEparseNAME[$f]";
if ($DB > 0) {print "$event_string\n";}
&event_logger;
}
$f++;
}
$event_string = "\n";
$event_string .= "FILE PARSING FINISHED!\n";
$event_string .= "Files parsed: $f\n";
$event_string .= "ConfFile: $PATHconf\n";
$event_string .= "QXZ line count: $QXZlinecount\n";
$event_string .= "QXZ count: $QXZcount\n";
$event_string .= "QXZ with length set: $QXZcount_length\n";
$event_string .= "QXZ with PHP vars: $QXZcount_var\n";
$event_string .= "QXZ with var place set: $QXZcount_place\n";
$event_string .= "QXZ with PHP vars inst: $QXZcount_var_ct\n";
$event_string .= "QXZ with var place inst: $QXZcount_place_ct\n";
$event_string .= "\n";
$event_string .= "QXZ DB inserts: $QXZinserts\n";
$event_string .= "QXZ DB dups: $QXZdups\n";
$event_string .= "\n";
if ($DB > 0) {print "$event_string\n";}
&event_logger;
$secy = time(); $secz = ($secy - $secX); $minz = ($secz/60); # calculate script runtime so far
$event_string = "\n - process runtime ($secz sec) ($minz minutes)";
if ($DB > 0) {print "$event_string\n";}
&event_logger;
exit;
sub event_logger
{
if ($SYSLOG)
{
### open the log file for writing ###
open(Lout, ">>$VASLOGfile")
|| die "Can't open $VASLOGfile: $!\n";
print Lout "$now_date|$event_string|\n";
close(Lout);
}
$event_string='';
}
@@ -3034,14 +3034,14 @@ index (start_time)
CREATE TABLE vicidial_webservers (
webserver_id SMALLINT(5) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
webserver VARCHAR(150) default '',
hostname VARCHAR(150) default '',
webserver VARCHAR(125) default '',
hostname VARCHAR(125) default '',
unique index vdweb (webserver, hostname)
) ENGINE=MyISAM;
CREATE TABLE vicidial_urls (
url_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
url VARCHAR(333) default '',
url VARCHAR(255) default '',
unique index (url)
) ENGINE=MyISAM;
@@ -3078,6 +3078,15 @@ audio_length INT(10) UNSIGNED default '0',
unique index (audio_filename)
) ENGINE=MyISAM;
CREATE TABLE www_phrases (
phrase_id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
phrase_text VARCHAR(10000) default '',
php_filename VARCHAR(255) NOT NULL,
php_directory VARCHAR(255) default '',
source VARCHAR(20) default '',
index (phrase_text)
) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
@@ -3321,4 +3330,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version';
UPDATE system_settings set vdc_agent_api_active='1';
UPDATE system_settings SET db_schema_version='1392',db_schema_update_date=NOW(),reload_timestamp=NOW();
UPDATE system_settings SET db_schema_version='1393',db_schema_update_date=NOW(),reload_timestamp=NOW();
+16
View File
@@ -92,3 +92,19 @@ unique index (audio_filename)
) ENGINE=MyISAM;
UPDATE system_settings SET db_schema_version='1392',db_schema_update_date=NOW() where db_schema_version < 1392;
CREATE TABLE www_phrases (
phrase_id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
phrase_text VARCHAR(10000) default '',
php_filename VARCHAR(255) NOT NULL,
php_directory VARCHAR(255) default '',
source VARCHAR(20) default '',
index (phrase_text)
) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE vicidial_webservers MODIFY webserver VARCHAR(125) default '';
ALTER TABLE vicidial_webservers MODIFY hostname VARCHAR(125) default '';
ALTER TABLE vicidial_urls MODIFY url VARCHAR(255) default '';
UPDATE system_settings SET db_schema_version='1393',db_schema_update_date=NOW() where db_schema_version < 1393;
@@ -43,6 +43,7 @@
# 130603-2222 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
# 130802-0957 - Changed to PHP mysqli functions
# 140811-0850 - Changed to use QXZ function for echoing text
# 141128-0901 - Code cleanup for QXZ functions
#
require_once("dbconnect_mysqli.php");
@@ -172,7 +173,7 @@ if ($format=='table')
if ($ADD==3) {echo _QXZ("Outside Lines");}
if ($ADD==4) {echo _QXZ("Local Extensions");}
if ($ADD==5) {echo _QXZ("Conferences");}
if ($ADD==99999) {echo _QXZ( "HELP");}
if ($ADD==99999) {echo _QXZ("HELP");}
echo "</title>\n";
echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
+28 -27
View File
@@ -76,10 +76,11 @@
# 140428-1656 - Added pause_type logging to queue_log pause/unpause entries for ra_call_control function
# 140619-1006 - Added basic audio_playback function
# 140811-1243 - Changed to use QXZ function for echoing text
# 141128-0847 - Code cleanup for QXZ functions
#
$version = '2.10-42';
$build = '140811-1243';
$version = '2.10-43';
$build = '141128-0847';
$startMS = microtime();
@@ -2284,175 +2285,175 @@ if ($function == 'update_fields')
$field_set=0;
if (preg_match('/phone_code/',$query_string))
{
if ($DB) {echo _QXZ("phone_code set to $phone_code\n");}
if ($DB) {echo _QXZ("phone_code set to")." $phone_code\n";}
$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");}
if ($DB) {echo _QXZ("address1 set to")." $address1\n";}
$fieldsSQL .= "address1='$address1',";
$fieldsLIST .= "address1,";
$field_set++;
}
if (preg_match('/address2/',$query_string))
{
if ($DB) {echo _QXZ("address2 set to $address2\n");}
if ($DB) {echo _QXZ("address2 set to")." $address2\n";}
$fieldsSQL .= "address2='$address2',";
$fieldsLIST .= "address2,";
$field_set++;
}
if (preg_match('/address3/',$query_string))
{
if ($DB) {echo _QXZ("address3 set to $address3\n");}
if ($DB) {echo _QXZ("address3 set to")." $address3\n";}
$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");}
if ($DB) {echo _QXZ("alt_phone set to")." $alt_phone\n";}
$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");}
if ($DB) {echo _QXZ("city set to")." $city\n";}
$fieldsSQL .= "city='$city',";
$fieldsLIST .= "city,";
$field_set++;
}
if (preg_match('/comments/',$query_string))
{
if ($DB) {echo _QXZ("comments set to $comments\n");}
if ($DB) {echo _QXZ("comments set to")." $comments\n";}
$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");}
if ($DB) {echo _QXZ("country_code set to")." $country_code\n";}
$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");}
if ($DB) {echo _QXZ("date_of_birth set to")." $date_of_birth\n";}
$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");}
if ($DB) {echo _QXZ("email set to")." $email\n";}
$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");}
if ($DB) {echo _QXZ("first_name set to")." $first_name\n";}
$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");}
if ($DB) {echo _QXZ("gender set to")." $gender\n";}
$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");}
if ($DB) {echo _QXZ("gmt_offset_now set to")." $gmt_offset_now\n";}
$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");}
if ($DB) {echo _QXZ("last_name set to")." $last_name\n";}
$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");}
if ($DB) {echo _QXZ("middle_initial set to")." $middle_initial\n";}
$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");}
if ($DB) {echo _QXZ("phone_number set to")." $phone_number\n";}
$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");}
if ($DB) {echo _QXZ("postal_code set to")." $postal_code\n";}
$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");}
if ($DB) {echo _QXZ("province set to")." $province\n";}
$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");}
if ($DB) {echo _QXZ("security_phrase set to")." $security_phrase\n";}
$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");}
if ($DB) {echo _QXZ("source_id set to")." $source_id\n";}
$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");}
if ($DB) {echo _QXZ("state set to")." $state\n";}
$fieldsSQL .= "state='$state',";
$fieldsLIST .= "state,";
$field_set++;
}
if (preg_match('/title/i',$query_string))
{
if ($DB) {echo _QXZ("title set to $title\n");}
if ($DB) {echo _QXZ("title set to")." $title\n";}
$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");}
if ($DB) {echo _QXZ("vendor_lead_code set to")." $vendor_lead_code\n";}
$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");}
if ($DB) {echo _QXZ("rank set to")." $rank\n";}
$fieldsSQL .= "rank='$rank',";
$fieldsLIST .= "rank,";
$field_set++;
}
if (preg_match('/owner/i',$query_string))
{
if ($DB) {echo _QXZ("owner set to $owner\n");}
if ($DB) {echo _QXZ("owner set to")." $owner\n";}
$fieldsSQL .= "owner='$owner',";
$fieldsLIST .= "owner,";
$field_set++;
+1 -1
View File
@@ -1768,7 +1768,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";}
var reglink='';
if (taskreg.length<1)
{
head_reg = <?php echo _QXZ("'NO ONE'"); ?>;
head_reg = '<?php echo _QXZ("NO ONE"); ?>';
show_reglink=1;
reglink = "<a href=\"#\" onclick=\"conf_register_room('" + head_conf + "');return false;\">Register</a>";
}
+2 -1
View File
@@ -35,6 +35,7 @@
# 130802-1005 - Changed to PHP mysqli functions
# 140811-0847 - Changed to use QXZ function for echoing text
# 141118-1232 - Formatting changes for QXZ output
# 141128-0852 - Code cleanup for QXZ functions
#
require_once("dbconnect_mysqli.php");
@@ -128,7 +129,7 @@ if ($format=='debug')
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
{
$channel_live=0;
echo _QXZ("Exten %1s is not valid or protocol %2s is not valid\n",0,'',$exten,$protocol);
echo _QXZ("Exten %1s is not valid or protocol %2s is not valid",0,'',$exten,$protocol)."\n";
exit;
}
else
+6 -5
View File
@@ -64,10 +64,11 @@
# 140126-0659 - Added external_pause_code function
# 140810-2136 - Changed to use QXZ function for echoing text
# 141118-1233 - Formatting changes for QXZ output
# 141128-0853 - Code cleanup for QXZ functions
#
$version = '2.10-39';
$build = '141118-1233';
$version = '2.10-40';
$build = '141128-0853';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=39;
$one_mysql_log=0;
@@ -216,7 +217,7 @@ if ($ACTION == 'refresh')
if (strlen($conf_exten)<1)
{
$channel_live=0;
echo _QXZ("Conf Exten %1s is not valid\n",0,'',$conf_exten);
echo _QXZ("Conf Exten %1s is not valid",0,'',$conf_exten)."\n";
exit;
}
else
@@ -756,7 +757,7 @@ if ($ACTION == 'register')
if ( (strlen($conf_exten)<1) || (strlen($exten)<1) )
{
$channel_live=0;
echo _QXZ("Conf Exten %1s is not valid or Exten %2s is not valid\n",0,'',$conf_exten,$exten);
echo _QXZ("Conf Exten %1s is not valid or Exten %2s is not valid",0,'',$conf_exten,$exten)."\n";
exit;
}
else
@@ -766,7 +767,7 @@ if ($ACTION == 'register')
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);}
}
echo _QXZ("Conference %1s has been registered to %2s\n",0,'',$conf_exten,$exten);
echo _QXZ("Conference %1s has been registered to %2s",0,'',$conf_exten,$exten)."\n";
}
+4 -3
View File
@@ -22,6 +22,7 @@
# 140521-1314 - Added more agent login error messages
# 140811-2024 - Changed to use QXZ function for echoing text, for use in future translations
# 141118-0909 - Added options for up to 9 ordered variables within QXZ function output
# 141128-0846 - Code cleanup for QXZ functions
#
# $mysql_queries = 19
@@ -441,7 +442,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
if ($A_field_type[$o]=='DISPLAY')
{
if ($A_field_default[$o]=='NULL') {$A_field_default[$o]='';}
$field_HTML .= _QXZ("$A_field_default[$o]\n");
$field_HTML .= _QXZ("$A_field_default[$o]")."\n";
}
if ($A_field_type[$o]=='READONLY')
{
@@ -548,10 +549,10 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
$CFoutput .= "</td></tr></table>\n";
}
else
{$CFoutput .= _QXZ("ERROR: no custom list fields\n");}
{$CFoutput .= _QXZ("ERROR: no custom list fields")."\n";}
}
else
{$CFoutput .= _QXZ("ERROR: no custom list fields table\n");}
{$CFoutput .= _QXZ("ERROR: no custom list fields table")."\n";}
##### BEGIN parsing for vicidial variables #####
+2 -1
View File
@@ -36,6 +36,7 @@
# 130802-1009 - Changed to PHP mysqli functions
# 140811-0841 - Changed to use QXZ function for echoing text
# 141118-1236 - Formatting changes for QXZ output
# 141128-0854 - Code cleanup for QXZ functions
#
require_once("dbconnect_mysqli.php");
@@ -139,7 +140,7 @@ $channel_live=1;
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
{
$channel_live=0;
echo _QXZ("Exten %1s is not valid or protocol %2s is not valid\n",0,'',$exten,$protocol);
echo _QXZ("Exten %1s is not valid or protocol %2s is not valid",0,'',$exten,$protocol)."\n";
exit;
}
else
+11 -5
View File
@@ -121,10 +121,11 @@
# 140215-2057 - Added several variable options for QM socket URL
# 140810-2125 - Changed to use QXZ function for echoing text
# 141118-1101 - Formatting changes for QXZ output
# 141128-0851 - Code cleanup for QXZ functions
#
$version = '2.10-68';
$build = '141118-1101';
$version = '2.10-69';
$build = '141128-0851';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=128;
$one_mysql_log=0;
@@ -1648,7 +1649,8 @@ if ($ACTION=="RedirectXtraCXNeW")
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02044',$user,$server_ip,$session_name,$one_mysql_log);}
echo _QXZ("RedirectXtraCX command sent for Channel %1s on %2s and \nHungup %3s on %4s",0,'',$channel,$call_server_ip,$extrachannel,$server_ip)."\n";
echo _QXZ("RedirectXtraCX command sent for Channel %1s on %2s and",0,'',$channel,$call_server_ip)."\n";
echo _QXZ("Hungup %1s on %2s",0,'',$extrachannel,$server_ip)."\n";
if (preg_match("/SECOND|FIRST|DEBUG/",$filename)) {$DBout .= "$channel on $call_server_ip, Hungup $extrachannel on $server_ip";}
}
}
@@ -1824,7 +1826,9 @@ if ($ACTION=="RedirectXtraNeW")
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02057',$user,$server_ip,$session_name,$one_mysql_log);}
echo _QXZ("RedirectXtra command sent for Channel %1s and \nExtraChannel %2s\n to %3s on %4s",0,'',$channel,$extrachannel,$exten,$server_ip)."\n";
echo _QXZ("RedirectXtra command sent for Channel %1s and",0,'',$channel)."\n";
echo _QXZ("ExtraChannel %1s",0,'',$extrachannel)."\n";
echo _QXZ(" to %1s on %2s",0,'',$exten,$server_ip)."\n";
if (preg_match("/SECOND|FIRST|DEBUG/",$filename)) {$DBout .= "$channel and $extrachannel to $exten on $server_ip";}
}
else
@@ -1851,7 +1855,9 @@ if ($ACTION=="RedirectXtraNeW")
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02059',$user,$server_ip,$session_name,$one_mysql_log);}
echo _QXZ("RedirectXtra command sent for Channel %1s on %2s and \nExtraChannel %3s\n to %4s on %5s",0,'',$channel,$call_server_ip,$extrachannel,$exten,$server_ip)."\n";
echo _QXZ("RedirectXtra command sent for Channel %1s on %2s and",0,'',$channel,$call_server_ip)."\n";
echo _QXZ("ExtraChannel %1s",0,'',$extrachannel)."\n";
echo _QXZ(" to %1s on %2s",0,'',$exten,$server_ip)."\n";
if (preg_match("/SECOND|FIRST|DEBUG/",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";}
}
}
+5 -4
View File
@@ -366,10 +366,11 @@
# 141123-0933 - Added dispo_comments option input
# 141124-1136 - Added cbcomment_comments option input
# 141125-0059 - Added parked_hangup code
# 141128-0849 - Code cleanup for QXZ functions
#
$version = '2.10-262';
$build = '141125-0059';
$version = '2.10-263';
$build = '141128-0849';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=597;
$one_mysql_log=0;
@@ -1499,7 +1500,7 @@ if ($ACTION == 'UpdateFields')
}
else
{
echo "ERROR: "._QXZ("no lead active for this agent\n");
echo "ERROR: "._QXZ("no lead active for this agent")."\n";
}
}
@@ -1577,7 +1578,7 @@ if ($ACTION == 'update_settings')
}
else
{
echo "ERROR: "._QXZ("no agent session\n");
echo "ERROR: "._QXZ("no agent session")."\n";
}
}
+5 -4
View File
@@ -1,5 +1,5 @@
<?php
# vdc_email_display.php - VICIDIAL administration page
# vdc_email_display.php - VICIDIAL agent email display script
#
# Copyright (C) 2014 Matt Florell, Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
#
@@ -18,10 +18,11 @@
# 130802-1032 - Changed to PHP mysqli functions
# 140811-0834 - Changed to use QXZ function for echoing text
# 141118-1426 - Added agent_email variable
# 141128-0850 - Code cleanup for QXZ functions
#
$version = '2.10-8';
$build = '141118-1426';
$version = '2.10-9';
$build = '141128-0850';
require_once("dbconnect_mysqli.php");
require_once("functions.php");
@@ -119,7 +120,7 @@ if ($qm_conf_ct > 0)
if ($allow_emails<1)
{
echo _QXZ("Your system does not have the email setting enabled\n");
echo _QXZ("Your system does not have the email setting enabled")."\n";
exit;
}
+4 -3
View File
@@ -26,11 +26,12 @@
# 140429-2042 - Added TABLEper_call_notes display script variable for form display
# 140810-2119 - Changed to use QXZ function for echoing text
# 141118-1424 - Added agent_email variable
# 141128-0855 - Code cleanup for QXZ functions
#
$version = '2.10-17';
$build = '141118-1424';
$version = '2.10-18';
$build = '141128-0855';
require_once("dbconnect_mysqli.php");
require_once("functions.php");
@@ -421,7 +422,7 @@ if ($stage=='SUBMIT')
}
}
else
{$CFoutput .= _QXZ("ERROR: no custom list fields table\n");}
{$CFoutput .= _QXZ("ERROR: no custom list fields table")."\n";}
echo _QXZ("Custom Form Output:")."\n<BR>\n";
+4 -3
View File
@@ -456,10 +456,11 @@
# 141124-2234 - Added clear_script campaign option
# 141125-0100 - Added parked_hangup code
# 141125-1235 - Fixed issue with lead info not being updated when Max Dead time is triggered
# 141128-0848 - Code cleanup for QXZ functions
#
$version = '2.10-427c';
$build = '141125-1235';
$version = '2.10-428c';
$build = '141128-0848';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=80;
$one_mysql_log=0;
@@ -11934,7 +11935,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
function LogouT(tempreason)
{
if (MD_channel_look==1)
{alert("<?php echo _QXZ('You cannot log out during a Dial attempt. \nWait 50 seconds for the dial to fail out if it is not answered'); ?>");}
{alert("<?php echo _QXZ('You cannot log out during a Dial attempt. Wait 50 seconds for the dial to fail out if it is not answered'); ?>");}
else
{
if (VD_live_customer_call==1)
@@ -27,6 +27,7 @@
# 140108-0747 - Added webserver and hostname to report logging
# 140328-0005 - Converted division calculations to use MathZDC function
# 141113-2336 - Finalized adding QXZ translation to all admin files
# 141128-0856 - Code cleanup for QXZ functions
#
$startMS = microtime();
@@ -347,7 +348,7 @@ $MAIN.="<PRE><FONT SIZE=2>\n\n";
if (!$group)
{
$MAIN.="\n\n";
$MAIN.=_QXZ("PLEASE SELECT AN IN-GROUP AND DATE RANGE ABOVE AND CLICK SUBMIT\n");
$MAIN.=_QXZ("PLEASE SELECT AN IN-GROUP AND DATE RANGE ABOVE AND CLICK SUBMIT")."\n";
echo "$HEADER";
require("admin_header.php");
echo "$MAIN";
@@ -44,6 +44,7 @@
# 140108-0746 - Added webserver and hostname to report logging
# 140328-0005 - Converted division calculations to use MathZDC function
# 141114-0009 - Finalized adding QXZ translation to all admin files
# 141128-0858 - Code cleanup for QXZ functions
#
$startMS = microtime();
@@ -478,11 +479,11 @@ if ($groups_to_print < 1)
{
$MAIN.="\n\n";
if ($EMAIL=='Y')
{$MAIN.=_QXZ("PLEASE SELECT AN EMAIL ACCOUNT AND DATE RANGE ABOVE AND CLICK SUBMIT\n");}
{$MAIN.=_QXZ("PLEASE SELECT AN EMAIL ACCOUNT AND DATE RANGE ABOVE AND CLICK SUBMIT")."\n";}
if ($DID=='Y')
{$MAIN.=_QXZ("PLEASE SELECT A DID AND DATE RANGE ABOVE AND CLICK SUBMIT\n");}
{$MAIN.=_QXZ("PLEASE SELECT A DID AND DATE RANGE ABOVE AND CLICK SUBMIT")."\n";}
else
{$MAIN.=_QXZ("PLEASE SELECT AN IN-GROUP AND DATE RANGE ABOVE AND CLICK SUBMIT\n");}
{$MAIN.=_QXZ("PLEASE SELECT AN IN-GROUP AND DATE RANGE ABOVE AND CLICK SUBMIT")."\n";}
}
else
@@ -44,6 +44,7 @@
# 140328-0005 - Converted division calculations to use MathZDC function
# 141113-2334 - Finalized adding QXZ translation to all admin files
# 141125-0951 - Changed TOTAL column label to LOGIN TIME for uniform headers with other reports, issue #427
# 141128-0904 - Code cleanup for QXZ functions
#
$startMS = microtime();
@@ -522,7 +523,7 @@ $HTML_text.="<option value=\"AM\">"._QXZ("AM")."</option>\n";
$HTML_text.="<option value=\"PM\">"._QXZ("PM")."</option>\n";
$HTML_text.="<option value=\"ALL\">"._QXZ("ALL")."</option>\n";
$HTML_text.="</SELECT><BR><BR>\n";
$HTML_text.="<input type='checkbox' name='show_percentages' value='checked' $show_percentages>"._QXZ("Show %'s")."\n";
$HTML_text.="<input type='checkbox' name='show_percentages' value='checked' $show_percentages>"._QXZ("Show %s")."\n";
$HTML_text.="</TD><TD VALIGN=TOP>";
$HTML_text.=_QXZ("Display as").":<BR>";
$HTML_text.="<select name='report_display_type'>";
@@ -9,6 +9,7 @@
# 140414-1712 - Sales count bug fix
# 140418-1830 - Call count bug fix
# 141113-2058 - Finalized adding QXZ translation to all admin files
# 141128-0905 - Code cleanup for QXZ functions
#
$startMS = microtime();
@@ -418,7 +419,7 @@ $HTML_head.="<TITLE>"._QXZ("$report_name")."</TITLE></HEAD><BODY BGCOLOR=WHITE m
$HTML_text.="<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$HTML_text.="<FORM ACTION=\"$PHP_SELF\" METHOD=GET name=vicidial_report id=vicidial_report>\n";
$HTML_text.="<TABLE CELLSPACING=3><TR><TD VALIGN=TOP> "._QXZ("Today's date").":<BR>";
$HTML_text.="<TABLE CELLSPACING=3><TR><TD VALIGN=TOP> "._QXZ("date").":<BR>";
$HTML_text.="<INPUT TYPE=hidden NAME=DB VALUE=\"$DB\">\n";
$HTML_text.="<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">";
@@ -88,10 +88,11 @@
# 140328-0006 - Converted division calculations to use MathZDC function
# 140624-1424 - Added droppedOFtotal options.php option
# 140918-1614 - Added QXZ function formatting of output
# 141128-0857 - Code cleanup for QXZ functions
#
$version = '2.10-77';
$build = '140918-1614';
$version = '2.10-78';
$build = '141128-0857';
header ("Content-type: text/html; charset=utf-8");
@@ -2777,7 +2778,7 @@ $talking_to_print = mysqli_num_rows($rslt);
}
$Aecho .= "$Aline";
$Aecho .= " $agentcount "._QXZ("agents logged in on all servers\n");
$Aecho .= " $agentcount "._QXZ("agents logged in on all servers")."\n";
$Aecho .= " "._QXZ("System Load Average").": $load_ave &nbsp; $db_source\n\n";
# $Aecho .= " <SPAN class=\"orange\"><B> </SPAN> - "._QXZ("Balanced call")."</B>\n";
@@ -62,6 +62,7 @@
# 140706-0827 - Incorporated QC includes into code
# 140817-0937 - Added Archive Log search option
# 141001-2200 - Finalized adding QXZ translation to all admin files
# 141128-0859 - Code cleanup for QXZ functions
#
require("dbconnect_mysqli.php");
@@ -262,7 +263,7 @@ $modify_leads = $rights_row[0];
if ( $modify_leads < 1 )
{
header ("Content-type: text/html; charset=utf-8");
echo _QXZ("You do not have permissions to modify leads\n");
echo _QXZ("You do not have permissions to modify leads")."\n";
exit;
}
+2 -1
View File
@@ -15,6 +15,7 @@
# 130901-0900 - Changed to mysqli PHP functions
# 140328-0005 - Converted division calculations to use MathZDC function
# 141114-0034 - Finalized adding QXZ translation to all admin files
# 141128-0903 - Code cleanup for QXZ functions
#
require("dbconnect_mysqli.php");
@@ -125,7 +126,7 @@ else
$VDdisplayMESSAGE = _QXZ("Login incorrect, please try again");
if ($auth_message == 'LOCK')
{
$VDdisplayMESSAGE = _QXZ( "Too many login attempts, try again in 15 minutes");
$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;
@@ -18,6 +18,7 @@
# 130902-0904 - Changed to mysqli PHP functions, fixes for issue #699
# 140706-0837 - Incorporated into standard admin code
# 141007-2152 - Finalized adding QXZ translation to all admin files
# 141128-0902 - Code cleanup for QXZ functions
#
require("dbconnect_mysqli.php");
@@ -175,7 +176,7 @@ if ($auth < 1)
$VDdisplayMESSAGE = _QXZ("Login incorrect, please try again");
if ($auth_message == 'LOCK')
{
$VDdisplayMESSAGE = _QXZ( "Too many login attempts, try again in 15 minutes");
$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;