示例#1
0
文件: Blog.php 项目: Trim/movim
 function display()
 {
     /*if(!$this->get('f')) {
           return;
       }*/
     if ($this->_view == 'grouppublic') {
         $from = $this->get('s');
         $node = $this->get('n');
         $this->view->assign('mode', 'group');
         $this->view->assign('server', $from);
         $this->view->assign('node', $node);
         $pd = new \Modl\ItemDAO();
         $this->view->assign('item', $pd->getItem($from, $node));
     } else {
         $from = $this->get('f');
         $cd = new \modl\ContactDAO();
         $c = $cd->get($from, true);
         $this->view->assign('contact', $c);
         if (filter_var($from, FILTER_VALIDATE_EMAIL)) {
             $node = 'urn:xmpp:microblog:0';
         } else {
             return;
         }
         $this->view->assign('mode', 'blog');
     }
     $pd = new \modl\PostnDAO();
     if ($id = $this->get('i')) {
         $messages = $pd->getPublicItem($from, $node, $id, 10, 0);
     } else {
         $messages = $pd->getPublic($from, $node, 10, 0);
     }
     $this->view->assign('posts', $messages);
 }
示例#2
0
 function ajaxCreate($server, $node, $id = false)
 {
     if (!$this->validateServerNode($server, $node)) {
         return;
     }
     $post = false;
     if ($id) {
         $pd = new \modl\PostnDAO();
         $p = $pd->getItem($id);
         if ($p->isEditable()) {
             $post = $p;
         }
     }
     $view = $this->tpl();
     $view->assign('to', $server);
     $view->assign('node', $node);
     $view->assign('item', $post);
     RPC::call('MovimTpl.fill', 'main section > div:nth-child(2)', $view->draw('_publish_create', true));
     $pd = new \Modl\ItemDAO();
     $item = $pd->getItem($server, $node);
     $view = $this->tpl();
     $view->assign('server', $server);
     $view->assign('node', $node);
     $view->assign('post', $post);
     $view->assign('item', $item);
     Header::fill($view->draw('_publish_header', true));
     if ($id) {
         RPC::call('Publish.initEdit');
     }
     RPC::call('Publish.setEmbed');
 }
示例#3
0
文件: Items.php 项目: movim/moxl
 public function handle($stanza, $parent = false)
 {
     $nd = new \Modl\ItemDAO();
     $jid = null;
     foreach ($stanza->query->item as $item) {
         $n = $nd->getItem($this->_to, (string) $item->attributes()->node);
         if (!$n) {
             $n = new \modl\Item();
         }
         $n->set($item, $this->_to);
         if (substr($n->node, 0, 29) != 'urn:xmpp:microblog:0:comments') {
             $nd->set($n, true);
         }
         if ($jid != $n->jid) {
             if (isset($n->node)) {
                 $r = new Request();
                 $r->setTo($n->jid)->setNode($n->node)->request();
             }
             $r = new Request();
             $r->setTo($n->jid)->request();
         }
         $jid = $n->jid;
     }
     $this->pack($this->_to);
     $this->deliver();
 }
示例#4
0
文件: Groups.php 项目: Anon215/movim
 function ajaxHeader()
 {
     $id = new \Modl\ItemDAO();
     $view = $this->tpl();
     $view->assign('servers', $id->getGroupServers());
     $header = $view->draw('_groups_header', true);
     Header::fill($header);
 }
示例#5
0
文件: Upload.php 项目: Anon215/movim
 function ajaxSend($file)
 {
     $id = new \Modl\ItemDAO();
     $u = $id->getUpload($this->user->getServer());
     if (isset($u)) {
         $r = new Request();
         $r->setTo($u->node)->setName($file->name)->setSize($file->size)->setType($file->type)->request();
     }
 }
示例#6
0
文件: Blog.php 项目: vijo/movim
 function load()
 {
     if ($this->_view == 'node') {
         $this->_from = $this->get('s');
         $this->_node = $this->get('n');
         if (!$this->validateServerNode($this->_from, $this->_node)) {
             return;
         }
         $pd = new \Modl\ItemDAO();
         $this->_item = $pd->getItem($this->_from, $this->_node);
         $this->_mode = 'group';
         $this->url = Route::urlize('node', array($this->_from, $this->_node));
     } else {
         $this->_from = $this->get('f');
         $cd = new \modl\ContactDAO();
         $this->_contact = $cd->get($this->_from, true);
         if (filter_var($this->_from, FILTER_VALIDATE_EMAIL)) {
             $this->_node = 'urn:xmpp:microblog:0';
         } else {
             return;
         }
         $this->_mode = 'blog';
         $this->url = Route::urlize('blog', $this->_from);
     }
     $pd = new \modl\PostnDAO();
     if ($this->_id = $this->get('i')) {
         if (Validator::int()->between(0, 100)->validate($this->_id)) {
             $this->_messages = $pd->getNodeUnfiltered($this->_from, $this->_node, $this->_id * $this->_paging, $this->_paging + 1);
             $this->_page = $this->_id + 1;
         } elseif (Validator::string()->length(5, 100)->validate($this->_id)) {
             $this->_messages = $pd->getPublicItem($this->_from, $this->_node, $this->_id);
             if (is_object($this->_messages[0])) {
                 $this->title = $this->_messages[0]->title;
                 $description = stripTags($this->_messages[0]->contentcleaned);
                 if (!empty($description)) {
                     $this->description = $description;
                 }
                 $attachements = $this->_messages[0]->getAttachements();
                 if ($attachements && array_key_exists('pictures', $attachements)) {
                     $this->image = urldecode($attachements['pictures'][0]['href']);
                 }
             }
             if ($this->_view == 'node') {
                 $this->url = Route::urlize('node', array($this->_from, $this->_node, $this->_id));
             } else {
                 $this->url = Route::urlize('blog', array($this->_from, $this->_id));
             }
         }
     } else {
         $this->_page = 1;
         $this->_messages = $pd->getNodeUnfiltered($this->_from, $this->_node, 0, $this->_paging + 1);
     }
     if (count($this->_messages) == $this->_paging + 1) {
         array_pop($this->_messages);
     }
 }
示例#7
0
文件: Rooms.php 项目: Anon215/movim
 /**
  * @brief Display the add room form
  */
 function ajaxAdd()
 {
     $view = $this->tpl();
     $id = new \Modl\ItemDAO();
     $item = $id->getConference($this->user->getServer());
     if ($item) {
         $view->assign('server', $item->jid);
     }
     $view->assign('username', $this->user->getUser());
     Dialog::fill($view->draw('_rooms_add', true));
 }
示例#8
0
文件: Delete.php 项目: Hywan/moxl
 public function error($stanza, $parent = false)
 {
     //delete from bookmark
     $sd = new \Modl\SubscriptionDAO();
     $sd->deleteNode($this->_to, $this->_node);
     //delete from item
     $id = new \Modl\ItemDAO();
     $id->deleteItem($this->_to, $this->_node);
     $this->pack(array('server' => $this->_to, 'node' => $this->_node));
     $this->deliver();
 }
示例#9
0
文件: Publish.php 项目: Anon215/movim
 function ajaxCreate($server, $node, $id = false, $reply = false)
 {
     if (!$this->validateServerNode($server, $node)) {
         return;
     }
     $post = false;
     $view = $this->tpl();
     if ($id) {
         $pd = new \modl\PostnDAO();
         $p = $pd->get($server, $node, $id);
         if ($p->isEditable() && !$reply) {
             $post = $p;
         }
         if ($p->isReply()) {
             $reply = $p->getReply();
         } elseif ($reply) {
             $reply = $p;
         }
     }
     if ($reply) {
         $view->assign('to', $this->user->getLogin());
         $view->assign('node', 'urn:xmpp:microblog:0');
         $view->assign('item', $post);
         $view->assign('reply', $reply);
     } else {
         $view->assign('to', $server);
         $view->assign('node', $node);
         $view->assign('item', $post);
         $view->assign('reply', false);
     }
     if ($node == 'urn:xmpp:microblog:0') {
         RPC::call('MovimUtils.pushState', $this->route('news'));
     } else {
         RPC::call('MovimUtils.removeClass', '#group_widget', 'fixed');
     }
     if ($reply) {
         Drawer::fill('<section>' . $view->draw('_publish_create', true) . '</section>');
     } else {
         RPC::call('MovimTpl.fill', 'main section > div:nth-child(2)', $view->draw('_publish_create', true));
     }
     $pd = new \Modl\ItemDAO();
     $item = $pd->getItem($server, $node);
     $view = $this->tpl();
     $view->assign('server', $server);
     $view->assign('node', $node);
     $view->assign('post', $post);
     $view->assign('item', $item);
     //Header::fill($view->draw('_publish_header', true));
     if ($id) {
         RPC::call('Publish.initEdit');
     }
     RPC::call('Publish.setEmbed');
 }
示例#10
0
文件: Publish.php 项目: Trim/movim
 function ajaxCreate($server, $node)
 {
     if (!$this->validateServerNode($server, $node)) {
         return;
     }
     $view = $this->tpl();
     $view->assign('to', $server);
     $view->assign('node', $node);
     RPC::call('MovimTpl.fill', 'main section > div:nth-child(2)', $view->draw('_publish_create', true));
     $pd = new \Modl\ItemDAO();
     $item = $pd->getItem($server, $node);
     $view = $this->tpl();
     $view->assign('item', $item);
     $view->assign('server', $server);
     $view->assign('node', $node);
     Header::fill($view->draw('_publish_header', true));
     RPC::call('Publish.setEmbed');
 }
示例#11
0
文件: Group.php 项目: vijo/movim
 private function prepareHeader($server, $node)
 {
     $pd = new \Modl\ItemDAO();
     $item = $pd->getItem($server, $node);
     $pd = new \Modl\SubscriptionDAO();
     $subscription = $pd->get($server, $node);
     $view = $this->tpl();
     $view->assign('item', $item);
     $view->assign('subscription', $subscription);
     $view->assign('role', $this->_role);
     return $view->draw('_group_header', true);
 }
示例#12
0
文件: User.php 项目: sugaryog/movim
 function isSupported($key)
 {
     $this->reload();
     if ($this->caps != null) {
         switch ($key) {
             case 'pubsub':
                 return in_array('http://jabber.org/protocol/pubsub#publish', $this->caps);
                 break;
             case 'upload':
                 $id = new \Modl\ItemDAO();
                 return $id->getUpload($this->getServer()) != null;
                 break;
             default:
                 return false;
                 break;
         }
     } elseif ($key == 'anonymous') {
         $session = \Sessionx::start();
         return $session->mechanism == 'ANONYMOUS';
     } else {
         return false;
     }
 }
示例#13
0
文件: Account.php 项目: Trim/movim
 function display()
 {
     $id = new \Modl\ItemDAO();
     $this->view->assign('gateway', $id->getGateways($this->user->getServer()));
 }
示例#14
0
 function display()
 {
     ob_clean();
     $pd = new \modl\PostnDAO();
     $cd = new \modl\ContactDAO();
     $id = new \Modl\ItemDAO();
     if (!$this->get('s')) {
         return;
     }
     $from = $this->get('s');
     $item = $contact = null;
     if (filter_var($from, FILTER_VALIDATE_EMAIL)) {
         $node = 'urn:xmpp:microblog:0';
         $contact = $cd->get($from);
     } elseif (!$this->get('n')) {
         return;
     } else {
         $node = $this->get('n');
         $item = $id->getItem($from, $node);
     }
     $messages = $pd->getPublic($from, $node, 0, 20);
     header("Content-Type: application/atom+xml; charset=UTF-8");
     $dom = new \DOMDocument('1.0', 'UTF-8');
     $dom->formatOutput = true;
     $feed = $dom->createElementNS('http://www.w3.org/2005/Atom', 'feed');
     $dom->appendChild($feed);
     $feed->appendChild($dom->createElement('updated', date('c')));
     $feed->appendChild($self = $dom->createElement('link'));
     $self->setAttribute('rel', 'self');
     if ($contact != null) {
         $feed->appendChild($dom->createElement('title', __('feed.title', $contact->getTrueName())));
         $feed->appendChild($author = $dom->createElement('author'));
         $author->appendChild($dom->createElement('name', $contact->getTrueName()));
         $author->appendChild($dom->createElement('uri', Route::urlize('blog', [$from])));
         $feed->appendChild($dom->createElement('logo', $contact->getPhoto('l')));
         $self->setAttribute('href', Route::urlize('feed', [$from]));
     }
     if ($item != null) {
         if ($item->name) {
             $feed->appendChild($dom->createElement('title', $item->name));
         } else {
             $feed->appendChild($dom->createElement('title', $item->node));
         }
         if ($item->description) {
             $feed->appendChild($dom->createElement('subtitle', $item->description));
         } else {
             $feed->appendChild($dom->createElement('subtitle', $item->server));
         }
         $self->setAttribute('href', Route::urlize('feed', [$from, $node]));
     }
     $feed->appendChild($generator = $dom->createElement('generator', 'Movim'));
     $generator->setAttribute('uri', 'https://movim.eu');
     $generator->setAttribute('version', APP_VERSION);
     foreach ($messages as $message) {
         $feed->appendChild($entry = $dom->createElement('entry'));
         if ($message->title) {
             $entry->appendChild($dom->createElement('title', $message->title));
         } else {
             $entry->appendChild($dom->createElement('title', __('post.default_title')));
         }
         $entry->appendChild($dom->createElement('id', $message->getUUID()));
         $entry->appendChild($dom->createElement('updated', date('c', strtotime($message->updated))));
         $entry->appendChild($content = $dom->createElement('content'));
         $content->appendChild($div = $dom->createElementNS('http://www.w3.org/1999/xhtml', 'div'));
         $content->setAttribute('type', 'xhtml');
         $f = $dom->createDocumentFragment();
         $f->appendXML($message->contentcleaned);
         $div->appendChild($f);
         $attachments = $message->getAttachments();
         if (isset($attachments['pictures'])) {
             foreach ($attachments['pictures'] as $value) {
                 $entry->appendChild($link = $dom->createElement('link'));
                 $link->setAttribute('rel', 'enclosure');
                 $link->setAttribute('type', $value['type']);
                 $link->setAttribute('href', $value['href']);
             }
         }
         if (isset($attachments['files'])) {
             foreach ($attachments['files'] as $value) {
                 $entry->appendChild($link = $dom->createElement('link'));
                 $link->setAttribute('rel', 'enclosure');
                 $link->setAttribute('type', $value['type']);
                 $link->setAttribute('href', $value['href']);
             }
         }
         if (isset($attachments['links'])) {
             foreach ($attachments['links'] as $value) {
                 $entry->appendChild($link = $dom->createElement('link'));
                 $link->setAttribute('rel', 'alternate');
                 $link->setAttribute('href', $value['href']);
             }
         }
         $entry->appendChild($link = $dom->createElement('link'));
         $link->setAttribute('rel', 'alternate');
         $link->setAttribute('type', 'text/html');
         $link->setAttribute('href', $message->getPublicUrl());
     }
     echo $dom->saveXML();
     exit;
 }
示例#15
0
文件: Blog.php 项目: Anon215/movim
 function load()
 {
     if ($this->_view == 'node') {
         $this->_from = $this->get('s');
         $this->_node = $this->get('n');
         if (!$this->validateServerNode($this->_from, $this->_node)) {
             return;
         }
         $pd = new \Modl\ItemDAO();
         $this->_item = $pd->getItem($this->_from, $this->_node);
         $this->_mode = 'group';
         $this->url = Route::urlize('node', array($this->_from, $this->_node));
     } elseif ($this->_view == 'tag' && $this->validateTag($this->get('t'))) {
         $this->_mode = 'tag';
         $this->_tag = $this->get('t');
         $this->title = '#' . $this->_tag;
     } else {
         $this->_from = $this->get('f');
         $cd = new \modl\ContactDAO();
         $this->_contact = $cd->get($this->_from, true);
         if (filter_var($this->_from, FILTER_VALIDATE_EMAIL)) {
             $this->_node = 'urn:xmpp:microblog:0';
         } else {
             return;
         }
         $this->_mode = 'blog';
         $this->url = Route::urlize('blog', $this->_from);
     }
     $pd = new \modl\PostnDAO();
     if ($this->_id = $this->get('i')) {
         if (Validator::stringType()->between('1', '100')->validate($this->_id)) {
             if (isset($this->_tag)) {
                 $this->_messages = $pd->getPublicTag($this->get('t'), $this->_id * $this->_paging, $this->_paging + 1);
             } else {
                 $this->_messages = $pd->getNodeUnfiltered($this->_from, $this->_node, $this->_id * $this->_paging, $this->_paging + 1);
             }
             $this->_page = $this->_id + 1;
         } elseif (Validator::stringType()->length(5, 100)->validate($this->_id)) {
             $this->_messages[0] = $pd->getPublicItem($this->_from, $this->_node, $this->_id);
             if (is_object($this->_messages[0])) {
                 $this->title = $this->_messages[0]->title;
                 $description = stripTags($this->_messages[0]->contentcleaned);
                 if (!empty($description)) {
                     $this->description = truncate($description, 100);
                 }
                 $attachments = $this->_messages[0]->getAttachments();
                 if ($attachments && array_key_exists('pictures', $attachments)) {
                     $this->image = urldecode($attachments['pictures'][0]['href']);
                 }
             }
             if ($this->_view == 'node') {
                 $this->url = Route::urlize('node', array($this->_from, $this->_node, $this->_id));
             } else {
                 $this->url = Route::urlize('blog', array($this->_from, $this->_id));
             }
         }
     } else {
         $this->_page = 1;
         if (isset($this->_tag)) {
             $this->_messages = $pd->getPublicTag($this->get('t'), 0, $this->_paging + 1);
         } else {
             $this->_messages = $pd->getNodeUnfiltered($this->_from, $this->_node, 0, $this->_paging + 1);
         }
     }
     if (count($this->_messages) == $this->_paging + 1) {
         array_pop($this->_messages);
     }
     if ($this->_node == 'urn:xmpp:microblog:0') {
         $this->user = new User($this->_from);
         $cssurl = $this->user->getDumpedConfig('cssurl');
         if (isset($cssurl) && $cssurl != '' && Validator::url()->validate($cssurl)) {
             $this->addrawcss($cssurl);
         }
     }
 }