Code: Alles auswählen
<?php
$phpbb_root_path = ''; // muß angepasst werden, falls eine Ebene unter dem Forumsordner.
define('IN_PHPBB', true);
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path']));
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
$server_url = $server_protocol . $server_name . $server_port . $script_name;
if(substr($server_url, -1, 1) != "/") { $server_url .= "/"; }
$server_url = code_utf8($server_url);
$zeit = time();
$pre_timezone = date('O', $zeit);
$time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2);
$result = mysql_query("SELECT topic_id,post_time FROM " . POSTS_TABLE ) ;
while( $row = mysql_fetch_assoc($result)) {
if($last_time[$row["topic_id"]] < $row["post_time"]) { $last_time[$row["topic_id"]] = $row["post_time"]; }
}
echo '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>'.$server_url.'</loc>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>
';
$result = mysql_query("SELECT topic_id,topic_replies,topic_time FROM " . TOPICS_TABLE . " ORDER BY topic_id DESC LIMIT 50000") ;
while( $row = mysql_fetch_assoc($result)) {
$topicId = $row["topic_id"] ;
$alter = $zeit - $last_time[$row["topic_id"]] ;
$zeitbonus = max(min(round((600000 - $alter ) / 80000),7),0) ;
$last_time_post = date("Y-m-d\TH:i:s",$last_time[$row["topic_id"]]) . $time_zone ;
if ($alter < 604800) { $changefreq = 'weekly'; } else { $changefreq = 'monthly'; }
if ($alter < 84000) { $changefreq = 'daily'; }
$topicpriority = min(( $row["topic_replies"] + 1 + $zeitbonus ),9) ;
echo " <url>
<loc>".$server_url."ftopic$topicId.html</loc>
<lastmod>$last_time_post</lastmod>
<changefreq>$changefreq</changefreq>
<priority>0.$topicpriority</priority>
</url>
";
}
echo '</urlset>';
function code_utf8($text) {
$array_1 = array("&","\"","'",">","<","");
$array_2 = array("&",""","'",">","<","");
for($x=0;$x<4;$x++){
$text = str_replace($array_1[$x],$array_2[$x],$text);
}
return $text;
}
?>