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');?> +