diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-12-06 22:13:11 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-12-06 22:13:11 +0000 |
commit | b508c57b8046f7372b37e45fd993471303fcfc58 (patch) | |
tree | 20e1fe5cccadb28c594334c1585b516621180955 /phpBB/includes/acp/acp_bots.php | |
parent | a9b2e99974398b6e88dc5a1417c0a711ec3a437c (diff) | |
download | forums-b508c57b8046f7372b37e45fd993471303fcfc58.tar forums-b508c57b8046f7372b37e45fd993471303fcfc58.tar.gz forums-b508c57b8046f7372b37e45fd993471303fcfc58.tar.bz2 forums-b508c57b8046f7372b37e45fd993471303fcfc58.tar.xz forums-b508c57b8046f7372b37e45fd993471303fcfc58.zip |
minor bugfixing
git-svn-id: file:///svn/phpbb/trunk@6719 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/acp/acp_bots.php')
-rw-r--r-- | phpBB/includes/acp/acp_bots.php | 70 |
1 files changed, 41 insertions, 29 deletions
diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index 2dbcc463e9..0b1cdb122f 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -70,42 +70,54 @@ class acp_bots case 'delete': if ($bot_id || sizeof($mark)) { - // We need to delete the relevant user, usergroup and bot entries ... - $sql_id = ($bot_id) ? " = $bot_id" : ' IN (' . implode(', ', $mark) . ')'; - - $sql = 'SELECT bot_name, user_id - FROM ' . BOTS_TABLE . " - WHERE bot_id $sql_id"; - $result = $db->sql_query($sql); - - $user_id_ary = $bot_name_ary = array(); - while ($row = $db->sql_fetchrow($result)) + if (confirm_box(true)) { - $user_id_ary[] = (int) $row['user_id']; - $bot_name_ary[] = $row['bot_name']; - } - $db->sql_freeresult($result); + // We need to delete the relevant user, usergroup and bot entries ... + $sql_id = ($bot_id) ? " = $bot_id" : ' IN (' . implode(', ', $mark) . ')'; - $db->sql_transaction('begin'); + $sql = 'SELECT bot_name, user_id + FROM ' . BOTS_TABLE . " + WHERE bot_id $sql_id"; + $result = $db->sql_query($sql); - $sql = 'DELETE FROM ' . BOTS_TABLE . " - WHERE bot_id $sql_id"; - $db->sql_query($sql); + $user_id_ary = $bot_name_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_id_ary[] = (int) $row['user_id']; + $bot_name_ary[] = $row['bot_name']; + } + $db->sql_freeresult($result); - $_tables = array(USERS_TABLE, USER_GROUP_TABLE); - foreach ($_tables as $table) - { - $sql = "DELETE FROM $table - WHERE " . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_transaction('begin'); + + $sql = 'DELETE FROM ' . BOTS_TABLE . " + WHERE bot_id $sql_id"; $db->sql_query($sql); - } - $db->sql_transaction('commit'); + $_tables = array(USERS_TABLE, USER_GROUP_TABLE); + foreach ($_tables as $table) + { + $sql = "DELETE FROM $table + WHERE " . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); - $cache->destroy('bots'); + $cache->destroy('bots'); - add_log('admin', 'LOG_BOT_DELETE', implode(', ', $bot_name_ary)); - trigger_error($user->lang['BOT_DELETED'] . adm_back_link($this->u_action)); + add_log('admin', 'LOG_BOT_DELETE', implode(', ', $bot_name_ary)); + trigger_error($user->lang['BOT_DELETED'] . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'mark' => $mark, + 'id' => $bot_id, + 'mode' => $mode, + 'action' => $action)) + ); + } } break; @@ -302,7 +314,7 @@ class acp_bots $sql = 'SELECT b.bot_id, b.bot_name, b.bot_active, u.user_lastvisit FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . ' u WHERE u.user_id = b.user_id - ORDER BY u.user_lastvisit DESC'; + ORDER BY u.user_lastvisit DESC, b.bot_name ASC'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) |