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'); }
function prepareMessage(&$message) { if (isset($message->html)) { $message->body = $message->html; } else { $message->body = prepareString(htmlentities($message->body, ENT_COMPAT, 'UTF-8')); } if ($message->type == 'groupchat') { $message->color = stringToColor($message->session . $message->resource . $message->jidfrom . $message->type); } $message->published = prepareDate(strtotime($message->published)); return $message; }
function prepareMessage(&$message, $jid = null) { if ($jid != $message->jidto && $jid != $message->jidfrom && $jid != null) { return $this->_wrapper; } $message->jidto = echapJS($message->jidto); $message->jidfrom = echapJS($message->jidfrom); if (isset($message->html)) { $message->body = $message->html; } else { // We add some smileys... $message->convertEmojis(); $message->addUrls(); // $message->body = prepareString(htmlentities($message->body , ENT_COMPAT,'UTF-8')); } if (isset($message->sticker)) { $p = new Picture(); $sticker = $p->get($message->sticker, false, false, 'png'); $stickerSize = $p->getSize(); if ($sticker == false) { $r = new Request(); $r->setTo($message->jidfrom)->setResource($message->resource)->setCid($message->sticker)->request(); } else { $message->sticker = ['url' => $sticker, 'width' => $stickerSize['width'], 'height' => $stickerSize['height']]; } } if (isset($message->picture)) { $message->sticker = ['url' => $message->picture, 'picture' => true]; } $message->publishedPrepared = prepareDate(strtotime($message->published), true); if ($message->delivered) { $message->delivered = prepareDate(strtotime($message->delivered), true); } $date = substr($message->published, 0, 10); if ($message->type == 'groupchat') { $message->color = stringToColor($message->session . $message->resource . $message->jidfrom . $message->type); //fillup $wrapper if ($message->body != "") { if (!array_key_exists($date, $this->_wrapper)) { $this->_wrapper[$date] = [$message]; } else { array_push($this->_wrapper[$date], $message); } } } else { $msgkey = $message->jidfrom . '>' . substr($message->published, 11, 5); //fillup $wrapper if (!array_key_exists($date, $this->_wrapper)) { $sticker = ""; if (isset($message->sticker)) { $sticker = "sticker"; } $this->_wrapper[$date] = ['0' . $sticker . '<' . $msgkey => [$message]]; } else { //date contains at least one speaker@time=>msg already end($this->_wrapper[$date]); $lastkey = key($this->_wrapper[$date]); if (substr($lastkey, strpos($lastkey, '<') + 1) == $msgkey && !isset($message->sticker) && strpos($lastkey, "sticker<") === false) { // the previous msg was not a sticker array_push($this->_wrapper[$date][$lastkey], $message); } else { $sticker = ""; if (isset($message->sticker)) { $sticker = "sticker"; } $this->_wrapper[$date][count($this->_wrapper[$date]) . $sticker . '<' . $msgkey] = [$message]; } } } return $this->_wrapper; }
/** * @brief Get data for contacts display in roster * @param &$c: the contact as an array and by reference, * $oc: the contact as an object, * $caps: an array of capabilities * @returns */ function prepareContact(&$c, $oc, $caps) { $arr = array(); $jid = false; $presencestxt = getPresencesTxt(); // We add some basic information $c['rosterview'] = array(); $c['rosterview']['avatar'] = $oc->getPhoto('s'); $c['rosterview']['color'] = stringToColor($oc->jid); $c['rosterview']['name'] = $oc->getTrueName(); $c['rosterview']['friendpage'] = $this->route('contact', $oc->jid); $c['rosterview']['subscription'] = $oc->rostersubscription; // Some data relative to the presence if ($oc->last != null && $oc->last > 60) { $c['rosterview']['inactive'] = 'inactive'; } else { $c['rosterview']['inactive'] = ''; } if ($oc->value && $oc->value != 5) { if ($oc->value && $oc->value == 6) { $c['rosterview']['presencetxt'] = 'server_error'; } else { $c['rosterview']['presencetxt'] = $presencestxt[$oc->value]; } $c['value'] = intval($c['value']); } else { $c['rosterview']['presencetxt'] = 'offline'; $c['value'] = 5; } $c['rosterview']['type'] = ''; $c['rosterview']['client'] = ''; $c['rosterview']['jingle'] = false; // About the entity capability if ($caps && isset($caps[$oc->node . '#' . $oc->ver])) { $cap = $caps[$oc->node . '#' . $oc->ver]; $c['rosterview']['type'] = $cap->type; $client = $cap->name; $client = explode(' ', $client); $c['rosterview']['client'] = strtolower(preg_replace('/[^a-zA-Z0-9_ \\-()\\/%-&]/s', '', reset($client))); // Jingle support $features = $cap->features; $features = unserialize($features); if (array_search('urn:xmpp:jingle:1', $features) !== null && array_search('urn:xmpp:jingle:apps:rtp:audio', $features) !== null && array_search('urn:xmpp:jingle:apps:rtp:video', $features) !== null && (array_search('urn:xmpp:jingle:transports:ice-udp:0', $features) || array_search('urn:xmpp:jingle:transports:ice-udp:1', $features))) { $c['rosterview']['jingle'] = true; } } // Tune $c['rosterview']['tune'] = false; if ($oc->tuneartist != null && $oc->tuneartist != '' || $oc->tunetitle != null && $oc->tunetitle != '') { $c['rosterview']['tune'] = true; } }
public function getColor() { return stringToColor($this->nodeLabel); }