public function handle($stanza, $parent = false) { $sd = new \Modl\SubscriptionDAO(); $sd->deleteNode($this->_to, $this->_node); $this->pack(['server' => $this->_to, 'node' => $this->_node]); $this->deliver(); }
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(); }
function prepareList($list) { $configlist = $this->tpl(); $sd = new \Modl\SubscriptionDAO(); $listhtml = ''; //if($sd != null && $sd->getSubscribed() != null) { foreach ($sd->getSubscribed() as $s) { if ($s->name != null) { $name = $s->name; } else { $name = $s->node; } if (isset($list[$s->server . $s->node])) { $checked = 'checked'; } else { $checked = ''; } $switch = $this->call('ajaxChangeSubscribed', "'" . $s->server . "'", "'" . $s->node . "'", "this.checked", "'" . $name . "'"); $listhtml .= ' <li class="action"> <span class="icon bubble color ' . stringToColor($s->node) . '"> ' . firstLetterCapitalize($s->node) . ' </span> <form> <div class="action"> <div class="checkbox"> <input type="checkbox" id="privacy' . $s->node . '" name="privacy' . $s->node . '" ' . $checked . ' onchange="' . $switch . '"/> <label for="privacy' . $s->node . '"></label> </div> </div> </form> <a href="' . Route::urlize('node', array($s->server, $s->node)) . '">' . $name . ' </a> </li>'; } $configlist->assign('list', $listhtml); return $configlist->draw('_pubsubsubscriptionconfig_list', true); //} else return t('No public groups found'); }
public function handle($stanza, $parent = false) { $jid = current(explode('/', (string) $stanza->attributes()->to)); $server = $this->_to; $node = $this->_node; $tab = []; foreach ($stanza->pubsub->subscriptions->children() as $s) { $su = new \Modl\Subscription(); $su->set($jid, $server, $node, $s); $sd = new \Modl\SubscriptionDAO(); $sd->set($su); $sub = ['jid' => (string) $s["jid"], 'subscription' => (string) $s["subscription"], 'subid' => (string) $s["subid"]]; array_push($tab, $sub); } if (empty($tab)) { $sd = new \Modl\SubscriptionDAO(); $sd->deleteNode($server, $node); } $this->pack(['subscriptions' => $tab, 'to' => $this->_to, 'node' => $this->_node]); if ($this->_notify) { $this->deliver(); } }
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); }
public function setBookmark($item = false) { $arr = []; if ($item) { array_push($arr, $item); } $sd = new \Modl\SubscriptionDAO(); $cd = new \Modl\ConferenceDAO(); $session = Session::start(); $subscribed = $sd->getSubscribed(); if ($subscribed) { foreach ($subscribed as $s) { array_push($arr, ['type' => 'subscription', 'server' => $s->server, 'title' => $s->title, 'subid' => $s->subid, 'tags' => unserialize($s->tags), 'node' => $s->node]); } } $conferences = $cd->getAll(); if ($conferences) { foreach ($conferences as $c) { array_push($arr, ['type' => 'conference', 'name' => $c->name, 'autojoin' => $c->autojoin, 'nick' => $c->nick, 'jid' => $c->conference]); } } $b = new Set(); $b->setArr($arr)->setTo($session->get('jid'))->request(); }