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.
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)

View file

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

View file

@ -3,7 +3,7 @@ Description=Movim daemon
After=nginx.service network.target local-fs.target
[Service]
User=www-data
User=movim
Type=simple
ExecStart=/usr/bin/php daemon.php https://YHURL YHPORT
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
sudo mkdir -p $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
sudo su -c "curl -sS https://getcomposer.org/installer | php -- --install-dir=$final_path" -s /bin/sh www-data
sudo su -c "cd $final_path && php composer.phar install" -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" movim
# Movim configuration
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@'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 su -c "cd $final_path && php mud.php db set" -s /bin/sh www-data
sudo su -c "cd $final_path && php mud.php config locale:$language"
sudo su -c "cd $final_path && php mud.php config loglevel:1"
sudo su -c "cd $final_path && php mud.php config environment:production"
sudo su -c "cd $final_path && php mud.php config timezone:`cat /etc/timezone`"
sudo su -c "cd $final_path && php mud.php config username:$admin"
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 db set" movim
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" movim
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`" movim
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}'`" movim
sudo yunohost app addaccess movim -u $admin
# Copy init script or systemd service

View file

@ -5,7 +5,8 @@ db_name=movim
root_pwd=$(sudo cat /etc/yunohost/mysql)
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
domain=$(sudo yunohost app setting movim domain)
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
final_path=/var/www/movim
sudo cp -a ../sources/* $final_path
sudo chown -R www-data: $final_path
#sudo chown -R www-data: $final_path
# Upgrade PHP dependencies
#sudo su -c "curl -sS https://getcomposer.org/installer | php -- --install-dir=$final_path" -s /bin/sh www-data
#sudo su -c "cd $final_path && php composer.phar install" -s /bin/sh www-data
# Create movim user if not exists and set permissions
if grep -q movim /etc/passwd; then
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
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
sudo yunohost app ssowatconf
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 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

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

@ -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

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

@ -13,7 +13,5 @@ class AdminController extends BaseController {
} 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

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

@ -259,23 +259,23 @@ class Contact extends Model {
}
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->marital = (string)$vcard->marital->status->text;
$this->adrlocality = $vcard->adr->locality;
$this->adrcountry = $vcard->adr->country;
$this->adrpostalcode = $vcard->adr->code;
$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,18 +286,18 @@ 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->email = (string)$vcard->email->text;
$this->description = trim($vcard->note->text);
$this->description = trim((string)$vcard->note->text);
}
public function getPlace() {
@ -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 {

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

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

@ -89,4 +89,5 @@ class Item extends Model {
class Server extends Model {
public $server;
public $number;
public $name;
}

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

@ -115,11 +115,12 @@ class ItemDAO extends SQL {
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(
@ -135,7 +136,6 @@ class ItemDAO extends SQL {
}
function getItems($server) {
$this->_sql = '
select * from item
left outer join (
@ -168,6 +168,41 @@ class ItemDAO extends SQL {
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) {
$this->_sql = '
select * from item natural join (

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

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

@ -13,6 +13,7 @@ class Subscription extends Model {
public $tags;
public $timestamp;
public $name;
public $servicename;
public function __construct() {
$this->_struct = '

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

@ -79,17 +79,21 @@ class SubscriptionDAO extends SQL {
subscription.node,
subscription,
item.name,
item.description
item.description,
caps.name as servicename
from subscription
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,
subscription,
caps.name,
item.name,
item.description
order by

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">

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