Added new options for forced launching of vicidial.php in restricted browser window

git-svn-id: svn://192.168.202.10@2020 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2013-09-04 04:37:28 +00:00
parent 76c4b273bc
commit 507a488ef2
5 changed files with 200 additions and 5 deletions
+7
View File
@@ -136,6 +136,13 @@ OTHER CHANGES:
15. Added AST_CRON_audio_4_ftp2_FTPSSL.pl script to allow for transmission of
second archival of recordings to an FTP SSL server.
16. Added settings to the agc/options.php file to allow for forced launching of
the agent screen from a script like the new launch.php script. The agent
is not allowed to login by going to the vicidial.php page directly, and
the launch.php page will open the agent screen with a read-only address
bar and several other browser options disabled. To enable this feature,
just set the $window_validation variable to '1' in options.php
@@ -237,6 +237,8 @@ If set to N, the calls will queue up, even if there are no agents logged in and
############################################################ CLIENT
This agent screen was not opened properly||
########################## CHANGES TO EXISTING PHRASES IN AGENT TRANSLATION
+148
View File
@@ -0,0 +1,148 @@
<?php
# launch.php - launches vicidial.php in restricted window
#
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# For launch validation to work, the options.php file must have
# window_validation = 1 and win_valid_name set to window_name below
#
# CHANGELOG
# 130903-2055 - First Build
#
$window_name = 'subwindow_launch';
### do not edit below this line ###
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["JS_browser_width"])) {$JS_browser_width=$_GET["JS_browser_width"];}
elseif (isset($_POST["JS_browser_width"])) {$JS_browser_width=$_POST["JS_browser_width"];}
if (isset($_GET["JS_browser_height"])) {$JS_browser_height=$_GET["JS_browser_height"];}
elseif (isset($_POST["JS_browser_height"])) {$JS_browser_height=$_POST["JS_browser_height"];}
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
if (isset($_GET["VD_login"])) {$VD_login=$_GET["VD_login"];}
elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];}
if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];}
elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];}
if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];}
elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];}
if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];}
elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];}
if (isset($_GET["MGR_override"])) {$MGR_override=$_GET["MGR_override"];}
elseif (isset($_POST["MGR_override"])) {$MGR_override=$_POST["MGR_override"];}
if (!isset($phone_login))
{
if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];}
elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];}
}
if (!isset($phone_pass))
{
if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];}
elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];}
}
if (isset($VD_campaign))
{
$VD_campaign = strtoupper($VD_campaign);
$VD_campaign = preg_replace("/\s/i",'',$VD_campaign);
}
if (!isset($flag_channels))
{
$flag_channels=0;
$flag_string='';
}
### 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);
$login_string='';
if (strlen($phone_login)>0)
{$login_string .= "phone_login=$phone_login&";}
if (strlen($phone_pass)>0)
{$login_string .= "phone_pass=$phone_pass&";}
if (strlen($VD_login)>0)
{$login_string .= "VD_login=$VD_login&";}
if (strlen($VD_pass)>0)
{$login_string .= "VD_pass=$VD_pass&";}
if (strlen($VD_campaign)>0)
{$login_string .= "VD_campaign=$VD_campaign";}
if (strlen($login_string)>0)
{$login_string = "?$login_string";}
$US='_';
$CL=':';
$AT='@';
$DS='-';
$date = date("r");
$ip = getenv("REMOTE_ADDR");
$browser = getenv("HTTP_USER_AGENT");
$script_name = getenv("SCRIPT_NAME");
$server_name = getenv("SERVER_NAME");
$server_port = getenv("SERVER_PORT");
if (preg_match("/443/i",$server_port)) {$HTTPprotocol = 'https://';}
else {$HTTPprotocol = 'http://';}
if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
else {$server_port = "$CL$server_port";}
$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
$agcDIR = preg_replace("/launch\.php/",'',$agcPAGE);
if (strlen($static_agent_url) > 5)
{$agcPAGE = $static_agent_url;}
?>
<html>
<head>
<title>Agent Screen Opener</title>
<script type="text/javascript">
<!--
var BrowseWidth = 0;
var BrowseHeight = 0;
function browser_dimensions()
{
<?php
if (preg_match('/MSIE/',$browser))
{
echo " if (document.documentElement && document.documentElement.clientHeight)\n";
echo " {BrowseWidth = document.documentElement.clientWidth;}\n";
echo " else if (document.body)\n";
echo " {BrowseWidth = document.body.clientWidth;}\n";
echo " if (document.documentElement && document.documentElement.clientHeight)\n";
echo " {BrowseHeight = document.documentElement.clientHeight;}\n";
echo " else if (document.body)\n";
echo " {BrowseHeight = document.body.clientHeight;}\n";
}
else
{
echo " BrowseWidth = window.innerWidth;\n";
echo " BrowseHeight = window.innerHeight;\n";
}
echo " BrowseWidth = (BrowseWidth - 20);\n";
echo " BrowseHeight = (BrowseHeight - 20);\n";
?>
// alert('opening window');
// document.getElementById("dimensions").innerHTML = BrowseWidth + " x " + BrowseHeight;
subwin = window.open('<?php echo $agcDIR ?>vicidial.php<?php echo $login_string ?>','<?php echo $window_name ?>','titlebar=no, status=no, menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=yes');
}
</script>
</head>
<body bgcolor=white onload="browser_dimensions();">
Agent Screen Opener
<span id=dimensions></span>
</body>
</html>
+6 -2
View File
@@ -1,13 +1,14 @@
<?php
# options.php - manually defined options for vicidial.php
#
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# rename this file to options.php for the settings here to go into effect
#
# CHANGELOG
# 100306-0805 - First Build
# 120214-1636 - Added consult_custom_delay optioin
# 120214-1636 - Added consult_custom_delay option
# 130903-2015 - Added window validation options
#
$conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording
@@ -55,6 +56,9 @@ $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6
$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0
$SIDEBAR_COLOR = '#F6F6F6';
$window_validation = 0; # set to 1 to disallow direct logins to vicidial.php
$win_valid_name = 'subwindow_launch'; # only window name to allow if validation enabled
# thin bar webphone settings:
# $webphone_width = 1085; # set the webphone frame width
# $webphone_height = 36; # set the webphone frame height
+37 -3
View File
@@ -409,10 +409,11 @@
# 130718-0745 - Added recording_filename to dispo_call_url
# 130802-1134 - Changed to PHP mysqli functions
# 130822-0656 - Changed all require to require_once in agc directory for PHP backward compatibility
# 130903-1920 - Added security check for browser window name, see launch.php for more information
#
$version = '2.8-378c';
$build = '130822-0656';
$version = '2.8-379c';
$build = '130903-1920';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=79;
$one_mysql_log=0;
@@ -576,6 +577,9 @@ $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0
$FORM_COLOR = '#EFEFEF';
$SIDEBAR_COLOR = '#F6F6F6';
$window_validation = 0; # set to 1 to disallow direct logins to vicidial.php
$win_valid_name = 'subwindow_launch'; # only window name to allow if validation enabled
# if options file exists, use the override values for the above variables
# see the options-example.php file for more information
if (file_exists('options.php'))
@@ -3197,7 +3201,6 @@ $CCAL_OUT .= "</table>";
?>
<script language="Javascript">
window.name='vicidial_window';
var MTvar;
var NOW_TIME = '<?php echo $NOW_TIME ?>';
var SQLdate = '<?php echo $NOW_TIME ?>';
@@ -3787,6 +3790,26 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";}
image_LB_ivrgrabparkedcall.src="./images/vdc_LB_grabivrparkcall.gif";
var image_LB_ivrparkcall = new Image();
image_LB_ivrparkcall.src="./images/vdc_LB_ivrparkcall.gif";
<?php
if ($window_validation > 0)
{
echo "var win_valid_name = '$win_valid_name';\n";
echo "var val_win_name = window.name;\n";
echo "if (win_valid_name != val_win_name)\n";
echo "\t{\n";
echo "\tvar invalid_opener=1;\n";
echo "\t}\n";
echo "else\n";
echo "\t{\n";
echo "\tvar invalid_opener=0;\n";
echo "\t}\n";
}
else
{
echo "\tvar invalid_opener=0;\n";
}
?>
window.name='vicidial_window';
@@ -13296,6 +13319,7 @@ function phone_number_format(formatphone) {
hideDiv('blind_monitor_notice_span');
hideDiv('post_phone_time_diff_span');
hideDiv('ivrParkControl');
hideDiv('InvalidOpenerSpan');
if (deactivated_old_session < 1)
{hideDiv('DeactivateDOlDSessioNSpan');}
if (is_webphone!='Y')
@@ -13892,6 +13916,12 @@ function phone_number_format(formatphone) {
if (check_n==2)
{
hideDiv('LoadingBox');
if (invalid_opener > 0)
{
refresh_interval = 7300000;
logout_stop_timeouts = 1;
showDiv('InvalidOpenerSpan');
}
}
}
function pause() // Pauses the refreshing of the lists
@@ -15470,6 +15500,10 @@ class="cust_form_text" value=""></TEXTAREA><input type="hidden" class="cust_form
</td></tr></table>
</span>
<span style="position:absolute;left:0px;top:0px;z-index:<?php $zi++; echo $zi ?>;" id="InvalidOpenerSpan">
<table border="1" bgcolor="#FFFFFF" width="<?php echo $CAwidth ?>px" height="<?php echo $WRheight ?>px"><tr><td align="center">This agent screen was not opened properly.<br />
</td></tr></table>
</span>