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.
Current Movim version : 0.9 git2015-08-27
Current Movim version : 0.9 git2015-08-31
**Changelog**
0.9b 2015-08-27
- Update to Movim 0.9 git2015-08-27
0.9b 2015-0
- Update to Movim 0.9 git2015-08-31
- Add notes in README about public pods & whitelisting
- Remove script now delete Movim php5-fpm pool.
- Remove script delete 'movim' user after shutting down Movim service.

View file

@ -47,17 +47,9 @@ class MovimEmoji
}
}
/**
* @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) {
function addUrls($string, $preview = false) {
// Add missing links
$string = preg_replace_callback(
return preg_replace_callback(
"/([\w\"'>]+\:\/\/[\w-?&;#+%:~=\.\/\@]+[\w\/])/", function ($match) use($preview) {
if(!in_array(substr($match[0], 0, 1), array('>', '"', '\''))) {
$content = $match[0];
@ -84,6 +76,18 @@ function prepareString($string, $large = false, $preview = false) {
}, $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
$string = preg_replace_callback(
@ -94,16 +98,7 @@ function prepareString($string, $large = false, $preview = false) {
// 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
);
"/ #[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

View file

@ -2,6 +2,8 @@
namespace modl;
use Respect\Validation\Validator;
class Contact extends Model {
public $jid;
@ -160,11 +162,10 @@ class Contact extends Model {
public function set($vcard, $jid) {
$this->__set('jid', \echapJid($jid));
$validate_date = Validator::date('Y-m-d');
if(isset($vcard->vCard->BDAY)
&& (string)$vcard->vCard->BDAY != '')
&& $validate_date->validate($vcard->vCard->BDAY))
$this->__set('date', (string)$vcard->vCard->BDAY);
else
$this->__set('date', null);
$this->__set('date', date(DATE_ISO8601, strtotime($this->date)));
@ -259,11 +260,11 @@ class Contact extends Model {
}
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);
if(empty($this->date))
$this->__set('date', null);
*/
$this->__set('name', (string)$vcard->nickname->text);
$this->__set('fn', (string)$vcard->fn->text);
$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');
}
}
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>
<ul>
<!--
<li class="subheader">
{$c->__('compatibility.info')}
</li>
-->
{if="$dbconnected"}
{if="$dbinfos > 0"}
<li>

View file

@ -485,11 +485,14 @@ class Chat extends WidgetBase
function prepareMessage(&$message)
{
/*if(isset($message->html)) {
if(isset($message->html)) {
$message->body = $message->html;
} 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') {
$message->color = stringToColor($message->session.$message->resource.$message->jidfrom.$message->type);

View file

@ -131,14 +131,6 @@
</li>
{/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"}
{$moods = unserialize($contact->mood)}
<li class="condensed block">
@ -150,7 +142,16 @@
</p>
</li>
{/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>
<br />
{if="$blog != null"}
<ul class="active">

View file

@ -157,6 +157,7 @@ class Publish extends WidgetBase
}
if($form->embed->value != '' && filter_var($form->embed->value, FILTER_VALIDATE_URL)) {
try {
$embed = Embed\Embed::create($form->embed->value);
$p->setLink($form->embed->value);
@ -166,6 +167,9 @@ class Publish extends WidgetBase
} else {
$content .= $this->prepareEmbed($embed);
}
} catch(Exception $e) {
error_log($e->getMessage());
}
}
$p->setContentXhtml(rawurldecode($content))
@ -185,6 +189,7 @@ class Publish extends WidgetBase
return;
}
try {
$embed = Embed\Embed::create($url);
$html = $this->prepareEmbed($embed);
@ -195,6 +200,9 @@ class Publish extends WidgetBase
RPC::call('movim_fill', 'preview', $html);
RPC::call('movim_fill', 'gallery', '');
}
} catch(Exception $e) {
error_log($e->getMessage());
}
}
function prepareEmbed($embed)

View file

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

View file

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

View file

@ -18,16 +18,17 @@
<span class="second">{$value->conference}</span>
</li>
{/loop}
</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>
{/if}
</ul>
{/if}
{else}
{if="$c->getView() == 'room' && $room != false"}
<div class="placeholder icon">

View file

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

View file

@ -154,17 +154,17 @@
<h3 class="block large">{$c->__('accounts.accounts_title')}</h3>
<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>
</div>
<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>
</div>
<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>
</div>

View file

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

View file

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

View file

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

View file

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