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 - ' '. - trim($match[0]). - ''; - }, ' ' . $string - ); - + "/ #[a-zA-Z0-9_-]{3,}/", function ($match) { return ' '. trim($match[0]). ''; }, ' ' . $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="$blog != null"} + {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 @@ {loop="$years"} - {/loop} @@ -76,9 +76,9 @@ {loop="$gender"} - {/loop} @@ -106,9 +106,9 @@
- +
+
- +
- +
- +
- +
@@ -173,9 +173,9 @@ onclick=" {$submit} movim_button_save('#vcard4validate'); - this.value = '{$c->__('Submitting')}'; - this.className='button oppose inactive';" - class="button color oppose" + this.value = '{$c->__('Submitting')}'; + this.className='button oppose inactive';" + class="button color oppose" id="vcard4validate" > {$c->__('button.save')} diff --git a/sources/app/widgets/Vcard4/locales.ini b/sources/app/widgets/Vcard4/locales.ini index 8fc2a84..5635727 100644 --- a/sources/app/widgets/Vcard4/locales.ini +++ b/sources/app/widgets/Vcard4/locales.ini @@ -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 diff --git a/sources/bootstrap.php b/sources/bootstrap.php index 14d6892..7540c45 100644 --- a/sources/bootstrap.php +++ b/sources/bootstrap.php @@ -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); diff --git a/sources/index.php b/sources/index.php index 5bc0caa..d34ba59 100644 --- a/sources/index.php +++ b/sources/index.php @@ -40,9 +40,14 @@ define('DOCUMENT_ROOT', dirname(__FILE__)); require_once(DOCUMENT_ROOT.'/bootstrap.php'); -$bootstrap = new Bootstrap(); - -$bootstrap->boot(); +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(); diff --git a/sources/themes/material/css/article.css b/sources/themes/material/css/article.css index b36e3b7..03f550a 100644 --- a/sources/themes/material/css/article.css +++ b/sources/themes/material/css/article.css @@ -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;