예제 #1
0
파일: GetItemsId.php 프로젝트: movim/moxl
 public function handle($stanza, $parent = false)
 {
     $evt = new Event();
     $pd = new \modl\PostnDAO();
     foreach (array_reverse($stanza->query->xpath('item')) as $item) {
         $id = (string) $item->attributes()->name;
         if (!$pd->exists($this->_to, $this->_node, $id)) {
             $gi = new GetItem();
             $gi->setTo($this->_to)->setNode($this->_node)->setId($id)->request();
         }
     }
     $this->pack(['server' => $this->_to, 'node' => $this->_node]);
     $this->deliver();
 }
예제 #2
0
파일: GetItemsId.php 프로젝트: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $evt = new \Event();
     $pd = new \modl\PostnDAO();
     $get = false;
     foreach ($stanza->query->item as $item) {
         $id = (string) $item->attributes()->name;
         if (!$pd->exist($id)) {
             $get = true;
             $gi = new GetItem();
             $gi->setTo($this->_to)->setNode($this->_node)->setId($id)->request();
         }
     }
     if ($get == false) {
         $this->pack(array('server' => $this->_to, 'node' => $this->_node));
         $this->deliver();
     }
 }
예제 #3
0
파일: Post.php 프로젝트: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $from = (string) $parent->attributes()->from;
     if ($stanza->items->item && isset($stanza->items->item->entry) && (string) $stanza->items->item->entry->attributes()->xmlns == 'http://www.w3.org/2005/Atom') {
         if ($parent->delay) {
             $delay = gmdate('Y-m-d H:i:s', strtotime((string) $parent->delay->attributes()->stamp));
         } else {
             $delay = false;
         }
         $p = new \modl\Postn();
         $p->set($stanza->items, $from, $delay);
         // We limit the very old posts (2 months old)
         if (strtotime($p->published) > mktime(0, 0, 0, gmdate("m") - 2, gmdate("d"), gmdate("Y")) && $p->nodeid != $this->testid) {
             $pd = new \modl\PostnDAO();
             $pd->set($p, $from);
             $this->pack($p);
             $this->deliver();
         }
     } elseif ($stanza->items->retract) {
         $pd = new \modl\PostnDAO();
         $pd->delete($stanza->items->retract->attributes()->id);
         $this->method('retract');
         $this->pack(array('server' => $from, 'node' => $stanza->attributes()->node));
         $this->deliver();
     } elseif (isset($stanza->items->item->realtime)) {
         $this->method('ticker');
         $this->pack(array('server' => $from, 'node' => $stanza->items->attributes()->node, 'ticker' => $stanza->items->item->realtime));
         $this->deliver();
     } elseif ($stanza->items->item && isset($stanza->items->item->attributes()->id) && !filter_var($from, FILTER_VALIDATE_EMAIL)) {
         // In this case we only get the header, so we request the full content
         $p = new \modl\PostnDAO();
         $id = (string) $stanza->items->item->attributes()->id;
         $here = $p->exist($id);
         if (!$here && $id != $this->testid) {
             $d = new GetItem();
             $d->setTo($from)->setNode((string) $stanza->items->attributes()->node)->setId($id)->request();
         }
     }
 }
예제 #4
0
파일: Post.php 프로젝트: vijo/movim
 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);
 }
예제 #5
0
파일: Post.php 프로젝트: Anon215/movim
 function ajaxGetPost($origin, $node, $id)
 {
     $pd = new \Modl\PostnDAO();
     $p = $pd->get($origin, $node, $id);
     if ($p) {
         $html = $this->preparePost($p);
         RPC::call('MovimUtils.pushState', $this->route('news', [$p->origin, $p->node, $p->nodeid]));
         RPC::call('MovimTpl.fill', '#post_widget', $html);
         RPC::call('MovimUtils.enableVideos');
         // If the post is a reply but we don't have the original
         if ($p->isReply() && !$p->getReply()) {
             $reply = unserialize($p->reply);
             $gi = new GetItem();
             $gi->setTo($reply['origin'])->setNode($reply['node'])->setId($reply['nodeid'])->setAskReply(['origin' => $p->origin, 'node' => $p->node, 'nodeid' => $p->nodeid])->request();
         }
         $gi = new GetItem();
         $gi->setTo($p->origin)->setNode($p->node)->setId($p->nodeid)->request();
     }
 }
예제 #6
0
파일: PostPublish.php 프로젝트: movim/moxl
 public function handle($stanza, $parent = false)
 {
     $g = new GetItem();
     $g->setTo($this->_to)->setNode($this->_node)->setId($this->_atom->id)->request();
     $this->pack(['to' => $this->_to, 'node' => $this->_node, 'id' => $this->_atom->id, 'repost' => $this->_repost]);
     $this->deliver();
 }