function wikiplugin_bigbluebutton($data, $params) { try { global $smarty, $prefs, $user; $bigbluebuttonlib = TikiLib::lib('bigbluebutton'); $meeting = $params['name']; // Meeting is more descriptive than name, but parameter name was already decided. $smarty->assign('bbb_meeting', $meeting); $smarty->assign('bbb_image', parse_url($prefs['bigbluebutton_server_location'], PHP_URL_SCHEME) . '://' . parse_url($prefs['bigbluebutton_server_location'], PHP_URL_HOST) . '/images/bbb_logo.png'); $perms = Perms::get('bigbluebutton', $meeting); $params = array_merge(array('prefix' => ''), $params); // This is incomplete, will only apply if the dynamic feature is enabled. To be completed. $params['configuration'] = array('presentation' => array('active' => false)); $smarty->assign('bbb_params', Tiki_Security::get()->encode($params)); if (!$bigbluebuttonlib->roomExists($meeting)) { if (!isset($_POST['bbb']) || $_POST['bbb'] != $meeting || !$perms->bigbluebutton_create) { $smarty->assign('bbb_recordings', $bigbluebuttonlib->getRecordings($meeting)); return $smarty->fetch('wiki-plugins/wikiplugin_bigbluebutton_create.tpl'); } } if ($perms->bigbluebutton_join) { $smarty->assign('bbb_attendees', $bigbluebuttonlib->getAttendees($meeting)); if ($perms->bigbluebutton_view_rec) { $smarty->assign('bbb_recordings', $bigbluebuttonlib->getRecordings($meeting)); } return $smarty->fetch('wiki-plugins/wikiplugin_bigbluebutton.tpl'); } elseif ($perms->bigbluebutton_view_rec) { # Case for anonymous users with the perm to view recordings but not to join meetings $smarty->assign('bbb_recordings', $bigbluebuttonlib->getRecordings($meeting)); return $smarty->fetch('wiki-plugins/wikiplugin_bigbluebutton_view_recordings.tpl'); } } catch (Exception $e) { return WikiParser_PluginOutput::internalError(tr('BigBlueButton misconfigured or unaccessible.')); } }
function wikiplugin_bigbluebutton($data, $params) { try { global $prefs, $user; $bigbluebuttonlib = TikiLib::lib('bigbluebutton'); $meeting = $params['name']; // Meeting is more descriptive than name, but parameter name was already decided. $smarty = TikiLib::lib('smarty'); $smarty->assign('bbb_meeting', $meeting); $perms = Perms::get('bigbluebutton', $meeting); $params = array_merge(array('prefix' => '', 'recording' => 0), $params); // This is incomplete, will only apply if the dynamic feature is enabled. To be completed. $params['configuration'] = array('presentation' => array('active' => false)); $smarty->assign('bbb_params', Tiki_Security::get()->encode($params)); if (!$bigbluebuttonlib->roomExists($meeting)) { if (!isset($_POST['bbb']) || $_POST['bbb'] != $meeting || !$perms->bigbluebutton_create) { if ($perms->bigbluebutton_view_rec && $params['showrecording'] != 'n') { $smarty->assign('bbb_recordings', $bigbluebuttonlib->getRecordings($meeting)); } else { $smarty->assign('bbb_recordings', null); } return $smarty->fetch('wiki-plugins/wikiplugin_bigbluebutton_create.tpl'); } } if ($perms->bigbluebutton_view_rec) { $smarty->assign('bbb_recordings', $bigbluebuttonlib->getRecordings($meeting)); } else { $smarty->assign('bbb_recordings', null); } if ($perms->bigbluebutton_join) { if ($params['showattendees'] != 'n') { $smarty->assign('bbb_attendees', $bigbluebuttonlib->getAttendees($meeting)); $smarty->assign('bbb_show_attendees', true); } else { $smarty->assign('bbb_show_attendees', false); } return $smarty->fetch('wiki-plugins/wikiplugin_bigbluebutton.tpl'); } // Won't display anything if recordings were not loaded return $smarty->fetch('wiki-plugins/wikiplugin_bigbluebutton_view_recordings.tpl'); } catch (Exception $e) { return WikiParser_PluginOutput::internalError(tr('BigBlueButton is misconfigured or inaccessible.')); } }
function createAction(Account $account, Message $message) { if (preg_match($this->pattern, $message->getRecipient(), $parts) && isset($parts['DATA'])) { $info = \Tiki_Security::get()->decode($parts['DATA']); // Not a signed value if (!$info) { return null; } $action = $info['a']; // Real user part of the signature, no need to rely on the email // address. if (isset($info['u'])) { $message->setAssociatedUser($info['u']); } if (isset($this->actionMap[$action])) { $class = $this->actionMap[$action]; return new $class(['type' => $info['t'], 'object' => $info['o']]); } } }
function action_join($input) { if (!($params = Tiki_Security::get()->decode($input->params->none()))) { throw new Services_Exception_Denied(); } $meetingName = $params['name']; $bigbluebuttonlib = TikiLib::lib('bigbluebutton'); $perms = Perms::get('bigbluebutton', $meetingName); if (!$bigbluebuttonlib->roomExists($meetingName)) { if (!$perms->bigbluebutton_create) { throw new Services_Exception_NotFound(); } } if (!$perms->bigbluebutton_join) { throw new Services_Exception_Denied(); } global $user; if (!$user && $input->bbb_name->text()) { $_SESSION['bbb_name'] = $params['prefix'] . $input->bbb_name->text(); } $configuration = null; if (!empty($params['configuration'])) { $configuration = $params['configuration']; unset($params['configuration']); } // Attempt to create room made before joining as the BBB server has no persistency. // Prior check ensures that the user has appropriate rights to create the room in the // first place or that the room was already officially created and this is only a // re-create if the BBB server restarted. // // This avoids the issue occuring when tiki cache thinks the room exist and it's gone // on the other hand. It does not solve the issue if the room is lost on the BBB server // and tiki cache gets flushed. To cover that one, create can be granted to everyone for // the specific object. $bigbluebuttonlib->createRoom($meetingName, $params); $token = null; if ($configuration) { $token = $bigbluebuttonlib->configureRoom($meetingName, $configuration); } $bigbluebuttonlib->joinMeeting($meetingName, $token); }
function action_render(JitFilter $request) { $encoded = $request->stream->none(); $page = $request->page->int() ?: 1; if (!($baseQuery = Tiki_Security::get()->decode($encoded))) { throw new Services_Exception_Denied('Invalid request performed.'); } $query = new Search_Query(); $this->lib->initQuery($query); $query->filterType('activity'); $matches = WikiParser_PluginMatcher::match($baseQuery['body']); $builder = new Search_Query_WikiBuilder($query); $builder->enableAggregate(); $builder->apply($matches); if ($builder->isNextPossible()) { $query->setPage($page); } $query->setOrder('modification_date_desc'); if (!($index = $this->lib->getIndex())) { throw new Services_Exception_NotAvailable(tr('Activity stream currently unavailable.')); } $result = $query->search($index); $paginationArguments = $builder->getPaginationArguments(); $resultBuilder = new Search_ResultSet_WikiBuilder($result); $resultBuilder->setPaginationArguments($paginationArguments); $resultBuilder->apply($matches); try { $plugin = new Search_Formatter_Plugin_SmartyTemplate('templates/activity/activitystream.tpl'); $plugin->setFields(array('like_list' => true, 'user_groups' => true, 'contributors' => true)); $formatter = new Search_Formatter($plugin); $formatter->setDataSource($this->lib->getDataSource()); $out = $formatter->format($result); } catch (SmartyException $e) { throw new Services_Exception_NotAvailable($e->getMessage()); } return array('autoScroll' => $request->autoscroll->int(), 'pageNumber' => $page, 'nextPossible' => $builder->isNextPossible(), 'stream' => $encoded, 'body' => TikiLib::lib('parser')->parse_data($out, array('is_html' => true))); }
function wikiplugin_activitystream($data, $params) { $encoded = Tiki_Security::get()->encode(array('body' => $data)); $servicelib = TikiLib::lib('service'); return $servicelib->render('activitystream', 'render', array('autoscroll' => isset($params['auto']) && $params['auto'], 'stream' => $encoded)); }
private function send($email, $title, $html, $args = []) { global $prefs; require_once 'lib/webmail/tikimaillib.php'; $mail = new TikiMail(); $mail->setSubject($title); $mail->setHtml($html); if (!empty($prefs['monitor_reply_email_pattern']) && isset($args['reply_action'], $args['type'], $args['object'])) { $data = Tiki_Security::get()->encode(['u' => $GLOBALS['user'], 'a' => $args['reply_action'], 't' => $args['type'], 'o' => $args['object']]); $reply = str_replace('PLACEHOLDER', $data, $prefs['monitor_reply_email_pattern']); $name = tr("%0 Reply Handler", $prefs['sitetitle']); $mail->setReplyTo($reply, $name); } $mail->send($email); }