mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-04 22:58:10 +02:00
fixed bug #1370, #1447 (moderator status update, extensively tested, should work :D), #1309, poll delete checkbox
fixed (now it is only displayed if there is a poll to delete) git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3580 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
4367a190c7
commit
9c3d84f4e1
@ -171,6 +171,56 @@ else if ( isset($HTTP_POST_VARS['group_update']) )
|
||||
//
|
||||
if ( isset($HTTP_POST_VARS['group_delete']) )
|
||||
{
|
||||
//
|
||||
// Reset User Moderator Level
|
||||
//
|
||||
|
||||
// Is Group moderating a forum ?
|
||||
$sql = "SELECT auth_mod FROM " . AUTH_ACCESS_TABLE . "
|
||||
WHERE group_id = " . $group_id;
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not select auth_access', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
$row = $db->sql_fetchrow($result);
|
||||
if (intval($row['auth_mod']) == 1)
|
||||
{
|
||||
// Yes, get the assigned users and update their Permission if they are no longer moderator of one of the forums
|
||||
$sql = "SELECT user_id FROM " . USER_GROUP_TABLE . "
|
||||
WHERE group_id = " . $group_id;
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not select user_group', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
$rows = $db->sql_fetchrowset($result);
|
||||
for ($i = 0; $i < count($rows); $i++)
|
||||
{
|
||||
$sql = "SELECT g.group_id FROM " . AUTH_ACCESS_TABLE . " a, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
|
||||
WHERE (a.auth_mod = 1) AND (g.group_id = a.group_id) AND (a.group_id = ug.group_id) AND (g.group_id = ug.group_id)
|
||||
AND (ug.user_id = " . intval($rows[$i]['user_id']) . ") AND (ug.group_id <> " . $group_id . ")";
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not obtain moderator permissions', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
|
||||
if ($db->sql_numrows($result) == 0)
|
||||
{
|
||||
$sql = "UPDATE " . USERS_TABLE . " SET user_level = " . USER . "
|
||||
WHERE user_level = " . MOD . " AND user_id = " . intval($rows[$i]['user_id']);
|
||||
|
||||
if ( !$db->sql_query($sql) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not update moderator permissions', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Delete Group
|
||||
//
|
||||
$sql = "DELETE FROM " . GROUPS_TABLE . "
|
||||
WHERE group_id = " . $group_id;
|
||||
if ( !$db->sql_query($sql) )
|
||||
|
@ -132,6 +132,7 @@ elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' )
|
||||
"L_ADMIN_INTRO" => $lang['Admin_intro'],
|
||||
"L_FORUM_STATS" => $lang['Forum_stats'],
|
||||
"L_WHO_IS_ONLINE" => $lang['Who_is_Online'],
|
||||
"L_USERNAME" => $lang['Username'],
|
||||
"L_LOCATION" => $lang['Location'],
|
||||
"L_LAST_UPDATE" => $lang['Last_updated'],
|
||||
"L_IP_ADDRESS" => $lang['IP_Address'],
|
||||
|
@ -251,7 +251,8 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
|
||||
if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post']))
|
||||
{
|
||||
$topic_vote = (!empty($poll_title) && count($poll_options) >= 2) ? 1 : 0;
|
||||
$sql = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type, topic_vote = $topic_vote WHERE topic_id = $topic_id";
|
||||
|
||||
$sql = ($mode != "editpost") ? "INSERT INTO " . TOPICS_TABLE . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_vote)" : "UPDATE " . TOPICS_TABLE . " SET topic_title = '$post_subject', topic_type = $topic_type " . (($post_data['edit_vote'] || !empty($poll_title)) ? ", topic_vote = " . $topic_vote : "") . " WHERE topic_id = $topic_id";
|
||||
if (!$db->sql_query($sql))
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
|
||||
|
@ -1058,7 +1058,7 @@ if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['edit_poll']) )
|
||||
'POLL_LENGTH' => $poll_length)
|
||||
);
|
||||
|
||||
if( $mode == 'editpost' && $post_data['edit_poll'] )
|
||||
if( $mode == 'editpost' && $post_data['edit_poll'] && $post_data['has_poll'])
|
||||
{
|
||||
$template->assign_block_vars('switch_poll_delete_toggle', array());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user