diff --git a/phpBB/adm/style/acp_posting_buttons.html b/phpBB/adm/style/acp_posting_buttons.html index be15ab40d3..8a6a4462c7 100644 --- a/phpBB/adm/style/acp_posting_buttons.html +++ b/phpBB/adm/style/acp_posting_buttons.html @@ -1,7 +1,5 @@ + +
+ diff --git a/phpBB/assets/javascript/editor.js b/phpBB/assets/javascript/editor.js index 63d28e918a..61d852d254 100644 --- a/phpBB/assets/javascript/editor.js +++ b/phpBB/assets/javascript/editor.js @@ -386,6 +386,10 @@ function getCaretPosition(txtarea) { (function($) { function handle_mentions(txtarea) { + var $mentionParams = $('#mention_params'), + mentionURL = $mentionParams.data('mentionUrl'), + mentionNamesLimit = $mentionParams.data('mentionNamesLimit'), + mentionTopicId = $mentionParams.data('topicId'); $(txtarea).atwho({ at: "@", displayTpl: function(data) { @@ -395,9 +399,10 @@ function getCaretPosition(txtarea) { return "[URL]
BBCode tag and automatic/magic URLs are disabled.',
'ALLOWED_SCHEMES_LINKS' => 'Allowed schemes in links',
@@ -187,6 +188,8 @@ $lang = array_merge($lang, array(
'MAX_POST_IMG_WIDTH_EXPLAIN' => 'Maximum width of a flash file in postings. Set to 0 for unlimited size.',
'MAX_POST_URLS' => 'Maximum links per post',
'MAX_POST_URLS_EXPLAIN' => 'Maximum number of URLs in a post. Set to 0 for unlimited links.',
+ 'MENTIONS' => 'Mentions',
+ 'MENTION_NAMES_LIMIT' => 'Maximum number of names in dropdown list',
'MIN_CHAR_LIMIT' => 'Minimum characters per post/message',
'MIN_CHAR_LIMIT_EXPLAIN' => 'The minimum number of characters the user need to enter within a post/private message. The minimum for this setting is 1.',
'POSTING' => 'Posting',
diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php
index cdf4820475..475ac5aadd 100644
--- a/phpBB/language/en/acp/permissions_phpbb.php
+++ b/phpBB/language/en/acp/permissions_phpbb.php
@@ -76,6 +76,7 @@ $lang = array_merge($lang, array(
'ACL_U_ATTACH' => 'Can attach files',
'ACL_U_DOWNLOAD' => 'Can download files',
+ 'ACL_U_MENTION' => 'Can mention users and groups',
'ACL_U_SAVEDRAFTS' => 'Can save drafts',
'ACL_U_CHGCENSORS' => 'Can disable word censors',
'ACL_U_SIG' => 'Can use signature',
@@ -123,6 +124,7 @@ $lang = array_merge($lang, array(
'ACL_F_STICKY' => 'Can post stickies',
'ACL_F_ANNOUNCE' => 'Can post announcements',
'ACL_F_ANNOUNCE_GLOBAL' => 'Can post global announcements',
+ 'ACL_F_MENTION' => 'Can mention users and groups',
'ACL_F_REPLY' => 'Can reply to topics',
'ACL_F_EDIT' => 'Can edit own posts',
'ACL_F_DELETE' => 'Can permanently delete own posts',
diff --git a/phpBB/phpbb/db/migration/data/v330/add_mention_settings.php b/phpBB/phpbb/db/migration/data/v330/add_mention_settings.php
new file mode 100644
index 0000000000..1f38d919b2
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v330/add_mention_settings.php
@@ -0,0 +1,42 @@
+
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v330;
+
+class add_mention_settings extends \phpbb\db\migration\migration
+{
+ public function update_data()
+ {
+ return array(
+ array('config.add', array('allow_mentions', true)),
+ array('config.add', array('mention_names_limit', 10)),
+
+ // Set up user permissions
+ array('permission.add', array('u_mention', true)),
+ array('permission.permission_set', array('ROLE_USER_FULL', 'u_mention')),
+ array('permission.permission_set', array('ROLE_USER_STANDARD', 'u_mention')),
+ array('permission.permission_set', array('ROLE_USER_LIMITED', 'u_mention')),
+ array('permission.permission_set', array('ROLE_USER_NOPM', 'u_mention')),
+ array('permission.permission_set', array('ROLE_USER_NOAVATAR', 'u_mention')),
+
+ // Set up forum permissions
+ array('permission.add', array('f_mention', false)),
+ array('permission.permission_set', array('ROLE_FORUM_FULL', 'f_mention')),
+ array('permission.permission_set', array('ROLE_FORUM_STANDARD', 'f_mention')),
+ array('permission.permission_set', array('ROLE_FORUM_LIMITED', 'f_mention')),
+ array('permission.permission_set', array('ROLE_FORUM_ONQUEUE', 'f_mention')),
+ array('permission.permission_set', array('ROLE_FORUM_POLLS', 'f_mention')),
+ array('permission.permission_set', array('ROLE_FORUM_LIMITED_POLLS', 'f_mention')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/notification/type/mention.php b/phpBB/phpbb/notification/type/mention.php
index 54c180ad2c..1161814dbe 100644
--- a/phpBB/phpbb/notification/type/mention.php
+++ b/phpBB/phpbb/notification/type/mention.php
@@ -58,7 +58,7 @@ class mention extends \phpbb\notification\type\post
*/
public function is_available()
{
- return true;
+ return $this->config['allow_mentions'] && $this->auth->acl_get('u_mention');
}
/**
diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php
index bf3b33856e..857ae2a1ec 100644
--- a/phpBB/phpbb/permissions.php
+++ b/phpBB/phpbb/permissions.php
@@ -231,6 +231,7 @@ class permissions
'u_attach' => array('lang' => 'ACL_U_ATTACH', 'cat' => 'post'),
'u_download' => array('lang' => 'ACL_U_DOWNLOAD', 'cat' => 'post'),
+ 'u_mention' => array('lang' => 'ACL_U_MENTION', 'cat' => 'post'),
'u_savedrafts' => array('lang' => 'ACL_U_SAVEDRAFTS', 'cat' => 'post'),
'u_chgcensors' => array('lang' => 'ACL_U_CHGCENSORS', 'cat' => 'post'),
'u_sig' => array('lang' => 'ACL_U_SIG', 'cat' => 'post'),
@@ -276,6 +277,7 @@ class permissions
'f_sticky' => array('lang' => 'ACL_F_STICKY', 'cat' => 'post'),
'f_announce' => array('lang' => 'ACL_F_ANNOUNCE', 'cat' => 'post'),
'f_announce_global' => array('lang' => 'ACL_F_ANNOUNCE_GLOBAL', 'cat' => 'post'),
+ 'f_mention' => array('lang' => 'ACL_F_MENTION', 'cat' => 'post'),
'f_reply' => array('lang' => 'ACL_F_REPLY', 'cat' => 'post'),
'f_edit' => array('lang' => 'ACL_F_EDIT', 'cat' => 'post'),
'f_delete' => array('lang' => 'ACL_F_DELETE', 'cat' => 'post'),
diff --git a/phpBB/phpbb/textformatter/renderer_interface.php b/phpBB/phpbb/textformatter/renderer_interface.php
index 609b0bb642..106dbdc25f 100644
--- a/phpBB/phpbb/textformatter/renderer_interface.php
+++ b/phpBB/phpbb/textformatter/renderer_interface.php
@@ -89,4 +89,12 @@ interface renderer_interface
* @return null
*/
public function set_viewsmilies($value);
+
+ /**
+ * Set the "usemention" option
+ *
+ * @param bool $value Option's value
+ * @return null
+ */
+ public function set_usemention($value);
}
diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php
index 1edb170634..16bd63cf73 100644
--- a/phpBB/phpbb/textformatter/s9e/factory.php
+++ b/phpBB/phpbb/textformatter/s9e/factory.php
@@ -310,8 +310,8 @@ class factory implements \phpbb\textformatter\cache_interface
$configurator->tags['QUOTE']->nestingLimit = PHP_INT_MAX;
}
- // Modify the template to disable images/flash depending on user's settings
- foreach (array('FLASH', 'IMG') as $name)
+ // Modify the template to disable images/flash/mentions depending on user's settings
+ foreach (array('FLASH', 'IMG', 'MENTION') as $name)
{
$tag = $configurator->tags[$name];
$tag->template = '