function onLocationPublishError($error) { Notification::append(null, $error); RPC::call('movim_delete', 'mapdiv'); RPC::call('movim_delete', 'mapdata'); RPC::commit(); }
function ajaxShowPosition($pos) { list($lat, $lon) = explode(',', $pos); $pos = json_decode(file_get_contents('http://nominatim.openstreetmap.org/reverse?format=json&lat=' . $lat . '&lon=' . $lon . '&zoom=27&addressdetails=1')); RPC::call('movim_fill', 'postpublishlocation', (string) $pos->display_name); RPC::commit(); }
static function fill($html = '', $scroll = false) { RPC::call('movim_fill', 'dialog', $html); if ($scroll) { RPC::call('Dialog.addScroll'); } }
function onConfigured($package) { $node = $package->content; switch ($node) { case 'storage:bookmarks': $notif = $this->__('init.bookmark'); break; case 'urn:xmpp:vcard4': $notif = $this->__('init.vcard4'); break; case 'urn:xmpp:avatar:data': $notif = $this->__('init.avatar'); break; case 'http://jabber.org/protocol/geoloc': $notif = $this->__('init.location'); break; case 'urn:xmpp:pubsub:subscription': $notif = $this->__('init.subscriptions'); break; case 'urn:xmpp:microblog:0': $notif = $this->__('init.microblog'); break; } RPC::call('Init.setNode', $node); Notification::append(null, $notif); }
function ajaxAddChatroom() { $r = new Rooms(); $r->ajaxChatroomAdd(array('jid' => '*****@*****.**', 'name' => 'Movim Chatroom', 'nick' => false, 'autojoin' => 0)); $r->ajaxJoin('*****@*****.**'); RPC::call('MovimUtils.redirect', $this->route('chat')); }
function onMyAvatarError() { $cd = new \modl\ContactDAO(); $me = $cd->get(); $html = $this->prepareForm($me); RPC::call('movim_fill', 'avatar_form', $html); Notification::append(null, $this->__('avatar.not_updated')); }
function ajaxUnregister() { $cd = new \Modl\ConfigDAO(); $config = $cd->get(); $config->unregister = !$config->unregister; $cd->set($config); RPC::call('MovimUtils.reloadThis'); RPC::commit(); }
function onConfig($package) { $data = (array) $package->content; $this->user->setConfig($data); $html = $this->prepareConfigForm(); RPC::call('movim_fill', 'config_widget', $html); RPC::call('Config.load'); Notification::append(null, $this->__('config.updated')); }
function ajaxGet($type = 'all', $server = null, $node = null, $page = 0) { $html = $this->prepareList($type, $server, $node, $page); if ($page > 0) { RPC::call('movim_append', 'menu_wrapper', $html); } else { RPC::call('movim_fill', 'menu_widget', $html); RPC::call('movim_posts_unread', 0); } RPC::call('Menu.refresh'); }
function onNotifs($from = false) { $html = $this->prepareNotifs(); RPC::call('MovimTpl.fill', '#notifs_widget', $html); RPC::call('Notifs.refresh'); if (is_string($from)) { $cd = new \Modl\ContactDAO(); $contact = $cd->get($from); $avatar = $contact->getPhoto('s'); if ($avatar == false) { $avatar = null; } Notification::append('invite|' . $from, $contact->getTrueName(), $this->__('notifs.wants_to_talk', $contact->getTrueName()), $avatar, 4); } }
function onSessionInitiate($jingle) { $jts = new \JingletoSDP($jingle); $sdp = $jts->generate(); $cd = new \Modl\ContactDAO(); $contact = $cd->get(cleanJid((string) $jingle->attributes()->initiator)); if (!isset($contact)) { $contact = new Modl\Contact(); } if ($sdp) { RPC::call('movim_desktop_notification', $contact->getTrueName(), $this->__('visio.calling'), $contact->getPhoto('m')); RPC::call('remoteSetJid', (string) $jingle->attributes()->initiator); RPC::call('remoteCall', 'onOffer', $sdp); RPC::commit(); } }
function ajaxChangePassword($form) { $validate = Validator::string()->length(6, 40); $p1 = $form->password->value; $p2 = $form->password_confirmation->value; if ($validate->validate($p1) && $validate->validate($p2)) { if ($p1 == $p2) { $arr = explodeJid($this->user->getLogin()); $cp = new ChangePassword(); $cp->setTo($arr['server'])->setUsername($arr['username'])->setPassword($p1)->request(); } else { RPC::call('Account.resetPassword'); Notification::append(null, $this->__('account.password_not_same')); } } else { RPC::call('Account.resetPassword'); Notification::append(null, $this->__('account.password_not_valid')); } }
function onCommand($package) { $command = $package->content; $view = $this->tpl(); if (isset($command->note)) { $view->assign('note', $command->note); Dialog::fill($view->draw('_adhoc_note', true)); } if (isset($command->x)) { $xml = new \XMPPtoForm(); $form = $xml->getHTML($command->x->asXML()); $view->assign('form', $form); $view->assign('attributes', $command->attributes()); $view->assign('actions', null); if (isset($command->actions)) { $view->assign('actions', $command->actions); } Dialog::fill($view->draw('_adhoc_form', true), true); } RPC::call('AdHoc.initForm'); }
function ajaxDisplay() { $tmp = []; foreach (scandir(USERS_PATH) as $f) { if (is_dir(USERS_PATH . '/' . $f)) { $time = filemtime(USERS_PATH . '/' . $f . '/index.html'); if ($time) { array_push($tmp, $time); } } } sort($tmp); $days = []; $pattern = "M Y"; foreach ($tmp as $k => $time) { $key = date($pattern, $time); if (isset($days[$key])) { $days[$key]++; } else { $days[$key] = 1; } } $data = new stdClass(); $data->labels = []; $data->datasets = []; $first = new StdClass(); $first->label = "Monthly Subscriptions"; $first->fillColor = "rgba(255,152,0,0.5)"; $first->strokeColor = "rgba(255,152,0,0.8)"; $first->highlightFill = "rgba(220,220,220,0.75)"; $first->highlightStroke = "rgba(220,220,220,1)"; $values = []; foreach ($days as $key => $value) { array_push($data->labels, $key); array_push($values, $value); } $first->data = $values; array_push($data->datasets, $first); RPC::call('Statistics.drawGraphs', $data); }
function ajaxLogin($username) { $validate_user = Validator::string()->length(4, 40); if (!$validate_user->validate($username)) { Notification::append(null, $this->__('login_anonymous.bad_username')); return; } // We get the Server Configuration $cd = new \Modl\ConfigDAO(); $config = $cd->get(); $host = 'anonymous.jappix.com'; $password = '******'; // We try to get the domain $domain = \Moxl\Utils::getDomain($host); // We launch the XMPP socket RPC::call('register', $host); // We set the username in the session $s = Session::start(); $s->set('username', $username); // We create a new session or clear the old one $s = Sessionx::start(); $s->init($username, $password, $host, $domain); \Moxl\Stanza\Stream::init($host); }
function onGroupSubscribedList($list) { $html = $this->prepareList($list); RPC::call('movim_fill', 'groupsubscribedlistconfig', $html); }
function preparePresence() { $cd = new \Modl\ContactDAO(); $pd = new \Modl\PresenceDAO(); $session = \Session::start(); // If the user is still on a logued-in page after a daemon restart if ($session->get('jid') == false) { RPC::call('MovimUtils.disconnect'); return false; } $presence = $pd->getPresence($session->get('jid'), $session->get('resource')); $presencetpl = $this->tpl(); $contact = $cd->get(); if ($contact == null) { $contact = new \Modl\Contact(); } if ($presence == null) { $presence = new \Modl\Presence(); } $presencetpl->assign('me', $contact); $presencetpl->assign('presence', $presence); $presencetpl->assign('presencetxt', getPresencesTxt()); $presencetpl->assign('dialog', $this->call('ajaxOpenDialog')); $html = $presencetpl->draw('_presence', true); return $html; }
function ajaxGetForm() { $cd = new \modl\ContactDAO(); $me = $cd->get(); RPC::call('MovimTpl.fill', '#avatar_form', $this->prepareForm($me)); }
function ajaxEmbedTest($url) { if ($url == '') { return; } elseif (!filter_var($url, FILTER_VALIDATE_URL)) { Notification::append(false, $this->__('publish.valid_url')); return; } try { $embed = Embed\Embed::create($url); $html = $this->prepareEmbed($embed); RPC::call('movim_fill', 'preview', ''); RPC::call('movim_fill', 'gallery', ''); if (in_array($embed->type, array('photo', 'rich'))) { RPC::call('movim_fill', 'gallery', $this->prepareGallery($embed)); } if ($embed->type !== 'photo') { RPC::call('movim_fill', 'preview', $html); } } catch (Exception $e) { error_log($e->getMessage()); } }
function ajaxClear() { $html = $this->prepareEmpty(); RPC::call('movim_fill', 'group_widget', $html); }
function onGroupMemberList($list) { $html = $this->prepareList($list); RPC::call('movim_fill', 'memberlist', $html); RPC::commit(); }
function ajaxEmbedTest($url) { if ($url == '') { return; } elseif (!filter_var($url, FILTER_VALIDATE_URL)) { Notification::append(false, $this->__('publish.valid_url')); return; } $embed = Embed\Embed::create($url); $html = $this->prepareEmbed($embed); if ($embed->type == 'photo') { RPC::call('movim_fill', 'gallery', $this->prepareGallery($embed)); RPC::call('movim_fill', 'preview', ''); } else { RPC::call('movim_fill', 'preview', $html); RPC::call('movim_fill', 'gallery', ''); } }
function ajaxGetPost($id) { $pd = new \Modl\PostnDAO(); $p = $pd->getItem($id); $gi = new GetItem(); $gi->setTo($p->origin)->setNode($p->node)->setId($p->nodeid)->request(); $html = $this->preparePost($p); $header = $this->prepareHeader($id); Header::fill($header); RPC::call('movim_fill', 'post_widget', $html); }
function ajaxChat($jid) { $c = new Chats(); $c->ajaxOpen($jid); RPC::call('movim_redirect', $this->route('chat', $jid)); }
private function displayServer($server) { if (!$this->validateServer($server)) { return; } $html = $this->prepareServer($server); RPC::call('movim_fill', 'groups_widget', $html); RPC::call('Groups.refresh'); }
/** * @brief Confirm the room add */ function ajaxChatroomAdd($form) { if (!filter_var($form['jid'], FILTER_VALIDATE_EMAIL)) { Notification::append(null, $this->__('chatrooms.bad_id')); } elseif (trim($form['name']) == '') { Notification::append(null, $this->__('chatrooms.empty_name')); } else { $cd = new \Modl\ConferenceDAO(); $cd->deleteNode($form['jid']); $item = ['type' => 'conference', 'name' => $form['name'], 'autojoin' => $form['autojoin'], 'nick' => $form['nick'], 'jid' => $form['jid']]; $this->setBookmark($item); RPC::call('Dialog_ajaxClear'); } }
function prepareMessages($jid) { if (!$this->validateJid($jid)) { return; } $md = new \Modl\MessageDAO(); $messages = $md->getContact(echapJid($jid), 0, 30); if (is_array($messages)) { $messages = array_reverse($messages); foreach ($messages as $message) { $this->prepareMessage($message); } } $view = $this->tpl(); $view->assign('jid', $jid); $cd = new \Modl\ContactDAO(); $contact = $cd->get($jid); $me = $cd->get(); if ($me == null) { $me = new \Modl\Contact(); } $view->assign('contact', $contact); $view->assign('me', false); $left = $view->draw('_chat_bubble', true); $view->assign('contact', $me); $view->assign('me', true); $right = $view->draw('_chat_bubble', true); $room = $view->draw('_chat_bubble_room', true); RPC::call('Chat.setBubbles', $left, $right, $room); RPC::call('Chat.appendMessages', $messages); }
public function ajaxUpdateDatabase() { $md = \modl\Modl::getInstance(); $md->check(true); RPC::call('movim_reload_this'); }
function ajaxPublic($page = 0) { $validate_page = Validator::intType(); if (!$validate_page->validate($page)) { return; } RPC::call('MovimTpl.fill', '#public_list', $this->preparePublic($page)); }
/** * @brief Get all the keys * @return void */ function ajaxGet() { $session = Session::start(); $notifs = $session->get('notifs'); if ($notifs != null) { RPC::call('Notification.refresh', $notifs); } }