Esempio n. 1
0
File: Set.php Progetto: 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();
 }
Esempio n. 2
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();
 }
Esempio n. 3
0
File: Get.php Progetto: Hywan/moxl
 private function saveItem($c)
 {
     $sd = new \modl\SubscriptionDAO();
     $cd = new \modl\ConferenceDAO();
     if ($c->getName() == 'subscription') {
         $su = new \modl\Subscription();
         $su->jid = $this->_to;
         $su->server = (string) $c->attributes()->server;
         $su->node = (string) $c->attributes()->node;
         $su->subscription = 'subscribed';
         $su->subid = (string) $c->attributes()->subid;
         $sd->set($su);
     } elseif ($c->getName() == 'conference') {
         $co = new \modl\Conference();
         $co->jid = $this->_to;
         $co->conference = (string) $c->attributes()->jid;
         $co->name = (string) $c->attributes()->name;
         $co->nick = (string) $c->nick;
         $co->autojoin = (int) $c->attributes()->autojoin;
         $co->status = 0;
         $cd->set($co);
     }
 }