本文整理汇总了PHP中get_group_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_group_id函数的具体用法?PHP get_group_id怎么用?PHP get_group_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_group_id函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fix_empty_primary_groups
/**
* Ensure that all users have a default group specified and update related information such as their colour
*/
function fix_empty_primary_groups()
{
global $db;
// Set group ids for users not already having it
$sql = 'UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('registered') . '
WHERE group_id = 0 AND user_type = ' . USER_INACTIVE;
$db->sql_query($sql);
$sql = 'UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('registered') . '
WHERE group_id = 0 AND user_type = ' . USER_NORMAL;
$db->sql_query($sql);
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('guests') . ' WHERE user_id = ' . ANONYMOUS);
$sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . ' WHERE group_id = ' . get_group_id('administrators');
$result = $db->sql_query($sql);
$user_ids = array();
while ($row = $db->sql_fetchrow($result)) {
$user_ids[] = $row['user_id'];
}
$db->sql_freeresult($result);
if (sizeof($user_ids)) {
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('administrators') . '
WHERE group_id = 0 AND ' . $db->sql_in_set('user_id', $user_ids));
}
$sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . ' WHERE group_id = ' . get_group_id('global_moderators');
$user_ids = array();
while ($row = $db->sql_fetchrow($result)) {
$user_ids[] = $row['user_id'];
}
$db->sql_freeresult($result);
if (sizeof($user_ids)) {
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('global_moderators') . '
WHERE group_id = 0 AND ' . $db->sql_in_set('user_id', $user_ids));
}
// Set user colour
$sql = 'SELECT group_id, group_colour FROM ' . GROUPS_TABLE . "\n\t\tWHERE group_colour <> ''";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$db->sql_query('UPDATE ' . USERS_TABLE . " SET user_colour = '{$row['group_colour']}' WHERE group_id = {$row['group_id']}");
}
$db->sql_freeresult($result);
}
示例2: syncgroups
private function syncgroups()
{
// Si l'utilisateur est login alors voir les groups qu'il a et les ajouter s'il n'existe pas.
// En profiter pour maj l'user
//todo: code la maj du realname
// maj des groups
if (!function_exists('get_group_id')) {
include $this->phpbb_root_path . 'includes/functions_convert.' . $this->php_ext;
}
if (!function_exists('group_memberships')) {
include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
}
if (!function_exists('get_group_name')) {
include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
}
$passage_groups = explode(' ', get_apache_header($this->config['passage_groups']));
$phpbb_groups = group_memberships(false, $this->user->data['user_id'], false);
// Append
if (!empty($phpbb_groups) and !empty($passage_groups)) {
foreach ($passage_groups as $p_grg) {
if (is_array($phpbb_groups)) {
if (false == in_array($p_grg, $phpbb_groups)) {
group_user_add(get_group_id($p_grg), $this->user->data['user_id']);
}
}
}
// Clean
if (is_array($phpbb_groups)) {
foreach ($phpbb_groups as $bb_grp) {
if (false == in_array(get_group_name($bb_grp['group_id']), $passage_groups)) {
group_user_del($bb_grp['group_id'], $this->user->data['user_id']);
}
}
}
}
}
示例3: phpbb_set_primary_group
/**
* Set primary group.
* Really simple and only based on user_level (remaining groups will be assigned later)
*/
function phpbb_set_primary_group($user_level)
{
global $convert_row;
if ($user_level == 1)
{
return get_group_id('administrators');
}
/* else if ($user_level == 2)
{
return get_group_id('global_moderators');
}
else if ($user_level == 0 && $convert_row['user_active'])*/
else if ($convert_row['user_active'])
{
return get_group_id('registered');
}
return 0;
}
示例4: default_do_login
/**
* default_do_login - Login in the system
*/
function default_do_login()
{
global $PARAMS, $SOAP, $LOG;
if (get_parameter($PARAMS, "help")) {
echo <<<EOF
login - Log into GForge server
Available parameters:
--username=<username> or -U <username> Specify the user name
--password=<password> or -p <password> Specify the password. If none is entered, it
will be asked (note that this is the UNIX name of the project)
--project=<projectname> (Optional) Select a project to work on
--help Show this screen
Example:
gforge login -U john -p doe --project=myproject
EOF;
return;
}
$username = get_parameter($PARAMS, array("username", "U"), true);
$password = get_parameter($PARAMS, array("password", "p"), true);
$host = get_parameter($PARAMS, "host", true);
$secure = get_parameter($PARAMS, array("secure", "s"));
$projectname = get_parameter($PARAMS, "project", true);
// If no username is specified, use the system user name
if (strlen($username) == 0) {
if (array_key_exists("USER", $_ENV)) {
$username = $_ENV["USER"];
} else {
exit_error("You must specify the user name with the --username parameter");
}
}
// If no password is specified, ask for it
if (strlen($password) == 0) {
$password = get_user_input("Password: ", true);
}
if (strlen($host) > 0) {
if ($secure) {
$protocol = "https";
} else {
$protocol = "http";
}
$SOAP->setWSDL($protocol . "://" . $host . "/soap/?wsdl");
}
// Terminate an existing session (if any)
$SOAP->endSession();
// try to login in the server
$session_string = $SOAP->call("login", array("userid" => $username, "passwd" => $password), false);
// there was an error
if ($err = $SOAP->getError()) {
exit_error($err, $SOAP->faultcode);
}
// Login is OK, $result containts the session hash string
$LOG->add("Logged in as user " . $username . ", using session string " . $session_string);
echo "Logged in.\n";
$SOAP->setSessionString($session_string);
$SOAP->setSessionUser($username);
// If project was specified, get project information and store for future use
if (strlen($projectname) > 0) {
$group_id = get_group_id($projectname);
if (!$group_id) {
exit_error("Project \"" . $projectname . "\" doesn't exist");
}
$SOAP->setSessionGroupID($group_id);
$LOG->add("Using group #" . $group_id);
}
$SOAP->saveSession();
}
示例5: array
$language_file = 'mods/info_acp_mobiquo';
// The name of the mod to be displayed during installation.
$mod_name = 'ACP_MOBIQUO_TITLE';
/*
* The name of the config variable which will hold the currently installed version
* You do not need to set this yourself, UMIL will handle setting and updating the version itself.
*/
$version_config_name = 'mobiquo_version';
/*
* The array of versions and actions within each.
* You do not need to order it a specific way (it will be sorted automatically), however, you must enter every version, even if no actions are done for it.
*
* You must use correct version numbering. Unless you know exactly what you can use, only use X.X.X (replacing X with an integer).
* The version numbering must otherwise be compatible with the version_compare function - http://php.net/manual/en/function.version-compare.php
*/
$versions = array('3.4.0' => array('config_add' => array(array('mobiquo_push', 1), array('mobiquo_hide_forum_id', ''), array('mobiquo_guest_okay', 1), array('mobiquo_reg_url', 'ucp.php?mode=register'), array('tapatalkdir', 'mobiquo'), array('mobiquo_is_chrome', 1)), 'module_add' => array(array('acp', 'ACP_CAT_DOT_MODS', 'ACP_MOBIQUO'), array('acp', 'ACP_MOBIQUO', array('module_basename' => 'mobiquo', 'module_langname' => 'ACP_MOBIQUO_SETTINGS', 'module_mode' => 'mobiquo', 'module_auth' => 'acl_a_mobiquo'))), 'custom' => 'mobiquo_table', 'table_add' => array(array($table_prefix . 'tapatalk_users', array('COLUMNS' => array('userid' => array('INT:10', 0), 'announcement' => array('INT:5', 1), 'pm' => array('INT:5', 1), 'subscribe' => array('INT:5', 1), 'quote' => array('INT:5', 1), 'newtopic' => array('INT:5', 1), 'tag' => array('INT:5', 1), 'updated' => array('TIMESTAMP', 0)), 'PRIMARY_KEY' => 'userid')))), '3.4.1' => array('permission_add' => array(array('a_mobiquo', true)), 'permission_set' => array(array('ROLE_ADMIN_FULL', 'a_mobiquo'))), '3.4.2' => array('module_remove' => array(array('acp', 'ACP_MOBIQUO', 'ACP_MOBIQUO_SETTINGS')), 'module_add' => array(array('acp', 'ACP_MOBIQUO', array('module_basename' => 'mobiquo', 'module_langname' => 'ACP_MOBIQUO_SETTINGS', 'module_mode' => 'mobiquo', 'module_auth' => 'acl_a_mobiquo')))), '3.4.3' => array(), '3.5.0' => array('config_add' => array(array('tapatalk_push_key', '')), 'table_add' => array(array($table_prefix . 'tapatalk_push_data', array('COLUMNS' => array('push_id' => array('INT:10', NULL, 'auto_increment'), 'author' => array('VCHAR:100', ''), 'user_id' => array('INT:10', 0), 'data_type' => array('CHAR:20', ''), 'title' => array('VCHAR:200', ''), 'data_id' => array('INT:10', 0), 'create_time' => array('TIMESTAMP', 0)), 'PRIMARY_KEY' => 'push_id', 'KEYS' => array('user_id' => array('INDEX', 'user_id'), 'ct' => array('INDEX', 'create_time'), 'author' => array('INDEX', 'author')))))), '3.6.0' => array('config_add' => array(array('tapatalk_android_msg', 'This forum has an app for Android. Click OK to learn more about Tapatalk.'), array('tapatalk_android_url', 'market://details?id=com.quoord.tapatalkpro.activity'), array('tapatalk_iphone_msg', 'This forum has an app for iPhone ! Click OK to learn more about Tapatalk.'), array('tapatalk_iphone_url', 'http://itunes.apple.com/us/app/tapatalk-forum-app/id307880732?mt=8'), array('tapatalk_ipad_msg', 'This forum has an app for iPad! Click OK to learn more about Tapatalk.'), array('tapatalk_ipad_url', 'http://itunes.apple.com/us/app/tapatalk-hd-for-ipad/id481579541?mt=8'), array('tapatalk_kindle_msg', 'This forum has an app for Kindle Fire! Click OK to learn more about Tapatalk.'), array('tapatalk_kindle_url', 'http://www.amazon.com/gp/mas/dl/android?p=com.quoord.tapatalkpro.activity'), array('tapatalk_forum_read_only', '')), 'module_remove' => array(array('acp', 'ACP_MOBIQUO', 'ACP_MOBIQUO_SETTINGS')), 'module_add' => array(array('acp', 'ACP_MOBIQUO', array('module_basename' => 'mobiquo', 'module_langname' => 'ACP_MOBIQUO_SETTINGS', 'module_mode' => 'mobiquo', 'module_auth' => 'acl_a_board')), array('acp', 'ACP_MOBIQUO', array('module_basename' => 'mobiquo', 'module_langname' => 'ACP_TAPATALK_REBRANDING', 'module_mode' => 'rebranding', 'module_auth' => 'acl_a_board'))), 'permission_remove' => array(array('a_mobiquo'))), '3.6.1' => array(), '3.7.0' => array('config_add' => array(array('tapatalk_allow_register', '1'), array('tapatalk_iphone_app_id', ''), array('tapatalk_kindle_hd_msg', 'This forum has an app for Kindle Fire HD! Click OK to learn more about Tapatalk.'), array('tapatalk_kindle_hd_url', ''), array('tapatalk_android_hd_msg', 'This forum has an app for Android HD! Click OK to learn more about Tapatalk.'), array('tapatalk_android_hd_url', ''), array('tapatalk_app_icon_url', 'mobiquo/smartbanner/tapatalk2.png'), array('tapatalk_custom_replace', ""), array('tapatalk_app_desc', ''), array('tapatalk_app_name', '')), 'config_remove' => array(array('mobiquo_is_chrome')), 'custom' => 'push_table_update'), '3.7.1' => array(), '3.8.0' => array('config_remove' => array(array('tapatalk_iphone_app_id'), array('tapatalk_kindle_hd_msg'), array('tapatalk_kindle_hd_url'), array('tapatalk_android_hd_msg'), array('tapatalk_android_hd_url'), array('tapatalk_app_icon_url'), array('tapatalk_android_msg'), array('tapatalk_android_url'), array('tapatalk_iphone_msg'), array('tapatalk_iphone_url'), array('tapatalk_ipad_msg'), array('tapatalk_ipad_url'), array('tapatalk_kindle_msg'), array('tapatalk_kindle_url')), 'config_add' => array(array('tapatalk_app_banner_msg', ''), array('tapatalk_app_ios_id', ''), array('tapatalk_android_url'), array('tapatalk_kindle_url'), array('tapatalk_push_slug', '0'))), '3.8.1' => array(), '3.9.0' => array(), '4.0.0' => array('config_remove' => array(array('mobiquo_guest_okay'))), '4.1.0' => array('config_add' => array(array('tapatalk_app_ads_enable', 1)), 'config_remove' => array(array('tapatalk_allow_register')), 'custom' => 'push_table_update'), '4.1.1' => array(), '4.2.0' => array(), '4.3.0' => array('module_add' => array(array('acp', 'ACP_MOBIQUO', array('module_basename' => 'mobiquo', 'module_langname' => 'ACP_MOBIQUO_REGISTER_SETTINGS', 'module_mode' => 'register', 'module_auth' => 'acl_a_board'))), 'config_add' => array(array('tapatalk_register_status', 2), array('tapatalk_register_group', get_group_id('REGISTERED'))), 'custom' => 'push_table_update'), '4.3.1' => array());
// Include the UMIF Auto file and everything else will be handled automatically.
include $phpbb_root_path . 'umil/umil_auto.' . $phpEx;
/*
* Here is our custom function that will be called
*
* @param string $action The action (install|update|uninstall) will be sent through this.
* @param string $version The version this is being run for will be sent through this.
*/
function mobiquo_table($action, $version)
{
global $db, $table_prefix, $umil;
if ($action == 'install') {
// Run this when installing
if ($umil->table_exists($table_prefix . 'tapatalk_users')) {
//table from previous version exists...delete it.
示例6: check_guest_hash
// Create a guest user ID if enabled
if (!logged_in($userid) and $guests_can_chat == 1) {
$userid = check_guest_hash();
}
// Exit if banned
if (in_array($user_ip, $banlist) || in_array($userid, $banlist)) {
if (!empty($user_ip)) {
close_session();
exit;
}
}
// Get Group ID
if (check_if_guest($userid)) {
$group_id = array('acg');
} else {
$group_id = get_group_id($userid);
}
// Get file permissions for groups here so it can be passed to other files
if ($group_enable_mode == 1) {
if (check_array_for_match($group_id, $group_disable_uploads_sep)) {
} else {
$chatroom_transfer_on = 0;
$file_transfer_on = 0;
}
} else {
if (check_array_for_match($group_id, $group_disable_uploads_sep)) {
$chatroom_transfer_on = 0;
$file_transfer_on = 0;
}
}
// ############################ GET USER DATA ############################
示例7: array
'target' => USERS_TABLE,
'primary' => 'users.uid',
'autoincrement' => 'user_id',
'query_first' => array(
array('target', 'DELETE FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS),
array('target', $convert->truncate_statement . BOTS_TABLE)
),
'execute_last' => '
remove_invalid_users();
',
array('user_id', 'users.uid', 'phpbb_user_id'),
array('', 'users.uid AS poster_id', 'phpbb_user_id'),
array('user_type', USER_NORMAL, ''),
array('group_id', get_group_id('registered'), ''),
array('user_regdate', 'users.regdate', ''),
array('username', 'users.username', 'phpbb_set_encoding_html'), // recode to utf8 with default lang
array('username_clean', 'users.username', array('function1' => 'phpbb_set_encoding_html', 'function2' => 'utf8_clean_string')),
array('user_password', 'users.password', ''),
array('user_passwd_salt', 'users.salt', ''),
array('user_pass_convert', 1, ''),
array('user_posts', 'users.postnum', 'intval'),
array('user_email', 'users.email', 'strtolower'),
array('user_email_hash', 'users.email', 'gen_email_hash'),
array('user_birthday', 'users.birthday', ''),
array('user_lastvisit', 'users.lastvisit', 'intval'),
array('user_lastmark', 'users.regdate', 'intval'),
array('user_lang', $config['default_lang'], ''),
array('user_timezone', 'users.timezone', 'floatval'),
array('user_dateformat', $config['default_dateformat'], ''),
示例8: import
function import()
{
// 工装管理员 生产安全部
if (!has_perm(6, 1)) {
exit;
}
$name = $_FILES['files']['name'][0];
$size = $_FILES['files']['size'][0];
$tmp_name = $_FILES['files']['tmp_name'][0];
if (get_file_ext($name) != 'xls') {
$results['error'] = '对不起,系统只允许上传扩展名为 <strong>xls</strong> 的电子表格文件!';
$results['is_success'] = false;
} else {
if ($size > 2000000) {
$results['error'] = '对不起,系统只允许上传小于 <strong>2M</strong> 的电子表格文件!';
$results['is_success'] = false;
} else {
if (!empty($tmp_name)) {
$data = new \Spreadsheet_Excel_Reader();
$data->setOutputEncoding('UTF-8');
$cols = 12;
/* 每一行有12个单元格 */
$data->read($tmp_name);
error_reporting(E_ALL ^ E_NOTICE);
// 对电子表格的每一行进行循环
// 检测到某个单元格不存在时,设定其为空值
$rows = array();
//debug( $data->sheets[0]['cells'] );
foreach ($data->sheets[0]['cells'] as $row) {
for ($i = 1; $i <= $cols; $i++) {
if (!isset($row[$i])) {
$row[$i] = '';
}
// 转换部门名称为部门id值
if ($i == 6 && !empty($row[$i])) {
$row[$i] = get_group_id($row[$i]);
}
// 转换产品类型为id值
if ($i == 10) {
$row[$i] = get_type_id($row[$i]);
}
// 生产数量如果为空,则置0
if ($i == 4 && empty($row[$i])) {
$row[$i] = 0;
}
// 计划完成时间
if ($i == 5 && !empty($row[$i])) {
$row[$i] = change_date_style($row[$i]);
}
}
$rows[] = $row;
}
// 导入数据库
foreach ($rows as $row) {
//debug( $row );
$prod = new \Model\Production();
$prod->num = $row[1];
$prod->name = $row[2];
$prod->graphic_num = $row[3];
$prod->count = $row[4];
$prod->planned_completion_date = $row[5];
$prod->graphic_src = $row[6];
$prod->use_dep = 18;
$prod->completion_contact_person = $row[7];
$prod->completion_contact_phone = $row[8];
$prod->graphic_count = $row[9];
$prod->type = $row[10];
$prod->project_src = $row[11];
$prod->remark = $row[12];
$prod->user_id = $_SESSION['user_id'];
if ($prod->is_valid()) {
$prod->save();
} else {
//debug( $prod->errors );
// 如果某条导入失败
// 记录该条目的生产指令号,产品名称
// 以及具体的错误原因
$errors = array();
foreach ($prod->errors as $error) {
$errors[] = $error;
}
$results['failed_items'][] = array('num' => $prod->num, 'name' => $prod->name, 'errors' => $errors);
}
}
//debug( $rows );*/
//debug( $rows );
//debug( $rows );
$results['is_success'] = true;
}
}
}
echo json_encode($results);
}
示例9: switch
return $keys;
}
switch ($HTTP_GET_VARS['install']) {
case 'new':
install_ORP_to_sql();
tep_redirect(tep_href_link($filename));
break;
case 'remove':
$group_id = get_group_id($contrib);
remove_keys($group_id);
remove_group_id($contrib);
remove_table();
tep_redirect(tep_href_link($filename));
break;
case 'upgrade':
$group_id = get_group_id($contrib);
remove_keys($group_id);
install_ORP_to_sql($group_id);
tep_redirect(tep_href_link($filename));
break;
}
require DIR_WS_INCLUDES . 'template_top.php';
?>
<style>
.intro_section {padding:20px 20px 0px 20px;}
.intro_section p {width:590px;}
.intro_section b {font-size:.8em;font-weight:bold;color:#900;}
.setup_section {width:600px;border:solid 1px black;margin:10px;padding:3px 3px 10px 3px;}
.setup_section p {margin:10px;padding:3px}
</style>
<span class="pageHeading"><?php
示例10: get_working_group
/**
* get_working_group - Return the ID of the group the user is currently working with. The name of the group can be defined
* on the session or in the parameters.
*
* @param array An array of parameters to look for the defined group. If the group isn't in the parameters, looks in the session
* @param bool Specify if we should abort the program if the group isn't found
*/
function get_working_group(&$params, $die = true)
{
global $SOAP;
$group_name = get_parameter($params, "project", true);
if ($group_name) {
$group_id = get_group_id($group_name);
if (!$group_id) {
if ($die) {
exit_error("Invalid project \"" . $group_name . "\"");
} else {
return false;
}
}
} else {
$group_id = $SOAP->getSessionGroupID();
if (!$group_id) {
if ($die) {
exit_error("You must specify a project using the --project=parameter");
} else {
return false;
}
}
}
return $group_id;
}
示例11: require_login
/**
* This page allows for the tagging of program objectives to course objectives.
*/
global $PAGE, $CFG, $DB, $USER;
require_once '../../config.php';
require_once 'lib.php';
// Check that they can access
require_login();
// TODO: Get permissions working
//require_capability('local/metadata:ins_view', $context);
require_once $CFG->dirroot . '/local/metadata/tag_form.php';
$categoryId = get_category_id();
$PAGE->set_category_by_id($categoryId);
$courseId = get_course_id();
$objectiveId = get_objective_id();
$groupId = get_group_id();
$programId = get_program_id();
$course = $DB->get_record('course', array('id' => $courseId), '*', MUST_EXIST);
// Set up page information
$PAGE->set_context(context_coursecat::instance($categoryId));
$PAGE->set_pagelayout('standard');
$PAGE->set_title(get_string('ins_pluginname', 'local_metadata'));
$heading = 'Program Learning Objectives: ' . $course->shortname . ': ' . $course->fullname;
$PAGE->set_heading($heading);
// Create url
$base_url = new moodle_url('/local/metadata/admview_tag.php', array('categoryid' => $categoryId, 'id' => $courseId, 'program' => $programId, 'obj' => $objectiveId, 'grp' => $groupId));
$knowledge_url = create_manage_url('knowledge', $categoryId);
$policy_url = create_manage_url('policy', $categoryId);
$tag_url = create_manage_url('course', $categoryId);
$exclude_url = create_manage_url('exclude', $categoryId);
$reporting_url = create_manage_url('reporting', $categoryId);
示例12: get_group_id
<dl class="selectionBox">
<dt>
<label for="username">IP Address</label>
</dt>
<dd style="margin-top: 7px;">
<span><?php
echo $row['ip_address'];
?>
</span>
<p class="explain">
</p>
</dd>
</dl>
<?php
$group_id = get_group_id(get_var('id'));
if (!is_null($group_id)) {
?>
<dl class="selectionBox">
<dt>
<label for="username">Group IDs</label>
</dt>
<dd style="margin-top: 7px;">
<span>
<?php
$i = 1;
foreach ($group_id as $val) {
if ($i == 1) {
echo $val;
} else {
echo ', ' . $val;
示例13: phpbb_convert_authentication
/**
* Convert authentication
* user, group and forum table has to be filled in order to work
*/
function phpbb_convert_authentication($mode)
{
global $db, $src_db, $same_db, $convert, $phpbb_root_path, $phpEx;
if ($mode == 'start')
{
$db->sql_query($convert->truncate_statement . ACL_USERS_TABLE);
$db->sql_query($convert->truncate_statement . ACL_GROUPS_TABLE);
// Grab users with admin permissions
$sql = "SELECT uid, permissions
FROM {$convert->src_table_prefix}adminoptions
WHERE uid >= 1";
$result = $src_db->sql_query($sql);
$admins = $founders = array();
while ($row = $src_db->sql_fetchrow($result))
{
$user_id = (int) phpbb_user_id($row['uid']);
$permissions = unserialize($row['permissions']);
$admins[] = $user_id;
if ($permissions['user']['admin_permissions'])
{
$founders[] = $user_id;
}
}
$src_db->sql_freeresult($result);
// We'll set the users that can manage admin permissions as founders.
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_type = ' . USER_FOUNDER . "
WHERE " . $db->sql_in_set('user_id', $founders);
$db->sql_query($sql);
$bot_group_id = get_group_id('bots');
user_group_auth('guests', 'SELECT user_id, {GUESTS} FROM ' . USERS_TABLE . ' WHERE user_id = ' . ANONYMOUS, false);
user_group_auth('registered', 'SELECT user_id, {REGISTERED} FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS . " AND group_id <> $bot_group_id", false);
$auth_sql = 'SELECT user_id, {ADMINISTRATORS} FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $admins);
user_group_auth('administrators', $auth_sql, false);
$auth_sql = 'SELECT user_id, {GLOBAL_MODERATORS} FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $admins);
user_group_auth('global_moderators', $auth_sql, false);
if (!function_exists('group_set_user_default'))
{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
}
// Set the admin group as their default group.
group_set_user_default(get_group_id('administrators'), $admins);
}
else if ($mode == 'first')
{
// Assign permission roles and other default permissions
// guests having u_download and u_search ability
$db->sql_query('INSERT INTO ' . ACL_GROUPS_TABLE . ' (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) SELECT ' . get_group_id('guests') . ', 0, auth_option_id, 0, 1 FROM ' . ACL_OPTIONS_TABLE . " WHERE auth_option IN ('u_', 'u_download', 'u_search')");
// administrators/global mods having full user features
mass_auth('group_role', 0, 'administrators', 'USER_FULL');
mass_auth('group_role', 0, 'global_moderators', 'USER_FULL');
// By default all converted administrators are given full access
mass_auth('group_role', 0, 'administrators', 'ADMIN_FULL');
// All registered users are assigned the standard user role
mass_auth('group_role', 0, 'registered', 'USER_STANDARD');
mass_auth('group_role', 0, 'registered_coppa', 'USER_STANDARD');
// Instead of administrators being global moderators we give the MOD_FULL role to global mods (admins already assigned to this group)
mass_auth('group_role', 0, 'global_moderators', 'MOD_FULL');
}
}