From 5e3ba4dbbf90e994da64c8e130ac8e065668bb04 Mon Sep 17 00:00:00 2001 From: src386 Date: Fri, 20 May 2016 10:51:42 +0200 Subject: [PATCH] update to movim upstream --- CHANGELOG | 3 + README.md | 2 +- sources/CHANGELOG.md | 2 + sources/app/assets/js/movim_tpl.js | 6 + sources/app/helpers/StringHelper.php | 17 +- sources/app/models/contact/ContactDAO.php | 35 +++ sources/app/models/message/MessageDAO.php | 26 ++ sources/app/models/postn/PostnDAO.php | 31 ++- sources/app/views/chat.tpl | 2 + sources/app/views/conf.tpl | 2 + sources/app/views/contact.tpl | 2 + sources/app/views/group.tpl | 2 +- sources/app/views/help.tpl | 2 + sources/app/views/news.tpl | 1 + sources/app/views/page.tpl | 4 + .../app/widgets/AccountNext/accountnext.css | 2 +- sources/app/widgets/Chat/Chat.php | 54 ++-- sources/app/widgets/Chat/_chat.tpl | 21 +- sources/app/widgets/Chat/chat.css | 4 +- sources/app/widgets/Chat/chat.js | 2 +- sources/app/widgets/Chat/chat.tpl | 1 + sources/app/widgets/Chats/Chats.php | 2 +- sources/app/widgets/Chats/chats.js | 1 - sources/app/widgets/Contact/contact.tpl | 22 +- sources/app/widgets/Group/Group.php | 31 ++- sources/app/widgets/Group/_group_header.tpl | 108 ++++---- sources/app/widgets/Group/_group_posts.tpl | 3 + sources/app/widgets/Group/group.tpl | 25 +- sources/app/widgets/Groups/Groups.php | 13 +- sources/app/widgets/Groups/_groups_add.tpl | 4 +- sources/app/widgets/Groups/_groups_server.tpl | 22 +- .../widgets/Groups/_groups_subscriptions.tpl | 19 ++ sources/app/widgets/Groups/locales.ini | 2 +- sources/app/widgets/Login/Login.php | 6 +- sources/app/widgets/Login/login.js | 32 +-- sources/app/widgets/Login/login.tpl | 9 +- sources/app/widgets/Menu/_menu_list.tpl | 41 ++-- sources/app/widgets/Navigation/navigation.tpl | 32 ++- .../app/widgets/Notification/Notification.php | 21 +- sources/app/widgets/Post/_post_empty.tpl | 1 - sources/app/widgets/Publish/Publish.php | 4 +- sources/app/widgets/Rooms/Rooms.php | 18 ++ sources/app/widgets/Rooms/_rooms.tpl | 1 + sources/app/widgets/Rooms/_rooms_list.tpl | 6 +- sources/app/widgets/Rooms/rooms.js | 4 +- sources/app/widgets/Search/Search.php | 61 +++++ sources/app/widgets/Search/_search.tpl | 20 ++ sources/app/widgets/Search/_search_posts.tpl | 0 .../app/widgets/Search/_search_results.tpl | 60 +++++ sources/app/widgets/Search/locales.ini | 3 + sources/app/widgets/Search/search.css | 16 ++ sources/app/widgets/Search/search.js | 11 + sources/app/widgets/Search/search.tpl | 2 + sources/app/widgets/Stickers/Stickers.php | 13 + sources/app/widgets/Stickers/_stickers.tpl | 3 + .../app/widgets/Stickers/_stickers_smiley.tpl | 111 +++++---- .../widgets/Stickers/_stickers_smiley_two.tpl | 94 +++++++ sources/app/widgets/Vcard4/Vcard4.php | 50 ++-- sources/app/widgets/Vcard4/_vcard4_form.tpl | 10 +- sources/composer.json | 3 +- sources/composer.lock | 167 +++++++++---- sources/locales/locales.ini | 1 + sources/themes/material/css/block.css | 4 +- sources/themes/material/css/card.css | 24 ++ sources/themes/material/css/color.css | 15 +- sources/themes/material/css/dialog.css | 64 +++++ sources/themes/material/css/fonts.css | 6 +- sources/themes/material/css/form.css | 69 +++--- sources/themes/material/css/header.css | 6 +- sources/themes/material/css/icon.css | 82 +++++++ sources/themes/material/css/listn.css | 91 ++++--- sources/themes/material/css/menu.css | 18 +- sources/themes/material/css/style.css | 232 ++---------------- sources/themes/material/css/table.css | 52 ++++ sources/themes/material/css/title.css | 55 +++++ 75 files changed, 1339 insertions(+), 652 deletions(-) create mode 100644 sources/app/widgets/Search/Search.php create mode 100644 sources/app/widgets/Search/_search.tpl create mode 100644 sources/app/widgets/Search/_search_posts.tpl create mode 100644 sources/app/widgets/Search/_search_results.tpl create mode 100644 sources/app/widgets/Search/locales.ini create mode 100644 sources/app/widgets/Search/search.css create mode 100644 sources/app/widgets/Search/search.js create mode 100644 sources/app/widgets/Search/search.tpl create mode 100644 sources/app/widgets/Stickers/_stickers_smiley_two.tpl create mode 100644 sources/themes/material/css/card.css create mode 100644 sources/themes/material/css/dialog.css create mode 100644 sources/themes/material/css/icon.css create mode 100644 sources/themes/material/css/table.css create mode 100644 sources/themes/material/css/title.css diff --git a/CHANGELOG b/CHANGELOG index 6c829eb..8953311 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ **Changelog** +1.9 2016-* +- Update to movim 0.9 git2016-05-19 + 1.8 2016-04-15 - Update to movim 0.9 git2016-04-15 - Removed "environment" variable on mud.php (obsolete) diff --git a/README.md b/README.md index f7ef68a..f31d512 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Movim is a decentralized social network, written in PHP and HTML5 and based on t It is recommended to use a "valid" certificate to use Movim, auto-signed is sometimes problematic. You might want to take a look a StartSSL or Let's Encrypt. -Provided Movim version : 0.9 git2016-04-15 +Provided Movim version : 0.9 git2016-05-19 Please read CHANGELOG. diff --git a/sources/CHANGELOG.md b/sources/CHANGELOG.md index c1df669..a17dba8 100644 --- a/sources/CHANGELOG.md +++ b/sources/CHANGELOG.md @@ -3,6 +3,8 @@ Movim Changelog v0.9.1 (trunk) --------------------------- + * Fix Pubsub metadata handling for some XMPP servers + * Add silent notifications for chatrooms * Put your own XMPP server as default in the configuration (movim.eu in fallback) * Close the Dialog box when pressing ESC * Moving values from Sessionx to Session diff --git a/sources/app/assets/js/movim_tpl.js b/sources/app/assets/js/movim_tpl.js index 7559094..696750d 100644 --- a/sources/app/assets/js/movim_tpl.js +++ b/sources/app/assets/js/movim_tpl.js @@ -98,6 +98,12 @@ var MovimTpl = { target.innerHTML = html; } }, + append : function(selector, html) { + target = document.querySelector(selector); + if(target) { + target.insertAdjacentHTML('beforeend', html); + } + }, isPanel : function() { if(movim_has_class('main section > div:first-child:nth-last-child(2) ~ div', 'enabled')) { return true; diff --git a/sources/app/helpers/StringHelper.php b/sources/app/helpers/StringHelper.php index df59468..0673f5e 100644 --- a/sources/app/helpers/StringHelper.php +++ b/sources/app/helpers/StringHelper.php @@ -47,7 +47,7 @@ class MovimEmoji function addUrls($string, $preview = false) { // Add missing links return preg_replace_callback( - "/([\w\"'>]+\:\/\/[\w-?'&;#+,%:~=\.\/\@]+)/u", function ($match) use($preview) { + "/([\w\"'>]+\:\/\/[\w-?'&;#+,%:~=\.\/\@\(\)]+)/u", function ($match) use($preview) { if(!in_array(substr($match[0], 0, 1), array('>', '"', '\''))) { $content = $match[0]; @@ -187,21 +187,6 @@ function explodeJid($jid) ); } -/** - * Return a URIfied string - * @param string - * @return string - */ -function stringToUri($url) { - $url = utf8_decode($url); - $url = strtolower(strtr($url, utf8_decode('ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ()[]\'"~$&%*@ç!?;,:/\^¨€{}<>|+- .'), 'aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn -- c --- e --_')); - $url = str_replace(' ', '', $url); - $url = str_replace('---', '-', $url); - $url = str_replace('--', '-', $url); - $url = trim($url,'-'); - return $url; -} - /** * Return a human readable filesize * @param string size in bytes diff --git a/sources/app/models/contact/ContactDAO.php b/sources/app/models/contact/ContactDAO.php index 7ab75a4..dbd5810 100644 --- a/sources/app/models/contact/ContactDAO.php +++ b/sources/app/models/contact/ContactDAO.php @@ -480,6 +480,41 @@ class ContactDAO extends SQL { return $this->run('RosterContact'); } + function search($key) + { + $this->_sql = ' + select + rosterlink.jid, + contact.fn, + contact.name, + contact.nickname, + contact.tuneartist, + contact.tunetitle, + rosterlink.rostername, + rosterlink.rostersubscription, + rosterlink.groupname, + rosterlink.chaton + from rosterlink + left outer join contact + on rosterlink.jid = contact.jid + where rosterlink.session = :session + and (rosterlink.jid like :jid + or rosterlink.rostername like :rostername) + order by groupname, rosterlink.jid + limit 3 offset 0'; + + $this->prepare( + 'RosterLink', + array( + 'session' => $this->_user, + 'jid' => '%'.$key.'%', + 'rostername' => '%'.$key.'%' + ) + ); + + return $this->run('RosterContact'); + } + function getRosterFrom() { $this->_sql = ' select * from rosterlink diff --git a/sources/app/models/message/MessageDAO.php b/sources/app/models/message/MessageDAO.php index bbdd5d5..bc00fe1 100644 --- a/sources/app/models/message/MessageDAO.php +++ b/sources/app/models/message/MessageDAO.php @@ -160,6 +160,32 @@ class MessageDAO extends SQL { where session = :session and (jidfrom = :jidfrom or jidto = :jidto) + and type = \'chat\' + order by published desc'; + + if($limitr) + $this->_sql = $this->_sql.' limit '.$limitr.' offset '.$limitf; + + $this->prepare( + 'Message', + array( + 'session' => $this->_user, + 'jidfrom' => $jid, + 'jidto' => $jid + ) + ); + + return $this->run('Message'); + } + + function getRoom($jid, $limitf = false, $limitr = false) + { + $this->_sql = ' + select * from message + where session = :session + and (jidfrom = :jidfrom + or jidto = :jidto) + and type = \'groupchat\' order by published desc'; if($limitr) diff --git a/sources/app/models/postn/PostnDAO.php b/sources/app/models/postn/PostnDAO.php index ed1b37d..7d42537 100644 --- a/sources/app/models/postn/PostnDAO.php +++ b/sources/app/models/postn/PostnDAO.php @@ -625,7 +625,36 @@ class PostnDAO extends SQL { return $this->run('ContactPostn'); } - function exist($id) { + function search($key) + { + $this->_sql = ' + select *, postn.aid from postn + left outer join contact on postn.aid = contact.jid + where ( + (postn.origin in (select jid from rosterlink where session = :origin and rostersubscription in (\'both\', \'to\')) and node = \'urn:xmpp:microblog:0\') + or (postn.origin = :origin and node = \'urn:xmpp:microblog:0\') + or ((postn.origin, node) in (select server, node from subscription where jid = :origin)) + ) + and postn.node not like \'urn:xmpp:microblog:0:comments/%\' + and postn.node not like \'urn:xmpp:inbox\' + and upper(title) like upper(:title) + order by postn.published desc + limit 5 offset 0 + '; + + $this->prepare( + 'Postn', + array( + 'origin' => $this->_user, + 'title' => '%'.$key.'%' + ) + ); + + return $this->run('ContactPostn'); + } + + function exist($id) + { $this->_sql = ' select count(*) from postn where postn.nodeid = :nodeid diff --git a/sources/app/views/chat.tpl b/sources/app/views/chat.tpl index 9fc978c..4b70cdd 100644 --- a/sources/app/views/chat.tpl +++ b/sources/app/views/chat.tpl @@ -1,4 +1,6 @@ +widget('Search');?> widget('Stickers');?> +