1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00

Update to movim 20150818

This commit is contained in:
src386 2015-08-19 11:28:28 +02:00
parent cb9c93f893
commit 1bef41b550
563 changed files with 1012 additions and 582 deletions

View file

@ -5,12 +5,13 @@ Movim is a decentralized social network, written in PHP and HTML5 and based on t
Warning: BETA.
Current Movim version : 20150810.
Current Movim version : 20150818.
**Changelog**
0.6b 2015-08-19
- Replace 'www-data' system user with 'movim'
- Update to upstream Movim 20150818.
0.5b 2015-08-17
- Add default port (9537)

0
sources/CHANGELOG.md Executable file → Normal file
View file

0
sources/COPYING Executable file → Normal file
View file

0
sources/INSTALL.md Executable file → Normal file
View file

View file

@ -3,7 +3,7 @@ Movim - Kickass Social Network
Movim is a decentralized social network, written in PHP and HTML5 and based on the XMPP standard protocol.
![movim logo](https://movim.eu/sites/default/files/mainc.png)
![movim logo](https://movim.eu/sites/default/files/large_0.png)
Installation
------------

0
sources/VERSION Executable file → Normal file
View file

0
sources/app/assets/js/images/marker-icon.png Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

0
sources/app/assets/js/images/marker-shadow.png Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 535 B

After

Width:  |  Height:  |  Size: 535 B

0
sources/app/assets/js/leaflet.css Executable file → Normal file
View file

0
sources/app/assets/js/leaflet.js Executable file → Normal file
View file

0
sources/app/assets/js/movim_base.js Executable file → Normal file
View file

0
sources/app/assets/js/movim_hash.js Executable file → Normal file
View file

0
sources/app/assets/js/movim_tpl.js Executable file → Normal file
View file

0
sources/app/assets/js/movim_utils.js Executable file → Normal file
View file

17
sources/app/assets/js/movim_websocket.js Executable file → Normal file
View file

@ -1,8 +1,8 @@
/**
* Movim Websocket
*
*
* This file define the websocket behaviour and handle its connection
*/
*/
WebSocket.prototype.unregister = function() {
this.send(JSON.stringify({'func' : 'unregister'}));
@ -18,7 +18,7 @@ WebSocket.prototype.admin = function(key) {
/**
* @brief Definition of the MovimWebsocket object
* @param string error
* @param string error
*/
var MovimWebsocket = {
@ -26,7 +26,7 @@ var MovimWebsocket = {
attached: new Array(),
registered: new Array(),
unregistered: false,
launchAttached : function() {
for(var i = 0; i < MovimWebsocket.attached.length; i++) {
MovimWebsocket.attached[i]();
@ -54,7 +54,9 @@ var MovimWebsocket = {
};
this.connection.onmessage = function(e) {
//console.log(e.data);
data = pako.ungzip(base64_decode(e.data), { to: 'string' });
//data = e.data;
var obj = JSON.parse(data);
@ -66,9 +68,10 @@ var MovimWebsocket = {
if(obj.func == 'disconnected') {
movim_disconnect();
}
MovimWebsocket.handle(obj);
}
MovimWebsocket.handle(data);
};
this.connection.onclose = function(e) {
@ -122,8 +125,8 @@ var MovimWebsocket = {
this.attached = new Array();
},
handle : function(json) {
var funcalls = JSON.parse(json);
handle : function(funcalls) {
//var funcalls = JSON.parse(json);
if(funcalls != null) {
for(h = 0; h < funcalls.length; h++) {
var funcall = funcalls[h];

0
sources/app/controllers/AboutController.php Executable file → Normal file
View file

0
sources/app/controllers/AccountController.php Executable file → Normal file
View file

0
sources/app/controllers/AccountnextController.php Executable file → Normal file
View file

6
sources/app/controllers/AdminController.php Executable file → Normal file
View file

@ -7,13 +7,11 @@ class AdminController extends BaseController {
function dispatch() {
session_start();
if(isset($_SESSION['admin']) && $_SESSION['admin'] == true) {
if(isset($_SESSION['admin']) && $_SESSION['admin'] == true) {
$this->page->setTitle(__('title.administration', APP_TITLE));
} else {
$this->name = 'adminlogin';
}
//session_write_close();
}
}

0
sources/app/controllers/AdminloginController.php Executable file → Normal file
View file

0
sources/app/controllers/BlogController.php Executable file → Normal file
View file

0
sources/app/controllers/ConfController.php Executable file → Normal file
View file

0
sources/app/controllers/DisconnectController.php Executable file → Normal file
View file

View file

@ -2,10 +2,15 @@
class GroupController extends BaseController {
function load() {
$this->session_only = true;
$this->session_only = false;
}
function dispatch() {
$user = new User();
if(!$user->isLogged()) {
$this->name = 'grouppublic';
}
$this->page->setTitle(__('page.groups'));
}
}

View file

@ -0,0 +1,11 @@
<?php
class GrouppublicController extends BaseController {
function load() {
$this->session_only = false;
}
function dispatch() {
$this->page->setTitle(__('page.groups'));
}
}

0
sources/app/controllers/HelpController.php Executable file → Normal file
View file

0
sources/app/controllers/InfosController.php Executable file → Normal file
View file

0
sources/app/controllers/LoginController.php Executable file → Normal file
View file

0
sources/app/controllers/MainController.php Executable file → Normal file
View file

0
sources/app/controllers/MediaController.php Executable file → Normal file
View file

0
sources/app/controllers/NewsController.php Executable file → Normal file
View file

0
sources/app/controllers/NotfoundController.php Executable file → Normal file
View file

0
sources/app/controllers/PodsController.php Executable file → Normal file
View file

0
sources/app/controllers/VisioController.php Executable file → Normal file
View file

0
sources/app/helpers/DateHelper.php Executable file → Normal file
View file

0
sources/app/helpers/StringHelper.php Executable file → Normal file
View file

0
sources/app/helpers/TimezoneHelper.php Executable file → Normal file
View file

0
sources/app/helpers/TimezoneList.php Executable file → Normal file
View file

0
sources/app/models/cache/Cache.php vendored Executable file → Normal file
View file

0
sources/app/models/cache/CacheDAO.php vendored Executable file → Normal file
View file

0
sources/app/models/caps/Caps.php Executable file → Normal file
View file

0
sources/app/models/caps/CapsDAO.php Executable file → Normal file
View file

0
sources/app/models/conference/Conference.php Executable file → Normal file
View file

0
sources/app/models/conference/ConferenceDAO.php Executable file → Normal file
View file

0
sources/app/models/config/Config.php Executable file → Normal file
View file

0
sources/app/models/config/ConfigDAO.php Executable file → Normal file
View file

248
sources/app/models/contact/Contact.php Executable file → Normal file
View file

@ -4,37 +4,37 @@ namespace modl;
class Contact extends Model {
public $jid;
protected $fn;
protected $name;
protected $date;
protected $url;
public $email;
protected $adrlocality;
protected $adrpostalcode;
protected $adrcountry;
protected $gender;
protected $marital;
protected $photobin;
protected $description;
protected $protected;
protected $privacy;
// User Mood (contain serialized array) - XEP 0107
protected $mood;
// User Activity (contain serialized array) - XEP 0108
protected $activity;
// User Nickname - XEP 0172
protected $nickname;
// User Tune - XEP 0118
protected $tuneartist;
protected $tunelenght;
@ -42,8 +42,8 @@ class Contact extends Model {
protected $tunesource;
protected $tunetitle;
protected $tunetrack;
// User Location
// User Location
protected $loclatitude;
protected $loclongitude;
protected $localtitude;
@ -68,98 +68,98 @@ class Contact extends Model {
// Datetime
public $created;
public $updated;
public function __construct() {
$this->_struct = '
{
"jid" :
"jid" :
{"type":"string", "size":128, "mandatory":true, "key":true },
"fn" :
"fn" :
{"type":"string", "size":128 },
"name" :
"name" :
{"type":"string", "size":128 },
"date" :
"date" :
{"type":"date", "size":11 },
"url" :
"url" :
{"type":"string", "size":128 },
"email" :
"email" :
{"type":"string", "size":128 },
"adrlocality" :
"adrlocality" :
{"type":"string", "size":128 },
"adrpostalcode" :
"adrpostalcode" :
{"type":"string", "size":128 },
"adrcountry" :
"adrcountry" :
{"type":"string", "size":128 },
"gender" :
"gender" :
{"type":"string", "size":1 },
"marital" :
"marital" :
{"type":"string", "size":20 },
"description" :
"description" :
{"type":"text"},
"mood" :
"mood" :
{"type":"string", "size":128 },
"activity" :
"activity" :
{"type":"string", "size":128 },
"nickname" :
"nickname" :
{"type":"string", "size":128 },
"tuneartist" :
"tuneartist" :
{"type":"string", "size":128 },
"tunelenght" :
"tunelenght" :
{"type":"int", "size":11 },
"tunerating" :
"tunerating" :
{"type":"int", "size":11 },
"tunesource" :
"tunesource" :
{"type":"string", "size":128 },
"tunetitle" :
"tunetitle" :
{"type":"string", "size":128 },
"tunetrack" :
"tunetrack" :
{"type":"string", "size":128 },
"loclatitude" :
"loclatitude" :
{"type":"string", "size":128 },
"loclongitude" :
"loclongitude" :
{"type":"string", "size":128 },
"localtitude" :
"localtitude" :
{"type":"int", "size":11 },
"loccountry" :
"loccountry" :
{"type":"string", "size":128 },
"loccountrycode" :
"loccountrycode" :
{"type":"string", "size":128 },
"locregion" :
"locregion" :
{"type":"string", "size":128 },
"locpostalcode" :
"locpostalcode" :
{"type":"string", "size":128 },
"loclocality" :
"loclocality" :
{"type":"string", "size":128 },
"locstreet" :
"locstreet" :
{"type":"string", "size":128 },
"locbuilding" :
"locbuilding" :
{"type":"string", "size":128 },
"loctext" :
"loctext" :
{"type":"text" },
"locuri" :
"locuri" :
{"type":"string", "size":128 },
"loctimestamp" :
"loctimestamp" :
{"type":"date", "size":11 },
"twitter" :
"twitter" :
{"type":"string", "size":128 },
"skype" :
"skype" :
{"type":"string", "size":128 },
"yahoo" :
"yahoo" :
{"type":"string", "size":128 },
"avatarhash" :
"avatarhash" :
{"type":"string", "size":128 },
"created" :
"created" :
{"type":"date" },
"updated" :
"updated" :
{"type":"date" }
}';
parent::__construct();
}
public function set($vcard, $jid) {
$this->jid = \echapJid($jid);
if(isset($vcard->vCard->BDAY)
&& (string)$vcard->vCard->BDAY != '')
$this->date = (string)$vcard->vCard->BDAY;
@ -167,7 +167,7 @@ class Contact extends Model {
$this->date = null;
$this->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;
@ -176,7 +176,7 @@ class Contact extends Model {
$this->marital = (string)$vcard->vCard->MARITAL->STATUS;
$this->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;
@ -187,7 +187,7 @@ class Contact extends Model {
} else {
$this->photobin = (string)$vcard->vCard->PHOTO->BINVAL;
}
$this->description = (string)$vcard->vCard->DESC;
}
@ -195,7 +195,7 @@ class Contact extends Model {
$p = new \Picture;
$p->fromBase($this->photobin);
$p->set($this->jid);
if(isset($this->email)) {
\createEmailPic(strtolower($this->jid), $this->email);
}
@ -230,7 +230,7 @@ class Contact extends Model {
return $p->get($this->jid, $sizes[$size][0], $sizes[$size][1]);
}
}
public function setLocation($stanza) {
$this->loclatitude = (string)$stanza->items->item->geoloc->lat;
$this->loclongitude = (string)$stanza->items->item->geoloc->lon;
@ -245,10 +245,10 @@ class Contact extends Model {
$this->loctext = (string)$stanza->items->item->geoloc->text;
$this->locuri = (string)$stanza->items->item->geoloc->uri;
$this->loctimestamp = date(
'Y-m-d H:i:s',
'Y-m-d H:i:s',
strtotime((string)$stanza->items->item->geoloc->timestamp));
}
public function setTune($stanza) {
$this->tuneartist = (string)$stanza->items->item->tune->artist;
$this->tunelenght = (int)$stanza->items->item->tune->lenght;
@ -257,25 +257,25 @@ class Contact extends Model {
$this->tunetitle = (string)$stanza->items->item->tune->title;
$this->tunetrack = (string)$stanza->items->item->tune->track;
}
public function setVcard4($vcard) {
if(isset($vcard->bday->date))
$this->date = $vcard->bday->date;
if(isset($vcard->bday->date) && !empty((string)$vcard->bday->date))
$this->date = (string)$vcard->bday->date;
else
$this->date = null;
$this->name = $vcard->nickname->text;
$this->fn = $vcard->fn->text;
$this->url = $vcard->url->uri;
$this->name = (string)$vcard->nickname->text;
$this->fn = (string)$vcard->fn->text;
$this->url = (string)$vcard->url->uri;
if(isset($vcard->gender))
$this->gender = $vcard->gender->sex->text;
$this->gender = (string)$vcard->gender->sex->text;
if(isset($vcard->marital))
$this->marital = $vcard->marital->status->text;
$this->adrlocality = $vcard->adr->locality;
$this->adrcountry = $vcard->adr->country;
$this->adrpostalcode = $vcard->adr->code;
$this->marital = (string)$vcard->marital->status->text;
$this->adrlocality = (string)$vcard->adr->locality;
$this->adrcountry = (string)$vcard->adr->country;
$this->adrpostalcode = (string)$vcard->adr->code;
if(isset($vcard->impp)) {
foreach($vcard->impp->children() as $c) {
@ -286,25 +286,25 @@ class Contact extends Model {
$this->twitter = str_replace('@', '', $value);
break;
case 'skype' :
$this->skype = $value;
$this->skype = (string)$value;
break;
case 'ymsgr' :
$this->yahoo = $value;
$this->yahoo = (string)$value;
break;
}
}
}
$this->email = $vcard->email->text;
$this->description = trim($vcard->note->text);
$this->email = (string)$vcard->email->text;
$this->description = trim((string)$vcard->note->text);
}
public function getPlace() {
$place = null;
if($this->loctext != '')
$place .= $this->loctext.' ';
$place .= $this->loctext.' ';
else {
if($this->locbuilding != '')
$place .= $this->locbuilding.' ';
@ -319,18 +319,18 @@ class Contact extends Model {
if($this->loccountry != '')
$place .= $this->loccountry;
}
return $place;
}
public function getTrueName() {
$truename = '';
if(isset($this->rostername))
$rostername = str_replace('\40', '', $this->rostername);
else
$rostername = '';
if(
isset($this->rostername)
&& $rostername != ''
@ -363,7 +363,7 @@ class Contact extends Model {
function getAge() {
if(isset($this->date)
&& $this->date != '0000-00-00T00:00:00+0000'
&& $this->date != '0000-00-00T00:00:00+0000'
&& $this->date != '1970-01-01 00:00:00'
&& $this->date != '1970-01-01 01:00:00'
&& $this->date != '1970-01-01T00:00:00+0000') {
@ -383,7 +383,7 @@ class Contact extends Model {
function getMarital() {
$marital = getMarital();
if($this->marital != null && $this->marital != 'none') {
return $marital[$this->marital];
}
@ -407,8 +407,6 @@ class Contact extends Model {
&& $this->date == null
&& $this->url == null
&& $this->email == null
&& $this->created == null
&& $this->updated == null
&& $this->description == null) {
return true;
} else {
@ -439,14 +437,14 @@ class PresenceContact extends Contact {
protected $value;
protected $priority;
protected $status;
// Client Informations
protected $node;
protected $ver;
// Delay - XEP 0203
protected $delay;
// Last Activity - XEP 0256
protected $last;
@ -462,35 +460,35 @@ class PresenceContact extends Contact {
$this->_struct = '
{
"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 }
}';
}
}
class RosterContact extends Contact {
@ -510,46 +508,46 @@ class RosterContact extends Contact {
protected $ver;
protected $category;
//protected $type;
public function __construct() {
parent::__construct();
$this->_struct = "
{
'rostername' :
'rostername' :
{'type':'string', 'size':128 },
'rosterask' :
'rosterask' :
{'type':'string', 'size':128 },
'rostersubscription' :
'rostersubscription' :
{'type':'string', 'size':8 },
'groupname' :
'groupname' :
{'type':'string', 'size':128 },
'resource' :
'resource' :
{'type':'string', 'size':128, 'key':true },
'value' :
'value' :
{'type':'int', 'size':11, 'mandatory':true },
'chaton' :
'chaton' :
{'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 },
'mucaffiliation' :
'mucaffiliation' :
{'type':'string', 'size':32 },
'mucrole' :
'mucrole' :
{'type':'string', 'size':32 }
}";
}
// This method is only use on the connection
public function setPresence($p) {
$this->resource = $p->resource;

0
sources/app/models/contact/ContactDAO.php Executable file → Normal file
View file

25
sources/app/models/item/Item.php Executable file → Normal file
View file

@ -14,28 +14,28 @@ class Item extends Model {
public $subscription;
public $num;
public $sub;
public function __construct() {
$this->_struct = '
{
"server" :
"server" :
{"type":"string", "size":64, "mandatory":true, "key":true },
"jid" :
"jid" :
{"type":"string", "size":128, "mandatory":true, "key":true },
"node" :
"node" :
{"type":"string", "size":128, "mandatory":true, "key":true },
"creator" :
"creator" :
{"type":"string", "size":128 },
"name" :
"name" :
{"type":"string", "size":128 },
"created" :
"created" :
{"type":"date"},
"description" :
"description" :
{"type":"text" },
"updated" :
"updated" :
{"type":"date"}
}';
parent::__construct();
}
@ -72,10 +72,10 @@ class Item extends Model {
break;
}
}
$this->updated = date('Y-m-d H:i:s');
}
public function getName() {
if($this->name != null)
return $this->name;
@ -89,4 +89,5 @@ class Item extends Model {
class Server extends Model {
public $server;
public $number;
public $name;
}

131
sources/app/models/item/ItemDAO.php Executable file → Normal file
View file

@ -2,7 +2,7 @@
namespace modl;
class ItemDAO extends SQL {
class ItemDAO extends SQL {
function set(Item $item, $insert_only = false) {
if(!$insert_only) {
$this->_sql = '
@ -15,9 +15,9 @@ class ItemDAO extends SQL {
where server = :server
and jid = :jid
and node = :node';
$this->prepare(
'Item',
'Item',
array(
'name' => $item->name,
'created' => $item->created,
@ -29,10 +29,10 @@ class ItemDAO extends SQL {
'description' => $item->description
)
);
$this->run('Item');
}
if(!$this->_effective || $insert_only) {
$this->_sql = '
insert into item
@ -55,9 +55,9 @@ class ItemDAO extends SQL {
:updated,
:description
)';
$this->prepare(
'Item',
'Item',
array(
'name' => $item->name,
'creator' => $item->creator,
@ -69,38 +69,38 @@ class ItemDAO extends SQL {
'description' => $item->description
)
);
$this->run('Item');
}
}
function getServers() {
$this->_sql = '
select server, count(node) as number
select server, count(node) as number
from item
where node not like :node
group by server
order by number desc';
$this->prepare(
'Item',
array(
'node' => 'urn:xmpp:microblog:0:comments%'
)
);
return $this->run('Server');
return $this->run('Server');
}
function getConferenceServers() {
$this->_sql = '
select server, count(node) as number
select server, count(node) as number
from item
where node not like :node
and node = :name
group by server
order by number desc';
$this->prepare(
'Item',
array(
@ -109,19 +109,20 @@ class ItemDAO extends SQL {
'name' => ''
)
);
return $this->run('Server');
return $this->run('Server');
}
function getGroupServers() {
$this->_sql = '
select server, count(node) as number
select server, count(item.node) as number, caps.name
from item
where node not like :node
and node != :name
group by server
left outer join caps on caps.node = item.server
where item.node not like :node
and item.node != :name
group by server, caps.name
order by number desc';
$this->prepare(
'Item',
array(
@ -130,12 +131,11 @@ class ItemDAO extends SQL {
'name' => ''
)
);
return $this->run('Server');
return $this->run('Server');
}
function getItems($server) {
$this->_sql = '
select * from item
left outer join (
@ -148,14 +148,14 @@ class ItemDAO extends SQL {
where server = :server
group by node) as sub
on sub.node = item.node
left outer join (select server, node, subscription from subscription where jid = :node)
as s on s.server = item.server
left outer join (select server, node, subscription from subscription where jid = :node)
as s on s.server = item.server
and s.node = item.node
where item.server = :server
and item.node != \'\'
order by name, item.node
';
$this->prepare(
'Item',
array(
@ -164,8 +164,43 @@ class ItemDAO extends SQL {
'server' => $server
)
);
return $this->run('Item');
return $this->run('Item');
}
function getGateways($server) {
$this->_sql = '
select * from item
left outer join caps on caps.node = item.jid
where server = :server
and category = \'gateway\'';
$this->prepare(
'Item',
array(
'server' => $server
)
);
return $this->run('Item');
}
function getUpload($server) {
$this->_sql = '
select * from item
left outer join caps on caps.node = item.jid
where server = :server
and category = \'store\'
and type = \'file\'';
$this->prepare(
'Item',
array(
'server' => $server
)
);
return $this->run('Item', 'item');
}
function getUpdatedItems($limitf = false, $limitr = false) {
@ -178,32 +213,32 @@ class ItemDAO extends SQL {
order by num desc
';
if($limitr)
if($limitr)
$this->_sql = $this->_sql.' limit '.$limitr.' offset '.$limitf;
$this->prepare(
'Item',
array(
'node' => 'urn:xmpp:microblog%'
)
);
return $this->run('Item');
return $this->run('Item');
}
function deleteItems($server) {
$this->_sql = '
delete from item
where server= :server';
$this->prepare(
'Item',
array(
'server' => $server
)
);
return $this->run('Item');
return $this->run('Item');
}
function deleteItem($server, $item) {
@ -211,7 +246,7 @@ class ItemDAO extends SQL {
delete from item
where server = :server
and node = :node';
$this->prepare(
'Item',
array(
@ -219,25 +254,25 @@ class ItemDAO extends SQL {
'node' => $item
)
);
return $this->run('Item');
return $this->run('Item');
}
function getItem($server, $item) {
$this->_sql = '
select * from item
where
where
node = :node
and server = :server';
$this->prepare(
'Item',
'Item',
array(
'node' => $item,
'server' => $server
)
);
return $this->run('Item', 'item');
}
}

0
sources/app/models/message/Message.php Executable file → Normal file
View file

0
sources/app/models/message/MessageDAO.php Executable file → Normal file
View file

6
sources/app/models/postn/Postn.php Executable file → Normal file
View file

@ -90,7 +90,8 @@ class Postn extends Model {
switch($c->attributes()->type) {
case 'html':
case 'xhtml':
return (string)$c->asXML();
if($c->getName() == 'content') return $c->children()->asXML();
else return (string)$c->asXML();
break;
case 'text':
default :
@ -284,7 +285,8 @@ class Postn extends Model {
public function isMine() {
$user = new \User();
if($this->origin == $user->getLogin())
if($this->aid == $user->getLogin()
|| $this->origin == $user->getLogin())
return true;
else
return false;

1
sources/app/models/postn/PostnDAO.php Executable file → Normal file
View file

@ -535,6 +535,7 @@ class PostnDAO extends SQL {
node != \'urn:xmpp:microblog:0\'
and postn.node not like \'urn:xmpp:microblog:0:comments/%\'
and postn.node not like \'urn:xmpp:inbox\'
and postn.origin not like \'nsfw%\'
and ((postn.origin, node) not in (select server, node from subscription where jid = :origin))
order by published desc
';

0
sources/app/models/presence/Presence.php Executable file → Normal file
View file

0
sources/app/models/presence/PresenceDAO.php Executable file → Normal file
View file

0
sources/app/models/privacy/Privacy.php Executable file → Normal file
View file

0
sources/app/models/privacy/PrivacyDAO.php Executable file → Normal file
View file

0
sources/app/models/rosterlink/RosterLink.php Executable file → Normal file
View file

0
sources/app/models/rosterlink/RosterLinkDAO.php Executable file → Normal file
View file

0
sources/app/models/sessionx/Sessionx.php Executable file → Normal file
View file

0
sources/app/models/sessionx/SessionxDAO.php Executable file → Normal file
View file

25
sources/app/models/subscription/Subscription.php Executable file → Normal file
View file

@ -2,7 +2,7 @@
namespace modl;
class Subscription extends Model {
class Subscription extends Model {
public $jid;
public $server;
public $node;
@ -13,28 +13,29 @@ class Subscription extends Model {
public $tags;
public $timestamp;
public $name;
public $servicename;
public function __construct() {
$this->_struct = '
{
"jid" :
"jid" :
{"type":"string", "size":64, "mandatory":true, "key":true },
"server" :
"server" :
{"type":"string", "size":64, "mandatory":true, "key":true },
"node" :
"node" :
{"type":"string", "size":128, "mandatory":true, "key":true },
"subscription" :
"subscription" :
{"type":"string", "size":128, "mandatory":true },
"subid" :
"subid" :
{"type":"string", "size":128 },
"title" :
"title" :
{"type":"string", "size":128 },
"tags" :
"tags" :
{"type":"text" },
"timestamp" :
"timestamp" :
{"type":"date" }
}';
parent::__construct();
}
@ -46,7 +47,7 @@ class Subscription extends Model {
$this->subscription = (string)$s->attributes()->subscription;
$this->subid = (string)$s->attributes()->subid;
$this->tags = serialize(array());
if($this->subid = '')
$this->subid = 'default';
}

82
sources/app/models/subscription/SubscriptionDAO.php Executable file → Normal file
View file

@ -13,10 +13,10 @@ class SubscriptionDAO extends SQL {
where jid = :jid
and server = :server
and node = :node';
$this->prepare(
'Subscription',
array(
'Subscription',
array(
'subscription' => $s->subscription,
'timestamp' => date(DATE_ISO8601),
'jid' => $s->jid,
@ -26,17 +26,17 @@ class SubscriptionDAO extends SQL {
'subid' => $s->subid
)
);
$this->run('Subscription');
if(!$this->_effective) {
$this->_sql = '
insert into subscription
(jid, server, node, subscription, subid, tags, timestamp)
values (:jid, :server, :node, :subscription, :subid, :tags, :timestamp)';
$this->prepare(
'Subscription',
'Subscription',
array(
'subscription' => $s->subscription,
'timestamp' => date(DATE_ISO8601),
@ -47,61 +47,65 @@ class SubscriptionDAO extends SQL {
'subid' => $s->subid
)
);
$this->run('Subscription');
}
}
function get($server, $node) {
$this->_sql = '
select * from subscription
where jid = :jid
and server = :server
and node = :node';
$this->prepare(
'Subscription',
'Subscription',
array(
'jid' => $this->_user,
'server' => $server,
'node' => $node
)
);
return $this->run('Subscription');
}
function getSubscribed() {
$this->_sql = '
select
subscription.jid,
subscription.server,
subscription.node,
select
subscription.jid,
subscription.server,
subscription.node,
subscription,
item.name,
item.description
item.description,
caps.name as servicename
from subscription
left outer join item
on item.server = subscription.server
left outer join item
on item.server = subscription.server
and item.node = subscription.node
left outer join caps
on caps.node = subscription.server
where subscription.jid = :jid
group by
subscription.server,
subscription.node,
subscription.jid,
group by
subscription.server,
subscription.node,
subscription.jid,
subscription,
caps.name,
item.name,
item.description
order by
order by
subscription.server';
$this->prepare(
'Subscription',
'Subscription',
array(
'jid' => $this->_user
)
);
return $this->run('Subscription');
}
@ -109,36 +113,36 @@ class SubscriptionDAO extends SQL {
$this->_sql = '
delete from subscription
where jid = :jid';
$this->prepare(
'Subscription',
'Subscription',
array(
'jid' => $this->_user
)
);
return $this->run('Subscription');
}
function deleteNode($server, $node) {
$this->_sql = '
delete from subscription
where jid = :jid
and server = :server
and node = :node';
$this->prepare(
'Subscription',
'Subscription',
array(
'jid' => $this->_user,
'server' => $server,
'node' => $node
)
);
return $this->run('Subscription');
}
function deleteNodeSubid($server, $node, $subid) {
$this->_sql = '
delete from subscription
@ -146,9 +150,9 @@ class SubscriptionDAO extends SQL {
and server = :server
and node = :node
and subid = :subid';
$this->prepare(
'Subscription',
'Subscription',
array(
'jid' => $this->_user,
'server' => $server,
@ -156,7 +160,7 @@ class SubscriptionDAO extends SQL {
'subid' => $subid,
)
);
return $this->run('Subscription');
}
}

0
sources/app/views/about.tpl Executable file → Normal file
View file

0
sources/app/views/account.tpl Executable file → Normal file
View file

0
sources/app/views/accountnext.tpl Executable file → Normal file
View file

0
sources/app/views/admin.tpl Executable file → Normal file
View file

0
sources/app/views/adminlogin.tpl Executable file → Normal file
View file

6
sources/app/views/blog.tpl Executable file → Normal file
View file

@ -1,11 +1,7 @@
<main>
<section>
<div>
<?php //$this->widget('Tabs');?>
<div style="background-color: #EEE;">
<?php $this->widget('Blog');?>
<?php //$this->widget('ContactSummary');?>
<?php //$this->widget('ContactCard');?>
</div>
</section>
</main>

View file

@ -10,6 +10,7 @@
<?php $this->widget('Chats');?>
<?php $this->widget('Rooms');?>
</div>
<?php $this->widget('Upload');?>
<?php $this->widget('Chat');?>
</section>
</main>

0
sources/app/views/conf.tpl Executable file → Normal file
View file

0
sources/app/views/disconnect.tpl Executable file → Normal file
View file

0
sources/app/views/feed.tpl Executable file → Normal file
View file

0
sources/app/views/friend.tpl Executable file → Normal file
View file

View file

@ -1,3 +1,5 @@
<?php $this->widget('Upload'); ?>
<nav class="color dark">
<?php $this->widget('Navigation');?>
<?php $this->widget('Presence');?>

View file

@ -0,0 +1,7 @@
<main>
<section>
<div style="background-color: #EEE;">
<?php $this->widget('Blog');?>
</div>
</section>
</main>

0
sources/app/views/help.tpl Executable file → Normal file
View file

0
sources/app/views/infos.tpl Executable file → Normal file
View file

0
sources/app/views/login.tpl Executable file → Normal file
View file

0
sources/app/views/main.tpl Executable file → Normal file
View file

0
sources/app/views/media.tpl Executable file → Normal file
View file

1
sources/app/views/news.tpl Executable file → Normal file
View file

@ -1,4 +1,5 @@
<?php $this->widget('Init');?>
<?php $this->widget('Upload');?>
<nav class="color dark">
<?php $this->widget('Navigation');?>

0
sources/app/views/notfound.tpl Executable file → Normal file
View file

0
sources/app/views/page.tpl Executable file → Normal file
View file

0
sources/app/views/pods.tpl Executable file → Normal file
View file

0
sources/app/views/room.tpl Executable file → Normal file
View file

0
sources/app/views/share.tpl Executable file → Normal file
View file

0
sources/app/views/visio.tpl Executable file → Normal file
View file

0
sources/app/widgets/.dir-locals.el Executable file → Normal file
View file

0
sources/app/widgets/About/About.php Executable file → Normal file
View file

0
sources/app/widgets/About/about.tpl Executable file → Normal file
View file

0
sources/app/widgets/About/locales.ini Executable file → Normal file
View file

View file

@ -3,6 +3,7 @@
use Moxl\Xec\Action\Register\ChangePassword;
use Moxl\Xec\Action\Register\Remove;
use Moxl\Xec\Action\Register\Get;
use Moxl\Xec\Action\Register\Set;
use Respect\Validation\Validator;
class Account extends WidgetBase
@ -12,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');
}
function onPasswordChanged()
@ -41,6 +42,7 @@ class Account extends WidgetBase
$form = $xml->getHTML($content->x->asXML());
$view->assign('form', $form);
$view->assign('from', $package->from);
$view->assign('attributes', $content->attributes());
$view->assign('actions', null);
if(isset($content->actions)) {
@ -91,7 +93,7 @@ class Account extends WidgetBase
$da->request();
}
function ajaxRegister($server)
function ajaxGetRegistration($server)
{
if(!$this->validateServer($server)) return;
@ -100,6 +102,15 @@ class Account extends WidgetBase
->request();
}
function ajaxRegister($server, $form)
{
if(!$this->validateServer($server)) return;
$s = new Set;
$s->setTo($server)
->setData($form)
->request();
}
private function validateServer($server)
{
$validate_server = Validator::string()->noWhitespace()->length(6, 80);
@ -109,5 +120,7 @@ class Account extends WidgetBase
function display()
{
$id = new \Modl\ItemDAO;
$this->view->assign('gateway', $id->getGateways($this->user->getServer()));
}
}

View file

@ -1,5 +1,5 @@
<section class="scroll">
<form name="command" data-sessionid="{$attributes->sessionid}" data-node="{$attributes->node}">
<form name="register" data-sessionid="{$attributes->sessionid}" data-node="{$attributes->node}">
{$form}
</form>
</section>
@ -7,6 +7,9 @@
<a onclick="Dialog.clear()" class="button flat">
{$c->__('button.close')}
</a>
<a onclick="Account_ajaxRegister('{$from}', movim_form_to_json('register')); Dialog.clear();" class="button flat">
{$c->__('button.submit')}
</a>
{if="$actions != null"}
{if="isset($actions->next)"}
<a onclick="AdHoc.submit()" class="button flat">

View file

@ -1,4 +1,21 @@
<div class="tabelem" title="{$c->__('account.title')}" id="account_widget" >
<div class="tabelem" title="{$c->__('account.title')}" id="account_widget">
{if="isset($gateway)"}
<ul class="active middle divided">
<li class="subheader">{$c->__('account.gateway_title')}</li>
{loop="$gateway"}
<li class="condensed action" onclick="Account_ajaxGetRegistration('{$value->node}')">
<div class="action">
<i class="zmdi zmdi-chevron-right"></i>
</div>
<span class="icon">
<i class="zmdi zmdi-swap"></i>
</span>
<span>{$value->name}</span>
<p>{$value->node}</p>
</li>
{/loop}
</ul>
{/if}
<ul class="middle active divided ">
<li class="subheader">{$c->__('account.password_change_title')}</li>
<li>

View file

@ -10,3 +10,4 @@ delete_title = Delete my account
delete = Delete your account
delete_text = You will delete your XMPP account and all the relative information linked to it (profile, contacts and publications).
delete_text_confirm = "Are you sure that you want to delete it ?"
gateway_title = Gateway

0
sources/app/widgets/AccountNext/AccountNext.php Executable file → Normal file
View file

0
sources/app/widgets/AccountNext/_accountnext_form.tpl Executable file → Normal file
View file

0
sources/app/widgets/AccountNext/accountnext.css Executable file → Normal file
View file

Some files were not shown because too many files have changed in this diff Show more