mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/17493] Remove more jabber permissions and elements
PHPBB-17493
This commit is contained in:
parent
a7c7c38bfb
commit
3128b3fa9b
10 changed files with 26 additions and 323 deletions
|
@ -140,7 +140,6 @@ $u_permissions = array(
|
|||
'u_sendemail' => array(0, 1),
|
||||
'u_readpm' => array(0, 1),
|
||||
'u_sendpm' => array(0, 1),
|
||||
'u_sendim' => array(0, 1),
|
||||
'u_hideonline' => array(0, 1),
|
||||
'u_viewonline' => array(0, 1),
|
||||
'u_viewprofile' => array(0, 1),
|
||||
|
|
|
@ -1514,208 +1514,6 @@ function validate_user_email($email, $allowed_email = false)
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate jabber address
|
||||
* Taken from the jabber class within flyspray (see author notes)
|
||||
*
|
||||
* @author flyspray.org
|
||||
*/
|
||||
function validate_jabber($jid)
|
||||
{
|
||||
if (!$jid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$separator_pos = strpos($jid, '@');
|
||||
|
||||
if ($separator_pos === false)
|
||||
{
|
||||
return 'WRONG_DATA';
|
||||
}
|
||||
|
||||
$username = substr($jid, 0, $separator_pos);
|
||||
$realm = substr($jid, $separator_pos + 1);
|
||||
|
||||
if (strlen($username) == 0 || strlen($realm) < 3)
|
||||
{
|
||||
return 'WRONG_DATA';
|
||||
}
|
||||
|
||||
$arr = explode('.', $realm);
|
||||
|
||||
if (count($arr) == 0)
|
||||
{
|
||||
return 'WRONG_DATA';
|
||||
}
|
||||
|
||||
foreach ($arr as $part)
|
||||
{
|
||||
if (substr($part, 0, 1) == '-' || substr($part, -1, 1) == '-')
|
||||
{
|
||||
return 'WRONG_DATA';
|
||||
}
|
||||
|
||||
if (!preg_match("@^[a-zA-Z0-9-.]+$@", $part))
|
||||
{
|
||||
return 'WRONG_DATA';
|
||||
}
|
||||
}
|
||||
|
||||
$boundary = array(array(0, 127), array(192, 223), array(224, 239), array(240, 247), array(248, 251), array(252, 253));
|
||||
|
||||
// Prohibited Characters RFC3454 + RFC3920
|
||||
$prohibited = array(
|
||||
// Table C.1.1
|
||||
array(0x0020, 0x0020), // SPACE
|
||||
// Table C.1.2
|
||||
array(0x00A0, 0x00A0), // NO-BREAK SPACE
|
||||
array(0x1680, 0x1680), // OGHAM SPACE MARK
|
||||
array(0x2000, 0x2001), // EN QUAD
|
||||
array(0x2001, 0x2001), // EM QUAD
|
||||
array(0x2002, 0x2002), // EN SPACE
|
||||
array(0x2003, 0x2003), // EM SPACE
|
||||
array(0x2004, 0x2004), // THREE-PER-EM SPACE
|
||||
array(0x2005, 0x2005), // FOUR-PER-EM SPACE
|
||||
array(0x2006, 0x2006), // SIX-PER-EM SPACE
|
||||
array(0x2007, 0x2007), // FIGURE SPACE
|
||||
array(0x2008, 0x2008), // PUNCTUATION SPACE
|
||||
array(0x2009, 0x2009), // THIN SPACE
|
||||
array(0x200A, 0x200A), // HAIR SPACE
|
||||
array(0x200B, 0x200B), // ZERO WIDTH SPACE
|
||||
array(0x202F, 0x202F), // NARROW NO-BREAK SPACE
|
||||
array(0x205F, 0x205F), // MEDIUM MATHEMATICAL SPACE
|
||||
array(0x3000, 0x3000), // IDEOGRAPHIC SPACE
|
||||
// Table C.2.1
|
||||
array(0x0000, 0x001F), // [CONTROL CHARACTERS]
|
||||
array(0x007F, 0x007F), // DELETE
|
||||
// Table C.2.2
|
||||
array(0x0080, 0x009F), // [CONTROL CHARACTERS]
|
||||
array(0x06DD, 0x06DD), // ARABIC END OF AYAH
|
||||
array(0x070F, 0x070F), // SYRIAC ABBREVIATION MARK
|
||||
array(0x180E, 0x180E), // MONGOLIAN VOWEL SEPARATOR
|
||||
array(0x200C, 0x200C), // ZERO WIDTH NON-JOINER
|
||||
array(0x200D, 0x200D), // ZERO WIDTH JOINER
|
||||
array(0x2028, 0x2028), // LINE SEPARATOR
|
||||
array(0x2029, 0x2029), // PARAGRAPH SEPARATOR
|
||||
array(0x2060, 0x2060), // WORD JOINER
|
||||
array(0x2061, 0x2061), // FUNCTION APPLICATION
|
||||
array(0x2062, 0x2062), // INVISIBLE TIMES
|
||||
array(0x2063, 0x2063), // INVISIBLE SEPARATOR
|
||||
array(0x206A, 0x206F), // [CONTROL CHARACTERS]
|
||||
array(0xFEFF, 0xFEFF), // ZERO WIDTH NO-BREAK SPACE
|
||||
array(0xFFF9, 0xFFFC), // [CONTROL CHARACTERS]
|
||||
array(0x1D173, 0x1D17A), // [MUSICAL CONTROL CHARACTERS]
|
||||
// Table C.3
|
||||
array(0xE000, 0xF8FF), // [PRIVATE USE, PLANE 0]
|
||||
array(0xF0000, 0xFFFFD), // [PRIVATE USE, PLANE 15]
|
||||
array(0x100000, 0x10FFFD), // [PRIVATE USE, PLANE 16]
|
||||
// Table C.4
|
||||
array(0xFDD0, 0xFDEF), // [NONCHARACTER CODE POINTS]
|
||||
array(0xFFFE, 0xFFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0x1FFFE, 0x1FFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0x2FFFE, 0x2FFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0x3FFFE, 0x3FFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0x4FFFE, 0x4FFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0x5FFFE, 0x5FFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0x6FFFE, 0x6FFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0x7FFFE, 0x7FFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0x8FFFE, 0x8FFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0x9FFFE, 0x9FFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0xAFFFE, 0xAFFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0xBFFFE, 0xBFFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0xCFFFE, 0xCFFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0xDFFFE, 0xDFFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0xEFFFE, 0xEFFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0xFFFFE, 0xFFFFF), // [NONCHARACTER CODE POINTS]
|
||||
array(0x10FFFE, 0x10FFFF), // [NONCHARACTER CODE POINTS]
|
||||
// Table C.5
|
||||
array(0xD800, 0xDFFF), // [SURROGATE CODES]
|
||||
// Table C.6
|
||||
array(0xFFF9, 0xFFF9), // INTERLINEAR ANNOTATION ANCHOR
|
||||
array(0xFFFA, 0xFFFA), // INTERLINEAR ANNOTATION SEPARATOR
|
||||
array(0xFFFB, 0xFFFB), // INTERLINEAR ANNOTATION TERMINATOR
|
||||
array(0xFFFC, 0xFFFC), // OBJECT REPLACEMENT CHARACTER
|
||||
array(0xFFFD, 0xFFFD), // REPLACEMENT CHARACTER
|
||||
// Table C.7
|
||||
array(0x2FF0, 0x2FFB), // [IDEOGRAPHIC DESCRIPTION CHARACTERS]
|
||||
// Table C.8
|
||||
array(0x0340, 0x0340), // COMBINING GRAVE TONE MARK
|
||||
array(0x0341, 0x0341), // COMBINING ACUTE TONE MARK
|
||||
array(0x200E, 0x200E), // LEFT-TO-RIGHT MARK
|
||||
array(0x200F, 0x200F), // RIGHT-TO-LEFT MARK
|
||||
array(0x202A, 0x202A), // LEFT-TO-RIGHT EMBEDDING
|
||||
array(0x202B, 0x202B), // RIGHT-TO-LEFT EMBEDDING
|
||||
array(0x202C, 0x202C), // POP DIRECTIONAL FORMATTING
|
||||
array(0x202D, 0x202D), // LEFT-TO-RIGHT OVERRIDE
|
||||
array(0x202E, 0x202E), // RIGHT-TO-LEFT OVERRIDE
|
||||
array(0x206A, 0x206A), // INHIBIT SYMMETRIC SWAPPING
|
||||
array(0x206B, 0x206B), // ACTIVATE SYMMETRIC SWAPPING
|
||||
array(0x206C, 0x206C), // INHIBIT ARABIC FORM SHAPING
|
||||
array(0x206D, 0x206D), // ACTIVATE ARABIC FORM SHAPING
|
||||
array(0x206E, 0x206E), // NATIONAL DIGIT SHAPES
|
||||
array(0x206F, 0x206F), // NOMINAL DIGIT SHAPES
|
||||
// Table C.9
|
||||
array(0xE0001, 0xE0001), // LANGUAGE TAG
|
||||
array(0xE0020, 0xE007F), // [TAGGING CHARACTERS]
|
||||
// RFC3920
|
||||
array(0x22, 0x22), // "
|
||||
array(0x26, 0x26), // &
|
||||
array(0x27, 0x27), // '
|
||||
array(0x2F, 0x2F), // /
|
||||
array(0x3A, 0x3A), // :
|
||||
array(0x3C, 0x3C), // <
|
||||
array(0x3E, 0x3E), // >
|
||||
array(0x40, 0x40) // @
|
||||
);
|
||||
|
||||
$pos = 0;
|
||||
$result = true;
|
||||
|
||||
while ($pos < strlen($username))
|
||||
{
|
||||
$len = $uni = 0;
|
||||
for ($i = 0; $i <= 5; $i++)
|
||||
{
|
||||
if (ord($username[$pos]) >= $boundary[$i][0] && ord($username[$pos]) <= $boundary[$i][1])
|
||||
{
|
||||
$len = $i + 1;
|
||||
$uni = (ord($username[$pos]) - $boundary[$i][0]) * pow(2, $i * 6);
|
||||
|
||||
for ($k = 1; $k < $len; $k++)
|
||||
{
|
||||
$uni += (ord($username[$pos + $k]) - 128) * pow(2, ($i - $k) * 6);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($len == 0)
|
||||
{
|
||||
return 'WRONG_DATA';
|
||||
}
|
||||
|
||||
foreach ($prohibited as $pval)
|
||||
{
|
||||
if ($uni >= $pval[0] && $uni <= $pval[1])
|
||||
{
|
||||
$result = false;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
|
||||
$pos = $pos + $len;
|
||||
}
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
return 'WRONG_DATA';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate hex colour value
|
||||
*
|
||||
|
|
|
@ -482,7 +482,6 @@ INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_readpm', 1);
|
|||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_savedrafts', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_search', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_sendemail', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_sendim', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_sendpm', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_sig', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_viewonline', 1);
|
||||
|
@ -528,10 +527,10 @@ INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id,
|
|||
INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_subject, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_freq, prune_days, prune_viewed, forum_parents, forum_flags) VALUES ('{L_FORUMS_TEST_FORUM_TITLE}', '{L_FORUMS_TEST_FORUM_DESC}', 2, 3, 1, 1, 1, 0, 0, 1, 0, 0, 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, '', '', '', '', '', '', '', 1, 7, 7, '', 48);
|
||||
|
||||
# -- Users / Anonymous user
|
||||
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_jabber, user_actkey, user_actkey_expiration, user_newpasswd, user_allow_massemail) VALUES (2, 1, 'Anonymous', 'anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', 0, '', 0);
|
||||
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_actkey, user_actkey_expiration, user_newpasswd, user_allow_massemail) VALUES (2, 1, 'Anonymous', 'anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', 0, '', 0);
|
||||
|
||||
# -- username: Admin password: admin (change this or remove it once everything is working!)
|
||||
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_jabber, user_actkey, user_actkey_expiration, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', 0, '');
|
||||
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_actkey, user_actkey_expiration, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', 0, '');
|
||||
|
||||
# -- Groups
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GUESTS', 3, 0, '', 0, '', '', '', 5);
|
||||
|
@ -576,14 +575,14 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
|
|||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 6, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_forward');
|
||||
|
||||
# Limited Features (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 7, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim', 'u_masspm', 'u_masspm_group');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 7, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_masspm', 'u_masspm_group');
|
||||
|
||||
# No Private Messages (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 8, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_', 'u_chgavatar', 'u_chgcensors', 'u_chgemail', 'u_chgpasswd', 'u_download', 'u_hideonline', 'u_mention', 'u_sig', 'u_viewprofile');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 8, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_readpm', 'u_sendpm', 'u_masspm', 'u_masspm_group');
|
||||
|
||||
# No Avatar (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_chgavatar', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim', 'u_masspm', 'u_masspm_group');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_chgavatar', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_masspm', 'u_masspm_group');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_chgavatar');
|
||||
|
||||
# Full Moderator (m_)
|
||||
|
|
|
@ -98,7 +98,6 @@ $lang = array_merge($lang, array(
|
|||
'ACL_U_PM_IMG' => 'Can use [img] BBCode tag in private messages',
|
||||
|
||||
'ACL_U_SENDEMAIL' => 'Can send emails',
|
||||
'ACL_U_SENDIM' => 'Can send instant messages',
|
||||
'ACL_U_IGNOREFLOOD' => 'Can ignore flood limit',
|
||||
'ACL_U_HIDEONLINE' => 'Can hide online status',
|
||||
'ACL_U_VIEWONLINE' => 'Can view hidden online users',
|
||||
|
|
|
@ -669,7 +669,6 @@ switch ($mode)
|
|||
'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']),
|
||||
'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $member['username']),
|
||||
'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']),
|
||||
'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']),
|
||||
'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']),
|
||||
|
||||
'S_PROFILE_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group'),
|
||||
|
@ -923,12 +922,6 @@ switch ($mode)
|
|||
$sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'c' => $user->lang['SORT_JOINED'], 'd' => $user->lang['SORT_POST_COUNT']);
|
||||
$sort_key_sql = array('a' => 'u.username_clean', 'c' => 'u.user_regdate', 'd' => 'u.user_posts');
|
||||
|
||||
if ($config['jab_enable'] && $auth->acl_get('u_sendim'))
|
||||
{
|
||||
$sort_key_text['k'] = $user->lang['JABBER'];
|
||||
$sort_key_sql['k'] = 'u.user_jabber';
|
||||
}
|
||||
|
||||
if ($auth->acl_get('a_user'))
|
||||
{
|
||||
$sort_key_text['e'] = $user->lang['SORT_EMAIL'];
|
||||
|
@ -979,7 +972,6 @@ switch ($mode)
|
|||
{
|
||||
$username = $request->variable('username', '', true);
|
||||
$email = strtolower($request->variable('email', ''));
|
||||
$jabber = $request->variable('jabber', '');
|
||||
$search_group_id = $request->variable('search_group_id', 0);
|
||||
|
||||
// when using these, make sure that we actually have values defined in $find_key_match
|
||||
|
@ -1019,7 +1011,6 @@ switch ($mode)
|
|||
|
||||
$sql_where .= ($username) ? ' AND u.username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($username))) : '';
|
||||
$sql_where .= ($auth->acl_get('a_user') && $email) ? ' AND u.user_email ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $email)) . ' ' : '';
|
||||
$sql_where .= ($jabber) ? ' AND u.user_jabber ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $jabber)) . ' ' : '';
|
||||
$sql_where .= (is_numeric($count) && isset($find_key_match[$count_select])) ? ' AND u.user_posts ' . $find_key_match[$count_select] . ' ' . (int) $count . ' ' : '';
|
||||
|
||||
if (isset($find_key_match[$joined_select]) && count($joined) == 3)
|
||||
|
@ -1480,7 +1471,6 @@ switch ($mode)
|
|||
$template->assign_vars(array(
|
||||
'USERNAME' => $username,
|
||||
'EMAIL' => $email,
|
||||
'JABBER' => $jabber,
|
||||
'JOINED' => implode('-', $joined),
|
||||
'ACTIVE' => implode('-', $active),
|
||||
'COUNT' => $count,
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace phpbb\cron\task\core;
|
|||
use phpbb\config\config;
|
||||
|
||||
/**
|
||||
* Queue cron task. Sends email and jabber messages queued by other scripts.
|
||||
* Queue cron task. Sends email queued by other scripts.
|
||||
*/
|
||||
class queue extends \phpbb\cron\task\base
|
||||
{
|
||||
|
|
|
@ -67,6 +67,7 @@ class remove_jabber extends migration
|
|||
'ACP_JABBER_SETTINGS',
|
||||
]],
|
||||
['permission.remove', ['a_jabber']],
|
||||
['permission.remove', ['u_sendim']],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -94,6 +95,7 @@ class remove_jabber extends migration
|
|||
],
|
||||
]],
|
||||
['permission.add', ['a_jabber', true]],
|
||||
['permission.add', ['u_sendim', true]],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,27 +26,34 @@ class message
|
|||
|
||||
/** @var string */
|
||||
protected $subject = '';
|
||||
|
||||
/** @var string */
|
||||
protected $body = '';
|
||||
|
||||
/** @var string */
|
||||
protected $template = '';
|
||||
|
||||
/** @var array */
|
||||
protected $template_vars = array();
|
||||
|
||||
/** @var string */
|
||||
protected $sender_ip = '';
|
||||
|
||||
/** @var string */
|
||||
protected $sender_name = '';
|
||||
|
||||
/** @var string */
|
||||
protected $sender_address = '';
|
||||
|
||||
/** @var string */
|
||||
protected $sender_lang = '';
|
||||
|
||||
/** @var string|int */
|
||||
protected $sender_id = '';
|
||||
|
||||
/** @var string */
|
||||
protected $sender_username = '';
|
||||
/** @var string */
|
||||
protected $sender_jabber = '';
|
||||
|
||||
/** @var int */
|
||||
protected $sender_notify_type = messenger_interface::NOTIFY_EMAIL;
|
||||
|
||||
|
@ -120,8 +127,7 @@ class message
|
|||
$user['user_email'],
|
||||
$user['user_lang'],
|
||||
$user['user_notify_type'],
|
||||
$user['username'],
|
||||
$user['user_jabber']
|
||||
$user['username']
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -133,17 +139,15 @@ class message
|
|||
* @param string $recipient_lang
|
||||
* @param int $recipient_notify_type Used notification methods (Jabber, Email, ...)
|
||||
* @param string $recipient_username User Name (used for AntiAbuse header)
|
||||
* @param string $recipient_jabber
|
||||
* @return void
|
||||
*/
|
||||
public function add_recipient($recipient_name, $recipient_address, $recipient_lang, $recipient_notify_type = messenger_interface::NOTIFY_EMAIL, $recipient_username = '', $recipient_jabber = '')
|
||||
public function add_recipient($recipient_name, $recipient_address, $recipient_lang, $recipient_notify_type = messenger_interface::NOTIFY_EMAIL, $recipient_username = '')
|
||||
{
|
||||
$this->recipients[] = array(
|
||||
'name' => $recipient_name,
|
||||
'user_email' => $recipient_address,
|
||||
'lang' => $recipient_lang,
|
||||
'username' => $recipient_username,
|
||||
'user_jabber' => $recipient_jabber,
|
||||
'notify_type' => $recipient_notify_type,
|
||||
'to_name' => $recipient_name,
|
||||
);
|
||||
|
@ -163,8 +167,7 @@ class message
|
|||
$user->data['user_email'],
|
||||
$user->lang_name,
|
||||
$user->data['user_id'],
|
||||
$user->data['username'],
|
||||
$user->data['user_jabber']
|
||||
$user->data['username']
|
||||
);
|
||||
|
||||
$this->set_sender_notify_type($user->data['user_notify_type']);
|
||||
|
@ -179,10 +182,9 @@ class message
|
|||
* @param string $sender_lang
|
||||
* @param int $sender_id User ID
|
||||
* @param string $sender_username User Name (used for AntiAbuse header)
|
||||
* @param string $sender_jabber
|
||||
* @return void
|
||||
*/
|
||||
public function set_sender($sender_ip, $sender_name, $sender_address, $sender_lang = '', $sender_id = 0, $sender_username = '', $sender_jabber = '')
|
||||
public function set_sender($sender_ip, $sender_name, $sender_address, $sender_lang = '', $sender_id = 0, $sender_username = '')
|
||||
{
|
||||
$this->sender_ip = $sender_ip;
|
||||
$this->sender_name = $sender_name;
|
||||
|
@ -190,7 +192,6 @@ class message
|
|||
$this->sender_lang = $sender_lang;
|
||||
$this->sender_id = $sender_id;
|
||||
$this->sender_username = $sender_username;
|
||||
$this->sender_jabber = $sender_jabber;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -225,7 +226,6 @@ class message
|
|||
'user_email' => $this->sender_address,
|
||||
'name' => $this->sender_name,
|
||||
'username' => $this->sender_username,
|
||||
'user_jabber' => $this->sender_jabber,
|
||||
'notify_type' => $this->sender_notify_type,
|
||||
'to_name' => $this->recipients[0]['to_name'],
|
||||
);
|
||||
|
|
|
@ -253,7 +253,6 @@ class permissions
|
|||
'u_pm_img' => array('lang' => 'ACL_U_PM_IMG', 'cat' => 'pm'),
|
||||
|
||||
'u_sendemail' => array('lang' => 'ACL_U_SENDEMAIL', 'cat' => 'misc'),
|
||||
'u_sendim' => array('lang' => 'ACL_U_SENDIM', 'cat' => 'misc'),
|
||||
'u_ignoreflood' => array('lang' => 'ACL_U_IGNOREFLOOD', 'cat' => 'misc'),
|
||||
'u_hideonline' => array('lang' => 'ACL_U_HIDEONLINE', 'cat' => 'misc'),
|
||||
'u_viewonline' => array('lang' => 'ACL_U_VIEWONLINE', 'cat' => 'misc'),
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions_user.php';
|
||||
require_once __DIR__ . '/validate_data_helper.php';
|
||||
|
||||
class phpbb_functions_validate_jabber_test extends phpbb_test_case
|
||||
{
|
||||
protected $helper;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->helper = new phpbb_functions_validate_data_helper($this);
|
||||
}
|
||||
|
||||
public function test_validate_jabber()
|
||||
{
|
||||
$this->helper->assert_valid_data(array(
|
||||
'empty' => array(
|
||||
array(),
|
||||
'',
|
||||
array('jabber'),
|
||||
),
|
||||
'no_seperator' => array(
|
||||
array('WRONG_DATA'),
|
||||
'testjabber.ccc',
|
||||
array('jabber'),
|
||||
),
|
||||
'no_user' => array(
|
||||
array('WRONG_DATA'),
|
||||
'@jabber.ccc',
|
||||
array('jabber'),
|
||||
),
|
||||
'no_realm' => array(
|
||||
array('WRONG_DATA'),
|
||||
'user@',
|
||||
array('jabber'),
|
||||
),
|
||||
'dot_realm' => array(
|
||||
array('WRONG_DATA'),
|
||||
'user@.....',
|
||||
array('jabber'),
|
||||
),
|
||||
'-realm' => array(
|
||||
array('WRONG_DATA'),
|
||||
'user@-jabber.ccc',
|
||||
array('jabber'),
|
||||
),
|
||||
'realm-' => array(
|
||||
array('WRONG_DATA'),
|
||||
'user@jabber.ccc-',
|
||||
array('jabber'),
|
||||
),
|
||||
'correct' => array(
|
||||
array(),
|
||||
'user@jabber.09A-z.org',
|
||||
array('jabber'),
|
||||
),
|
||||
'prohibited' => array(
|
||||
array('WRONG_DATA'),
|
||||
'u@ser@jabber.ccc.org',
|
||||
array('jabber'),
|
||||
),
|
||||
'prohibited_char' => array(
|
||||
array('WRONG_DATA'),
|
||||
'u<s>er@jabber.ccc.org',
|
||||
array('jabber'),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue