public static function getJabbexInstance() { if (!self::$_jabbex_instance) { try { require_once "jabbex_api/Jabbex.php"; self::$_jabbex_instance = new Jabbex(session_hash()); } catch (Exception $e) { $GLOBALS['Response']->addFeedback('error', 'Jabbex require_once error:' . $e->getMessage()); return null; } } return self::$_jabbex_instance; }
/** * Returns an instance of jabdex * @return Jabbex object class for im processing */ function _get_im_object() { return JabbexFactory::getJabbexInstance(); }
/** * Display chat room of project $group_id */ function chat_room() { $request = HTTPRequest::instance(); $group_id = $request->get('group_id'); $pm = ProjectManager::instance(); $project = $pm->getProject($group_id); $um = UserManager::instance(); $user = $um->getCurrentUser(); $plugin = $this->getControler()->getPlugin(); $plugin_path = $plugin->getPluginPath(); $im_object = JabbexFactory::getJabbexInstance(); $jabberConf = $im_object->get_server_conf(); $sessionId = session_hash(); $server_dns = $jabberConf['server_dns']; $conference_service = $jabberConf['conference_service']; $room_name = $project->getUnixName(); $user_unix_name = $user->getName(); echo '<div id="chatroom">'; echo '<h2 id="mucroom_title">' . $GLOBALS['Language']->getText('plugin_im', 'chatroom_title') . '</h2>'; echo '<p id="mucroom_summary">' . $GLOBALS['Language']->getText('plugin_im', 'chatroom_summary') . '</p>'; $user_projects = $user->getProjects(); if (in_array($group_id, $user_projects)) { echo '<div id="mucroom_timer">'; echo $GLOBALS['Language']->getText('plugin_im', 'wait_loading'); echo $GLOBALS['HTML']->getImage('ic/spinner.gif'); echo '</div>'; $url = $plugin_path . '/webmuc/muckl.php?username='******'&sessid=' . $sessionId . '&host=' . $server_dns . '&cs=' . $conference_service . '&room=' . $room_name . '&group_id=' . $group_id; echo '<iframe id="mucroom" src="' . $url . '" width="800" height="600" frameborder="0"></iframe>'; echo '<script type="text/javascript" src="mucroom.js"></script>'; echo '</div>'; } else { echo '<p class="feedback_error">' . $GLOBALS['Language']->getText('plugin_im', 'chatroom_onlymembers') . '</p>'; } }