本文整理汇总了PHP中auth_admin::acl_add_option方法的典型用法代码示例。如果您正苦于以下问题:PHP auth_admin::acl_add_option方法的具体用法?PHP auth_admin::acl_add_option怎么用?PHP auth_admin::acl_add_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth_admin
的用法示例。
在下文中一共展示了auth_admin::acl_add_option方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
function install()
{
global $phpbb_root_path, $phpEx, $db, $user;
// Setup $auth_admin class so we can add permission options
include $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
$auth_admin = new auth_admin();
// Add permission for manage cvsdb
$auth_admin->acl_add_option(array('local' => array(), 'global' => array('a_add_board')));
$module_data = $this->module();
$module_basename = substr(strstr($module_data['filename'], '_'), 1);
$result = $db->sql_query('SELECT module_id FROM ' . MODULES_TABLE . " WHERE module_basename = '{$module_basename}'");
$module_id = $db->sql_fetchfield('module_id');
$db->sql_freeresult($result);
$sql = 'UPDATE ' . MODULES_TABLE . " SET module_auth = 'acl_a_add_board' WHERE module_id = {$module_id}";
$db->sql_query($sql);
$config->set('add_user_version', $module_data['version'], false);
trigger_error(sprintf($user->lang['ADD_USER_MOD_UPDATED'], $module_data['version']));
}
示例2: array
/**
* Load the contents of the schema into the database and then alter it based on what has been input during the installation
*/
function load_schema($mode, $sub)
{
global $cache, $gallery_config, $phpbb_root_path, $phpEx, $template, $user;
include $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
$this->page_title = $user->lang['STAGE_CREATE_TABLE'];
$s_hidden_fields = '';
$dbms_data = get_dbms_infos();
$db_schema = $dbms_data['db_schema'];
$delimiter = $dbms_data['delimiter'];
// Create the tables
nv_create_table('phpbb_gallery_albums', $dbms_data);
nv_create_table('phpbb_gallery_albums_track', $dbms_data);
nv_create_table('phpbb_gallery_comments', $dbms_data);
nv_create_table('phpbb_gallery_config', $dbms_data);
nv_create_table('phpbb_gallery_contests', $dbms_data);
nv_create_table('phpbb_gallery_favorites', $dbms_data);
nv_create_table('phpbb_gallery_images', $dbms_data);
nv_create_table('phpbb_gallery_modscache', $dbms_data);
nv_create_table('phpbb_gallery_permissions', $dbms_data);
nv_create_table('phpbb_gallery_rates', $dbms_data);
nv_create_table('phpbb_gallery_reports', $dbms_data);
nv_create_table('phpbb_gallery_roles', $dbms_data);
nv_create_table('phpbb_gallery_users', $dbms_data);
nv_create_table('phpbb_gallery_watch', $dbms_data);
// Create columns
nv_add_column(SESSIONS_TABLE, 'session_album_id', array('UINT', 0));
nv_add_column(LOG_TABLE, 'album_id', array('UINT', 0));
nv_add_column(LOG_TABLE, 'image_id', array('UINT', 0));
nv_add_index(GALLERY_USERS_TABLE, 'pg_palbum_id', array('personal_album_id'));
nv_add_index(SESSIONS_TABLE, 'session_aid', array('session_album_id'));
// Set default config
set_default_config();
$auth_admin = new auth_admin();
$auth_admin->acl_add_option(array('local' => array(), 'global' => array('a_gallery_manage', 'a_gallery_albums', 'a_gallery_import', 'a_gallery_cleanup')));
$cache->destroy('acl_options');
$template->assign_vars(array('BODY' => $user->lang['STAGE_CREATE_TABLE_EXPLAIN'], 'L_SUBMIT' => $user->lang['NEXT_STEP'], 'S_HIDDEN' => '', 'U_ACTION' => append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&sub=in_progress")));
}
示例3: change_database_data
function change_database_data(&$no_updates, $version)
{
global $db, $db_tools, $errored, $error_ary, $config, $table_prefix, $phpbb_root_path, $phpEx;
switch ($version) {
case '3.0.0':
$sql = 'UPDATE ' . TOPICS_TABLE . "\n\t\t\t\tSET topic_last_view_time = topic_last_post_time\n\t\t\t\tWHERE topic_last_view_time = 0";
_sql($sql, $errored, $error_ary);
// Update smiley sizes
$smileys = array('icon_e_surprised.gif', 'icon_eek.gif', 'icon_cool.gif', 'icon_lol.gif', 'icon_mad.gif', 'icon_razz.gif', 'icon_redface.gif', 'icon_cry.gif', 'icon_evil.gif', 'icon_twisted.gif', 'icon_rolleyes.gif', 'icon_exclaim.gif', 'icon_question.gif', 'icon_idea.gif', 'icon_arrow.gif', 'icon_neutral.gif', 'icon_mrgreen.gif', 'icon_e_ugeek.gif');
foreach ($smileys as $smiley) {
if (file_exists($phpbb_root_path . 'images/smilies/' . $smiley)) {
list($width, $height) = getimagesize($phpbb_root_path . 'images/smilies/' . $smiley);
$sql = 'UPDATE ' . SMILIES_TABLE . '
SET smiley_width = ' . $width . ', smiley_height = ' . $height . "\n\t\t\t\t\t\tWHERE smiley_url = '" . $db->sql_escape($smiley) . "'";
_sql($sql, $errored, $error_ary);
}
}
$no_updates = false;
break;
// No changes from 3.0.1-RC1 to 3.0.1
// No changes from 3.0.1-RC1 to 3.0.1
case '3.0.1-RC1':
break;
// changes from 3.0.1 to 3.0.2-RC1
// changes from 3.0.1 to 3.0.2-RC1
case '3.0.1':
set_config('referer_validation', '1');
set_config('check_attachment_content', '1');
set_config('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title');
$no_updates = false;
break;
// No changes from 3.0.2-RC1 to 3.0.2-RC2
// No changes from 3.0.2-RC1 to 3.0.2-RC2
case '3.0.2-RC1':
break;
// No changes from 3.0.2-RC2 to 3.0.2
// No changes from 3.0.2-RC2 to 3.0.2
case '3.0.2-RC2':
break;
// Changes from 3.0.2 to 3.0.3-RC1
// Changes from 3.0.2 to 3.0.3-RC1
case '3.0.2':
set_config('enable_queue_trigger', '0');
set_config('queue_trigger_posts', '3');
set_config('pm_max_recipients', '0');
// Set maximum number of recipients for the registered users, bots, guests group
$sql = 'UPDATE ' . GROUPS_TABLE . ' SET group_max_recipients = 5
WHERE ' . $db->sql_in_set('group_name', array('GUESTS', 'REGISTERED', 'REGISTERED_COPPA', 'BOTS'));
_sql($sql, $errored, $error_ary);
// Not prefilling yet
set_config('dbms_version', '');
// Add new permission u_masspm_group and duplicate settings from u_masspm
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_masspm_group'])) {
$auth_admin->acl_add_option(array('global' => array('u_masspm_group')));
// Now the tricky part, filling the permission
$old_id = $auth_admin->acl_options['id']['u_masspm'];
$new_id = $auth_admin->acl_options['id']['u_masspm_group'];
$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();
}
/**
* Do not resync post counts here. An admin may do this later from the ACP
$start = 0;
$step = ($config['num_posts']) ? (max((int) ($config['num_posts'] / 5), 20000)) : 20000;
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_posts = 0';
_sql($sql, $errored, $error_ary);
do
{
$sql = 'SELECT COUNT(post_id) AS num_posts, poster_id
FROM ' . POSTS_TABLE . '
WHERE post_id BETWEEN ' . ($start + 1) . ' AND ' . ($start + $step) . '
AND post_postcount = 1 AND post_approved = 1
GROUP BY poster_id';
$result = _sql($sql, $errored, $error_ary);
if ($row = $db->sql_fetchrow($result))
{
do
{
//.........这里部分代码省略.........
示例4: change_database_data
//.........这里部分代码省略.........
$no_updates = false;
break;
// No changes from 3.0.2-RC1 to 3.0.2-RC2
case '3.0.2-RC1':
break;
// No changes from 3.0.2-RC2 to 3.0.2
case '3.0.2-RC2':
break;
// Changes from 3.0.2 to 3.0.3-RC1
case '3.0.2':
set_config('enable_queue_trigger', '0');
set_config('queue_trigger_posts', '3');
set_config('pm_max_recipients', '0');
// Set maximum number of recipients for the registered users, bots, guests group
$sql = 'UPDATE ' . GROUPS_TABLE . ' SET group_max_recipients = 5
WHERE ' . $db->sql_in_set('group_name', array('GUESTS', 'REGISTERED', 'REGISTERED_COPPA', 'BOTS'));
_sql($sql, $errored, $error_ary);
// Not prefilling yet
set_config('dbms_version', '');
// Add new permission u_masspm_group and duplicate settings from u_masspm
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_masspm_group']))
{
$auth_admin->acl_add_option(array('global' => array('u_masspm_group')));
// Now the tricky part, filling the permission
$old_id = $auth_admin->acl_options['id']['u_masspm'];
$new_id = $auth_admin->acl_options['id']['u_masspm_group'];
$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();
}
示例5: add
/**
* Permission Add
*
* Add a permission (auth) option
*
* @param string $auth_option The name of the permission (auth) option
* @param bool $global True for checking a global permission setting,
* False for a local permission setting
* @param int|false $copy_from If set, contains the id of the permission from which to copy the new one.
* @return null
*/
public function add($auth_option, $global = true, $copy_from = false)
{
if ($this->exists($auth_option, $global)) {
return;
}
// We've added permissions, so set to true to notify the user.
$this->permissions_added = true;
if (!class_exists('auth_admin')) {
include $this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext;
}
$auth_admin = new \auth_admin();
// We have to add a check to see if the !$global (if global, local, and if local, global) permission already exists. If it does, acl_add_option currently has a bug which would break the ACL system, so we are having a work-around here.
if ($this->exists($auth_option, !$global)) {
$sql_ary = array('is_global' => 1, 'is_local' => 1);
$sql = 'UPDATE ' . ACL_OPTIONS_TABLE . '
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\t\tWHERE auth_option = '" . $this->db->sql_escape($auth_option) . "'";
$this->db->sql_query($sql);
} else {
if ($global) {
$auth_admin->acl_add_option(array('global' => array($auth_option)));
} else {
$auth_admin->acl_add_option(array('local' => array($auth_option)));
}
}
// The permission has been added, now we can copy it if needed
if ($copy_from && isset($auth_admin->acl_options['id'][$copy_from])) {
$old_id = $auth_admin->acl_options['id'][$copy_from];
$new_id = $auth_admin->acl_options['id'][$auth_option];
$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 = $this->db->sql_query($sql);
$sql_ary = array();
while ($row = $this->db->sql_fetchrow($result)) {
$row['auth_option_id'] = $new_id;
$sql_ary[] = $row;
}
$this->db->sql_freeresult($result);
if (!empty($sql_ary)) {
$this->db->sql_multi_insert($table, $sql_ary);
}
}
$auth_admin->acl_clear_prefetch();
}
}
示例6: synchronise_settings
/**
* transmits new settings from the WP settings panel to phpBB
*/
public function synchronise_settings($dataToStore)
{
global $wpUnited, $cache, $user, $auth, $config, $db, $phpbb_root_path, $phpEx;
if (empty($dataToStore)) {
echo "No settings to process";
return false;
}
$fStateChanged = $this->foreground();
$adminLog = array();
$adminLog[] = __('Receiving settings from WP-United...', 'wp-united');
/**
* MySQL will not allow duplicate column names, so we can suppress errors (we still check anyway)
*/
$db->sql_return_on_error(true);
if (!array_key_exists('user_wpuint_id', $user->data)) {
$sql = 'ALTER TABLE ' . USERS_TABLE . '
ADD user_wpuint_id VARCHAR(10) NULL DEFAULT NULL';
@$db->sql_query($sql);
$adminLog[] = __('Modified USERS Table (Integration ID)', 'wp-united');
}
if (!array_key_exists('user_wpublog_id', $user->data)) {
$sql = 'ALTER TABLE ' . USERS_TABLE . '
ADD user_wpublog_id VARCHAR(10) NULL DEFAULT NULL';
@$db->sql_query($sql);
$adminLog[] = __('Modified USERS Table (Blog ID)', 'wp-united');
}
//Add an x-posting column to topics
$sql = 'SELECT * FROM ' . TOPICS_TABLE;
$result = $db->sql_query_limit($sql, 1);
$row = (array) $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!array_key_exists('topic_wpu_xpost', $row)) {
$sql = 'ALTER TABLE ' . TOPICS_TABLE . '
ADD topic_wpu_xpost VARCHAR(10) NULL DEFAULT NULL';
@$db->sql_query($sql);
// Add new columns
$sql = 'ALTER TABLE ' . POSTS_TABLE . '
ADD post_wpu_xpost_parent VARCHAR(10) NULL DEFAULT NULL,
ADD post_wpu_xpost_meta1 VARCHAR(255) NULL DEFAULT NULL,
ADD post_wpu_xpost_meta2 VARCHAR(255) NULL DEFAULT NULL';
@$db->sql_query($sql);
$adminLog[] = __('Modified TOPICS and POSTS Tables (Cross-Posting ability)', 'wp-united');
}
$db->sql_return_on_error(false);
$adminLog[] = __('Adding WP-United Permissions', 'wp-united');
// Setup $auth_admin class so we can add permission options
include_once $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
$auth_admin = new auth_admin();
// Add permissions
$auth_admin->acl_add_option(array('local' => array('f_wpu_xpost', 'f_wpu_xpost_comment'), 'global' => array('u_wpu_subscriber', 'u_wpu_contributor', 'u_wpu_author', 'm_wpu_editor', 'a_wpu_administrator')));
$adminLog[] = __('Storing the new WP-United settings', 'wp-united');
// this stores the passed-in settings object, which is a bit brittle
// TODO: ask $wpUnited->settings to store/reload itself, without making it public
$this->clear_settings();
$sql = array();
$sql[] = array('config_name' => 'wpu_location', 'config_value' => $wpUnited->get_plugin_path());
$dataIn = base64_encode(gzcompress(serialize($dataToStore)));
$currPtr = 1;
$chunkStart = 0;
while ($chunkStart < strlen($dataIn)) {
$sql[] = array('config_name' => "wpu_settings_{$currPtr}", 'config_value' => substr($dataIn, $chunkStart, 255));
$chunkStart = $chunkStart + 255;
$currPtr++;
}
$db->sql_multi_insert(CONFIG_TABLE, $sql);
$cache->destroy('config');
if ($wpUnited->get_setting('integrateLogin') && $wpUnited->get_setting('avatarsync')) {
if (!$config['allow_avatar'] || !$config['allow_avatar_remote']) {
$adminLog[] = __('Updating avatar settings', 'wp-united');
$sql = 'UPDATE ' . CONFIG_TABLE . '
SET config_value = 1
WHERE ' . $db->sql_in_set('config_name', array('allow_avatar', 'allow_avatar_remote'));
$db->sql_query($sql);
$cache->destroy('config');
}
}
// clear out the WP-United cache on settings change
$adminLog[] = __('Purging the WP-United cache', 'wp-united');
$wpuCache = WPU_Cache::getInstance();
$wpuCache->purge();
$adminLog[] = __('Completed successfully', 'wp-united');
// Save the admin log in a nice dropdown in phpBB admin log.
// Requires a bit of template hacking using JS since we don't want to have to do a mod edit for new script
// generate unique ID for details ID
$randSeed = rand(0, 99999);
$bodyContent = '<div style="display: none; border: 1px solid #cccccc; background-color: #ccccff; padding: 3px;" id="wpulogdets' . $randSeed . '">';
$bodyContent .= implode("<br />\n\n", $adminLog) . '</div>';
$ln = "*}<span class='wpulog'><script type=\"text/javascript\">// <![CDATA[\n\t\tvar d = document;\n\t\tfunction wputgl{$randSeed}() {\n\t\t\tvar l = d.getElementById('wpulogdets{$randSeed}');\n\t\t\tvar p = d.getElementById('wpulogexp{$randSeed}'); var n = p.firstChild.nodeValue;\n\t\t\tl.style.display = (n == '-') ? 'none' : 'block';\n\t\t\tp.firstChild.nodeValue = (n == '-') ? '+' : '-';\n\t\t\treturn false;\n\t\t}\n\t\tif(typeof wpual == 'undefined') {\n\t\t\tvar wpual = window.onload;\n\t\t\twindow.onload = function() {\n\t\t\t\tif (typeof wpual == 'function') wpual();\n\t\t\t\ttry {\n\t\t\t\t\tvar hs = d.getElementsByClassName('wpulog');\n\t\t\t\t\tfor(h in hs) {var p = hs[h].parentNode; p.firstChild.nodeValue = ''; p.lastChild.nodeValue = '';}\n\t\t\t\t} catch(e) {}\t \n\t\t\t};\n\t\t}\n\t\t// ]]>\n\t\t</script>";
$ln .= '<strong><a href="#" onclick="return wputgl' . $randSeed . '();" title="click to see details">' . __('Changed WP-United Settings (click for details)', 'wp-united') . '<span id="wpulogexp' . $randSeed . '">+</span></a></strong>' . $bodyContent . '</span>{*';
add_log('admin', $ln);
$cache->purge();
$this->restore_state($fStateChanged);
return true;
}
示例7: generate_sql
$delimiter = $available_dbms[$dbms]['DELIM'];
$sql_query = preg_replace('#phpbb_#i', $table_prefix, $table);
$remove_remarks($sql_query);
$sql_query = split_sql_file($sql_query, $delimiter);
foreach ($sql_query as $sql) {
$db->sql_query($sql);
}
unset($sql_query);
foreach ($config_items as $name => $value) {
set_config($name, $value);
}
foreach ($config_items_dyn as $name => $value) {
set_config($name, $value, true);
}
$acl = new auth_admin();
$acl->acl_add_option($permissions);
$error = array();
install_module('acp', 'acp_shoutbox', $error, 'ACP_CAT_DOT_MODS');
add_log('admin', 'LOG_AS_INSTALLED', VERSION);
trigger_error('MOD_INSTALLED');
function generate_sql(&$lineg, $dbms)
{
global $phpbb_root_path, $phpEx;
$dbms_type_map = array('mysql_41' => array('INT:' => 'int(%d)', 'BINT' => 'bigint(20)', 'UINT' => 'mediumint(8) UNSIGNED', 'UINT:' => 'int(%d) UNSIGNED', 'TINT:' => 'tinyint(%d)', 'USINT' => 'smallint(4) UNSIGNED', 'BOOL' => 'tinyint(1) UNSIGNED', 'VCHAR' => 'varchar(255)', 'VCHAR:' => 'varchar(%d)', 'CHAR:' => 'char(%d)', 'XSTEXT' => 'text', 'XSTEXT_UNI' => 'varchar(100)', 'STEXT' => 'text', 'STEXT_UNI' => 'varchar(255)', 'TEXT' => 'text', 'TEXT_UNI' => 'text', 'MTEXT' => 'mediumtext', 'MTEXT_UNI' => 'mediumtext', 'TIMESTAMP' => 'int(11) UNSIGNED', 'DECIMAL' => 'decimal(5,2)', 'DECIMAL:' => 'decimal(%d,2)', 'PDECIMAL' => 'decimal(6,3)', 'PDECIMAL:' => 'decimal(%d,3)', 'VCHAR_UNI' => 'varchar(255)', 'VCHAR_UNI:' => 'varchar(%d)', 'VCHAR_CI' => 'varchar(255)', 'VARBINARY' => 'varbinary(255)'), 'mysql_40' => array('INT:' => 'int(%d)', 'BINT' => 'bigint(20)', 'UINT' => 'mediumint(8) UNSIGNED', 'UINT:' => 'int(%d) UNSIGNED', 'TINT:' => 'tinyint(%d)', 'USINT' => 'smallint(4) UNSIGNED', 'BOOL' => 'tinyint(1) UNSIGNED', 'VCHAR' => 'varbinary(255)', 'VCHAR:' => 'varbinary(%d)', 'CHAR:' => 'binary(%d)', 'XSTEXT' => 'blob', 'XSTEXT_UNI' => 'blob', 'STEXT' => 'blob', 'STEXT_UNI' => 'blob', 'TEXT' => 'blob', 'TEXT_UNI' => 'blob', 'MTEXT' => 'mediumblob', 'MTEXT_UNI' => 'mediumblob', 'TIMESTAMP' => 'int(11) UNSIGNED', 'DECIMAL' => 'decimal(5,2)', 'DECIMAL:' => 'decimal(%d,2)', 'PDECIMAL' => 'decimal(6,3)', 'PDECIMAL:' => 'decimal(%d,3)', 'VCHAR_UNI' => 'blob', 'VCHAR_UNI:' => array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')), 'VCHAR_CI' => 'blob', 'VARBINARY' => 'varbinary(255)'), 'firebird' => array('INT:' => 'INTEGER', 'BINT' => 'DOUBLE PRECISION', 'UINT' => 'INTEGER', 'UINT:' => 'INTEGER', 'TINT:' => 'INTEGER', 'USINT' => 'INTEGER', 'BOOL' => 'INTEGER', 'VCHAR' => 'VARCHAR(255) CHARACTER SET NONE', 'VCHAR:' => 'VARCHAR(%d) CHARACTER SET NONE', 'CHAR:' => 'CHAR(%d) CHARACTER SET NONE', 'XSTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', 'STEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', 'TEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', 'MTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', 'XSTEXT_UNI' => 'VARCHAR(100) CHARACTER SET UTF8', 'STEXT_UNI' => 'VARCHAR(255) CHARACTER SET UTF8', 'TEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8', 'MTEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8', 'TIMESTAMP' => 'INTEGER', 'DECIMAL' => 'DOUBLE PRECISION', 'DECIMAL:' => 'DOUBLE PRECISION', 'PDECIMAL' => 'DOUBLE PRECISION', 'PDECIMAL:' => 'DOUBLE PRECISION', 'VCHAR_UNI' => 'VARCHAR(255) CHARACTER SET UTF8', 'VCHAR_UNI:' => 'VARCHAR(%d) CHARACTER SET UTF8', 'VCHAR_CI' => 'VARCHAR(255) CHARACTER SET UTF8', 'VARBINARY' => 'CHAR(255) CHARACTER SET NONE'), 'mssql' => array('INT:' => '[int]', 'BINT' => '[float]', 'UINT' => '[int]', 'UINT:' => '[int]', 'TINT:' => '[int]', 'USINT' => '[int]', 'BOOL' => '[int]', 'VCHAR' => '[varchar] (255)', 'VCHAR:' => '[varchar] (%d)', 'CHAR:' => '[char] (%d)', 'XSTEXT' => '[varchar] (1000)', 'STEXT' => '[varchar] (3000)', 'TEXT' => '[varchar] (8000)', 'MTEXT' => '[text]', 'XSTEXT_UNI' => '[varchar] (100)', 'STEXT_UNI' => '[varchar] (255)', 'TEXT_UNI' => '[varchar] (4000)', 'MTEXT_UNI' => '[text]', 'TIMESTAMP' => '[int]', 'DECIMAL' => '[float]', 'DECIMAL:' => '[float]', 'PDECIMAL' => '[float]', 'PDECIMAL:' => '[float]', 'VCHAR_UNI' => '[varchar] (255)', 'VCHAR_UNI:' => '[varchar] (%d)', 'VCHAR_CI' => '[varchar] (255)', 'VARBINARY' => '[varchar] (255)'), 'oracle' => array('INT:' => 'number(%d)', 'BINT' => 'number(20)', 'UINT' => 'number(8)', 'UINT:' => 'number(%d)', 'TINT:' => 'number(%d)', 'USINT' => 'number(4)', 'BOOL' => 'number(1)', 'VCHAR' => 'varchar2(255)', 'VCHAR:' => 'varchar2(%d)', 'CHAR:' => 'char(%d)', 'XSTEXT' => 'varchar2(1000)', 'STEXT' => 'varchar2(3000)', 'TEXT' => 'clob', 'MTEXT' => 'clob', 'XSTEXT_UNI' => 'varchar2(300)', 'STEXT_UNI' => 'varchar2(765)', 'TEXT_UNI' => 'clob', 'MTEXT_UNI' => 'clob', 'TIMESTAMP' => 'number(11)', 'DECIMAL' => 'number(5, 2)', 'DECIMAL:' => 'number(%d, 2)', 'PDECIMAL' => 'number(6, 3)', 'PDECIMAL:' => 'number(%d, 3)', 'VCHAR_UNI' => 'varchar2(765)', 'VCHAR_UNI:' => array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')), 'VCHAR_CI' => 'varchar2(255)', 'VARBINARY' => 'raw(255)'), 'sqlite' => array('INT:' => 'int(%d)', 'BINT' => 'bigint(20)', 'UINT' => 'INTEGER UNSIGNED', 'UINT:' => 'INTEGER UNSIGNED', 'TINT:' => 'tinyint(%d)', 'USINT' => 'INTEGER UNSIGNED', 'BOOL' => 'INTEGER UNSIGNED', 'VCHAR' => 'varchar(255)', 'VCHAR:' => 'varchar(%d)', 'CHAR:' => 'char(%d)', 'XSTEXT' => 'text(65535)', 'STEXT' => 'text(65535)', 'TEXT' => 'text(65535)', 'MTEXT' => 'mediumtext(16777215)', 'XSTEXT_UNI' => 'text(65535)', 'STEXT_UNI' => 'text(65535)', 'TEXT_UNI' => 'text(65535)', 'MTEXT_UNI' => 'mediumtext(16777215)', 'TIMESTAMP' => 'INTEGER UNSIGNED', 'DECIMAL' => 'decimal(5,2)', 'DECIMAL:' => 'decimal(%d,2)', 'PDECIMAL' => 'decimal(6,3)', 'PDECIMAL:' => 'decimal(%d,3)', 'VCHAR_UNI' => 'varchar(255)', 'VCHAR_UNI:' => 'varchar(%d)', 'VCHAR_CI' => 'varchar(255)', 'VARBINARY' => 'blob'), 'postgres' => array('INT:' => 'INT4', 'BINT' => 'INT8', 'UINT' => 'INT4', 'UINT:' => 'INT4', 'USINT' => 'INT2', 'BOOL' => 'INT2', 'TINT:' => 'INT2', 'VCHAR' => 'varchar(255)', 'VCHAR:' => 'varchar(%d)', 'CHAR:' => 'char(%d)', 'XSTEXT' => 'varchar(1000)', 'STEXT' => 'varchar(3000)', 'TEXT' => 'varchar(8000)', 'MTEXT' => 'TEXT', 'XSTEXT_UNI' => 'varchar(100)', 'STEXT_UNI' => 'varchar(255)', 'TEXT_UNI' => 'varchar(4000)', 'MTEXT_UNI' => 'TEXT', 'TIMESTAMP' => 'INT4', 'DECIMAL' => 'decimal(5,2)', 'DECIMAL:' => 'decimal(%d,2)', 'PDECIMAL' => 'decimal(6,3)', 'PDECIMAL:' => 'decimal(%d,3)', 'VCHAR_UNI' => 'varchar(255)', 'VCHAR_UNI:' => 'varchar(%d)', 'VCHAR_CI' => 'varchar_ci', 'VARBINARY' => 'bytea'));
// A list of types being unsigned for better reference in some db's
$unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP');
$supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite');
$schema_data = get_schema();
if ($dbms == 'mysqli' || $dbms == 'mysql4') {
$dbms = 'mysql_41';
} else {
示例8: add_permissions
/**
* simplification of auth_admin::acl_add()
*
* @param array $local_perms
* @param array $global_perms
*/
function add_permissions($local_perms = array(), $global_perms = array())
{
static $auth_admin = false;
if (!$auth_admin) {
// if it's not set, include auth_admin and create an object
if (!class_exists('auth_admin')) {
global $phpbb_root_path, $phpEx;
include $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
}
$auth_admin = new auth_admin();
}
// now let's add 'em
$auth_admin->acl_add_option(array('local' => !empty($local_perms) && is_array($local_perms) ? $local_perms : array(), 'global' => !empty($global_perms) && is_array($global_perms) ? $global_perms : array()));
}
示例9: array
/**
* Create required phpBB Garage
*/
function add_permissions($mode, $sub)
{
global $phpbb_root_path, $phpEx, $lang, $template, $data;
//Setup $auth_admin class so we can add permission options
include $phpbb_root_path . '/includes/acp/auth.' . $phpEx;
$auth_admin = new auth_admin();
//Lets Add The Required New Permissions
$phpbbgarage_permissions = array('local' => array(), 'global' => array('u_garage_browse', 'u_garage_search', 'u_garage_add_vehicle', 'u_garage_delete_vehicle', 'u_garage_add_modification', 'u_garage_delete_modification', 'u_garage_add_quartermile', 'u_garage_delete_quartermile', 'u_garage_add_lap', 'u_garage_delete_lap', 'u_garage_add_track', 'u_garage_delete_track', 'u_garage_add_dynorun', 'u_garage_delete_dynorun', 'u_garage_add_insurance', 'u_garage_delete_insurance', 'u_garage_add_service', 'u_garage_delete_service', 'u_garage_add_blog', 'u_garage_delete_blog', 'u_garage_add_business', 'u_garage_add_make_model', 'u_garage_add_product', 'u_garage_rate', 'u_garage_comment', 'u_garage_upload_image', 'u_garage_remote_image', 'u_garage_delete_image', 'u_garage_deny', 'm_garage_edit', 'm_garage_delete', 'm_garage_rating', 'm_garage_approve_vehicle', 'm_garage_approve_make', 'm_garage_approve_model', 'm_garage_approve_business', 'm_garage_approve_quartermile', 'm_garage_approve_dynorun', 'm_garage_approve_guestbook', 'm_garage_approve_lap', 'm_garage_approve_track', 'm_garage_approve_product', 'a_garage_update', 'a_garage_setting', 'a_garage_business', 'a_garage_category', 'a_garage_field', 'a_garage_model', 'a_garage_product', 'a_garage_quota', 'a_garage_tool', 'a_garage_track'));
$auth_admin->acl_add_option($phpbbgarage_permissions);
}
示例10: wpu_do_upgrade
function wpu_do_upgrade($action)
{
global $phpbbForum, $wpUnited, $debug, $db, $wpuDebug, $phpbb_root_path, $phpEx;
switch ($action) {
/**
* UPGRADING <0.9.2.0 TO 0.9.2.0
* -----------------------------
* in this version, we move the cross-posting column from POSTS_TABLE to TOPICS_TABLE
*/
case 'from <0.9.2.0':
$wpuDebug->add("Upgrading WP-United {$action}");
$fStateChanged = $phpbbForum->foreground();
$db->sql_return_on_error(true);
$sql = 'ALTER TABLE ' . TOPICS_TABLE . '
ADD topic_wpu_xpost VARCHAR(10) NULL DEFAULT NULL';
@$db->sql_query($sql);
//Now copy across data from posts column to topics column
$sql = 'SELECT post_wpu_xpost, topic_id FROM ' . POSTS_TABLE . '
WHERE post_wpu_xpost > 0';
if ($result = $db->sql_query($sql)) {
while ($row = $db->sql_fetchrow($result)) {
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_wpu_xpost = ' . (int) $row['post_wpu_xpost'] . '
WHERE topic_id = ' . (int) $row['topic_id'];
@$db->sql_query($sql);
}
}
$db->sql_freeresult($result);
// Now delete the posts column
$sql = 'ALTER TABLE ' . POSTS_TABLE . ' DROP COLUMN post_wpu_xpost';
@$db->sql_query($sql);
$db->sql_return_on_error(false);
$phpbbForum->restore_state($fStateChanged);
// no break!
// no break!
case 'from 0.9.2.0-r0':
$wpuDebug->add("Upgrading WP-United {$action}");
$fStateChanged = $phpbbForum->foreground();
$db->sql_return_on_error(true);
// Add new x-posting columns
$sql = 'ALTER TABLE ' . POSTS_TABLE . '
ADD post_wpu_xpost_parent VARCHAR(10) NULL DEFAULT NULL,
ADD post_wpu_xpost_meta1 VARCHAR(255) NULL DEFAULT NULL,
ADD post_wpu_xpost_meta2 VARCHAR(255) NULL DEFAULT NULL';
@$db->sql_query($sql);
$db->sql_return_on_error(false);
$phpbbForum->restore_state($fStateChanged);
// no break!
// no break!
case 'from 0.9.2.0-r1':
$wpuDebug->add("Upgrading WP-United {$action}");
$fStateChanged = $phpbbForum->foreground();
// Setup $auth_admin class so we can add permission options
include_once $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
$auth_admin = new auth_admin();
// Add permissions
$auth_admin->acl_add_option(array('local' => array('f_wpu_xpost', 'f_wpu_xpost_comment'), 'global' => array('u_wpu_subscriber', 'u_wpu_contributor', 'u_wpu_author', 'm_wpu_editor', 'a_wpu_administrator')));
$phpbbForum->restore_state($fStateChanged);
default:
break;
}
}
示例11: array
/**
* Add permissions groups
*/
function add_permissions($mode, $sub)
{
global $phpbb_root_path, $phpEx, $db, $errored, $error_ary;
// Reset permissions
$sql = 'UPDATE ' . USERS_TABLE . "
SET user_permissions = '',
user_perm_from = 0";
$db->sql_query($sql);
// Add new permissions u_karma_can, u_karma_view, f_karma_can and f_karma_view
// and duplicate settings from u_viewprofile
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
$auth_admin = new auth_admin();
// Add u_karma_can permission, only if it doesn not already exist
if (!isset($auth_admin->acl_options['id']['u_karma_can']))
{
$auth_admin->acl_add_option(array('global' => array('u_karma_can')));
// Now the tricky part, filling the permission
$old_id = $auth_admin->acl_options['id']['u_viewprofile'];
$new_id = $auth_admin->acl_options['id']['u_karma_can'];
$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 = $db->sql_query($sql);
$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();
}
// Add u_karma_view permission, only if it doesn not already exist
if (!isset($auth_admin->acl_options['id']['u_karma_view']))
{
$auth_admin->acl_add_option(array('global' => array('u_karma_view')));
// Now the tricky part, filling the permission
$old_id = $auth_admin->acl_options['id']['u_viewprofile'];
$new_id = $auth_admin->acl_options['id']['u_karma_view'];
$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 = $db->sql_query($sql);
$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();
}
// Add f_karma_can permission, only if it doesn not already exist
if (!isset($auth_admin->acl_options['id']['f_karma_can']))
{
$auth_admin->acl_add_option(array('local' => array('f_karma_can')));
// Now the tricky part, filling the permission
$old_id = $auth_admin->acl_options['id']['f_reply'];
$new_id = $auth_admin->acl_options['id']['f_karma_can'];
$tables = array(ACL_GROUPS_TABLE, ACL_ROLES_DATA_TABLE, ACL_USERS_TABLE);
//.........这里部分代码省略.........
示例12:
<?php
include 'sso.php';
$auth_options = ["u_mission_list", "u_mission_admin", "u_member_page", "u_member_admin", "u_front_page_admin"];
$global = true;
if (!class_exists('auth_admin')) {
global $phpbb_root_path, $phpEx;
include $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
}
$auth_admin = new auth_admin();
$auth_admin->acl_add_option(array('global' => $auth_options));
示例13: array
$user->setup('mods/garage');
//Get Mode Required For Page
$mode = request_var('mode', '');
$page_title = 'Manage Garage Permissions';
// Output the page
page_header($page_title);
$template->set_filenames(array('body' => 'message_body.html'));
//Setup $auth_admin class so we can add permission options
include $phpbb_root_path . '/includes/acp/auth.' . $phpEx;
$auth_admin = new auth_admin();
//Decide What Mode The User Is Doing
switch ($mode) {
case 'add':
//Lets Add The Required New Permissions
$phpbbgarage_permissions = array('local' => array(), 'global' => array('u_garage_browse', 'u_garage_search', 'u_garage_add_vehicle', 'u_garage_delete_vehicle', 'u_garage_add_modification', 'u_garage_delete_modification', 'u_garage_add_quartermile', 'u_garage_delete_quartermile', 'u_garage_add_lap', 'u_garage_delete_lap', 'u_garage_add_track', 'u_garage_delete_track', 'u_garage_add_dynorun', 'u_garage_delete_dynorun', 'u_garage_add_insurance', 'u_garage_delete_insurance', 'u_garage_add_service', 'u_garage_delete_service', 'u_garage_add_blog', 'u_garage_delete_blog', 'u_garage_add_business', 'u_garage_add_make_model', 'u_garage_add_product', 'u_garage_rate', 'u_garage_comment', 'u_garage_upload_image', 'u_garage_remote_image', 'u_garage_delete_image', 'u_garage_deny', 'm_garage_edit', 'm_garage_delete', 'm_garage_rating', 'm_garage_approve_vehicle', 'm_garage_approve_make', 'm_garage_approve_model', 'm_garage_approve_business', 'm_garage_approve_quartermile', 'm_garage_approve_dynorun', 'm_garage_approve_guestbook', 'm_garage_approve_lap', 'm_garage_approve_track', 'm_garage_approve_product', 'a_garage_setting', 'a_garage_business', 'a_garage_category', 'a_garage_field', 'a_garage_model', 'a_garage_product', 'a_garage_quota', 'a_garage_tool', 'a_garage_track'));
$auth_admin->acl_add_option($phpbbgarage_permissions);
//Standard Admin Role
$role = get_role_by_name('ROLE_ADMIN_STANDARD');
if ($role) {
acl_update_role($role['role_id'], array('a_garage_setting', 'a_garage_business', 'a_garage_category', 'a_garage_field', 'a_garage_model', 'a_garage_product', 'a_garage_quota', 'a_garage_tool', 'a_garage_track'));
}
//Full Admin Role
$role = get_role_by_name('ROLE_ADMIN_FULL');
if ($role) {
acl_update_role($role['role_id'], array('a_garage_setting', 'a_garage_business', 'a_garage_category', 'a_garage_field', 'a_garage_model', 'a_garage_product', 'a_garage_quota', 'a_garage_tool', 'a_garage_track'));
}
//Queue Moderator Role
$role = get_role_by_name('ROLE_MOD_QUEUE');
if ($role) {
acl_update_role($role['role_id'], array('m_garage_approve_vehicle', 'm_garage_approve_make', 'm_garage_approve_model', 'm_garage_approve_business', 'm_garage_approve_quartermile', 'm_garage_approve_dynorun', 'm_garage_approve_guestbook', 'm_garage_approve_lap', 'm_garage_approve_track', 'm_garage_approve_product'));
}
示例14: foreach
/**
* Permission Add
*
* Add a permission (auth) option
*
* @param string $auth_option The name of the permission (auth) option
* @param bool $global True for checking a global permission setting, False for a local permission setting
*
* @return result
*/
function permission_add($auth_option, $global = true)
{
// Multicall
if (is_array($auth_option)) {
foreach ($auth_option as $params) {
call_user_func_array(array($this, 'permission_add'), $params);
}
return;
}
$this->umil_start('PERMISSION_ADD', $auth_option);
if ($this->permission_exists($auth_option, $global)) {
return $this->umil_end('PERMISSION_ALREADY_EXISTS', $auth_option);
}
// We've added permissions, so set to true to notify the user.
$this->permissions_added = true;
if (!class_exists('auth_admin')) {
global $phpbb_root_path, $phpEx;
include $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
}
$auth_admin = new auth_admin();
// We have to add a check to see if the !$global (if global, local, and if local, global) permission already exists. If it does, acl_add_option currently has a bug which would break the ACL system, so we are having a work-around here.
if ($this->permission_exists($auth_option, !$global)) {
$sql_ary = array('is_global' => 1, 'is_local' => 1);
$sql = 'UPDATE ' . ACL_OPTIONS_TABLE . '
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
WHERE auth_option = \'' . $this->db->sql_escape($auth_option) . "'";
$this->db->sql_query($sql);
} else {
if ($global) {
$auth_admin->acl_add_option(array('global' => array($auth_option)));
} else {
$auth_admin->acl_add_option(array('local' => array($auth_option)));
}
}
return $this->umil_end();
}
示例15: MEDIUMINT
case 'A6':
case 'A7':
$sql = 'ALTER TABLE ' . BLOGS_TABLE . ' ADD blog_real_reply_count MEDIUMINT( 8 ) NOT NULL DEFAULT \'0\'';
$db->sql_query($sql);
case 'A8':
resync_blog('real_reply_count');
resync_blog('reply_count');
$sql_array[] = 'CREATE TABLE ' . BLOGS_SUBSCRIPTION_TABLE . ' (
sub_user_id mediumint(8) UNSIGNED DEFAULT \'0\' NOT NULL,
sub_type tinyint(1) UNSIGNED DEFAULT \'0\' NOT NULL,
blog_id mediumint(8) UNSIGNED DEFAULT \'0\' NOT NULL,
user_id mediumint(8) UNSIGNED DEFAULT \'0\' NOT NULL,
PRIMARY KEY (sub_user_id)
)';
$blog_permissions = array('local' => array(), 'global' => array('m_blogreplyapprove', 'm_blogreplyedit', 'm_blogreplylockedit', 'm_blogreplydelete', 'm_blogreplyreport'));
$auth_admin->acl_add_option($blog_permissions);
case 'A9':
set_config('user_blog_enable', 1, 0);
set_config('user_blog_custom_profile_enable', 0, 0);
set_config('user_blog_text_limit', '50', 0);
set_config('user_blog_user_text_limit', '500', 0);
set_config('user_blog_inform', '2', 0);
set_config('user_blog_always_show_blog_url', 0, 0);
case 'A10':
$sql_array[] = 'ALTER TABLE ' . BLOGS_TABLE . ' DROP blog_rating, DROP blog_num_ratings';
case 'A11':
set_config('user_blog_subscription_enabled', 1, 0);
$sql_array[] = 'ALTER TABLE ' . BLOGS_SUBSCRIPTION_TABLE . ' DROP PRIMARY KEY ,
ADD PRIMARY KEY (sub_user_id, sub_type, blog_id, user_id)';
$sql_array[] = 'ALTER TABLE ' . BLOGS_SUBSCRIPTION_TABLE . ' DROP INDEX sub_type';
case 'A12':