Added AST_CRON_audio_4_ftp2_FTPSSL.pl script for secondary archival of recordings to an FTP SSL server.
Changed agent code to use mysqli PHP functions. git-svn-id: svn://192.168.202.10@2009 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -121,6 +121,21 @@ OTHER CHANGES:
|
||||
AGI call_log line of the dialplan and before the Dial line:
|
||||
exten => _91NXXNXXXXXX,n,SipAddHeader(X-campaignid: ${CAMPCUST})
|
||||
|
||||
14. Changed the agent code to use PHP mysqli functions. This does not require
|
||||
any action or changes to enable since it is a change to the code.
|
||||
We are working on converting the administrative PHP scripts as well.
|
||||
These require MySQL 5.0 minimum to be used, but for several years that
|
||||
has been the minimmum for Vicidial anyway, so that requirement shouldn't
|
||||
be a problem for existing systems running the newest code. The existing
|
||||
older mysql PHP functions are set to be marked as depricated in PHP for
|
||||
future versions. For more information on mysqli you can visit the below
|
||||
webpages:
|
||||
http://news.php.net/php.internals/53799
|
||||
http://www.php.net/manual/en/mysqli.overview.php
|
||||
|
||||
15. Added AST_CRON_audio_4_ftp2_FTPSSL.pl script to allow for transmission of
|
||||
second archival of recordings to an FTP SSL server.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,474 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# AST_CRON_audio_4_ftp2_FTPSSL.pl
|
||||
#
|
||||
# This is a STEP-4 program in the audio archival process
|
||||
#
|
||||
# runs every 3 minutes and copies the recording files to an FTPSSL server
|
||||
#
|
||||
# ************* IMPORTANT!!!!!!!!!!!!!!!!!!!! ***************************
|
||||
# THIS SCRIPT REQUIRES THE Net::FTPSSL PERL MODULE TO RUN!!!
|
||||
# $ cpan
|
||||
# cpan> install ExtUtils::MakeMaker
|
||||
# cpan> install IO::Socket::SSL
|
||||
# cpan> install Net::SSLeay::Handle
|
||||
# cpan> install Net::FTPSSL
|
||||
# cpan> quit
|
||||
#
|
||||
# MAKE SURE YOU TEST THAT THIS IS WORKING MANUALLY BEFORE PUTTING INTO THE CRONTAB!!!
|
||||
#
|
||||
# ************* IMPORTANT!!!!!!!!!!!!!!!!!!!! ***************************
|
||||
#
|
||||
# put an entry into the cron of of your asterisk machine to run this script
|
||||
# every 3 minutes or however often you desire
|
||||
#
|
||||
# ### recording mixing/compressing/ftping scripts
|
||||
##0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_mix.pl
|
||||
# 0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_1_move_VDonly.pl
|
||||
# 1,4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58 * * * * /usr/share/astguiclient/AST_CRON_audio_2_compress.pl --GSM
|
||||
# 2,5,8,11,14,17,20,23,26,29,32,35,38,41,44,47,50,53,56,59 * * * * /usr/share/astguiclient/AST_CRON_audio_3_ftp.pl --GSM
|
||||
# 0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /usr/share/astguiclient/AST_CRON_audio_4_ftp2_FTPSSL.pl
|
||||
#
|
||||
# FLAG FOR NO DATE DIRECTORY ON FTP
|
||||
# --NODATEDIR
|
||||
#
|
||||
# if pinging is not working, try the 'icmp' Ping command in the code instead
|
||||
#
|
||||
# make sure that the following directories exist:
|
||||
# /var/spool/asterisk/monitorDONE # where the mixed -all files are put
|
||||
#
|
||||
# This program assumes that recordings are saved by Asterisk as .wav
|
||||
#
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# 130730-1849 - First Build based upon AST_CRON_audio_4_ftp2.pl script
|
||||
#
|
||||
|
||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
$year = ($year + 1900);
|
||||
$mon++;
|
||||
if ($hour < 10) {$hour = "0$hour";}
|
||||
if ($min < 10) {$min = "0$min";}
|
||||
if ($sec < 10) {$sec = "0$sec";}
|
||||
if ($mon < 10) {$mon = "0$mon";}
|
||||
if ($mday < 10) {$mday = "0$mday";}
|
||||
$FTPdate = "$year-$mon-$mday";
|
||||
|
||||
$GSM=0; $MP3=0; $OGG=0; $WAV=0; $GSW=0; $NODATEDIR=0;
|
||||
|
||||
# Default variables for FTP
|
||||
$VARFTP_host = '10.0.0.4';
|
||||
$VARFTP_user = 'cron';
|
||||
$VARFTP_pass = 'test';
|
||||
$VARFTP_port = '21';
|
||||
$VARFTP_dir = 'RECORDINGS';
|
||||
$VARHTTP_path = 'http://10.0.0.4';
|
||||
|
||||
$file_limit = 1000;
|
||||
$list_limit = 1000;
|
||||
$FTPpersistent=0;
|
||||
$FTPvalidate=0;
|
||||
|
||||
### 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 "allowed run time options:\n";
|
||||
print " [--help] = this screen\n";
|
||||
print " [--debug] = debug\n";
|
||||
print " [--debugX] = super debug\n";
|
||||
print " [--test] = test\n";
|
||||
print " [--run-check] = concurrency check, die if another instance is running\n";
|
||||
print " [--transfer-limit=XXX] = number of files to transfer before exiting\n";
|
||||
print " [--list-limit=XXX] = number of files to list in the directory before moving on\n";
|
||||
print " [--debugX] = super debug\n";
|
||||
print " [--nodatedir] = do not put into dated directories\n";
|
||||
print " [--ftp-server=XXX] = FTPSSL server\n";
|
||||
print " [--ftp-port=XXX] = FTPSSL server port\n";
|
||||
print " [--ftp-login=XXX] = FTPSSL server login account\n";
|
||||
print " [--ftp-pass=XXX] = FTPSSL server password\n";
|
||||
print " [--ftp-dir=XXX] = FTPSSL server directory\n";
|
||||
print " [--ftp-encrypt=X] = FTPSSL encryption type, E=Explicit, I=Implicit, default=E\n";
|
||||
print " [--ftp-persistent] = Does not log out between every file transmission\n";
|
||||
# print " [--ftp-validate] = Checks for a file size on the file after transmission\n";
|
||||
print "\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($args =~ /--debug/i)
|
||||
{
|
||||
$DB=1;
|
||||
print "\n----- DEBUG -----\n\n";
|
||||
}
|
||||
if ($args =~ /--debugX/i)
|
||||
{
|
||||
$DBX=1;
|
||||
print "\n----- SUPER DEBUG -----\n\n";
|
||||
}
|
||||
if ($args =~ /--test/i)
|
||||
{
|
||||
$T=1; $TEST=1;
|
||||
print "\n----- TESTING -----\n\n";
|
||||
}
|
||||
if ($args =~ /--nodatedir/i)
|
||||
{
|
||||
$NODATEDIR=1;
|
||||
if ($DB) {print "\n----- NO DATE DIRECTORIES -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--run-check/i)
|
||||
{
|
||||
$run_check=1;
|
||||
if ($DB) {print "\n----- CONCURRENCY CHECK -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--transfer-limit=/i)
|
||||
{
|
||||
my @data_in = split(/--transfer-limit=/,$args);
|
||||
$file_limit = $data_in[1];
|
||||
$file_limit =~ s/ .*//gi;
|
||||
print "\n----- FILE TRANSFER LIMIT: $file_limit -----\n\n";
|
||||
}
|
||||
if ($args =~ /--list-limit=/i)
|
||||
{
|
||||
my @data_in = split(/--list-limit=/,$args);
|
||||
$list_limit = $data_in[1];
|
||||
$list_limit =~ s/ .*//gi;
|
||||
print "\n----- FILE LIST LIMIT: $list_limit -----\n\n";
|
||||
}
|
||||
if ($args =~ /--ftp-server=/i)
|
||||
{
|
||||
my @data_in = split(/--ftp-server=/,$args);
|
||||
$VARFTP_host = $data_in[1];
|
||||
$VARFTP_host =~ s/ .*//gi;
|
||||
$CLIFTP_host=1;
|
||||
if ($DB > 0)
|
||||
{print "\n----- FTPSSL SERVER: $VARFTP_host -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--ftp-port=/i)
|
||||
{
|
||||
my @data_in = split(/--ftp-port=/,$args);
|
||||
$VARFTP_port = $data_in[1];
|
||||
$VARFTP_port =~ s/ .*//gi;
|
||||
$CLIFTP_port=1;
|
||||
if ($DB > 0)
|
||||
{print "\n----- FTPSSL PORT: $VARFTP_port -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--ftp-login=/i)
|
||||
{
|
||||
my @data_in = split(/--ftp-login=/,$args);
|
||||
$VARFTP_user = $data_in[1];
|
||||
$VARFTP_user =~ s/ .*//gi;
|
||||
$CLIFTP_user=1;
|
||||
if ($DB > 0)
|
||||
{print "\n----- FTPSSL LOGIN: $VARFTP_user -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--ftp-pass=/i)
|
||||
{
|
||||
my @data_in = split(/--ftp-pass=/,$args);
|
||||
$VARFTP_pass = $data_in[1];
|
||||
$VARFTP_pass =~ s/ .*//gi;
|
||||
$CLIFTP_pass=1;
|
||||
if ($DB > 0)
|
||||
{print "\n----- FTPSSL PASS: $VARFTP_pass -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--ftp-dir=/i)
|
||||
{
|
||||
my @data_in = split(/--ftp-dir=/,$args);
|
||||
$VARFTP_dir = $data_in[1];
|
||||
$VARFTP_dir =~ s/ .*//gi;
|
||||
$CLIFTP_dir=1;
|
||||
if ($DB > 0)
|
||||
{print "\n----- FTPSSL DIRECTORY: $VARFTP_dir -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--ftp-encrypt=/i)
|
||||
{
|
||||
my @data_in = split(/--ftp-encrypt=/,$args);
|
||||
$VARFTP_encrypt = $data_in[1];
|
||||
$VARFTP_encrypt =~ s/ .*//gi;
|
||||
if ($VARFTP_encrypt =~ /E/) {$VARFTP_encrypt = 'EXP_CRYPT';}
|
||||
if ($VARFTP_encrypt =~ /I/) {$VARFTP_encrypt = 'IMP_CRYPT';}
|
||||
if (length($VARFTP_encrypt)<5) {$VARFTP_encrypt = 'EXP_CRYPT';}
|
||||
$CLIFTP_encrypt=1;
|
||||
if ($DB > 0)
|
||||
{print "\n----- FTPSSL ENCRYPTION: $VARFTP_encrypt -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--ftp-persistent/i)
|
||||
{
|
||||
$FTPpersistent=1;
|
||||
if ($DB > 0)
|
||||
{print "\n----- FTPSSL PERSISTENT: $FTPpersistent -----\n\n";}
|
||||
}
|
||||
# if ($args =~ /--ftp-validate/i)
|
||||
# {
|
||||
# $FTPvalidate=1;
|
||||
# if ($DB > 0)
|
||||
# {print "\n----- FTPSSL VALIDATE: $FTPvalidate -----\n\n";}
|
||||
# }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#print "no command line options set\n";
|
||||
$WAV=1;
|
||||
}
|
||||
if (length($VARFTP_encrypt)<5) {$VARFTP_encrypt = 'EXP_CRYPT';}
|
||||
|
||||
|
||||
# default path to astguiclient configuration file:
|
||||
$PATHconf = '/etc/astguiclient.conf';
|
||||
|
||||
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 =~ /^PATHDONEmonitor/) && ($CLIDONEmonitor < 1) )
|
||||
{$PATHDONEmonitor = $line; $PATHDONEmonitor =~ 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;}
|
||||
if ( ($line =~ /^VARFTP_host/) && ($CLIFTP_host < 1) )
|
||||
{$VARFTP_host = $line; $VARFTP_host =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARFTP_user/) && ($CLIFTP_user < 1) )
|
||||
{$VARFTP_user = $line; $VARFTP_user =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARFTP_pass/) && ($CLIFTP_pass < 1) )
|
||||
{$VARFTP_pass = $line; $VARFTP_pass =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARFTP_port/) && ($CLIFTP_port < 1) )
|
||||
{$VARFTP_port = $line; $VARFTP_port =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARFTP_dir/) && ($CLIFTP_dir < 1) )
|
||||
{$VARFTP_dir = $line; $VARFTP_dir =~ s/.*=//gi;}
|
||||
if ( ($line =~ /^VARHTTP_path/) && ($CLIHTTP_path < 1) )
|
||||
{$VARHTTP_path = $line; $VARHTTP_path =~ s/.*=//gi;}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
### concurrency check
|
||||
if ($run_check > 0)
|
||||
{
|
||||
my $grepout = `/bin/ps ax | grep $0 | grep -v grep | grep -v '/bin/sh'`;
|
||||
my $grepnum=0;
|
||||
$grepnum++ while ($grepout =~ m/\n/g);
|
||||
if ($grepnum > 1)
|
||||
{
|
||||
if ($DB) {print "I am not alone! Another $0 is running! Exiting...\n";}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
# Customized Variables
|
||||
$server_ip = $VARserver_ip; # Asterisk server IP
|
||||
if (!$VARDB_port) {$VARDB_port='3306';}
|
||||
|
||||
use Time::HiRes ('gettimeofday','usleep','sleep'); # necessary to have perl sleep command of less than one second
|
||||
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;
|
||||
|
||||
use Net::Ping;
|
||||
use Net::FTPSSL;
|
||||
|
||||
### directory where -all recordings are
|
||||
$dir2 = "$PATHDONEmonitor/FTP";
|
||||
|
||||
opendir(FILE, "$dir2/");
|
||||
@FILES = readdir(FILE);
|
||||
|
||||
### Loop through files first to gather filesizes
|
||||
$i=0;
|
||||
$files_that_count=0;
|
||||
foreach(@FILES)
|
||||
{
|
||||
$FILEsize1[$i] = 0;
|
||||
if ( (length($FILES[$i]) > 4) && (!-d "$dir2/$FILES[$i]") )
|
||||
{
|
||||
$FILEsize1[$i] = (-s "$dir2/$FILES[$i]");
|
||||
if ($DBX) {print "$dir2/$FILES[$i] $FILEsize1[$i]\n";}
|
||||
$files_that_count++;
|
||||
}
|
||||
$i++;
|
||||
if ($files_that_count >= $list_limit)
|
||||
{
|
||||
last();
|
||||
}
|
||||
}
|
||||
|
||||
sleep(5);
|
||||
|
||||
$transfered_files = 0;
|
||||
|
||||
### Loop through files a second time to gather filesizes again 5 seconds later
|
||||
$i=0;
|
||||
foreach(@FILES)
|
||||
{
|
||||
$FILEsize2[$i] = 0;
|
||||
|
||||
if ( (length($FILES[$i]) > 4) && (!-d "$dir2/$FILES[$i]") )
|
||||
{
|
||||
|
||||
$FILEsize2[$i] = (-s "$dir2/$FILES[$i]");
|
||||
if ($DBX) {print "$dir2/$FILES[$i] $FILEsize2[$i]\n\n";}
|
||||
|
||||
if ($FILEsize1[$i] ne $FILEsize2[$i])
|
||||
{
|
||||
if ($DBX) {print "not transfering $dir2/$FILES[$i]. File size mismatch $FILEsize2[$i] != $FILEsize1[$i]\n\n";}
|
||||
}
|
||||
|
||||
if ( ($FILES[$i] !~ /out\.|in\.|lost\+found/i) && ($FILEsize1[$i] eq $FILEsize2[$i]) && (length($FILES[$i]) > 4))
|
||||
{
|
||||
$recording_id='';
|
||||
$ALLfile = $FILES[$i];
|
||||
$SQLFILE = $FILES[$i];
|
||||
$SQLFILE =~ s/-all\.wav|-all\.gsm|-all\.ogg|-all\.mp3//gi;
|
||||
|
||||
$stmtA = "select recording_id,start_time from recording_log where filename='$SQLFILE' order by recording_id desc LIMIT 1;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$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;
|
||||
$recording_id = $aryA[0];
|
||||
$start_date = $aryA[1];
|
||||
$start_date =~ s/ .*//gi;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
if (length($start_date) < 6)
|
||||
{$start_date = $FTPdate;}
|
||||
|
||||
if ($DB) {print "|$recording_id|$start_date|$ALLfile| |$SQLfile|\n";}
|
||||
|
||||
### BEGIN Remote file transfer
|
||||
if ( ($FTPpersistent > 0) && ($ping_good > 0) )
|
||||
{$ping_good=1;}
|
||||
else
|
||||
{
|
||||
$p = Net::Ping->new();
|
||||
$ping_good = $p->ping("$VARFTP_host");
|
||||
}
|
||||
|
||||
if (!$ping_good)
|
||||
{
|
||||
$p = Net::Ping->new("icmp");
|
||||
$ping_good = $p->ping("$VARFTP_host");
|
||||
}
|
||||
|
||||
if ($ping_good)
|
||||
{
|
||||
$transfered_files++;
|
||||
|
||||
$start_date_PATH='';
|
||||
$FTPdb=0;
|
||||
if ($DBX>0) {$FTPdb=1;}
|
||||
if ( ($FTPpersistent > 0) && ($transfered_files > 1) )
|
||||
{
|
||||
if($DBX){print STDERR "FTPSSL PERSISTENT, skipping login\n";}
|
||||
if ($NODATEDIR < 1)
|
||||
{
|
||||
$ftps->cwd("../");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# Some versions of the FTPSSL perl module require you to hard code the encryption value: IMP_CRYPT or EXP_CRYPT
|
||||
$ftps = Net::FTPSSL->new("$VARFTP_host", Port => $VARFTP_port, Encryption => $VARFTP_encrypt, Debug => $FTPdb);
|
||||
$ftps->login("$VARFTP_user","$VARFTP_pass");
|
||||
$ftps->cwd("$VARFTP_dir");
|
||||
}
|
||||
if ($NODATEDIR < 1)
|
||||
{
|
||||
$ftps->Net::FTPSSL::mkdir("$start_date");
|
||||
$ftps->cwd("$start_date");
|
||||
$start_date_PATH = "$start_date/";
|
||||
}
|
||||
$ftps->binary();
|
||||
$ftps->put("$dir2/$ALLfile", "$ALLfile");
|
||||
# if ($FTPvalidate > 0)
|
||||
# {
|
||||
# $FTPfilesize = $ftps->size("$ALLfile");
|
||||
# if($DBX){print STDERR "FTP FILESIZE: $FTPfilesize/$FILEsize1[$i] | $ALLfile\n";}
|
||||
# if ( ($FILEsize1[$i] > 100) && ($FTPfilesize < 100) )
|
||||
# {
|
||||
# print "ERROR! File did not transfer, exiting: $FTPfilesize/$FILEsize1[$i] | $ALLfile\n";
|
||||
# exit;
|
||||
# }
|
||||
# }
|
||||
if ($FTPpersistent < 1)
|
||||
{
|
||||
$ftps->quit;
|
||||
}
|
||||
|
||||
# FTP2 scripts do not alter the URL of the recording
|
||||
# $stmtA = "UPDATE recording_log set location='$VARHTTP_path/$start_date_PATH$ALLfile' where recording_id='$recording_id';";
|
||||
# if($DB){print STDERR "\n|$stmtA|\n";}
|
||||
# $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
|
||||
|
||||
if (!$T)
|
||||
{
|
||||
`mv -f "$dir2/$ALLfile" "$PATHDONEmonitor/FTP2/$ALLfile"`;
|
||||
}
|
||||
|
||||
if($DBX){print STDERR "Transfered $transfered_files files\n";}
|
||||
|
||||
if ( $transfered_files == $file_limit)
|
||||
{
|
||||
if($DBX){print STDERR "Transfer limit of $file_limit reached breaking out of the loop\n";}
|
||||
last();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($DB){print "ERROR: Could not ping server $VARFTP_host\n";}
|
||||
}
|
||||
### END Remote file transfer
|
||||
|
||||
### sleep for twenty hundredths of a second to not flood the server with disk activity
|
||||
usleep(1*200*1000);
|
||||
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($DB) {print "DONE... EXITING\n\n";}
|
||||
|
||||
$dbhA->disconnect();
|
||||
|
||||
|
||||
exit;
|
||||
@@ -41,9 +41,10 @@
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
# 130328-0029 - Converted ereg to preg functions
|
||||
# 130603-2222 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130802-0957 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
@@ -144,8 +145,8 @@ else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
@@ -200,12 +201,12 @@ if ($ADD==1)
|
||||
|
||||
$stmt="SELECT extension,fullname FROM phones where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysqli_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
@@ -258,12 +259,12 @@ if ($ADD==2)
|
||||
|
||||
$stmt="SELECT extension FROM live_channels where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysqli_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
@@ -315,12 +316,12 @@ if ($ADD==3)
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysqli_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
@@ -372,12 +373,12 @@ if ($ADD==4)
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_sip_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysqli_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
@@ -430,12 +431,12 @@ if ($ADD==5)
|
||||
|
||||
$stmt="SELECT conf_exten,extension FROM conferences where server_ip = '$server_ip' order by conf_exten $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysqli_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
|
||||
+272
-271
File diff suppressed because it is too large
Load Diff
+22
-22
@@ -61,9 +61,10 @@
|
||||
# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled
|
||||
# 130328-0017 - Converted ereg to preg functions
|
||||
# 130603-2220 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130802-1002 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
@@ -94,7 +95,7 @@ while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
|
||||
{$user_abb = preg_replace("/^./","",$user_abb); $forever_stop++;}
|
||||
|
||||
$version = '2.2.6-1';
|
||||
$build = '130328-0017';
|
||||
$build = '130802-1002';
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$DB=preg_replace("/[^0-9a-z]/","",$DB);
|
||||
@@ -182,8 +183,8 @@ else
|
||||
if($auth>0)
|
||||
{
|
||||
$stmt="SELECT full_name,user_level from vicidial_users where user='$user' and active='Y';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$LOGfullname=$row[0];
|
||||
if ($WeBRooTWritablE > 0)
|
||||
{
|
||||
@@ -242,8 +243,8 @@ else
|
||||
$authphone=0;
|
||||
$stmt="SELECT count(*) from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$authphone=$row[0];
|
||||
if (!$authphone)
|
||||
{
|
||||
@@ -279,8 +280,8 @@ else
|
||||
echo "<title>astGUIclient web client</title>\n";
|
||||
$stmt="SELECT extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,messages,old_messages,protocol,local_gmt,ASTmgrUSERNAME,ASTmgrSECRET,login_user,login_pass,login_campaign,park_on_extension,conf_on_extension,VICIDIAL_park_on_extension,VICIDIAL_park_on_filename,monitor_prefix,recording_exten,voicemail_exten,voicemail_dump_exten,ext_context,dtmf_send_extension,call_out_number_group,client_browser,install_directory,local_web_callerID_URL,VICIDIAL_web_URL,AGI_call_logging_enabled,user_switching_enabled,conferencing_enabled,admin_hangup_enabled,admin_hijack_enabled,admin_monitor_enabled,call_parking_enabled,updater_check_enabled,AFLogging_enabled,QUEUE_ACTION_enabled,CallerID_popup_enabled,voicemail_button_enabled,enable_fast_refresh,fast_refresh_rate,enable_persistant_mysql,auto_dial_next_number,VDstop_rec_after_each_call,DBX_server,DBX_database,DBX_user,DBX_pass,DBX_port,DBY_server,DBY_database,DBY_user,DBY_pass,DBY_port,outbound_cid,enable_sipsak_messages,email,template_id,conf_override,phone_context,phone_ring_timeout,conf_secret from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$extension=$row[0];
|
||||
$dialplan_number=$row[1];
|
||||
$voicemail_id=$row[2];
|
||||
@@ -352,23 +353,23 @@ else
|
||||
|
||||
$stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'agc';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
|
||||
$stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','agc','$NOW_TIME','$session_name');";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
|
||||
$stmt="SELECT count(*) from phone_favorites where extension='$extension' and server_ip = '$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$favorites_present=$row[0];
|
||||
if ($favorites_present > 0)
|
||||
{
|
||||
$stmt="SELECT extensions_list from phone_favorites where extension='$extension' and server_ip = '$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$favorites_list=$row[0];
|
||||
$h=0;
|
||||
$favorites_listX = preg_replace("/\'/i",'',$favorites_list);
|
||||
@@ -380,8 +381,8 @@ else
|
||||
while ($favorites_count > $o)
|
||||
{
|
||||
$stmt="SELECT fullname,protocol from phones where extension = '$favorites[$o]' and server_ip='$server_ip';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$rowx=mysqli_fetch_row($rslt);
|
||||
$favorites_names[$o] = $rowx[0];
|
||||
$favorites_listX .= "$rowx[1]/$favorites[$o],";
|
||||
$o++;
|
||||
@@ -398,13 +399,13 @@ else
|
||||
### gather phone extensions and fullnames for favorites editor ###
|
||||
$stmt="SELECT extension,fullname from phones where server_ip = '$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$exten_ct = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$exten_ct = mysqli_num_rows($rslt);
|
||||
$favlistCT=0;
|
||||
$nofavlistCT=0;
|
||||
while ($favlistCT < $exten_ct)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$favlist[$favlistCT]= "$row[0] - $row[1]";
|
||||
$favlistCT++;
|
||||
}
|
||||
@@ -1331,7 +1332,6 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";}
|
||||
// alert(xmlhttp.responseText);
|
||||
// document.getElementById("busycallsdebug").innerHTML = checklive_query + "<BR>" + xmlhttp.responseText;
|
||||
// pause();
|
||||
|
||||
var check_live_line=check_live.split("\n");
|
||||
var check_live_array=check_live_line[0].split("|");
|
||||
var inbound_call_array=check_live_line[1].split("|");
|
||||
@@ -1801,7 +1801,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";}
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
checkconf_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&conf_exten=" + taskconfnum;
|
||||
checkconf_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&conf_exten=" + taskconfnum + "&bcrypt=OFF";
|
||||
xmlhttp.open('POST', 'conf_exten_check.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(checkconf_query);
|
||||
@@ -1909,7 +1909,7 @@ if ($enable_fast_refresh < 1) {echo "var refresh_interval = 1000;\n";}
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
reg_conf_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&conf_exten=" + taskconfreg + "&exten=" + extension + "&ACTION=register";
|
||||
reg_conf_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&conf_exten=" + taskconfreg + "&exten=" + extension + "&ACTION=register&bcrypt=OFF";
|
||||
xmlhttp.open('POST', 'conf_exten_check.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(reg_conf_query);
|
||||
|
||||
+15
-12
@@ -1,14 +1,17 @@
|
||||
<?php
|
||||
# audit_comments.php
|
||||
#
|
||||
# Copyright (C) 2012 poundteam.com LICENSE: AGPLv2
|
||||
# Copyright (C) 2013 poundteam.com,vicidial.org LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed to display QC audit comments, contributed by poundteam.com
|
||||
#
|
||||
# changes:
|
||||
# 121116-1322 - First build, added to vicidial codebase
|
||||
# 130802-0957 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
require("functions.php");
|
||||
|
||||
function audit_comments($lead_id,$list_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log,$campaign) {
|
||||
$audit_comments_active=audit_comments_active($list_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log);
|
||||
if ($audit_comments_active) {
|
||||
@@ -17,11 +20,11 @@ function audit_comments($lead_id,$list_id,$format,$user,$mel,$NOW_TIME,$link,$se
|
||||
if ($format=='debug') {
|
||||
echo "\n<!-- $stmt -->";
|
||||
}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {
|
||||
mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditComments2',$user,$server_ip,$session_name,$one_mysql_log);
|
||||
}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if (strlen($row[0]) > 0) {
|
||||
$comment=$row[0];
|
||||
//Put comment in comment table
|
||||
@@ -29,17 +32,17 @@ function audit_comments($lead_id,$list_id,$format,$user,$mel,$NOW_TIME,$link,$se
|
||||
if ($format=='debug') {
|
||||
echo "\n<!-- $stmt -->";
|
||||
}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {
|
||||
mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditComments3',$user,$server_ip,$session_name,$one_mysql_log);
|
||||
}
|
||||
$affected=mysql_affected_rows();
|
||||
$affected=mysqli_affected_rows($link);
|
||||
if($affected>0) {
|
||||
$stmt="UPDATE vicidial_list set comments='' where lead_id='$lead_id';";
|
||||
if ($format=='debug') {
|
||||
echo "\n<!-- $stmt -->";
|
||||
}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {
|
||||
mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditComments4',$user,$server_ip,$session_name,$one_mysql_log);
|
||||
}
|
||||
@@ -55,11 +58,11 @@ function audit_comments_active($list_id,$format,$user,$mel,$NOW_TIME,$link,$serv
|
||||
if ($format=='debug') {
|
||||
echo "\n<!-- $stmt -->";
|
||||
}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {
|
||||
mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-AuditComments5',$user,$server_ip,$session_name,$one_mysql_log);
|
||||
}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if ($row[0] == '1') {
|
||||
return true;
|
||||
} else {
|
||||
@@ -71,18 +74,18 @@ function get_audited_comments($lead_id,$format,$user,$mel,$NOW_TIME,$link,$serve
|
||||
global $ACcomments;
|
||||
$stmt="select user_id,comment from vicidial_comments where lead_id='$lead_id';";
|
||||
if ($mel > 0) {
|
||||
mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"00142-65-AuditComments:$stmt LeadID: $lead_id,$format,$user,$mel,$NOW_TIME,$link,$server_ip,$session_name,$one_mysql_log",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"00142-65-AuditComments:$stmt LeadID: $lead_id,$format,$user,$mel,$NOW_TIME,\$link,$server_ip,$session_name,$one_mysql_log",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {
|
||||
mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-69-AuditComments',$user,$server_ip,$session_name,$one_mysql_log);
|
||||
}
|
||||
$ACcount=mysql_num_rows($rslt);
|
||||
$ACcount=mysqli_num_rows($rslt);
|
||||
mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-72-AuditComments $ACcount='.$ACcount,$user,$server_ip,$session_name,$one_mysql_log);
|
||||
if($ACcount>0) {
|
||||
$i=0;
|
||||
while ($i < $ACcount) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-77-AuditComments UserID='.$row[0],$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$ACcomments .= "UserID: $row[0]\n";
|
||||
mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00142-79-AuditComments Comment='.$row[1],$user,$server_ip,$session_name,$one_mysql_log);
|
||||
|
||||
@@ -32,9 +32,10 @@
|
||||
# 130328-0028 - Converted ereg to preg functions
|
||||
# 130603-2219 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130705-1524 - Added optional encrypted passwords compatibility
|
||||
# 130802-1005 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
@@ -93,8 +94,8 @@ else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
@@ -133,14 +134,14 @@ else
|
||||
##### print outbound calls from the call_log table
|
||||
$stmt="SELECT uniqueid,start_time,$number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$out_calls_count = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$out_calls_count = mysqli_num_rows($rslt);}
|
||||
echo "$out_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($out_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[3] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
@@ -159,14 +160,14 @@ else
|
||||
##### print inbound calls from the live_inbound_log table
|
||||
$stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$in_calls_count = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$in_calls_count = mysqli_num_rows($rslt);}
|
||||
echo "$in_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($in_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[4] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
|
||||
@@ -60,18 +60,21 @@
|
||||
# 130328-0011 - Converted ereg to preg functions
|
||||
# 130603-2218 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130705-1524 - Added optional encrypted passwords compatibility
|
||||
# 130802-1015 - Changed to use PHP mysqli functions
|
||||
#
|
||||
|
||||
$version = '2.8-35';
|
||||
$build = '130705-1524';
|
||||
$version = '2.8-36';
|
||||
$build = '130802-1015';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=39;
|
||||
$one_mysql_log=0;
|
||||
$DB=0;
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
$bcrypt=1;
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
@@ -97,6 +100,11 @@ if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"
|
||||
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
|
||||
if (isset($_GET["campagentstdisp"])) {$campagentstdisp=$_GET["campagentstdisp"];}
|
||||
elseif (isset($_POST["campagentstdisp"])) {$campagentstdisp=$_POST["campagentstdisp"];}
|
||||
if (isset($_GET["bcrypt"])) {$bcrypt=$_GET["bcrypt"];}
|
||||
elseif (isset($_POST["bcrypt"])) {$bcrypt=$_POST["bcrypt"];}
|
||||
|
||||
if ($bcrypt == 'OFF')
|
||||
{$bcrypt=0;}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
@@ -106,13 +114,13 @@ header ("Pragma: no-cache"); // HTTP/1.0
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
@@ -150,7 +158,7 @@ $random = (rand(1000000, 9999999) + 10000000);
|
||||
|
||||
|
||||
$auth=0;
|
||||
$auth_message = user_authorization($user,$pass,'',0,1,0);
|
||||
$auth_message = user_authorization($user,$pass,'',0,$bcrypt,0);
|
||||
if ($auth_message == 'GOOD')
|
||||
{$auth=1;}
|
||||
|
||||
@@ -170,9 +178,9 @@ else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
@@ -224,26 +232,26 @@ if ($ACTION == 'refresh')
|
||||
### see if the agent has a record in the vicidial_live_agents table
|
||||
$stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03003',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$Acount=$row[0];
|
||||
|
||||
### see if the agent has a record in the vicidial_session_data table
|
||||
$stmt="SELECT count(*) from vicidial_session_data where user='$user' and server_ip='$server_ip' and session_name='$session_name';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03039',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$Scount=$row[0];
|
||||
|
||||
if ($Acount > 0)
|
||||
{
|
||||
$stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$Astatus = $row[0];
|
||||
$Acallerid = $row[1];
|
||||
$Aagent_log_id = $row[2];
|
||||
@@ -252,19 +260,19 @@ if ($ACTION == 'refresh')
|
||||
|
||||
$api_manual_dial='STANDARD';
|
||||
$stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$vcc_conf_ct = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$vcc_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($vcc_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$api_manual_dial = $row[0];
|
||||
}
|
||||
}
|
||||
# ### find out if external table shows agent should be disabled
|
||||
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
|
||||
# if ($DB) {echo "|$stmt|\n";}
|
||||
# $rslt=mysql_query($stmt, $link);
|
||||
# $row=mysql_fetch_row($rslt);
|
||||
# $rslt=mysql_to_mysqli($stmt, $link);
|
||||
# $row=mysqli_fetch_row($rslt);
|
||||
# $AexternalDEAD=$row[0];
|
||||
|
||||
##### BEGIN check on calls in queue, number of active calls in the campaign
|
||||
@@ -274,9 +282,9 @@ if ($ACTION == 'refresh')
|
||||
### grab the status of this agent to display
|
||||
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$Alogin=$row[0];
|
||||
$Acampaign=$row[1];
|
||||
$AccampSQL=$row[2];
|
||||
@@ -291,9 +299,9 @@ if ($ACTION == 'refresh')
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$RingCalls=$row[0];
|
||||
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">Calls in Queue: $RingCalls</font>";}
|
||||
else {$RingCalls = "<font class=\"queue_text\">Calls in Queue: $RingCalls</font>";}
|
||||
@@ -301,9 +309,9 @@ if ($ACTION == 'refresh')
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$DiaLCalls=$row[0];
|
||||
}
|
||||
else
|
||||
@@ -319,12 +327,12 @@ if ($ACTION == 'refresh')
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03005',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9305$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
@@ -335,9 +343,9 @@ if ($ACTION == 'refresh')
|
||||
### find whether the call the agent is on is hung up
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03018',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$AcalleridCOUNT=$row[0];
|
||||
|
||||
if ( ($AcalleridCOUNT > 0) and (preg_match("/INCALL/i",$Astatus)) and (preg_match("/^M/",$Acallerid)) )
|
||||
@@ -345,7 +353,7 @@ if ($ACTION == 'refresh')
|
||||
$updateNOW_TIME = date("Y-m-d H:i:s");
|
||||
$stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03038',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
|
||||
@@ -355,9 +363,9 @@ if ($ACTION == 'refresh')
|
||||
### find whether the agent log record has already logged DEAD
|
||||
$stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03019',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$Aagent_log_idCOUNT=$row[0];
|
||||
|
||||
if ($Aagent_log_idCOUNT < 1)
|
||||
@@ -366,12 +374,12 @@ if ($ACTION == 'refresh')
|
||||
$deadNOW_TIME = date("Y-m-d H:i:s");
|
||||
$stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03020',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03021',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
@@ -382,12 +390,12 @@ if ($ACTION == 'refresh')
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03009',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9309$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
@@ -397,9 +405,9 @@ if ($ACTION == 'refresh')
|
||||
### find whether the call the agent is on is hung up
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03029',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$AcalleridCOUNT=$row[0];
|
||||
|
||||
if ( ($AcalleridCOUNT > 0) and (preg_match("/INCALL/i",$Astatus)) )
|
||||
@@ -407,7 +415,7 @@ if ($ACTION == 'refresh')
|
||||
$updateNOW_TIME = date("Y-m-d H:i:s");
|
||||
$stmt="UPDATE vicidial_auto_calls set last_update_time='$updateNOW_TIME' where callerid='$Acallerid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03037',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
|
||||
@@ -417,9 +425,9 @@ if ($ACTION == 'refresh')
|
||||
### find whether the agent log record has already logged DEAD
|
||||
$stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03030',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$Aagent_log_idCOUNT=$row[0];
|
||||
|
||||
if ($Aagent_log_idCOUNT < 1)
|
||||
@@ -428,12 +436,12 @@ if ($ACTION == 'refresh')
|
||||
$deadNOW_TIME = date("Y-m-d H:i:s");
|
||||
$stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03031',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03032',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
@@ -443,9 +451,9 @@ if ($ACTION == 'refresh')
|
||||
### grab the API hangup and API dispo fields in vicidial_live_agents
|
||||
$stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds,external_dtmf,external_transferconf,external_park,external_timer_action_destination,external_recording from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03010',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$external_hangup = $row[0];
|
||||
$external_status = $row[1];
|
||||
$external_pause = $row[2];
|
||||
@@ -465,43 +473,43 @@ if ($ACTION == 'refresh')
|
||||
if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') )
|
||||
{
|
||||
$stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mdq_count_record_ct = mysql_num_rows($rslt);
|
||||
$mdq_count_record_ct = mysqli_num_rows($rslt);
|
||||
if ($mdq_count_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$MDQ_count = $row[0];
|
||||
}
|
||||
|
||||
if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) )
|
||||
{
|
||||
$stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mdq_record_ct = mysql_num_rows($rslt);
|
||||
$mdq_record_ct = mysqli_num_rows($rslt);
|
||||
if ($mdq_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$MDQ_mdq_id = $row[0];
|
||||
$MDQ_external_dial = $row[1];
|
||||
$external_dial = $MDQ_external_dial;
|
||||
|
||||
$stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$UMDQaffected_rows_update = mysql_affected_rows($link);
|
||||
$UMDQaffected_rows_update = mysqli_affected_rows($link);
|
||||
|
||||
if ($UMDQaffected_rows_update > 0)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMDQaffected_rows_update = mysql_affected_rows($link);
|
||||
$VLAMDQaffected_rows_update = mysqli_affected_rows($link);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -512,9 +520,9 @@ if ($ACTION == 'refresh')
|
||||
$web_epoch = date("U");
|
||||
$stmt="SELECT UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater where server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03014',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$server_epoch = $row[0];
|
||||
$db_epoch = $row[1];
|
||||
$time_diff = ($server_epoch - $db_epoch);
|
||||
@@ -524,32 +532,32 @@ if ($ACTION == 'refresh')
|
||||
$InGroupChangeDetails = '0|||';
|
||||
$manager_ingroup_set=0;
|
||||
$stmt="SELECT count(*) FROM vicidial_live_agents where user='$user' and manager_ingroup_set='SET';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03022',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mis_record_ct = mysql_num_rows($rslt);
|
||||
$mis_record_ct = mysqli_num_rows($rslt);
|
||||
if ($mis_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$manager_ingroup_set = $row[0];
|
||||
}
|
||||
if ($manager_ingroup_set > 0)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET closer_campaigns=external_ingroups, manager_ingroup_set='Y' where user='$user' and manager_ingroup_set='SET';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03023',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMISaffected_rows_update = mysql_affected_rows($link);
|
||||
$VLAMISaffected_rows_update = mysqli_affected_rows($link);
|
||||
if ($VLAMISaffected_rows_update > 0)
|
||||
{
|
||||
$stmt="SELECT external_ingroups,external_blended,external_igb_set_user,outbound_autodial,dial_method FROM vicidial_live_agents vla, vicidial_campaigns vc where user='$user' and manager_ingroup_set='Y' and vla.campaign_id=vc.campaign_id;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03024',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$migs_record_ct = mysql_num_rows($rslt);
|
||||
$migs_record_ct = mysqli_num_rows($rslt);
|
||||
if ($migs_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$external_ingroups = $row[0];
|
||||
$external_blended = $row[1];
|
||||
$external_igb_set_user = $row[2];
|
||||
@@ -557,13 +565,13 @@ if ($ACTION == 'refresh')
|
||||
$dial_method = $row[4];
|
||||
|
||||
$stmt="SELECT full_name FROM vicidial_users where user='$external_igb_set_user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03025',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mign_record_ct = mysql_num_rows($rslt);
|
||||
$mign_record_ct = mysqli_num_rows($rslt);
|
||||
if ($mign_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$external_igb_set_name = $row[0];
|
||||
}
|
||||
|
||||
@@ -573,15 +581,15 @@ if ($ACTION == 'refresh')
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents SET outbound_autodial='$NEWoutbound_autodial' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03026',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMIBaffected_rows_update = mysql_affected_rows($link);
|
||||
$VLAMIBaffected_rows_update = mysqli_affected_rows($link);
|
||||
|
||||
$InGroupChangeDetails = "1|$external_blended|$external_igb_set_user|$external_igb_set_name";
|
||||
|
||||
$stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$Acampaign_id',event_date='$NOW_TIME',blended='$external_blended',closer_campaigns='$external_ingroups',manager_change='$external_igb_set_user';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03027',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
@@ -589,17 +597,17 @@ if ($ACTION == 'refresh')
|
||||
|
||||
##### grab the shift information the agent
|
||||
$stmt="SELECT user_group,agent_shift_enforcement_override from vicidial_users where user='$user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03015',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$VU_user_group = $row[0];
|
||||
$VU_agent_shift_enforcement_override = $row[1];
|
||||
|
||||
### Gather timeclock and shift enforcement restriction settings
|
||||
$stmt="SELECT shift_enforcement,group_shifts from vicidial_user_groups where user_group='$VU_user_group';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03016',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$shift_enforcement = $row[0];
|
||||
$LOGgroup_shiftsSQL = preg_replace('/\s\s/','',$row[1]);
|
||||
$LOGgroup_shiftsSQL = preg_replace('/\s/',"','",$LOGgroup_shiftsSQL);
|
||||
@@ -618,14 +626,14 @@ if ($ACTION == 'refresh')
|
||||
$wday = date("w");
|
||||
|
||||
$stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'3017',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$shifts_to_print = mysql_num_rows($rslt);
|
||||
$shifts_to_print = mysqli_num_rows($rslt);
|
||||
|
||||
$o=0;
|
||||
while ( ($shifts_to_print > $o) and ($shift_ok < 1) )
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$rowx=mysqli_fetch_row($rslt);
|
||||
$shift_id = $rowx[0];
|
||||
$shift_start_time = $rowx[1];
|
||||
$shift_length = $rowx[2];
|
||||
@@ -686,37 +694,37 @@ if ($ACTION == 'refresh')
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET external_timer_action='' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03028',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAETAaffected_rows_update = mysql_affected_rows($link);
|
||||
$VLAETAaffected_rows_update = mysqli_affected_rows($link);
|
||||
}
|
||||
}
|
||||
$total_conf=0;
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03011',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$sip_list = mysql_num_rows($rslt);}
|
||||
if ($rslt) {$sip_list = mysqli_num_rows($rslt);}
|
||||
# echo "$sip_list|";
|
||||
$loop_count=0;
|
||||
while ($sip_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$ChannelA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03012',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
if ($rslt) {$channels_list = mysqli_num_rows($rslt);}
|
||||
# echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$ChannelA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
@@ -751,7 +759,7 @@ if ($ACTION == 'register')
|
||||
{
|
||||
$stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$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 "Conference $conf_exten has been registered to $exten\n";
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
#
|
||||
# dbconnect_mysqli.php version 2.8
|
||||
#
|
||||
# database connection settings and some global web settings
|
||||
#
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES:
|
||||
# 130328-0022 - Converted ereg to preg functions
|
||||
# 130802-0957 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
if ( file_exists("/etc/astguiclient.conf") )
|
||||
{
|
||||
$DBCagc = file("/etc/astguiclient.conf");
|
||||
foreach ($DBCagc as $DBCline)
|
||||
{
|
||||
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
|
||||
if (preg_match("/^PATHlogs/", $DBCline))
|
||||
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
|
||||
if (preg_match("/^PATHweb/", $DBCline))
|
||||
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
|
||||
if (preg_match("/^VARserver_ip/", $DBCline))
|
||||
{$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);}
|
||||
if (preg_match("/^VARDB_server/", $DBCline))
|
||||
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
|
||||
if (preg_match("/^VARDB_database/", $DBCline))
|
||||
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
|
||||
if (preg_match("/^VARDB_user/", $DBCline))
|
||||
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
|
||||
if (preg_match("/^VARDB_pass/", $DBCline))
|
||||
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
|
||||
if (preg_match("/^VARDB_port/", $DBCline))
|
||||
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#defaults for DB connection
|
||||
$VARDB_server = 'localhost';
|
||||
$VARDB_port = '3306';
|
||||
$VARDB_user = 'cron';
|
||||
$VARDB_pass = '1234';
|
||||
$VARDB_database = '1234';
|
||||
$WeBServeRRooT = '/usr/local/apache2/htdocs';
|
||||
}
|
||||
|
||||
$link=mysqli_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass", "$VARDB_database", $VARDB_port);
|
||||
if (!$link)
|
||||
{
|
||||
die('MySQL connect ERROR: ' . mysqli_error($link));
|
||||
}
|
||||
|
||||
$local_DEF = 'Local/';
|
||||
$conf_silent_prefix = '7';
|
||||
$local_AMP = '@';
|
||||
$ext_context = 'demo';
|
||||
$recording_exten = '8309';
|
||||
$WeBRooTWritablE = '1';
|
||||
$non_latin = '0'; # set to 1 for UTF rules, overridden by system_settings
|
||||
$flag_channels=0;
|
||||
$flag_string = 'VICIast20';
|
||||
|
||||
?>
|
||||
+17
-16
@@ -26,13 +26,14 @@
|
||||
# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled
|
||||
# 130328-0016 - Converted ereg to preg functions
|
||||
# 130603-2217 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130802-1006 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
$api_script = 'deactivate';
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
$filedate = date("Ymd");
|
||||
@@ -80,12 +81,12 @@ if (preg_match("/$TD$dispo$TD/",$sale_status))
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS INFO LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$ss_conf_ct = mysql_num_rows($rslt);
|
||||
$ss_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($ss_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
}
|
||||
##### END SYSTEM_SETTINGS INFO LOOKUP #####
|
||||
@@ -114,26 +115,26 @@ if (preg_match("/$TD$dispo$TD/",$sale_status))
|
||||
}
|
||||
|
||||
$stmt = "SELECT $search_field FROM vicidial_list where lead_id='$lead_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$sv_ct = mysql_num_rows($rslt);
|
||||
$sv_ct = mysqli_num_rows($rslt);
|
||||
if ($sv_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$search_value = $row[0];
|
||||
}
|
||||
|
||||
if (strlen($search_value) > 0)
|
||||
{
|
||||
$stmt="select list_id from vicidial_lists where campaign_id='$campaign_check';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$li_recs = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$li_recs = mysqli_num_rows($rslt);
|
||||
if ($li_recs > 0)
|
||||
{
|
||||
$L=0;
|
||||
while ($li_recs > $L)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$duplicate_lists .= "'$row[0]',";
|
||||
$L++;
|
||||
}
|
||||
@@ -145,12 +146,12 @@ if (preg_match("/$TD$dispo$TD/",$sale_status))
|
||||
{
|
||||
$search_count=0;
|
||||
$stmt = "SELECT count(*) FROM vicidial_list where $search_field='$search_value' and list_id IN($duplicate_lists);";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$sc_ct = mysql_num_rows($rslt);
|
||||
$sc_ct = mysqli_num_rows($rslt);
|
||||
if ($sc_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$search_count = $row[0];
|
||||
}
|
||||
|
||||
@@ -158,14 +159,14 @@ if (preg_match("/$TD$dispo$TD/",$sale_status))
|
||||
{
|
||||
$stmt="UPDATE vicidial_list SET status='$new_status' where $search_field='$search_value' and list_id IN($duplicate_lists) limit 100;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
|
||||
$SQL_log = "$stmt|";
|
||||
$SQL_log = preg_replace('/;/','',$SQL_log);
|
||||
$SQL_log = addslashes($SQL_log);
|
||||
$stmt="INSERT INTO vicidial_api_log set user='$user',agent_user='$user',function='deactivate_lead',value='$lead_id',result='$affected_rows',result_reason='$search_field',source='vdc',data='$SQL_log',api_date='$NOW_TIME',api_script='$api_script';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
|
||||
$MESSAGE = "DONE: $search_count duplicates found, $affected_rows updated to $new_status from $dispo";
|
||||
echo "$MESSAGE\n";
|
||||
|
||||
+18
-17
@@ -33,13 +33,14 @@
|
||||
# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled
|
||||
# 130328-0015 - Converted ereg to preg functions
|
||||
# 130603-2216 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130802-1007 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
$api_script = 'deactivate';
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
$filedate = date("Ymd");
|
||||
@@ -121,12 +122,12 @@ if ($match_found > 0)
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS INFO LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$ss_conf_ct = mysql_num_rows($rslt);
|
||||
$ss_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($ss_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
}
|
||||
##### END SYSTEM_SETTINGS INFO LOOKUP #####
|
||||
@@ -153,8 +154,8 @@ if ($match_found > 0)
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_live_agents where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$authlive=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) or ($authlive==0))
|
||||
@@ -167,12 +168,12 @@ if ($match_found > 0)
|
||||
{
|
||||
$search_count=0;
|
||||
$stmt = "SELECT count(*) FROM vicidial_list where lead_id='$lead_id' and list_id!='$new_list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$sc_ct = mysql_num_rows($rslt);
|
||||
$sc_ct = mysqli_num_rows($rslt);
|
||||
if ($sc_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$search_count = $row[0];
|
||||
}
|
||||
|
||||
@@ -182,30 +183,30 @@ if ($match_found > 0)
|
||||
if ($reset_dialed=='Y') {$reset_dialedSQL=", called_since_last_reset='N'";}
|
||||
$stmt="UPDATE vicidial_list SET list_id='$new_list_id' $reset_dialedSQL where lead_id='$lead_id' limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
|
||||
$campaign_idSQL='';
|
||||
$stmtA = "SELECT campaign_id FROM vicidial_lists where list_id='$new_list_id';";
|
||||
$rslt=mysql_query($stmtA, $link);
|
||||
$rslt=mysql_to_mysqli($stmtA, $link);
|
||||
if ($DB) {echo "$stmtA\n";}
|
||||
$vlc_ct = mysql_num_rows($rslt);
|
||||
$vlc_ct = mysqli_num_rows($rslt);
|
||||
if ($vlc_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$campaign_idSQL = ",campaign_id='$row[0]'";
|
||||
}
|
||||
|
||||
$stmtB="UPDATE vicidial_callbacks SET list_id='$new_list_id' $campaign_idSQL where lead_id='$lead_id' limit 1;";
|
||||
if ($DB) {echo "$stmtB\n";}
|
||||
$rslt=mysql_query($stmtB, $link);
|
||||
$CBaffected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmtB, $link);
|
||||
$CBaffected_rows = mysqli_affected_rows($link);
|
||||
|
||||
$SQL_log = "$stmt|$stmtB|$CBaffected_rows|";
|
||||
$SQL_log = preg_replace('/;/','',$SQL_log);
|
||||
$SQL_log = addslashes($SQL_log);
|
||||
$stmt="INSERT INTO vicidial_api_log set user='$user',agent_user='$user',function='deactivate_lead',value='$lead_id',result='$affected_rows',result_reason='$lead_id',source='vdc',data='$SQL_log',api_date='$NOW_TIME',api_script='$api_script';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
|
||||
$MESSAGE = "DONE: $search_count match found, $affected_rows updated to $new_list_id with $dispo status";
|
||||
echo "$MESSAGE\n";
|
||||
|
||||
+63
-58
@@ -17,23 +17,24 @@
|
||||
# 130328-0018 - Converted ereg to preg functions
|
||||
# 130603-2208 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130705-2004 - Added optional encrypted passwords compatibility
|
||||
# 130802-1004 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
|
||||
##### BEGIN validate user login credentials, check for failed lock out #####
|
||||
function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$return_hash)
|
||||
{
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,webroot_writable,pass_hash_enabled,pass_key,pass_cost FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$SSwebroot_writable = $row[1];
|
||||
$SSpass_hash_enabled = $row[2];
|
||||
@@ -73,30 +74,30 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur
|
||||
if ($user_option == 'MGR')
|
||||
{$stmt="SELECT count(*) from vicidial_users where user='$user' and $passSQL and manager_shift_enforcement_override='1' and active='Y' and ( (failed_login_count < $LOCK_trigger_attempts) or (UNIX_TIMESTAMP(last_login_date) < $LOCK_over) );";}
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($non_latin > 0) {$rslt=mysql_to_mysqli($link, "SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05009',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if ($auth < 1)
|
||||
{
|
||||
$auth_key='BAD';
|
||||
$auth_key='BAD'."|$stmt";
|
||||
$stmt="SELECT failed_login_count,UNIX_TIMESTAMP(last_login_date) from vicidial_users where user='$user';";
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($non_latin > 0) {$rslt=mysql_to_mysqli($link, "SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05010',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$cl_user_ct = mysql_num_rows($rslt);
|
||||
$cl_user_ct = mysqli_num_rows($rslt);
|
||||
if ($cl_user_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$failed_login_count = $row[0];
|
||||
$last_login_date = $row[1];
|
||||
|
||||
if ($failed_login_count < $LOCK_trigger_attempts)
|
||||
{
|
||||
$stmt="UPDATE vicidial_users set failed_login_count=(failed_login_count+1),last_ip='$ip' where user='$user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05011',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
else
|
||||
@@ -104,7 +105,7 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur
|
||||
if ($LOCK_over > $last_login_date)
|
||||
{
|
||||
$stmt="UPDATE vicidial_users set last_login_date=NOW(),failed_login_count=1,last_ip='$ip' where user='$user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05012',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
else
|
||||
@@ -123,7 +124,7 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur
|
||||
if ($user_update > 0)
|
||||
{
|
||||
$stmt="UPDATE vicidial_users set last_login_date=NOW(),last_ip='$ip',failed_login_count=0 where user='$user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05013',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
$auth_key='GOOD';
|
||||
@@ -144,36 +145,36 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
|
||||
|
||||
$vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|';
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
|
||||
$CFoutput='';
|
||||
$stmt="SHOW TABLES LIKE \"custom_$list_id\";";
|
||||
if ($DB>0) {echo "$stmt";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$tablecount_to_print = mysql_num_rows($rslt);
|
||||
$tablecount_to_print = mysqli_num_rows($rslt);
|
||||
if ($tablecount_to_print > 0)
|
||||
{
|
||||
$stmt="SELECT count(*) from custom_$list_id;";
|
||||
if ($DB>0) {echo "$stmt";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05003',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$fieldscount_to_print = mysql_num_rows($rslt);
|
||||
$fieldscount_to_print = mysqli_num_rows($rslt);
|
||||
if ($fieldscount_to_print > 0)
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$rowx=mysqli_fetch_row($rslt);
|
||||
$custom_records_count = $rowx[0];
|
||||
|
||||
$select_SQL='';
|
||||
$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 from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05004',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$fields_to_print = mysql_num_rows($rslt);
|
||||
$fields_to_print = mysqli_num_rows($rslt);
|
||||
$fields_list='';
|
||||
$o=0;
|
||||
while ($fields_to_print > $o)
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$rowx=mysqli_fetch_row($rslt);
|
||||
$A_field_id[$o] = $rowx[0];
|
||||
$A_field_label[$o] = $rowx[1];
|
||||
$A_field_name[$o] = $rowx[2];
|
||||
@@ -223,14 +224,14 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
|
||||
{
|
||||
##### BEGIN grab the data from custom table for the lead_id
|
||||
$stmt="SELECT $select_SQL FROM custom_$list_id where lead_id='$lead_id' LIMIT 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05005',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$list_lead_ct = mysql_num_rows($rslt);
|
||||
$list_lead_ct = mysqli_num_rows($rslt);
|
||||
}
|
||||
if ($list_lead_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$o=0;
|
||||
while ($fields_to_print >= $o)
|
||||
{
|
||||
@@ -478,12 +479,12 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
|
||||
{
|
||||
$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";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05006',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VUC_ct = mysql_num_rows($rslt);
|
||||
$VUC_ct = mysqli_num_rows($rslt);
|
||||
if ($VUC_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$user_custom_one = trim($row[0]);
|
||||
$user_custom_two = trim($row[1]);
|
||||
$user_custom_three = trim($row[2]);
|
||||
@@ -501,12 +502,12 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
|
||||
### find the dialed number and label for this call
|
||||
$stmt = "SELECT phone_number,alt_dial from vicidial_log where uniqueid='$uniqueid';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$vl_dialed_ct = mysql_num_rows($rslt);
|
||||
$vl_dialed_ct = mysqli_num_rows($rslt);
|
||||
if ($vl_dialed_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$dialed_number = $row[0];
|
||||
$dialed_label = $row[1];
|
||||
}
|
||||
@@ -514,13 +515,13 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
|
||||
|
||||
##### grab the data from vicidial_list for the lead_id
|
||||
$stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner FROM vicidial_list where lead_id='$lead_id' LIMIT 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$list_lead_ct = mysql_num_rows($rslt);
|
||||
$list_lead_ct = mysqli_num_rows($rslt);
|
||||
if ($list_lead_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$dispo = trim($row[3]);
|
||||
$tsr = trim($row[4]);
|
||||
$vendor_id = trim($row[5]);
|
||||
@@ -635,7 +636,7 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
|
||||
|
||||
function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code)
|
||||
{
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
|
||||
$postalgmt_found=0;
|
||||
if ( (preg_match("/POSTAL/i",$postalgmt)) && (strlen($postal_code)>4) )
|
||||
@@ -643,11 +644,11 @@ function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$
|
||||
if (preg_match('/^1$/', $phone_code))
|
||||
{
|
||||
$stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$pc_recs = mysqli_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$gmt_offset = $row[2]; $gmt_offset = preg_replace("/\+/i","",$gmt_offset);
|
||||
$dst = $row[3];
|
||||
$dst_range = $row[4];
|
||||
@@ -664,11 +665,11 @@ function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$
|
||||
if ($phone_code =='1')
|
||||
{
|
||||
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$pc_recs = mysqli_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$gmt_offset = $row[4]; $gmt_offset = preg_replace("/\+/i","",$gmt_offset);
|
||||
$dst = $row[5];
|
||||
$dst_range = $row[6];
|
||||
@@ -679,11 +680,11 @@ function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$
|
||||
if ($phone_code =='52')
|
||||
{
|
||||
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$pc_recs = mysqli_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$gmt_offset = $row[4]; $gmt_offset = preg_replace("/\+/i","",$gmt_offset);
|
||||
$dst = $row[5];
|
||||
$dst_range = $row[6];
|
||||
@@ -694,11 +695,11 @@ function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$
|
||||
if ($phone_code =='61')
|
||||
{
|
||||
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$pc_recs = mysqli_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$gmt_offset = $row[4]; $gmt_offset = preg_replace("/\+/i","",$gmt_offset);
|
||||
$dst = $row[5];
|
||||
$dst_range = $row[6];
|
||||
@@ -710,11 +711,11 @@ function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$
|
||||
{
|
||||
$PC_processed++;
|
||||
$stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$pc_recs = mysqli_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$gmt_offset = $row[4]; $gmt_offset = preg_replace("/\+/i","",$gmt_offset);
|
||||
$dst = $row[5];
|
||||
$dst_range = $row[6];
|
||||
@@ -1396,7 +1397,7 @@ function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$
|
||||
##### DETERMINE IF LEAD IS DIALABLE #####
|
||||
function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state)
|
||||
{
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
|
||||
$dialable=0;
|
||||
|
||||
@@ -1411,8 +1412,8 @@ function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state)
|
||||
|
||||
$stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$rowx=mysqli_fetch_row($rslt);
|
||||
$Gct_default_start = $rowx[3];
|
||||
$Gct_default_stop = $rowx[4];
|
||||
$Gct_sunday_start = $rowx[5];
|
||||
@@ -1536,11 +1537,11 @@ function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_
|
||||
$errno=''; $error='';
|
||||
if ( ($mel > 0) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$errno = mysql_errno($link);
|
||||
$errno = mysqli_errno($link);
|
||||
if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$error = mysql_error($link);
|
||||
$efp = fopen ("./vicidial_mysql_errors.txt", "a");
|
||||
$error = mysqli_error($link);
|
||||
$efp = fopen ("./vicidial_mysqli_errors.txt", "a");
|
||||
fwrite ($efp, "$NOW_TIME|vdc_db_query|$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n");
|
||||
fclose($efp);
|
||||
}
|
||||
@@ -1549,5 +1550,9 @@ function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_
|
||||
return $errno;
|
||||
}
|
||||
|
||||
function mysql_to_mysqli($stmt, $link) {
|
||||
$rslt=mysqli_query($link, $stmt);
|
||||
return $rslt;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
# inbound_popup.php version 2.6
|
||||
# inbound_popup.php version 2.8
|
||||
#
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
@@ -33,9 +33,10 @@
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
# 130328-0025 - Converted ereg to preg functions
|
||||
# 130603-2215 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130802-1008 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
@@ -104,8 +105,8 @@ else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
@@ -276,11 +277,11 @@ else
|
||||
{
|
||||
$stmt="SELECT uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,acknowledged,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$channels_list = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$channels_list = mysqli_num_rows($rslt);
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt|||||
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
@@ -333,11 +334,8 @@ else
|
||||
|
||||
$stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,9 +33,10 @@
|
||||
# 130328-0027 - Converted ereg to preg functions
|
||||
# 130603-2214 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130705-1522 - Added optional encrypted passwords compatibility
|
||||
# 130802-1009 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
@@ -94,8 +95,8 @@ else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
@@ -126,8 +127,8 @@ echo "UnixTime: $StarTtime|";
|
||||
|
||||
$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
echo "$row[0]|";
|
||||
|
||||
$MT[0]='';
|
||||
@@ -143,14 +144,14 @@ else
|
||||
{
|
||||
$stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysqli_num_rows($rslt);}
|
||||
echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$ChanneLA[$loop_count] = "$row[0]";
|
||||
$ChanneLB[$loop_count] = "$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
@@ -163,11 +164,11 @@ while($loop_count > $counter)
|
||||
$counter++;
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysqli_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "ChannelA: $ChanneLA[$counter] ~";
|
||||
echo "ChannelB: $ChanneLB[$counter] ~";
|
||||
@@ -177,11 +178,11 @@ while($loop_count > $counter)
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysqli_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "ChannelA: $ChanneLA[$counter] ~";
|
||||
echo "ChannelB: $ChanneLB[$counter] ~";
|
||||
@@ -191,11 +192,11 @@ while($loop_count > $counter)
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysqli_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "ChannelA: $ChanneLA[$counter] ~";
|
||||
echo "ChannelB: $ChanneLB[$counter] ~";
|
||||
@@ -205,11 +206,11 @@ while($loop_count > $counter)
|
||||
{
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysqli_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "ChannelA: $ChanneLA[$counter] ~";
|
||||
echo "ChannelB: $ChanneLB[$counter] ~";
|
||||
@@ -232,11 +233,11 @@ echo "\n";
|
||||
### check for live_inbound entry
|
||||
$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysqli_num_rows($rslt);}
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$LIuniqueid = "$row[0]";
|
||||
$LIchannel = "$row[1]";
|
||||
$LIcallerid = "$row[3]";
|
||||
@@ -259,8 +260,8 @@ if ($favorites_count > 0)
|
||||
$fav_extension = explode('/',$favorites[$h]);
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$favs_print .= "$fav_extension[1]: $row[0] ~";
|
||||
$h++;
|
||||
}
|
||||
|
||||
+230
-229
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
# park_calls_display.php version 2.6
|
||||
# park_calls_display.php version 2.8
|
||||
#
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
@@ -25,9 +25,10 @@
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
# 130328-0024 - Converted ereg to preg functions
|
||||
# 130603-2213 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130802-1024 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
@@ -83,8 +84,8 @@ else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
@@ -123,14 +124,14 @@ else
|
||||
##### print parked calls from the parked_channels table
|
||||
$stmt="SELECT channel,server_ip,channel_group,extension,parked_by,parked_time from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$park_calls_count = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$park_calls_count = mysqli_num_rows($rslt);
|
||||
echo "$park_calls_count\n";
|
||||
$loop_count=0;
|
||||
while ($park_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
+52
-51
@@ -11,15 +11,16 @@
|
||||
# 130328-0005 - Converted ereg to preg functions
|
||||
# 130603-2212 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130718-0946 - Fixed login bug
|
||||
# 130802-1139 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
$version = '2.8-7p';
|
||||
$build = '130718-0946';
|
||||
$version = '2.8-8p';
|
||||
$build = '130802-1139';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=73;
|
||||
$one_mysql_log=0;
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
@@ -86,13 +87,13 @@ $random = (rand(1000000, 9999999) + 10000000);
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day,vtiger_url,enable_vtiger_integration,outbound_autodial_active,enable_second_webform,user_territories_active,static_agent_url,custom_fields_enabled FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09001',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$vdc_header_date_format = $row[1];
|
||||
$vdc_customer_date_format = $row[2];
|
||||
@@ -175,10 +176,10 @@ echo "<!-- BROWSER: $BROWSER_WIDTH x $BROWSER_HEIGHT $JS_browser_width x $JS
|
||||
|
||||
|
||||
$stmt="SELECT user_group from vicidial_users where user='$VD_login';";
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($non_latin > 0) {$rslt=mysql_to_mysqli($link, "SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09002',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$VU_user_group=$row[0];
|
||||
|
||||
|
||||
@@ -254,9 +255,9 @@ if ($user_login_first == 1)
|
||||
{
|
||||
$stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09073',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$phone_login=$row[0];
|
||||
$phone_pass=$row[1];
|
||||
|
||||
@@ -344,18 +345,18 @@ else
|
||||
{
|
||||
##### grab the full name of the agent
|
||||
$stmt="SELECT full_name,user_level,hotkeys_active,agent_choose_ingroups,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,closer_default_blended,user_group,vicidial_recording_override,alter_custphone_override,alert_enabled,agent_shift_enforcement_override,shift_override_flag,allow_alerts,closer_campaigns,agent_choose_territories,custom_one,custom_two,custom_three,custom_four,custom_five,agent_call_log_view_override,agent_choose_blended,agent_lead_search_override from vicidial_users where user='$VD_login';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09004',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$LOGfullname = $row[0];
|
||||
$user_level = $row[1];
|
||||
$VU_user_group = $row[10];
|
||||
|
||||
### Gather timeclock and shift enforcement restriction settings
|
||||
$stmt="SELECT forced_timeclock_login,shift_enforcement,group_shifts,agent_status_viewable_groups,agent_status_view_time,agent_call_log_view,agent_xfer_consultative,agent_xfer_dial_override,agent_xfer_vm_transfer,agent_xfer_blind_transfer,agent_xfer_dial_with_customer,agent_xfer_park_customer_dial,agent_fullscreen,webphone_url_override,webphone_dialpad_override,webphone_systemkey_override from vicidial_user_groups where user_group='$VU_user_group';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09005',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$agent_fullscreen = $row[12];
|
||||
$webphone_url = $row[13];
|
||||
$webphone_dialpad_override = $row[14];
|
||||
@@ -428,23 +429,23 @@ else
|
||||
# login: ca101,cb101,cc101
|
||||
$alias_found=0;
|
||||
$stmt="select count(*) from phones_alias where alias_id = '$phone_login';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09006',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$alias_ct = mysql_num_rows($rslt);
|
||||
$alias_ct = mysqli_num_rows($rslt);
|
||||
if ($alias_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$alias_found = "$row[0]";
|
||||
}
|
||||
if ($alias_found > 0)
|
||||
{
|
||||
$stmt="select alias_name,logins_list from phones_alias where alias_id = '$phone_login' limit 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09007',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$alias_ct = mysql_num_rows($rslt);
|
||||
$alias_ct = mysqli_num_rows($rslt);
|
||||
if ($alias_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$alias_name = "$row[0]";
|
||||
$phone_login = "$row[1]";
|
||||
}
|
||||
@@ -472,9 +473,9 @@ else
|
||||
#$stmt="SELECT count(*) from phones where $phoneSQL and active = 'Y';";
|
||||
$stmt="SELECT count(*) from phones,servers where $phoneSQL and phones.active = 'Y' and active_asterisk_server='Y' and phones.server_ip=servers.server_ip;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09008',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$authphone=$row[0];
|
||||
if (!$authphone)
|
||||
{
|
||||
@@ -523,49 +524,49 @@ else
|
||||
### find the server_ip of each phone_login
|
||||
$stmtx="SELECT server_ip from phones where login = '$phones_auto[$pb]';";
|
||||
if ($DB) {echo "|$stmtx|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmtx, $link);
|
||||
if ($non_latin > 0) {$rslt=mysql_to_mysqli($link, "SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_to_mysqli($stmtx, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09009',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$rowx=mysqli_fetch_row($rslt);
|
||||
|
||||
### get number of agents logged in to each server
|
||||
$stmt="SELECT count(*) from web_client_sessions where server_ip = '$rowx[0]';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09010',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
|
||||
### find out whether the server is set to active
|
||||
$stmt="SELECT count(*) from servers where server_ip = '$rowx[0]' and active='Y' and active_asterisk_server='Y';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09011',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$rowy=mysql_fetch_row($rslt);
|
||||
$rowy=mysqli_fetch_row($rslt);
|
||||
|
||||
### find out if this server has a twin
|
||||
$twin_not_live=0;
|
||||
$stmt="SELECT active_twin_server_ip from servers where server_ip = '$rowx[0]';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09012',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$rowyy=mysql_fetch_row($rslt);
|
||||
$rowyy=mysqli_fetch_row($rslt);
|
||||
if (strlen($rowyy[0]) > 4)
|
||||
{
|
||||
### find out whether the twin server_updater is running
|
||||
$stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[0]' and last_update > '$past_minutes_date';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09013',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$rowyz=mysql_fetch_row($rslt);
|
||||
$rowyz=mysqli_fetch_row($rslt);
|
||||
if ($rowyz[0] < 1) {$twin_not_live=1;}
|
||||
}
|
||||
|
||||
### find out whether the server_updater is running
|
||||
$stmt="SELECT count(*) from server_updater where server_ip = '$rowx[0]' and last_update > '$past_minutes_date';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09014',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$rowz=mysql_fetch_row($rslt);
|
||||
$rowz=mysqli_fetch_row($rslt);
|
||||
|
||||
$pb_log .= "$phones_auto[$pb]|$rowx[0]|$row[0]|$rowy[0]|$rowz[0]|$twin_not_live| ";
|
||||
|
||||
@@ -585,9 +586,9 @@ else
|
||||
echo "<title>Phone web client</title>\n";
|
||||
$stmt="SELECT extension,dialplan_number,voicemail_id,phone_ip,computer_ip,server_ip,login,pass,status,active,phone_type,fullname,company,picture,messages,old_messages,protocol,local_gmt,ASTmgrUSERNAME,ASTmgrSECRET,login_user,login_pass,login_campaign,park_on_extension,conf_on_extension,VICIDIAL_park_on_extension,VICIDIAL_park_on_filename,monitor_prefix,recording_exten,voicemail_exten,voicemail_dump_exten,ext_context,dtmf_send_extension,call_out_number_group,client_browser,install_directory,local_web_callerID_URL,VICIDIAL_web_URL,AGI_call_logging_enabled,user_switching_enabled,conferencing_enabled,admin_hangup_enabled,admin_hijack_enabled,admin_monitor_enabled,call_parking_enabled,updater_check_enabled,AFLogging_enabled,QUEUE_ACTION_enabled,CallerID_popup_enabled,voicemail_button_enabled,enable_fast_refresh,fast_refresh_rate,enable_persistant_mysql,auto_dial_next_number,VDstop_rec_after_each_call,DBX_server,DBX_database,DBX_user,DBX_pass,DBX_port,DBY_server,DBY_database,DBY_user,DBY_pass,DBY_port,outbound_cid,enable_sipsak_messages,email,template_id,conf_override,phone_context,phone_ring_timeout,conf_secret,is_webphone,use_external_server_ip,codecs_list,webphone_dialpad,phone_ring_timeout,on_hook_agent,webphone_auto_answer from phones where login='$phone_login' and pass='$phone_pass' and active = 'Y';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09015',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$extension=$row[0];
|
||||
$dialplan_number=$row[1];
|
||||
$voicemail_id=$row[2];
|
||||
@@ -670,7 +671,7 @@ else
|
||||
{
|
||||
$stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09016',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
@@ -678,7 +679,7 @@ else
|
||||
{
|
||||
$stmt="UPDATE phones SET computer_ip='$ip' where login='$phone_login' and pass='$phone_pass' and active = 'Y';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09017',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
if ($clientDST)
|
||||
@@ -710,12 +711,12 @@ else
|
||||
|
||||
$stmt="DELETE from web_client_sessions where start_time < '$past_month_date' and extension='$extension' and server_ip = '$server_ip' and program = 'phone';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09018',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt="INSERT INTO web_client_sessions values('$extension','$server_ip','phone','$NOW_TIME','$session_name');";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09019',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
|
||||
@@ -731,13 +732,13 @@ else
|
||||
{
|
||||
##### find external_server_ip if enabled for this phone account
|
||||
$stmt="SELECT external_server_ip FROM servers where server_ip='$server_ip' LIMIT 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09020',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$exip_ct = mysql_num_rows($rslt);
|
||||
$exip_ct = mysqli_num_rows($rslt);
|
||||
if ($exip_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$webphone_server_ip =$row[0];
|
||||
}
|
||||
}
|
||||
@@ -745,13 +746,13 @@ else
|
||||
{
|
||||
##### find webphone_url in system_settings and generate IFRAME code for it #####
|
||||
$stmt="SELECT webphone_url FROM system_settings LIMIT 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09021',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$wu_ct = mysql_num_rows($rslt);
|
||||
$wu_ct = mysqli_num_rows($rslt);
|
||||
if ($wu_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$webphone_url =$row[0];
|
||||
}
|
||||
}
|
||||
@@ -759,13 +760,13 @@ else
|
||||
{
|
||||
##### find system_key in system_settings if populated #####
|
||||
$stmt="SELECT webphone_systemkey FROM system_settings LIMIT 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09022',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$wsk_ct = mysql_num_rows($rslt);
|
||||
$wsk_ct = mysqli_num_rows($rslt);
|
||||
if ($wsk_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$system_key =$row[0];
|
||||
}
|
||||
}
|
||||
|
||||
+44
-43
@@ -13,10 +13,11 @@
|
||||
# 130328-0021 - Converted ereg to preg functions
|
||||
# 130603-2211 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130705-2010 - Added optional encrypted passwords compatibility
|
||||
# 130802-1031 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
$version = '2.8-8';
|
||||
$build = '130603-2211';
|
||||
$version = '2.8-9';
|
||||
$build = '130802-1031';
|
||||
|
||||
$StarTtimE = date("U");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
@@ -75,31 +76,31 @@ if (!isset($phone_pass))
|
||||
}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$DB=preg_replace("/[^0-9a-z]/","",$DB);
|
||||
$phone_login=preg_replace("/[^\,0-9a-zA-Z]/","",$phone_login);
|
||||
$phone_pass=preg_replace("/[^0-9a-zA-Z]/","",$phone_pass);
|
||||
$VD_login=preg_replace("/[^0-9a-zA-Z]/","",$VD_login);
|
||||
$VD_pass=preg_replace("/[^0-9a-zA-Z]/","",$VD_pass);
|
||||
$VD_campaign=preg_replace("/[^0-9a-zA-Z_]/","",$VD_campaign);
|
||||
$user=preg_replace("/[^0-9a-zA-Z]/","",$user);
|
||||
$pass=preg_replace("/[^0-9a-zA-Z]/","",$pass);
|
||||
$stage=preg_replace("/[^0-9a-zA-Z]/","",$stage);
|
||||
$commit=preg_replace("/[^0-9a-zA-Z]/","",$commit);
|
||||
$referrer=preg_replace("/[^0-9a-zA-Z]/","",$referrer);
|
||||
$DB=preg_replace("/[^0-9a-z]/","",$DB);
|
||||
$phone_login=preg_replace("/[^\,0-9a-zA-Z]/","",$phone_login);
|
||||
$phone_pass=preg_replace("/[^0-9a-zA-Z]/","",$phone_pass);
|
||||
$VD_login=preg_replace("/[^0-9a-zA-Z]/","",$VD_login);
|
||||
$VD_pass=preg_replace("/[^0-9a-zA-Z]/","",$VD_pass);
|
||||
$VD_campaign=preg_replace("/[^0-9a-zA-Z_]/","",$VD_campaign);
|
||||
$user=preg_replace("/[^0-9a-zA-Z]/","",$user);
|
||||
$pass=preg_replace("/[^0-9a-zA-Z]/","",$pass);
|
||||
$stage=preg_replace("/[^0-9a-zA-Z]/","",$stage);
|
||||
$commit=preg_replace("/[^0-9a-zA-Z]/","",$commit);
|
||||
$referrer=preg_replace("/[^0-9a-zA-Z]/","",$referrer);
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,admin_home_url,admin_web_directory FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $qm_conf_ct)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$welcomeURL = $row[1];
|
||||
$admin_web_directory = $row[2];
|
||||
@@ -167,8 +168,8 @@ if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
### get name and group for this user
|
||||
$stmt="SELECT full_name,user_group from vicidial_users where user='$user' and active='Y';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$full_name = $row[0];
|
||||
$user_group = $row[1];
|
||||
print "<!-- vicidial_users name and group for $user: |$full_name|$user_group| -->\n";
|
||||
@@ -176,8 +177,8 @@ if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
### get vicidial_timeclock_status record count for this user
|
||||
$stmt="SELECT count(*) from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$vts_count = $row[0];
|
||||
|
||||
$last_action_sec=99;
|
||||
@@ -187,8 +188,8 @@ if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
### vicidial_timeclock_status record found, grab status and date of last activity
|
||||
$stmt="SELECT status,event_epoch from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$status = $row[0];
|
||||
$event_epoch = $row[1];
|
||||
$last_action_date = date("Y-m-d H:i:s", $event_epoch);
|
||||
@@ -222,10 +223,10 @@ if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
### No vicidial_timeclock_status record found, insert one
|
||||
$stmt="INSERT INTO vicidial_timeclock_status set status='START', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$status='START';
|
||||
$totTIME_HMS='0:00:00';
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
print "<!-- NEW vicidial_timeclock_status record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
if ( ($last_action_sec < 30) and ($status != 'START') )
|
||||
@@ -276,23 +277,23 @@ if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
$timeclock_id = mysqli_insert_id($link);
|
||||
print "<!-- NEW vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='LOGIN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
print "<!-- NEW vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
@@ -304,37 +305,37 @@ if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
$timeclock_id = mysqli_insert_id($link);
|
||||
print "<!-- NEW vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update last login record in the timeclock log
|
||||
$stmt="UPDATE vicidial_timeclock_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_log record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='LOGOUT', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
print "<!-- NEW vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update last login record in the timeclock audit log
|
||||
$stmt="UPDATE vicidial_timeclock_audit_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_audit_log record updated for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
|
||||
+1371
-1371
File diff suppressed because it is too large
Load Diff
@@ -15,9 +15,10 @@
|
||||
# 130328-0007 - Converted ereg to preg functions
|
||||
# 130603-2210 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130705-1515 - Added optional encrypted passwords compatibility
|
||||
# 130802-1032 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
@@ -93,12 +94,12 @@ $IFRAME=0;
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,custom_fields_enabled,allow_emails FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$timeclock_end_of_day = $row[1];
|
||||
$agentonly_callback_campaign_lock = $row[2];
|
||||
@@ -139,14 +140,14 @@ if ($auth_message == 'GOOD')
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and modify_leads='1';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$VUmodify=$row[0];
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_live_agents where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$LVAactive=$row[0];
|
||||
$LVAactive=9;
|
||||
if ( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) or ( ($LVAactive < 1) ) )
|
||||
@@ -212,14 +213,14 @@ if ($REPLY)
|
||||
{
|
||||
$reply_message=preg_replace('/(\"|\||\'|\;)/', '\\\$1', $reply_message);
|
||||
$log_stmt="INSERT INTO vicidial_email_log(email_row_id, lead_id, email_date, user, email_to, message, campaign_id, attachments) VALUES('$email_row_id', '$lead_id', now(), '$user', '$reply_to_address', '$reply_message', '$campaign', '$attachment_str')";
|
||||
$log_rslt=mysql_query($log_stmt, $link);
|
||||
$log_rslt=mysql_to_mysqli($log_stmt, $link);
|
||||
echo "<p>mail sent to $to!</p>";
|
||||
|
||||
# Hangup the "call" on the agent screen
|
||||
$stmt="UPDATE vicidial_live_agents set external_hangup='1' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -231,9 +232,9 @@ if ($REPLY)
|
||||
|
||||
if ($lead_id) {
|
||||
$stmt="select * from vicidial_email_list where lead_id='$lead_id' and direction='INBOUND' and status IN('NEW','INCALL') order by email_date asc";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if (mysql_num_rows($rslt)>0) {
|
||||
$row=mysql_fetch_array($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if (mysqli_num_rows($rslt)>0) {
|
||||
$row=mysqli_fetch_array($rslt);
|
||||
$email_row_id=$row["email_row_id"];
|
||||
preg_match('/\<[^\>\@]+\@[^\>\@]+\>/', $row["email_from"], $matches);
|
||||
if (strlen($matches[0])>0) {
|
||||
@@ -257,10 +258,10 @@ if ($lead_id) {
|
||||
$EMAIL_form.="<tr bgcolor=white><td align='right' valign='top' width='150'>Message:</td><td align='left' valign='top' width='*'><pre>$row[message]</pre></td></tr>\n";
|
||||
|
||||
$att_stmt="select * from inbound_email_attachments where email_row_id='$email_row_id'";
|
||||
$att_rslt=mysql_query($att_stmt, $link);
|
||||
if (mysql_num_rows($att_rslt)>0) {
|
||||
$att_rslt=mysql_to_mysqli($att_stmt, $link);
|
||||
if (mysqli_num_rows($att_rslt)>0) {
|
||||
$EMAIL_form.="<tr bgcolor=white><td align='right' valign='top' width='150'>Attachments:</td><td align='left' valign='top' width='*'><pre>";
|
||||
while($att_row=mysql_fetch_array($att_rslt)) {
|
||||
while($att_row=mysqli_fetch_array($att_rslt)) {
|
||||
$EMAIL_form.="<LI><a href='$_SERVER[PHP_SELF]?attachment_id=$att_row[attachment_id]&lead_id=$lead_id'>$att_row[filename]</a>\n";
|
||||
}
|
||||
$EMAIL_form.="</pre></td></tr>";
|
||||
@@ -288,9 +289,9 @@ if ($lead_id) {
|
||||
|
||||
if ($attachment_id) {
|
||||
$stmt="select * from inbound_email_attachments where attachment_id='$attachment_id'";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if (mysql_num_rows($rslt)>0) {
|
||||
$row=mysql_fetch_array($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if (mysqli_num_rows($rslt)>0) {
|
||||
$row=mysqli_fetch_array($rslt);
|
||||
$filename=$row["filename"];
|
||||
$encoding=$row["file_encoding"];
|
||||
$file_size=$row["file_size"];
|
||||
|
||||
@@ -21,12 +21,13 @@
|
||||
# 130603-2204 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130615-2155 - Allow qc_enabled user access to this page even if not logged in as an agent
|
||||
# 130705-1512 - Added optional encrypted passwords compatibility
|
||||
# 130802-1033 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
$version = '2.8-12';
|
||||
$build = '130615-2155';
|
||||
$version = '2.8-13';
|
||||
$build = '130802-1033';
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require_once("functions.php");
|
||||
|
||||
$bcrypt=1;
|
||||
@@ -185,12 +186,12 @@ $IFRAME=0;
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,custom_fields_enabled FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$timeclock_end_of_day = $row[1];
|
||||
$agentonly_callback_campaign_lock = $row[2];
|
||||
@@ -227,14 +228,14 @@ if ($auth_message == 'GOOD')
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and ( (modify_leads='1') or (qc_enabled='1') );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$VUmodify=$row[0];
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_live_agents where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$LVAactive=$row[0];
|
||||
|
||||
if ($custom_fields_enabled < 1)
|
||||
@@ -267,24 +268,24 @@ if ($stage=='SUBMIT')
|
||||
$CFoutput='';
|
||||
$stmt="SHOW TABLES LIKE \"custom_$list_id\";";
|
||||
if ($DB>0) {echo "$stmt";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$tablecount_to_print = mysql_num_rows($rslt);
|
||||
$tablecount_to_print = mysqli_num_rows($rslt);
|
||||
if ($tablecount_to_print > 0)
|
||||
{
|
||||
$update_SQL='';
|
||||
$VL_update_SQL='';
|
||||
$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 from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06003',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$fields_to_print = mysql_num_rows($rslt);
|
||||
$fields_to_print = mysqli_num_rows($rslt);
|
||||
$fields_list='';
|
||||
$o=0;
|
||||
while ($fields_to_print > $o)
|
||||
{
|
||||
$new_field_value='';
|
||||
$form_field_value='';
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$rowx=mysqli_fetch_row($rslt);
|
||||
$A_field_id[$o] = $rowx[0];
|
||||
$A_field_label[$o] = $rowx[1];
|
||||
$A_field_name[$o] = $rowx[2];
|
||||
@@ -350,12 +351,12 @@ if ($stage=='SUBMIT')
|
||||
$custom_record_lead_count=0;
|
||||
$stmt="SELECT count(*) from custom_$list_id where lead_id='$lead_id';";
|
||||
if ($DB>0) {echo "$stmt";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'06004',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$fieldleadcount_to_print = mysql_num_rows($rslt);
|
||||
$fieldleadcount_to_print = mysqli_num_rows($rslt);
|
||||
if ($fieldleadcount_to_print > 0)
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$rowx=mysqli_fetch_row($rslt);
|
||||
$custom_record_lead_count = $rowx[0];
|
||||
}
|
||||
$update_SQL = preg_replace("/,$/","",$update_SQL);
|
||||
@@ -363,10 +364,10 @@ if ($stage=='SUBMIT')
|
||||
if ($custom_record_lead_count > 0)
|
||||
{$custom_table_update_SQL = "UPDATE custom_$list_id SET $update_SQL where lead_id='$lead_id';";}
|
||||
|
||||
$rslt=mysql_query($custom_table_update_SQL, $link);
|
||||
$custom_update_count = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($custom_table_update_SQL, $link);
|
||||
$custom_update_count = mysqli_affected_rows($link);
|
||||
if ($DB) {echo "$custom_update_count|$custom_table_update_SQL\n";}
|
||||
if (!$rslt) {die('Could not execute: ' . mysql_error());}
|
||||
if (!$rslt) {die('Could not execute: ' . mysqli_error($link));}
|
||||
|
||||
$update_sent++;
|
||||
}
|
||||
@@ -379,10 +380,10 @@ if ($stage=='SUBMIT')
|
||||
$VL_update_SQL = preg_replace("/,$/","",$VL_update_SQL);
|
||||
$list_table_update_SQL = "UPDATE vicidial_list SET $custom_update_vl_SQL $VL_update_SQL where lead_id='$lead_id';";
|
||||
|
||||
$rslt=mysql_query($list_table_update_SQL, $link);
|
||||
$list_update_count = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($list_table_update_SQL, $link);
|
||||
$list_update_count = mysqli_affected_rows($link);
|
||||
if ($DB) {echo "$list_update_count|$list_table_update_SQL\n";}
|
||||
if (!$rslt) {die('Could not execute: ' . mysql_error());}
|
||||
if (!$rslt) {die('Could not execute: ' . mysqli_error($link));}
|
||||
|
||||
$update_sent++;
|
||||
}
|
||||
@@ -391,10 +392,10 @@ if ($stage=='SUBMIT')
|
||||
if ($custom_update_count > 0)
|
||||
{
|
||||
$list_table_update_SQL = "UPDATE vicidial_list SET entry_list_id='$list_id' where lead_id='$lead_id';";
|
||||
$rslt=mysql_query($list_table_update_SQL, $link);
|
||||
$list_update_count = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($list_table_update_SQL, $link);
|
||||
$list_update_count = mysqli_affected_rows($link);
|
||||
if ($DB) {echo "$list_update_count|$list_table_update_SQL\n";}
|
||||
if (!$rslt) {die('Could not execute: ' . mysql_error());}
|
||||
if (!$rslt) {die('Could not execute: ' . mysqli_error($link));}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,7 +408,7 @@ if ($stage=='SUBMIT')
|
||||
$SQL_log = addslashes($SQL_log);
|
||||
$stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$user', ip_address='$ip', event_section='LEADS', event_type='MODIFY', record_id='$lead_id', event_code='ADMIN MODIFY CUSTOM LEAD', event_sql=\"$SQL_log\", event_notes='$custom_update_count|$list_update_count';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -21,12 +21,13 @@
|
||||
# 130402-2255 - Added user_group variable
|
||||
# 130603-2206 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130705-1513 - Added optional encrypted passwords compatibility
|
||||
# 130802-1035 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
$version = '2.8-15';
|
||||
$build = '130705-1513';
|
||||
$version = '2.8-16';
|
||||
$build = '130802-1035';
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
|
||||
@@ -221,12 +222,12 @@ $IFRAME=0;
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$timeclock_end_of_day = $row[1];
|
||||
$agentonly_callback_campaign_lock = $row[2];
|
||||
@@ -286,12 +287,12 @@ else
|
||||
|
||||
$ignore_list_script_override='N';
|
||||
$stmt = "SELECT ignore_list_script_override FROM vicidial_inbound_groups where group_id='$group';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$ilso_ct = mysql_num_rows($rslt);
|
||||
$ilso_ct = mysqli_num_rows($rslt);
|
||||
if ($ilso_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$ignore_list_script_override = $row[0];
|
||||
}
|
||||
if ($ignore_list_script_override=='Y')
|
||||
@@ -300,22 +301,22 @@ if ($ignore_list_script_override=='Y')
|
||||
if ($ignore_list_script < 1)
|
||||
{
|
||||
$stmt="SELECT agent_script_override from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$agent_script_override = $row[0];
|
||||
if (strlen($agent_script_override) > 0)
|
||||
{$call_script = $agent_script_override;}
|
||||
}
|
||||
|
||||
$stmt="SELECT list_name,list_description from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$list_name = $row[0];
|
||||
$list_description = $row[1];
|
||||
|
||||
$stmt="SELECT script_name,script_text from vicidial_scripts where script_id='$call_script';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$script_name = $row[0];
|
||||
$script_text = stripslashes($row[1]);
|
||||
|
||||
@@ -491,13 +492,13 @@ if ($CF_uses_custom_fields=='Y')
|
||||
{
|
||||
### find the names of all custom fields, if any
|
||||
$stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$cffn_ct = mysql_num_rows($rslt);
|
||||
$cffn_ct = mysqli_num_rows($rslt);
|
||||
$d=0;
|
||||
while ($cffn_ct > $d)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$field_name_id = $row[0];
|
||||
$field_name_tag = "--A--" . $field_name_id . "--B--";
|
||||
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
# 110221-1252 - Added missing variables, accounted for call notes on manual dial calls
|
||||
# 130328-0019 - Converted ereg to preg functions
|
||||
# 130603-2201 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130802-1036 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
$version = '2.8-4';
|
||||
$build = '130603-2201';
|
||||
$version = '2.8-5';
|
||||
$build = '130802-1036';
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
|
||||
@@ -249,12 +250,12 @@ if (strlen($call_date) < 1)
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$timeclock_end_of_day = $row[1];
|
||||
$agentonly_callback_campaign_lock = $row[2];
|
||||
@@ -303,8 +304,8 @@ $label_email = 'Email';
|
||||
$label_comments = 'Comments';
|
||||
|
||||
$stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if (strlen($row[0])>0) {$label_title = $row[0];}
|
||||
if (strlen($row[1])>0) {$label_first_name = $row[1];}
|
||||
if (strlen($row[2])>0) {$label_middle_initial = $row[2];}
|
||||
@@ -364,14 +365,14 @@ if ($process > 0)
|
||||
#Update vicidial_list record
|
||||
$stmt="UPDATE vicidial_list SET vendor_lead_code='$vendor_lead_code',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',phone_code='$phone_code',phone_number='$phone_number',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',rank='$rank',owner='$owner' where lead_id='$lead_id';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
|
||||
#Insert/Update custom record
|
||||
$stmt="INSERT IGNORE INTO custom_$entry_list_id SET question='$question',answer='$answer',lead_id='$lead_id' ON DUPLICATE KEY UPDATE question='$question',answer='$answer';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$CFaffected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$CFaffected_rows = mysqli_affected_rows($link);
|
||||
|
||||
$pauseSQL = '';
|
||||
$epoch = date("U");
|
||||
@@ -379,8 +380,8 @@ if ($process > 0)
|
||||
#Update the agent screen with new data
|
||||
$stmt="UPDATE vicidial_live_agents set external_update_fields='1',external_update_fields_data='vendor_lead_code,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,phone_code,phone_number,gender,date_of_birth,alt_phone,email,security_phrase,comments,rank,owner,question,answer,formreload,' $pauseSQL where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
|
||||
if ($notesid < 100)
|
||||
{
|
||||
@@ -388,29 +389,29 @@ if ($process > 0)
|
||||
{
|
||||
$four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y")));
|
||||
$stmt = "SELECT uniqueid FROM vicidial_log where call_date > \"$four_hours_ago\" and user='$user' and lead_id='$lead_id' order by call_date desc limit 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$vid_ct = mysql_num_rows($rslt);
|
||||
$vid_ct = mysqli_num_rows($rslt);
|
||||
if ($vid_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$vicidial_id = $row[0];
|
||||
}
|
||||
}
|
||||
# Insert into vicidial_call_notes
|
||||
$stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='$vicidial_id',call_date='$call_date',call_notes='$call_notes';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$notesid = mysql_insert_id($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
$notesid = mysqli_insert_id($link);
|
||||
}
|
||||
else
|
||||
{
|
||||
# update vicidial_call_notes record
|
||||
$stmt="UPDATE vicidial_call_notes set order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes' where notesid='$notesid';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
}
|
||||
|
||||
echo "<BR><b>Data Updated, Hanging up call, please wait</b><BR><BR>\n";
|
||||
@@ -420,8 +421,8 @@ if ($process > 0)
|
||||
#Update the agent screen with status and hangup
|
||||
$stmt="UPDATE vicidial_live_agents set external_status='$status',external_hangup='1' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
}
|
||||
|
||||
$URLarray = explode("?", $PHP_SELF);
|
||||
@@ -692,15 +693,15 @@ echo "<tr bgcolor=#E6E6E6><td align=right>Disposition: </td><td align=left><sele
|
||||
|
||||
|
||||
$stmt="SELECT status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable from vicidial_statuses where selectable='Y' or status IN($extra_statuses) order by status";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$statuses_to_print = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$statuses_to_print = mysqli_num_rows($rslt);
|
||||
$statuses_list='';
|
||||
|
||||
$o=0;
|
||||
$DS=0;
|
||||
while ($statuses_to_print > $o)
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$rowx=mysqli_fetch_row($rslt);
|
||||
if ( (strlen($dispo) == strlen($rowx[0])) and (preg_match("/$dispo/i",$rowx[0])) )
|
||||
{$statuses_list .= "<option SELECTED value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; $DS++;}
|
||||
else
|
||||
@@ -709,14 +710,14 @@ while ($statuses_to_print > $o)
|
||||
}
|
||||
|
||||
$stmt="SELECT status,status_name,selectable,campaign_id,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable from vicidial_campaign_statuses where (selectable='Y' or status IN($extra_statuses)) and campaign_id='$campaign' order by status";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$CAMPstatuses_to_print = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$CAMPstatuses_to_print = mysqli_num_rows($rslt);
|
||||
|
||||
$o=0;
|
||||
$CBhold_set=0;
|
||||
while ($CAMPstatuses_to_print > $o)
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$rowx=mysqli_fetch_row($rslt);
|
||||
if ( (strlen($dispo) == strlen($rowx[0])) and (preg_match("/$dispo/i",$rowx[0])) )
|
||||
{$statuses_list .= "<option SELECTED value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; $DS++;}
|
||||
else
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
# 100622-2230 - Added field labels
|
||||
# 130328-0020 - Converted ereg to preg functions
|
||||
# 130603-2203 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130802-1037 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
$version = '2.8-4';
|
||||
$build = '130603-2203';
|
||||
$version = '2.8-5';
|
||||
$build = '130802-1037';
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
|
||||
@@ -217,12 +218,12 @@ if (strlen($call_date) < 1)
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$timeclock_end_of_day = $row[1];
|
||||
$agentonly_callback_campaign_lock = $row[2];
|
||||
@@ -271,8 +272,8 @@ $label_email = 'Email';
|
||||
$label_comments = 'Comments';
|
||||
|
||||
$stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if (strlen($row[0])>0) {$label_title = $row[0];}
|
||||
if (strlen($row[1])>0) {$label_first_name = $row[1];}
|
||||
if (strlen($row[2])>0) {$label_middle_initial = $row[2];}
|
||||
@@ -329,31 +330,31 @@ if ($process > 0)
|
||||
#Update vicidial_list record
|
||||
$stmt="UPDATE vicidial_list SET vendor_lead_code='$vendor_lead_code',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',phone_code='$phone_code',phone_number='$phone_number',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',rank='$rank',owner='$owner' where lead_id='$lead_id';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
|
||||
#Update the agent screen with new data
|
||||
$stmt="UPDATE vicidial_live_agents set external_update_fields='1',external_update_fields_data='vendor_lead_code,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,phone_code,phone_number,gender,date_of_birth,alt_phone,email,security_phrase,comments,rank,owner' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
|
||||
if ($notesid < 100)
|
||||
{
|
||||
# Insert into vicidial_call_notes
|
||||
$stmt="INSERT INTO vicidial_call_notes set lead_id='$lead_id',vicidial_id='$vicidial_id',call_date='$call_date',order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$notesid = mysql_insert_id($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
$notesid = mysqli_insert_id($link);
|
||||
}
|
||||
else
|
||||
{
|
||||
# update vicidial_call_notes record
|
||||
$stmt="UPDATE vicidial_call_notes set order_id='$order_id',appointment_date='$appointment_date',appointment_time='$appointment_time',call_notes='$call_notes' where notesid='$notesid';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$affected_rows = mysqli_affected_rows($link);
|
||||
}
|
||||
|
||||
echo "<BR><b>Data Changes Accepted</b><BR><BR>";
|
||||
|
||||
+196
-195
File diff suppressed because it is too large
Load Diff
@@ -25,9 +25,10 @@
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
# 130328-0025 - Converted ereg to preg functions
|
||||
# 130603-2202 - Added login lockout for 15 minutes after 10 failed logins, and other security fixes
|
||||
# 130802-1038 - Changed to PHP mysqli functions
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
@@ -80,8 +81,8 @@ else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
@@ -118,13 +119,13 @@ else
|
||||
{
|
||||
$stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$vmails_list = mysql_num_rows($rslt);
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$vmails_list = mysqli_num_rows($rslt);
|
||||
$loop_count=0;
|
||||
while ($vmails_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
echo "$row[0]|$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user