/LANG_www/agc_es/vicidial.php
https://github.com/h4ck3rm1k3/vicidial-asterisk-gui · PHP · 8606 lines · 6915 code · 666 blank · 1025 comment · 1427 complexity · 87c6a885b8a24530345796628442c4ab MD5 · raw file
Large files are truncated click here to view the full file
- <?
- # vicidial.php - the web-based version of the astVICIDIAL client application
- #
- # Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
- #
- # Other scripts that this application depends on:
- # - vdc_db_query.php: Updates information in the database
- # - manager_send.php: Sends manager actions to the DB for execution
- # - conf_exten_check.php: time sync and status updater, calls in queue
- #
- # CHANGELOG
- # 50607-1426 - First Build of VICIDIAL web client basic login process finished
- # 50628-1620 - Added some basic formatting and worked on process flow
- # 50628-1715 - Startup variables mapped to javascript variables
- # 50629-1303 - Added Login Closer in-groups selection box and vla update
- # 50629-1530 - Rough layout for customer info form section and button links
- # 50630-1453 - Rough Manual Dial/Hangup with customer info displayed
- # 50701-1450 - Added vicidial_log entries on dial and hangup
- # 50701-1634 - Added Logout function
- # 50705-1259 - Added call disposition functionality
- # 50705-1432 - Added lead info DB update function
- # 50705-1658 - Added web form functionality
- # 50706-1043 - Added call park and pickup functions
- # 50706-1234 - Added Start/Stop Recording functionality
- # 50706-1614 - Added conference channels display option
- # 50711-1333 - Removed call check redundancy and fixed a span bug
- # 50727-1424 - Added customer channel and participant present sensing/alerts
- # 50804-1057 - Added SendDTMF function and reconfigured the transfer span
- # 50804-1224 - Added Local and Internal Closer transfer functions
- # 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs
- # 50804-1808 - Added button images for left buttons
- # 50815-1151 - Added 3Way calling functions to Transfer-conf frame
- # 50815-1602 - Added images and buttons for xfer functions
- # 50816-1813 - Added basic autodial outbound call pickup functions
- # 50817-1113 - Fixes to auto_dialing call receipt
- # 50817-1234 - Added inbound call receipt capability
- # 50817-1541 - Added customer time display
- # 50817-1541 - Added customer time display
- # 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option
- # 50818-1703 - Added pretty login section
- # 50825-1200 - Modified form field lengths, added double-click dispositions
- # 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER
- # 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug
- # 50903-0904 - Added preview-lead code for manual dialing
- # 50904-0016 - Added ability to hangup manual dials before pickup
- # 50906-1319 - Added override for filters on xfer calls, fixed login display bug
- # 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode
- # 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use
- # 50913-1212 - Added campaign_cid to 3rd party calls
- # 50923-1546 - Modified to work with language translation
- # 50926-1656 - Added campaign pull-down at login of active campaigns
- # 50928-1633 - Added manual dial alternate number dial option
- # 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs
- # 51004-1656 - Fixed recording filename bug and new Spanish translation
- # 51020-1103 - Added campaign-specific recording control abilities
- # 51020-1352 - Added Basic vicidial_agent_log framework
- # 51021-1050 - Fixed custtime display and disable Enter/Return keypresses
- # 51021-1718 - Allows for multi-line comments (changes \n to !N in database)
- # 51110-1432 - Fixed non-standard http port issue
- # 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial
- # 51118-1305 - Activate multi-line comments from $multi_line_comments var
- # 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view
- # 51121-1506 - Small PHP optimizations in many scripts and disabled globalize
- # 51129-1010 - Added ability to accept calls from other VICIDIAL servers
- # 51129-1254 - Fixed Hangups of other agents channels when customer hangs up
- # 51208-1732 - Created user-first login that looks for default phone info
- # 51219-1526 - Added variable framework for campaign and in-group scripts
- # 51221-1200 - Added SCRIPT tab, layout and functionality
- # 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup
- # 51222-1605 - Added VMail message blind transfer button to xfer-conf frame
- # 51229-1028 - Added checks on web_form_address to allow for var in the DB value
- # 60117-1312 - Added Transfer-conf frame toggle on button press
- # 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame
- # 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys
- # 60213-1210 - Added ability to sort routing of calls by user_level
- # 60214-0932 - Initial Callback calendar display framework
- # 60214-1407 - Added ability to minimize the dispo screen to see info below
- # 60215-1104 - Added ANYONE scheduled callbacks functionality
- # 60410-1116 - Added persistant pause after dispo option and change dispo text
- # - Added web form submit that opens new window with dispo on submit
- # - Added PREVIOUS CALLBACK in customer info to flag callbacks
- # - Added link to try to hangup the call again in the dispo screen
- # - Added link noone-in-session screen to call agent phone again
- # - Added link customer-hungup screen to go straight to dispo screen
- # 60410-1532 - Added agent status and campaign calls dialing display option
- # 60411-1547 - Add ability to set callback as USERONLY and some basic formatting
- # 60413-1752 - Add basic USERONLY callback frame and listings
- # 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans
- # - Added beta-level USERONLY callback functionality
- # - Added beta-level manual dialing with lead insertion functionality
- # 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug
- # 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode
- # - Changed several permissions to database-defined
- # 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished
- # 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error
- # 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES
- # 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials
- # 60426-1058 - Added vicidial_user setting for default blended check for CLOSER
- # 60501-1008 - Added option to manual dial screen to manually lookup phone number
- # 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen
- # 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug
- # - Fixed recording filename display to not overrun 25 characters
- # 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo
- # 60608-1453 - Added CLOSER campaign allowable in-groups limitations
- # 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC
- # 60619-1047 - Added variable filters to close security holes for login form
- # 60804-1710 - fixed scheduled CALLBK for other languages build
- # 60808-1145 - Added consultative transfers with customer data
- # 60808-2232 - Added campaign name to pulldown for login screen
- # 60809-1603 - Added option to locally transfer consult xfers
- # 60809-1732 - Added recheck of transferred channels before customer gone mesg
- # 60810-1011 - Fixed CXFER leave 3way call bugs
- # 60816-1602 - Added ALLCALLS recording delay option allcalls_delay
- # 60816-1716 - Fixed customer time display bug and client DST setting
- # 60821-1555 - Added option to omit phone_code on dialout of leads
- # 60821-1628 - Added ALLFORCE recording option
- # 60821-1643 - Added no_delete_sessions option to not delete sessions
- # 60822-0512 - Changed phone number fields to be maxlength of 12
- # 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php
- # 60906-1152 - Added Previous CallBack info display span
- # 60906-1715 - Allow for Local phone extension conferences
- # 61004-1729 - Add ability to control volume per channel in "calls in this session"
- # 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions
- # 61122-1523 - Added more SCRIPT variables
- # 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries
- # 61130-1617 - Added lead_id to MonitorConf for recording_log
- # 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT
- # 70109-1128 - Fixed wrapup timer bug
- # 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode
- # - Added option for alternate number dialing with hotkeys
- # 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns
- # 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group
- # 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code
- # 70201-1703 - Fixed cursor bug for most text input fields
- # 70202-1453 - Added first portions of Agent Pause Codes
- # 70203-0108 - Finished Agent Pause Codes functionality
- # 70203-0930 - Added dialed_number to webform output
- # 70203-1010 - Added dialed_label to webform output
- # 70206-1201 - Fixed allow_closers bug
- # 70206-1332 - Added vicidial_recording_override users setting function
- # 70212-1252 - Fixed small issue with CXFER
- # 70213-1018 - Changed CXFER and AXFER to update customer information before transfer
- # 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log
- # 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log
- # 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL
- # 70226-1252 - Added Mute/UnMute to agent screen
- # 70309-1035 - Allow amphersands and questions marks in comments to pass through
- # 70313-1052 - Allow pound signs(hash) in comments to pass through
- # 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf
- # 70319-1446 - Added agent-deactive-display and disable customer info update functions
- # 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper
- # 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen
- # 70322-1545 - Added sipsak display ability
- # 70510-1319 - Added onUnload force Logout
- # 70806-1530 - Added Presets Dial links above agent mute button
- # 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE
- # 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM
- # 71022-1427 - Added formatting of the customer phone number in the main status bar
- # 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions
- # 71101-1204 - Fixed bug in callback calendar with DST
- # 71116-0957 - Added campaign_weight and calls_today to the vla table insertion
- # 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login
- # 71122-0256 - Added auto-pause notification
- # 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to
- # 71127-0408 - Added height and width settings for easier modification of screen size
- # 71129-2025 - restricted callbacks count and list to campaign only
- # 71223-0318 - changed logging of closer calls
- # 71226-1117 - added option to kick all calls from conference upon logout
- # 80109-1510 - added gender select list
- # 80116-1032 - added option on CLOSER-type campaigns to change in-groups when paused
- # 80317-2106 - added recording override options for inbound group calls
- # 80331-1433 - Added second transfer try for VICIDIAL transfers/hangups on manual dial calls
- # 80402-0121 - Fixes for manual dial transfers on some systems
- # 80407-2112 - Work on adding phone login load balancing across servers
- # 80416-0559 - Added ability to log computer_ip at login, set the $PhoneSComPIP variable
- # 80428-0413 - UTF8 changes and testing
- # 80505-0054 - Added multi-phones load-balanced alias option
- # 80507-0932 - Fixed Script display bug (+ instead of space)
- # 80519-1425 - Added calls in queue display
- # 80523-1630 - Added Timeclock links
- # 80625-0047 - Added U option for gender, added date/phone display options
- # 80630-2210 - Added queue_log entries for Manual Dial
- # 80703-0139 - Added alter customer phone permissions
- # 80703-1106 - Added API functionality for Hangup and Dispo, added Agent Display Queue Count
- # 80707-2325 - Added vicidial_id to recording_log for tracking of vicidial or closer log to recording
- # 80709-0358 - Added Default alt phone dial hard-code option
- # 80719-1147 - Changed recording and senddtmf conf prefix
- # 80815-1014 - Added manual dial list restriction option
- # 80823-2123 - Fixed form scroll for IE, added copy to clipboard(IE-only feature)
- # 80831-0548 - Added Extended alt-dial-phone display information for non-manual calls
- # 80909-1717 - Added support for campaign-specific DNC lists
- # 80915-1754 - Rewrote leave-3way functions for external calling
- # 81002-1908 - Fixed double-login bug in some conditions
- # 81007-0945 - Added three_way_call_cid option for outbound 3way calls
- # 81010-1047 - Fixed conf calling prefix to use settings, other 3way improvements
- # 81011-1403 - Fixed bugs in leave3way when transferring a manual dial call
- # 81012-1729 - Added INBOUND_MAN dial method to allow manual list dialing and inbound calls
- # 81013-1644 - Fixed bug in leave 3way for manual dial fronters
- # 81015-0405 - Fixed bug related to hangups on 3way calls
- # 81016-0703 - Changed leave 3way to allow function at any time transfer-conf is available
- # 81020-1501 - Fixed bugs in queue_log logging
- # 81023-0411 - Added compatibility for dial-in agents using AGI, bug fixes
- # 81030-0403 - Added option to force Pause Codes on PAUSE
- # 81103-1427 - Added 3way call dial prefix
- # 81104-0140 - Added mysql error logging capability
- # 81104-1618 - Changed MySQL queries logging
- # 81106-0411 - Changedthe campaign login list behaviour
- # 81110-0057 - Changed Pause time to start new vicidial_agent_log on every pause
- # 81110-1514 - Added hangup_all_non_reserved to fix non-Hangup bug
- # 81119-1811 - webform backslash fix
- # 81124-2213 - Fixes blind transfer bug
- # 81209-1617 - Added campaign web form target option and web form address variables
- # 81211-0422 - Fixed Manual dial agent_log bug
- # 90102-1402 - Added time sync check notification
- # 90115-0619 - Added ability to send Local Closer to AGENTDIRECT agent_only
- # 90120-1719 - Added API pause/resume and number dial functionality
- # 90126-2302 - Added Vtiger login option and agent alert option
- # 90128-0230 - Added vendor_lead_code to API dial and manuald dial with lookup
- # 90202-0148 - Added option to disable BLENDED checkbox
- # 90209-0132 - Changed tab images and color scheme
- # 90303-1145 - Fixed rare manual dial live hangup bug
- # 90304-1333 - Added user-specific web vars option
- # 90305-0917 - Added prefix-choice and group-alias options for calls coming from API
- # 90307-1736 - Added Shift enforcement and manager override features
- # 90320-0309 - Fixed agent log bug when using wrapup time
- #
- $version = '2.0.5-202';
- $build = '90320-0309';
- $mel=1; # Mysql Error Log enabled = 1
- $mysql_log_count=60;
- $one_mysql_log=0;
- require("dbconnect.php");
- if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
- elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
- 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 = eregi_replace(" ",'',$VD_campaign);
- }
- if (!isset($flag_channels))
- {
- $flag_channels=0;
- $flag_string='';
- }
- ### security strip all non-alphanumeric characters out of the variables ###
- $DB=ereg_replace("[^0-9a-z]","",$DB);
- $phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login);
- $phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass);
- $VD_login=ereg_replace("[^0-9a-zA-Z]","",$VD_login);
- $VD_pass=ereg_replace("[^0-9a-zA-Z]","",$VD_pass);
- $VD_campaign = ereg_replace("[^-\_0-9a-zA-Z]","",$VD_campaign);
- $forever_stop=0;
- if ($force_logout)
- {
- echo "Usted ahora ha registrado hacia fuera. Gracias\n";
- exit;
- }
- $isdst = date("I");
- $StarTtimE = date("U");
- $NOW_TIME = date("Y-m-d H:i:s");
- $tsNOW_TIME = date("YmdHis");
- $FILE_TIME = date("Ymd-His");
- $loginDATE = date("Ymd");
- $CIDdate = date("ymdHis");
- $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y"));
- $past_month_date = date("Y-m-d H:i:s",$month_old);
- $minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y"));
- $past_minutes_date = date("Y-m-d H:i:s",$minutes_old);
- $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 FROM system_settings;";
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- if ($DB) {echo "$stmt\n";}
- $qm_conf_ct = mysql_num_rows($rslt);
- $i=0;
- while ($i < $qm_conf_ct)
- {
- $row=mysql_fetch_row($rslt);
- $non_latin = $row[0];
- $vdc_header_date_format = $row[1];
- $vdc_customer_date_format = $row[2];
- $vdc_header_phone_format = $row[3];
- $WeBRooTWritablE = $row[4];
- $timeclock_end_of_day = $row[5];
- $vtiger_url = $row[6];
- $enable_vtiger_integration = $row[7];
- $outbound_autodial_active = $row[8];
- $i++;
- }
- ##### END SETTINGS LOOKUP #####
- ###########################################
- ##### DEFINABLE SETTINGS AND OPTIONS
- ###########################################
- $conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording
- $dtmf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently
- $HKuser_level = '5'; # minimum vicidial user_level for HotKeys
- $campaign_login_list = '1'; # show drop-down list of campaigns at login
- $manual_dial_preview = '1'; # allow preview lead option when manual dial
- $multi_line_comments = '1'; # set to 1 to allow multi-line comment box
- $user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login
- $view_scripts = '1'; # set to 1 to show the SCRIPTS tab
- $dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo
- $callholdstatus = '1'; # set to 1 to show calls en hold count
- $agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count
- $campagentstatctmax = '3'; # Number of segundos for campaign call and agent stats
- $show_campname_pulldown = '1'; # set to 1 to show campaign name en login pulldown
- $webform_sessionname = '1'; # set to 1 to include the session_name in webform URL
- $local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server
- $clientDST = '1'; # set to 1 to check for DST en server for agent time
- $no_delete_sessions = '0'; # set to 1 to not delete sessions at logout
- $volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels
- $PreseT_DiaL_LinKs = '0'; # set to 1 to show a DIAL link for Dial Presets
- $LogiNAJAX = '1'; # set to 1 to do lookups en campaigns for login
- $HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls"
- $hangup_all_non_reserved= '1'; # set to 1 to force hangup all non-reserved channels upon Colgar al Cliente
- $LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout
- $TeléfonoSComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login
- $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT DIAL by default if enabled for the campaign
- $AgentAlert_allowed = '1'; # set to 1 to allow Agent alert option
- $disable_blended_checkbox='0'; # set to 1 to disable the BLENDED checkbox from the in-group chooser screen
- $TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen
- $BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500
- $BROWSER_WIDTH = 770; # set to the minimum browser width, default=770
- $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6
- $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0
- # options now set in DB:
- #$alt_phone_dialing = '1'; # allow agents to call alt phone numbers
- #$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks
- # $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks
- #$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session
- ### SCREEN WIDTH AND HEIGHT CALCULATIONS ###
- ### DO NOT EDIT! ###
- $MASTERwidth=($BROWSER_WIDTH - 340);
- $MASTERheight=($BROWSER_HEIGHT - 200);
- if ($MASTERwidth < 430) {$MASTERwidth = '430';}
- if ($MASTERheight < 300) {$MASTERheight = '300';}
- $CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...)
- $MNwidth = ($MASTERwidth + 330); # 760 - main frame
- $XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference
- $HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks
- $AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links
- $SCwidth = ($MASTERwidth + 230); # 670 - live call segundos counter
- $SSwidth = ($MASTERwidth + 176); # 606 - scroll script
- $SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session
- $HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button
- $HSwidth = ($MASTERwidth + 1); # 431 - Header spacer
- $HKheight = ($MASTERheight + 105); # 405 - HotKey active Button
- $AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links
- $MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons
- $CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status
- $SSheight = ($MASTERheight + 31); # 331 - script content
- $HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey
- $BPheight = ($MASTERheight - 250); # 50 - bottom buffer
- $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 (eregi("443",$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 = eregi_replace('vicidial.php','',$agcPAGE);
- header ("Content-type: text/html; charset=utf-8");
- header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
- header ("Pragma: no-cache"); // HTTP/1.0
- echo "<html>\n";
- echo "<head>\n";
- echo "<!-- VERSIÓN: $version CONSTRUCCION: $build -->\n";
- if ($campaign_login_list > 0)
- {
- $camp_form_code = "<select size=1 name=VD_campaign id=VD_campaign onFocus=\"login_allowable_campaigns()\">\n";
- $camp_form_code .= "<option value=\"\"></option>\n";
- $LOGallowed_campaignsSQL='';
- if ($relogin == 'YES')
- {
- $stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass'";
- if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01002',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- $row=mysql_fetch_row($rslt);
- $VU_user_group=$row[0];
- $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';";
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01003',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- $row=mysql_fetch_row($rslt);
- if ( (!eregi("ALL-CAMPAIGNS",$row[0])) )
- {
- $LOGallowed_campaignsSQL = eregi_replace(' -','',$row[0]);
- $LOGallowed_campaignsSQL = eregi_replace(' ',"','",$LOGallowed_campaignsSQL);
- $LOGallowed_campaignsSQL = "and campaign_id IN('$LOGallowed_campaignsSQL')";
- }
- }
- ### code for manager override of shift restrictions
- if ($MGR_override > 0)
- {
- if (isset($_GET["MGR_login$loginDATE"])) {$MGR_login=$_GET["MGR_login$loginDATE"];}
- elseif (isset($_POST["MGR_login$loginDATE"])) {$MGR_login=$_POST["MGR_login$loginDATE"];}
- if (isset($_GET["MGR_pass$loginDATE"])) {$MGR_pass=$_GET["MGR_pass$loginDATE"];}
- elseif (isset($_POST["MGR_pass$loginDATE"])) {$MGR_pass=$_POST["MGR_pass$loginDATE"];}
- $stmt="SELECT count(*) from vicidial_users where user='$MGR_login' and pass='$MGR_pass' and manager_shift_enforcement_override='1' and active='Y';";
- if ($DB) {echo "|$stmt|\n";}
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01058',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- $row=mysql_fetch_row($rslt);
- $MGR_auth=$row[0];
- if($MGR_auth>0)
- {
- $stmt="UPDATE vicidial_users SET shift_override_flag='1' where user='$VD_login' and pass='$VD_pass';";
- if ($DB) {echo "|$stmt|\n";}
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01059',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- print "<!-- Shift Override entered for $VD_login by $MGR_login -->\n";
- ### Add a record to the vicidial_admin_log
- $SQL_log = "$stmt|";
- $SQL_log = ereg_replace(';','',$SQL_log);
- $SQL_log = addslashes($SQL_log);
- $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$MGR_login', ip_address='$ip', event_section='AGENT', event_type='OVERRIDE', record_id='$VD_login', event_code='GERENTE DE TRANSFERENCIA OF AGENT SHIFT ENFORCEMENT', event_sql=\"$SQL_log\", event_notes='user: $VD_login';";
- if ($DB) {echo "|$stmt|\n";}
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01060',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- }
- }
- $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id";
- if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01004',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- $camps_to_print = mysql_num_rows($rslt);
- $o=0;
- while ($camps_to_print > $o)
- {
- $rowx=mysql_fetch_row($rslt);
- if ($show_campname_pulldown)
- {$campname = " - $rowx[1]";}
- else
- {$campname = '';}
- if ($VD_campaign)
- {
- if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) )
- {$camp_form_code .= "<option value=\"$rowx[0]\" SELECTED>$rowx[0]$campname</option>\n";}
- else
- {
- if (!ereg('login_allowable_campaigns',$camp_form_code))
- {$camp_form_code .= "<option value=\"$rowx[0]\">$rowx[0]$campname</option>\n";}
- }
- }
- else
- {
- if (!ereg('login_allowable_campaigns',$camp_form_code))
- {$camp_form_code .= "<option value=\"$rowx[0]\">$rowx[0]$campname</option>\n";}
- }
- $o++;
- }
- $camp_form_code .= "</select>\n";
- }
- else
- {
- $camp_form_code = "<INPUT TYPE=TEXT NAME=VD_campaign SIZE=10 maxlength=20 VALUE=\"$VD_campaign\">\n";
- }
- if ($LogiNAJAX > 0)
- {
- ?>
- <script language="Javascript">
- // ################################################################################
- // Send Request for allowable campaigns to populate the campaigns pull-down
- function login_allowable_campaigns()
- {
- var xmlhttp=false;
- /*@cc_on @*/
- /*@if (@_jscript_version >= 5)
- // JScript gives us Conditional compilation, we can cope with old IE versions.
- // and security blocked creation of the objects.
- try {
- xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try {
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (E) {
- xmlhttp = false;
- }
- }
- @end @*/
- if (!xmlhttp && typeof XMLHttpRequest!='undefined')
- {
- xmlhttp = new XMLHttpRequest();
- }
- if (xmlhttp)
- {
- logincampaign_query = "&user=" + document.vicidial_form.VD_login.value + "&pass=" + document.vicidial_form.VD_pass.value + "&ACTION=LogiNCamPaigns&format=html";
- xmlhttp.open('POST', 'vdc_db_query.php');
- xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
- xmlhttp.send(logincampaign_query);
- xmlhttp.onreadystatechange = function()
- {
- if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
- {
- Nactiveext = null;
- Nactiveext = xmlhttp.responseText;
- // alert(logincampaign_query);
- // alert(xmlhttp.responseText);
- document.getElementById("LogiNCamPaigns").innerHTML = Nactiveext;
- document.getElementById("LogiNReseT").innerHTML = "<INPUT TYPE=BUTTON VALUE=\"Recarga Campaña List\" OnClick=\"login_allowable_campaigns()\">";
- document.getElementById("VD_campaign").focus();
- }
- }
- delete xmlhttp;
- }
- }
- </script>
- <?
- }
- if ($relogin == 'YES')
- {
- echo "<title>web client VICIDIAL: Conexión Otra Vez</title>\n";
- echo "</head>\n";
- echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
- echo "<A HREF=\"./timeclock.php?referrer=agent&pl=$phone_login&pp=$phone_pass&VD_login=$VD_login&VD_pass=$VD_pass\">Timeclock</A><BR>\n";
- echo "<TABLE WIDTH=100%><TR><TD></TD>\n";
- echo "<!-- ILPV -->\n";
- echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP NOWRAP><a href=\"../agc_en/vicidial.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">English <img src=\"../agc/images/en.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP BGCOLOR=\"#CCFFCC\" NOWRAP><a href=\"../agc_es/vicidial.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">Español <img src=\"../agc/images/es.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";echo "</TR></TABLE>\n";
- echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
- echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
- echo "<BR><BR><BR><CENTER><TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"$MAIN_COLOR\"><TR BGCOLOR=WHITE>";
- echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vdc_tab_vicidial.gif\" Border=0></TD>";
- echo "<TD ALIGN=CENTER VALIGN=MIDDLE> Conexión Otra Vez </TD>";
- echo "</TR>\n";
- echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Conexión Del Teléfono: </TD>";
- echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=phone_login SIZE=10 maxlength=20 VALUE=\"$phone_login\"></TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Contraseña Del Teléfono: </TD>";
- echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=phone_pass SIZE=10 maxlength=20 VALUE=\"$phone_pass\"></TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Conexión Del Usuario: </TD>";
- echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=VD_login SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Contraseña Del Usuario: </TD>";
- echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=VD_pass SIZE=10 maxlength=20 VALUE=\"$VD_pass\"></TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Campaña: </TD>";
- echo "<TD ALIGN=LEFT><span id=\"LogiNCamPaigns\">$camp_form_code</span></TD></TR>\n";
- echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> \n";
- echo "<span id=\"LogiNReseT\"><INPUT TYPE=BUTTON VALUE=\"Recarga Campaña List\" OnClick=\"login_allowable_campaigns()\"></span></TD></TR>\n";
- echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version CONSTRUCCION: $build</TD></TR>\n";
- echo "</TABLE>\n";
- echo "</FORM>\n\n";
- echo "</body>\n\n";
- echo "</html>\n\n";
- exit;
- }
- if ($user_login_first == 1)
- {
- if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) )
- {
- echo "<title>web client VICIDIAL: Conexión en la Campaña</title>\n";
- echo "</head>\n";
- echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
- echo "<A HREF=\"./timeclock.php?referrer=agent&pl=$phone_login&pp=$phone_pass&VD_login=$VD_login&VD_pass=$VD_pass\">Timeclock</A><BR>\n";
- echo "<TABLE WIDTH=100%><TR><TD></TD>\n";
- echo "<!-- ILPV -->\n";
- echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP NOWRAP><a href=\"../agc_en/vicidial.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">English <img src=\"../agc/images/en.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP BGCOLOR=\"#CCFFCC\" NOWRAP><a href=\"../agc_es/vicidial.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">Español <img src=\"../agc/images/es.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n"; echo "</TR></TABLE>\n";
- echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
- echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
- #echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
- #echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
- echo "<CENTER><BR><B>Conexión Del Usuario</B><BR><BR>";
- echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"$MAIN_COLOR\"><TR BGCOLOR=WHITE>";
- echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vdc_tab_vicidial.gif\" Border=0></TD>";
- echo "<TD ALIGN=CENTER VALIGN=MIDDLE> Conexión en la Campaña </TD>";
- echo "</TR>\n";
- echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Conexión Del Usuario: </TD>";
- echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=VD_login SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Contraseña Del Usuario: </TD>";
- echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=VD_pass SIZE=10 maxlength=20 VALUE=\"$VD_pass\"></TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Campaña: </TD>";
- echo "<TD ALIGN=LEFT><span id=\"LogiNCamPaigns\">$camp_form_code</span></TD></TR>\n";
- echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> \n";
- echo "<span id=\"LogiNReseT\"></span></TD></TR>\n";
- echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version CONSTRUCCION: $build</TD></TR>\n";
- echo "</TABLE>\n";
- echo "</FORM>\n\n";
- echo "</body>\n\n";
- echo "</html>\n\n";
- exit;
- }
- else
- {
- if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) )
- {
- $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0 and active='Y';";
- if ($DB) {echo "|$stmt|\n";}
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01005',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- $row=mysql_fetch_row($rslt);
- $phone_login=$row[0];
- $phone_pass=$row[1];
- echo "<title>web client VICIDIAL: Conexión</title>\n";
- echo "</head>\n";
- echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
- echo "<A HREF=\"./timeclock.php?referrer=agent&pl=$phone_login&pp=$phone_pass&VD_login=$VD_login&VD_pass=$VD_pass\">Timeclock</A><BR>\n";
- echo "<TABLE WIDTH=100%><TR><TD></TD>\n";
- echo "<!-- ILPV -->\n";
- echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP NOWRAP><a href=\"../agc_en/vicidial.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">English <img src=\"../agc/images/en.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP BGCOLOR=\"#CCFFCC\" NOWRAP><a href=\"../agc_es/vicidial.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">Español <img src=\"../agc/images/es.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n"; echo "</TR></TABLE>\n";
- echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
- echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
- echo "<BR><BR><BR><CENTER><TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"$MAIN_COLOR\"><TR BGCOLOR=WHITE>";
- echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vdc_tab_vicidial.gif\" Border=0></TD>";
- echo "<TD ALIGN=CENTER VALIGN=MIDDLE> Conexión </TD>";
- echo "</TR>\n";
- echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Conexión Del Teléfono: </TD>";
- echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=phone_login SIZE=10 maxlength=20 VALUE=\"$phone_login\"></TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Contraseña Del Teléfono: </TD>";
- echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=phone_pass SIZE=10 maxlength=20 VALUE=\"$phone_pass\"></TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Conexión Del Usuario: </TD>";
- echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=VD_login SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Contraseña Del Usuario: </TD>";
- echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=VD_pass SIZE=10 maxlength=20 VALUE=\"$VD_pass\"></TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Campaña: </TD>";
- echo "<TD ALIGN=LEFT><span id=\"LogiNCamPaigns\">$camp_form_code</span></TD></TR>\n";
- echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> \n";
- echo "<span id=\"LogiNReseT\"></span></TD></TR>\n";
- echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version CONSTRUCCION: $build</TD></TR>\n";
- echo "</TABLE>\n";
- echo "</FORM>\n\n";
- echo "</body>\n\n";
- echo "</html>\n\n";
- exit;
- }
- }
- }
- if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) )
- {
- echo "<title>web client VICIDIAL: Conexión Del Teléfono</title>\n";
- echo "</head>\n";
- echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
- echo "<A HREF=\"./timeclock.php?referrer=agent&pl=$phone_login&pp=$phone_pass&VD_login=$VD_login&VD_pass=$VD_pass\">Timeclock</A><BR>\n";
- echo "<TABLE WIDTH=100%><TR><TD></TD>\n";
- echo "<!-- ILPV -->\n";
- echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP NOWRAP><a href=\"../agc_en/vicidial.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">English <img src=\"../agc/images/en.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP BGCOLOR=\"#CCFFCC\" NOWRAP><a href=\"../agc_es/vicidial.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">Español <img src=\"../agc/images/es.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";echo "</TR></TABLE>\n";
- echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
- echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
- echo "<BR><BR><BR><CENTER><TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"$MAIN_COLOR\"><TR BGCOLOR=WHITE>";
- echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vdc_tab_vicidial.gif\" Border=0></TD>";
- echo "<TD ALIGN=CENTER VALIGN=MIDDLE> Conexión Del Teléfono </TD>";
- echo "</TR>\n";
- echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Conexión Del Teléfono: </TD>";
- echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=phone_login SIZE=10 maxlength=20 VALUE=\"\"></TD></TR>\n";
- echo "<TR><TD ALIGN=RIGHT>Contraseña Del Teléfono: </TD>";
- echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=phone_pass SIZE=10 maxlength=20 VALUE=\"\"></TD></TR>\n";
- echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> \n";
- echo "<span id=\"LogiNReseT\"></span></TD></TR>\n";
- echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version CONSTRUCCION: $build</TD></TR>\n";
- echo "</TABLE>\n";
- echo "</FORM>\n\n";
- echo "</body>\n\n";
- echo "</html>\n\n";
- exit;
- }
- else
- {
- if ($WeBRooTWritablE > 0)
- {$fp = fopen ("./vicidial_auth_entries.txt", "a");}
- $VDloginDISPLAY=0;
- if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) )
- {
- $VDloginDISPLAY=1;
- }
- else
- {
- $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0 and active='Y';";
- if ($DB) {echo "|$stmt|\n";}
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01006',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- $row=mysql_fetch_row($rslt);
- $auth=$row[0];
- if($auth>0)
- {
- $login=strtoupper($VD_login);
- $password=strtoupper($VD_pass);
- ##### 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 from vicidial_users where user='$VD_login' and pass='$VD_pass'";
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- $row=mysql_fetch_row($rslt);
- $LOGfullname = $row[0];
- $user_level = $row[1];
- $VU_hotkeys_active = $row[2];
- $VU_agent_choose_ingroups = $row[3];
- $VU_scheduled_callbacks = $row[4];
- $agentonly_callbacks = $row[5];
- $agentcall_manual = $row[6];
- $VU_vicidial_recording = $row[7];
- $VU_vicidial_transfers = $row[8];
- $VU_closer_default_blended = $row[9];
- $VU_user_group = $row[10];
- $VU_vicidial_recording_override = $row[11];
- $VU_alter_custphone_override = $row[12];
- $VU_alert_enabled = $row[13];
- $VU_agent_shift_enforcement_override = $row[14];
- $VU_shift_override_flag = $row[15];
- if ($VU_alert_enabled > 0) {$VU_alert_enabled = 'ON';}
- else {$VU_alert_enabled = 'OFF';}
- ### Gather timeclock and shift enforcement restriction settings
- $stmt="SELECT forced_timeclock_login,shift_enforcement,group_shifts from vicidial_user_groups where user_group='$VU_user_group';";
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01052',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- $row=mysql_fetch_row($rslt);
- $forced_timeclock_login = $row[0];
- $shift_enforcement = $row[1];
- $LOGgroup_shiftsSQL = eregi_replace(' ','',$row[2]);
- $LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL);
- $LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')";
- ### BEGIN - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR
- if ( (ereg('Y',$forced_timeclock_login)) or ( (ereg('ADMIN_EXEMPT',$forced_timeclock_login)) and ($VU_user_level < 8) ) )
- {
- $last_agent_event='';
- $HHMM = date("Hi");
- $HHteod = substr($timeclock_end_of_day,0,2);
- $MMteod = substr($timeclock_end_of_day,2,2);
- if ($HHMM < $timeclock_end_of_day)
- {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d")-1, date("Y"));}
- else
- {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d"), date("Y"));}
- $EoDdate = date("Y-m-d H:i:s", $EoD);
- ##### grab timeclock logged-in time for each user #####
- $stmt="SELECT event from vicidial_timeclock_log where user='$VD_login' and event_epoch >= '$EoD' order by timeclock_id desc limit 1;";
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01053',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- $events_to_parse = mysql_num_rows($rslt);
- if ($events_to_parse > 0)
- {
- $rowx=mysql_fetch_row($rslt);
- $last_agent_event = $rowx[0];
- }
- if ($DB>0) {echo "|$stmt|$events_to_parse|$last_agent_event|";}
- if ( (strlen($last_agent_event)<2) or (ereg('SALIR',$last_agent_event)) )
- {
- $VDloginDISPLAY=1;
- $VDdisplayMESSAGE = "USTED DEBE ENTRAR A LA PRIMERA TIMECLOCK<BR>";
- }
- }
- ### END - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR
- ### BEGIN - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR
- if ( ( (ereg("COMIENZO|ALL",$shift_enforcement)) and (!ereg("OFF",$VU_agent_shift_enforcement_override)) ) or (ereg("COMIENZO|ALL",$VU_agent_shift_enforcement_override)) )
- {
- $shift_ok=0;
- if ( (strlen($LOGgroup_shiftsSQL) < 3) and ($VU_shift_override_flag < 1) )
- {
- $VDloginDISPLAY=1;
- $VDdisplayMESSAGE = "ERROR: No hay cambios habilitado para su grupo de usuarios<BR>";
- }
- else
- {
- $HHMM = date("Hi");
- $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);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$user,$server_ip,$session_name,$one_mysql_log);}
- $shifts_to_print = mysql_num_rows($rslt);
- $o=0;
- while ( ($shifts_to_print > $o) and ($shift_ok < 1) )
- {
- $rowx=mysql_fetch_row($rslt);
- $shift_id = $rowx[0];
- $shift_start_time = $rowx[1];
- $shift_length = $rowx[2];
- $shift_weekdays = $rowx[3];
- if (eregi("$wday",$shift_weekdays))
- {
- $HHshift_length = substr($shift_length,0,2);
- $MMshift_length = substr($shift_length,3,2);
- $HHshift_start_time = substr($shift_start_time,0,2);
- $MMshift_start_time = substr($shift_start_time,2,2);
- $HHshift_end_time = ($HHshift_length + $HHshift_start_time);
- $MMshift_end_time = ($MMshift_length + $MMshift_start_time);
- if ($MMshift_end_time > 59)
- {
- $MMshift_end_time = ($MMshift_end_time - 60);
- $HHshift_end_time++;
- }
- if ($HHshift_end_time > 23)
- {$HHshift_end_time = ($HHshift_end_time - 24);}
- $HHshift_end_time = sprintf("%02s", $HHshift_end_time);
- $MMshift_end_time = sprintf("%02s", $MMshift_end_time);
- $shift_end_time = "$HHshift_end_time$MMshift_end_time";
- if (
- ( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or
- ( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or
- ( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) )
- )
- {$shift_ok++;}
- }
- $o++;
- }
- if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) )
- {
- $VDloginDISPLAY=1;
- $VDdisplayMESSAGE = "ERROR: No se le permite acceder fuera de su turno<BR>";
- }
- }
- if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) and ($VDloginDISPLAY > 0) )
- {
- $VDdisplayMESSAGE.= "<BR><BR>GERENTE DE TRANSFERENCIA:<BR>\n";
- $VDdisplayMESSAGE.= "<FORM ACTION=\"$PHP_SELF\" METHOD=POST>\n";
- $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=MGR_override VALUE=\"1\">\n";
- $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=relogin VALUE=\"YES\">\n";
- $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
- $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
- $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
- $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
- $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
- $VDdisplayMESSAGE.= "Manager Conexión: <INPUT TYPE=TEXT NAME=\"MGR_login$loginDATE\" SIZE=10 maxlength=20><br>\n";
- $VDdisplayMESSAGE.= "Manager Contraseña: <INPUT TYPE=PASSWORD NAME=\"MGR_pass$loginDATE\" SIZE=10 maxlength=20><br>\n";
- $VDdisplayMESSAGE.= "<INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR></FORM>\n";
- }
- }
- ### END - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR
- if ($WeBRooTWritablE > 0)
- {
- fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n");
- fclose($fp);
- }
- $user_abb = "$VD_login$VD_login$VD_login$VD_login";
- while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
- {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
- $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';";
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01008',$VD_login,$server_ip,$session_name,$one_mysql_log);}
- $row=mysql_fetch_row($rslt);
- $LOGallowed_campaigns =$row[0];
- if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) )
- {
- echo "<title>web client VICIDIAL: VICIDIAL Conexión en la Campaña</title>\n";
- echo "</head>\n";
- echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
- echo "<A HREF=\"./timeclock.php?referrer=agent&pl=$phone_login&pp=$phone_pass&VD_login=$VD_login&VD_pass=$VD_pass\">Timeclock</A><BR>\n";
- echo "<TABLE WIDTH=100%><TR><TD></TD>\n";
- echo "<!-- ILPV -->\n";
- echo "<TD WIDTH=10…