/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

  1. <?
  2. # vicidial.php - the web-based version of the astVICIDIAL client application
  3. #
  4. # Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
  5. #
  6. # Other scripts that this application depends on:
  7. # - vdc_db_query.php: Updates information in the database
  8. # - manager_send.php: Sends manager actions to the DB for execution
  9. # - conf_exten_check.php: time sync and status updater, calls in queue
  10. #
  11. # CHANGELOG
  12. # 50607-1426 - First Build of VICIDIAL web client basic login process finished
  13. # 50628-1620 - Added some basic formatting and worked on process flow
  14. # 50628-1715 - Startup variables mapped to javascript variables
  15. # 50629-1303 - Added Login Closer in-groups selection box and vla update
  16. # 50629-1530 - Rough layout for customer info form section and button links
  17. # 50630-1453 - Rough Manual Dial/Hangup with customer info displayed
  18. # 50701-1450 - Added vicidial_log entries on dial and hangup
  19. # 50701-1634 - Added Logout function
  20. # 50705-1259 - Added call disposition functionality
  21. # 50705-1432 - Added lead info DB update function
  22. # 50705-1658 - Added web form functionality
  23. # 50706-1043 - Added call park and pickup functions
  24. # 50706-1234 - Added Start/Stop Recording functionality
  25. # 50706-1614 - Added conference channels display option
  26. # 50711-1333 - Removed call check redundancy and fixed a span bug
  27. # 50727-1424 - Added customer channel and participant present sensing/alerts
  28. # 50804-1057 - Added SendDTMF function and reconfigured the transfer span
  29. # 50804-1224 - Added Local and Internal Closer transfer functions
  30. # 50804-1628 - Added Blind transfer, activated LIVE CALL image and fixed bugs
  31. # 50804-1808 - Added button images for left buttons
  32. # 50815-1151 - Added 3Way calling functions to Transfer-conf frame
  33. # 50815-1602 - Added images and buttons for xfer functions
  34. # 50816-1813 - Added basic autodial outbound call pickup functions
  35. # 50817-1113 - Fixes to auto_dialing call receipt
  36. # 50817-1234 - Added inbound call receipt capability
  37. # 50817-1541 - Added customer time display
  38. # 50817-1541 - Added customer time display
  39. # 50818-1327 - Added stop-all-recordings-after-each-vicidial-call option
  40. # 50818-1703 - Added pretty login section
  41. # 50825-1200 - Modified form field lengths, added double-click dispositions
  42. # 50831-1603 - Fixed customer time bug and fronter display bug for CLOSER
  43. # 50901-1314 - Fixed CLOSER IN-GROUP Web Form bug
  44. # 50903-0904 - Added preview-lead code for manual dialing
  45. # 50904-0016 - Added ability to hangup manual dials before pickup
  46. # 50906-1319 - Added override for filters on xfer calls, fixed login display bug
  47. # 50909-1243 - Added hotkeys functionality for quick dispoing in auto-dial mode
  48. # 50912-0958 - Modified hotkeys function, agent must have user_level >= 5 to use
  49. # 50913-1212 - Added campaign_cid to 3rd party calls
  50. # 50923-1546 - Modified to work with language translation
  51. # 50926-1656 - Added campaign pull-down at login of active campaigns
  52. # 50928-1633 - Added manual dial alternate number dial option
  53. # 50930-1538 - Added session_id empty login failure and fixed 2 minor bugs
  54. # 51004-1656 - Fixed recording filename bug and new Spanish translation
  55. # 51020-1103 - Added campaign-specific recording control abilities
  56. # 51020-1352 - Added Basic vicidial_agent_log framework
  57. # 51021-1050 - Fixed custtime display and disable Enter/Return keypresses
  58. # 51021-1718 - Allows for multi-line comments (changes \n to !N in database)
  59. # 51110-1432 - Fixed non-standard http port issue
  60. # 51111-1047 - Added vicidial_agent_log lead_id earlier for manual dial
  61. # 51118-1305 - Activate multi-line comments from $multi_line_comments var
  62. # 51118-1313 - Move Transfer DIV to a floating span to preserve 800x600 view
  63. # 51121-1506 - Small PHP optimizations in many scripts and disabled globalize
  64. # 51129-1010 - Added ability to accept calls from other VICIDIAL servers
  65. # 51129-1254 - Fixed Hangups of other agents channels when customer hangs up
  66. # 51208-1732 - Created user-first login that looks for default phone info
  67. # 51219-1526 - Added variable framework for campaign and in-group scripts
  68. # 51221-1200 - Added SCRIPT tab, layout and functionality
  69. # 51221-1714 - Added auto-switch-to-SCRIPT-tab and auto-webform-popup
  70. # 51222-1605 - Added VMail message blind transfer button to xfer-conf frame
  71. # 51229-1028 - Added checks on web_form_address to allow for var in the DB value
  72. # 60117-1312 - Added Transfer-conf frame toggle on button press
  73. # 60208-1152 - Added DTMF-xfernumber preset links to xfer-conf frame
  74. # 60213-1129 - Added vicidial_users.hotkeys_active for any user hotkeys
  75. # 60213-1210 - Added ability to sort routing of calls by user_level
  76. # 60214-0932 - Initial Callback calendar display framework
  77. # 60214-1407 - Added ability to minimize the dispo screen to see info below
  78. # 60215-1104 - Added ANYONE scheduled callbacks functionality
  79. # 60410-1116 - Added persistant pause after dispo option and change dispo text
  80. # - Added web form submit that opens new window with dispo on submit
  81. # - Added PREVIOUS CALLBACK in customer info to flag callbacks
  82. # - Added link to try to hangup the call again in the dispo screen
  83. # - Added link noone-in-session screen to call agent phone again
  84. # - Added link customer-hungup screen to go straight to dispo screen
  85. # 60410-1532 - Added agent status and campaign calls dialing display option
  86. # 60411-1547 - Add ability to set callback as USERONLY and some basic formatting
  87. # 60413-1752 - Add basic USERONLY callback frame and listings
  88. # 60414-1039 - Changed manual dial preview and alt dial checkboxes to spans
  89. # - Added beta-level USERONLY callback functionality
  90. # - Added beta-level manual dialing with lead insertion functionality
  91. # 60415-1534 - Fixed manual dial lead preview and fixed manuald dial override bug
  92. # 60417-1108 - Added capability to do alt-number-dialing in auto-dial mode
  93. # - Changed several permissions to database-defined
  94. # 60419-1529 - Prevent manual dial or callbacks when alt-dial lead not finished
  95. # 60420-1647 - Fixed DiaLDiaLAltPhonE error, Call Agent Again DialControl error
  96. # 60421-1229 - Check GET/POST vars lines with isset to not trigger PHP NOTICES
  97. # 60424-1005 - Fixed Alt phone disabled bug for callbacks and manual dials
  98. # 60426-1058 - Added vicidial_user setting for default blended check for CLOSER
  99. # 60501-1008 - Added option to manual dial screen to manually lookup phone number
  100. # 60503-1653 - Fixed agentonly_callback not-defined bug in scheduled callbacks screen
  101. # 60504-1032 - Fixed manual dial display bug and transfer dispo alert bug
  102. # - Fixed recording filename display to not overrun 25 characters
  103. # 60510-1051 - Added Wrapup timer and wrapup message on wrapup screen after dispo
  104. # 60608-1453 - Added CLOSER campaign allowable in-groups limitations
  105. # 60609-1123 - Added add-number-to-DNC-list function and manual dial check DNC
  106. # 60619-1047 - Added variable filters to close security holes for login form
  107. # 60804-1710 - fixed scheduled CALLBK for other languages build
  108. # 60808-1145 - Added consultative transfers with customer data
  109. # 60808-2232 - Added campaign name to pulldown for login screen
  110. # 60809-1603 - Added option to locally transfer consult xfers
  111. # 60809-1732 - Added recheck of transferred channels before customer gone mesg
  112. # 60810-1011 - Fixed CXFER leave 3way call bugs
  113. # 60816-1602 - Added ALLCALLS recording delay option allcalls_delay
  114. # 60816-1716 - Fixed customer time display bug and client DST setting
  115. # 60821-1555 - Added option to omit phone_code on dialout of leads
  116. # 60821-1628 - Added ALLFORCE recording option
  117. # 60821-1643 - Added no_delete_sessions option to not delete sessions
  118. # 60822-0512 - Changed phone number fields to be maxlength of 12
  119. # 60829-1531 - Made compatible with WeBRooTWritablE setting in dbconnect.php
  120. # 60906-1152 - Added Previous CallBack info display span
  121. # 60906-1715 - Allow for Local phone extension conferences
  122. # 61004-1729 - Add ability to control volume per channel in "calls in this session"
  123. # 61122-1341 - Added vicidial_user_groups allowed_campaigns restrictions
  124. # 61122-1523 - Added more SCRIPT variables
  125. # 61128-2229 - Added vicidial_live_agents and vicidial_auto_calls manual dial entries
  126. # 61130-1617 - Added lead_id to MonitorConf for recording_log
  127. # 61221-1212 - Changed width to 760 to better fit 800x600 screens, widened SCRIPT
  128. # 70109-1128 - Fixed wrapup timer bug
  129. # 70109-1635 - Added option for HotKeys automatically dialing next number in manual mode
  130. # - Added option for alternate number dialing with hotkeys
  131. # 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns
  132. # 70118-1517 - Added vicidial_agent_log and vicidial_user_log logging of user_group
  133. # 70201-1249 - Added FAST DIAL option for manually dialing, added UTF8 compatible code
  134. # 70201-1703 - Fixed cursor bug for most text input fields
  135. # 70202-1453 - Added first portions of Agent Pause Codes
  136. # 70203-0108 - Finished Agent Pause Codes functionality
  137. # 70203-0930 - Added dialed_number to webform output
  138. # 70203-1010 - Added dialed_label to webform output
  139. # 70206-1201 - Fixed allow_closers bug
  140. # 70206-1332 - Added vicidial_recording_override users setting function
  141. # 70212-1252 - Fixed small issue with CXFER
  142. # 70213-1018 - Changed CXFER and AXFER to update customer information before transfer
  143. # 70214-1233 - Added queuemetrics_log_id field for server_id in queue_log
  144. # 70215-1240 - Added queuemetrics_log_id field for server_id in queue_log
  145. # 70222-1617 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL
  146. # 70226-1252 - Added Mute/UnMute to agent screen
  147. # 70309-1035 - Allow amphersands and questions marks in comments to pass through
  148. # 70313-1052 - Allow pound signs(hash) in comments to pass through
  149. # 70316-1406 - Moved the MUTE button to be accessible during a transfer/conf
  150. # 70319-1446 - Added agent-deactive-display and disable customer info update functions
  151. # 70319-1626 - Added option to allow agent logins to campaigns with no leads in the hopper
  152. # 70320-1501 - Added option to allow retry of leave-3way-call from dispo screen
  153. # 70322-1545 - Added sipsak display ability
  154. # 70510-1319 - Added onUnload force Logout
  155. # 70806-1530 - Added Presets Dial links above agent mute button
  156. # 70823-2118 - Fixed XMLHTTPRequest, HotKeys and Scheduled Callbacks issues with MSIE
  157. # 70828-1443 - Added source_id to output of SCRIPTtab-IFRAME and WEBFORM
  158. # 71022-1427 - Added formatting of the customer phone number in the main status bar
  159. # 71029-1848 - Changed CLOSER-type campaign to not use campaign_id restrictions
  160. # 71101-1204 - Fixed bug in callback calendar with DST
  161. # 71116-0957 - Added campaign_weight and calls_today to the vla table insertion
  162. # 71120-1719 - Added XMLHTPRequest lookup of allowable campaigns for agents during login
  163. # 71122-0256 - Added auto-pause notification
  164. # 71125-1751 - Changed Transfer section to allow for selection of in-groups to send calls to
  165. # 71127-0408 - Added height and width settings for easier modification of screen size
  166. # 71129-2025 - restricted callbacks count and list to campaign only
  167. # 71223-0318 - changed logging of closer calls
  168. # 71226-1117 - added option to kick all calls from conference upon logout
  169. # 80109-1510 - added gender select list
  170. # 80116-1032 - added option on CLOSER-type campaigns to change in-groups when paused
  171. # 80317-2106 - added recording override options for inbound group calls
  172. # 80331-1433 - Added second transfer try for VICIDIAL transfers/hangups on manual dial calls
  173. # 80402-0121 - Fixes for manual dial transfers on some systems
  174. # 80407-2112 - Work on adding phone login load balancing across servers
  175. # 80416-0559 - Added ability to log computer_ip at login, set the $PhoneSComPIP variable
  176. # 80428-0413 - UTF8 changes and testing
  177. # 80505-0054 - Added multi-phones load-balanced alias option
  178. # 80507-0932 - Fixed Script display bug (+ instead of space)
  179. # 80519-1425 - Added calls in queue display
  180. # 80523-1630 - Added Timeclock links
  181. # 80625-0047 - Added U option for gender, added date/phone display options
  182. # 80630-2210 - Added queue_log entries for Manual Dial
  183. # 80703-0139 - Added alter customer phone permissions
  184. # 80703-1106 - Added API functionality for Hangup and Dispo, added Agent Display Queue Count
  185. # 80707-2325 - Added vicidial_id to recording_log for tracking of vicidial or closer log to recording
  186. # 80709-0358 - Added Default alt phone dial hard-code option
  187. # 80719-1147 - Changed recording and senddtmf conf prefix
  188. # 80815-1014 - Added manual dial list restriction option
  189. # 80823-2123 - Fixed form scroll for IE, added copy to clipboard(IE-only feature)
  190. # 80831-0548 - Added Extended alt-dial-phone display information for non-manual calls
  191. # 80909-1717 - Added support for campaign-specific DNC lists
  192. # 80915-1754 - Rewrote leave-3way functions for external calling
  193. # 81002-1908 - Fixed double-login bug in some conditions
  194. # 81007-0945 - Added three_way_call_cid option for outbound 3way calls
  195. # 81010-1047 - Fixed conf calling prefix to use settings, other 3way improvements
  196. # 81011-1403 - Fixed bugs in leave3way when transferring a manual dial call
  197. # 81012-1729 - Added INBOUND_MAN dial method to allow manual list dialing and inbound calls
  198. # 81013-1644 - Fixed bug in leave 3way for manual dial fronters
  199. # 81015-0405 - Fixed bug related to hangups on 3way calls
  200. # 81016-0703 - Changed leave 3way to allow function at any time transfer-conf is available
  201. # 81020-1501 - Fixed bugs in queue_log logging
  202. # 81023-0411 - Added compatibility for dial-in agents using AGI, bug fixes
  203. # 81030-0403 - Added option to force Pause Codes on PAUSE
  204. # 81103-1427 - Added 3way call dial prefix
  205. # 81104-0140 - Added mysql error logging capability
  206. # 81104-1618 - Changed MySQL queries logging
  207. # 81106-0411 - Changedthe campaign login list behaviour
  208. # 81110-0057 - Changed Pause time to start new vicidial_agent_log on every pause
  209. # 81110-1514 - Added hangup_all_non_reserved to fix non-Hangup bug
  210. # 81119-1811 - webform backslash fix
  211. # 81124-2213 - Fixes blind transfer bug
  212. # 81209-1617 - Added campaign web form target option and web form address variables
  213. # 81211-0422 - Fixed Manual dial agent_log bug
  214. # 90102-1402 - Added time sync check notification
  215. # 90115-0619 - Added ability to send Local Closer to AGENTDIRECT agent_only
  216. # 90120-1719 - Added API pause/resume and number dial functionality
  217. # 90126-2302 - Added Vtiger login option and agent alert option
  218. # 90128-0230 - Added vendor_lead_code to API dial and manuald dial with lookup
  219. # 90202-0148 - Added option to disable BLENDED checkbox
  220. # 90209-0132 - Changed tab images and color scheme
  221. # 90303-1145 - Fixed rare manual dial live hangup bug
  222. # 90304-1333 - Added user-specific web vars option
  223. # 90305-0917 - Added prefix-choice and group-alias options for calls coming from API
  224. # 90307-1736 - Added Shift enforcement and manager override features
  225. # 90320-0309 - Fixed agent log bug when using wrapup time
  226. #
  227. $version = '2.0.5-202';
  228. $build = '90320-0309';
  229. $mel=1; # Mysql Error Log enabled = 1
  230. $mysql_log_count=60;
  231. $one_mysql_log=0;
  232. require("dbconnect.php");
  233. if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
  234. elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
  235. if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
  236. elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
  237. if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
  238. elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
  239. if (isset($_GET["VD_login"])) {$VD_login=$_GET["VD_login"];}
  240. elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];}
  241. if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];}
  242. elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];}
  243. if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];}
  244. elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];}
  245. if (isset($_GET["relogin"])) {$relogin=$_GET["relogin"];}
  246. elseif (isset($_POST["relogin"])) {$relogin=$_POST["relogin"];}
  247. if (isset($_GET["MGR_override"])) {$MGR_override=$_GET["MGR_override"];}
  248. elseif (isset($_POST["MGR_override"])) {$MGR_override=$_POST["MGR_override"];}
  249. if (!isset($phone_login))
  250. {
  251. if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];}
  252. elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];}
  253. }
  254. if (!isset($phone_pass))
  255. {
  256. if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];}
  257. elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];}
  258. }
  259. if (isset($VD_campaign))
  260. {
  261. $VD_campaign = strtoupper($VD_campaign);
  262. $VD_campaign = eregi_replace(" ",'',$VD_campaign);
  263. }
  264. if (!isset($flag_channels))
  265. {
  266. $flag_channels=0;
  267. $flag_string='';
  268. }
  269. ### security strip all non-alphanumeric characters out of the variables ###
  270. $DB=ereg_replace("[^0-9a-z]","",$DB);
  271. $phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login);
  272. $phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass);
  273. $VD_login=ereg_replace("[^0-9a-zA-Z]","",$VD_login);
  274. $VD_pass=ereg_replace("[^0-9a-zA-Z]","",$VD_pass);
  275. $VD_campaign = ereg_replace("[^-\_0-9a-zA-Z]","",$VD_campaign);
  276. $forever_stop=0;
  277. if ($force_logout)
  278. {
  279. echo "Usted ahora ha registrado hacia fuera. Gracias\n";
  280. exit;
  281. }
  282. $isdst = date("I");
  283. $StarTtimE = date("U");
  284. $NOW_TIME = date("Y-m-d H:i:s");
  285. $tsNOW_TIME = date("YmdHis");
  286. $FILE_TIME = date("Ymd-His");
  287. $loginDATE = date("Ymd");
  288. $CIDdate = date("ymdHis");
  289. $month_old = mktime(11, 0, 0, date("m"), date("d")-2, date("Y"));
  290. $past_month_date = date("Y-m-d H:i:s",$month_old);
  291. $minutes_old = mktime(date("H"), date("i")-2, date("s"), date("m"), date("d"), date("Y"));
  292. $past_minutes_date = date("Y-m-d H:i:s",$minutes_old);
  293. $random = (rand(1000000, 9999999) + 10000000);
  294. #############################################
  295. ##### START SYSTEM_SETTINGS LOOKUP #####
  296. $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;";
  297. $rslt=mysql_query($stmt, $link);
  298. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  299. if ($DB) {echo "$stmt\n";}
  300. $qm_conf_ct = mysql_num_rows($rslt);
  301. $i=0;
  302. while ($i < $qm_conf_ct)
  303. {
  304. $row=mysql_fetch_row($rslt);
  305. $non_latin = $row[0];
  306. $vdc_header_date_format = $row[1];
  307. $vdc_customer_date_format = $row[2];
  308. $vdc_header_phone_format = $row[3];
  309. $WeBRooTWritablE = $row[4];
  310. $timeclock_end_of_day = $row[5];
  311. $vtiger_url = $row[6];
  312. $enable_vtiger_integration = $row[7];
  313. $outbound_autodial_active = $row[8];
  314. $i++;
  315. }
  316. ##### END SETTINGS LOOKUP #####
  317. ###########################################
  318. ##### DEFINABLE SETTINGS AND OPTIONS
  319. ###########################################
  320. $conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording
  321. $dtmf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently
  322. $HKuser_level = '5'; # minimum vicidial user_level for HotKeys
  323. $campaign_login_list = '1'; # show drop-down list of campaigns at login
  324. $manual_dial_preview = '1'; # allow preview lead option when manual dial
  325. $multi_line_comments = '1'; # set to 1 to allow multi-line comment box
  326. $user_login_first = '0'; # set to 1 to have the vicidial_user login before the phone login
  327. $view_scripts = '1'; # set to 1 to show the SCRIPTS tab
  328. $dispo_check_all_pause = '0'; # set to 1 to allow for persistent pause after dispo
  329. $callholdstatus = '1'; # set to 1 to show calls en hold count
  330. $agentcallsstatus = '0'; # set to 1 to show agent status and call dialed count
  331. $campagentstatctmax = '3'; # Number of segundos for campaign call and agent stats
  332. $show_campname_pulldown = '1'; # set to 1 to show campaign name en login pulldown
  333. $webform_sessionname = '1'; # set to 1 to include the session_name in webform URL
  334. $local_consult_xfers = '1'; # set to 1 to send consultative transfers from original server
  335. $clientDST = '1'; # set to 1 to check for DST en server for agent time
  336. $no_delete_sessions = '0'; # set to 1 to not delete sessions at logout
  337. $volumecontrol_active = '1'; # set to 1 to allow agents to alter volume of channels
  338. $PreseT_DiaL_LinKs = '0'; # set to 1 to show a DIAL link for Dial Presets
  339. $LogiNAJAX = '1'; # set to 1 to do lookups en campaigns for login
  340. $HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls"
  341. $hangup_all_non_reserved= '1'; # set to 1 to force hangup all non-reserved channels upon Colgar al Cliente
  342. $LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout
  343. $TeléfonoSComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login
  344. $DefaulTAlTDiaL = '0'; # set to 1 to enable ALT DIAL by default if enabled for the campaign
  345. $AgentAlert_allowed = '1'; # set to 1 to allow Agent alert option
  346. $disable_blended_checkbox='0'; # set to 1 to disable the BLENDED checkbox from the in-group chooser screen
  347. $TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen
  348. $BROWSER_HEIGHT = 500; # set to the minimum browser height, default=500
  349. $BROWSER_WIDTH = 770; # set to the minimum browser width, default=770
  350. $MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6
  351. $SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0
  352. # options now set in DB:
  353. #$alt_phone_dialing = '1'; # allow agents to call alt phone numbers
  354. #$scheduled_callbacks = '1'; # set to 1 to allow agent to choose scheduled callbacks
  355. # $agentonly_callbacks = '1'; # set to 1 to allow agent to choose agent-only scheduled callbacks
  356. #$agentcall_manual = '1'; # set to 1 to allow agent to make manual calls during autodial session
  357. ### SCREEN WIDTH AND HEIGHT CALCULATIONS ###
  358. ### DO NOT EDIT! ###
  359. $MASTERwidth=($BROWSER_WIDTH - 340);
  360. $MASTERheight=($BROWSER_HEIGHT - 200);
  361. if ($MASTERwidth < 430) {$MASTERwidth = '430';}
  362. if ($MASTERheight < 300) {$MASTERheight = '300';}
  363. $CAwidth = ($MASTERwidth + 340); # 770 - cover all (none-in-session, customer hunngup, etc...)
  364. $MNwidth = ($MASTERwidth + 330); # 760 - main frame
  365. $XFwidth = ($MASTERwidth + 320); # 750 - transfer/conference
  366. $HCwidth = ($MASTERwidth + 310); # 740 - hotkeys and callbacks
  367. $AMwidth = ($MASTERwidth + 270); # 700 - agent mute and preset-dial links
  368. $SCwidth = ($MASTERwidth + 230); # 670 - live call segundos counter
  369. $SSwidth = ($MASTERwidth + 176); # 606 - scroll script
  370. $SDwidth = ($MASTERwidth + 170); # 600 - scroll script, customer data and calls-in-session
  371. $HKwidth = ($MASTERwidth + 70); # 500 - Hotkeys button
  372. $HSwidth = ($MASTERwidth + 1); # 431 - Header spacer
  373. $HKheight = ($MASTERheight + 105); # 405 - HotKey active Button
  374. $AMheight = ($MASTERheight + 100); # 400 - Agent mute and preset dial links
  375. $MBheight = ($MASTERheight + 65); # 365 - Manual Dial Buttons
  376. $CBheight = ($MASTERheight + 50); # 350 - Agent Callback, pause code, volume control Buttons and agent status
  377. $SSheight = ($MASTERheight + 31); # 331 - script content
  378. $HTheight = ($MASTERheight + 10); # 310 - transfer frame, callback comments and hotkey
  379. $BPheight = ($MASTERheight - 250); # 50 - bottom buffer
  380. $US='_';
  381. $CL=':';
  382. $AT='@';
  383. $DS='-';
  384. $date = date("r");
  385. $ip = getenv("REMOTE_ADDR");
  386. $browser = getenv("HTTP_USER_AGENT");
  387. $script_name = getenv("SCRIPT_NAME");
  388. $server_name = getenv("SERVER_NAME");
  389. $server_port = getenv("SERVER_PORT");
  390. if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
  391. else {$HTTPprotocol = 'http://';}
  392. if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
  393. else {$server_port = "$CL$server_port";}
  394. $agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
  395. $agcDIR = eregi_replace('vicidial.php','',$agcPAGE);
  396. header ("Content-type: text/html; charset=utf-8");
  397. header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
  398. header ("Pragma: no-cache"); // HTTP/1.0
  399. echo "<html>\n";
  400. echo "<head>\n";
  401. echo "<!-- VERSIÓN: $version CONSTRUCCION: $build -->\n";
  402. if ($campaign_login_list > 0)
  403. {
  404. $camp_form_code = "<select size=1 name=VD_campaign id=VD_campaign onFocus=\"login_allowable_campaigns()\">\n";
  405. $camp_form_code .= "<option value=\"\"></option>\n";
  406. $LOGallowed_campaignsSQL='';
  407. if ($relogin == 'YES')
  408. {
  409. $stmt="SELECT user_group from vicidial_users where user='$VD_login' and pass='$VD_pass'";
  410. if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
  411. $rslt=mysql_query($stmt, $link);
  412. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01002',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  413. $row=mysql_fetch_row($rslt);
  414. $VU_user_group=$row[0];
  415. $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';";
  416. $rslt=mysql_query($stmt, $link);
  417. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01003',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  418. $row=mysql_fetch_row($rslt);
  419. if ( (!eregi("ALL-CAMPAIGNS",$row[0])) )
  420. {
  421. $LOGallowed_campaignsSQL = eregi_replace(' -','',$row[0]);
  422. $LOGallowed_campaignsSQL = eregi_replace(' ',"','",$LOGallowed_campaignsSQL);
  423. $LOGallowed_campaignsSQL = "and campaign_id IN('$LOGallowed_campaignsSQL')";
  424. }
  425. }
  426. ### code for manager override of shift restrictions
  427. if ($MGR_override > 0)
  428. {
  429. if (isset($_GET["MGR_login$loginDATE"])) {$MGR_login=$_GET["MGR_login$loginDATE"];}
  430. elseif (isset($_POST["MGR_login$loginDATE"])) {$MGR_login=$_POST["MGR_login$loginDATE"];}
  431. if (isset($_GET["MGR_pass$loginDATE"])) {$MGR_pass=$_GET["MGR_pass$loginDATE"];}
  432. elseif (isset($_POST["MGR_pass$loginDATE"])) {$MGR_pass=$_POST["MGR_pass$loginDATE"];}
  433. $stmt="SELECT count(*) from vicidial_users where user='$MGR_login' and pass='$MGR_pass' and manager_shift_enforcement_override='1' and active='Y';";
  434. if ($DB) {echo "|$stmt|\n";}
  435. $rslt=mysql_query($stmt, $link);
  436. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01058',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  437. $row=mysql_fetch_row($rslt);
  438. $MGR_auth=$row[0];
  439. if($MGR_auth>0)
  440. {
  441. $stmt="UPDATE vicidial_users SET shift_override_flag='1' where user='$VD_login' and pass='$VD_pass';";
  442. if ($DB) {echo "|$stmt|\n";}
  443. $rslt=mysql_query($stmt, $link);
  444. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01059',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  445. print "<!-- Shift Override entered for $VD_login by $MGR_login -->\n";
  446. ### Add a record to the vicidial_admin_log
  447. $SQL_log = "$stmt|";
  448. $SQL_log = ereg_replace(';','',$SQL_log);
  449. $SQL_log = addslashes($SQL_log);
  450. $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';";
  451. if ($DB) {echo "|$stmt|\n";}
  452. $rslt=mysql_query($stmt, $link);
  453. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01060',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  454. }
  455. }
  456. $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id";
  457. if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
  458. $rslt=mysql_query($stmt, $link);
  459. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01004',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  460. $camps_to_print = mysql_num_rows($rslt);
  461. $o=0;
  462. while ($camps_to_print > $o)
  463. {
  464. $rowx=mysql_fetch_row($rslt);
  465. if ($show_campname_pulldown)
  466. {$campname = " - $rowx[1]";}
  467. else
  468. {$campname = '';}
  469. if ($VD_campaign)
  470. {
  471. if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) )
  472. {$camp_form_code .= "<option value=\"$rowx[0]\" SELECTED>$rowx[0]$campname</option>\n";}
  473. else
  474. {
  475. if (!ereg('login_allowable_campaigns',$camp_form_code))
  476. {$camp_form_code .= "<option value=\"$rowx[0]\">$rowx[0]$campname</option>\n";}
  477. }
  478. }
  479. else
  480. {
  481. if (!ereg('login_allowable_campaigns',$camp_form_code))
  482. {$camp_form_code .= "<option value=\"$rowx[0]\">$rowx[0]$campname</option>\n";}
  483. }
  484. $o++;
  485. }
  486. $camp_form_code .= "</select>\n";
  487. }
  488. else
  489. {
  490. $camp_form_code = "<INPUT TYPE=TEXT NAME=VD_campaign SIZE=10 maxlength=20 VALUE=\"$VD_campaign\">\n";
  491. }
  492. if ($LogiNAJAX > 0)
  493. {
  494. ?>
  495. <script language="Javascript">
  496. // ################################################################################
  497. // Send Request for allowable campaigns to populate the campaigns pull-down
  498. function login_allowable_campaigns()
  499. {
  500. var xmlhttp=false;
  501. /*@cc_on @*/
  502. /*@if (@_jscript_version >= 5)
  503. // JScript gives us Conditional compilation, we can cope with old IE versions.
  504. // and security blocked creation of the objects.
  505. try {
  506. xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  507. } catch (e) {
  508. try {
  509. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  510. } catch (E) {
  511. xmlhttp = false;
  512. }
  513. }
  514. @end @*/
  515. if (!xmlhttp && typeof XMLHttpRequest!='undefined')
  516. {
  517. xmlhttp = new XMLHttpRequest();
  518. }
  519. if (xmlhttp)
  520. {
  521. logincampaign_query = "&user=" + document.vicidial_form.VD_login.value + "&pass=" + document.vicidial_form.VD_pass.value + "&ACTION=LogiNCamPaigns&format=html";
  522. xmlhttp.open('POST', 'vdc_db_query.php');
  523. xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
  524. xmlhttp.send(logincampaign_query);
  525. xmlhttp.onreadystatechange = function()
  526. {
  527. if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
  528. {
  529. Nactiveext = null;
  530. Nactiveext = xmlhttp.responseText;
  531. // alert(logincampaign_query);
  532. // alert(xmlhttp.responseText);
  533. document.getElementById("LogiNCamPaigns").innerHTML = Nactiveext;
  534. document.getElementById("LogiNReseT").innerHTML = "<INPUT TYPE=BUTTON VALUE=\"Recarga Campaña List\" OnClick=\"login_allowable_campaigns()\">";
  535. document.getElementById("VD_campaign").focus();
  536. }
  537. }
  538. delete xmlhttp;
  539. }
  540. }
  541. </script>
  542. <?
  543. }
  544. if ($relogin == 'YES')
  545. {
  546. echo "<title>web client VICIDIAL: Conexión Otra Vez</title>\n";
  547. echo "</head>\n";
  548. echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
  549. 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";
  550. echo "<TABLE WIDTH=100%><TR><TD></TD>\n";
  551. echo "<!-- ILPV -->\n";
  552. 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";
  553. echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
  554. echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
  555. echo "<BR><BR><BR><CENTER><TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"$MAIN_COLOR\"><TR BGCOLOR=WHITE>";
  556. echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vdc_tab_vicidial.gif\" Border=0></TD>";
  557. echo "<TD ALIGN=CENTER VALIGN=MIDDLE> Conexión Otra Vez </TD>";
  558. echo "</TR>\n";
  559. echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
  560. echo "<TR><TD ALIGN=RIGHT>Conexión Del Teléfono: </TD>";
  561. echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=phone_login SIZE=10 maxlength=20 VALUE=\"$phone_login\"></TD></TR>\n";
  562. echo "<TR><TD ALIGN=RIGHT>Contraseña Del Teléfono: </TD>";
  563. echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=phone_pass SIZE=10 maxlength=20 VALUE=\"$phone_pass\"></TD></TR>\n";
  564. echo "<TR><TD ALIGN=RIGHT>Conexión Del Usuario: </TD>";
  565. echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=VD_login SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
  566. echo "<TR><TD ALIGN=RIGHT>Contraseña Del Usuario: </TD>";
  567. echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=VD_pass SIZE=10 maxlength=20 VALUE=\"$VD_pass\"></TD></TR>\n";
  568. echo "<TR><TD ALIGN=RIGHT>Campaña: </TD>";
  569. echo "<TD ALIGN=LEFT><span id=\"LogiNCamPaigns\">$camp_form_code</span></TD></TR>\n";
  570. echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> &nbsp; \n";
  571. echo "<span id=\"LogiNReseT\"><INPUT TYPE=BUTTON VALUE=\"Recarga Campaña List\" OnClick=\"login_allowable_campaigns()\"></span></TD></TR>\n";
  572. echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version &nbsp; &nbsp; &nbsp; CONSTRUCCION: $build</TD></TR>\n";
  573. echo "</TABLE>\n";
  574. echo "</FORM>\n\n";
  575. echo "</body>\n\n";
  576. echo "</html>\n\n";
  577. exit;
  578. }
  579. if ($user_login_first == 1)
  580. {
  581. if ( (strlen($VD_login)<1) or (strlen($VD_pass)<1) or (strlen($VD_campaign)<1) )
  582. {
  583. echo "<title>web client VICIDIAL: Conexión en la Campaña</title>\n";
  584. echo "</head>\n";
  585. echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
  586. 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";
  587. echo "<TABLE WIDTH=100%><TR><TD></TD>\n";
  588. echo "<!-- ILPV -->\n";
  589. 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";
  590. echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
  591. echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
  592. #echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
  593. #echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
  594. echo "<CENTER><BR><B>Conexión Del Usuario</B><BR><BR>";
  595. echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"$MAIN_COLOR\"><TR BGCOLOR=WHITE>";
  596. echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vdc_tab_vicidial.gif\" Border=0></TD>";
  597. echo "<TD ALIGN=CENTER VALIGN=MIDDLE> Conexión en la Campaña </TD>";
  598. echo "</TR>\n";
  599. echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
  600. echo "<TR><TD ALIGN=RIGHT>Conexión Del Usuario: </TD>";
  601. echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=VD_login SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
  602. echo "<TR><TD ALIGN=RIGHT>Contraseña Del Usuario: </TD>";
  603. echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=VD_pass SIZE=10 maxlength=20 VALUE=\"$VD_pass\"></TD></TR>\n";
  604. echo "<TR><TD ALIGN=RIGHT>Campaña: </TD>";
  605. echo "<TD ALIGN=LEFT><span id=\"LogiNCamPaigns\">$camp_form_code</span></TD></TR>\n";
  606. echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> &nbsp; \n";
  607. echo "<span id=\"LogiNReseT\"></span></TD></TR>\n";
  608. echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version &nbsp; &nbsp; &nbsp; CONSTRUCCION: $build</TD></TR>\n";
  609. echo "</TABLE>\n";
  610. echo "</FORM>\n\n";
  611. echo "</body>\n\n";
  612. echo "</html>\n\n";
  613. exit;
  614. }
  615. else
  616. {
  617. if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) )
  618. {
  619. $stmt="SELECT phone_login,phone_pass from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0 and active='Y';";
  620. if ($DB) {echo "|$stmt|\n";}
  621. $rslt=mysql_query($stmt, $link);
  622. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01005',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  623. $row=mysql_fetch_row($rslt);
  624. $phone_login=$row[0];
  625. $phone_pass=$row[1];
  626. echo "<title>web client VICIDIAL: Conexión</title>\n";
  627. echo "</head>\n";
  628. echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
  629. 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";
  630. echo "<TABLE WIDTH=100%><TR><TD></TD>\n";
  631. echo "<!-- ILPV -->\n";
  632. 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";
  633. echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
  634. echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
  635. echo "<BR><BR><BR><CENTER><TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"$MAIN_COLOR\"><TR BGCOLOR=WHITE>";
  636. echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vdc_tab_vicidial.gif\" Border=0></TD>";
  637. echo "<TD ALIGN=CENTER VALIGN=MIDDLE> Conexión </TD>";
  638. echo "</TR>\n";
  639. echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
  640. echo "<TR><TD ALIGN=RIGHT>Conexión Del Teléfono: </TD>";
  641. echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=phone_login SIZE=10 maxlength=20 VALUE=\"$phone_login\"></TD></TR>\n";
  642. echo "<TR><TD ALIGN=RIGHT>Contraseña Del Teléfono: </TD>";
  643. echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=phone_pass SIZE=10 maxlength=20 VALUE=\"$phone_pass\"></TD></TR>\n";
  644. echo "<TR><TD ALIGN=RIGHT>Conexión Del Usuario: </TD>";
  645. echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=VD_login SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
  646. echo "<TR><TD ALIGN=RIGHT>Contraseña Del Usuario: </TD>";
  647. echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=VD_pass SIZE=10 maxlength=20 VALUE=\"$VD_pass\"></TD></TR>\n";
  648. echo "<TR><TD ALIGN=RIGHT>Campaña: </TD>";
  649. echo "<TD ALIGN=LEFT><span id=\"LogiNCamPaigns\">$camp_form_code</span></TD></TR>\n";
  650. echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> &nbsp; \n";
  651. echo "<span id=\"LogiNReseT\"></span></TD></TR>\n";
  652. echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version &nbsp; &nbsp; &nbsp; CONSTRUCCION: $build</TD></TR>\n";
  653. echo "</TABLE>\n";
  654. echo "</FORM>\n\n";
  655. echo "</body>\n\n";
  656. echo "</html>\n\n";
  657. exit;
  658. }
  659. }
  660. }
  661. if ( (strlen($phone_login)<2) or (strlen($phone_pass)<2) )
  662. {
  663. echo "<title>web client VICIDIAL: Conexión Del Teléfono</title>\n";
  664. echo "</head>\n";
  665. echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
  666. 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";
  667. echo "<TABLE WIDTH=100%><TR><TD></TD>\n";
  668. echo "<!-- ILPV -->\n";
  669. 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";
  670. echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
  671. echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
  672. echo "<BR><BR><BR><CENTER><TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"$MAIN_COLOR\"><TR BGCOLOR=WHITE>";
  673. echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vdc_tab_vicidial.gif\" Border=0></TD>";
  674. echo "<TD ALIGN=CENTER VALIGN=MIDDLE> Conexión Del Teléfono </TD>";
  675. echo "</TR>\n";
  676. echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> &nbsp; </TD></TR>\n";
  677. echo "<TR><TD ALIGN=RIGHT>Conexión Del Teléfono: </TD>";
  678. echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=phone_login SIZE=10 maxlength=20 VALUE=\"\"></TD></TR>\n";
  679. echo "<TR><TD ALIGN=RIGHT>Contraseña Del Teléfono: </TD>";
  680. echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=phone_pass SIZE=10 maxlength=20 VALUE=\"\"></TD></TR>\n";
  681. echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> &nbsp; \n";
  682. echo "<span id=\"LogiNReseT\"></span></TD></TR>\n";
  683. echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version &nbsp; &nbsp; &nbsp; CONSTRUCCION: $build</TD></TR>\n";
  684. echo "</TABLE>\n";
  685. echo "</FORM>\n\n";
  686. echo "</body>\n\n";
  687. echo "</html>\n\n";
  688. exit;
  689. }
  690. else
  691. {
  692. if ($WeBRooTWritablE > 0)
  693. {$fp = fopen ("./vicidial_auth_entries.txt", "a");}
  694. $VDloginDISPLAY=0;
  695. if ( (strlen($VD_login)<2) or (strlen($VD_pass)<2) or (strlen($VD_campaign)<2) )
  696. {
  697. $VDloginDISPLAY=1;
  698. }
  699. else
  700. {
  701. $stmt="SELECT count(*) from vicidial_users where user='$VD_login' and pass='$VD_pass' and user_level > 0 and active='Y';";
  702. if ($DB) {echo "|$stmt|\n";}
  703. $rslt=mysql_query($stmt, $link);
  704. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01006',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  705. $row=mysql_fetch_row($rslt);
  706. $auth=$row[0];
  707. if($auth>0)
  708. {
  709. $login=strtoupper($VD_login);
  710. $password=strtoupper($VD_pass);
  711. ##### grab the full name of the agent
  712. $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'";
  713. $rslt=mysql_query($stmt, $link);
  714. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01007',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  715. $row=mysql_fetch_row($rslt);
  716. $LOGfullname = $row[0];
  717. $user_level = $row[1];
  718. $VU_hotkeys_active = $row[2];
  719. $VU_agent_choose_ingroups = $row[3];
  720. $VU_scheduled_callbacks = $row[4];
  721. $agentonly_callbacks = $row[5];
  722. $agentcall_manual = $row[6];
  723. $VU_vicidial_recording = $row[7];
  724. $VU_vicidial_transfers = $row[8];
  725. $VU_closer_default_blended = $row[9];
  726. $VU_user_group = $row[10];
  727. $VU_vicidial_recording_override = $row[11];
  728. $VU_alter_custphone_override = $row[12];
  729. $VU_alert_enabled = $row[13];
  730. $VU_agent_shift_enforcement_override = $row[14];
  731. $VU_shift_override_flag = $row[15];
  732. if ($VU_alert_enabled > 0) {$VU_alert_enabled = 'ON';}
  733. else {$VU_alert_enabled = 'OFF';}
  734. ### Gather timeclock and shift enforcement restriction settings
  735. $stmt="SELECT forced_timeclock_login,shift_enforcement,group_shifts from vicidial_user_groups where user_group='$VU_user_group';";
  736. $rslt=mysql_query($stmt, $link);
  737. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01052',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  738. $row=mysql_fetch_row($rslt);
  739. $forced_timeclock_login = $row[0];
  740. $shift_enforcement = $row[1];
  741. $LOGgroup_shiftsSQL = eregi_replace(' ','',$row[2]);
  742. $LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL);
  743. $LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')";
  744. ### BEGIN - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR
  745. if ( (ereg('Y',$forced_timeclock_login)) or ( (ereg('ADMIN_EXEMPT',$forced_timeclock_login)) and ($VU_user_level < 8) ) )
  746. {
  747. $last_agent_event='';
  748. $HHMM = date("Hi");
  749. $HHteod = substr($timeclock_end_of_day,0,2);
  750. $MMteod = substr($timeclock_end_of_day,2,2);
  751. if ($HHMM < $timeclock_end_of_day)
  752. {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d")-1, date("Y"));}
  753. else
  754. {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d"), date("Y"));}
  755. $EoDdate = date("Y-m-d H:i:s", $EoD);
  756. ##### grab timeclock logged-in time for each user #####
  757. $stmt="SELECT event from vicidial_timeclock_log where user='$VD_login' and event_epoch >= '$EoD' order by timeclock_id desc limit 1;";
  758. $rslt=mysql_query($stmt, $link);
  759. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01053',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  760. $events_to_parse = mysql_num_rows($rslt);
  761. if ($events_to_parse > 0)
  762. {
  763. $rowx=mysql_fetch_row($rslt);
  764. $last_agent_event = $rowx[0];
  765. }
  766. if ($DB>0) {echo "|$stmt|$events_to_parse|$last_agent_event|";}
  767. if ( (strlen($last_agent_event)<2) or (ereg('SALIR',$last_agent_event)) )
  768. {
  769. $VDloginDISPLAY=1;
  770. $VDdisplayMESSAGE = "USTED DEBE ENTRAR A LA PRIMERA TIMECLOCK<BR>";
  771. }
  772. }
  773. ### END - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR
  774. ### BEGIN - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR
  775. if ( ( (ereg("COMIENZO|ALL",$shift_enforcement)) and (!ereg("OFF",$VU_agent_shift_enforcement_override)) ) or (ereg("COMIENZO|ALL",$VU_agent_shift_enforcement_override)) )
  776. {
  777. $shift_ok=0;
  778. if ( (strlen($LOGgroup_shiftsSQL) < 3) and ($VU_shift_override_flag < 1) )
  779. {
  780. $VDloginDISPLAY=1;
  781. $VDdisplayMESSAGE = "ERROR: No hay cambios habilitado para su grupo de usuarios<BR>";
  782. }
  783. else
  784. {
  785. $HHMM = date("Hi");
  786. $wday = date("w");
  787. $stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id";
  788. $rslt=mysql_query($stmt, $link);
  789. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01056',$user,$server_ip,$session_name,$one_mysql_log);}
  790. $shifts_to_print = mysql_num_rows($rslt);
  791. $o=0;
  792. while ( ($shifts_to_print > $o) and ($shift_ok < 1) )
  793. {
  794. $rowx=mysql_fetch_row($rslt);
  795. $shift_id = $rowx[0];
  796. $shift_start_time = $rowx[1];
  797. $shift_length = $rowx[2];
  798. $shift_weekdays = $rowx[3];
  799. if (eregi("$wday",$shift_weekdays))
  800. {
  801. $HHshift_length = substr($shift_length,0,2);
  802. $MMshift_length = substr($shift_length,3,2);
  803. $HHshift_start_time = substr($shift_start_time,0,2);
  804. $MMshift_start_time = substr($shift_start_time,2,2);
  805. $HHshift_end_time = ($HHshift_length + $HHshift_start_time);
  806. $MMshift_end_time = ($MMshift_length + $MMshift_start_time);
  807. if ($MMshift_end_time > 59)
  808. {
  809. $MMshift_end_time = ($MMshift_end_time - 60);
  810. $HHshift_end_time++;
  811. }
  812. if ($HHshift_end_time > 23)
  813. {$HHshift_end_time = ($HHshift_end_time - 24);}
  814. $HHshift_end_time = sprintf("%02s", $HHshift_end_time);
  815. $MMshift_end_time = sprintf("%02s", $MMshift_end_time);
  816. $shift_end_time = "$HHshift_end_time$MMshift_end_time";
  817. if (
  818. ( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or
  819. ( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or
  820. ( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) )
  821. )
  822. {$shift_ok++;}
  823. }
  824. $o++;
  825. }
  826. if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) )
  827. {
  828. $VDloginDISPLAY=1;
  829. $VDdisplayMESSAGE = "ERROR: No se le permite acceder fuera de su turno<BR>";
  830. }
  831. }
  832. if ( ($shift_ok < 1) and ($VU_shift_override_flag < 1) and ($VDloginDISPLAY > 0) )
  833. {
  834. $VDdisplayMESSAGE.= "<BR><BR>GERENTE DE TRANSFERENCIA:<BR>\n";
  835. $VDdisplayMESSAGE.= "<FORM ACTION=\"$PHP_SELF\" METHOD=POST>\n";
  836. $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=MGR_override VALUE=\"1\">\n";
  837. $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=relogin VALUE=\"YES\">\n";
  838. $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
  839. $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
  840. $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
  841. $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
  842. $VDdisplayMESSAGE.= "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
  843. $VDdisplayMESSAGE.= "Manager Conexión: <INPUT TYPE=TEXT NAME=\"MGR_login$loginDATE\" SIZE=10 maxlength=20><br>\n";
  844. $VDdisplayMESSAGE.= "Manager Contraseña: <INPUT TYPE=PASSWORD NAME=\"MGR_pass$loginDATE\" SIZE=10 maxlength=20><br>\n";
  845. $VDdisplayMESSAGE.= "<INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR></FORM>\n";
  846. }
  847. }
  848. ### END - CHECK TO SEE IF SHIFT ENFORCEMENT IS ENABLED AND AGENT IS OUTSIDE OF THEIR SHIFTS, IF SO, OUTPUT ERROR
  849. if ($WeBRooTWritablE > 0)
  850. {
  851. fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n");
  852. fclose($fp);
  853. }
  854. $user_abb = "$VD_login$VD_login$VD_login$VD_login";
  855. while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
  856. {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
  857. $stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$VU_user_group';";
  858. $rslt=mysql_query($stmt, $link);
  859. if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01008',$VD_login,$server_ip,$session_name,$one_mysql_log);}
  860. $row=mysql_fetch_row($rslt);
  861. $LOGallowed_campaigns =$row[0];
  862. if ( (!eregi(" $VD_campaign ",$LOGallowed_campaigns)) and (!eregi("ALL-CAMPAIGNS",$LOGallowed_campaigns)) )
  863. {
  864. echo "<title>web client VICIDIAL: VICIDIAL Conexión en la Campaña</title>\n";
  865. echo "</head>\n";
  866. echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
  867. 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";
  868. echo "<TABLE WIDTH=100%><TR><TD></TD>\n";
  869. echo "<!-- ILPV -->\n";
  870. echo "<TD WIDTH=10…