Removed permission settings from welcome message block;

Permissions will be added to all blocks;
This commit is contained in:
Marc Alexander
2010-11-19 19:04:45 +00:00
parent 670bd11fa6
commit c2b98fa3f0
3 changed files with 1 additions and 66 deletions

View File

@@ -604,19 +604,6 @@
</dt>
<dd><textarea name="welcome_message" id="welcome_message" cols="6" rows="12">{WELCOME_MESSAGE}</textarea></dd>
</dl>
<dl>
<dt>
<label for="permission-setting">{L_ACP_PORTAL_WELCOME_PERMISSION}:</label><br />
<span>{L_ACP_PORTAL_WELCOME_PERMISSION_EXP}</span>
</dt>
<dd>
<select id="permission-setting" size="10" multiple="multiple" name="permission-setting[]">
<!-- BEGIN permission_setting -->
<option value="{permission_setting.GROUP_ID}"<!-- IF permission_setting.SELECTED -->selected="selected"<!-- ENDIF -->>{permission_setting.GROUP_NAME}</option>
<!-- END permission_setting -->
</select>
</dd>
</dl>
<!-- IF S_AUTH -->
<!-- BEGIN auth_tpl -->
{auth_tpl.TPL}

View File

@@ -39,9 +39,6 @@ $lang = array_merge($lang, array(
'ACP_PORTAL_WELCOME_PREVIEW' => 'Welcome Message Preview',
'ACP_PORTAL_WELCOME_MESSAGE' => 'Welcome Message',
'ACP_PORTAL_WELCOME_MESSAGE_EXP' => 'You can change the welcome message in the textbox. BBCode, Images and URLs are allowed.',
'ACP_PORTAL_WELCOME_PERMISSION' => 'Welcome message permissions',
'ACP_PORTAL_WELCOME_PERMISSION_EXP' => 'Select the groups that should be able to view the welcome message. If you want all users to be able to view the welcome message, don´t select anything.<br />Select/Deselect multiple groups by holding <samp>CTRL</samp> and clicking.',
));
?>

View File

@@ -89,7 +89,6 @@ class portal_welcome_module
set_config('board3_welcome_message_' . $module_id, '');
set_config('board3_welcome_message_uid_' . $module_id, '');
set_config('board3_welcome_message_bitfield_' . $module_id, '');
set_config('board3_welcome_groups_' . $module_id, '');
return true;
}
@@ -107,7 +106,6 @@ class portal_welcome_module
$del_config = array(
'board3_welcome_intro_' . $module_id,
'board3_welcome_groups_' . $module_id,
'board3_welcome_message_uid_' . $module_id,
'board3_welcome_message_bitfield_' . $module_id,
);
@@ -138,8 +136,6 @@ class portal_welcome_module
}
$welcome_message = utf8_normalize_nfc(request_var('welcome_message', '', true));
$welcome_permission = request_var('permission-setting', array(0 => ''));
$groups_ary = array();
$uid = $bitfield = $flags = '';
$options = 7;
generate_text_for_storage($welcome_message, $uid, $bitfield, $flags, true, true, true);
@@ -151,20 +147,6 @@ class portal_welcome_module
trigger_error($user->lang['ACP_PORTAL_WELCOME_MESSAGE_SHORT']. adm_back_link($u_action), E_USER_WARNING);
}
// get groups and check if the selected groups actually exist
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . '
ORDER BY group_id ASC';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
$groups_ary[] = $row['group_id'];
}
$db->sql_freeresult($result);
$welcome_permission = array_intersect($welcome_permission, $groups_ary);
$welcome_permission = implode(',', $welcome_permission);
add_log('admin', 'LOG_PORTAL_CONFIG', $user->lang['PORTAL_WELCOME']);
// set_portal_config will take care of escaping the welcome message
@@ -178,8 +160,7 @@ class portal_welcome_module
case 'preview':
$welcome_message = $text = utf8_normalize_nfc(request_var('welcome_message', '', true));
$welcome_permission = request_var('permission-setting', array(0 => ''));
$groups_ary = array();
if (!class_exists('parse_message'))
{
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
@@ -198,19 +179,6 @@ class portal_welcome_module
'S_PREVIEW' => true,
));
// get groups and check if the selected groups actually exist
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . '
ORDER BY group_id ASC';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
$groups_ary[] = $row['group_id'];
}
$db->sql_freeresult($result);
$temp_permissions = array_intersect($welcome_permission, $groups_ary);
// Edit or add menu item
case 'reset':
default:
@@ -232,23 +200,6 @@ class portal_welcome_module
'MAX_FONT_SIZE' => (int) $config['max_post_font_size'],
));
$groups_ary = (isset($temp_permissions)) ? $temp_permissions : ((isset($config['board3_welcome_groups_' . $module_id])) ? explode(',', $config['board3_welcome_groups_' . $module_id]) : array());
// get group info from database and assign the block vars
$sql = 'SELECT group_id, group_name
FROM ' . GROUPS_TABLE . '
ORDER BY group_id ASC';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('permission_setting', array(
'SELECTED' => (in_array($row['group_id'], $groups_ary)) ? true : false,
'GROUP_NAME' => (isset($user->lang['G_' . $row['group_name']])) ? $user->lang['G_' . $row['group_name']] : $row['group_name'],
'GROUP_ID' => $row['group_id'],
));
}
$db->sql_freeresult($result);
if(!function_exists('display_forums'))
{
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);