function prepareProfileData() { $submit = $this->call('ajaxLocationPublish', "getMyPositionData()"); $cd = new \Modl\ContactDAO(); $c = $cd->get($this->user->getLogin()); if ($c->loctimestamp) { $data = prepareDate(strtotime($c->loctimestamp)) . '<br /><br />'; $data .= $c->getPlace(); } else { $data = ''; } $html = ''; $html .= ' <div id="location"> <div id="mapdata" style="margin: 1em 0;">' . $data . '</div> <div id="mapdiv" style="width: auto; height: 250px; display: none;"></div> <div class="clear"></div> <a class="button color green" style="margin-top: 1em;" onclick="getMyPosition(); this.style.display = \'none\';"> <i class="fa fa-compass"></i> ' . $this->__('location.update') . ' </a> <a id="mypossubmit" style="display: none; margin-top: 1em; float: right;" class="button color green merged left" onclick="' . $submit . ' hidePositionChoice();"> <i class="fa fa-check"></i> ' . $this->__('button.accept') . '</a> </div>'; return $html; }
/** * @brief Display the add room form */ function ajaxAdd() { $view = $this->tpl(); $cd = new \Modl\ContactDAO(); $view->assign('me', $cd->get()); Dialog::fill($view->draw('_rooms_add', true)); }
function onPost($packet) { $pd = new \Modl\PostnDAO(); $since = Cache::c('since'); $count = $pd->getCountSince($since); $post = $packet->content; if ($count > 0 && strtotime($post->published) > strtotime($since)) { if ($post->isMicroblog()) { $cd = new \Modl\ContactDAO(); $contact = $cd->get($post->origin); if ($post->title == null) { $title = __('post.default_title'); } else { $title = $post->title; } if (!$post->isMine()) { Notification::append('news', $contact->getTrueName(), $title, $contact->getPhoto('s'), 2, $this->route('news', $post->nodeid)); } } else { $logo = $post->logo ? $post->getLogo() : null; Notification::append('news', $post->title, $post->node, $logo, 2, $this->route('news', $post->nodeid)); } $this->onStream($count); } }
public function handle($stanza, $parent = false) { $jid = current(explode('/', (string) $parent->attributes()->from)); $cd = new \Modl\ContactDAO(); $c = $cd->get($jid); if ($c == null) { $c = new \Modl\Contact(); } $p = new Picture(); $p->fromBase((string) $stanza->items->item->data); $p->set($jid); $this->event('vcard', $c); }
public function handle($stanza, $parent = false) { $to = current(explode('/', (string) $parent->attributes()->to)); $from = current(explode('/', (string) $parent->attributes()->from)); if (isset($stanza->items->item->geoloc) && $stanza->items->item->geoloc->count() > 0) { $cd = new \Modl\ContactDAO(); $c = $cd->get($from); if ($c != null) { $c->setLocation($stanza); $cd->set($c); } } }
public function handle($stanza, $parent = false) { $jid = current(explode('/', (string) $parent->attributes()->from)); $cd = new \Modl\ContactDAO(); $c = $cd->get($jid); if ($c == null) { $c = new \Modl\Contact(); } $c->jid = $jid; $vcard = $stanza->items->item->vcard; $c->setVcard4($vcard); $c->createThumbnails(); $cd->set($c); $this->event('vcard', $c); }
public function handle($stanza, $parent = false) { $jid = current(explode('/', (string) $parent->attributes()->from)); $cd = new \Modl\ContactDAO(); $c = $cd->get($jid); if (isset($stanza->items->item->metadata->info)) { $info = $stanza->items->item->metadata->info->attributes(); if ($info->id != $c->avatarhash) { $c->avatarhash = $info->id; $cd->set($c); $g = new Get(); $g->setTo($jid)->request(); } } }
public function handle($stanza, $parent = false) { $to = current(explode('/', (string) $parent->attributes()->to)); $from = current(explode('/', (string) $parent->attributes()->from)); if ($stanza->items->item->nick) { $cd = new \Modl\ContactDAO(); $c = $cd->get($from); if ($c == null) { $c = new \Modl\Contact(); $c->jid = $from; } $c->nickname = (string) $stanza->items->item->nick; $cd->set($c); } }
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 prepareNotifs() { $cd = new \Modl\ContactDAO(); $contacts = $cd->getRosterFrom(); $invitations = array(); $notifs = \Cache::c('activenotifs'); if (is_array($notifs)) { foreach ($notifs as $key => $value) { array_push($invitations, $cd->get($key)); } } $nft = $this->tpl(); $nft->assign('invitations', $invitations); $nft->assign('contacts', $contacts); return $nft->draw('_notifs_from', true); }
public function handle($stanza, $parent = false) { $cd = new \Modl\ContactDAO(); $c = $cd->get($this->_to); if ($c == null) { $c = new \Modl\Contact(); } $c->jid = $this->_to; if ($vcard = $stanza->pubsub->items->item) { $vcard = $stanza->pubsub->items->item->vcard; $c->setVcard4($vcard); $c->createThumbnails(); $cd->set($c); $this->pack($c); $this->deliver(); } else { $this->error(false); } }
public function handle($stanza, $parent = false) { $from = current(explode('/', (string) $parent->attributes()->from)); if (isset($stanza->items->item->mood) && $stanza->items->item->mood->count() > 0) { $arrmood = array(); foreach ($stanza->items->item->mood->children() as $mood) { if ($mood->getName() != 'text') { array_push($arrmood, $mood->getName()); } } if (count($arrmood) > 0) { $cd = new \Modl\ContactDAO(); $c = $cd->get($from); if ($c != null) { $c->mood = serialize($arrmood); $cd->set($c); } } } }
public function handle($stanza, $parent = false) { if ($stanza->attributes()->from) { $jid = current(explode('/', (string) $stanza->attributes()->from)); } else { $jid = $this->_to; } if ($jid) { $evt = new Event(); $cd = new \Modl\ContactDAO(); $c = $cd->get($this->_to); if ($c == null) { $c = new \Modl\Contact(); } $c->set($stanza, $this->_to); $cd->set($c); $c->createThumbnails(); $this->pack($c); $this->deliver(); } }
function onPost($packet) { $pd = new \Modl\PostnDAO(); $count = $pd->getCountSince(Cache::c('since')); if ($count > 0) { $post = $packet->content; if ($post->isMicroblog()) { $cd = new \Modl\ContactDAO(); $contact = $cd->get($post->origin); if ($post->title == null) { $title = __('post.default_title'); } else { $title = $post->title; } if (!$post->isMine()) { Notification::append('news', $contact->getTrueName(), $title, $contact->getPhoto('s'), 2); } } else { Notification::append('news', $post->title, $post->node, null, 2); } $this->onStream($count); } }
public function handle($stanza, $parent = false) { $cd = new \Modl\ContactDAO(); $this->pack($cd->get()); $this->deliver(); }
function preparePost($p) { $view = $this->tpl(); if (isset($p)) { if (isset($p->commentplace)) { $this->ajaxGetComments($p->commentplace, $p->nodeid); } $view->assign('recycled', false); // Is it a recycled post ? if ($p->getContact()->jid && $p->node == 'urn:xmpp:microblog:0' && $p->origin != $p->getContact()->jid) { $cd = new \Modl\ContactDAO(); $view->assign('recycled', $cd->get($p->origin)); } $view->assign('post', $p); $view->assign('attachements', $p->getAttachements()); return $view->draw('_post', true); } else { return $this->prepareEmpty(); } }
function ajaxVcardSubmit($vcard) { # Format it ISO 8601: if ($vcard->year->value != -1 && $vcard->month->value != -1 && $vcard->day->value != -1) { $vcard->date->value = $vcard->year->value . '-' . $vcard->month->value . '-' . $vcard->day->value; } unset($vcard->year->value); unset($vcard->month->value); unset($vcard->day->value); $cd = new \Modl\ContactDAO(); $c = $cd->get($this->user->getLogin()); if ($c == null) { $c = new \Modl\Contact(); } $c->jid = $this->user->getLogin(); if (isset($vcard->date->value)) { $c->date = $vcard->date->value; } if (Validator::string()->length(0, 40)->validate($vcard->name->value)) { $c->name = $vcard->name->value; } if (Validator::string()->length(0, 40)->validate($vcard->fn->value)) { $c->fn = $vcard->fn->value; } if (Validator::url()->validate($vcard->url->value)) { $c->url = $vcard->url->value; } if (Validator::in(array_keys(getGender()))->validate($vcard->gender->value)) { $c->gender = $vcard->gender->value; } if (Validator::in(array_keys(getMarital()))->validate($vcard->marital->value)) { $c->marital = $vcard->marital->value; } $c->adrlocality = $vcard->locality->value; $c->adrcountry = $vcard->country->value; if (Validator::email()->validate($vcard->email->value)) { $c->email = $vcard->email->value; } $c->twitter = $vcard->twitter->value; $c->skype = $vcard->skype->value; $c->yahoo = $vcard->yahoo->value; if (Validator::string()->validate($vcard->desc->value)) { $c->description = trim($vcard->desc->value); } $cd = new \Modl\ContactDAO(); $cd->set($c); $r = new Set(); $r->setData($c)->request(); $r = new Moxl\Xec\Action\Vcard\Set(); $r->setData($vcard)->request(); }
function prepareMessages($jid, $muc = false) { if (!$this->validateJid($jid)) { return; } $md = new \Modl\MessageDAO(); if ($muc) { $messages = $md->getRoom(echapJid($jid)); } else { $messages = $md->getContact(echapJid($jid), 0, $this->_pagination); } if (is_array($messages)) { $messages = array_reverse($messages); /*foreach($messages as $message) { $this->_msgMap[$message->published.$message->jid] = $message; } foreach($this->_msgMap as $message) {*/ 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); RPC::call('Chat.appendMessagesWrapper', $this->_wrapper); RPC::call('MovimTpl.scrollPanel'); }
function prepareChat($jid, $status = null) { if (!$this->validateJid($jid)) { return; } $view = $this->tpl(); $cd = new \Modl\ContactDAO(); $md = new \modl\MessageDAO(); $cad = new \modl\CapsDAO(); $presencestxt = getPresencesTxt(); $cr = $cd->getRosterItem($jid); if (isset($cr)) { if ($cr->value != null) { $view->assign('presence', $presencestxt[$cr->value]); } $view->assign('contact', $cr); $view->assign('caps', $cad->get($cr->node . '#' . $cr->ver)); } else { $view->assign('contact', $cd->get($jid)); $view->assign('caps', null); } $view->assign('status', $status); $m = $md->getContact($jid, 0, 1); if (isset($m)) { $view->assign('message', $m[0]); } return $view->draw('_chats_item', true); }
function ajaxGetContact($jid) { $cd = new \Modl\ContactDAO(); $contact = $cd->get($jid); $contactview = $this->tpl(); $contactview->assign('contact', $contact); RPC::call('movim_fill', 'avatar', $contactview->draw('_visio_contact', true)); }
function prepareContact($jid) { if (!$this->validateJid($jid)) { return; } $cd = new \Modl\ContactDAO(); $c = $cd->get($jid, true); if ($c == null || $c->created == null || $c->isOld()) { if ($c == null) { $c = new \Modl\Contact(); $c->jid = $jid; } $this->ajaxRefreshVcard($jid); } $cr = $cd->getRosterItem($jid); $view = $this->tpl(); $pd = new \Modl\PostnDAO(); $gallery = $pd->getGallery($jid, 0, 12); $blog = $pd->getPublic($jid, 'urn:xmpp:microblog:0', 0, 4); $presencestxt = getPresencesTxt(); $view->assign('edit', $this->call('ajaxEditContact', "'" . echapJS($jid) . "'")); $view->assign('delete', $this->call('ajaxDeleteContact', "'" . echapJS($jid) . "'")); if (isset($c)) { $view->assign('mood', getMood()); $view->assign('contact', $c); $view->assign('contactr', $cr); if ($cr->node != null && $cr->ver != null && $cr->node && $cr->ver) { $node = $cr->node . '#' . $cr->ver; $cad = new \Modl\CapsDAO(); $caps = $cad->get($node); if ($cr->value != null) { $view->assign('presence', $presencestxt[$cr->value]); } if (isset($caps) && $caps->name != '' && $caps->type != '') { $clienttype = getClientTypes(); $view->assign('caps', $caps); $view->assign('clienttype', $clienttype); } } else { $view->assign('caps', null); } $view->assign('gallery', $gallery); $view->assign('blog', $blog); $view->assign('chat', $this->call('ajaxChat', "'" . echapJS($c->jid) . "'")); return $view->draw('_contact', true); } elseif (isset($cr)) { $view->assign('contact', null); $view->assign('contactr', $cr); $view->assign('chat', $this->call('ajaxChat', "'" . echapJS($cr->jid) . "'")); return $view->draw('_contact', true); } else { return $this->prepareEmpty(0, $jid); } }
function preparePresenceList() { $txt = getPresences(); $txts = getPresencesTxt(); $session = \Session::start(); $pd = new \Modl\PresenceDAO(); $p = $pd->getPresence($session->get('jid'), $session->get('resource')); $cd = new \Modl\ContactDAO(); $contact = $cd->get($session->get('jid')); if ($contact == null) { $contact = new \Modl\Contact(); } $presencetpl = $this->tpl(); $presencetpl->assign('contact', $contact); $presencetpl->assign('p', $p); $presencetpl->assign('txt', $txt); $presencetpl->assign('txts', $txts); $html = $presencetpl->draw('_presence_list', true); return $html; }
function ajaxGetRememberedSession($sessions) { $sessions = json_decode($sessions); $sessions_grabbed = array(); $cd = new \Modl\ContactDAO(); foreach ($sessions as $s) { $c = $cd->get($s); if ($c != null) { array_push($sessions_grabbed, $c); } else { $c = new \Modl\Contact(); $c->jid = $s; array_push($sessions_grabbed, $c); } } $sessionshtml = $this->tpl(); $sessionshtml->assign('sessions', $sessions_grabbed); $sessionshtml->assign('empty', new \Modl\Contact()); RPC::call('movim_fill', 'sessions', $sessionshtml->draw('_login_sessions', true)); RPC::call('Login.refresh'); }
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); }
function preparePost($p, $external = false, $public = false) { $view = $this->tpl(); if (isset($p)) { if (isset($p->commentorigin) && !$external) { $this->ajaxGetComments($p->commentorigin, $p->commentnodeid); // Broken in case of repost } $view->assign('repost', false); $view->assign('external', $external); $view->assign('public', $public); $view->assign('reply', $p->isReply() ? $p->getReply() : false); // Is it a repost ? if ($p->isRecycled()) { $cd = new \Modl\ContactDAO(); $view->assign('repost', $cd->get($p->origin)); } $view->assign('post', $p); $view->assign('attachments', $p->getAttachments()); return $view->draw('_post', true); } elseif (!$external) { return $this->prepareEmpty(); } }