Карта сайта / Sitemap

S

Saint

Гость
Nightmare, поменять, то я поменял, в этом есть в том что место неизвестных чисел покасывает Сегодня и время. Но гугл все до сих пор ругается.
Код:
Неправильно введена дата
Обнаружена неверная дата. Исправьте дату или ее формат перед повторной передачей.
Родительский тег: url
Тег: lastmod
Значение: Сегодня 15:42
Проблема обнаружена: 22.10.2011
 

krumax

Пользователь
Nightmare, проблема в том, что с такими параметрами дата всёравно выводится в виде Сегодня 15:42 :)
 
D

diim

Гость
Есть стабильная и рабочая версия мода на последний билд ?
Или нужно тестить все разборы полетов ?
Хотя модуль перенесли с стабильные, но все же ?
 
S

Saint

Гость
Я исправил этот касяк, пока был в бане :) Если завтра будет время то напишу в чем проблема была и как ее решить.
 
S

Saint

Гость
functions_sitemap_fx
PHP:
<?php
/**
*
* @package phpBB3
* @version $Id: functions_sitemap_fx.php,v 1.0.5 9467 2009-08-17 20:46:39Z FladeX Exp $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* Generate sitemap
*/
function sitemap_fx_forum($forum_id)
{
    global $sitemap_config;
    $url = make_url('/');

    $sitemap_file = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
    $sitemap_file .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";

    $sql = 'SELECT topic_id, forum_id, topic_last_post_time, topic_type, topic_replies
        FROM ' . BB_TOPICS . '
            WHERE forum_id = ' . $forum_id;
    $result = DB()->sql_query($sql);

    while ($row = DB()->sql_fetchrow($result))
    {
        $lastmod = date($row['topic_last_post_time']);
        $pages = $row['topic_replies'] / $sitemap_config['posts_per_page'];
        $pages = (int) $pages;
        for ($i=0; $i<=$pages; $i++)
        {
            $sitemap_file .= "<url>\n";
            if ($i == 0)
            {
                $sitemap_file .= "<loc>" . $url . "viewtopic.php?f=" . $row['forum_id'] . "&amp;t=" . $row['topic_id'] . "</loc>\n";
            }
            else
            {
                $sitemap_file .= "<loc>" . $url . "viewtopic.php?f=" . $row['forum_id'] . "&amp;t=" . $row['topic_id'] . "&amp;start=" . $i * $sitemap_config['posts_per_page'] . "</loc>\n";
            }
            $sitemap_file .= "<lastmod>" . $lastmod = Date('Y-m-d') . "</lastmod>\n";
            switch ($row['topic_type'])
            {
                case POST_NORMAL:
                    $sitemap_file .= "<changefreq>" . $sitemap_config['sitemap_freq_0'] . "</changefreq>\n";
                    $sitemap_file .= "<priority>" . $sitemap_config['sitemap_priority_0'] . "</priority>\n";
                    break;
                case POST_STICKY:
                    $sitemap_file .= "<changefreq>" . $sitemap_config['sitemap_freq_1'] . "</changefreq>\n";
                    $sitemap_file .= "<priority>" . $sitemap_config['sitemap_priority_1'] . "</priority>\n";
                    break;
                case POST_ANNOUNCE:
                    $sitemap_file .= "<changefreq>" . $sitemap_config['sitemap_freq_2'] . "</changefreq>\n";
                    $sitemap_file .= "<priority>" . $sitemap_config['sitemap_priority_2'] . "</priority>\n";
                    break;
                default:
                    $sitemap_file .= "<changefreq>" . $sitemap_config['sitemap_freq_0'] . "</changefreq>\n";
                    $sitemap_file .= "<priority>" . $sitemap_config['sitemap_priority_0'] . "</priority>\n";
            }
            $sitemap_file .= "</url>\n";
        }
    }
    DB()->sql_freeresult($result);

    $sitemap_file .= "</urlset>\n";

    $w=fopen("sitemap/$forum_id.xml",'w');
    fwrite($w,$sitemap_file);
    fclose($w);
}

function sitemap_fx_global($forum_id)
{
    global $sitemap_config;
    $url = make_url('/');

    $sitemap_file = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
    $sitemap_file .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";

    $sql = 'SELECT topic_id, forum_id, topic_title, topic_last_post_time, topic_type, topic_replies
            FROM ' . BB_TOPICS . '
            WHERE topic_type = ' . POST_NORMAL;
    $result = DB()->sql_query($sql);

    if (DB()->sql_fetchrow($result))
    {
        while ($row = DB()->sql_fetchrow($result))
        {
            $lastmod = date($row['topic_last_post_time']);
            $pages = $row['topic_replies'] / $sitemap_config['posts_per_page'];
            $pages = (int) $pages;
            for ($i=0; $i<=$pages; $i++)
            {
                $sitemap_file .= "<url>\n";
                if ($i == 0)
                {
                    $sitemap_file .= "<loc>" . $url . "viewtopic.php?f=" . $forum_id . "&amp;t=" . $row['topic_id'] . "</loc>\n";
                }
                else
                {
                    $sitemap_file .= "<loc>" . $url . "viewtopic.php?f=" . $forum_id . "&amp;t=" . $row['topic_id'] . "&amp;start=" . $i * $sitemap_config['posts_per_page'] . "</loc>\n";
                }
                $sitemap_file .= "<lastmod>" . $lastmod = Date('Y-m-d') . "</lastmod>\n";
                $sitemap_file .= "<changefreq>" . $sitemap_config['sitemap_freq_3'] . "</changefreq>\n";
                $sitemap_file .= "<priority>" . $sitemap_config['sitemap_priority_3'] . "</priority>\n";
                $sitemap_file .= "</url>\n";
            }
        }
    }
    DB()->sql_freeresult($result);

    $sql = 'SELECT forum_id
            FROM ' . BB_FORUMS;//, forum_type
    $result = DB()->sql_query($sql);
    if (DB()->sql_fetchrow($result))
    {
        while ($row = DB()->sql_fetchrow($result))
        {
            //if ($row['forum_type'] == 1)
            //{
                $sitemap_file .= "<url>\n";
                $sitemap_file .= "<loc>" . $url . "viewforum.php?f=" . $row['forum_id'] . "</loc>\n";
                $sitemap_file .= "<lastmod>" . Date('Y-m-d') . "</lastmod>\n";
                $sitemap_file .= "<changefreq>daily</changefreq>\n";
                $sitemap_file .= "<priority>1</priority>\n";
                $sitemap_file .= "</url>\n";
            //}
        }
    }
    DB()->sql_freeresult($result);
    $sitemap_file .= "</urlset>\n";

    $w=fopen("sitemap/0.xml", 'w');
    fwrite($w, $sitemap_file);
    fclose($w);
}

?>
sitemap.php
PHP:
<?php

define('IN_PHPBB',  true);
define('BB_ROOT', './');
include(BB_ROOT .'common.php');
include(INC_DIR .'functions_sitemap_fx.php');

$sitemap_config['sitemap_enable'] = true;
$sitemap_config['sitemap_cache_time'] = 60; // minutes
$sitemap_config['sitemap_priority_0'] = '1.0';
$sitemap_config['sitemap_priority_1'] = '0.9';
$sitemap_config['sitemap_priority_2'] = '0.8';
$sitemap_config['sitemap_priority_3'] = '0.7';
$sitemap_config['sitemap_freq_0'] = 'daily';
$sitemap_config['sitemap_freq_1'] = 'daily';
$sitemap_config['sitemap_freq_2'] = 'daily';
$sitemap_config['sitemap_freq_3'] = 'daily';

$sitemap_config['posts_per_page'] = 30;

if (!$sitemap_config['sitemap_enable'])
{
    exit;
}

$url = make_url('/');
$last_forum_id = 0;
$user->session_start();

header("Content-Type: text/xml");

if (!$sitemap_index_file = CACHE('bb_cache')->get("sitemap_fx_index"))
{
    $sitemap_index_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    $sitemap_index_file .= "<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";

    $sql = 'SELECT forum_id, forum_topics'.//, auth_view
        '    FROM ' . BB_FORUMS;
    $result = DB()->query($sql);

    while ($row = DB()->sql_fetchrow($result))
    {
        if ($row['forum_id'] && /*($row['auth_view'] == 1) &&*/ ($row['forum_topics'] > 0))
        {
            sitemap_fx_forum((int) $row['forum_id']);

            $sitemap_index_file .= "<sitemap>\n";
            $sitemap_index_file .= "<loc>" . $url . "sitemap/" . $row['forum_id'] . ".xml</loc>\n";
            $sitemap_index_file .= "<lastmod>" . Date('Y-m-d') . "</lastmod>\n";
            $sitemap_index_file .= "</sitemap>\n";

            $last_forum_id = $row['forum_id'];
        }
    }
    DB()->sql_freeresult($result);

    if(!$bb_cfg['gzip_compress'])
    {
        flush();
    }

    sitemap_fx_global((int) $last_forum_id);
    $sitemap_index_file .= "<sitemap>\n";
    $sitemap_index_file .= "<loc>" . $url . "sitemap/0.xml</loc>\n";
    $sitemap_index_file .= "<lastmod>" . Date('Y-m-d') . "</lastmod>\n";
    $sitemap_index_file .= "</sitemap>\n";

    $sitemap_index_file .= "</sitemapindex>\n";
    CACHE('bb_cache')->set("sitemap_fx_index", $sitemap_index_file, (60 * $sitemap_config['sitemap_cache_time']));
}

print $sitemap_index_file;

?>
Замени файлы место того что от этого мода даются.
 
Сверху