Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
add_bots.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 namespace phpbb\install\module\install_data\task;
015
016 use phpbb\install\exception\resource_limit_reached_exception;
017
018 class add_bots extends \phpbb\install\task_base
019 {
020 /**
021 * A list of the web-crawlers/bots we recognise by default
022 *
023 * Candidates but not included:
024 * 'Accoona [Bot]' 'Accoona-AI-Agent/'
025 * 'ASPseek [Crawler]' 'ASPseek/'
026 * 'Boitho [Crawler]' 'boitho.com-dc/'
027 * 'Bunnybot [Bot]' 'powered by www.buncat.de'
028 * 'Cosmix [Bot]' 'cfetch/'
029 * 'Crawler Search [Crawler]' '.Crawler-Search.de'
030 * 'Findexa [Crawler]' 'Findexa Crawler ('
031 * 'GBSpider [Spider]' 'GBSpider v'
032 * 'genie [Bot]' 'genieBot ('
033 * 'Hogsearch [Bot]' 'oegp v. 1.3.0'
034 * 'Insuranco [Bot]' 'InsurancoBot'
035 * 'IRLbot [Bot]' 'http://irl.cs.tamu.edu/crawler'
036 * 'ISC Systems [Bot]' 'ISC Systems iRc Search'
037 * 'Jyxobot [Bot]' 'Jyxobot/'
038 * 'Kraehe [Metasuche]' '-DIE-KRAEHE- META-SEARCH-ENGINE/'
039 * 'LinkWalker' 'LinkWalker'
040 * 'MMSBot [Bot]' 'http://www.mmsweb.at/bot.html'
041 * 'Naver [Bot]' 'nhnbot@naver.com)'
042 * 'NetResearchServer' 'NetResearchServer/'
043 * 'Nimble [Crawler]' 'NimbleCrawler'
044 * 'Ocelli [Bot]' 'Ocelli/'
045 * 'Onsearch [Bot]' 'onCHECK-Robot'
046 * 'Orange [Spider]' 'OrangeSpider'
047 * 'Sproose [Bot]' 'http://www.sproose.com/bot'
048 * 'Susie [Sync]' '!Susie (http://www.sync2it.com/susie)'
049 * 'Tbot [Bot]' 'Tbot/'
050 * 'Thumbshots [Capture]' 'thumbshots-de-Bot'
051 * 'Vagabondo [Crawler]' 'http://webagent.wise-guys.nl/'
052 * 'Walhello [Bot]' 'appie 1.1 (www.walhello.com)'
053 * 'WissenOnline [Bot]' 'WissenOnline-Bot'
054 * 'WWWeasel [Bot]' 'WWWeasel Robot v'
055 * 'Xaldon [Spider]' 'Xaldon WebSpider'
056 *
057 * @var array
058 */
059 protected $bot_list = array(
060 'AdsBot [Google]' => array('AdsBot-Google', ''),
061 'Ahrefs [Bot]' => array('AhrefsBot/', ''),
062 'Alexa [Bot]' => array('ia_archiver', ''),
063 'Alta Vista [Bot]' => array('Scooter/', ''),
064 'Amazon [Bot]' => array('Amazonbot/', ''),
065 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''),
066 'Baidu [Spider]' => array('Baiduspider', ''),
067 'Bing [Bot]' => array('bingbot/', ''),
068 'DuckDuckGo [Bot]' => array('DuckDuckBot/', ''),
069 'Exabot [Bot]' => array('Exabot/', ''),
070 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''),
071 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''),
072 'Francis [Bot]' => array('http://www.neomo.de/', ''),
073 'Gigabot [Bot]' => array('Gigabot/', ''),
074 'Google Adsense [Bot]' => array('Mediapartners-Google', ''),
075 'Google Desktop' => array('Google Desktop', ''),
076 'Google Feedfetcher' => array('Feedfetcher-Google', ''),
077 'Google [Bot]' => array('Googlebot', ''),
078 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''),
079 'Heritrix [Crawler]' => array('heritrix/1.', ''),
080 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''),
081 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''),
082 'ichiro [Crawler]' => array('ichiro/', ''),
083 'Majestic-12 [Bot]' => array('MJ12bot/', ''),
084 'Metager [Bot]' => array('MetagerBot/', ''),
085 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''),
086 'MSN [Bot]' => array('msnbot/', ''),
087 'MSNbot Media' => array('msnbot-media/', ''),
088 'NG-Search [Bot]' => array('NG-Search/', ''),
089 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''),
090 'Nutch/CVS [Bot]' => array('NutchCVS/', ''),
091 'OmniExplorer [Bot]' => array('OmniExplorer_Bot/', ''),
092 'Online link [Validator]' => array('online link validator', ''),
093 'psbot [Picsearch]' => array('psbot/0', ''),
094 'Seekport [Bot]' => array('Seekbot/', ''),
095 'Semrush [Bot]' => array('SemrushBot/', ''),
096 'Sensis [Crawler]' => array('Sensis Web Crawler', ''),
097 'SEO Crawler' => array('SEO search Crawler/', ''),
098 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''),
099 'SEOSearch [Crawler]' => array('SEOsearch/', ''),
100 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''),
101 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''),
102 'Synoo [Bot]' => array('SynooBot/', ''),
103 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''),
104 'TurnitinBot [Bot]' => array('TurnitinBot/', ''),
105 'Voyager [Bot]' => array('voyager/', ''),
106 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''),
107 'W3C [Linkcheck]' => array('W3C-checklink/', ''),
108 'W3C [Validator]' => array('W3C_*Validator', ''),
109 'WiseNut [Bot]' => array('http://www.WISEnutbot.com', ''),
110 'YaCy [Bot]' => array('yacybot', ''),
111 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''),
112 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''),
113 'Yahoo [Bot]' => array('Yahoo! Slurp', ''),
114 'YahooSeeker [Bot]' => array('YahooSeeker/', ''),
115 );
116
117 /**
118 * @var \phpbb\db\driver\driver_interface
119 */
120 protected $db;
121
122 /**
123 * @var \phpbb\install\helper\config
124 */
125 protected $install_config;
126
127 /**
128 * @var \phpbb\install\helper\iohandler\iohandler_interface
129 */
130 protected $io_handler;
131
132 /**
133 * @var \phpbb\language\language
134 */
135 protected $language;
136
137 /**
138 * @var string
139 */
140 protected $phpbb_root_path;
141
142 /**
143 * @var string
144 */
145 protected $php_ext;
146
147 /**
148 * Constructor
149 *
150 * @param \phpbb\install\helper\config $install_config Installer's config
151 * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Input-output handler for the installer
152 * @param \phpbb\install\helper\container_factory $container Installer's DI container
153 * @param \phpbb\language\language $language Language provider
154 * @param string $phpbb_root_path Relative path to phpBB root
155 * @param string $php_ext PHP extension
156 */
157 public function __construct(\phpbb\install\helper\config $install_config,
158 \phpbb\install\helper\iohandler\iohandler_interface $iohandler,
159 \phpbb\install\helper\container_factory $container,
160 \phpbb\language\language $language,
161 $phpbb_root_path,
162 $php_ext)
163 {
164 parent::__construct(true);
165
166 $this->db = $container->get('dbal.conn');
167 $this->install_config = $install_config;
168 $this->io_handler = $iohandler;
169 $this->language = $language;
170 $this->phpbb_root_path = $phpbb_root_path;
171 $this->php_ext = $php_ext;
172 }
173
174 /**
175 * {@inheritdoc}
176 */
177 public function run()
178 {
179 $this->db->sql_return_on_error(true);
180
181 $sql = 'SELECT group_id
182 FROM ' . GROUPS_TABLE . "
183 WHERE group_name = 'BOTS'";
184 $result = $this->db->sql_query($sql);
185 $group_id = (int) $this->db->sql_fetchfield('group_id');
186 $this->db->sql_freeresult($result);
187
188 if (!$group_id)
189 {
190 // If we reach this point then something has gone very wrong
191 $this->io_handler->add_error_message('NO_GROUP');
192 }
193
194 $i = $this->install_config->get('add_bot_index', 0);
195 $bot_list = array_slice($this->bot_list, $i);
196
197 foreach ($bot_list as $bot_name => $bot_ary)
198 {
199 $user_row = array(
200 'user_type' => USER_IGNORE,
201 'group_id' => $group_id,
202 'username' => $bot_name,
203 'user_regdate' => time(),
204 'user_password' => '',
205 'user_colour' => '9E8DA7',
206 'user_email' => '',
207 'user_lang' => $this->install_config->get('default_lang'),
208 'user_style' => 1,
209 'user_timezone' => 'UTC',
210 'user_dateformat' => $this->language->lang('default_dateformat'),
211 'user_allow_massemail' => 0,
212 'user_allow_pm' => 0,
213 );
214
215 if (!function_exists('user_add'))
216 {
217 include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
218 }
219
220 $user_id = user_add($user_row);
221
222 if (!$user_id)
223 {
224 // If we can't insert this user then continue to the next one to avoid inconsistent data
225 $this->io_handler->add_error_message('CONV_ERROR_INSERT_BOT');
226
227 $i++;
228 continue;
229 }
230
231 $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', array(
232 'bot_active' => 1,
233 'bot_name' => (string) $bot_name,
234 'user_id' => (int) $user_id,
235 'bot_agent' => (string) $bot_ary[0],
236 'bot_ip' => (string) $bot_ary[1],
237 ));
238
239 $this->db->sql_query($sql);
240
241 $i++;
242
243 // Stop execution if resource limit is reached
244 if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0)
245 {
246 break;
247 }
248 }
249
250 $this->install_config->set('add_bot_index', $i);
251
252 if ($i < count($this->bot_list))
253 {
254 throw new resource_limit_reached_exception();
255 }
256 }
257
258 /**
259 * {@inheritdoc}
260 */
261 static public function get_step_count()
262 {
263 return 1;
264 }
265
266 /**
267 * {@inheritdoc}
268 */
269 public function get_task_lang_name()
270 {
271 return 'TASK_ADD_BOTS';
272 }
273 }
274