Allow more versions
[infodrom.org/www.zeitungsliste.de] / lib / core.inc
index 0b157b9..0d709de 100644 (file)
@@ -141,7 +141,67 @@ function is_spider()
       strpos($_SERVER['HTTP_USER_AGENT'], 'holmes/3.12') !== false ||
       strpos($_SERVER['HTTP_USER_AGENT'], 'NoteworthyBot/0.1') !== false ||
       strpos($_SERVER['HTTP_USER_AGENT'], 'Eurosoft-Bot') !== false ||
-      strpos($_SERVER['HTTP_USER_AGENT'], 'msnbot') !== false) {
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Eurobot/1') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Yandex') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'msnbot') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Twiceler-0.9') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'ScoutJet') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'penthesilea/0.3') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'VisBot/2.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Netluchs/Nutch-1.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Yanga WorldSearch Bot') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Semager') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'DotBot') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Baiduspider') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'MJ12bot/') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Yahoo-MMCrawler') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Charlotte/1.1') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Gaisbot/3.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'psbot/0.1') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Ask Jeeves/Teoma') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'SapphireWebCrawler/Nutch') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'kalooga/KaloogaBot') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'SimilarPages/Nutch-1.0-dev') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Cogentbot/1.') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'CatchBot/1.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'GingerCrawler/1.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'yacybot') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'www.yacy.net') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Nutch-1.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Tagoobot/3.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'SapphireWebCrawler/1.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'BotOnParade') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'SurveyBot/2.3') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'XmarksFetch/1.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'spbot/2.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'TinEye/1.1') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'TurnitinBot/2.1') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'CligooRobot/1.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'libwww-perl') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Wget') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Python-urllib') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'CamontSpider/1.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'TwengaBot-Discover') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Hailoobot/1.2') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'bingbot/2.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Exabot/3.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'spbot/2.1') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Search17Bot/1') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Linguee Bot') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'findlinks/2') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'SiteBot/0.1') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Purebot/1.1') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Ezooms/1.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'discobot/1.1') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'AhrefsBot/1.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'suggybot v0.01a') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'DomainCrawler/2.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Plukkie/1.4') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], '/Nutch-') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'aiHitBot/1.0') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'AhrefsBot/') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Crawler') !== false ||
+      strpos($_SERVER['HTTP_USER_AGENT'], 'Acoon') !== false ||
       strpos($_SERVER['HTTP_USER_AGENT'], 'Cityreview Robot') !== false) {
     if (isset($_SESSION['uid']))
       $_SESSION['robot'] = true;
@@ -153,6 +213,17 @@ function is_spider()
   return false;
 }
 
+function is_admin()
+{
+  global $_SESSION;
+
+  if (!array_key_exists('nickname', $_SESSION))
+    return false;
+
+  error_log( $_SESSION['nickname'] === 'Joey');
+  return $_SESSION['nickname'] === 'Joey';
+}
+
 function format_info_bookmarks()
 {
   global $_SESSION;
@@ -169,11 +240,11 @@ function format_info_bookmarks()
 
   $sth = db_query($query);
 
-  if ($sth === false || pg_NumRows ($sth) == 0)
+  if ($sth === false || pg_num_rows ($sth) == 0)
     return false;
 
   $ret = '<p><ul>';
-  for ($n=0; $n < pg_NumRows ($sth); $n++) {
+  for ($n=0; $n < pg_num_rows ($sth); $n++) {
     $row = pg_fetch_array ($sth, $n);
     $ret .= sprintf('<li><a href="%szeitung/%d.html">%s</a></li>',
                    $cfg['basepath'], $row['zeitung'], $row['name']);
@@ -183,4 +254,4 @@ function format_info_bookmarks()
   return $ret;
 }
 
-?>
\ No newline at end of file
+?>