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

update to movim upstream

This commit is contained in:
src386 2016-03-17 13:44:43 +01:00
parent ee83b59c76
commit a6b322b178
9 changed files with 46 additions and 55 deletions

View file

@ -0,0 +1,13 @@
/**
* @brief Open the URLs in the default browser
*/
if(typeof require !== 'undefined') {
document.addEventListener('click', function(event) {
if(event.target.target == '_blank'
|| (event.target.hostname != null && event.target.hostname != BASE_HOST)) {
event.preventDefault();
var shell = require('electron').shell;
shell.openExternal(event.target.href);
}
});
}

View file

@ -98,46 +98,6 @@ function addHFR($string) {
function prepareString($string, $large = false, $preview = false) {
$string = addUrls($string, $preview);
// We remove all the style attributes
/*$string = preg_replace_callback(
'/(<[^>]+) style=".*?"/i', function($match) {
return $match[1];
}, $string
);
// Twitter hashtags
$string = preg_replace_callback(
"/ #[a-zA-Z0-9_-]{3,}/", function ($match) { return ' <a class="twitter hastag" href="http://twitter.com/search?q='. urlencode(trim($match[0])). '&src=hash" target="_blank">'. trim($match[0]). '</a>'; }, ' ' . $string);
$string = preg_replace_callback(
"/ @[a-zA-Z0-9_-]{3,}/", function ($match) {
return
' <a class="twitter at" href="http://twitter.com/'.
trim($match[0]).
'" target="_blank">'.
trim($match[0]).
'</a>';
}, ' ' . $string
);
//remove all scripts
$string = preg_replace_callback(
'#<[/]?script[^>]*>#is', function ($match) {
return '';
}, ' ' . $string
);
//remove all iframe
$string = preg_replace_callback(
'#<[/]?iframe[^>]*>#is', function ($match) {
return '';
}, ' ' . $string
);
//remove all iframe
$string = preg_replace_callback(
'#<[/]?ss[^>]*>#is', function ($match) {
return '';
}, ' ' . $string
);*/
// We add some smileys...
$emoji = MovimEmoji::getInstance();
$string = $emoji->replace($string, $large);
@ -157,6 +117,16 @@ function fixSelfClosing($string) {
, $string);
}
/**
* @desc Escape the unescaped ampersand
*/
function escapeAmpersands($string) {
return preg_replace(
'/&[^; ]{0,6}.?/e',
"((substr('\\0',-1) == ';') ? '\\0' : '&amp;'.substr('\\0',1))",
$string);
}
/**
* Remove the content, body and html tags
*/

View file

@ -98,8 +98,10 @@ class Message extends Model {
$images = (bool)($this->type == 'chat');
\movim_log((string)$stanza->html->body);
if($stanza->html) {
$xhtml = new \SimpleXMLElement('<body xmlns="http://www.w3.org/1999/xhtml">'.(string)$stanza->html->body.'</body>');
$xhtml = new \SimpleXMLElement('<body xmlns="http://www.w3.org/1999/xhtml">'.escapeAmpersands((string)$stanza->html->body).'</body>');
$xhtml->registerXPathNamespace('xhtml', 'http://www.w3.org/1999/xhtml');
$img = $xhtml->xpath('//xhtml:img/@src')[0];
if($img) {

View file

@ -1,8 +1,9 @@
<ul id="obb" class="thick">
<ul id="obb" class="list thick">
<li class="condensed">
<span class="icon bubble color blue">
<span class="primary icon bubble color blue">
<i class="zmdi zmdi-chevron-right"></i>
</span>
<p></p>
<p>
{$c->__('oob.about')}
</p>

View file

@ -1,6 +1,6 @@
<br />
<h2>{$c->__('explore.explore')}</h2>
<ul id="public_list" class="list flex card shadow active middle">
<ul id="public_list" class="list flex card shadow active">
{$users}
</ul>

View file

@ -1,24 +1,23 @@
{loop="$users"}
<li class="block" style="background-image: url();" onclick="Contact_ajaxGetContact('{$value->jid}', {if="$page"}{$page}{else}0{/if});">
{$url = $value->getPhoto('s')}
{$url = $value->getPhoto('l')}
{if="$url"}
<span class="primary icon bubble">
<img src="{$url}">
<span class="primary icon thumb" style="background-image: url({$url});">
</span>
{else}
<span class="primary icon bubble color {$value->jid|stringToColor}">
<span class="primary icon thumb color {$value->jid|stringToColor}">
<i class="zmdi zmdi-account"></i>
</span>
{/if}
<p class="normal">
{$value->getTrueName()}
{if="$value->getAge()"}
<span class="info">{$c->__('age.years', $value->getAge())}</span>
<span class="second">{$c->__('age.years', $value->getAge())}</span>
{/if}
{if="$value->getGender()"}
<span class="info">{$value->getGender()}</span>
<span class="second">{$value->getGender()}</span>
{/if}
{$value->getTrueName()}
</p>
{if="$value->description != ''"}

View file

@ -174,6 +174,7 @@ class Post extends WidgetBase
$view->assign('top', $cd->getTop(6));
$view->assign('blogs', $nd->getLastBlogPublic(0, 6));
$view->assign('posts', $nd->getLastPublished(0, 4));
$view->assign('jid', $this->user->getLogin());
return $view->draw('_post_empty', true);
}

View file

@ -131,8 +131,10 @@ class Picture {
if($im != false) {
$im->setImageFormat($format);
$im->setImageBackgroundColor('#ffffff');
$im = $im->flattenImages();
if($format == 'jpeg') {
$im->setImageBackgroundColor('#ffffff');
$im = $im->flattenImages();
}
$im->setImageCompressionQuality(95);
$im->setInterlaceScheme(Imagick::INTERLACE_PLANE);
@ -160,8 +162,10 @@ class Picture {
$im->readImageBlob($this->_bin);
$im->setImageFormat($format);
$im->setImageBackgroundColor('#ffffff');
$im = $im->flattenImages();
if($format == 'jpeg') {
$im->setImageBackgroundColor('#ffffff');
$im = $im->flattenImages();
}
$geo = $im->getImageGeometry();

View file

@ -60,6 +60,7 @@ class BaseController {
$this->page->addScript('movim_hash.js');
$this->page->addScript('movim_utils.js');
$this->page->addScript('movim_base.js');
$this->page->addScript('movim_electron.js');
if(!$this->public) {
$this->page->addScript('movim_tpl.js');