Cheetah
ChChatPlusModule.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbConnectModule');
9 
11 {
12  function __construct(&$aModule)
13  {
14  parent::__construct($aModule);
15  }
16 
18  {
19  parent::_actionAdministration('ch_chat_plus_url', '_ch_chat_plus_setting', '_ch_chat_plus_information', '_ch_chat_plus_information_block');
20  }
21 
22  function actionView ()
23  {
24  $this->_oTemplate->pageStart();
25 
26  ch_import ('Page', $this->_aModule);
27  $oPage = new ChChatPlusPage ('ch_chat_plus');
28  echo $oPage->getCode();
29 
30  $this->_oTemplate->pageCode(_t('_ch_chat_plus_chat'), false, false);
31  }
32 
33  function actionRedirect ()
34  {
35  if (!getParam('ch_chat_plus_url')) {
36  $this->_oTemplate->displayMsg(_t('_ch_chat_plus_not_configured'));
37  return;
38  }
39 
40  header("Location:" . getParam('ch_chat_plus_url'), true, 302);
41  }
42 
43  function actionLogo ()
44  {
45  if (!($sLogoUrl = $GLOBALS['oFunctions']->getLogoUrl())) {
46  header("HTTP/1.0 404 Not Found");
47  echo '404 Not Found';
48  return;
49  }
50 
51  header("Location:" . $sLogoUrl);
52  }
53 
54  function serviceChatBlock ()
55  {
56  if (!getParam('ch_chat_plus_url'))
57  return array(MsgBox(_t('_ch_chat_plus_not_configured')));
58 
59  $this->_oTemplate->addCss('main.css');
60  $s = $this->_oTemplate->parseHtmlByName('chat_block.html', array('chat_url' => getParam('ch_chat_plus_url')));
61 
62  return array($s, array (
63  _t('_ch_chat_plus_open_in_separate_window') => array (
64  'href' => getParam('ch_chat_plus_url'),
65  'target' => '_blank',
66  'active' => true,
67  ),
68  ), false, false, 'getChatBlockMenu');
69  }
70 
71  function serviceHelpdeskCode ()
72  {
73  $sChatUrl = getParam('ch_chat_plus_url');
74  if (!getParam('ch_chat_plus_helpdesk') || !$sChatUrl)
75  return '';
76 
77  if (getParam('ch_chat_plus_helpdesk_guest_only') && isLogged())
78  return '';
79 
80  $aUrl = parse_url($sChatUrl);
81  $sChatUrl = $aUrl['scheme'] . '://' . $aUrl['host'] . ($aUrl['port'] ? ':' . $aUrl['port'] : '');
82 
83  return <<<EOS
84 
85 <!-- Start of Rocket.Chat Livechat Script -->
86 <script type="text/javascript">
87 (function(w, d, s, u) {
88  w.RocketChat = function(c) { w.RocketChat._.push(c) }; w.RocketChat._ = []; w.RocketChat.url = u;
89  var h = d.getElementsByTagName(s)[0], j = d.createElement(s);
90  j.async = true; j.src = '{$sChatUrl}/packages/rocketchat_livechat/assets/rocketchat-livechat.min.js?_=201702160944';
91  h.parentNode.insertBefore(j, h);
92 })(window, document, 'script', '{$sChatUrl}/livechat');
93 </script>
94 <!-- End of Rocket.Chat Livechat Script -->
95 
96 EOS;
97 
98  }
99 }
header
</code > Be careful enabling this directive if you have a redirector script that does not use the< code > Location</code > HTTP header
Definition: URI.MungeResources.txt:10
document
Output SortAttr HTML Purifier will sort attributes by name before writing them back to the document
Definition: Output.SortAttr.txt:8
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
ChChatPlusModule\actionRedirect
actionRedirect()
Definition: ChChatPlusModule.php:33
ChWsbModule\isLogged
isLogged()
Definition: ChWsbModule.php:113
$aModule
$aModule
Definition: classifieds.php:21
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChChatPlusModule
Definition: ChChatPlusModule.php:11
php
$oPage
$oPage
Definition: search_home.php:83
ChChatPlusModule\__construct
__construct(&$aModule)
Definition: ChChatPlusModule.php:12
ChChatPlusModule\serviceChatBlock
serviceChatBlock()
Definition: ChChatPlusModule.php:54
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
of
however that any such election will not serve to withdraw this and this License will continue in full force and effect unless terminated as stated above Miscellaneous Each time You Distribute or Publicly Perform the Work or a the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License Each time You Distribute or Publicly Perform an Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License If any provision of this License is invalid or unenforceable under applicable it shall not affect the validity or enforceability of the remainder of the terms of this and without further action by the parties to this such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent This License constitutes the entire agreement between the parties with respect to the Work licensed here There are no agreements or representations with respect to the Work not specified here Licensor shall not be bound by any additional provisions that may appear in any communication from You This License may not be modified without the mutual written agreement of the Licensor and You The rights granted and the subject matter in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic the Rome Convention of
Definition: license.txt:65
type
if(!defined("USER_STATUS_TYPE")) define("USER_STATUS_TYPE" type
Definition: constants.inc.php:13
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
$s
$s
Definition: embed.php:13
ChChatPlusModule\actionLogo
actionLogo()
Definition: ChChatPlusModule.php:43
ChChatPlusModule\actionView
actionView()
Definition: ChChatPlusModule.php:22
ChChatPlusPage
Definition: ChChatPlusPage.php:11
ChChatPlusModule\serviceHelpdeskCode
serviceHelpdeskCode()
Definition: ChChatPlusModule.php:71
ChChatPlusModule\actionAdministration
actionAdministration()
Definition: ChChatPlusModule.php:17
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
ChWsbConnectModule
Definition: ChWsbConnectModule.php:11