mirror of
https://github.com/YunoHost-Apps/movim_ynh.git
synced 2024-09-03 19:46:19 +02:00
update to movim 0.9 2015-08-27
This commit is contained in:
parent
449c5f7fe6
commit
7acf104028
16 changed files with 234 additions and 223 deletions
|
@ -5,10 +5,13 @@ Movim is a decentralized social network, written in PHP and HTML5 and based on t
|
|||
|
||||
Warning: BETA.
|
||||
|
||||
Current Movim version : 20150824.
|
||||
Current Movim version : 0.9 git2015-08-27
|
||||
|
||||
**Changelog**
|
||||
|
||||
0.9b 2015-08-27
|
||||
- Update to Movim 0.9 git2015-08-27
|
||||
|
||||
0.8b 2015-08-24
|
||||
- Added language selection : ar, de, es, it, ja, nl, ru
|
||||
- Fix URL in manifest.json (was https://https://...)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,37 +158,37 @@ class Contact extends Model {
|
|||
}
|
||||
|
||||
public function set($vcard, $jid) {
|
||||
$this->jid = \echapJid($jid);
|
||||
$this->__set('jid', \echapJid($jid));
|
||||
|
||||
if(isset($vcard->vCard->BDAY)
|
||||
&& (string)$vcard->vCard->BDAY != '')
|
||||
$this->date = (string)$vcard->vCard->BDAY;
|
||||
$this->__set('date', (string)$vcard->vCard->BDAY);
|
||||
else
|
||||
$this->date = null;
|
||||
$this->__set('date', null);
|
||||
|
||||
$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 +250,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(isset($vcard->bday->date))
|
||||
$this->__set('date', (string)$vcard->bday->date);
|
||||
if(empty($this->date))
|
||||
$this->date = null;
|
||||
|
||||
$this->name = (string)$vcard->nickname->text;
|
||||
$this->fn = (string)$vcard->fn->text;
|
||||
$this->url = (string)$vcard->url->uri;
|
||||
$this->__set('date', null);
|
||||
*/
|
||||
$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 +283,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() {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 .= '<br />'.$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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -10,3 +10,7 @@ var Account = {
|
|||
Presence_ajaxLogout();
|
||||
}
|
||||
}
|
||||
|
||||
MovimWebsocket.attach(function() {
|
||||
Notification.current('account');
|
||||
});
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -253,7 +253,7 @@ class Chat extends WidgetBase
|
|||
}
|
||||
|
||||
$m->body = rawurldecode($message);
|
||||
$m->html = prepareString($m->body, false, true);
|
||||
//$m->html = prepareString($m->body, false, true);
|
||||
$m->published = gmdate('Y-m-d H:i:s');
|
||||
$m->delivered = gmdate('Y-m-d H:i:s');
|
||||
|
||||
|
@ -265,7 +265,7 @@ class Chat extends WidgetBase
|
|||
$p = new Publish;
|
||||
$p->setTo($to);
|
||||
//$p->setHTML($m->html);
|
||||
$p->setContent(htmlspecialchars($m->body));
|
||||
$p->setContent($m->body);
|
||||
|
||||
if($muc) {
|
||||
$p->setMuc();
|
||||
|
@ -485,11 +485,11 @@ class Chat extends WidgetBase
|
|||
|
||||
function prepareMessage(&$message)
|
||||
{
|
||||
if(isset($message->html)) {
|
||||
/*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);
|
||||
|
|
|
@ -77,7 +77,6 @@ var Chat = {
|
|||
};
|
||||
|
||||
bubble.querySelector('span.user').innerHTML = message.resource;
|
||||
|
||||
var conversation = document.getElementById(id);
|
||||
if(conversation) {
|
||||
conversation.appendChild(bubble);
|
||||
|
@ -110,6 +109,7 @@ var Chat = {
|
|||
|
||||
if(bubble) {
|
||||
bubble.querySelector('div.bubble div').innerHTML = message.body;
|
||||
|
||||
bubble.querySelector('div.bubble span.info').innerHTML = message.published;
|
||||
|
||||
movim_append(id, bubble.outerHTML);
|
||||
|
|
|
@ -196,9 +196,9 @@ class Rooms extends WidgetBase
|
|||
array_push($arr,
|
||||
array(
|
||||
'type' => 'conference',
|
||||
'name' => $c->name,
|
||||
'name' => htmlentities($c->name),
|
||||
'autojoin' => $c->autojoin,
|
||||
'nick' => $c->nick,
|
||||
'nick' => htmlentities($c->nick),
|
||||
'jid' => $c->conference));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
"react/socket-client": "0.4.*@dev",
|
||||
|
||||
"forxer/Gravatar": "~1.2",
|
||||
"respect/validation": "0.8.*"
|
||||
"respect/validation": "0.8.*",
|
||||
"ezyang/htmlpurifier": "^4.7"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ $stdin_behaviour = function ($data) use (&$conn, $loop, &$buffer, &$connector, &
|
|||
|
||||
$port = 5222;
|
||||
$dns = \Moxl\Utils::resolveHost($msg->host);
|
||||
if(isset($dns[0]['target']) && $dns[0]['target'] != null) $msg->host = $dns[0]['target'];
|
||||
if(isset($dns[0]['port']) && $dns[0]['port'] != null) $port = $dns[0]['port'];
|
||||
if(isset($dns->target) && $dns->target != null) $msg->host = $dns->target;
|
||||
if(isset($dns->port) && $dns->port != null) $port = $dns->port;
|
||||
#fwrite(STDERR, colorize('open a socket to '.$domain, 'yellow')." : ".colorize('sent to XMPP', 'green')."\n");
|
||||
$connector->create($msg->host, $port)->then($xmpp_behaviour);
|
||||
}
|
||||
|
@ -111,6 +111,8 @@ $xmpp_behaviour = function (React\Stream\Stream $stream) use (&$conn, $loop, &$s
|
|||
|| $message == '<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>') {
|
||||
stream_set_blocking($conn->stream, 1);
|
||||
stream_context_set_option($conn->stream, 'ssl', 'allow_self_signed', true);
|
||||
#stream_context_set_option($conn->stream, 'ssl', 'verify_peer_name', false);
|
||||
#stream_context_set_option($conn->stream, 'ssl', 'verify_peer', false);
|
||||
$out = stream_socket_enable_crypto($conn->stream, 1, STREAM_CRYPTO_METHOD_TLS_CLIENT);
|
||||
|
||||
$restart = true;
|
||||
|
@ -137,7 +139,7 @@ $xmpp_behaviour = function (React\Stream\Stream $stream) use (&$conn, $loop, &$s
|
|||
\RPC::clear();
|
||||
|
||||
if(!empty($msg)) {
|
||||
//[MaJ[MaJ[MaJ[MaI[MaI[MaI[MaI[MaI[MaI[MaI[MaI[MaIecho json_encode($msg)."";
|
||||
//echo json_encode($msg)."";
|
||||
echo base64_encode(gzcompress(json_encode($msg), 9))."";
|
||||
//fwrite(STDERR, colorize(json_encode($msg).' '.strlen($msg), 'yellow')." : ".colorize('sent to browser', 'green')."\n");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue