mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 14:30:32 +02:00
just preparing...
git-svn-id: file:///svn/phpbb/trunk@5468 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -2059,175 +2059,6 @@ function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $limi
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if (class_exists('auth'))
|
||||
{
|
||||
class auth_admin extends auth
|
||||
{
|
||||
// Set a user or group ACL record
|
||||
function acl_set($ug_type, &$forum_id, &$ug_id, &$auth)
|
||||
{
|
||||
global $db;
|
||||
|
||||
// One or more forums
|
||||
if (!is_array($forum_id))
|
||||
{
|
||||
$forum_id = array($forum_id);
|
||||
}
|
||||
|
||||
// Set any flags as required
|
||||
foreach ($auth as $auth_option => $setting)
|
||||
{
|
||||
$flag = substr($auth_option, 0, strpos($auth_option, '_') + 1);
|
||||
if (empty($auth[$flag]))
|
||||
{
|
||||
$auth[$flag] = $setting;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT auth_option_id, auth_option
|
||||
FROM ' . ACL_OPTIONS_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$option_ids[$row['auth_option']] = $row['auth_option_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql_forum = 'AND a.forum_id IN (' . implode(', ', array_map('intval', $forum_id)) . ')';
|
||||
|
||||
$sql = ($ug_type == 'user') ? 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting FROM ' . ACL_USERS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $sql_forum AND a.user_id = $ug_id" : 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting FROM ' . ACL_GROUPS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $sql_forum AND a.group_id = $ug_id";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$cur_auth = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$cur_auth[$row['forum_id']][$row['auth_option_id']] = $row['auth_setting'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$table = ($ug_type == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE;
|
||||
$id_field = $ug_type . '_id';
|
||||
|
||||
$sql_ary = array();
|
||||
foreach ($forum_id as $forum)
|
||||
{
|
||||
foreach ($auth as $auth_option => $setting)
|
||||
{
|
||||
$auth_option_id = $option_ids[$auth_option];
|
||||
|
||||
switch ($setting)
|
||||
{
|
||||
case ACL_UNSET:
|
||||
if (isset($cur_auth[$forum][$auth_option_id]))
|
||||
{
|
||||
$sql_ary['delete'][] = "DELETE FROM $table
|
||||
WHERE forum_id = $forum
|
||||
AND auth_option_id = $auth_option_id
|
||||
AND $id_field = $ug_id";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!isset($cur_auth[$forum][$auth_option_id]))
|
||||
{
|
||||
$sql_ary['insert'][] = "$ug_id, $forum, $auth_option_id, $setting";
|
||||
}
|
||||
else if ($cur_auth[$forum][$auth_option_id] != $setting)
|
||||
{
|
||||
$sql_ary['update'][] = "UPDATE " . $table . "
|
||||
SET auth_setting = $setting
|
||||
WHERE $id_field = $ug_id
|
||||
AND forum_id = $forum
|
||||
AND auth_option_id = $auth_option_id";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($cur_auth);
|
||||
|
||||
$sql = '';
|
||||
foreach ($sql_ary as $sql_type => $sql_subary)
|
||||
{
|
||||
switch ($sql_type)
|
||||
{
|
||||
case 'insert':
|
||||
switch (SQL_LAYER)
|
||||
{
|
||||
case 'mysql':
|
||||
$sql = 'VALUES ' . implode(', ', preg_replace('#^(.*?)$#', '(\1)', $sql_subary));
|
||||
break;
|
||||
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
case 'mssql':
|
||||
case 'mssql_odbc':
|
||||
case 'sqlite':
|
||||
$sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary));
|
||||
break;
|
||||
|
||||
default:
|
||||
foreach ($sql_subary as $sql)
|
||||
{
|
||||
$sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) VALUES ($sql)";
|
||||
$db->sql_query($sql);
|
||||
$sql = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($sql != '')
|
||||
{
|
||||
$sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) $sql";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
case 'delete':
|
||||
foreach ($sql_subary as $sql)
|
||||
{
|
||||
$result = $db->sql_query($sql);
|
||||
$sql = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
unset($sql_ary[$sql_type]);
|
||||
}
|
||||
unset($sql_ary);
|
||||
|
||||
$this->acl_clear_prefetch();
|
||||
}
|
||||
|
||||
function acl_delete($mode, &$forum_id, &$ug_id, $auth_ids = false)
|
||||
{
|
||||
global $db;
|
||||
|
||||
// One or more forums
|
||||
if (!is_array($forum_id))
|
||||
{
|
||||
$forum_id = array($forum_id);
|
||||
}
|
||||
|
||||
$auth_sql = ($auth_ids) ? ' AND auth_option_id IN (' . implode(', ', array_map('intval', $auth_ids)) . ')' : '';
|
||||
|
||||
$table = ($mode == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE;
|
||||
$id_field = $mode . '_id';
|
||||
|
||||
foreach ($forum_id as $forum)
|
||||
{
|
||||
$sql = "DELETE FROM $table
|
||||
WHERE $id_field = $ug_id
|
||||
AND forum_id = $forum
|
||||
$auth_sql";
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$this->acl_clear_prefetch();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Update Post Informations (First/Last Post in topic/forum)
|
||||
* Should be used instead of sync() if only the last post informations are out of sync... faster
|
||||
|
Reference in New Issue
Block a user