diff options
Diffstat (limited to 'phpBB/includes/acp/acp_bots.php')
-rw-r--r-- | phpBB/includes/acp/acp_bots.php | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index 50458718ba..d08cabb062 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -1,14 +1,22 @@ <?php -/** +/** * * @package acp * @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @copyright (c) 2005 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License * */ /** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** * @package acp */ class acp_bots @@ -51,7 +59,7 @@ class acp_bots { $sql_id = ($bot_id) ? " = $bot_id" : ' IN (' . implode(', ', $mark) . ')'; - $sql = 'UPDATE ' . BOTS_TABLE . " + $sql = 'UPDATE ' . BOTS_TABLE . " SET bot_active = 1 WHERE bot_id $sql_id"; $db->sql_query($sql); @@ -65,7 +73,7 @@ class acp_bots { $sql_id = ($bot_id) ? " = $bot_id" : ' IN (' . implode(', ', $mark) . ')'; - $sql = 'UPDATE ' . BOTS_TABLE . " + $sql = 'UPDATE ' . BOTS_TABLE . " SET bot_active = 0 WHERE bot_id $sql_id"; $db->sql_query($sql); @@ -82,8 +90,8 @@ class acp_bots // 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 . " + $sql = 'SELECT bot_name, user_id + FROM ' . BOTS_TABLE . " WHERE bot_id $sql_id"; $result = $db->sql_query($sql); @@ -97,7 +105,7 @@ class acp_bots $db->sql_transaction('begin'); - $sql = 'DELETE FROM ' . BOTS_TABLE . " + $sql = 'DELETE FROM ' . BOTS_TABLE . " WHERE bot_id $sql_id"; $db->sql_query($sql); @@ -200,9 +208,9 @@ class acp_bots // New bot? Create a new user and group entry if ($action == 'add') { - $sql = 'SELECT group_id, group_colour - FROM ' . GROUPS_TABLE . " - WHERE group_name = 'BOTS' + $sql = 'SELECT group_id, group_colour + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'BOTS' AND group_type = " . GROUP_SPECIAL; $result = $db->sql_query($sql); $group_row = $db->sql_fetchrow($result); @@ -215,22 +223,22 @@ class acp_bots $user_id = user_add(array( - 'user_type' => (int) USER_IGNORE, - 'group_id' => (int) $group_row['group_id'], - 'username' => (string) $bot_row['bot_name'], + 'user_type' => (int) USER_IGNORE, + 'group_id' => (int) $group_row['group_id'], + 'username' => (string) $bot_row['bot_name'], 'user_regdate' => time(), 'user_password' => '', 'user_colour' => (string) $group_row['group_colour'], 'user_email' => '', - 'user_lang' => (string) $bot_row['bot_lang'], + 'user_lang' => (string) $bot_row['bot_lang'], 'user_style' => (int) $bot_row['bot_style'], 'user_allow_massemail' => 0, )); $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( 'user_id' => (int) $user_id, - 'bot_name' => (string) $bot_row['bot_name'], - 'bot_active' => (int) $bot_row['bot_active'], + 'bot_name' => (string) $bot_row['bot_name'], + 'bot_active' => (int) $bot_row['bot_active'], 'bot_agent' => (string) $bot_row['bot_agent'], 'bot_ip' => (string) $bot_row['bot_ip']) ); @@ -240,8 +248,8 @@ class acp_bots } else if ($bot_id) { - $sql = 'SELECT user_id, bot_name - FROM ' . BOTS_TABLE . " + $sql = 'SELECT user_id, bot_name + FROM ' . BOTS_TABLE . " WHERE bot_id = $bot_id"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); @@ -267,8 +275,8 @@ class acp_bots $db->sql_query($sql); $sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( - 'bot_name' => (string) $bot_row['bot_name'], - 'bot_active' => (int) $bot_row['bot_active'], + 'bot_name' => (string) $bot_row['bot_name'], + 'bot_active' => (int) $bot_row['bot_active'], 'bot_agent' => (string) $bot_row['bot_agent'], 'bot_ip' => (string) $bot_row['bot_ip']) ) . " WHERE bot_id = $bot_id"; @@ -292,7 +300,7 @@ class acp_bots } else if ($bot_id) { - $sql = 'SELECT b.*, u.user_lang, u.user_style + $sql = 'SELECT b.*, u.user_lang, u.user_style FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . " u WHERE b.bot_id = $bot_id AND u.user_id = b.user_id"; @@ -358,7 +366,7 @@ class acp_bots 'S_BOT_OPTIONS' => $s_options) ); - $sql = 'SELECT b.bot_id, b.bot_name, b.bot_active, u.user_lastvisit + $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, b.bot_name ASC'; |