diff --git a/README.md b/README.md index 3285b9d..25c67fd 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,12 @@ Warning: BETA. You need a valid SSL certificate to use Movim, auto-signed is not allowed. -Current Movim version : 0.9 git2015-08-25 +Current Movim version : 0.9 git2015-09-10 **Changelog** 0.9b 2015-0 +- Update to upstream Movim 0.9 git2015-09-10 - Add notes in README about public pods & whitelisting - script/install now check if path is empty. - script/remove now delete /etc/php/fpm/pool.d/movim.conf (fix #8). diff --git a/sources/app/helpers/StringHelper.php b/sources/app/helpers/StringHelper.php index 3a6edce..2ff9590 100644 --- a/sources/app/helpers/StringHelper.php +++ b/sources/app/helpers/StringHelper.php @@ -47,17 +47,9 @@ class MovimEmoji } } -/** - * @desc Prepare the string (add the a to the links and show the smileys) - * - * @param string $string - * @param boolean display large emojis - * @param check the links and convert them to pictures (heavy) - * @return string - */ -function prepareString($string, $large = false, $preview = false) { +function addUrls($string, $preview = false) { // Add missing links - $string = preg_replace_callback( + return preg_replace_callback( "/([\w\"'>]+\:\/\/[\w-?&;#+%:~=\.\/\@]+[\w\/])/", function ($match) use($preview) { if(!in_array(substr($match[0], 0, 1), array('>', '"', '\''))) { $content = $match[0]; @@ -84,6 +76,18 @@ function prepareString($string, $large = false, $preview = false) { }, $string ); +} + +/** + * @desc Prepare the string (add the a to the links and show the smileys) + * + * @param string $string + * @param boolean display large emojis + * @param check the links and convert them to pictures (heavy) + * @return string + */ +function prepareString($string, $large = false, $preview = false) { + $string = addUrls($string, $preview); // We remove all the style attributes $string = preg_replace_callback( @@ -94,16 +98,7 @@ function prepareString($string, $large = false, $preview = false) { // Twitter hashtags $string = preg_replace_callback( - "/ #[a-zA-Z0-9_-]{3,}/", function ($match) { - return - ' '. - trim($match[0]). - ''; - }, ' ' . $string - ); - + "/ #[a-zA-Z0-9_-]{3,}/", function ($match) { return ' '. trim($match[0]). ''; }, ' ' . $string); $string = preg_replace_callback( "/ @[a-zA-Z0-9_-]{3,}/", function ($match) { return diff --git a/sources/app/models/conference/Conference.php b/sources/app/models/conference/Conference.php index 3f95153..81c094d 100644 --- a/sources/app/models/conference/Conference.php +++ b/sources/app/models/conference/Conference.php @@ -2,31 +2,31 @@ namespace modl; -class Conference extends Model { +class Conference extends Model { public $jid; - public $conference; - public $name; - public $nick; + protected $conference; + protected $name; + protected $nick; public $autojoin; public $status; - + public function __construct() { $this->_struct = ' { - "jid" : + "jid" : {"type":"string", "size":128, "mandatory":true, "key":true }, - "conference" : + "conference" : {"type":"string", "size":128, "mandatory":true, "key":true }, - "name" : + "name" : {"type":"string", "size":128, "mandatory":true }, - "nick" : + "nick" : {"type":"string", "size":128 }, - "autojoin" : + "autojoin" : {"type":"int", "size":1 }, - "status" : + "status" : {"type":"int", "size":1 } }'; - + parent::__construct(); } } diff --git a/sources/app/models/config/Config.php b/sources/app/models/config/Config.php index 7d72bdb..e4c514a 100644 --- a/sources/app/models/config/Config.php +++ b/sources/app/models/config/Config.php @@ -31,7 +31,7 @@ class Config extends Model { "loglevel" : {"type":"string", "size":16, "mandatory":true }, "timezone" : - {"type":"string", "size":16, "mandatory":true }, + {"type":"string", "size":32, "mandatory":true }, "xmppwhitelist" : {"type":"text" }, "info" : @@ -50,7 +50,7 @@ class Config extends Model { parent::__construct(); - $this->description = __('global.description'); + $this->description = 'Description';//__('global.description'); $this->theme = 'material'; $this->locale = 'en'; $this->maxusers = -1; diff --git a/sources/app/models/contact/Contact.php b/sources/app/models/contact/Contact.php index d657101..f27132c 100644 --- a/sources/app/models/contact/Contact.php +++ b/sources/app/models/contact/Contact.php @@ -2,6 +2,8 @@ namespace modl; +use Respect\Validation\Validator; + class Contact extends Model { public $jid; @@ -158,37 +160,36 @@ class Contact extends Model { } public function set($vcard, $jid) { - $this->jid = \echapJid($jid); + $this->__set('jid', \echapJid($jid)); + $validate_date = Validator::date('Y-m-d'); if(isset($vcard->vCard->BDAY) - && (string)$vcard->vCard->BDAY != '') - $this->date = (string)$vcard->vCard->BDAY; - else - $this->date = null; + && $validate_date->validate($vcard->vCard->BDAY)) + $this->__set('date', (string)$vcard->vCard->BDAY); - $this->date = date(DATE_ISO8601, strtotime($this->date)); + $this->__set('date', date(DATE_ISO8601, strtotime($this->date))); - $this->name = (string)$vcard->vCard->NICKNAME; - $this->fn = (string)$vcard->vCard->FN; - $this->url = (string)$vcard->vCard->URL; + $this->__set('name', (string)$vcard->vCard->NICKNAME); + $this->__set('fn', (string)$vcard->vCard->FN); + $this->__set('url', (string)$vcard->vCard->URL); - $this->gender = (string)$vcard->vCard->{'X-GENDER'}; - $this->marital = (string)$vcard->vCard->MARITAL->STATUS; + $this->__set('gender', (string)$vcard->vCard->{'X-GENDER'}); + $this->__set('marital', (string)$vcard->vCard->MARITAL->STATUS); - $this->email = (string)$vcard->vCard->EMAIL->USERID; + $this->__set('email', (string)$vcard->vCard->EMAIL->USERID); - $this->adrlocality = (string)$vcard->vCard->ADR->LOCALITY; - $this->adrpostalcode = (string)$vcard->vCard->ADR->PCODE; - $this->adrcountry = (string)$vcard->vCard->ADR->CTRY; + $this->__set('adrlocality', (string)$vcard->vCard->ADR->LOCALITY); + $this->__set('adrpostalcode', (string)$vcard->vCard->ADR->PCODE); + $this->__set('adrcountry', (string)$vcard->vCard->ADR->CTRY); if(filter_var((string)$vcard->vCard->PHOTO, FILTER_VALIDATE_URL)) { - $this->photobin = base64_encode( - requestUrl((string)$vcard->vCard->PHOTO, 1)); + $this->__set('photobin', base64_encode( + requestUrl((string)$vcard->vCard->PHOTO, 1))); } else { - $this->photobin = (string)$vcard->vCard->PHOTO->BINVAL; + $this->__set('photobin', (string)$vcard->vCard->PHOTO->BINVAL); } - $this->description = (string)$vcard->vCard->DESC; + $this->__set('description', (string)$vcard->vCard->DESC); } public function createThumbnails() { @@ -250,32 +251,32 @@ class Contact extends Model { } public function setTune($stanza) { - $this->tuneartist = (string)$stanza->items->item->tune->artist; - $this->tunelenght = (int)$stanza->items->item->tune->lenght; - $this->tunerating = (int)$stanza->items->item->tune->rating; - $this->tunesource = (string)$stanza->items->item->tune->source; - $this->tunetitle = (string)$stanza->items->item->tune->title; - $this->tunetrack = (string)$stanza->items->item->tune->track; + $this->__set('tuneartist', (string)$stanza->items->item->tune->artist); + $this->__set('tunelenght', (int)$stanza->items->item->tune->lenght); + $this->__set('tunerating', (int)$stanza->items->item->tune->rating); + $this->__set('tunesource', (string)$stanza->items->item->tune->source); + $this->__set('tunetitle', (string)$stanza->items->item->tune->title); + $this->__set('tunetrack', (string)$stanza->items->item->tune->track); } public function setVcard4($vcard) { - if(isset($vcard->bday->date)) - $this->date = (string)$vcard->bday->date; - if(empty($this->date)) - $this->date = null; + $validate_date = Validator::date('Y-m-d'); + if(isset($vcard->bday->date) + && $validate_date->validate($vcard->bday->date)) + $this->__set('date', (string)$vcard->bday->date); - $this->name = (string)$vcard->nickname->text; - $this->fn = (string)$vcard->fn->text; - $this->url = (string)$vcard->url->uri; + $this->__set('name', (string)$vcard->nickname->text); + $this->__set('fn', (string)$vcard->fn->text); + $this->__set('url', (string)$vcard->url->uri); if(isset($vcard->gender)) - $this->gender = (string)$vcard->gender->sex->text; + $this->__set('gender ', (string)$vcard->gender->sex->text); if(isset($vcard->marital)) - $this->marital = (string)$vcard->marital->status->text; + $this->__set('marital', (string)$vcard->marital->status->text); - $this->adrlocality = (string)$vcard->adr->locality; - $this->adrcountry = (string)$vcard->adr->country; - $this->adrpostalcode = (string)$vcard->adr->code; + $this->__set('adrlocality', (string)$vcard->adr->locality); + $this->__set('adrcountry', (string)$vcard->adr->country); + $this->__set('adrpostalcode', (string)$vcard->adr->code); if(isset($vcard->impp)) { foreach($vcard->impp->children() as $c) { @@ -283,21 +284,20 @@ class Contact extends Model { switch($key) { case 'twitter' : - $this->twitter = str_replace('@', '', $value); + $this->__set('twitter', str_replace('@', '', $value)); break; case 'skype' : - $this->skype = (string)$value; + $this->__set('skype', (string)$value); break; case 'ymsgr' : - $this->yahoo = (string)$value; + $this->__set('yahoo', (string)$value); break; } } } - $this->email = (string)$vcard->email->text; - - $this->description = trim((string)$vcard->note->text); + $this->__set('email', (string)$vcard->email->text); + $this->__set('description', trim((string)$vcard->note->text)); } public function getPlace() { @@ -389,6 +389,26 @@ class Contact extends Model { } } + function getAlbum() + { + $uri = str_replace( + ' ', + '%20', + 'http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=80c1aa3abfa9e3d06f404a2e781e38f9&artist='. + $this->tuneartist. + '&album='. + $this->tunesource. + '&format=json' + ); + + $json = json_decode(requestURL($uri, 2)); + + if($json->album) { + $json->album->url = $json->album->image[2]->{'#text'}; + return $json->album; + } + } + function toRoster() { return array( 'jid' => $this->jid, diff --git a/sources/app/models/message/Message.php b/sources/app/models/message/Message.php index 654f974..4b3bb46 100644 --- a/sources/app/models/message/Message.php +++ b/sources/app/models/message/Message.php @@ -6,15 +6,15 @@ class Message extends Model { public $session; public $jidto; public $jidfrom; - - public $resource; - + + protected $resource; + public $type; - public $subject; - public $thread; - public $body; - public $html; + protected $subject; + protected $thread; + protected $body; + protected $html; public $published; public $delivered; @@ -25,30 +25,30 @@ class Message extends Model { { $this->_struct = ' { - "session" : + "session" : {"type":"string", "size":128, "mandatory":true }, - "jidto" : + "jidto" : {"type":"string", "size":128, "mandatory":true }, - "jidfrom" : + "jidfrom" : {"type":"string", "size":128, "mandatory":true }, - "resource" : + "resource" : {"type":"string", "size":128 }, - "type" : + "type" : {"type":"string", "size":20 }, - "subject" : + "subject" : {"type":"text"}, - "thread" : + "thread" : {"type":"string", "size":128 }, - "body" : + "body" : {"type":"text"}, - "html" : + "html" : {"type":"text"}, - "published" : + "published" : {"type":"date"}, - "delivered" : + "delivered" : {"type":"date"} }'; - + parent::__construct(); } @@ -66,15 +66,15 @@ class Message extends Model { $this->jidfrom = $jid[0]; if(isset($jid[1])) - $this->resource = $jid[1]; + $this->__set('resource', $jid[1]); $this->type = 'chat'; if($stanza->attributes()->type) { $this->type = (string)$stanza->attributes()->type; } - $this->body = (string)$stanza->body; - $this->subject = (string)$stanza->subject; + $this->__set('body', (string)$stanza->body); + $this->__set('subject', (string)$stanza->subject); $images = (bool)($this->type == 'chat'); @@ -83,9 +83,9 @@ class Message extends Model { $this->html = \fixSelfClosing($this->html); $this->html = \prepareString($this->html, false, $images); } else {*/ - $this->html = \prepareString($this->body, false, $images); + // $this->html = \prepareString($this->body, false, $images); //} - + if($stanza->delay) $this->published = gmdate('Y-m-d H:i:s', strtotime($stanza->delay->attributes()->stamp)); elseif($parent && $parent->delay) @@ -95,4 +95,15 @@ class Message extends Model { $this->delivered = gmdate('Y-m-d H:i:s'); } } + + public function convertEmojis() + { + $emoji = \MovimEmoji::getInstance(); + $this->body = $emoji->replace($this->body); + } + + public function addUrls() + { + $this->body = addUrls($this->body); + } } diff --git a/sources/app/models/postn/Postn.php b/sources/app/models/postn/Postn.php index 8eae785..ee4f512 100644 --- a/sources/app/models/postn/Postn.php +++ b/sources/app/models/postn/Postn.php @@ -109,33 +109,33 @@ class Postn extends Model { else $entry = $item; - $this->origin = $from; + $this->__set('origin', $from); if($node) - $this->node = $node; + $this->__set('node', $node); else - $this->node = (string)$item->attributes()->node; + $this->__set('node', (string)$item->attributes()->node); - $this->nodeid = (string)$entry->attributes()->id; + $this->__set('nodeid', (string)$entry->attributes()->id); if($entry->entry->id) - $this->nodeid = (string)$entry->entry->id; + $this->__set('nodeid', (string)$entry->entry->id); // Get some informations on the author if($entry->entry->author->name) - $this->aname = (string)$entry->entry->author->name; + $this->__set('aname', (string)$entry->entry->author->name); if($entry->entry->author->uri) - $this->aid = substr((string)$entry->entry->author->uri, 5); + $this->__set('aid', substr((string)$entry->entry->author->uri, 5)); if($entry->entry->author->email) - $this->aemail = (string)$entry->entry->author->email; + $this->__set('aemail', (string)$entry->entry->author->email); // Non standard support if($entry->entry->source && $entry->entry->source->author->name) - $this->aname = (string)$entry->entry->source->author->name; + $this->__set('aname', (string)$entry->entry->source->author->name); if($entry->entry->source && $entry->entry->source->author->uri) - $this->aid = substr((string)$entry->entry->source->author->uri, 5); + $this->__set('aid', substr((string)$entry->entry->source->author->uri, 5)); - $this->title = (string)$entry->entry->title; + $this->__set('title', (string)$entry->entry->title); // Content if($entry->entry->summary && (string)$entry->entry->summary != '') @@ -153,23 +153,22 @@ class Postn extends Model { $content = $summary.$content; if($entry->entry->updated) - $this->updated = (string)$entry->entry->updated; + $this->__set('updated', (string)$entry->entry->updated); else - $this->updated = gmdate(DATE_ISO8601); + $this->__set('updated', gmdate(DATE_ISO8601)); if($entry->entry->published) - $this->published = (string)$entry->entry->published; + $this->__set('published', (string)$entry->entry->published); elseif($entry->entry->updated) - $this->published = (string)$entry->entry->updated; + $this->__set('published', (string)$entry->entry->updated); else - $this->published = gmdate(DATE_ISO8601); + $this->__set('published', gmdate(DATE_ISO8601)); if($delay) - $this->delay = $delay; + $this->__set('delay', $delay); $contentimg = $this->setAttachements($entry->entry->link); - // Tags parsing if($entry->entry->category) { $this->tags = array(); @@ -183,22 +182,24 @@ class Postn extends Model { } if(!empty($this->tags)) - $this->tags = serialize($this->tags); + $this->__set('tags', serialize($this->tags)); if($contentimg != '') $content .= '
'.$contentimg; if(!isset($this->commentplace)) - $this->commentplace = $this->origin; + $this->__set('commentplace', $this->origin); - $this->content = trim($content); - $this->contentcleaned = prepareString(html_entity_decode($this->content)); + $this->__set('content', trim($content)); + //$this->__set('contentcleaned', prepareString(html_entity_decode($this->content))); + $purifier = new \HTMLPurifier(); + $this->contentcleaned = $purifier->purify(html_entity_decode($this->content)); if($entry->entry->geoloc) { if($entry->entry->geoloc->lat != 0) - $this->lat = (string)$entry->entry->geoloc->lat; + $this->__set('lat', (string)$entry->entry->geoloc->lat); if($entry->entry->geoloc->lon != 0) - $this->lon = (string)$entry->entry->geoloc->lon; + $this->__set('lon', (string)$entry->entry->geoloc->lon); } } diff --git a/sources/app/models/presence/Presence.php b/sources/app/models/presence/Presence.php index 002e785..0f64f7a 100644 --- a/sources/app/models/presence/Presence.php +++ b/sources/app/models/presence/Presence.php @@ -4,23 +4,23 @@ namespace Modl; class Presence extends Model { protected $id; - + protected $session; protected $jid; - + // General presence informations protected $resource; protected $value; protected $priority; protected $status; - + // Client Informations protected $node; protected $ver; - + // Delay - XEP 0203 protected $delay; - + // Last Activity - XEP 0256 protected $last; @@ -33,84 +33,84 @@ class Presence extends Model { // vcard-temp:x:update, not saved in the DB public $photo = false; - + public function __construct() { $this->_struct = ' { - "id" : + "id" : {"type":"string", "size":128, "mandatory":true }, - "session" : + "session" : {"type":"string", "size":64, "mandatory":true, "key":true }, - "jid" : + "jid" : {"type":"string", "size":64, "mandatory":true, "key":true }, - "resource" : + "resource" : {"type":"string", "size":64, "key":true }, - "value" : + "value" : {"type":"int", "size":11, "mandatory":true }, - "priority" : + "priority" : {"type":"int", "size":11 }, - "status" : + "status" : {"type":"text"}, - "node" : + "node" : {"type":"string", "size":128 }, - "ver" : + "ver" : {"type":"string", "size":128 }, - "delay" : + "delay" : {"type":"date"}, - "last" : + "last" : {"type":"int", "size":11 }, - "publickey" : + "publickey" : {"type":"text"}, - "muc" : + "muc" : {"type":"int", "size":1 }, - "mucjid" : + "mucjid" : {"type":"string", "size":64 }, - "mucaffiliation" : + "mucaffiliation" : {"type":"string", "size":32 }, - "mucrole" : + "mucrole" : {"type":"string", "size":32 } }'; - + parent::__construct(); } - + public function setPresence($stanza) { $jid = explode('/',(string)$stanza->attributes()->from); - + if($stanza->attributes()->to) $to = current(explode('/',(string)$stanza->attributes()->to)); else $to = $jid[0]; - $this->session = $to; - $this->jid = $jid[0]; + $this->__set('session', $to); + $this->__set('jid', $jid[0]); if(isset($jid[1])) - $this->resource = $jid[1]; + $this->__set('resource', $jid[1]); else - $this->resource = 'default'; - - $this->status = (string)$stanza->status; - + $this->__set('resource', 'default'); + + $this->__set('status', (string)$stanza->status); + if($stanza->c) { - $this->node = (string)$stanza->c->attributes()->node; - $this->ver = (string)$stanza->c->attributes()->ver; + $this->__set('node', (string)$stanza->c->attributes()->node); + $this->__set('ver', (string)$stanza->c->attributes()->ver); } - + if($stanza->priority) - $this->priority = (string)$stanza->priority; - + $this->__set('priority', (string)$stanza->priority); + if((string)$stanza->attributes()->type == 'error') { - $this->value = 6; + $this->__set('value', 6); } elseif((string)$stanza->attributes()->type == 'unavailable') { - $this->value = 5; + $this->__set('value', 5); } elseif((string)$stanza->show == 'away') { - $this->value = 2; + $this->__set('value', 2); } elseif((string)$stanza->show == 'dnd') { - $this->value = 3; + $this->__set('value', 3); } elseif((string)$stanza->show == 'xa') { - $this->value = 4; + $this->__set('value', 4); } else { - $this->value = 1; + $this->__set('value', 1); } // Specific XEP @@ -118,41 +118,41 @@ class Presence extends Model { foreach($stanza->children() as $name => $c) { switch($c->attributes()->xmlns) { case 'jabber:x:signed' : - $this->publickey = (string)$c; + $this->__set('publickey', (string)$c); break; case 'http://jabber.org/protocol/muc#user' : - $this->muc = true; + $this->__set('muc ', true); if($c->item->attributes()->jid) - $this->mucjid = cleanJid((string)$c->item->attributes()->jid); + $this->__set('mucjid', cleanJid((string)$c->item->attributes()->jid)); else - $this->mucjid = (string)$stanza->attributes()->from; + $this->__set('mucjid', (string)$stanza->attributes()->from); - $this->mucrole = (string)$c->item->attributes()->role; - $this->mucaffiliation = (string)$c->item->attributes()->affiliation; + $this->__set('mucrole', (string)$c->item->attributes()->role); + $this->__set('mucaffiliation', (string)$c->item->attributes()->affiliation); break; case 'vcard-temp:x:update' : - $this->photo = true; + $this->__set('photo', true); break; } } } - + if($stanza->delay) { - $this->delay = + $this->__set('delay', gmdate( - 'Y-m-d H:i:s', + 'Y-m-d H:i:s', strtotime( (string)$stanza->delay->attributes()->stamp ) ) - ; + ); } - + if($stanza->query) { - $this->last = (int)$stanza->query->attributes()->seconds; + $this->__set('last', (int)$stanza->query->attributes()->seconds); } } - + public function getPresence() { $txt = array( 1 => 'online', @@ -162,7 +162,7 @@ class Presence extends Model { 5 => 'offline', 6 => 'server_error' ); - + $arr = array(); $arr['jid'] = $this->jid; $arr['resource'] = $this->resource; @@ -172,7 +172,7 @@ class Presence extends Model { $arr['status'] = $this->status; $arr['node'] = $this->node; $arr['ver'] = $this->ver; - + return $arr; } diff --git a/sources/app/models/rosterlink/RosterLink.php b/sources/app/models/rosterlink/RosterLink.php index 2668c41..61595da 100644 --- a/sources/app/models/rosterlink/RosterLink.php +++ b/sources/app/models/rosterlink/RosterLink.php @@ -2,56 +2,57 @@ namespace modl; -class RosterLink extends Model { +class RosterLink extends Model { public $session; public $jid; - - public $rostername; + + protected $rostername; public $rosterask; public $rostersubscription; - - public $realname; - - public $groupname; - + + protected $realname; + + protected $groupname; + public $chaton; public $publickey; - + public function __construct() { $this->_struct = ' { - "session" : + "session" : {"type":"string", "size":128, "mandatory":true, "key":true }, - "jid" : + "jid" : {"type":"string", "size":128, "mandatory":true, "key":true }, - "rostername" : + "rostername" : {"type":"string", "size":128 }, - "rosterask" : + "rosterask" : {"type":"string", "size":128 }, - "rostersubscription" : + "rostersubscription" : {"type":"string", "size":128 }, - "realname" : + "realname" : {"type":"string", "size":128 }, - "groupname" : + "groupname" : {"type":"string", "size":128 }, - "chaton" : + "chaton" : {"type":"int", "size":11 } }'; - + parent::__construct(); } - + function set($stanza) { $this->jid = (string)$stanza->attributes()->jid; - - if(isset($stanza->attributes()->name) && (string)$stanza->attributes()->name != '') - $this->rostername = (string)$stanza->attributes()->name; + + if(isset($stanza->attributes()->name) + && (string)$stanza->attributes()->name != '') + $this->__set('rostername', (string)$stanza->attributes()->name); else - $this->rostername = (string)$stanza->attributes()->jid; - $this->rosterask = (string)$stanza->attributes()->ask; - $this->rostersubscription = (string)$stanza->attributes()->subscription; - $this->groupname = (string)$stanza->group; + $this->__set('rostername', (string)$stanza->attributes()->jid); + $this->__set('rosterask', (string)$stanza->attributes()->ask); + $this->__set('rostersubscription', (string)$stanza->attributes()->subscription); + $this->__set('groupname', (string)$stanza->group); } } diff --git a/sources/app/models/subscription/Subscription.php b/sources/app/models/subscription/Subscription.php index 6fe980d..6dd273f 100644 --- a/sources/app/models/subscription/Subscription.php +++ b/sources/app/models/subscription/Subscription.php @@ -4,11 +4,11 @@ namespace modl; class Subscription extends Model { public $jid; - public $server; - public $node; - public $subscription; - public $subid; - public $title; + protected $server; + protected $node; + protected $subscription; + protected $subid; + protected $title; public $description; public $tags; public $timestamp; @@ -40,13 +40,13 @@ class Subscription extends Model { } function set($jid, $server, $node, $s) { - $this->jid = $jid; - $this->server = $server; - $this->node = $node; - $this->jid = (string)$s->attributes()->jid; - $this->subscription = (string)$s->attributes()->subscription; - $this->subid = (string)$s->attributes()->subid; - $this->tags = serialize(array()); + $this->__set('jid', $jid); + $this->__set('server', $server); + $this->__set('node', $node); + $this->__set('jid', (string)$s->attributes()->jid); + $this->__set('subscription', (string)$s->attributes()->subscription); + $this->__set('subid', (string)$s->attributes()->subid); + $this->__set('tags', serialize(array())); if($this->subid = '') $this->subid = 'default'; diff --git a/sources/app/views/about.tpl b/sources/app/views/about.tpl index 51f4f82..61f570c 100644 --- a/sources/app/views/about.tpl +++ b/sources/app/views/about.tpl @@ -5,6 +5,7 @@ widget('Tabs');?> widget('About');?> + widget('Help');?> widget('Caps');?> diff --git a/sources/app/views/page.tpl b/sources/app/views/page.tpl index 34e897c..f11aaac 100644 --- a/sources/app/views/page.tpl +++ b/sources/app/views/page.tpl @@ -11,8 +11,8 @@ - - + diff --git a/sources/app/widgets/About/about.tpl b/sources/app/widgets/About/about.tpl index 5e33396..60e2226 100644 --- a/sources/app/widgets/About/about.tpl +++ b/sources/app/widgets/About/about.tpl @@ -20,7 +20,7 @@ {$c->__('about.translators')}

- Thanks to all the translators translations.launchpad.net/movim + {$c->__('about.translators_text')} www.transifex.com/projects/p/movim/

  • {$c->__('about.software')}
  • diff --git a/sources/app/widgets/About/locales.ini b/sources/app/widgets/About/locales.ini index decc689..0581b91 100644 --- a/sources/app/widgets/About/locales.ini +++ b/sources/app/widgets/About/locales.ini @@ -1,8 +1,9 @@ [about] -thanks = Thanks -developers = Developers -translators = Translators -software = Software -resources = Resources -api = API -info = Movim is an XMPP-based communication platform. All the project, except the following software and resources, is under +thanks = Thanks +developers = Developers +translators = Translators +translators_text = "Thanks to all the translators" +software = Software +resources = Resources +api = API +info = Movim is an XMPP-based communication platform. All the project, except the following software and resources, is under diff --git a/sources/app/widgets/Account/Account.php b/sources/app/widgets/Account/Account.php index ff4ebd8..c56e7b5 100644 --- a/sources/app/widgets/Account/Account.php +++ b/sources/app/widgets/Account/Account.php @@ -13,7 +13,7 @@ class Account extends WidgetBase $this->addjs('account.js'); $this->registerEvent('register_changepassword_handle', 'onPasswordChanged'); $this->registerEvent('register_remove_handle', 'onRemoved'); - $this->registerEvent('register_get_handle', 'onRegister'); + $this->registerEvent('register_get_handle', 'onRegister', 'account'); } function onPasswordChanged() diff --git a/sources/app/widgets/Account/account.js b/sources/app/widgets/Account/account.js index 85bf564..d6f3724 100644 --- a/sources/app/widgets/Account/account.js +++ b/sources/app/widgets/Account/account.js @@ -10,3 +10,7 @@ var Account = { Presence_ajaxLogout(); } } + +MovimWebsocket.attach(function() { + Notification.current('account'); +}); diff --git a/sources/app/widgets/AccountNext/AccountNext.php b/sources/app/widgets/AccountNext/AccountNext.php index 3089be3..ba1086a 100644 --- a/sources/app/widgets/AccountNext/AccountNext.php +++ b/sources/app/widgets/AccountNext/AccountNext.php @@ -9,12 +9,12 @@ class AccountNext extends WidgetBase { { $this->addjs('accountnext.js'); $this->addcss('accountnext.css'); - + $this->registerEvent('register_get_handle', 'onForm'); $this->registerEvent('register_set_handle', 'onRegistered'); - $this->registerEvent('register_set_errorconflict', 'onRegisterError'); - $this->registerEvent('register_set_errornotacceptable', 'onRegisterNotAcceptable'); - $this->registerEvent('register_get_errorserviceunavailable', 'onServiceUnavailable'); + $this->registerEvent('register_set_errorconflict', 'onRegisterError', 'accountnext'); + $this->registerEvent('register_set_errornotacceptable', 'onRegisterNotAcceptable', 'accountnext'); + $this->registerEvent('register_get_errorserviceunavailable', 'onServiceUnavailable', 'accountnext'); } function display() @@ -35,7 +35,7 @@ class AccountNext extends WidgetBase { switch($form->x->attributes()->xmlns) { case 'jabber:x:data' : $formview = $this->tpl(); - + $formh = $xtf->getHTML($form->x->asXML()); $formview->assign('submitdata', $this->call('ajaxRegister', "movim_form_to_json('data')")); @@ -47,13 +47,13 @@ class AccountNext extends WidgetBase { case 'jabber:x:oob' : $oobview = $this->tpl(); $oobview->assign('url', (string)$form->x->url); - + $html = $oobview->draw('_accountnext_oob', true); - + RPC::call('movim_fill', 'subscription_form', $html); break; } - + } else{ $formh = $xtf->getHTML($form->asXML()); } @@ -65,9 +65,9 @@ class AccountNext extends WidgetBase { $view = $this->tpl(); $view->assign('url', (string)$form->x->url); - + $html = $view->draw('_accountnext_registered', true); - + RPC::call('movim_fill', 'subscription_form', $html); RPC::call('setUsername', $data->username->value); } @@ -77,12 +77,12 @@ class AccountNext extends WidgetBase { $error = $package->content; Notification::append(null, $error); } - + function onRegisterNotAcceptable() { Notification::append(null, $this->__('error.not_acceptable')); } - + function onServiceUnavailable() { Notification::append(null, $this->__('error.service_unavailable')); diff --git a/sources/app/widgets/AdminLogin/adminlogin.tpl b/sources/app/widgets/AdminLogin/adminlogin.tpl index 5d40df7..5a8f1fa 100644 --- a/sources/app/widgets/AdminLogin/adminlogin.tpl +++ b/sources/app/widgets/AdminLogin/adminlogin.tpl @@ -12,10 +12,10 @@ + value="{$c->__('button.validate')}" /> diff --git a/sources/app/widgets/AdminMain/AdminMain.php b/sources/app/widgets/AdminMain/AdminMain.php index 9ec3d7f..2888cc4 100644 --- a/sources/app/widgets/AdminMain/AdminMain.php +++ b/sources/app/widgets/AdminMain/AdminMain.php @@ -72,6 +72,8 @@ class AdminMain extends WidgetBase $cd = new \Modl\ConfigDAO(); $config = $cd->get(); + $l = Locale::start(); + $this->view->assign('conf', $cd->get()); $this->view->assign('logs', array( @@ -96,6 +98,6 @@ class AdminMain extends WidgetBase } $this->view->assign('timezones', getTimezoneList()); - $this->view->assign('langs', loadLangArray()); + $this->view->assign('langs', $l->getList()); } } diff --git a/sources/app/widgets/AdminMain/adminmain.tpl b/sources/app/widgets/AdminMain/adminmain.tpl index 79de4cd..a3f7979 100644 --- a/sources/app/widgets/AdminMain/adminmain.tpl +++ b/sources/app/widgets/AdminMain/adminmain.tpl @@ -155,7 +155,7 @@ + value="{$c->__('button.save')}"/>
    diff --git a/sources/app/widgets/AdminTest/AdminTest.php b/sources/app/widgets/AdminTest/AdminTest.php index 0b3aeb3..8f8cdda 100644 --- a/sources/app/widgets/AdminTest/AdminTest.php +++ b/sources/app/widgets/AdminTest/AdminTest.php @@ -46,7 +46,7 @@ class AdminTest extends WidgetBase $config = $cd->get(); $this->view->assign('dbconnected', $md->_connected); - $this->view->assign('dbtype', $supported[$conf['type']]); + $this->view->assign('dbtype', $supported[$config->type]); $this->view->assign('dbinfos', sizeof($md->check())); $this->view->assign('websocketurl', $config->websocketurl); } diff --git a/sources/app/widgets/AdminTest/admintest.tpl b/sources/app/widgets/AdminTest/admintest.tpl index 39968fa..a08ecd8 100644 --- a/sources/app/widgets/AdminTest/admintest.tpl +++ b/sources/app/widgets/AdminTest/admintest.tpl @@ -34,10 +34,11 @@ + {$attachements = $value->getAttachements()}
    + {if="strlen($value->contentcleaned) < 500 && isset($attachements.pictures)"} + {loop="$attachements.pictures"} + + + + {/loop} + {/if} {$value->contentcleaned}