diff options
| author | Graham Eames <grahamje@users.sourceforge.net> | 2006-06-09 09:20:51 +0000 |
|---|---|---|
| committer | Graham Eames <grahamje@users.sourceforge.net> | 2006-06-09 09:20:51 +0000 |
| commit | 68a80524344909f5fa3ad34c79a0c866235cebab (patch) | |
| tree | 87fe602813fc72c239f4dcb7079eac780b38dba9 /phpBB/install/install_install.php | |
| parent | ef08df567522851202b09715c6b4bdef0c386403 (diff) | |
| download | forums-68a80524344909f5fa3ad34c79a0c866235cebab.tar forums-68a80524344909f5fa3ad34c79a0c866235cebab.tar.gz forums-68a80524344909f5fa3ad34c79a0c866235cebab.tar.bz2 forums-68a80524344909f5fa3ad34c79a0c866235cebab.tar.xz forums-68a80524344909f5fa3ad34c79a0c866235cebab.zip | |
- Change groups listed on index by default
- Change addition of bots on install
git-svn-id: file:///svn/phpbb/trunk@6026 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/install/install_install.php')
| -rwxr-xr-x | phpBB/install/install_install.php | 89 |
1 files changed, 80 insertions, 9 deletions
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index b2c8e08fea..ac3333f33e 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -81,6 +81,7 @@ class install_install extends module case 'final' : $this->load_schema($mode, $sub); $this->add_modules($mode, $sub); + $this->add_bots($mode, $sub); $this->email_admin($mode, $sub); break; @@ -1268,9 +1269,8 @@ class install_install extends module { $sql = 'SELECT module_id, left_id, right_id FROM ' . MODULES_TABLE . " WHERE module_langname = 'ACP_CAT_USERS' - AND module_class = 'acp' - LIMIT 1"; - $result = $db->sql_query($sql); + AND module_class = 'acp'"; + $result = $db->sql_query_limit($sql, 1); $row2 = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -1283,9 +1283,8 @@ class install_install extends module $sql = 'SELECT * FROM ' . MODULES_TABLE . " WHERE module_langname = 'ACP_MANAGE_USERS' - AND module_class = 'acp' - LIMIT 1"; - $result = $db->sql_query($sql); + AND module_class = 'acp'"; + $result = $db->sql_query_limit($sql,a); $module_data = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -1305,9 +1304,8 @@ class install_install extends module { $sql = 'SELECT module_id, left_id, right_id FROM ' . MODULES_TABLE . " WHERE module_langname = '$cat_name' - AND module_class = '$module_class' - LIMIT 1"; - $result = $db->sql_query($sql); + AND module_class = '$module_class'"; + $result = $db->sql_query_limit($sql, 1); $row2 = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -1350,6 +1348,69 @@ class install_install extends module } /** + * Add search robots to the database + */ + function add_bots($mode, $sub) + { + global $db; + + $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'"; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id', 0, $result); + $db->sql_freeresult($result); + + if (!$group_id) + { + // If we reach this point then something has gone very wrong + $this->p_master->error($lang['NO_GROUP'], __LINE__, __FILE__); + } + + foreach ($this->bot_list as $bot_name => $bot_ary) + { + $sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'user_type' => GROUP_HIDDEN, + 'group_id' => $group_id, + 'username' => $bot_name, + 'user_regdate' => time(), + 'user_password' => '', + 'user_lang' => 'en', + 'user_style' => 1, + 'user_rank' => 0, + 'user_colour' => '9E8DA7', + )); + + $result = $db->sql_query($sql); + + if (!$result) + { + // If we can't insert this user then continue to the next one to avoid inconsistant data + $this->p_master->db_error('Unable to insert bot into users table', $sql, __LINE__, __FILE__, true); + continue; + } + + $user_id = $db->sql_nextid(); + + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'group_id' => $group_id, + 'user_id' => $user_id, + 'group_leader' => 0, + 'user_pending' => 0, + )); + $result = $db->sql_query($sql); + + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'bot_active' => 1, + 'bot_name' => $bot_name, + 'user_id' => $user_id, + 'bot_agent' => $bot_ary[0], + 'bot_ip' => $bot_ary[1], + )); + + $result = $db->sql_query($sql); + } + } + + /** * Sends an email to the board administrator with their password and some useful links */ function email_admin($mode, $sub) @@ -1719,6 +1780,16 @@ class install_install extends module ); /** + * A list of the web-crawlers/bots we recognise by default + */ + var $bot_list = array( + 'Alexa' => array('ia_archiver', '66.28.250.,209.237.238.'), + 'Fastcrawler' => array('FAST MetaWeb Crawler', '66.151.181.'), + 'Googlebot' => array('Googlebot/', ''), + 'Inktomi' => array('Slurp/', '216.35.116.,66.196.'), + ); + + /** * Define the module structure so that we can populate the database without * needing to hard-code module_id values */ |
