mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-13 20:28:44 +01:00
- Display coloured usernames in ACP groups management screens
- Changed behaviour of group_create() function to support specifying additional group columns - New groups option to excempt group leaders from group permissions git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9625 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
ac1fd3c740
commit
d7d96223e7
@ -55,21 +55,29 @@
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_GROUP_SETTINGS_SAVE}</legend>
|
||||
<legend>{L_GROUP_OPTIONS_SAVE}</legend>
|
||||
<!-- IF S_USER_FOUNDER -->
|
||||
<dl>
|
||||
<dt><label for="group_founder_manage">{L_GROUP_FOUNDER_MANAGE}:</label><br /><span>{L_GROUP_FOUNDER_MANAGE_EXPLAIN}</span></dt>
|
||||
<dd><input name="group_founder_manage" type="checkbox" class="radio" id="group_founder_manage"{GROUP_FOUNDER_MANAGE} /></dd>
|
||||
<dd><input name="group_founder_manage" type="checkbox" value="1" class="radio" id="group_founder_manage"{GROUP_FOUNDER_MANAGE} /></dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
<dl>
|
||||
<dt><label for="group_skip_auth">{L_GROUP_SKIP_AUTH}:</label><br /><span>{L_GROUP_SKIP_AUTH_EXPLAIN}</span></dt>
|
||||
<dd><input name="group_skip_auth" type="checkbox" value="1" class="radio" id="group_skip_auth"{GROUP_SKIP_AUTH} /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="group_legend">{L_GROUP_LEGEND}:</label></dt>
|
||||
<dd><input name="group_legend" type="checkbox" class="radio" id="group_legend"{GROUP_LEGEND} /></dd>
|
||||
<dd><input name="group_legend" type="checkbox" value="1" class="radio" id="group_legend"{GROUP_LEGEND} /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="group_receive_pm">{L_GROUP_RECEIVE_PM}:</label><br /><span>{L_GROUP_RECEIVE_PM_EXPLAIN}</span></dt>
|
||||
<dd><input name="group_receive_pm" type="checkbox" class="radio" id="group_receive_pm"{GROUP_RECEIVE_PM} /></dd>
|
||||
<dd><input name="group_receive_pm" type="checkbox" value="1" class="radio" id="group_receive_pm"{GROUP_RECEIVE_PM} /></dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{L_GROUP_SETTINGS_SAVE}</legend>
|
||||
<dl>
|
||||
<dt><label for="group_message_limit">{L_GROUP_MESSAGE_LIMIT}:</label><br /><span>{L_GROUP_MESSAGE_LIMIT_EXPLAIN}</span></dt>
|
||||
<dd><input name="group_message_limit" type="text" id="group_message_limit" maxlength="4" size="4" value="{GROUP_MESSAGE_LIMIT}" /></dd>
|
||||
@ -80,7 +88,7 @@
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="group_colour">{L_GROUP_COLOR}:</label><br /><span>{L_GROUP_COLOR_EXPLAIN}</span></dt>
|
||||
<dd><input name="group_colour" type="text" id="group_colour" value="{GROUP_COLOUR}" size="6" maxlength="6" /> <span>[ <a href="{U_SWATCH}" onclick="popup(this.href, 636, 150, '_swatch'); return false">{L_COLOUR_SWATCH}</a> ]</span></dd>
|
||||
<dd><input name="group_colour" type="text" id="group_colour" value="{GROUP_COLOUR}" size="6" maxlength="6" /><!-- IF GROUP_COLOUR --> <span style="background-color: #{GROUP_COLOUR}"> </span><!-- ENDIF --> <span>[ <a href="{U_SWATCH}" onclick="popup(this.href, 636, 150, '_swatch'); return false">{L_COLOUR_SWATCH}</a> ]</span></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="group_rank">{L_GROUP_RANK}:</label></dt>
|
||||
@ -97,7 +105,7 @@
|
||||
</dl>
|
||||
<!-- IF not S_IN_AVATAR_GALLERY -->
|
||||
<!-- IF S_CAN_UPLOAD -->
|
||||
<dl>
|
||||
<dl>
|
||||
<dt><label for="uploadfile">{L_UPLOAD_AVATAR_FILE}:</label></dt>
|
||||
<dd><input type="file" id="uploadfile" name="uploadfile" /></dd>
|
||||
</dl>
|
||||
@ -115,7 +123,7 @@
|
||||
<dd><input name="width" type="text" id="width" size="3" value="{AVATAR_WIDTH}" /> <span>px X </span> <input type="text" name="height" size="3" value="{AVATAR_HEIGHT}" /> <span>px</span></dd>
|
||||
</dl>
|
||||
<!-- IF S_DISPLAY_GALLERY -->
|
||||
<dl>
|
||||
<dl>
|
||||
<dt><label>{L_AVATAR_GALLERY}:</label></dt>
|
||||
<dd><input class="button2" type="submit" name="display_gallery" value="{L_DISPLAY_GALLERY}" /></dd>
|
||||
</dl>
|
||||
@ -132,7 +140,7 @@
|
||||
<dl>
|
||||
<table cellspacing="1">
|
||||
<!-- BEGIN avatar_row -->
|
||||
<tr>
|
||||
<tr>
|
||||
<!-- BEGIN avatar_column -->
|
||||
<td class="row1" style="text-align: center;"><img src="{avatar_row.avatar_column.AVATAR_IMAGE}" alt="{avatar_row.avatar_column.AVATAR_NAME}" title="{avatar_row.avatar_column.AVATAR_NAME}" /></td>
|
||||
<!-- END avatar_column -->
|
||||
@ -146,11 +154,11 @@
|
||||
</table>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<fieldset class="quick" style="margin-top: -15px;">
|
||||
<input class="button2" type="submit" name="cancel" value="{L_CANCEL}" />
|
||||
</fieldset>
|
||||
|
||||
|
||||
<!-- ENDIF -->
|
||||
</fieldset>
|
||||
|
||||
@ -192,7 +200,7 @@
|
||||
</tr>
|
||||
<!-- BEGIN leader -->
|
||||
<!-- IF leader.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<td><a href="{leader.U_USER_EDIT}">{leader.USERNAME}</a></td>
|
||||
<td><!-- IF leader.USERNAME_COLOUR --><a href="{leader.U_USER_EDIT}" style="color: #{leader.USERNAME_COLOUR};" class="username-coloured">{leader.USERNAME}</a><!-- ELSE --><a href="{leader.U_USER_EDIT}">{leader.USERNAME}</a><!-- ENDIF --></td>
|
||||
<td style="text-align: center;"><!-- IF leader.S_GROUP_DEFAULT -->{L_YES}<!-- ELSE -->{L_NO}<!-- ENDIF --></td>
|
||||
<td style="text-align: center;">{leader.JOINED}</td>
|
||||
<td style="text-align: center;">{leader.USER_POSTS}</td>
|
||||
@ -213,7 +221,7 @@
|
||||
</tr>
|
||||
<!-- ELSE -->
|
||||
<!-- IF member.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<td><a href="{member.U_USER_EDIT}">{member.USERNAME}</a></td>
|
||||
<td><!-- IF member.USERNAME_COLOUR --><a href="{member.U_USER_EDIT}" style="color: #{member.USERNAME_COLOUR};" class="username-coloured">{member.USERNAME}</a><!-- ELSE --><a href="{member.U_USER_EDIT}">{member.USERNAME}</a><!-- ENDIF --></td>
|
||||
<td style="text-align: center;"><!-- IF member.S_GROUP_DEFAULT -->{L_YES}<!-- ELSE -->{L_NO}<!-- ENDIF --></td>
|
||||
<td style="text-align: center;">{member.JOINED}</td>
|
||||
<td style="text-align: center;">{member.USER_POSTS}</td>
|
||||
@ -231,12 +239,12 @@
|
||||
<div class="pagination">
|
||||
<a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{S_ON_PAGE}</a> • <span>{PAGINATION}</span>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
|
||||
<fieldset class="quick">
|
||||
<select name="action"><option class="sep" value="">{L_SELECT_OPTION}</option>{S_ACTION_OPTIONS}</select>
|
||||
<input class="button2" type="submit" name="update" value="{L_SUBMIT}" />
|
||||
<p class="small"><a href="#" onclick="marklist('list', 'mark', true); return false;">{L_MARK_ALL}</a> • <a href="#" onclick="marklist('list', 'mark', false); return false;">{L_UNMARK_ALL}</a></p>
|
||||
<p class="small"><a href="#" onclick="marklist('list', 'mark', true); return false;">{L_MARK_ALL}</a> • <a href="#" onclick="marklist('list', 'mark', false); return false;">{L_UNMARK_ALL}</a></p>
|
||||
</fieldset>
|
||||
|
||||
<h1>{L_ADD_USERS}</h1>
|
||||
|
@ -1125,6 +1125,7 @@ function get_schema_struct()
|
||||
'group_id' => array('UINT', NULL, 'auto_increment'),
|
||||
'group_type' => array('TINT:4', 1),
|
||||
'group_founder_manage' => array('BOOL', 0),
|
||||
'group_skip_auth' => array('BOOL', 0),
|
||||
'group_name' => array('VCHAR_CI', ''),
|
||||
'group_desc' => array('TEXT_UNI', ''),
|
||||
'group_desc_bitfield' => array('VCHAR:255', ''),
|
||||
|
@ -122,6 +122,7 @@
|
||||
<li>[Fix] Wrong description in UCP group management implicates missing feature (Bug #19945 - Patch by nickvergessen)</li>
|
||||
<li>[Fix] Do not throw an error when PDO is a shared module and not loaded preventing SQLite from being loaded.</li>
|
||||
<li>[Fix] Fix unicode words wrong censoring. (Bug #16555 - Patch by rxu)</li>
|
||||
<li>[Fix] Display coloured usernames in ACP groups management screens</li>
|
||||
<li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li>
|
||||
<li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li>
|
||||
<li>[Change] Template engine now permits to a limited extent variable includes.</li>
|
||||
@ -129,6 +130,7 @@
|
||||
<li>[Change] Banning/unbanning users now generates an entry in their user notes (Bug #21825 - Patch by nickvergessen)</li>
|
||||
<li>[Change] Smilies no longer require the f_bbcode permission. (Bug #26545)</li>
|
||||
<li>[Change] Ability to define column split in FAQ/BBCode help (Bug #31405)</li>
|
||||
<li>[Change] Changed behaviour of group_create() function to support specifying additional group columns</li>
|
||||
<li>[Feature] Backported 3.2 captcha plugins.</li>
|
||||
<li>[Feature] Introduced new ACM plugins:
|
||||
<ul>
|
||||
@ -140,6 +142,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
<li>[Feature] ATOM Feeds (Idea and diversed from RSS Feed 2.0 MOD (Version 1.0.8/9) by leviatan21)</li>
|
||||
<li>[Feature] New groups option to excempt group leaders from group permissions</li>
|
||||
</ul>
|
||||
<a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3>
|
||||
|
||||
|
@ -309,6 +309,7 @@ class acp_groups
|
||||
'message_limit' => request_var('group_message_limit', 0),
|
||||
'max_recipients' => request_var('group_max_recipients', 0),
|
||||
'founder_manage' => 0,
|
||||
'skip_auth' => request_var('group_skip_auth', 0),
|
||||
);
|
||||
|
||||
if ($user->data['user_type'] == USER_FOUNDER)
|
||||
@ -400,11 +401,26 @@ class acp_groups
|
||||
// were made.
|
||||
|
||||
$group_attributes = array();
|
||||
$test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit', 'max_recipients', 'founder_manage');
|
||||
foreach ($test_variables as $test)
|
||||
$test_variables = array(
|
||||
'rank' => 'int',
|
||||
'colour' => 'string',
|
||||
'avatar' => 'string',
|
||||
'avatar_type' => 'int',
|
||||
'avatar_width' => 'int',
|
||||
'avatar_height' => 'int',
|
||||
'receive_pm' => 'int',
|
||||
'legend' => 'int',
|
||||
'message_limit' => 'int',
|
||||
'max_recipients'=> 'int',
|
||||
'founder_manage'=> 'int',
|
||||
'skip_auth' => 'int',
|
||||
);
|
||||
|
||||
foreach ($test_variables as $test => $type)
|
||||
{
|
||||
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test]))
|
||||
{
|
||||
settype($submit_ary[$test], $type);
|
||||
$group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
|
||||
}
|
||||
}
|
||||
@ -562,7 +578,7 @@ class acp_groups
|
||||
'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0,
|
||||
'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0,
|
||||
'GROUP_COLOUR' => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '',
|
||||
|
||||
'GROUP_SKIP_AUTH' => (!empty($group_row['group_skip_auth'])) ? ' checked="checked"' : '',
|
||||
|
||||
'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'],
|
||||
'S_DESC_URLS_CHECKED' => $group_desc_data['allow_urls'],
|
||||
@ -591,8 +607,7 @@ class acp_groups
|
||||
'U_SWATCH' => append_sid("{$phpbb_admin_path}swatch.$phpEx", 'form=settings&name=group_colour'),
|
||||
'U_ACTION' => "{$this->u_action}&action=$action&g=$group_id",
|
||||
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)),
|
||||
)
|
||||
);
|
||||
));
|
||||
|
||||
return;
|
||||
break;
|
||||
@ -607,7 +622,7 @@ class acp_groups
|
||||
$this->page_title = 'GROUP_MEMBERS';
|
||||
|
||||
// Grab the leaders - always, on every page...
|
||||
$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
|
||||
$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_colour, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
|
||||
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
|
||||
WHERE ug.group_id = $group_id
|
||||
AND u.user_id = ug.user_id
|
||||
@ -621,11 +636,12 @@ class acp_groups
|
||||
'U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"),
|
||||
|
||||
'USERNAME' => $row['username'],
|
||||
'USERNAME_COLOUR' => $row['user_colour'],
|
||||
'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false,
|
||||
'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
|
||||
'USER_POSTS' => $row['user_posts'],
|
||||
'USER_ID' => $row['user_id'])
|
||||
);
|
||||
'USER_ID' => $row['user_id'],
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
@ -662,7 +678,7 @@ class acp_groups
|
||||
));
|
||||
|
||||
// Grab the members
|
||||
$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
|
||||
$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
|
||||
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
|
||||
WHERE ug.group_id = $group_id
|
||||
AND u.user_id = ug.user_id
|
||||
@ -687,6 +703,7 @@ class acp_groups
|
||||
'U_USER_EDIT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"),
|
||||
|
||||
'USERNAME' => $row['username'],
|
||||
'USERNAME_COLOUR' => $row['user_colour'],
|
||||
'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false,
|
||||
'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
|
||||
'USER_POSTS' => $row['user_posts'],
|
||||
@ -763,8 +780,7 @@ class acp_groups
|
||||
|
||||
'GROUP_NAME' => $group_name,
|
||||
'TOTAL_MEMBERS' => $row['total_members'],
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -963,6 +963,7 @@ class acp_permissions
|
||||
LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.group_id = g.group_id)
|
||||
WHERE ug.user_id = ' . $user_id . '
|
||||
AND ug.user_pending = 0
|
||||
AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1)
|
||||
ORDER BY g.group_type DESC, g.group_id DESC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
|
@ -608,22 +608,26 @@ class auth
|
||||
|
||||
// Now grab group settings - non-role specific...
|
||||
$sql_ary[] = 'SELECT ug.user_id, a.forum_id, a.auth_setting, a.auth_option_id' . $sql_opts_select . '
|
||||
FROM ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug' . $sql_opts_from . '
|
||||
FROM ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug, ' . GROUPS_TABLE . ' g' . $sql_opts_from . '
|
||||
WHERE a.auth_role_id = 0 ' .
|
||||
(($sql_opts_from) ? 'AND a.auth_option_id = ao.auth_option_id ' : '') . '
|
||||
AND a.group_id = ug.group_id
|
||||
AND g.group_id = ug.group_id
|
||||
AND ug.user_pending = 0
|
||||
AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1)
|
||||
' . (($sql_user) ? 'AND ug.' . $sql_user : '') . "
|
||||
$sql_forum
|
||||
$sql_opts";
|
||||
|
||||
// Now grab group settings - role specific...
|
||||
$sql_ary[] = 'SELECT ug.user_id, a.forum_id, r.auth_setting, r.auth_option_id' . $sql_opts_select . '
|
||||
FROM ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug, ' . ACL_ROLES_DATA_TABLE . ' r' . $sql_opts_from . '
|
||||
FROM ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug, ' . GROUPS_TABLE . ' g, ' . ACL_ROLES_DATA_TABLE . ' r' . $sql_opts_from . '
|
||||
WHERE a.auth_role_id = r.role_id ' .
|
||||
(($sql_opts_from) ? 'AND r.auth_option_id = ao.auth_option_id ' : '') . '
|
||||
AND a.group_id = ug.group_id
|
||||
AND g.group_id = ug.group_id
|
||||
AND ug.user_pending = 0
|
||||
AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1)
|
||||
' . (($sql_user) ? 'AND ug.' . $sql_user : '') . "
|
||||
$sql_forum
|
||||
$sql_opts";
|
||||
@ -825,9 +829,11 @@ class auth
|
||||
|
||||
// Now grab group-specific permission settings
|
||||
$sql = 'SELECT a.forum_id, a.auth_option_id, a.auth_role_id, a.auth_setting
|
||||
FROM ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug
|
||||
FROM ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug, ' . GROUPS_TABLE . ' g
|
||||
WHERE a.group_id = ug.group_id
|
||||
AND g.group_id = ug.group_id
|
||||
AND ug.user_pending = 0
|
||||
AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1)
|
||||
AND ug.user_id = ' . $user_id;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
|
@ -2137,12 +2137,13 @@ function cache_moderators()
|
||||
|
||||
// Remove users who have group memberships with DENY moderator permissions
|
||||
$sql = $db->sql_build_query('SELECT', array(
|
||||
'SELECT' => 'a.forum_id, ug.user_id',
|
||||
'SELECT' => 'a.forum_id, ug.user_id, g.group_id',
|
||||
|
||||
'FROM' => array(
|
||||
ACL_OPTIONS_TABLE => 'o',
|
||||
USER_GROUP_TABLE => 'ug',
|
||||
ACL_GROUPS_TABLE => 'a'
|
||||
ACL_GROUPS_TABLE => 'a',
|
||||
GROUPS_TABLE => 'g',
|
||||
),
|
||||
|
||||
'LEFT_JOIN' => array(
|
||||
@ -2156,6 +2157,8 @@ function cache_moderators()
|
||||
AND ((a.auth_setting = ' . ACL_NEVER . ' AND r.auth_setting IS NULL)
|
||||
OR r.auth_setting = ' . ACL_NEVER . ')
|
||||
AND a.group_id = ug.group_id
|
||||
AND g.ground_id = ug.group_id
|
||||
AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1)
|
||||
AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . "
|
||||
AND ug.user_pending = 0
|
||||
AND o.auth_option " . $db->sql_like_expression('m_' . $db->any_char),
|
||||
|
@ -2396,24 +2396,9 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||
global $phpbb_root_path, $config, $db, $user, $file_upload;
|
||||
|
||||
$error = array();
|
||||
$attribute_ary = array(
|
||||
'group_colour' => 'string',
|
||||
'group_rank' => 'int',
|
||||
'group_avatar' => 'string',
|
||||
'group_avatar_type' => 'int',
|
||||
'group_avatar_width' => 'int',
|
||||
'group_avatar_height' => 'int',
|
||||
|
||||
'group_receive_pm' => 'int',
|
||||
'group_legend' => 'int',
|
||||
'group_message_limit' => 'int',
|
||||
'group_max_recipients' => 'int',
|
||||
|
||||
'group_founder_manage' => 'int',
|
||||
);
|
||||
|
||||
// Those are group-only attributes
|
||||
$group_only_ary = array('group_receive_pm', 'group_legend', 'group_message_limit', 'group_max_recipients', 'group_founder_manage');
|
||||
// Attributes which also affect the users table
|
||||
$user_attribute_ary = array('group_colour', 'group_rank', 'group_avatar', 'group_avatar_type', 'group_avatar_width', 'group_avatar_height');
|
||||
|
||||
// Check data. Limit group name length.
|
||||
if (!utf8_strlen($name) || utf8_strlen($name) > 60)
|
||||
@ -2451,14 +2436,8 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||
|
||||
if (sizeof($group_attributes))
|
||||
{
|
||||
foreach ($attribute_ary as $attribute => $_type)
|
||||
{
|
||||
if (isset($group_attributes[$attribute]))
|
||||
{
|
||||
settype($group_attributes[$attribute], $_type);
|
||||
$sql_ary[$attribute] = $group_attributes[$attribute];
|
||||
}
|
||||
}
|
||||
// Merge them with $sql_ary to properly update the group
|
||||
$sql_ary = array_merge($sql_ary, $group_attributes);
|
||||
}
|
||||
|
||||
// Setting the log message before we set the group id (if group gets added)
|
||||
@ -2483,6 +2462,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||
{
|
||||
remove_default_avatar($group_id, $user_ary);
|
||||
}
|
||||
|
||||
if (isset($sql_ary['group_rank']) && !$sql_ary['group_rank'])
|
||||
{
|
||||
remove_default_rank($group_id, $user_ary);
|
||||
@ -2498,6 +2478,32 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||
SET group_name = '" . $db->sql_escape($sql_ary['group_name']) . "'
|
||||
WHERE group_id = $group_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
// One special case is the group skip auth setting. If this was changed we need to purge permissions for this group
|
||||
if (isset($group_attributes['group_skip_auth']))
|
||||
{
|
||||
// Get users within this group...
|
||||
$sql = 'SELECT user_id
|
||||
FROM ' . USER_GROUP_TABLE . '
|
||||
WHERE group_id = ' . $group_id . '
|
||||
AND user_pending = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$user_id_ary = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$user_id_ary[] = $row['user_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!empty($user_id_ary))
|
||||
{
|
||||
global $auth;
|
||||
|
||||
// Clear permissions cache of relevant users
|
||||
$auth->acl_clear_prefetch($user_id_ary);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2508,6 +2514,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||
if (!$group_id)
|
||||
{
|
||||
$group_id = $db->sql_nextid();
|
||||
|
||||
if (isset($sql_ary['group_avatar_type']) && $sql_ary['group_avatar_type'] == AVATAR_UPLOAD)
|
||||
{
|
||||
group_correct_avatar($group_id, $sql_ary['group_avatar']);
|
||||
@ -2518,18 +2525,21 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||
$sql_ary = array();
|
||||
if (sizeof($group_attributes))
|
||||
{
|
||||
foreach ($attribute_ary as $attribute => $_type)
|
||||
// Go through the user attributes array, check if a group attribute matches it and then set it. ;)
|
||||
foreach ($user_attribute_ary as $attribute)
|
||||
{
|
||||
if (isset($group_attributes[$attribute]) && !in_array($attribute, $group_only_ary))
|
||||
if (!isset($group_attributes[$attribute]))
|
||||
{
|
||||
// If we are about to set an avatar, we will not overwrite user avatars if no group avatar is set...
|
||||
if (strpos($attribute, 'group_avatar') === 0 && !$group_attributes[$attribute])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql_ary[$attribute] = $group_attributes[$attribute];
|
||||
continue;
|
||||
}
|
||||
|
||||
// If we are about to set an avatar, we will not overwrite user avatars if no group avatar is set...
|
||||
if (strpos($attribute, 'group_avatar') === 0 && !$group_attributes[$attribute])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql_ary[$attribute] = $group_attributes[$attribute];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -606,11 +606,24 @@ class ucp_groups
|
||||
// were made.
|
||||
|
||||
$group_attributes = array();
|
||||
$test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit', 'max_recipients');
|
||||
foreach ($test_variables as $test)
|
||||
$test_variables = array(
|
||||
'rank' => 'int',
|
||||
'colour' => 'string',
|
||||
'avatar' => 'string',
|
||||
'avatar_type' => 'int',
|
||||
'avatar_width' => 'int',
|
||||
'avatar_height' => 'int',
|
||||
'receive_pm' => 'int',
|
||||
'legend' => 'int',
|
||||
'message_limit' => 'int',
|
||||
'max_recipients'=> 'int',
|
||||
);
|
||||
|
||||
foreach ($test_variables as $test => $type)
|
||||
{
|
||||
if ($action == 'add' || (isset($submit_ary[$test]) && $group_row['group_' . $test] != $submit_ary[$test]))
|
||||
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test]))
|
||||
{
|
||||
settype($submit_ary[$test], $type);
|
||||
$group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,9 @@ $updates_to_version = '3.0.6-dev';
|
||||
// Enter any version to update from to test updates. The version within the db will not be updated.
|
||||
$debug_from_version = false;
|
||||
|
||||
// Which oldest version does this updater supports?
|
||||
$oldest_from_version = '3.0.0';
|
||||
|
||||
// Return if we "just include it" to find out for which version the database update is responsible for
|
||||
if (defined('IN_PHPBB') && defined('IN_INSTALL'))
|
||||
{
|
||||
@ -685,6 +688,11 @@ function database_update_info()
|
||||
'log_time' => array('log_time'),
|
||||
),
|
||||
),
|
||||
'add_columns' => array(
|
||||
GROUPS_TABLE => array(
|
||||
'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -1991,23 +1999,28 @@ class updater_db_tools
|
||||
switch ($this->sql_layer)
|
||||
{
|
||||
case 'firebird':
|
||||
// Does not support AFTER statement, only POSITION (and there you need the column position)
|
||||
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD "' . strtoupper($column_name) . '" ' . $column_data['column_type_sql'];
|
||||
break;
|
||||
|
||||
case 'mssql':
|
||||
// Does not support AFTER, only through temporary table
|
||||
$statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default'];
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$statements[] = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql'];
|
||||
$after = (!empty($column_data['after'])) ? ' AFTER ' . $column_data['after'] : '';
|
||||
$statements[] = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql'] . $after;
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
// Does not support AFTER, only through temporary table
|
||||
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $column_data['column_type_sql'];
|
||||
break;
|
||||
|
||||
case 'postgres':
|
||||
// Does not support AFTER, only through temporary table
|
||||
$statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql'];
|
||||
break;
|
||||
|
||||
|
@ -425,6 +425,7 @@ CREATE TABLE phpbb_groups (
|
||||
group_id INTEGER NOT NULL,
|
||||
group_type INTEGER DEFAULT 1 NOT NULL,
|
||||
group_founder_manage INTEGER DEFAULT 0 NOT NULL,
|
||||
group_skip_auth INTEGER DEFAULT 0 NOT NULL,
|
||||
group_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
||||
group_desc BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL,
|
||||
group_desc_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -297,6 +297,7 @@ CREATE TABLE phpbb_groups (
|
||||
group_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
||||
group_type tinyint(4) DEFAULT '1' NOT NULL,
|
||||
group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
group_skip_auth tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
group_name blob NOT NULL,
|
||||
group_desc blob NOT NULL,
|
||||
group_desc_bitfield varbinary(255) DEFAULT '' NOT NULL,
|
||||
|
@ -297,6 +297,7 @@ CREATE TABLE phpbb_groups (
|
||||
group_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
||||
group_type tinyint(4) DEFAULT '1' NOT NULL,
|
||||
group_founder_manage tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
group_skip_auth tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
group_name varchar(255) DEFAULT '' NOT NULL,
|
||||
group_desc text NOT NULL,
|
||||
group_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
|
||||
|
@ -586,6 +586,7 @@ CREATE TABLE phpbb_groups (
|
||||
group_id number(8) NOT NULL,
|
||||
group_type number(4) DEFAULT '1' NOT NULL,
|
||||
group_founder_manage number(1) DEFAULT '0' NOT NULL,
|
||||
group_skip_auth number(1) DEFAULT '0' NOT NULL,
|
||||
group_name varchar2(255) DEFAULT '' ,
|
||||
group_desc clob DEFAULT '' ,
|
||||
group_desc_bitfield varchar2(255) DEFAULT '' ,
|
||||
@ -822,7 +823,7 @@ CREATE TABLE phpbb_poll_votes (
|
||||
topic_id number(8) DEFAULT '0' NOT NULL,
|
||||
poll_option_id number(4) DEFAULT '0' NOT NULL,
|
||||
vote_user_id number(8) DEFAULT '0' NOT NULL,
|
||||
vote_user_ip varchar2(40) DEFAULT ''
|
||||
vote_user_ip varchar2(40) DEFAULT ''
|
||||
)
|
||||
/
|
||||
|
||||
@ -1466,7 +1467,7 @@ CREATE TABLE phpbb_styles_template_data (
|
||||
template_filename varchar2(100) DEFAULT '' ,
|
||||
template_included clob DEFAULT '' ,
|
||||
template_mtime number(11) DEFAULT '0' NOT NULL,
|
||||
template_data clob DEFAULT ''
|
||||
template_data clob DEFAULT ''
|
||||
)
|
||||
/
|
||||
|
||||
|
@ -440,6 +440,7 @@ CREATE TABLE phpbb_groups (
|
||||
group_id INT4 DEFAULT nextval('phpbb_groups_seq'),
|
||||
group_type INT2 DEFAULT '1' NOT NULL,
|
||||
group_founder_manage INT2 DEFAULT '0' NOT NULL CHECK (group_founder_manage >= 0),
|
||||
group_skip_auth INT2 DEFAULT '0' NOT NULL CHECK (group_skip_auth >= 0),
|
||||
group_name varchar_ci DEFAULT '' NOT NULL,
|
||||
group_desc varchar(4000) DEFAULT '' NOT NULL,
|
||||
group_desc_bitfield varchar(255) DEFAULT '' NOT NULL,
|
||||
|
@ -289,6 +289,7 @@ CREATE TABLE phpbb_groups (
|
||||
group_id INTEGER PRIMARY KEY NOT NULL ,
|
||||
group_type tinyint(4) NOT NULL DEFAULT '1',
|
||||
group_founder_manage INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
group_skip_auth INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
group_name varchar(255) NOT NULL DEFAULT '',
|
||||
group_desc text(65535) NOT NULL DEFAULT '',
|
||||
group_desc_bitfield varchar(255) NOT NULL DEFAULT '',
|
||||
|
@ -88,16 +88,19 @@ $lang = array_merge($lang, array(
|
||||
'GROUP_PENDING' => 'Pending members',
|
||||
'GROUP_MAX_RECIPIENTS' => 'Maximum number of allowed recipients per private message',
|
||||
'GROUP_MAX_RECIPIENTS_EXPLAIN' => 'The maximum number of allowed recipients in a private message. If 0 is entered, the board-wide setting is used.',
|
||||
'GROUP_OPTIONS_SAVE' => 'Group wide options',
|
||||
'GROUP_PROMOTE' => 'Promote to group leader',
|
||||
'GROUP_RANK' => 'Group rank',
|
||||
'GROUP_RECEIVE_PM' => 'Group able to receive private messages',
|
||||
'GROUP_RECEIVE_PM_EXPLAIN' => 'Please note that hidden groups are not able to be messaged, regardless of this setting.',
|
||||
'GROUP_REQUEST' => 'Request',
|
||||
'GROUP_SETTINGS_SAVE' => 'Group wide settings',
|
||||
'GROUP_SKIP_AUTH' => 'Excempt group leader from permissions',
|
||||
'GROUP_SKIP_AUTH_EXPLAIN' => 'If enabled group leader no longer inherit permissions from the group.',
|
||||
'GROUP_TYPE' => 'Group type',
|
||||
'GROUP_TYPE_EXPLAIN' => 'This determines which users can join or view this group.',
|
||||
'GROUP_UPDATED' => 'Group preferences updated successfully.',
|
||||
|
||||
|
||||
'GROUP_USERS_ADDED' => 'New users added to group successfully.',
|
||||
'GROUP_USERS_EXIST' => 'The selected users are already members.',
|
||||
'GROUP_USERS_REMOVE' => 'Users removed from group and new defaults set successfully.',
|
||||
|
Loading…
x
Reference in New Issue
Block a user