Example #1
0
File: Set.php Project: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $sd = new \modl\SubscriptionDAO();
     $cd = new \modl\ConferenceDAO();
     // We clear the old Bookmarks
     $sd->delete();
     $cd->delete();
     // We save the bookmarks as Subscriptions in the database
     foreach ($this->_arr as $c) {
         if ($c['type'] == 'subscription') {
             $su = new \modl\Subscription();
             $su->jid = $this->_to;
             $su->server = (string) $c['server'];
             $su->node = (string) $c['node'];
             $su->subscription = 'subscribed';
             $su->subid = (string) $c['subid'];
             $sd->set($su);
         } elseif ($c['type'] == 'conference') {
             $co = new \modl\Conference();
             $co->jid = $this->_to;
             $co->conference = (string) $c['jid'];
             $co->name = (string) $c['name'];
             $co->nick = (string) $c['nick'];
             $co->autojoin = (int) $c['autojoin'];
             $co->status = 0;
             $cd->set($co);
         }
     }
     $this->deliver();
 }
Example #2
0
 public function handle($stanza, $parent = false)
 {
     $sd = new \modl\SubscriptionDAO();
     // , $this->_subid
     $sd->deleteNode($this->_to, $this->_node);
     $this->pack(array('server' => $this->_to, 'node' => $this->_node));
     $this->deliver();
 }
Example #3
0
 function ajaxRefresh()
 {
     Notification::append(null, $this->__('menu.refresh'));
     $sd = new \modl\SubscriptionDAO();
     $subscriptions = $sd->getSubscribed();
     foreach ($subscriptions as $s) {
         $r = new GetItems();
         $r->setTo($s->server)->setNode($s->node)->request();
     }
 }
Example #4
0
 public function handle($stanza, $parent = false)
 {
     $s = $stanza->pubsub->subscription;
     $su = new \modl\Subscription();
     $su->set($this->_from, $this->_to, $this->_node, $s);
     $sd = new \modl\SubscriptionDAO();
     $sd->set($su);
     $this->pack(array('server' => $this->_to, 'node' => $this->_node, 'data', $this->_data));
     $this->deliver();
 }
Example #5
0
File: Get.php Project: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     if ($stanza->pubsub->items->item->storage) {
         $sd = new \modl\SubscriptionDAO();
         $cd = new \modl\ConferenceDAO();
         // We clear the old Bookmarks
         $sd->delete();
         $cd->delete();
         if ($stanza->pubsub->items->item->count() == 1) {
             // We save the bookmarks as Subscriptions in the database
             foreach ($stanza->pubsub->items->item->storage->children() as $c) {
                 $this->saveItem($c);
             }
         } else {
             // We parse non-standard XML where the items are in many <item>
             foreach ($stanza->pubsub->items->children() as $c) {
                 foreach ($c->storage->children() as $s) {
                     $this->saveItem($s);
                 }
             }
         }
         $this->deliver();
     }
 }
Example #6
0
 function prepareSubscriptions()
 {
     $sd = new \modl\SubscriptionDAO();
     $view = $this->tpl();
     $view->assign('subscriptions', $sd->getSubscribed());
     $html = $view->draw('_groups_subscriptions', true);
     return $html;
 }
Example #7
0
File: Rooms.php Project: Trim/movim
 public function setBookmark($item = false)
 {
     $arr = array();
     if ($item) {
         array_push($arr, $item);
     }
     $sd = new \modl\SubscriptionDAO();
     $cd = new \modl\ConferenceDAO();
     foreach ($sd->getSubscribed() as $s) {
         array_push($arr, array('type' => 'subscription', 'server' => $s->server, 'title' => $s->title, 'subid' => $s->subid, 'tags' => unserialize($s->tags), 'node' => $s->node));
     }
     foreach ($cd->getAll() as $c) {
         array_push($arr, array('type' => 'conference', 'name' => $c->name, 'autojoin' => $c->autojoin, 'nick' => $c->nick, 'jid' => $c->conference));
     }
     $b = new Set();
     $b->setArr($arr)->setTo($this->user->getLogin())->request();
 }