示例#1
0
 public static function listen(XenForo_FrontController $fc, XenForo_ControllerResponse_Abstract &$controllerResponse, XenForo_ViewRenderer_Abstract &$viewRenderer, array &$containerParams)
 {
     $options = XenForo_Application::get('options');
     if ($options->dark_taigachat_globalhook || $controllerResponse->controllerName == 'Dark_TaigaChat_ControllerPublic_TaigaChat' || $controllerResponse->controllerName == 'XenForo_ControllerPublic_Index') {
         $action = $controllerResponse->controllerAction;
         $action[0] = strtolower($action[0]);
         Dark_TaigaChat_Helper_Global::getTaigaChatStuff($controllerResponse, $action);
     }
 }
示例#2
0
 public function actionPopup()
 {
     if (method_exists('XFCP_Dark_TaigaChat_ControllerPublic_Index', 'actionPopup')) {
         $response = parent::actionPopup();
         if ($response instanceof XenForo_ControllerResponse_View) {
             Dark_TaigaChat_Helper_Global::getTaigaChatStuff($response, 'popup', $this);
         }
         return $response;
     }
 }
示例#3
0
 public static function TemplateCreate($templateName, array &$params, XenForo_Template_Abstract $template)
 {
     if ($templateName == 'dark_taigachat') {
         $response = new stdClass();
         $response->viewName = "";
         $response->params = array();
         Dark_TaigaChat_Helper_Global::getTaigaChatStuff($response, "");
         //Zend_Debug::dump($response->params);
         $params = array_merge_recursive($params, $response->params);
     }
 }
示例#4
0
 public function getModule(&$options)
 {
     if (!($addon = $this->getModelFromCache('XenForo_Model_AddOn')->getAddOnById('TaigaChat')) || empty($addon['active'])) {
         return "killModule";
     }
     $response = new XenForo_ControllerResponse_View();
     $response->viewName = 'derp';
     $response->params = array();
     Dark_TaigaChat_Helper_Global::getTaigaChatStuff($response, 'index');
     $response->params += array('xenporta' => true);
     return $response->params;
 }
示例#5
0
 public static function TemplateHook($hookName, &$content, array $hookParams, XenForo_Template_Abstract $template)
 {
     switch ($hookName) {
         case 'dark_taigachat':
         case 'dark_taigachat_alt':
             $params = $template->getParams();
             if ($hookName == 'dark_taigachat_alt') {
                 $params['taigachat']['alt'] = true;
             }
             $params['taigachat']['room'] = 1;
             if (isset($hookParams['room'])) {
                 $params['taigachat']['room'] = $hookParams['room'];
             }
             $content .= $template->create('dark_taigachat', $params)->render();
             break;
         case 'dark_taigachat_online_users':
             $params = $template->getParams();
             $content .= $template->create('dark_taigachat_widget_online', $params)->render();
             break;
         case 'dark_taigachat_fake':
             $params = $template->getParams();
             $content .= $template->create('dark_taigachat_fake', $params)->render();
             break;
         case 'dark_taigachat_full':
             $params = $template->getParams();
             $params['taigachat']['room'] = 1;
             if (isset($hookParams['room'])) {
                 $params['taigachat']['room'] = $hookParams['room'];
             }
             $visitor = XenForo_Visitor::getInstance();
             $sessionModel = XenForo_Model::create('Dark_TaigaChat_Model_Session');
             $taigamodel = XenForo_Model::create("Dark_TaigaChat_Model_TaigaChat");
             $taigamodel->updateActivity($visitor['user_id'], false);
             $onlineUsers = $sessionModel->getSessionActivityQuickList($visitor->toArray(), array('cutOff' => array('>', $sessionModel->getOnlineStatusTimeout())), $visitor['user_id'] ? $visitor->toArray() : null);
             $onlineUsersTaiga = array();
             if ($options->dark_taigachat_sidebar) {
                 $onlineUsersTaiga = $taigamodel->getActivityUserList($visitor->toArray());
             }
             $params += array('taigachat' => array('onlineUsers' => $onlineUsers, 'sidebar_enabled' => true, 'online' => $onlineUsersTaiga));
             $response = new stdClass();
             $response->viewName = "Dark_TaigaChat_ViewPublic_TaigaChat_Index";
             $response->params = array();
             Dark_TaigaChat_Helper_Global::getTaigaChatStuff($response, "");
             $params = array_merge_recursive($params, $response->params);
             $content .= $template->create('dark_taigachat_full', $params)->render();
             break;
     }
 }
示例#6
0
 public function actionPopup()
 {
     $visitor = XenForo_Visitor::getInstance();
     $options = XenForo_Application::get('options');
     $taigamodel = $this->_getTaigaChatModel();
     if (!$options->dark_taigachat_popupenabled) {
         throw $this->getErrorOrNoPermissionResponseException('');
     }
     $taigamodel->updateActivity($visitor['user_id']);
     $this->canonicalizeRequestUrl(XenForo_Link::buildPublicLink($options->dark_taigachat_route . '/popup'));
     $viewParams = array('request' => $this->_request);
     $response = new stdClass();
     $response->viewName = "";
     $response->params = array();
     Dark_TaigaChat_Helper_Global::getTaigaChatStuff($response, "popup");
     $viewParams['taigachat'] = $response->params['taigachat'];
     return $this->responseView('Dark_TaigaChat_ViewPublic_TaigaChat_Popup', 'dark_taigachat_popup', $viewParams);
 }