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

upgrade to movim 0.9b 2015-08-31

This commit is contained in:
src386 2015-08-31 14:49:04 +02:00
parent 6ed029559e
commit d0b0a14396
17 changed files with 138 additions and 105 deletions

View file

@ -5,12 +5,12 @@ Movim is a decentralized social network, written in PHP and HTML5 and based on t
Warning: BETA. Warning: BETA.
Current Movim version : 0.9 git2015-08-27 Current Movim version : 0.9 git2015-08-31
**Changelog** **Changelog**
0.9b 2015-08-27 0.9b 2015-0
- Update to Movim 0.9 git2015-08-27 - Update to Movim 0.9 git2015-08-31
- Add notes in README about public pods & whitelisting - Add notes in README about public pods & whitelisting
- Remove script now delete Movim php5-fpm pool. - Remove script now delete Movim php5-fpm pool.
- Remove script delete 'movim' user after shutting down Movim service. - Remove script delete 'movim' user after shutting down Movim service.

View file

@ -47,17 +47,9 @@ class MovimEmoji
} }
} }
/** function addUrls($string, $preview = false) {
* @desc Prepare the string (add the a to the links and show the smileys)
*
* @param string $string
* @param boolean display large emojis
* @param check the links and convert them to pictures (heavy)
* @return string
*/
function prepareString($string, $large = false, $preview = false) {
// Add missing links // Add missing links
$string = preg_replace_callback( return preg_replace_callback(
"/([\w\"'>]+\:\/\/[\w-?&;#+%:~=\.\/\@]+[\w\/])/", function ($match) use($preview) { "/([\w\"'>]+\:\/\/[\w-?&;#+%:~=\.\/\@]+[\w\/])/", function ($match) use($preview) {
if(!in_array(substr($match[0], 0, 1), array('>', '"', '\''))) { if(!in_array(substr($match[0], 0, 1), array('>', '"', '\''))) {
$content = $match[0]; $content = $match[0];
@ -84,6 +76,18 @@ function prepareString($string, $large = false, $preview = false) {
}, $string }, $string
); );
}
/**
* @desc Prepare the string (add the a to the links and show the smileys)
*
* @param string $string
* @param boolean display large emojis
* @param check the links and convert them to pictures (heavy)
* @return string
*/
function prepareString($string, $large = false, $preview = false) {
$string = addUrls($string, $preview);
// We remove all the style attributes // We remove all the style attributes
$string = preg_replace_callback( $string = preg_replace_callback(
@ -94,16 +98,7 @@ function prepareString($string, $large = false, $preview = false) {
// Twitter hashtags // Twitter hashtags
$string = preg_replace_callback( $string = preg_replace_callback(
"/ #[a-zA-Z0-9_-]{3,}/", function ($match) { "/ #[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);
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( $string = preg_replace_callback(
"/ @[a-zA-Z0-9_-]{3,}/", function ($match) { "/ @[a-zA-Z0-9_-]{3,}/", function ($match) {
return return

View file

@ -2,6 +2,8 @@
namespace modl; namespace modl;
use Respect\Validation\Validator;
class Contact extends Model { class Contact extends Model {
public $jid; public $jid;
@ -160,11 +162,10 @@ class Contact extends Model {
public function set($vcard, $jid) { public function set($vcard, $jid) {
$this->__set('jid', \echapJid($jid)); $this->__set('jid', \echapJid($jid));
$validate_date = Validator::date('Y-m-d');
if(isset($vcard->vCard->BDAY) if(isset($vcard->vCard->BDAY)
&& (string)$vcard->vCard->BDAY != '') && $validate_date->validate($vcard->vCard->BDAY))
$this->__set('date', (string)$vcard->vCard->BDAY); $this->__set('date', (string)$vcard->vCard->BDAY);
else
$this->__set('date', null);
$this->__set('date', date(DATE_ISO8601, strtotime($this->date))); $this->__set('date', date(DATE_ISO8601, strtotime($this->date)));
@ -259,11 +260,11 @@ class Contact extends Model {
} }
public function setVcard4($vcard) { public function setVcard4($vcard) {
/*if(isset($vcard->bday->date)) $validate_date = Validator::date('Y-m-d');
if(isset($vcard->bday->date)
&& $validate_date->validate($vcard->bday->date))
$this->__set('date', (string)$vcard->bday->date); $this->__set('date', (string)$vcard->bday->date);
if(empty($this->date))
$this->__set('date', null);
*/
$this->__set('name', (string)$vcard->nickname->text); $this->__set('name', (string)$vcard->nickname->text);
$this->__set('fn', (string)$vcard->fn->text); $this->__set('fn', (string)$vcard->fn->text);
$this->__set('url', (string)$vcard->url->uri); $this->__set('url', (string)$vcard->url->uri);

View file

@ -95,4 +95,15 @@ class Message extends Model {
$this->delivered = gmdate('Y-m-d H:i:s'); $this->delivered = gmdate('Y-m-d H:i:s');
} }
} }
public function convertEmojis()
{
$emoji = \MovimEmoji::getInstance();
$this->body = $emoji->replace($this->body);
}
public function addUrls()
{
$this->body = addUrls($this->body);
}
} }

View file

@ -34,10 +34,11 @@
</div> </div>
<ul> <ul>
<!--
<li class="subheader"> <li class="subheader">
{$c->__('compatibility.info')} {$c->__('compatibility.info')}
</li> </li>
-->
{if="$dbconnected"} {if="$dbconnected"}
{if="$dbinfos > 0"} {if="$dbinfos > 0"}
<li> <li>

View file

@ -485,11 +485,14 @@ class Chat extends WidgetBase
function prepareMessage(&$message) function prepareMessage(&$message)
{ {
/*if(isset($message->html)) { if(isset($message->html)) {
$message->body = $message->html; $message->body = $message->html;
} else { } else {
$message->body = prepareString(htmlentities($message->body , ENT_COMPAT,'UTF-8')); // We add some smileys...
}*/ $message->convertEmojis();
$message->addUrls();
// $message->body = prepareString(htmlentities($message->body , ENT_COMPAT,'UTF-8'));
}
if($message->type == 'groupchat') { if($message->type == 'groupchat') {
$message->color = stringToColor($message->session.$message->resource.$message->jidfrom.$message->type); $message->color = stringToColor($message->session.$message->resource.$message->jidfrom.$message->type);

View file

@ -131,14 +131,6 @@
</li> </li>
{/if} {/if}
{if="$contact->description != null && trim($contact->description) != ''"}
<li class="condensed block">
<span class="icon gray"><i class="zmdi zmdi-format-align-justify"></i></span>
<span>{$c->__('general.about')}</span>
<p class="all">{$contact->description}</p>
</li>
{/if}
{if="$contact->mood != null"} {if="$contact->mood != null"}
{$moods = unserialize($contact->mood)} {$moods = unserialize($contact->mood)}
<li class="condensed block"> <li class="condensed block">
@ -150,7 +142,16 @@
</p> </p>
</li> </li>
{/if} {/if}
{if="$contact->description != null && trim($contact->description) != ''"}
<li class="condensed block large">
<span class="icon gray"><i class="zmdi zmdi-format-align-justify"></i></span>
<span>{$c->__('general.about')}</span>
<p class="all">{$contact->description}</p>
</li>
{/if}
</ul> </ul>
<br />
{if="$blog != null"} {if="$blog != null"}
<ul class="active"> <ul class="active">

View file

@ -157,14 +157,18 @@ class Publish extends WidgetBase
} }
if($form->embed->value != '' && filter_var($form->embed->value, FILTER_VALIDATE_URL)) { if($form->embed->value != '' && filter_var($form->embed->value, FILTER_VALIDATE_URL)) {
$embed = Embed\Embed::create($form->embed->value); try {
$p->setLink($form->embed->value); $embed = Embed\Embed::create($form->embed->value);
$p->setLink($form->embed->value);
if($embed->type == 'photo') { if($embed->type == 'photo') {
$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 .= $this->prepareEmbed($embed);
}
} catch(Exception $e) {
error_log($e->getMessage());
} }
} }
@ -185,15 +189,19 @@ class Publish extends WidgetBase
return; return;
} }
$embed = Embed\Embed::create($url); try {
$html = $this->prepareEmbed($embed); $embed = Embed\Embed::create($url);
$html = $this->prepareEmbed($embed);
if($embed->type == 'photo') { if($embed->type == 'photo') {
RPC::call('movim_fill', 'gallery', $this->prepareGallery($embed)); RPC::call('movim_fill', 'gallery', $this->prepareGallery($embed));
RPC::call('movim_fill', 'preview', ''); RPC::call('movim_fill', 'preview', '');
} else { } else {
RPC::call('movim_fill', 'preview', $html); RPC::call('movim_fill', 'preview', $html);
RPC::call('movim_fill', 'gallery', ''); RPC::call('movim_fill', 'gallery', '');
}
} catch(Exception $e) {
error_log($e->getMessage());
} }
} }

View file

@ -1,4 +1,4 @@
<q cite="{$embed->url}"> <div class="quote" cite="{$embed->url}">
<ul> <ul>
<li> <li>
<span> <span>
@ -17,4 +17,4 @@
</li> </li>
{/if} {/if}
</ul> </ul>
</q> </div>

View file

@ -16,6 +16,7 @@ class Rooms extends WidgetBase
$this->registerEvent('bookmark_set_handle', 'onBookmark'); $this->registerEvent('bookmark_set_handle', 'onBookmark');
$this->registerEvent('presence_muc_handle', 'onConnected'); $this->registerEvent('presence_muc_handle', 'onConnected');
$this->registerEvent('presence_unavailable_handle', 'onDisconnected'); $this->registerEvent('presence_unavailable_handle', 'onDisconnected');
$this->registerEvent('presence_muc_errorconflict', 'onConflict');
} }
function onBookmark() function onBookmark()
@ -29,6 +30,11 @@ class Rooms extends WidgetBase
$this->refreshRooms(); $this->refreshRooms();
} }
function onConflict()
{
Notification::append(null, $this->__('chatrooms.conflict'));
}
function onDisconnected() function onDisconnected()
{ {
// We reset the Chat view // We reset the Chat view

View file

@ -18,16 +18,17 @@
<span class="second">{$value->conference}</span> <span class="second">{$value->conference}</span>
</li> </li>
{/loop} {/loop}
{if="$conferences == null"}
<li class="condensed">
<span class="icon green">
<i class="zmdi zmdi-accounts-outline"></i>
</span>
<p>{$c->__('rooms.empty_text1')} {$c->__('rooms.empty_text2')}</p>
</li>
{/if}
</ul> </ul>
{if="$conferences == null"}
<ul class="thick spaced">
<li class="condensed">
<span class="icon green">
<i class="zmdi zmdi-accounts-outline"></i>
</span>
<p>{$c->__('rooms.empty_text1')} {$c->__('rooms.empty_text2')}</p>
</li>
</ul>
{/if}
{else} {else}
{if="$c->getView() == 'room' && $room != false"} {if="$c->getView() == 'room' && $room != false"}
<div class="placeholder icon"> <div class="placeholder icon">

View file

@ -17,6 +17,7 @@ connected = Connected to the chatroom
disconnected = Disconnected from the chatroom disconnected = Disconnected from the chatroom
users = Users in the room users = Users in the room
bad_nickname = Please enter a correct nickname (2 to 40 characters) bad_nickname = Please enter a correct nickname (2 to 40 characters)
conflict = Username already taken
[bookmarks] [bookmarks]
updated = Bookmarks updated updated = Bookmarks updated

View file

@ -154,17 +154,17 @@
<h3 class="block large">{$c->__('accounts.accounts_title')}</h3> <h3 class="block large">{$c->__('accounts.accounts_title')}</h3>
<div class="block"> <div class="block">
<input type="text" name="twitter" class="content" value="{$me->twitter}" placeholder="{$c->__('accounts.nickname')}"> <input type="text" name="twitter" class="content" value="{$me->twitter}" placeholder="{$c->__('accounts.twitter')}">
<label for="twitter"><i class="fa fa-twitter"></i> {$c->__('accounts.twitter')}</label> <label for="twitter"><i class="fa fa-twitter"></i> {$c->__('accounts.twitter')}</label>
</div> </div>
<div class="block"> <div class="block">
<input type="text" name="skype" class="content" value="{$me->skype}" placeholder="{$c->__('accounts.nickname')}"> <input type="text" name="skype" class="content" value="{$me->skype}" placeholder="{$c->__('accounts.skype')}">
<label for="skype"><i class="fa fa-skype"></i> {$c->__('accounts.skype')}</label> <label for="skype"><i class="fa fa-skype"></i> {$c->__('accounts.skype')}</label>
</div> </div>
<div class="block"> <div class="block">
<input type="email" name="yahoo" class="content" value="{$me->yahoo}" placeholder="{$c->__('accounts.accounts_yahoo')}"> <input type="email" name="yahoo" class="content" value="{$me->yahoo}" placeholder="{$c->__('accounts.yahoo')}">
<label for="skype"><i class="fa fa-yahoo"></i> {$c->__('accounts.yahoo')}</label> <label for="skype"><i class="fa fa-yahoo"></i> {$c->__('accounts.yahoo')}</label>
</div> </div>

View file

@ -25,9 +25,8 @@ country = Country
accounts_title = Accounts accounts_title = Accounts
twitter = Twitter twitter = Twitter
skype = Skype skype = Skype
yahoo = Yahoo yahoo = Yahoo Account
accounts_nickname = Nickname accounts_nickname = Nickname
accounts_yahoo = Yahoo Account
[privacy] [privacy]
privacy_title = Privacy Level privacy_title = Privacy Level

View file

@ -321,7 +321,7 @@ class Bootstrap {
if(file_exists(DOCUMENT_ROOT.'/config/db.inc.php')) { if(file_exists(DOCUMENT_ROOT.'/config/db.inc.php')) {
require DOCUMENT_ROOT.'/config/db.inc.php'; require DOCUMENT_ROOT.'/config/db.inc.php';
} else { } else {
throw new MovimException('Cannot find config/db.inc.php file'); throw new Exception('Cannot find config/db.inc.php file');
} }
$db->setConnectionArray($conf); $db->setConnectionArray($conf);

View file

@ -40,9 +40,14 @@
define('DOCUMENT_ROOT', dirname(__FILE__)); define('DOCUMENT_ROOT', dirname(__FILE__));
require_once(DOCUMENT_ROOT.'/bootstrap.php'); require_once(DOCUMENT_ROOT.'/bootstrap.php');
$bootstrap = new Bootstrap(); try {
$bootstrap = new Bootstrap();
$bootstrap->boot(); $bootstrap->boot();
} catch(Exception $e) {
error_log($e->getMessage());
echo 'Oops, something went wrong, please check the log files';
return;
}
$rqst = new FrontController(); $rqst = new FrontController();
$rqst->handle(); $rqst->handle();

View file

@ -89,7 +89,8 @@ article section content em {
/* Some CSS to style the quote XHTML generated by Movim */ /* Some CSS to style the quote XHTML generated by Movim */
article section content blockquote, article section content blockquote,
article section content q { article section content q,
article section content div.quote {
display: block; display: block;
border-radius: 2px; border-radius: 2px;
border: 1px solid rgba(0, 0, 0, 0.12); border: 1px solid rgba(0, 0, 0, 0.12);
@ -97,34 +98,34 @@ article section content q {
box-sizing: border-box; box-sizing: border-box;
} }
article section content q:before, article section content div.quote:before,
article section content q:after { article section content div.quote:after {
content: ''; content: '';
display: none; display: none;
} }
article section content q ul { article section content div.quote ul {
display: flex; display: flex;
flex-flow: row wrap; flex-flow: row wrap;
} }
article section content q li { article section content div.quote li {
flex: 1 25%; flex: 1 25%;
list-style-type: none; list-style-type: none;
padding-left: 0; padding-left: 0;
} }
article section content q li:first-child { article section content div.quote li:first-child {
flex: 1 75%; flex: 1 75%;
} }
@media screen and (max-width: 1024px) { @media screen and (max-width: 1024px) {
article section content q li { article section content div.quote li {
flex: 1 100%; flex: 1 100%;
} }
} }
article section content q li img { article section content div.quote li img {
max-height: 10rem; max-height: 10rem;
max-width: 100%; max-width: 100%;
float: right; float: right;