本文整理汇总了PHP中add_permission_language函数的典型用法代码示例。如果您正苦于以下问题:PHP add_permission_language函数的具体用法?PHP add_permission_language怎么用?PHP add_permission_language使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_permission_language函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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) : ''));
}
示例2: main
function main($id, $mode)
{
global $db, $user, $auth, $template, $phpbb_container, $request;
global $config, $phpbb_root_path, $phpEx;
if (!function_exists('user_get_id_name')) {
include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
}
if (!class_exists('auth_admin')) {
include $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
}
$this->permissions = $phpbb_container->get('acl.permissions');
$auth_admin = new auth_admin();
$user->add_lang('acp/permissions');
add_permission_language();
$this->tpl_name = 'acp_permissions';
// Trace has other vars
if ($mode == 'trace') {
$user_id = $request->variable('u', 0);
$forum_id = $request->variable('f', 0);
$permission = $request->variable('auth', '');
$this->tpl_name = 'permission_trace';
if ($user_id && isset($auth_admin->acl_options['id'][$permission]) && $auth->acl_get('a_viewauth')) {
$this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $this->permissions->get_permission_lang($permission));
$this->permission_trace($user_id, $forum_id, $permission);
return;
}
trigger_error('NO_MODE', E_USER_ERROR);
}
// Copy forum permissions
if ($mode == 'setting_forum_copy') {
$this->tpl_name = 'permission_forum_copy';
if ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')) {
$this->page_title = 'ACP_FORUM_PERMISSIONS_COPY';
$this->copy_forum_permissions();
return;
}
trigger_error('NO_MODE', E_USER_ERROR);
}
// Set some vars
$action = $request->variable('action', array('' => 0));
$action = key($action);
$action = isset($_POST['psubmit']) ? 'apply_permissions' : $action;
$all_forums = $request->variable('all_forums', 0);
$subforum_id = $request->variable('subforum_id', 0);
$forum_id = $request->variable('forum_id', array(0));
$username = $request->variable('username', array(''), true);
$usernames = $request->variable('usernames', '', true);
$user_id = $request->variable('user_id', array(0));
$group_id = $request->variable('group_id', array(0));
$select_all_groups = $request->variable('select_all_groups', 0);
$form_name = 'acp_permissions';
add_form_key($form_name);
// If select all groups is set, we pre-build the group id array (this option is used for other screens to link to the permission settings screen)
if ($select_all_groups) {
// Add default groups to selection
$sql_and = !$config['coppa_enable'] ? " AND group_name <> 'REGISTERED_COPPA'" : '';
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . '
WHERE group_type = ' . GROUP_SPECIAL . "\n\t\t\t\t{$sql_and}";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$group_id[] = $row['group_id'];
}
$db->sql_freeresult($result);
}
// Map usernames to ids and vice versa
if ($usernames) {
$username = explode("\n", $usernames);
}
unset($usernames);
if (sizeof($username) && !sizeof($user_id)) {
user_get_id_name($user_id, $username);
if (!sizeof($user_id)) {
trigger_error($user->lang['SELECTED_USER_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING);
}
}
unset($username);
// Build forum ids (of all forums are checked or subforum listing used)
if ($all_forums) {
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
ORDER BY left_id';
$result = $db->sql_query($sql);
$forum_id = array();
while ($row = $db->sql_fetchrow($result)) {
$forum_id[] = (int) $row['forum_id'];
}
$db->sql_freeresult($result);
} else {
if ($subforum_id) {
$forum_id = array();
foreach (get_forum_branch($subforum_id, 'children') as $row) {
$forum_id[] = (int) $row['forum_id'];
}
}
}
// Define some common variables for every mode
$permission_scope = strpos($mode, '_global') !== false ? 'global' : 'local';
// Showing introductionary page?
if ($mode == 'intro') {
//.........这里部分代码省略.........
示例3: main
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache, $phpbb_container;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $request;
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
include_once $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
$this->auth_admin = new auth_admin();
$user->add_lang('acp/permissions');
add_permission_language();
$this->tpl_name = 'acp_permission_roles';
$submit = isset($_POST['submit']) ? true : false;
$role_id = request_var('role_id', 0);
$action = request_var('action', '');
$action = isset($_POST['add']) ? 'add' : $action;
$form_name = 'acp_permissions';
add_form_key($form_name);
if (!$role_id && in_array($action, array('remove', 'edit', 'move_up', 'move_down'))) {
trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
}
switch ($mode) {
case 'admin_roles':
$permission_type = 'a_';
$this->page_title = 'ACP_ADMIN_ROLES';
break;
case 'user_roles':
$permission_type = 'u_';
$this->page_title = 'ACP_USER_ROLES';
break;
case 'mod_roles':
$permission_type = 'm_';
$this->page_title = 'ACP_MOD_ROLES';
break;
case 'forum_roles':
$permission_type = 'f_';
$this->page_title = 'ACP_FORUM_ROLES';
break;
default:
trigger_error('NO_MODE', E_USER_ERROR);
break;
}
$template->assign_vars(array('L_TITLE' => $user->lang[$this->page_title], 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN']));
// Take action... admin submitted something
if ($submit || $action == 'remove') {
switch ($action) {
case 'remove':
$sql = 'SELECT *
FROM ' . ACL_ROLES_TABLE . '
WHERE role_id = ' . $role_id;
$result = $db->sql_query($sql);
$role_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$role_row) {
trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
}
if (confirm_box(true)) {
$this->remove_role($role_id, $permission_type);
$role_name = !empty($user->lang[$role_row['role_name']]) ? $user->lang[$role_row['role_name']] : $role_row['role_name'];
add_log('admin', 'LOG_' . strtoupper($permission_type) . 'ROLE_REMOVED', $role_name);
trigger_error($user->lang['ROLE_DELETED'] . adm_back_link($this->u_action));
} else {
confirm_box(false, 'DELETE_ROLE', build_hidden_fields(array('i' => $id, 'mode' => $mode, 'role_id' => $role_id, 'action' => $action)));
}
break;
case 'edit':
// Get role we edit
$sql = 'SELECT *
FROM ' . ACL_ROLES_TABLE . '
WHERE role_id = ' . $role_id;
$result = $db->sql_query($sql);
$role_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$role_row) {
trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
}
// no break;
// no break;
case 'add':
if (!check_form_key($form_name)) {
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$role_name = utf8_normalize_nfc(request_var('role_name', '', true));
$role_description = utf8_normalize_nfc(request_var('role_description', '', true));
$auth_settings = request_var('setting', array('' => 0));
if (!$role_name) {
trigger_error($user->lang['NO_ROLE_NAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING);
}
if (utf8_strlen($role_description) > 4000) {
trigger_error($user->lang['ROLE_DESCRIPTION_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
}
// if we add/edit a role we check the name to be unique among the settings...
$sql = 'SELECT role_id
FROM ' . ACL_ROLES_TABLE . "\n\t\t\t\t\t\tWHERE role_type = '" . $db->sql_escape($permission_type) . "'\n\t\t\t\t\t\t\tAND role_name = '" . $db->sql_escape($role_name) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// Make sure we only print out the error if we add the role or change it's name
if ($row && ($mode == 'add' || $mode == 'edit' && $role_row['role_name'] != $role_name)) {
trigger_error(sprintf($user->lang['ROLE_NAME_ALREADY_EXIST'], $role_name) . adm_back_link($this->u_action), E_USER_WARNING);
}
//.........这里部分代码省略.........
示例4: 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";
示例5: main
function main($id, $mode)
{
global $db, $cache, $config, $user, $lang, $auth, $template, $cms_admin;
add_permission_language();
include_once IP_ROOT_PATH . 'includes/class_auth_admin.' . PHP_EXT;
$auth_admin = new auth_admin();
// Set some vars
$action = request_var('paction', array('' => 0));
$action = key($action);
$action = isset($_POST['psubmit']) ? 'apply_permissions' : $action;
$all_forums = request_var('all_forums', 0);
$subforum_id = request_var('subforum_id', 0);
$forum_id = request_var('forum_id', array(0));
$id_type = request_var('id_type', '');
$id_types_array = array('forum', 'block', 'layout', 'layout_special');
$id_type = in_array($id_type, $id_types_array) ? $id_type : $id_types_array[0];
$this->id_type = $id_type;
$username = request_var('username', array(''), true);
$usernames = request_var('usernames', '', true);
$user_id = request_var('user_id', array(0));
$group_id = request_var('group_id', array(0));
$select_all_groups = request_var('select_all_groups', 0);
$form_name = 'acp_permissions';
add_form_key($form_name);
$this->tpl_name = 'cms_permissions.tpl';
$this->u_action = append_sid($cms_admin->root . '?mode=auth&pmode=' . $mode);
/*
// Trace has other vars
if ($mode == 'trace')
{
$user_id = request_var('u', 0);
$forum_id = request_var('f', 0);
$permission = request_var('auth', '');
$this->tpl_name = 'cms_permission_trace.tpl';
if ($user_id && isset($auth_admin->acl_options['id'][$permission]))
{
$this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $user->lang['acl_' . $permission]['lang']);
$this->permission_trace($user_id, $forum_id, $permission);
return;
}
trigger_error('NO_MODE', E_USER_ERROR);
}
*/
// If select all groups is set, we pre-build the group id array (this option is used for other screens to link to the permission settings screen)
if ($select_all_groups) {
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . '
WHERE group_single_user = 0';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$group_id[] = $row['group_id'];
}
$db->sql_freeresult($result);
}
// Map usernames to ids and vice versa
if ($usernames) {
$username = explode("\n", $usernames);
}
unset($usernames);
if (sizeof($username) && !sizeof($user_id)) {
user_get_id_name($user_id, $username);
if (!sizeof($user_id)) {
trigger_error($user->lang['SELECTED_USER_NOT_EXIST'] . page_back_link($this->u_action), E_USER_WARNING);
}
}
unset($username);
// Define some common variables for every mode
$error = array();
$permission_scope = strpos($mode, '_global') !== false ? 'global' : 'local';
// Showing introductionary page?
if ($mode == 'intro') {
$this->page_title = 'CMS_PERMISSIONS';
$template->assign_vars(array('S_INTRO' => true));
return;
}
switch ($mode) {
case 'setting_admin_global':
case 'setting_mod_global':
$this->permission_dropdown = strpos($mode, '_admin_') !== false ? array('a_') : array('m_');
$permission_victim = array('usergroup');
$this->page_title = $mode == 'setting_admin_global' ? 'CMS_PERMISSIONS_ADMINS' : 'CMS_PERMISSIONS_MODS';
break;
case 'setting_cms_user_global':
case 'setting_cms_group_global':
$this->permission_dropdown = array('cms_', 'pl_', 'u_');
$permission_victim = array('usergroup');
//$permission_victim = ($mode == 'setting_cms_user_global') ? array('user') : array('group');
$this->page_title = $mode == 'setting_cms_user_global' ? 'CMS_PERMISSIONS_CMS_USERS' : 'CMS_PERMISSIONS_CMS_GROUPS';
break;
case 'setting_cms_user_local':
case 'setting_cms_group_local':
$this->permission_dropdown = $this->id_type == 'layout' ? array('cmsl_') : ($this->id_type == 'layout_special' ? array('cmss_') : array('cmsb_'));
$permission_victim = array('cms', 'usergroup');
//$permission_victim = ($mode == 'setting_cms_user_local') ? array('user') : array('group');
$this->page_title = $mode == 'setting_cms_user_local' ? 'CMS_PERMISSIONS_CMS_USERS' : 'CMS_PERMISSIONS_CMS_GROUPS';
break;
case 'setting_plugins_user_global':
case 'setting_plugins_group_global':
//.........这里部分代码省略.........