Verzeichnisstruktur phpBB-3.0.0


Veröffentlicht
12.12.2007

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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

repair_bots.php

Zuletzt modifiziert: 09.10.2024, 12:50 - Dateigröße: 5.02 KiB


 001  <?php
 002  /**
 003  * Rebuild BOTS
 004  *
 005  * You should make a backup from your whole database. Things can and will go wrong. 
 006  * This will only work if no BOTs were added.
 007  *
 008  */
 009  die("Please read the first lines of this script for instructions on how to enable it");
 010   
 011  set_time_limit(0);
 012   
 013  define('IN_PHPBB', true);
 014  $phpbb_root_path = './../';
 015  $phpEx = substr(strrchr(__FILE__, '.'), 1);
 016  include($phpbb_root_path . 'common.'.$phpEx);
 017  include($phpbb_root_path . '/includes/functions_user.'.$phpEx);
 018   
 019   
 020  // Start session management
 021  $user->session_begin();
 022  $auth->acl($user->data);
 023  $user->setup();
 024   
 025  $bots = array(
 026      'AdsBot [Google]'            => array('AdsBot-Google', ''),
 027      'Alexa [Bot]'                => array('ia_archiver', ''),
 028      'Alta Vista [Bot]'            => array('Scooter/', ''),
 029      'Ask Jeeves [Bot]'            => array('Ask Jeeves', ''),
 030      'Baidu [Spider]'            => array('Baiduspider+(', ''),
 031      'Exabot [Bot]'                => array('Exabot/', ''),
 032      'FAST Enterprise [Crawler]'    => array('FAST Enterprise Crawler', ''),
 033      'FAST WebCrawler [Crawler]'    => array('FAST-WebCrawler/', ''),
 034      'Francis [Bot]'                => array('http://www.neomo.de/', ''),
 035      'Gigabot [Bot]'                => array('Gigabot/', ''),
 036      'Google Adsense [Bot]'        => array('Mediapartners-Google', ''),
 037      'Google Desktop'            => array('Google Desktop', ''),
 038      'Google Feedfetcher'        => array('Feedfetcher-Google', ''),
 039      'Google [Bot]'                => array('Googlebot', ''),
 040      'Heise IT-Markt [Crawler]'    => array('heise-IT-Markt-Crawler', ''),
 041      'Heritrix [Crawler]'        => array('heritrix/1.', ''),
 042      'IBM Research [Bot]'        => array('ibm.com/cs/crawler', ''),
 043      'ICCrawler - ICjobs'        => array('ICCrawler - ICjobs', ''),
 044      'ichiro [Crawler]'            => array('ichiro/2', ''),
 045      'Majestic-12 [Bot]'            => array('MJ12bot/', ''),
 046      'Metager [Bot]'                => array('MetagerBot/', ''),
 047      'MSN NewsBlogs'                => array('msnbot-NewsBlogs/', ''),
 048      'MSN [Bot]'                    => array('msnbot/', ''),
 049      'MSNbot Media'                => array('msnbot-media/', ''),
 050      'NG-Search [Bot]'            => array('NG-Search/', ''),
 051      'Nutch [Bot]'                => array('http://lucene.apache.org/nutch/', ''),
 052      'Nutch/CVS [Bot]'            => array('NutchCVS/', ''),
 053      'OmniExplorer [Bot]'        => array('OmniExplorer_Bot/', ''),
 054      'Online link [Validator]'    => array('online link validator', ''),
 055      'psbot [Picsearch]'            => array('psbot/0', ''),
 056      'Seekport [Bot]'            => array('Seekbot/', ''),
 057      'Sensis [Crawler]'            => array('Sensis Web Crawler', ''),
 058      'SEO Crawler'                => array('SEO search Crawler/', ''),
 059      'Seoma [Crawler]'            => array('Seoma [SEO Crawler]', ''),
 060      'SEOSearch [Crawler]'        => array('SEOsearch/', ''),
 061      'Snappy [Bot]'                => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''),
 062      'Steeler [Crawler]'            => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''),
 063      'Synoo [Bot]'                => array('SynooBot/', ''),
 064      'Telekom [Bot]'                => array('crawleradmin.t-info@telekom.de', ''),
 065      'TurnitinBot [Bot]'            => array('TurnitinBot/', ''),
 066      'Voyager [Bot]'                => array('voyager/1.0', ''),
 067      'W3 [Sitesearch]'            => array('W3 SiteSearch Crawler', ''),
 068      'W3C [Linkcheck]'            => array('W3C-checklink/', ''),
 069      'W3C [Validator]'            => array('W3C_*Validator', ''),
 070      'WiseNut [Bot]'                => array('http://www.WISEnutbot.com', ''),
 071      'YaCy [Bot]'                => array('yacybot', ''),
 072      'Yahoo MMCrawler [Bot]'        => array('Yahoo-MMCrawler/', ''),
 073      'Yahoo Slurp [Bot]'            => array('Yahoo! DE Slurp', ''),
 074      'Yahoo [Bot]'                => array('Yahoo! Slurp', ''),
 075      'YahooSeeker [Bot]'            => array('YahooSeeker/', ''),
 076  );
 077      
 078  $bot_ids = array();
 079  user_get_id_name($bot_ids, array_keys($bots), USER_IGNORE);
 080  foreach($bot_ids as $bot)
 081  {
 082      user_delete('remove', $bot);
 083  }
 084  // Done
 085  add_bots($bots);
 086  echo 'done';
 087   
 088   
 089  /**
 090  * Add the search bots into the database
 091  * This code should be used in execute_last if the source database did not have bots
 092  * If you are converting bots this function should not be called
 093  * @todo We might want to look at sharing the bot list between the install code and this code for consistency
 094  */
 095  function add_bots($bots)
 096  {
 097      global $db, $config;
 098   
 099      $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
 100      $result = $db->sql_query($sql);
 101      $group_id = (int) $db->sql_fetchfield('group_id', false, $result);
 102      $db->sql_freeresult($result);
 103      $db->sql_query('TRUNCATE TABLE ' . BOTS_TABLE);
 104   
 105      if (!$group_id)
 106      {
 107          add_default_groups();
 108   
 109          $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
 110          $result = $db->sql_query($sql);
 111          $group_id = (int) $db->sql_fetchfield('group_id', false, $result);
 112          $db->sql_freeresult($result);
 113   
 114      }
 115   
 116   
 117   
 118   
 119      foreach ($bots as $bot_name => $bot_ary)
 120      {
 121          $user_row = array(
 122              'user_type'                => USER_IGNORE,
 123              'group_id'                => $group_id,
 124              'username'                => $bot_name,
 125              'user_regdate'            => time(),
 126              'user_password'            => '',
 127              'user_colour'            => '9E8DA7',
 128              'user_email'            => '',
 129              'user_lang'                => $config['default_lang'],
 130              'user_style'            => 1,
 131              'user_timezone'            => 0,
 132              'user_allow_massemail'    => 0,
 133          );
 134   
 135          $user_id = user_add($user_row);
 136   
 137          if ($user_id)
 138          {
 139              $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
 140                  'bot_active'    => 1,
 141                  'bot_name'        => $bot_name,
 142                  'user_id'        => $user_id,
 143                  'bot_agent'        => $bot_ary[0],
 144                  'bot_ip'        => $bot_ary[1])
 145              );
 146              $db->sql_query($sql);
 147          }
 148      }
 149  }
 150   
 151  ?>