コード例 #1
0
ファイル: Set.php プロジェクト: 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();
 }
コード例 #2
0
ファイル: Unsubscribe.php プロジェクト: Hywan/moxl
 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();
 }
コード例 #3
0
ファイル: Menu.php プロジェクト: spthaolt/movim
 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();
     }
 }
コード例 #4
0
ファイル: Subscribe.php プロジェクト: Hywan/moxl
 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();
 }
コード例 #5
0
ファイル: Get.php プロジェクト: 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();
     }
 }
コード例 #6
0
ファイル: Groups.php プロジェクト: vijo/movim
 function prepareSubscriptions()
 {
     $sd = new \modl\SubscriptionDAO();
     $view = $this->tpl();
     $view->assign('subscriptions', $sd->getSubscribed());
     $html = $view->draw('_groups_subscriptions', true);
     return $html;
 }
コード例 #7
0
ファイル: Rooms.php プロジェクト: 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();
 }