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

Merge branch 'dev'

This commit is contained in:
src386 2015-08-19 13:55:19 +02:00
commit 089a8fbe0d
568 changed files with 1064 additions and 599 deletions

View file

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

View file

@ -11,7 +11,7 @@
dir="YHDIR" dir="YHDIR"
cmd="php daemon.php https://YHURL YHPORT" cmd="php daemon.php https://YHURL YHPORT"
user="www-data" user="movim"
name=`basename $0` name=`basename $0`
pid_file="/var/run/$name.pid" pid_file="/var/run/$name.pid"

View file

@ -3,7 +3,7 @@ Description=Movim daemon
After=nginx.service network.target local-fs.target After=nginx.service network.target local-fs.target
[Service] [Service]
User=www-data User=movim
Type=simple Type=simple
ExecStart=/usr/bin/php daemon.php https://YHURL YHPORT ExecStart=/usr/bin/php daemon.php https://YHURL YHPORT
WorkingDirectory=YHDIR WorkingDirectory=YHDIR

View file

@ -54,24 +54,28 @@ sudo apt-get install php5-gd php5-curl php5-imagick php5-cli -y
final_path=/var/www/movim final_path=/var/www/movim
sudo mkdir -p $final_path sudo mkdir -p $final_path
sudo cp -a ../sources/* $final_path sudo cp -a ../sources/* $final_path
sudo chown -R www-data: $final_path
# Create movim system user and set permissions
sudo useradd -d /var/www/movim -s /bin/sh movim
sudo chown -R movim:www-data $final_path
sudo chmod -R 750 $final_path
# Install PHP dependencies # Install PHP dependencies
sudo su -c "curl -sS https://getcomposer.org/installer | php -- --install-dir=$final_path" -s /bin/sh www-data sudo su -c "curl -sS https://getcomposer.org/installer | php -- --install-dir=$final_path" movim
sudo su -c "cd $final_path && php composer.phar install" -s /bin/sh www-data sudo su -c "cd $final_path && php composer.phar install" movim
# Movim configuration # Movim configuration
sudo cp $final_path/config/db.example.inc.php $final_path/config/db.inc.php sudo cp $final_path/config/db.example.inc.php $final_path/config/db.inc.php
sudo sed -i "s@'username' => 'username'@'username' => '$db_user'@g" $final_path/config/db.inc.php sudo sed -i "s@'username' => 'username'@'username' => '$db_user'@g" $final_path/config/db.inc.php
sudo sed -i "s@'password' => 'password'@'password' => '$db_pwd'@g" $final_path/config/db.inc.php sudo sed -i "s@'password' => 'password'@'password' => '$db_pwd'@g" $final_path/config/db.inc.php
sudo sed -i "s@/ws/@$path/ws/@g" $final_path/app/assets/js/movim_websocket.js sudo sed -i "s@/ws/@$path/ws/@g" $final_path/app/assets/js/movim_websocket.js
sudo su -c "cd $final_path && php mud.php db set" -s /bin/sh www-data sudo su -c "cd $final_path && php mud.php db set" movim
sudo su -c "cd $final_path && php mud.php config locale:$language" sudo su -c "cd $final_path && php mud.php config locale:$language" movim
sudo su -c "cd $final_path && php mud.php config loglevel:1" sudo su -c "cd $final_path && php mud.php config loglevel:1" movim
sudo su -c "cd $final_path && php mud.php config environment:production" sudo su -c "cd $final_path && php mud.php config environment:production" movim
sudo su -c "cd $final_path && php mud.php config timezone:`cat /etc/timezone`" sudo su -c "cd $final_path && php mud.php config timezone:`cat /etc/timezone`" movim
sudo su -c "cd $final_path && php mud.php config username:$admin" sudo su -c "cd $final_path && php mud.php config username:$admin" movim
sudo su -c "cd $final_path && php mud.php config password:`echo -n $password | sha1sum | awk '{print $1}'`" sudo su -c "cd $final_path && php mud.php config password:`echo -n $password | sha1sum | awk '{print $1}'`" movim
sudo yunohost app addaccess movim -u $admin sudo yunohost app addaccess movim -u $admin
# Copy init script or systemd service # Copy init script or systemd service

View file

@ -5,7 +5,8 @@ db_name=movim
root_pwd=$(sudo cat /etc/yunohost/mysql) root_pwd=$(sudo cat /etc/yunohost/mysql)
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;" mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
# Removing executable files # Removing executable files and user
sudo userdel movim
sudo rm -rf /var/www/movim sudo rm -rf /var/www/movim
domain=$(sudo yunohost app setting movim domain) domain=$(sudo yunohost app setting movim domain)
sudo rm -f /etc/nginx/conf.d/$domain.d/movim.conf sudo rm -f /etc/nginx/conf.d/$domain.d/movim.conf

View file

@ -6,15 +6,42 @@ path=$(sudo yunohost app setting movim path)
# Install Movim files # Install Movim files
final_path=/var/www/movim final_path=/var/www/movim
sudo cp -a ../sources/* $final_path sudo cp -a ../sources/* $final_path
sudo chown -R www-data: $final_path #sudo chown -R www-data: $final_path
# Upgrade PHP dependencies # Create movim user if not exists and set permissions
#sudo su -c "curl -sS https://getcomposer.org/installer | php -- --install-dir=$final_path" -s /bin/sh www-data if grep -q movim /etc/passwd; then
#sudo su -c "cd $final_path && php composer.phar install" -s /bin/sh www-data sudo chown -R movim:www-data $final_path
sudo chmod -R 750 $final_path
else
sudo useradd -s /bin/sh -d $final_path movim
sudo chown -R movim:www-data $final_path
sudo chmod -R 750 $final_path
fi
# Update PHP dependencies
sudo su -c "curl -sS https://getcomposer.org/installer | php -- --install-dir=$final_path" movim
sudo su -c "cd $final_path && php composer.phar install" movim
# Movim configuration # Movim configuration
sudo sed -i "s@/ws/@$path/ws/@g" $final_path/app/assets/js/movim_websocket.js sudo sed -i "s@/ws/@$path/ws/@g" $final_path/app/assets/js/movim_websocket.js
# Update init scripts
initcheck=`pgrep -ox systemd`
if [ "$initcheck" = "1" ];
then
sudo systemctl stop movim.service
sudo systemctl disable movim.service
sudo cp ../conf/movim.service /lib/systemd/system/
sudo systemctl enable movim.service
sudo systemctl start movim.service
else
sudo /etc/init.d/movim stop
sudo cp ../conf/movim.init /etc/init.d/movim
sudo chmod 755 /etc/init.d/movim
sudo update-rc.d movim defaults
sudo /etc/init.d/movim start
fi
# Reload # Reload
sudo yunohost app ssowatconf sudo yunohost app ssowatconf
sudo movim restart sudo movim restart

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 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 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 * Movim Websocket
* *
* This file define the websocket behaviour and handle its connection * This file define the websocket behaviour and handle its connection
*/ */
WebSocket.prototype.unregister = function() { WebSocket.prototype.unregister = function() {
this.send(JSON.stringify({'func' : 'unregister'})); this.send(JSON.stringify({'func' : 'unregister'}));
@ -18,7 +18,7 @@ WebSocket.prototype.admin = function(key) {
/** /**
* @brief Definition of the MovimWebsocket object * @brief Definition of the MovimWebsocket object
* @param string error * @param string error
*/ */
var MovimWebsocket = { var MovimWebsocket = {
@ -26,7 +26,7 @@ var MovimWebsocket = {
attached: new Array(), attached: new Array(),
registered: new Array(), registered: new Array(),
unregistered: false, unregistered: false,
launchAttached : function() { launchAttached : function() {
for(var i = 0; i < MovimWebsocket.attached.length; i++) { for(var i = 0; i < MovimWebsocket.attached.length; i++) {
MovimWebsocket.attached[i](); MovimWebsocket.attached[i]();
@ -54,7 +54,9 @@ var MovimWebsocket = {
}; };
this.connection.onmessage = function(e) { this.connection.onmessage = function(e) {
//console.log(e.data);
data = pako.ungzip(base64_decode(e.data), { to: 'string' }); data = pako.ungzip(base64_decode(e.data), { to: 'string' });
//data = e.data;
var obj = JSON.parse(data); var obj = JSON.parse(data);
@ -66,9 +68,10 @@ var MovimWebsocket = {
if(obj.func == 'disconnected') { if(obj.func == 'disconnected') {
movim_disconnect(); movim_disconnect();
} }
MovimWebsocket.handle(obj);
} }
MovimWebsocket.handle(data);
}; };
this.connection.onclose = function(e) { this.connection.onclose = function(e) {
@ -122,8 +125,8 @@ var MovimWebsocket = {
this.attached = new Array(); this.attached = new Array();
}, },
handle : function(json) { handle : function(funcalls) {
var funcalls = JSON.parse(json); //var funcalls = JSON.parse(json);
if(funcalls != null) { if(funcalls != null) {
for(h = 0; h < funcalls.length; h++) { for(h = 0; h < funcalls.length; h++) {
var funcall = funcalls[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() { function dispatch() {
session_start(); session_start();
if(isset($_SESSION['admin']) && $_SESSION['admin'] == true) { if(isset($_SESSION['admin']) && $_SESSION['admin'] == true) {
$this->page->setTitle(__('title.administration', APP_TITLE)); $this->page->setTitle(__('title.administration', APP_TITLE));
} else { } else {
$this->name = 'adminlogin'; $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 { class GroupController extends BaseController {
function load() { function load() {
$this->session_only = true; $this->session_only = false;
} }
function dispatch() { function dispatch() {
$user = new User();
if(!$user->isLogged()) {
$this->name = 'grouppublic';
}
$this->page->setTitle(__('page.groups')); $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 { class Contact extends Model {
public $jid; public $jid;
protected $fn; protected $fn;
protected $name; protected $name;
protected $date; protected $date;
protected $url; protected $url;
public $email; public $email;
protected $adrlocality; protected $adrlocality;
protected $adrpostalcode; protected $adrpostalcode;
protected $adrcountry; protected $adrcountry;
protected $gender; protected $gender;
protected $marital; protected $marital;
protected $photobin; protected $photobin;
protected $description; protected $description;
protected $protected; protected $protected;
protected $privacy; protected $privacy;
// User Mood (contain serialized array) - XEP 0107 // User Mood (contain serialized array) - XEP 0107
protected $mood; protected $mood;
// User Activity (contain serialized array) - XEP 0108 // User Activity (contain serialized array) - XEP 0108
protected $activity; protected $activity;
// User Nickname - XEP 0172 // User Nickname - XEP 0172
protected $nickname; protected $nickname;
// User Tune - XEP 0118 // User Tune - XEP 0118
protected $tuneartist; protected $tuneartist;
protected $tunelenght; protected $tunelenght;
@ -42,8 +42,8 @@ class Contact extends Model {
protected $tunesource; protected $tunesource;
protected $tunetitle; protected $tunetitle;
protected $tunetrack; protected $tunetrack;
// User Location // User Location
protected $loclatitude; protected $loclatitude;
protected $loclongitude; protected $loclongitude;
protected $localtitude; protected $localtitude;
@ -68,98 +68,98 @@ class Contact extends Model {
// Datetime // Datetime
public $created; public $created;
public $updated; public $updated;
public function __construct() { public function __construct() {
$this->_struct = ' $this->_struct = '
{ {
"jid" : "jid" :
{"type":"string", "size":128, "mandatory":true, "key":true }, {"type":"string", "size":128, "mandatory":true, "key":true },
"fn" : "fn" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"name" : "name" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"date" : "date" :
{"type":"date", "size":11 }, {"type":"date", "size":11 },
"url" : "url" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"email" : "email" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"adrlocality" : "adrlocality" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"adrpostalcode" : "adrpostalcode" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"adrcountry" : "adrcountry" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"gender" : "gender" :
{"type":"string", "size":1 }, {"type":"string", "size":1 },
"marital" : "marital" :
{"type":"string", "size":20 }, {"type":"string", "size":20 },
"description" : "description" :
{"type":"text"}, {"type":"text"},
"mood" : "mood" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"activity" : "activity" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"nickname" : "nickname" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"tuneartist" : "tuneartist" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"tunelenght" : "tunelenght" :
{"type":"int", "size":11 }, {"type":"int", "size":11 },
"tunerating" : "tunerating" :
{"type":"int", "size":11 }, {"type":"int", "size":11 },
"tunesource" : "tunesource" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"tunetitle" : "tunetitle" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"tunetrack" : "tunetrack" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"loclatitude" : "loclatitude" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"loclongitude" : "loclongitude" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"localtitude" : "localtitude" :
{"type":"int", "size":11 }, {"type":"int", "size":11 },
"loccountry" : "loccountry" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"loccountrycode" : "loccountrycode" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"locregion" : "locregion" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"locpostalcode" : "locpostalcode" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"loclocality" : "loclocality" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"locstreet" : "locstreet" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"locbuilding" : "locbuilding" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"loctext" : "loctext" :
{"type":"text" }, {"type":"text" },
"locuri" : "locuri" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"loctimestamp" : "loctimestamp" :
{"type":"date", "size":11 }, {"type":"date", "size":11 },
"twitter" : "twitter" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"skype" : "skype" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"yahoo" : "yahoo" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"avatarhash" : "avatarhash" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"created" : "created" :
{"type":"date" }, {"type":"date" },
"updated" : "updated" :
{"type":"date" } {"type":"date" }
}'; }';
parent::__construct(); parent::__construct();
} }
public function set($vcard, $jid) { public function set($vcard, $jid) {
$this->jid = \echapJid($jid); $this->jid = \echapJid($jid);
if(isset($vcard->vCard->BDAY) if(isset($vcard->vCard->BDAY)
&& (string)$vcard->vCard->BDAY != '') && (string)$vcard->vCard->BDAY != '')
$this->date = (string)$vcard->vCard->BDAY; $this->date = (string)$vcard->vCard->BDAY;
@ -167,7 +167,7 @@ class Contact extends Model {
$this->date = null; $this->date = null;
$this->date = date(DATE_ISO8601, strtotime($this->date)); $this->date = date(DATE_ISO8601, strtotime($this->date));
$this->name = (string)$vcard->vCard->NICKNAME; $this->name = (string)$vcard->vCard->NICKNAME;
$this->fn = (string)$vcard->vCard->FN; $this->fn = (string)$vcard->vCard->FN;
$this->url = (string)$vcard->vCard->URL; $this->url = (string)$vcard->vCard->URL;
@ -176,7 +176,7 @@ class Contact extends Model {
$this->marital = (string)$vcard->vCard->MARITAL->STATUS; $this->marital = (string)$vcard->vCard->MARITAL->STATUS;
$this->email = (string)$vcard->vCard->EMAIL->USERID; $this->email = (string)$vcard->vCard->EMAIL->USERID;
$this->adrlocality = (string)$vcard->vCard->ADR->LOCALITY; $this->adrlocality = (string)$vcard->vCard->ADR->LOCALITY;
$this->adrpostalcode = (string)$vcard->vCard->ADR->PCODE; $this->adrpostalcode = (string)$vcard->vCard->ADR->PCODE;
$this->adrcountry = (string)$vcard->vCard->ADR->CTRY; $this->adrcountry = (string)$vcard->vCard->ADR->CTRY;
@ -187,7 +187,7 @@ class Contact extends Model {
} else { } else {
$this->photobin = (string)$vcard->vCard->PHOTO->BINVAL; $this->photobin = (string)$vcard->vCard->PHOTO->BINVAL;
} }
$this->description = (string)$vcard->vCard->DESC; $this->description = (string)$vcard->vCard->DESC;
} }
@ -195,7 +195,7 @@ class Contact extends Model {
$p = new \Picture; $p = new \Picture;
$p->fromBase($this->photobin); $p->fromBase($this->photobin);
$p->set($this->jid); $p->set($this->jid);
if(isset($this->email)) { if(isset($this->email)) {
\createEmailPic(strtolower($this->jid), $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]); return $p->get($this->jid, $sizes[$size][0], $sizes[$size][1]);
} }
} }
public function setLocation($stanza) { public function setLocation($stanza) {
$this->loclatitude = (string)$stanza->items->item->geoloc->lat; $this->loclatitude = (string)$stanza->items->item->geoloc->lat;
$this->loclongitude = (string)$stanza->items->item->geoloc->lon; $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->loctext = (string)$stanza->items->item->geoloc->text;
$this->locuri = (string)$stanza->items->item->geoloc->uri; $this->locuri = (string)$stanza->items->item->geoloc->uri;
$this->loctimestamp = date( $this->loctimestamp = date(
'Y-m-d H:i:s', 'Y-m-d H:i:s',
strtotime((string)$stanza->items->item->geoloc->timestamp)); strtotime((string)$stanza->items->item->geoloc->timestamp));
} }
public function setTune($stanza) { public function setTune($stanza) {
$this->tuneartist = (string)$stanza->items->item->tune->artist; $this->tuneartist = (string)$stanza->items->item->tune->artist;
$this->tunelenght = (int)$stanza->items->item->tune->lenght; $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->tunetitle = (string)$stanza->items->item->tune->title;
$this->tunetrack = (string)$stanza->items->item->tune->track; $this->tunetrack = (string)$stanza->items->item->tune->track;
} }
public function setVcard4($vcard) { public function setVcard4($vcard) {
if(isset($vcard->bday->date)) if(isset($vcard->bday->date) && !empty((string)$vcard->bday->date))
$this->date = $vcard->bday->date; $this->date = (string)$vcard->bday->date;
else else
$this->date = null; $this->date = null;
$this->name = $vcard->nickname->text; $this->name = (string)$vcard->nickname->text;
$this->fn = $vcard->fn->text; $this->fn = (string)$vcard->fn->text;
$this->url = $vcard->url->uri; $this->url = (string)$vcard->url->uri;
if(isset($vcard->gender)) if(isset($vcard->gender))
$this->gender = $vcard->gender->sex->text; $this->gender = (string)$vcard->gender->sex->text;
if(isset($vcard->marital)) if(isset($vcard->marital))
$this->marital = $vcard->marital->status->text; $this->marital = (string)$vcard->marital->status->text;
$this->adrlocality = $vcard->adr->locality; $this->adrlocality = (string)$vcard->adr->locality;
$this->adrcountry = $vcard->adr->country; $this->adrcountry = (string)$vcard->adr->country;
$this->adrpostalcode = $vcard->adr->code; $this->adrpostalcode = (string)$vcard->adr->code;
if(isset($vcard->impp)) { if(isset($vcard->impp)) {
foreach($vcard->impp->children() as $c) { foreach($vcard->impp->children() as $c) {
@ -286,25 +286,25 @@ class Contact extends Model {
$this->twitter = str_replace('@', '', $value); $this->twitter = str_replace('@', '', $value);
break; break;
case 'skype' : case 'skype' :
$this->skype = $value; $this->skype = (string)$value;
break; break;
case 'ymsgr' : case 'ymsgr' :
$this->yahoo = $value; $this->yahoo = (string)$value;
break; break;
} }
} }
} }
$this->email = $vcard->email->text; $this->email = (string)$vcard->email->text;
$this->description = trim($vcard->note->text); $this->description = trim((string)$vcard->note->text);
} }
public function getPlace() { public function getPlace() {
$place = null; $place = null;
if($this->loctext != '') if($this->loctext != '')
$place .= $this->loctext.' '; $place .= $this->loctext.' ';
else { else {
if($this->locbuilding != '') if($this->locbuilding != '')
$place .= $this->locbuilding.' '; $place .= $this->locbuilding.' ';
@ -319,18 +319,18 @@ class Contact extends Model {
if($this->loccountry != '') if($this->loccountry != '')
$place .= $this->loccountry; $place .= $this->loccountry;
} }
return $place; return $place;
} }
public function getTrueName() { public function getTrueName() {
$truename = ''; $truename = '';
if(isset($this->rostername)) if(isset($this->rostername))
$rostername = str_replace('\40', '', $this->rostername); $rostername = str_replace('\40', '', $this->rostername);
else else
$rostername = ''; $rostername = '';
if( if(
isset($this->rostername) isset($this->rostername)
&& $rostername != '' && $rostername != ''
@ -363,7 +363,7 @@ class Contact extends Model {
function getAge() { function getAge() {
if(isset($this->date) 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 00:00:00'
&& $this->date != '1970-01-01 01:00:00' && $this->date != '1970-01-01 01:00:00'
&& $this->date != '1970-01-01T00:00:00+0000') { && $this->date != '1970-01-01T00:00:00+0000') {
@ -383,7 +383,7 @@ class Contact extends Model {
function getMarital() { function getMarital() {
$marital = getMarital(); $marital = getMarital();
if($this->marital != null && $this->marital != 'none') { if($this->marital != null && $this->marital != 'none') {
return $marital[$this->marital]; return $marital[$this->marital];
} }
@ -407,8 +407,6 @@ class Contact extends Model {
&& $this->date == null && $this->date == null
&& $this->url == null && $this->url == null
&& $this->email == null && $this->email == null
&& $this->created == null
&& $this->updated == null
&& $this->description == null) { && $this->description == null) {
return true; return true;
} else { } else {
@ -439,14 +437,14 @@ class PresenceContact extends Contact {
protected $value; protected $value;
protected $priority; protected $priority;
protected $status; protected $status;
// Client Informations // Client Informations
protected $node; protected $node;
protected $ver; protected $ver;
// Delay - XEP 0203 // Delay - XEP 0203
protected $delay; protected $delay;
// Last Activity - XEP 0256 // Last Activity - XEP 0256
protected $last; protected $last;
@ -462,35 +460,35 @@ class PresenceContact extends Contact {
$this->_struct = ' $this->_struct = '
{ {
"resource" : "resource" :
{"type":"string", "size":64, "key":true }, {"type":"string", "size":64, "key":true },
"value" : "value" :
{"type":"int", "size":11, "mandatory":true }, {"type":"int", "size":11, "mandatory":true },
"priority" : "priority" :
{"type":"int", "size":11 }, {"type":"int", "size":11 },
"status" : "status" :
{"type":"text"}, {"type":"text"},
"node" : "node" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"ver" : "ver" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"delay" : "delay" :
{"type":"date"}, {"type":"date"},
"last" : "last" :
{"type":"int", "size":11 }, {"type":"int", "size":11 },
"publickey" : "publickey" :
{"type":"text"}, {"type":"text"},
"muc" : "muc" :
{"type":"int", "size":1 }, {"type":"int", "size":1 },
"mucjid" : "mucjid" :
{"type":"string", "size":64 }, {"type":"string", "size":64 },
"mucaffiliation" : "mucaffiliation" :
{"type":"string", "size":32 }, {"type":"string", "size":32 },
"mucrole" : "mucrole" :
{"type":"string", "size":32 } {"type":"string", "size":32 }
}'; }';
} }
} }
class RosterContact extends Contact { class RosterContact extends Contact {
@ -510,46 +508,46 @@ class RosterContact extends Contact {
protected $ver; protected $ver;
protected $category; protected $category;
//protected $type; //protected $type;
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
$this->_struct = " $this->_struct = "
{ {
'rostername' : 'rostername' :
{'type':'string', 'size':128 }, {'type':'string', 'size':128 },
'rosterask' : 'rosterask' :
{'type':'string', 'size':128 }, {'type':'string', 'size':128 },
'rostersubscription' : 'rostersubscription' :
{'type':'string', 'size':8 }, {'type':'string', 'size':8 },
'groupname' : 'groupname' :
{'type':'string', 'size':128 }, {'type':'string', 'size':128 },
'resource' : 'resource' :
{'type':'string', 'size':128, 'key':true }, {'type':'string', 'size':128, 'key':true },
'value' : 'value' :
{'type':'int', 'size':11, 'mandatory':true }, {'type':'int', 'size':11, 'mandatory':true },
'chaton' : 'chaton' :
{'type':'int', 'size':11 }, {'type':'int', 'size':11 },
'status' : 'status' :
{'type':'text'}, {'type':'text'},
'node' : 'node' :
{'type':'string', 'size':128 }, {'type':'string', 'size':128 },
'ver' : 'ver' :
{'type':'string', 'size':128 }, {'type':'string', 'size':128 },
'delay' : 'delay' :
{'type':'date'}, {'type':'date'},
'last' : 'last' :
{'type':'int', 'size':11 }, {'type':'int', 'size':11 },
'publickey' : 'publickey' :
{'type':'text'}, {'type':'text'},
'muc' : 'muc' :
{'type':'int', 'size':1 }, {'type':'int', 'size':1 },
'mucaffiliation' : 'mucaffiliation' :
{'type':'string', 'size':32 }, {'type':'string', 'size':32 },
'mucrole' : 'mucrole' :
{'type':'string', 'size':32 } {'type':'string', 'size':32 }
}"; }";
} }
// This method is only use on the connection // This method is only use on the connection
public function setPresence($p) { public function setPresence($p) {
$this->resource = $p->resource; $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 $subscription;
public $num; public $num;
public $sub; public $sub;
public function __construct() { public function __construct() {
$this->_struct = ' $this->_struct = '
{ {
"server" : "server" :
{"type":"string", "size":64, "mandatory":true, "key":true }, {"type":"string", "size":64, "mandatory":true, "key":true },
"jid" : "jid" :
{"type":"string", "size":128, "mandatory":true, "key":true }, {"type":"string", "size":128, "mandatory":true, "key":true },
"node" : "node" :
{"type":"string", "size":128, "mandatory":true, "key":true }, {"type":"string", "size":128, "mandatory":true, "key":true },
"creator" : "creator" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"name" : "name" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"created" : "created" :
{"type":"date"}, {"type":"date"},
"description" : "description" :
{"type":"text" }, {"type":"text" },
"updated" : "updated" :
{"type":"date"} {"type":"date"}
}'; }';
parent::__construct(); parent::__construct();
} }
@ -72,10 +72,10 @@ class Item extends Model {
break; break;
} }
} }
$this->updated = date('Y-m-d H:i:s'); $this->updated = date('Y-m-d H:i:s');
} }
public function getName() { public function getName() {
if($this->name != null) if($this->name != null)
return $this->name; return $this->name;
@ -89,4 +89,5 @@ class Item extends Model {
class Server extends Model { class Server extends Model {
public $server; public $server;
public $number; public $number;
public $name;
} }

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

@ -2,7 +2,7 @@
namespace modl; namespace modl;
class ItemDAO extends SQL { class ItemDAO extends SQL {
function set(Item $item, $insert_only = false) { function set(Item $item, $insert_only = false) {
if(!$insert_only) { if(!$insert_only) {
$this->_sql = ' $this->_sql = '
@ -15,9 +15,9 @@ class ItemDAO extends SQL {
where server = :server where server = :server
and jid = :jid and jid = :jid
and node = :node'; and node = :node';
$this->prepare( $this->prepare(
'Item', 'Item',
array( array(
'name' => $item->name, 'name' => $item->name,
'created' => $item->created, 'created' => $item->created,
@ -29,10 +29,10 @@ class ItemDAO extends SQL {
'description' => $item->description 'description' => $item->description
) )
); );
$this->run('Item'); $this->run('Item');
} }
if(!$this->_effective || $insert_only) { if(!$this->_effective || $insert_only) {
$this->_sql = ' $this->_sql = '
insert into item insert into item
@ -55,9 +55,9 @@ class ItemDAO extends SQL {
:updated, :updated,
:description :description
)'; )';
$this->prepare( $this->prepare(
'Item', 'Item',
array( array(
'name' => $item->name, 'name' => $item->name,
'creator' => $item->creator, 'creator' => $item->creator,
@ -69,38 +69,38 @@ class ItemDAO extends SQL {
'description' => $item->description 'description' => $item->description
) )
); );
$this->run('Item'); $this->run('Item');
} }
} }
function getServers() { function getServers() {
$this->_sql = ' $this->_sql = '
select server, count(node) as number select server, count(node) as number
from item from item
where node not like :node where node not like :node
group by server group by server
order by number desc'; order by number desc';
$this->prepare( $this->prepare(
'Item', 'Item',
array( array(
'node' => 'urn:xmpp:microblog:0:comments%' 'node' => 'urn:xmpp:microblog:0:comments%'
) )
); );
return $this->run('Server'); return $this->run('Server');
} }
function getConferenceServers() { function getConferenceServers() {
$this->_sql = ' $this->_sql = '
select server, count(node) as number select server, count(node) as number
from item from item
where node not like :node where node not like :node
and node = :name and node = :name
group by server group by server
order by number desc'; order by number desc';
$this->prepare( $this->prepare(
'Item', 'Item',
array( array(
@ -109,19 +109,20 @@ class ItemDAO extends SQL {
'name' => '' 'name' => ''
) )
); );
return $this->run('Server'); return $this->run('Server');
} }
function getGroupServers() { function getGroupServers() {
$this->_sql = ' $this->_sql = '
select server, count(node) as number select server, count(item.node) as number, caps.name
from item from item
where node not like :node left outer join caps on caps.node = item.server
and node != :name where item.node not like :node
group by server and item.node != :name
group by server, caps.name
order by number desc'; order by number desc';
$this->prepare( $this->prepare(
'Item', 'Item',
array( array(
@ -130,12 +131,11 @@ class ItemDAO extends SQL {
'name' => '' 'name' => ''
) )
); );
return $this->run('Server'); return $this->run('Server');
} }
function getItems($server) { function getItems($server) {
$this->_sql = ' $this->_sql = '
select * from item select * from item
left outer join ( left outer join (
@ -148,14 +148,14 @@ class ItemDAO extends SQL {
where server = :server where server = :server
group by node) as sub group by node) as sub
on sub.node = item.node on sub.node = item.node
left outer join (select server, node, subscription from subscription where jid = :node) left outer join (select server, node, subscription from subscription where jid = :node)
as s on s.server = item.server as s on s.server = item.server
and s.node = item.node and s.node = item.node
where item.server = :server where item.server = :server
and item.node != \'\' and item.node != \'\'
order by name, item.node order by name, item.node
'; ';
$this->prepare( $this->prepare(
'Item', 'Item',
array( array(
@ -164,8 +164,43 @@ class ItemDAO extends SQL {
'server' => $server '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) { function getUpdatedItems($limitf = false, $limitr = false) {
@ -178,32 +213,32 @@ class ItemDAO extends SQL {
order by num desc order by num desc
'; ';
if($limitr) if($limitr)
$this->_sql = $this->_sql.' limit '.$limitr.' offset '.$limitf; $this->_sql = $this->_sql.' limit '.$limitr.' offset '.$limitf;
$this->prepare( $this->prepare(
'Item', 'Item',
array( array(
'node' => 'urn:xmpp:microblog%' 'node' => 'urn:xmpp:microblog%'
) )
); );
return $this->run('Item'); return $this->run('Item');
} }
function deleteItems($server) { function deleteItems($server) {
$this->_sql = ' $this->_sql = '
delete from item delete from item
where server= :server'; where server= :server';
$this->prepare( $this->prepare(
'Item', 'Item',
array( array(
'server' => $server 'server' => $server
) )
); );
return $this->run('Item'); return $this->run('Item');
} }
function deleteItem($server, $item) { function deleteItem($server, $item) {
@ -211,7 +246,7 @@ class ItemDAO extends SQL {
delete from item delete from item
where server = :server where server = :server
and node = :node'; and node = :node';
$this->prepare( $this->prepare(
'Item', 'Item',
array( array(
@ -219,25 +254,25 @@ class ItemDAO extends SQL {
'node' => $item 'node' => $item
) )
); );
return $this->run('Item'); return $this->run('Item');
} }
function getItem($server, $item) { function getItem($server, $item) {
$this->_sql = ' $this->_sql = '
select * from item select * from item
where where
node = :node node = :node
and server = :server'; and server = :server';
$this->prepare( $this->prepare(
'Item', 'Item',
array( array(
'node' => $item, 'node' => $item,
'server' => $server 'server' => $server
) )
); );
return $this->run('Item', 'item'); 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) { switch($c->attributes()->type) {
case 'html': case 'html':
case 'xhtml': case 'xhtml':
return (string)$c->asXML(); if($c->getName() == 'content') return $c->children()->asXML();
else return (string)$c->asXML();
break; break;
case 'text': case 'text':
default : default :
@ -284,7 +285,8 @@ class Postn extends Model {
public function isMine() { public function isMine() {
$user = new \User(); $user = new \User();
if($this->origin == $user->getLogin()) if($this->aid == $user->getLogin()
|| $this->origin == $user->getLogin())
return true; return true;
else else
return false; 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\' node != \'urn:xmpp:microblog:0\'
and postn.node not like \'urn:xmpp:microblog:0:comments/%\' and postn.node not like \'urn:xmpp:microblog:0:comments/%\'
and postn.node not like \'urn:xmpp:inbox\' 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)) and ((postn.origin, node) not in (select server, node from subscription where jid = :origin))
order by published desc 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; namespace modl;
class Subscription extends Model { class Subscription extends Model {
public $jid; public $jid;
public $server; public $server;
public $node; public $node;
@ -13,28 +13,29 @@ class Subscription extends Model {
public $tags; public $tags;
public $timestamp; public $timestamp;
public $name; public $name;
public $servicename;
public function __construct() { public function __construct() {
$this->_struct = ' $this->_struct = '
{ {
"jid" : "jid" :
{"type":"string", "size":64, "mandatory":true, "key":true }, {"type":"string", "size":64, "mandatory":true, "key":true },
"server" : "server" :
{"type":"string", "size":64, "mandatory":true, "key":true }, {"type":"string", "size":64, "mandatory":true, "key":true },
"node" : "node" :
{"type":"string", "size":128, "mandatory":true, "key":true }, {"type":"string", "size":128, "mandatory":true, "key":true },
"subscription" : "subscription" :
{"type":"string", "size":128, "mandatory":true }, {"type":"string", "size":128, "mandatory":true },
"subid" : "subid" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"title" : "title" :
{"type":"string", "size":128 }, {"type":"string", "size":128 },
"tags" : "tags" :
{"type":"text" }, {"type":"text" },
"timestamp" : "timestamp" :
{"type":"date" } {"type":"date" }
}'; }';
parent::__construct(); parent::__construct();
} }
@ -46,7 +47,7 @@ class Subscription extends Model {
$this->subscription = (string)$s->attributes()->subscription; $this->subscription = (string)$s->attributes()->subscription;
$this->subid = (string)$s->attributes()->subid; $this->subid = (string)$s->attributes()->subid;
$this->tags = serialize(array()); $this->tags = serialize(array());
if($this->subid = '') if($this->subid = '')
$this->subid = 'default'; $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 where jid = :jid
and server = :server and server = :server
and node = :node'; and node = :node';
$this->prepare( $this->prepare(
'Subscription', 'Subscription',
array( array(
'subscription' => $s->subscription, 'subscription' => $s->subscription,
'timestamp' => date(DATE_ISO8601), 'timestamp' => date(DATE_ISO8601),
'jid' => $s->jid, 'jid' => $s->jid,
@ -26,17 +26,17 @@ class SubscriptionDAO extends SQL {
'subid' => $s->subid 'subid' => $s->subid
) )
); );
$this->run('Subscription'); $this->run('Subscription');
if(!$this->_effective) { if(!$this->_effective) {
$this->_sql = ' $this->_sql = '
insert into subscription insert into subscription
(jid, server, node, subscription, subid, tags, timestamp) (jid, server, node, subscription, subid, tags, timestamp)
values (:jid, :server, :node, :subscription, :subid, :tags, :timestamp)'; values (:jid, :server, :node, :subscription, :subid, :tags, :timestamp)';
$this->prepare( $this->prepare(
'Subscription', 'Subscription',
array( array(
'subscription' => $s->subscription, 'subscription' => $s->subscription,
'timestamp' => date(DATE_ISO8601), 'timestamp' => date(DATE_ISO8601),
@ -47,61 +47,65 @@ class SubscriptionDAO extends SQL {
'subid' => $s->subid 'subid' => $s->subid
) )
); );
$this->run('Subscription'); $this->run('Subscription');
} }
} }
function get($server, $node) { function get($server, $node) {
$this->_sql = ' $this->_sql = '
select * from subscription select * from subscription
where jid = :jid where jid = :jid
and server = :server and server = :server
and node = :node'; and node = :node';
$this->prepare( $this->prepare(
'Subscription', 'Subscription',
array( array(
'jid' => $this->_user, 'jid' => $this->_user,
'server' => $server, 'server' => $server,
'node' => $node 'node' => $node
) )
); );
return $this->run('Subscription'); return $this->run('Subscription');
} }
function getSubscribed() { function getSubscribed() {
$this->_sql = ' $this->_sql = '
select select
subscription.jid, subscription.jid,
subscription.server, subscription.server,
subscription.node, subscription.node,
subscription, subscription,
item.name, item.name,
item.description item.description,
caps.name as servicename
from subscription from subscription
left outer join item left outer join item
on item.server = subscription.server on item.server = subscription.server
and item.node = subscription.node and item.node = subscription.node
left outer join caps
on caps.node = subscription.server
where subscription.jid = :jid where subscription.jid = :jid
group by group by
subscription.server, subscription.server,
subscription.node, subscription.node,
subscription.jid, subscription.jid,
subscription, subscription,
caps.name,
item.name, item.name,
item.description item.description
order by order by
subscription.server'; subscription.server';
$this->prepare( $this->prepare(
'Subscription', 'Subscription',
array( array(
'jid' => $this->_user 'jid' => $this->_user
) )
); );
return $this->run('Subscription'); return $this->run('Subscription');
} }
@ -109,36 +113,36 @@ class SubscriptionDAO extends SQL {
$this->_sql = ' $this->_sql = '
delete from subscription delete from subscription
where jid = :jid'; where jid = :jid';
$this->prepare( $this->prepare(
'Subscription', 'Subscription',
array( array(
'jid' => $this->_user 'jid' => $this->_user
) )
); );
return $this->run('Subscription'); return $this->run('Subscription');
} }
function deleteNode($server, $node) { function deleteNode($server, $node) {
$this->_sql = ' $this->_sql = '
delete from subscription delete from subscription
where jid = :jid where jid = :jid
and server = :server and server = :server
and node = :node'; and node = :node';
$this->prepare( $this->prepare(
'Subscription', 'Subscription',
array( array(
'jid' => $this->_user, 'jid' => $this->_user,
'server' => $server, 'server' => $server,
'node' => $node 'node' => $node
) )
); );
return $this->run('Subscription'); return $this->run('Subscription');
} }
function deleteNodeSubid($server, $node, $subid) { function deleteNodeSubid($server, $node, $subid) {
$this->_sql = ' $this->_sql = '
delete from subscription delete from subscription
@ -146,9 +150,9 @@ class SubscriptionDAO extends SQL {
and server = :server and server = :server
and node = :node and node = :node
and subid = :subid'; and subid = :subid';
$this->prepare( $this->prepare(
'Subscription', 'Subscription',
array( array(
'jid' => $this->_user, 'jid' => $this->_user,
'server' => $server, 'server' => $server,
@ -156,7 +160,7 @@ class SubscriptionDAO extends SQL {
'subid' => $subid, 'subid' => $subid,
) )
); );
return $this->run('Subscription'); 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> <main>
<section> <section>
<div> <div style="background-color: #EEE;">
<?php //$this->widget('Tabs');?>
<?php $this->widget('Blog');?> <?php $this->widget('Blog');?>
<?php //$this->widget('ContactSummary');?>
<?php //$this->widget('ContactCard');?>
</div> </div>
</section> </section>
</main> </main>

View file

@ -10,6 +10,7 @@
<?php $this->widget('Chats');?> <?php $this->widget('Chats');?>
<?php $this->widget('Rooms');?> <?php $this->widget('Rooms');?>
</div> </div>
<?php $this->widget('Upload');?>
<?php $this->widget('Chat');?> <?php $this->widget('Chat');?>
</section> </section>
</main> </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"> <nav class="color dark">
<?php $this->widget('Navigation');?> <?php $this->widget('Navigation');?>
<?php $this->widget('Presence');?> <?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('Init');?>
<?php $this->widget('Upload');?>
<nav class="color dark"> <nav class="color dark">
<?php $this->widget('Navigation');?> <?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\ChangePassword;
use Moxl\Xec\Action\Register\Remove; use Moxl\Xec\Action\Register\Remove;
use Moxl\Xec\Action\Register\Get; use Moxl\Xec\Action\Register\Get;
use Moxl\Xec\Action\Register\Set;
use Respect\Validation\Validator; use Respect\Validation\Validator;
class Account extends WidgetBase class Account extends WidgetBase
@ -12,7 +13,7 @@ class Account extends WidgetBase
$this->addjs('account.js'); $this->addjs('account.js');
$this->registerEvent('register_changepassword_handle', 'onPasswordChanged'); $this->registerEvent('register_changepassword_handle', 'onPasswordChanged');
$this->registerEvent('register_remove_handle', 'onRemoved'); $this->registerEvent('register_remove_handle', 'onRemoved');
//$this->registerEvent('register_get_handle', 'onRegister'); $this->registerEvent('register_get_handle', 'onRegister');
} }
function onPasswordChanged() function onPasswordChanged()
@ -41,6 +42,7 @@ class Account extends WidgetBase
$form = $xml->getHTML($content->x->asXML()); $form = $xml->getHTML($content->x->asXML());
$view->assign('form', $form); $view->assign('form', $form);
$view->assign('from', $package->from);
$view->assign('attributes', $content->attributes()); $view->assign('attributes', $content->attributes());
$view->assign('actions', null); $view->assign('actions', null);
if(isset($content->actions)) { if(isset($content->actions)) {
@ -91,7 +93,7 @@ class Account extends WidgetBase
$da->request(); $da->request();
} }
function ajaxRegister($server) function ajaxGetRegistration($server)
{ {
if(!$this->validateServer($server)) return; if(!$this->validateServer($server)) return;
@ -100,6 +102,15 @@ class Account extends WidgetBase
->request(); ->request();
} }
function ajaxRegister($server, $form)
{
if(!$this->validateServer($server)) return;
$s = new Set;
$s->setTo($server)
->setData($form)
->request();
}
private function validateServer($server) private function validateServer($server)
{ {
$validate_server = Validator::string()->noWhitespace()->length(6, 80); $validate_server = Validator::string()->noWhitespace()->length(6, 80);
@ -109,5 +120,7 @@ class Account extends WidgetBase
function display() function display()
{ {
$id = new \Modl\ItemDAO;
$this->view->assign('gateway', $id->getGateways($this->user->getServer()));
} }
} }

View file

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

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