aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/database_update.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-03-01 16:15:11 +0100
committerJoas Schilling <nickvergessen@gmx.de>2012-12-06 15:10:29 +0100
commit4103c99a8676653a868014a6f58a76e8986bd5ed (patch)
treed51e247df33f3189bb530dfbc2102fc7e98bdde0 /phpBB/install/database_update.php
parent2364d4b2172c9f54520f04001b29c517d7138b69 (diff)
downloadforums-4103c99a8676653a868014a6f58a76e8986bd5ed.tar
forums-4103c99a8676653a868014a6f58a76e8986bd5ed.tar.gz
forums-4103c99a8676653a868014a6f58a76e8986bd5ed.tar.bz2
forums-4103c99a8676653a868014a6f58a76e8986bd5ed.tar.xz
forums-4103c99a8676653a868014a6f58a76e8986bd5ed.zip
[ticket/10679] Add new permission for changing profile field information
The setting is copied from "Can use signature" PHPBB3-10679
Diffstat (limited to 'phpBB/install/database_update.php')
-rw-r--r--phpBB/install/database_update.php48
1 files changed, 44 insertions, 4 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index e966756337..f0a16844e9 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -2731,8 +2731,6 @@ function change_database_data(&$no_updates, $version)
$config->set('display_last_subject', '1');
}
- $no_updates = false;
-
if (!isset($config['assets_version']))
{
$config->set('assets_version', '1');
@@ -2771,7 +2769,7 @@ function change_database_data(&$no_updates, $version)
}
// PHPBB3-10601: Make inbox default. Add basename to ucp's pm category
-
+
// Get the category wanted while checking, at the same time, if this has already been applied
$sql = 'SELECT module_id, module_basename
FROM ' . MODULES_TABLE . "
@@ -2788,10 +2786,52 @@ function change_database_data(&$no_updates, $version)
SET module_basename = 'ucp_pm'
WHERE module_id = " . (int) $row['module_id'];
- _sql($sql, $errored, $error_ary);
+ _sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
+ // Add new permission u_chgprofileinfo and duplicate settings from u_sig
+ include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
+ $auth_admin = new auth_admin();
+
+ // Only add the new permission if it does not already exist
+ if (empty($auth_admin->acl_options['id']['u_chgprofileinfo']))
+ {
+ $auth_admin->acl_add_option(array('global' => array('u_chgprofileinfo')));
+
+ // Now the tricky part, filling the permission
+ $old_id = $auth_admin->acl_options['id']['u_sig'];
+ $new_id = $auth_admin->acl_options['id']['u_chgprofileinfo'];
+
+ $tables = array(ACL_GROUPS_TABLE, ACL_ROLES_DATA_TABLE, ACL_USERS_TABLE);
+
+ foreach ($tables as $table)
+ {
+ $sql = 'SELECT *
+ FROM ' . $table . '
+ WHERE auth_option_id = ' . $old_id;
+ $result = _sql($sql, $errored, $error_ary);
+
+ $sql_ary = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $row['auth_option_id'] = $new_id;
+ $sql_ary[] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ if (sizeof($sql_ary))
+ {
+ $db->sql_multi_insert($table, $sql_ary);
+ }
+ }
+
+ // Remove any old permission entries
+ $auth_admin->acl_clear_prefetch();
+ }
+
+ $no_updates = false;
+
break;
}
}