mirror of
https://github.com/YunoHost-Apps/movim_ynh.git
synced 2024-09-03 19:46:19 +02:00
update to movim 0.9-git2015-09-22
This commit is contained in:
parent
451a5b0499
commit
2364e0e077
27 changed files with 298 additions and 153 deletions
12
README.md
12
README.md
|
@ -7,23 +7,23 @@ Warning: BETA.
|
||||||
|
|
||||||
You need a valid SSL certificate to use Movim, auto-signed is not allowed.
|
You need a valid SSL certificate to use Movim, auto-signed is not allowed.
|
||||||
|
|
||||||
Current Movim version : 0.9 git2015-09-10
|
Current Movim version : 0.9 git2015-09-22
|
||||||
|
|
||||||
**Changelog**
|
**Changelog**
|
||||||
|
|
||||||
0.9b 2015-0
|
0.9b 2015-0
|
||||||
- Update to upstream Movim 0.9 git2015-09-10
|
- Update to upstream Movim 0.9 git2015-09-22.
|
||||||
- Add notes in README about public pods & whitelisting
|
- Add notes in README about public pods & whitelisting.
|
||||||
- script/install now check if path is empty.
|
- script/install now check if path is empty.
|
||||||
- script/remove now delete /etc/php/fpm/pool.d/movim.conf (fix #8).
|
- script/remove now delete /etc/php/fpm/pool.d/movim.conf (fix #8).
|
||||||
- script/remove now delete 'movim' user only after Movim service is stopped.
|
- script/remove now delete 'movim' user only after Movim service is stopped.
|
||||||
- script/remove now stop php5-fpm in order to remove Movim user
|
- script/remove now stop php5-fpm in order to remove Movim user.
|
||||||
- script/update now updates php dependancies (composer update).
|
- script/update now updates php dependancies (composer update).
|
||||||
- conf/movim.service now has a PID and a syslog identifier.
|
- conf/movim.service now has a PID and a syslog identifier.
|
||||||
- conf/movim.service starts after mysql.service.
|
- conf/movim.service starts after mysql.service.
|
||||||
- conf/movim.service is now located in /etc/systemd/system
|
- conf/movim.service is now located in /etc/systemd/system.
|
||||||
- conf/movim.init starts after mysql.
|
- conf/movim.init starts after mysql.
|
||||||
- conf/nginx.conf : proxy_read_timeout and proxy_send_timeout removed (default is 60s)
|
- conf/nginx.conf : proxy_read_timeout and proxy_send_timeout removed (default is 60s).
|
||||||
- conf/php-fpm.conf add timezone parameter.
|
- conf/php-fpm.conf add timezone parameter.
|
||||||
|
|
||||||
0.8b 2015-08-24
|
0.8b 2015-08-24
|
||||||
|
|
1
TODO
1
TODO
|
@ -1 +0,0 @@
|
||||||
- systemd Log to /var/log/movim/
|
|
|
@ -10,6 +10,8 @@ class Conference extends Model {
|
||||||
public $autojoin;
|
public $autojoin;
|
||||||
public $status;
|
public $status;
|
||||||
|
|
||||||
|
public $connected = false;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->_struct = '
|
$this->_struct = '
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,8 +90,14 @@ class Postn extends Model {
|
||||||
switch($c->attributes()->type) {
|
switch($c->attributes()->type) {
|
||||||
case 'html':
|
case 'html':
|
||||||
case 'xhtml':
|
case 'xhtml':
|
||||||
if($c->getName() == 'content') return $c->children()->asXML();
|
$dom = new \DOMDocument('1.0', 'utf-8');
|
||||||
else return (string)$c->asXML();
|
$import = dom_import_simplexml($c->children());
|
||||||
|
if($import == null) {
|
||||||
|
$import = dom_import_simplexml($c);
|
||||||
|
}
|
||||||
|
$element = $dom->importNode($import, true);
|
||||||
|
$dom->appendChild($element);
|
||||||
|
return (string)$dom->saveHTML();
|
||||||
break;
|
break;
|
||||||
case 'text':
|
case 'text':
|
||||||
default :
|
default :
|
||||||
|
@ -293,6 +299,14 @@ class Postn extends Model {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUUID() {
|
||||||
|
if(substr($this->nodeid, 10) == 'urn:uuid:') {
|
||||||
|
return $this->nodeid;
|
||||||
|
} else {
|
||||||
|
return 'urn:uuid:'.generateUUID($this->nodeid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function isMicroblog() {
|
public function isMicroblog() {
|
||||||
if($this->node == "urn:xmpp:microblog:0")
|
if($this->node == "urn:xmpp:microblog:0")
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<ul class="thick divided">
|
<ul class="thick divided">
|
||||||
<li class="condensed">
|
<li class="condensed">
|
||||||
<span class="icon bubble color green"><i class="zmdi zmdi-info"></i></span>
|
<span class="icon bubble color green"><i class="zmdi zmdi-info"></i></span>
|
||||||
<p>{$c->__('about.info')} <a href="http://www.gnu.org/licenses/agpl-3.0.html">GNU Affero General Public License v3</a>.</p>
|
<p class="all">{$c->__('about.info')} <a href="http://www.gnu.org/licenses/agpl-3.0.html">GNU Affero General Public License v3</a>.</p>
|
||||||
</li>
|
</li>
|
||||||
<li class="subheader">{$c->__('about.thanks')}</li>
|
<li class="subheader">{$c->__('about.thanks')}</li>
|
||||||
<li class="condensed">
|
<li class="condensed">
|
||||||
|
|
|
@ -72,7 +72,7 @@ class AdminMain extends WidgetBase
|
||||||
$cd = new \Modl\ConfigDAO();
|
$cd = new \Modl\ConfigDAO();
|
||||||
$config = $cd->get();
|
$config = $cd->get();
|
||||||
|
|
||||||
$l = Locale::start();
|
$l = Movim\i18n\Locale::start();
|
||||||
|
|
||||||
$this->view->assign('conf', $cd->get());
|
$this->view->assign('conf', $cd->get());
|
||||||
$this->view->assign('logs',
|
$this->view->assign('logs',
|
||||||
|
|
|
@ -8,10 +8,6 @@ class Blog extends WidgetBase {
|
||||||
|
|
||||||
function display()
|
function display()
|
||||||
{
|
{
|
||||||
/*if(!$this->get('f')) {
|
|
||||||
return;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if($this->_view == 'grouppublic') {
|
if($this->_view == 'grouppublic') {
|
||||||
$from = $this->get('s');
|
$from = $this->get('s');
|
||||||
$node = $this->get('n');
|
$node = $this->get('n');
|
||||||
|
|
|
@ -28,7 +28,15 @@
|
||||||
{/if}
|
{/if}
|
||||||
</li>
|
</li>
|
||||||
{else}
|
{else}
|
||||||
<li class="condensed">
|
<li class="condensed action">
|
||||||
|
<div class="action">
|
||||||
|
<a
|
||||||
|
href="{$c->route('feed', array($server, $node))}"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
<i class="zmdi zmdi-portable-wifi"></i> Atom
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
<span class="icon gray">
|
<span class="icon gray">
|
||||||
<i class="zmdi zmdi-pages"></i>
|
<i class="zmdi zmdi-pages"></i>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -72,20 +72,23 @@ class Chat extends WidgetBase
|
||||||
&& $message->type != 'groupchat') {
|
&& $message->type != 'groupchat') {
|
||||||
$avatar = $contact->getPhoto('s');
|
$avatar = $contact->getPhoto('s');
|
||||||
if($avatar == false) $avatar = null;
|
if($avatar == false) $avatar = null;
|
||||||
Notification::append('chat|'.$from, $contact->getTrueName(), $message->body, $avatar, 4);
|
Notification::append(
|
||||||
|
'chat|'.$from,
|
||||||
|
$contact->getTrueName(),
|
||||||
|
$message->body,
|
||||||
|
$avatar,
|
||||||
|
4,
|
||||||
|
$this->route('chat', $contact->jid)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
RPC::call('movim_fill', $from.'_state', $contact->jid);
|
RPC::call('movim_fill', $from.'_state', $contact->jid);
|
||||||
// If the message is from me
|
} else {
|
||||||
} /*else {
|
// If the message is from me we reset the notif counter
|
||||||
$from = $message->jidto;
|
$from = $message->jidto;
|
||||||
$contact = $cd->get();
|
$n = new Notification;
|
||||||
}*
|
$n->ajaxClear('chat|'.$from);
|
||||||
|
}
|
||||||
$me = $cd->get();
|
|
||||||
if($me == null) {
|
|
||||||
$me = new \Modl\Contact;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if(!preg_match('#^\?OTR#', $message->body)) {
|
if(!preg_match('#^\?OTR#', $message->body)) {
|
||||||
RPC::call('Chat.appendMessage', $this->prepareMessage($message));
|
RPC::call('Chat.appendMessage', $this->prepareMessage($message));
|
||||||
|
|
|
@ -83,7 +83,7 @@ var Chat = {
|
||||||
}
|
}
|
||||||
|
|
||||||
bubble.querySelector('div').className = '';
|
bubble.querySelector('div').className = '';
|
||||||
} else {
|
} else if(Chat.left != null) {
|
||||||
if(message.session == message.jidfrom) {
|
if(message.session == message.jidfrom) {
|
||||||
bubble = Chat.right.cloneNode(true);
|
bubble = Chat.right.cloneNode(true);
|
||||||
if(Chat.previous == 'right') {
|
if(Chat.previous == 'right') {
|
||||||
|
@ -124,6 +124,7 @@ var Chat = {
|
||||||
MovimWebsocket.attach(function() {
|
MovimWebsocket.attach(function() {
|
||||||
var jid = document.querySelector('#chat_widget').dataset.jid;
|
var jid = document.querySelector('#chat_widget').dataset.jid;
|
||||||
if(jid) {
|
if(jid) {
|
||||||
|
MovimTpl.showPanel();
|
||||||
Chat_ajaxGet(jid);
|
Chat_ajaxGet(jid);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
<div id="chat_widget" {if="$jid"}data-jid="{$jid}"{/if}>
|
<div id="chat_widget" {if="$jid"}data-jid="{$jid}"{/if}>
|
||||||
{$c->prepareEmpty()}
|
{if="$jid"}
|
||||||
|
{$c->prepareChat($jid)}
|
||||||
|
{else}
|
||||||
|
{$c->prepareEmpty()}
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Config extends WidgetBase
|
||||||
/* We load the user configuration */
|
/* We load the user configuration */
|
||||||
$this->user->reload();
|
$this->user->reload();
|
||||||
|
|
||||||
$l = Locale::start();
|
$l = Movim\i18n\Locale::start();
|
||||||
|
|
||||||
$view->assign('languages', $l->getList());
|
$view->assign('languages', $l->getList());
|
||||||
$view->assign('me', $this->user->getLogin());
|
$view->assign('me', $this->user->getLogin());
|
||||||
|
|
|
@ -46,9 +46,24 @@ class Menu extends WidgetBase
|
||||||
$title = $post->title;
|
$title = $post->title;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$post->isMine()) Notification::append('news', $contact->getTrueName(), $title, $contact->getPhoto('s'), 2);
|
if(!$post->isMine())
|
||||||
|
Notification::append(
|
||||||
|
'news',
|
||||||
|
$contact->getTrueName(),
|
||||||
|
$title,
|
||||||
|
$contact->getPhoto('s'),
|
||||||
|
2,
|
||||||
|
$this->route('news', $post->nodeid)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
Notification::append('news', $post->title, $post->node, null, 2);
|
Notification::append(
|
||||||
|
'news',
|
||||||
|
$post->title,
|
||||||
|
$post->node,
|
||||||
|
null,
|
||||||
|
2,
|
||||||
|
$this->route('news', $post->nodeid)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->onStream($count);
|
$this->onStream($count);
|
||||||
|
|
|
@ -29,16 +29,19 @@ class Notification extends WidgetBase
|
||||||
$session = Session::start();
|
$session = Session::start();
|
||||||
$notifs = $session->get('notifs');
|
$notifs = $session->get('notifs');
|
||||||
|
|
||||||
RPC::call('Notification.desktop', $title, $body, $picture);
|
RPC::call('Notification.desktop', $title, $body, $picture, $action);
|
||||||
|
|
||||||
$notifs_key = $session->get('notifs_key');
|
$notifs_key = $session->get('notifs_key');
|
||||||
if($notifs_key != null && $key == $notifs_key) return;
|
|
||||||
|
|
||||||
if($notifs == null) $notifs = array();
|
if($notifs == null) $notifs = array();
|
||||||
|
|
||||||
$explode = explode('|', $key);
|
$explode = explode('|', $key);
|
||||||
$first = reset($explode);
|
$first = reset($explode);
|
||||||
|
|
||||||
|
if($notifs_key != null && $first == $notifs_key) return;
|
||||||
|
|
||||||
|
RPC::call('Notification.android', $title, $body, $picture, $action);
|
||||||
|
|
||||||
if(array_key_exists($first, $notifs)) {
|
if(array_key_exists($first, $notifs)) {
|
||||||
$notifs[$first]++;
|
$notifs[$first]++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -58,7 +61,7 @@ class Notification extends WidgetBase
|
||||||
}
|
}
|
||||||
|
|
||||||
$n = new Notification;
|
$n = new Notification;
|
||||||
RPC::call('Notification.snackbar', $n->prepareSnackbar($title, $body, $picture), $time);
|
RPC::call('Notification.snackbar', $n->prepareSnackbar($title, $body, $picture, $action), $time);
|
||||||
|
|
||||||
$session->set('notifs', $notifs);
|
$session->set('notifs', $notifs);
|
||||||
}
|
}
|
||||||
|
@ -121,13 +124,14 @@ class Notification extends WidgetBase
|
||||||
$session->set('notifs_key', $key);
|
$session->set('notifs_key', $key);
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareSnackbar($title, $body = false, $picture = false)
|
function prepareSnackbar($title, $body = null, $picture = null, $action = null)
|
||||||
{
|
{
|
||||||
$view = $this->tpl();
|
$view = $this->tpl();
|
||||||
|
|
||||||
$view->assign('title', $title);
|
$view->assign('title', $title);
|
||||||
$view->assign('body', $body);
|
$view->assign('body', $body);
|
||||||
$view->assign('picture', $picture);
|
$view->assign('picture', $picture);
|
||||||
|
$view->assign('action', $action);
|
||||||
|
|
||||||
return $view->draw('_notification', true);
|
return $view->draw('_notification', true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
<ul class="{if="!isset($picture)"}simple{/if}">
|
{if="isset($action)"}
|
||||||
<li class="{if="isset($body)"}condensed{/if}">
|
<a href="{$action}">
|
||||||
{if="isset($picture)"}
|
{/if}
|
||||||
<span class="icon bubble"><img src="{$picture}"></span>
|
<ul class="{if="!isset($picture)"}simple{/if}">
|
||||||
{/if}
|
<li class="{if="isset($body)"}condensed{/if}">
|
||||||
<span>{$title}</span>
|
{if="isset($picture)"}
|
||||||
{if="isset($body)"}
|
<span class="icon bubble"><img src="{$picture}"></span>
|
||||||
<p>{$body}</p>
|
{/if}
|
||||||
{/if}
|
<span>{$title}</span>
|
||||||
</li>
|
{if="isset($body)"}
|
||||||
</ul>
|
<p>{$body}</p>
|
||||||
|
{/if}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{if="isset($action)"}
|
||||||
|
</a>
|
||||||
|
{/if}
|
||||||
|
|
|
@ -75,6 +75,12 @@ var Notification = {
|
||||||
Notification_ajaxCurrent(Notification.notifs_key);
|
Notification_ajaxCurrent(Notification.notifs_key);
|
||||||
},
|
},
|
||||||
toast : function(html) {
|
toast : function(html) {
|
||||||
|
// Android notification
|
||||||
|
if(typeof Android !== 'undefined') {
|
||||||
|
Android.showToast(html);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
target = document.getElementById('toast');
|
target = document.getElementById('toast');
|
||||||
|
|
||||||
if(target) {
|
if(target) {
|
||||||
|
@ -88,7 +94,8 @@ var Notification = {
|
||||||
3000);
|
3000);
|
||||||
},
|
},
|
||||||
snackbar : function(html, time) {
|
snackbar : function(html, time) {
|
||||||
if(Notification.inhibed == true) return;
|
if(typeof Android !== 'undefined'
|
||||||
|
|| Notification.inhibed == true) return;
|
||||||
|
|
||||||
target = document.getElementById('snackbar');
|
target = document.getElementById('snackbar');
|
||||||
|
|
||||||
|
@ -102,11 +109,26 @@ var Notification = {
|
||||||
},
|
},
|
||||||
time*1000);
|
time*1000);
|
||||||
},
|
},
|
||||||
desktop : function(title, body, picture) {
|
desktop : function(title, body, picture, action) {
|
||||||
if(Notification.inhibed == true
|
if(Notification.inhibed == true
|
||||||
|| Notification.focused) return;
|
|| Notification.focused
|
||||||
console.log(DesktopNotification);
|
|| typeof DesktopNotification === 'undefined') return;
|
||||||
|
|
||||||
|
console.log(Notification.focused);
|
||||||
|
|
||||||
var notification = new DesktopNotification(title, { icon: picture, body: body });
|
var notification = new DesktopNotification(title, { icon: picture, body: body });
|
||||||
|
|
||||||
|
if(action !== null) {
|
||||||
|
notification.onclick = function() {
|
||||||
|
window.location.href = action;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
android : function(title, body, picture, action) {
|
||||||
|
if(typeof Android !== 'undefined') {
|
||||||
|
Android.showNotification(title, body, picture, action);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +155,8 @@ document.onfocus = function() {
|
||||||
|
|
||||||
|
|
||||||
window.addEventListener('load', function () {
|
window.addEventListener('load', function () {
|
||||||
|
if(typeof DesktopNotification === 'undefined') return;
|
||||||
|
|
||||||
DesktopNotification.requestPermission(function (status) {
|
DesktopNotification.requestPermission(function (status) {
|
||||||
// This allows to use Notification.permission with Chrome/Safari
|
// This allows to use Notification.permission with Chrome/Safari
|
||||||
if(DesktopNotification.permission !== status) {
|
if(DesktopNotification.permission !== status) {
|
||||||
|
|
|
@ -140,7 +140,6 @@ class Publish extends WidgetBase
|
||||||
RPC::call('Publish.disableSend');
|
RPC::call('Publish.disableSend');
|
||||||
|
|
||||||
if($form->title->value != '') {
|
if($form->title->value != '') {
|
||||||
|
|
||||||
$p = new PostPublish;
|
$p = new PostPublish;
|
||||||
$p->setFrom($this->user->getLogin())
|
$p->setFrom($this->user->getLogin())
|
||||||
->setTo($form->to->value)
|
->setTo($form->to->value)
|
||||||
|
@ -148,18 +147,19 @@ class Publish extends WidgetBase
|
||||||
->setNode($form->node->value);
|
->setNode($form->node->value);
|
||||||
//->setLocation($geo)
|
//->setLocation($geo)
|
||||||
//->enableComments()
|
//->enableComments()
|
||||||
if($form->content->value != '') {
|
|
||||||
$p->setContent($form->content->value);
|
|
||||||
|
|
||||||
$content = Markdown::defaultTransform($form->content->value);
|
|
||||||
$p->setContentXhtml(rawurldecode($content));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Still usefull ? Check line 44
|
// Still usefull ? Check line 44
|
||||||
if($form->node->value == 'urn:xmpp:microblog:0') {
|
if($form->node->value == 'urn:xmpp:microblog:0') {
|
||||||
$p->enableComments();
|
$p->enableComments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$content = $content_xhtml = '';
|
||||||
|
|
||||||
|
if($form->content->value != '') {
|
||||||
|
$content = $form->content->value;
|
||||||
|
$content_xhtml = Markdown::defaultTransform($content);
|
||||||
|
}
|
||||||
|
|
||||||
if($form->embed->value != '' && filter_var($form->embed->value, FILTER_VALIDATE_URL)) {
|
if($form->embed->value != '' && filter_var($form->embed->value, FILTER_VALIDATE_URL)) {
|
||||||
try {
|
try {
|
||||||
$embed = Embed\Embed::create($form->embed->value);
|
$embed = Embed\Embed::create($form->embed->value);
|
||||||
|
@ -169,13 +169,21 @@ class Publish extends WidgetBase
|
||||||
$key = key($embed->images);
|
$key = key($embed->images);
|
||||||
$p->setImage($embed->images[0]['value'], $embed->title, $embed->images[0]['mime']);
|
$p->setImage($embed->images[0]['value'], $embed->title, $embed->images[0]['mime']);
|
||||||
} else {
|
} else {
|
||||||
$content .= $this->prepareEmbed($embed);
|
$content_xhtml .= $this->prepareEmbed($embed);
|
||||||
}
|
}
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
error_log($e->getMessage());
|
error_log($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($content != '') {
|
||||||
|
$p->setContent($content);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($content_xhtml != '') {
|
||||||
|
$p->setContentXhtml(rawurldecode($content_xhtml));
|
||||||
|
}
|
||||||
|
|
||||||
$p->request();
|
$p->request();
|
||||||
} else {
|
} else {
|
||||||
RPC::call('Publish.enableSend');
|
RPC::call('Publish.enableSend');
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#post_widget #enable_content > * {
|
form[name=post] #enable_content > * {
|
||||||
transition: opacity 0.3s ease;
|
transition: opacity 0.3s ease;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#post_widget #enable_content:hover > * {
|
form[name=post] #enable_content:hover > * {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#post_widget #content_field {
|
form[name=post] #content_field {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,22 @@ class Rooms extends WidgetBase
|
||||||
{
|
{
|
||||||
$view = $this->tpl();
|
$view = $this->tpl();
|
||||||
$cod = new \modl\ConferenceDAO();
|
$cod = new \modl\ConferenceDAO();
|
||||||
$view->assign('conferences', $cod->getAll());
|
|
||||||
|
$list = $cod->getAll();
|
||||||
|
|
||||||
|
$connected = array();
|
||||||
|
|
||||||
|
foreach($list as $key => $room) {
|
||||||
|
if($this->checkConnected($room->conference, $room->nick)) {
|
||||||
|
$room->connected = true;
|
||||||
|
array_push($connected, $room);
|
||||||
|
unset($list[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$list = array_merge($connected, $list);
|
||||||
|
|
||||||
|
$view->assign('conferences', $list);
|
||||||
$view->assign('room', $this->get('r'));
|
$view->assign('room', $this->get('r'));
|
||||||
|
|
||||||
return $view->draw('_rooms', true);
|
return $view->draw('_rooms', true);
|
||||||
|
|
|
@ -5,11 +5,10 @@
|
||||||
<span class="info">{$conferences|count}</span>
|
<span class="info">{$conferences|count}</span>
|
||||||
</li>
|
</li>
|
||||||
{loop="$conferences"}
|
{loop="$conferences"}
|
||||||
{$connected = $c->checkConnected($value->conference, $value->nick)}
|
|
||||||
<li data-jid="{$value->conference}"
|
<li data-jid="{$value->conference}"
|
||||||
{if="$value->nick != null"} data-nick="{$value->nick}" {/if}
|
{if="$value->nick != null"} data-nick="{$value->nick}" {/if}
|
||||||
class="room {if="$connected"}online{/if}">
|
class="room {if="$value->connected"}online{/if}">
|
||||||
{if="$connected"}
|
{if="$value->connected"}
|
||||||
<span class="icon small bubble color {$value->name|stringToColor}"><i class="zmdi zmdi-accounts"></i></span>
|
<span class="icon small bubble color {$value->name|stringToColor}"><i class="zmdi zmdi-accounts"></i></span>
|
||||||
{else}
|
{else}
|
||||||
<span class="disabled icon small bubble color {$value->name|stringToColor}"><i class="zmdi zmdi-accounts-outline"></i></span>
|
<span class="disabled icon small bubble color {$value->name|stringToColor}"><i class="zmdi zmdi-accounts-outline"></i></span>
|
||||||
|
|
|
@ -11,58 +11,123 @@ class Syndication extends WidgetBase
|
||||||
{
|
{
|
||||||
ob_clean();
|
ob_clean();
|
||||||
|
|
||||||
if(!$this->get('f')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$from = $this->get('f');
|
|
||||||
if(filter_var($from, FILTER_VALIDATE_EMAIL)) {
|
|
||||||
$node = 'urn:xmpp:microblog:0';
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pd = new \modl\PostnDAO();
|
$pd = new \modl\PostnDAO();
|
||||||
$cd = new \modl\ContactDAO();
|
$cd = new \modl\ContactDAO();
|
||||||
|
$id = new \Modl\ItemDAO;
|
||||||
|
|
||||||
$this->view->assign('contact', $cd->get($from, true));
|
if(!$this->get('s')) {
|
||||||
$this->view->assign('uri', Route::urlize('blog',array($from)));
|
return;
|
||||||
|
|
||||||
if(isset($from) && isset($node)) {
|
|
||||||
$messages = $pd->getPublic($from, $node, 10, 0);
|
|
||||||
$this->view->assign('messages', $messages);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($messages[0])) {
|
$from = $this->get('s');
|
||||||
header("Content-Type: application/atom+xml; charset=UTF-8");
|
|
||||||
|
|
||||||
$this->view->assign('date', date('c'));
|
if(filter_var($from, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$node = 'urn:xmpp:microblog:0';
|
||||||
|
$contact = $cd->get($from);
|
||||||
|
} elseif(!$this->get('n')) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
$node = $this->get('n');
|
||||||
|
$item = $id->getItem($from, $node);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function prepareTitle($title)
|
$messages = $pd->getPublic($from, $node, 10, 0);
|
||||||
{
|
header("Content-Type: application/atom+xml; charset=UTF-8");
|
||||||
if($title == null)
|
|
||||||
return '...';
|
|
||||||
else
|
|
||||||
return $this->prepareContent($title, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function prepareContent($content, $title = false)
|
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||||
{
|
$dom->formatOutput = true;
|
||||||
if($title)
|
$feed = $dom->createElementNS('http://www.w3.org/2005/Atom', 'feed');
|
||||||
return cleanHTMLTags($content);
|
$dom->appendChild($feed);
|
||||||
else
|
|
||||||
return trim(cleanHTMLTags(prepareString($content)));
|
|
||||||
}
|
|
||||||
|
|
||||||
function generateUUID($content)
|
$feed->appendChild($dom->createElement('updated', date('c')));
|
||||||
{
|
|
||||||
return generateUUID(serialize($content));
|
|
||||||
}
|
|
||||||
|
|
||||||
function prepareUpdated($date)
|
$feed->appendChild($self = $dom->createElement('link'));
|
||||||
{
|
$self->setAttribute('rel', 'self');
|
||||||
return date('c', strtotime($date));
|
|
||||||
|
if($contact != null) {
|
||||||
|
$feed->appendChild($dom->createElement('title', __('feed.title', $contact->getTrueName())));
|
||||||
|
|
||||||
|
$feed->appendChild($author = $dom->createElement('author'));
|
||||||
|
$author->appendChild($dom->createElement('name', $contact->getTrueName()));
|
||||||
|
$author->appendChild($dom->createElement('uri', Route::urlize('blog',array($from))));
|
||||||
|
|
||||||
|
$feed->appendChild($dom->createElement('logo', $contact->getPhoto('xl')));
|
||||||
|
|
||||||
|
$self->setAttribute('href', Route::urlize('feed',array($server)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if($item != null) {
|
||||||
|
if($item->name) {
|
||||||
|
$feed->appendChild($dom->createElement('title', $item->name));
|
||||||
|
} else {
|
||||||
|
$feed->appendChild($dom->createElement('title', $item->node));
|
||||||
|
}
|
||||||
|
|
||||||
|
if($item->description) {
|
||||||
|
$feed->appendChild($dom->createElement('subtitle', $item->description));
|
||||||
|
} else {
|
||||||
|
$feed->appendChild($dom->createElement('subtitle', $item->server));
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->setAttribute('href', Route::urlize('feed',array($server, $node)));
|
||||||
|
}
|
||||||
|
|
||||||
|
$feed->appendChild($generator = $dom->createElement('generator', 'Movim'));
|
||||||
|
$generator->setAttribute('uri', 'https://movim.eu');
|
||||||
|
$generator->setAttribute('version', APP_VERSION);
|
||||||
|
|
||||||
|
foreach($messages as $message) {
|
||||||
|
$feed->appendChild($entry = $dom->createElement('entry'));
|
||||||
|
|
||||||
|
if($message->title) {
|
||||||
|
$entry->appendChild($dom->createElement('title', $message->title));
|
||||||
|
} else {
|
||||||
|
$entry->appendChild($dom->createElement('title', __('post.default_title')));
|
||||||
|
}
|
||||||
|
|
||||||
|
$entry->appendChild($dom->createElement('id', $message->getUUID()));
|
||||||
|
$entry->appendChild($dom->createElement('updated', date('c', strtotime($message->updated))));
|
||||||
|
|
||||||
|
$entry->appendChild($content = $dom->createElement('content'));
|
||||||
|
$content->appendChild($div = $dom->createElementNS('http://www.w3.org/1999/xhtml', 'div'));
|
||||||
|
$content->setAttribute('type', 'xhtml');
|
||||||
|
|
||||||
|
$f = $dom->createDocumentFragment();
|
||||||
|
$f->appendXML($message->contentcleaned);
|
||||||
|
$div->appendChild($f);
|
||||||
|
|
||||||
|
//$div->appendChild($dom->createCDATASection($message->contentcleaned));
|
||||||
|
|
||||||
|
$attachements = $message->getAttachements();
|
||||||
|
|
||||||
|
if(isset($attachements['pictures'])) {
|
||||||
|
foreach($attachements['pictures'] as $value) {
|
||||||
|
$entry->appendChild($link = $dom->createElement('link'));
|
||||||
|
$link->setAttribute('rel', 'enclosure');
|
||||||
|
$link->setAttribute('type', $value['type']);
|
||||||
|
$link->setAttribute('href', $value['href']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($attachements['files'])) {
|
||||||
|
foreach($attachements['files'] as $value) {
|
||||||
|
$entry->appendChild($link = $dom->createElement('link'));
|
||||||
|
$link->setAttribute('rel', 'enclosure');
|
||||||
|
$link->setAttribute('type', $value['type']);
|
||||||
|
$link->setAttribute('href', $value['href']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($attachements['links'])) {
|
||||||
|
foreach($attachements['files'] as $value) {
|
||||||
|
$entry->appendChild($link = $dom->createElement('link'));
|
||||||
|
$link->setAttribute('rel', 'alternate');
|
||||||
|
$link->setAttribute('href', $value['href']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $dom->saveXML();
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
{if="isset($contact)"}
|
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
||||||
<title>{$c->__('feed.title', $contact->getTrueName())}</title>
|
|
||||||
<updated>{$date}</updated>
|
|
||||||
<author>
|
|
||||||
<name>{$contact->getTrueName()}</name>
|
|
||||||
<uri><![CDATA[{$uri}]]></uri>
|
|
||||||
</author>
|
|
||||||
{$link}
|
|
||||||
<logo>{$contact->getPhoto('xl')}</logo>
|
|
||||||
|
|
||||||
<generator uri="http://movim.eu/" version="{#APP_VERSION#}">
|
|
||||||
Movim
|
|
||||||
</generator>
|
|
||||||
|
|
||||||
<id>urn:uuid:{$uuid}</id>
|
|
||||||
{if="!empty($messages)"}
|
|
||||||
{loop="$messages"}
|
|
||||||
<entry>
|
|
||||||
<title>
|
|
||||||
{if="$value->title != null"}
|
|
||||||
<![CDATA[{$c->prepareTitle($value->title)}]]>
|
|
||||||
{else}
|
|
||||||
<![CDATA[{$c->__('post.default_title')}]]>
|
|
||||||
{/if}
|
|
||||||
</title>
|
|
||||||
<id>urn:uuid:{$c->generateUUID($value->content)}</id>
|
|
||||||
<updated>{$c->prepareUpdated($value->published)}</updated>
|
|
||||||
<content type="html">
|
|
||||||
{if="$value->contentcleaned"}
|
|
||||||
<![CDATA[{$value->contentcleaned}]]>
|
|
||||||
{else}
|
|
||||||
<![CDATA[{$value->content|html_entity_decode|prepareString}]]>
|
|
||||||
{/if}
|
|
||||||
</content>
|
|
||||||
</entry>
|
|
||||||
{/if}
|
|
||||||
{/loop}
|
|
||||||
</feed>
|
|
||||||
{else}
|
|
||||||
{$c->__('feed.nope_contact')}
|
|
||||||
{/if}
|
|
|
@ -5,7 +5,6 @@ var Upload = {
|
||||||
|
|
||||||
init : function() {
|
init : function() {
|
||||||
document.getElementById('file').addEventListener('change', function(){
|
document.getElementById('file').addEventListener('change', function(){
|
||||||
console.log(this);
|
|
||||||
var file = this.files[0];
|
var file = this.files[0];
|
||||||
Upload_ajaxSend({
|
Upload_ajaxSend({
|
||||||
name: file.name,
|
name: file.name,
|
||||||
|
|
|
@ -31,6 +31,10 @@ $parser = new \Moxl\Parser;
|
||||||
|
|
||||||
$buffer = '';
|
$buffer = '';
|
||||||
|
|
||||||
|
function handleSSLErrors($errno, $errstr) {
|
||||||
|
fwrite(STDERR, colorize(getenv('sid'), 'yellow')." : ".colorize($errstr, 'red')."\n");
|
||||||
|
}
|
||||||
|
|
||||||
$stdin_behaviour = function ($data) use (&$conn, $loop, &$buffer, &$connector, &$xmpp_behaviour, &$parser) {
|
$stdin_behaviour = function ($data) use (&$conn, $loop, &$buffer, &$connector, &$xmpp_behaviour, &$parser) {
|
||||||
if(substr($data, -1) == "") {
|
if(substr($data, -1) == "") {
|
||||||
$messages = explode("", $buffer . substr($data, 0, -1));
|
$messages = explode("", $buffer . substr($data, 0, -1));
|
||||||
|
@ -113,7 +117,16 @@ $xmpp_behaviour = function (React\Stream\Stream $stream) use (&$conn, $loop, &$s
|
||||||
stream_context_set_option($conn->stream, 'ssl', 'allow_self_signed', true);
|
stream_context_set_option($conn->stream, 'ssl', 'allow_self_signed', true);
|
||||||
#stream_context_set_option($conn->stream, 'ssl', 'verify_peer_name', false);
|
#stream_context_set_option($conn->stream, 'ssl', 'verify_peer_name', false);
|
||||||
#stream_context_set_option($conn->stream, 'ssl', 'verify_peer', false);
|
#stream_context_set_option($conn->stream, 'ssl', 'verify_peer', false);
|
||||||
|
set_error_handler('handleSSLErrors');
|
||||||
$out = stream_socket_enable_crypto($conn->stream, 1, STREAM_CRYPTO_METHOD_TLS_CLIENT);
|
$out = stream_socket_enable_crypto($conn->stream, 1, STREAM_CRYPTO_METHOD_TLS_CLIENT);
|
||||||
|
restore_error_handler();
|
||||||
|
|
||||||
|
if($out !== true) {
|
||||||
|
$loop->stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fwrite(STDERR, colorize(getenv('sid'), 'yellow')." : ".colorize('TLS enabled', 'blue')."\n");
|
||||||
|
|
||||||
$restart = true;
|
$restart = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Route extends \BaseController {
|
||||||
'conf' => false,
|
'conf' => false,
|
||||||
'contact' => array('f'),
|
'contact' => array('f'),
|
||||||
'disconnect' => array('err'),
|
'disconnect' => array('err'),
|
||||||
'feed' => array('f'),
|
'feed' => array('s', 'n'),
|
||||||
'grouppublic' => array('s', 'n', 'i'),
|
'grouppublic' => array('s', 'n', 'i'),
|
||||||
'group' => array('s', 'n', 'i'),
|
'group' => array('s', 'n', 'i'),
|
||||||
'help' => false,
|
'help' => false,
|
||||||
|
|
|
@ -226,7 +226,7 @@ ul li div.bubble {
|
||||||
}
|
}
|
||||||
|
|
||||||
ul li div.bubble div {
|
ul li div.bubble div {
|
||||||
white-space: pre-wrap;
|
/*white-space: pre-wrap;*/
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -714,6 +714,19 @@ main section > div:first-child:nth-last-child(2) ~ div .actions.fixed > div:last
|
||||||
transform: translateX(0);
|
transform: translateX(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.snackbar > a {
|
||||||
|
pointer-events: auto;
|
||||||
|
margin: -1rem -2rem;
|
||||||
|
display: block;
|
||||||
|
margin: -2rem -1rem;
|
||||||
|
padding: 2rem 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.snackbar > a:hover {
|
||||||
|
border: 3px solid rgba(255, 255, 255, 0.2);
|
||||||
|
padding: calc(2rem - 3px) calc(1rem - 3px);
|
||||||
|
}
|
||||||
|
|
||||||
.snackbar p,
|
.snackbar p,
|
||||||
.toast p {
|
.toast p {
|
||||||
color: white;
|
color: white;
|
||||||
|
|
Loading…
Add table
Reference in a new issue