diff --git a/README.md b/README.md
index e3ea66d..e8fe708 100644
--- a/README.md
+++ b/README.md
@@ -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.
diff --git a/sources/app/helpers/StringHelper.php b/sources/app/helpers/StringHelper.php
index 3a6edce..2ff9590 100644
--- a/sources/app/helpers/StringHelper.php
+++ b/sources/app/helpers/StringHelper.php
@@ -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
- ' ';
- }, ' ' . $string
- );
-
+ "/ #[a-zA-Z0-9_-]{3,}/", function ($match) { return ' '; }, ' ' . $string);
$string = preg_replace_callback(
"/ @[a-zA-Z0-9_-]{3,}/", function ($match) {
return
diff --git a/sources/app/models/contact/Contact.php b/sources/app/models/contact/Contact.php
index 79a2f82..0f83065 100644
--- a/sources/app/models/contact/Contact.php
+++ b/sources/app/models/contact/Contact.php
@@ -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);
diff --git a/sources/app/models/message/Message.php b/sources/app/models/message/Message.php
index 3ec9429..4b3bb46 100644
--- a/sources/app/models/message/Message.php
+++ b/sources/app/models/message/Message.php
@@ -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);
+ }
}
diff --git a/sources/app/widgets/AdminTest/admintest.tpl b/sources/app/widgets/AdminTest/admintest.tpl
index 39968fa..a08ecd8 100644
--- a/sources/app/widgets/AdminTest/admintest.tpl
+++ b/sources/app/widgets/AdminTest/admintest.tpl
@@ -34,10 +34,11 @@
+
{if="$dbconnected"}
{if="$dbinfos > 0"}
-
diff --git a/sources/app/widgets/Chat/Chat.php b/sources/app/widgets/Chat/Chat.php
index f7a7018..a85bcde 100644
--- a/sources/app/widgets/Chat/Chat.php
+++ b/sources/app/widgets/Chat/Chat.php
@@ -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);
diff --git a/sources/app/widgets/Contact/_contact.tpl b/sources/app/widgets/Contact/_contact.tpl
index 8e86ab6..277b663 100644
--- a/sources/app/widgets/Contact/_contact.tpl
+++ b/sources/app/widgets/Contact/_contact.tpl
@@ -131,14 +131,6 @@
{/if}
- {if="$contact->description != null && trim($contact->description) != ''"}
- -
-
- {$c->__('general.about')}
-
{$contact->description}
-
- {/if}
-
{if="$contact->mood != null"}
{$moods = unserialize($contact->mood)}
-
@@ -150,7 +142,16 @@
{/if}
+
+ {if="$contact->description != null && trim($contact->description) != ''"}
+ -
+
+ {$c->__('general.about')}
+
{$contact->description}
+
+ {/if}
+
{if="$blog != null"}
diff --git a/sources/app/widgets/Publish/Publish.php b/sources/app/widgets/Publish/Publish.php
index f97ae11..32c9ae4 100644
--- a/sources/app/widgets/Publish/Publish.php
+++ b/sources/app/widgets/Publish/Publish.php
@@ -157,14 +157,18 @@ class Publish extends WidgetBase
}
if($form->embed->value != '' && filter_var($form->embed->value, FILTER_VALIDATE_URL)) {
- $embed = Embed\Embed::create($form->embed->value);
- $p->setLink($form->embed->value);
+ try {
+ $embed = Embed\Embed::create($form->embed->value);
+ $p->setLink($form->embed->value);
- if($embed->type == 'photo') {
- $key = key($embed->images);
- $p->setImage($embed->images[0]['value'], $embed->title, $embed->images[0]['mime']);
- } else {
- $content .= $this->prepareEmbed($embed);
+ if($embed->type == 'photo') {
+ $key = key($embed->images);
+ $p->setImage($embed->images[0]['value'], $embed->title, $embed->images[0]['mime']);
+ } else {
+ $content .= $this->prepareEmbed($embed);
+ }
+ } catch(Exception $e) {
+ error_log($e->getMessage());
}
}
@@ -185,15 +189,19 @@ class Publish extends WidgetBase
return;
}
- $embed = Embed\Embed::create($url);
- $html = $this->prepareEmbed($embed);
+ try {
+ $embed = Embed\Embed::create($url);
+ $html = $this->prepareEmbed($embed);
- if($embed->type == 'photo') {
- RPC::call('movim_fill', 'gallery', $this->prepareGallery($embed));
- RPC::call('movim_fill', 'preview', '');
- } else {
- RPC::call('movim_fill', 'preview', $html);
- RPC::call('movim_fill', 'gallery', '');
+ if($embed->type == 'photo') {
+ RPC::call('movim_fill', 'gallery', $this->prepareGallery($embed));
+ RPC::call('movim_fill', 'preview', '');
+ } else {
+ RPC::call('movim_fill', 'preview', $html);
+ RPC::call('movim_fill', 'gallery', '');
+ }
+ } catch(Exception $e) {
+ error_log($e->getMessage());
}
}
diff --git a/sources/app/widgets/Publish/_publish_embed.tpl b/sources/app/widgets/Publish/_publish_embed.tpl
index b4a1afd..6a6c218 100644
--- a/sources/app/widgets/Publish/_publish_embed.tpl
+++ b/sources/app/widgets/Publish/_publish_embed.tpl
@@ -1,4 +1,4 @@
-
+
diff --git a/sources/app/widgets/Rooms/Rooms.php b/sources/app/widgets/Rooms/Rooms.php
index 3a3f47d..2411743 100644
--- a/sources/app/widgets/Rooms/Rooms.php
+++ b/sources/app/widgets/Rooms/Rooms.php
@@ -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
diff --git a/sources/app/widgets/Rooms/_rooms.tpl b/sources/app/widgets/Rooms/_rooms.tpl
index 6f03f8c..be656e8 100644
--- a/sources/app/widgets/Rooms/_rooms.tpl
+++ b/sources/app/widgets/Rooms/_rooms.tpl
@@ -18,16 +18,17 @@
{$value->conference}
{/loop}
-
- {if="$conferences == null"}
- -
-
-
-
-
{$c->__('rooms.empty_text1')} {$c->__('rooms.empty_text2')}
-
- {/if}
+ {if="$conferences == null"}
+
+ {/if}
{else}
{if="$c->getView() == 'room' && $room != false"}
diff --git a/sources/app/widgets/Rooms/locales.ini b/sources/app/widgets/Rooms/locales.ini
index c90ef85..0b7f53b 100644
--- a/sources/app/widgets/Rooms/locales.ini
+++ b/sources/app/widgets/Rooms/locales.ini
@@ -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
diff --git a/sources/app/widgets/Vcard4/_vcard4_form.tpl b/sources/app/widgets/Vcard4/_vcard4_form.tpl
index 16b4f8a..71ce589 100644
--- a/sources/app/widgets/Vcard4/_vcard4_form.tpl
+++ b/sources/app/widgets/Vcard4/_vcard4_form.tpl
@@ -21,7 +21,7 @@
{$c->__('privacy.privacy_question')}
-
{$c->__('privacy.privacy_info')}
+
{$c->__('privacy.privacy_info')}
@@ -52,9 +52,9 @@