本文整理汇总了PHP中auth_admin::display_mask方法的典型用法代码示例。如果您正苦于以下问题:PHP auth_admin::display_mask方法的具体用法?PHP auth_admin::display_mask怎么用?PHP auth_admin::display_mask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth_admin
的用法示例。
在下文中一共展示了auth_admin::display_mask方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
//.........这里部分代码省略.........
case 'demote':
case 'promote':
case 'default':
group_user_attributes($action, $group_id, $user_id);
if ($action == 'default') {
$user_row['group_id'] = $group_id;
}
break;
case 'delete':
if (confirm_box(true)) {
if (!$group_id) {
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id));
}
if ($error = group_user_del($group_id, $user_id)) {
trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id));
}
$error = array();
} else {
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('u' => $user_id, 'i' => $id, 'mode' => $mode, 'action' => $action, 'g' => $group_id)));
}
break;
}
// Add user to group?
if ($submit) {
if (!$group_id) {
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id));
}
// Add user/s to group
if ($error = group_user_add($group_id, $user_id)) {
trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id));
}
$error = array();
}
$sql = 'SELECT ug.*, g.*
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug\n\t\t\t\t\tWHERE ug.user_id = {$user_id}\n\t\t\t\t\t\tAND g.group_id = ug.group_id\n\t\t\t\t\tORDER BY g.group_type DESC, ug.user_pending ASC, g.group_name";
$result = $db->sql_query($sql);
$i = 0;
$group_data = $id_ary = array();
while ($row = $db->sql_fetchrow($result)) {
$type = $row['group_type'] == GROUP_SPECIAL ? 'special' : ($row['user_pending'] ? 'pending' : 'normal');
$group_data[$type][$i]['group_id'] = $row['group_id'];
$group_data[$type][$i]['group_name'] = $row['group_name'];
$group_data[$type][$i]['group_leader'] = $row['group_leader'] ? 1 : 0;
$id_ary[] = $row['group_id'];
$i++;
}
$db->sql_freeresult($result);
// Select box for other groups
$sql = 'SELECT group_id, group_name, group_type
FROM ' . GROUPS_TABLE . '
' . (sizeof($id_ary) ? 'WHERE group_id NOT IN (' . implode(', ', $id_ary) . ')' : '') . '
ORDER BY group_type DESC, group_name ASC';
$result = $db->sql_query($sql);
$s_group_options = '';
while ($row = $db->sql_fetchrow($result)) {
if ($config['coppa_hide_groups'] && in_array($row['group_name'], array('INACTIVE_COPPA', 'REGISTERED_COPPA'))) {
continue;
}
$s_group_options .= '<option' . ($row['group_type'] == GROUP_SPECIAL ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . ($row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
}
$db->sql_freeresult($result);
$current_type = '';
foreach ($group_data as $group_type => $data_ary) {
if ($current_type != $group_type) {
$template->assign_block_vars('group', array('S_NEW_GROUP_TYPE' => true, 'GROUP_TYPE' => $user->lang['USER_GROUP_' . strtoupper($group_type)]));
}
foreach ($data_ary as $data) {
$template->assign_block_vars('group', array('U_EDIT_GROUP' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=groups&mode=manage&action=edit&u={$user_id}&g={$data['group_id']}&back_link=acp_users_groups"), 'U_DEFAULT' => $this->u_action . "&action=default&u={$user_id}&g=" . $data['group_id'], 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . ($data['group_leader'] ? 'demote' : 'promote') . "&u={$user_id}&g=" . $data['group_id'], 'U_DELETE' => $this->u_action . "&action=delete&u={$user_id}&g=" . $data['group_id'], 'GROUP_NAME' => $group_type == 'special' ? $user->lang['G_' . $data['group_name']] : $data['group_name'], 'L_DEMOTE_PROMOTE' => $data['group_leader'] ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'], 'S_NO_DEFAULT' => $user_row['group_id'] != $data['group_id'] ? true : false, 'S_SPECIAL_GROUP' => $group_type == 'special' ? true : false));
}
}
$template->assign_vars(array('S_GROUPS' => true, 'S_GROUP_OPTIONS' => $s_group_options));
break;
case 'perm':
include_once $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
$auth_admin = new auth_admin();
$user->add_lang('acp/permissions');
$user->add_lang('acp/permissions_phpbb');
// Select auth options
$sql = 'SELECT auth_option, is_local, is_global
FROM ' . ACL_OPTIONS_TABLE . "\n\t\t\t\t\tWHERE auth_option LIKE '%\\_'\n\t\t\t\t\t\tAND is_global = 1\n\t\t\t\t\tORDER BY auth_option";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', ACL_NO);
$auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false);
}
$db->sql_freeresult($result);
$sql = 'SELECT auth_option, is_local, is_global
FROM ' . ACL_OPTIONS_TABLE . "\n\t\t\t\t\tWHERE auth_option LIKE '%\\_'\n\t\t\t\t\t\tAND is_local = 1\n\t\t\t\t\tORDER BY is_global DESC, auth_option";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'local', ACL_NO);
$auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false);
}
$db->sql_freeresult($result);
$template->assign_vars(array('S_PERMISSIONS' => true, 'U_USER_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=permissions&mode=setting_user_global&user_id[]=' . $user_id), 'U_USER_FORUM_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=permissions&mode=setting_user_local&user_id[]=' . $user_id)));
break;
}
// Assign general variables
$template->assign_vars(array('S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => sizeof($error) ? implode('<br />', $error) : ''));
}
示例2: main
//.........这里部分代码省略.........
if ($submit) {
if (!check_form_key($form_name)) {
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
if (!$group_id) {
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
// Add user/s to group
if ($error = group_user_add($group_id, $user_id)) {
trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
$error = array();
}
/** @var \phpbb\group\helper $group_helper */
$group_helper = $phpbb_container->get('group_helper');
$sql = 'SELECT ug.*, g.*
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug\n\t\t\t\t\tWHERE ug.user_id = {$user_id}\n\t\t\t\t\t\tAND g.group_id = ug.group_id\n\t\t\t\t\tORDER BY g.group_type DESC, ug.user_pending ASC, g.group_name";
$result = $db->sql_query($sql);
$i = 0;
$group_data = $id_ary = array();
while ($row = $db->sql_fetchrow($result)) {
$type = $row['group_type'] == GROUP_SPECIAL ? 'special' : ($row['user_pending'] ? 'pending' : 'normal');
$group_data[$type][$i]['group_id'] = $row['group_id'];
$group_data[$type][$i]['group_name'] = $row['group_name'];
$group_data[$type][$i]['group_leader'] = $row['group_leader'] ? 1 : 0;
$id_ary[] = $row['group_id'];
$i++;
}
$db->sql_freeresult($result);
// Select box for other groups
$sql = 'SELECT group_id, group_name, group_type, group_founder_manage
FROM ' . GROUPS_TABLE . '
' . (sizeof($id_ary) ? 'WHERE ' . $db->sql_in_set('group_id', $id_ary, true) : '') . '
ORDER BY group_type DESC, group_name ASC';
$result = $db->sql_query($sql);
$s_group_options = '';
while ($row = $db->sql_fetchrow($result)) {
if (!$config['coppa_enable'] && $row['group_name'] == 'REGISTERED_COPPA') {
continue;
}
// Do not display those groups not allowed to be managed
if ($user->data['user_type'] != USER_FOUNDER && $row['group_founder_manage']) {
continue;
}
$s_group_options .= '<option' . ($row['group_type'] == GROUP_SPECIAL ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . $group_helper->get_name($row['group_name']) . '</option>';
}
$db->sql_freeresult($result);
$current_type = '';
foreach ($group_data as $group_type => $data_ary) {
if ($current_type != $group_type) {
$template->assign_block_vars('group', array('S_NEW_GROUP_TYPE' => true, 'GROUP_TYPE' => $user->lang['USER_GROUP_' . strtoupper($group_type)]));
}
foreach ($data_ary as $data) {
$template->assign_block_vars('group', array('U_EDIT_GROUP' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=groups&mode=manage&action=edit&u={$user_id}&g={$data['group_id']}&back_link=acp_users_groups"), 'U_DEFAULT' => $this->u_action . "&action=default&u={$user_id}&g=" . $data['group_id'], 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . ($data['group_leader'] ? 'demote' : 'promote') . "&u={$user_id}&g=" . $data['group_id'], 'U_DELETE' => $this->u_action . "&action=delete&u={$user_id}&g=" . $data['group_id'], 'U_APPROVE' => $group_type == 'pending' ? $this->u_action . "&action=approve&u={$user_id}&g=" . $data['group_id'] : '', 'GROUP_NAME' => $group_type == 'special' ? $user->lang['G_' . $data['group_name']] : $data['group_name'], 'L_DEMOTE_PROMOTE' => $data['group_leader'] ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'], 'S_IS_MEMBER' => $group_type != 'pending' ? true : false, 'S_NO_DEFAULT' => $user_row['group_id'] != $data['group_id'] ? true : false, 'S_SPECIAL_GROUP' => $group_type == 'special' ? true : false));
}
}
$template->assign_vars(array('S_GROUPS' => true, 'S_GROUP_OPTIONS' => $s_group_options));
break;
case 'perm':
if (!class_exists('auth_admin')) {
include $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
}
$auth_admin = new auth_admin();
$user->add_lang('acp/permissions');
add_permission_language();
$forum_id = $request->variable('f', 0);
// Global Permissions
if (!$forum_id) {
// Select auth options
$sql = 'SELECT auth_option, is_local, is_global
FROM ' . ACL_OPTIONS_TABLE . '
WHERE auth_option ' . $db->sql_like_expression($db->get_any_char() . '_') . '
AND is_global = 1
ORDER BY auth_option';
$result = $db->sql_query($sql);
$hold_ary = array();
while ($row = $db->sql_fetchrow($result)) {
$hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', ACL_NEVER);
$auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false);
}
$db->sql_freeresult($result);
unset($hold_ary);
} else {
$sql = 'SELECT auth_option, is_local, is_global
FROM ' . ACL_OPTIONS_TABLE . "\n\t\t\t\t\t\tWHERE auth_option " . $db->sql_like_expression($db->get_any_char() . '_') . "\n\t\t\t\t\t\t\tAND is_local = 1\n\t\t\t\t\t\tORDER BY is_global DESC, auth_option";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$hold_ary = $auth_admin->get_mask('view', $user_id, false, $forum_id, $row['auth_option'], 'local', ACL_NEVER);
$auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false);
}
$db->sql_freeresult($result);
}
$s_forum_options = '<option value="0"' . (!$forum_id ? ' selected="selected"' : '') . '>' . $user->lang['VIEW_GLOBAL_PERMS'] . '</option>';
$s_forum_options .= make_forum_select($forum_id, false, true, false, false, false);
$template->assign_vars(array('S_PERMISSIONS' => true, 'S_GLOBAL' => !$forum_id ? true : false, 'S_FORUM_OPTIONS' => $s_forum_options, 'U_ACTION' => $this->u_action . '&u=' . $user_id, 'U_USER_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=permissions&mode=setting_user_global&user_id[]=' . $user_id), 'U_USER_FORUM_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=permissions&mode=setting_user_local&user_id[]=' . $user_id)));
break;
}
// Assign general variables
$template->assign_vars(array('S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => sizeof($error) ? implode('<br />', $error) : ''));
}
示例3: main
//.........这里部分代码省略.........
foreach ($data_ary as $data)
{
$template->assign_block_vars('group', array(
'U_EDIT_GROUP' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=groups&mode=manage&action=edit&u=$user_id&g={$data['group_id']}&back_link=acp_users_groups"),
'U_DEFAULT' => $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'],
'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'],
'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'],
'GROUP_NAME' => ($group_type == 'special') ? $user->lang['G_' . $data['group_name']] : $data['group_name'],
'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'],
'S_NO_DEFAULT' => ($user_row['group_id'] != $data['group_id']) ? true : false,
'S_SPECIAL_GROUP' => ($group_type == 'special') ? true : false,
)
);
}
}
$template->assign_vars(array(
'S_GROUPS' => true,
'S_GROUP_OPTIONS' => $s_group_options)
);
break;
case 'perm':
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
$auth_admin = new auth_admin();
$user->add_lang('acp/permissions');
add_permission_language();
$forum_id = request_var('f', 0);
// Global Permissions
if (!$forum_id)
{
// Select auth options
$sql = 'SELECT auth_option, is_local, is_global
FROM ' . ACL_OPTIONS_TABLE . '
WHERE auth_option ' . $db->sql_like_expression($db->any_char . '_') . '
AND is_global = 1
ORDER BY auth_option';
$result = $db->sql_query($sql);
$hold_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', ACL_NEVER);
$auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false);
}
$db->sql_freeresult($result);
unset($hold_ary);
}
else
{
$sql = 'SELECT auth_option, is_local, is_global
FROM ' . ACL_OPTIONS_TABLE . "
WHERE auth_option " . $db->sql_like_expression($db->any_char . '_') . "
AND is_local = 1
ORDER BY is_global DESC, auth_option";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$hold_ary = $auth_admin->get_mask('view', $user_id, false, $forum_id, $row['auth_option'], 'local', ACL_NEVER);
$auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false);
}
$db->sql_freeresult($result);
}
$s_forum_options = '<option value="0"' . ((!$forum_id) ? ' selected="selected"' : '') . '>' . $user->lang['VIEW_GLOBAL_PERMS'] . '</option>';
$s_forum_options .= make_forum_select($forum_id, false, true, false, false, false);
$template->assign_vars(array(
'S_PERMISSIONS' => true,
'S_GLOBAL' => (!$forum_id) ? true : false,
'S_FORUM_OPTIONS' => $s_forum_options,
'U_ACTION' => $this->u_action . '&u=' . $user_id,
'U_USER_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx" ,'i=permissions&mode=setting_user_global&user_id[]=' . $user_id),
'U_USER_FORUM_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions&mode=setting_user_local&user_id[]=' . $user_id))
);
break;
}
// Assign general variables
$template->assign_vars(array(
'S_ERROR' => (sizeof($error)) ? true : false,
'ERROR_MSG' => (sizeof($error)) ? implode('<br />', $error) : '')
);
}