Просмотр файла sitemap.php

Размер файла: 3.96Kb
<?php
//  ==========================================================================
//  phpBB Google Sitemap Generator v1.0.0
//  http://www.gotaxe.com/phpbb-sitemap.php
//  ==========================================================================
//  Script created by John Brookes
//  Copyright John Brookes 2005
//  http://www.gotaxe.com
//  ==========================================================================
// Some configuration options!

define('FORUM_DOMAIN_ROOT', 'http://apwa.ru/'); // URL со слешем!

define('FORUM_URL_PREFIX', 'forum'); // Что будет перед ID форума?
define('FORUM_URL_SUFFIX', '.xhtml'); // Что будет после ID форума?
define('THREAD_URL_PREFIX', 'topic'); // Что будет перед ID темы?
define('THREAD_URL_SUFFIX', '.xhtml'); // Что будет после ID темы?

// --------------------------------------------------
// You don't need to edit anything below this line!!!
// --------------------------------------------------

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

if ($_GET['fid']) { $fid = $_GET['fid']; }

// Sitemap File    <sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">
// URL Index File  <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">';
if (isset($fid)) {
  echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
  if ($fid == '65535') 
  {
    // Let's first send out the header & homepage
    echo '  <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">'."\n";
    echo '    <url>
      <loc>'.FORUM_DOMAIN_ROOT.'</loc>
      <changefreq>daily</changefreq>
    </url>';
    // Let's send out a URL list of forums
    $sql = 'SELECT forum_id FROM FOR_forums WHERE auth_view = "0" and auth_read = "0"';
    $result = mysql_query($sql);
    while ($data = mysql_fetch_assoc($result)) 
    {
      echo '    <url>
      <loc>'.FORUM_DOMAIN_ROOT.FORUM_URL_PREFIX.$data['forum_id'].FORUM_URL_SUFFIX.'</loc>
      <changefreq>daily</changefreq>
      </url>';
    }
    echo '  </urlset>';
  } 
  else 
  {
    // Let's check it's not a restricted forum
    $sql = 'SELECT forum_id FROM FOR_forums WHERE auth_view = "0" and auth_read = "0" and forum_id = "'.$fid.'"';
    $result = mysql_query($sql);
    $data = mysql_fetch_assoc($result);
    if ($data['forum_id'] == $fid) 
    {
      echo '  <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">'."\n";
      $sql = 'SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time FROM FOR_topics t, FOR_users u, FOR_posts p, FOR_posts p2, FOR_users u2 WHERE t.forum_id = '.$fid.' AND t.topic_poster = u.user_id AND p.post_id = t.topic_first_post_id AND p2.post_id = t.topic_last_post_id AND u2.user_id = p2.poster_id ORDER BY t.topic_type DESC, t.topic_last_post_id DESC';
      $result = mysql_query($sql);
      while ($data = mysql_fetch_assoc($result)) 
      {
        echo '    <url>
      <loc>'.FORUM_DOMAIN_ROOT.THREAD_URL_PREFIX.$data['topic_id'].THREAD_URL_SUFFIX.'</loc>
      <lastmod>'.date('Y-m-d', $data['post_time']),'</lastmod>
    </url>';
        
      }
     echo '  </urlset>';

    }
  }
} 
else 
{
  echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
  echo '  <sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">'."\n";
    // Let's create a link to the main forum index sitemap
  echo '    <sitemap>
      <loc>'.FORUM_DOMAIN_ROOT.'forum-65535.xml</loc>
      <changefreq>monthly</changefreq>
   </sitemap>';
    // Let's do a loop here and list all the forums!
    $sql = 'SELECT forum_id FROM FOR_forums WHERE auth_view = "0" and auth_read = "0"';
    $result = mysql_query($sql);
    while ($data = mysql_fetch_assoc($result)) {
      echo '    <sitemap>
      <loc>'.FORUM_DOMAIN_ROOT.'forum-'.$data['forum_id'].'.xml</loc>
      <changefreq>daily</changefreq>
   </sitemap>';
    }
  echo "\n".'  </sitemapindex>';
}

?>