Hi thanks for your mod.
However the sitemap script does not obey permissions and just runs under the context of whatever user access is, not the bot group as it should.
The following changes fix this.
In the header:
Code: Select all
define('LOC_BOTGROUP','6');
define('LOC_CHECKPERM','f_list');
// Then comment out all this:
//$user->session_begin();
//$auth->acl($user->data);
//$user->setup();
Then replacing Topic_SiteMap_SQL():
Code: Select all
function Topic_SiteMap_SQL()
{
global $db, $cache, $auth;
// Here you can set the default time to reload cache in days (from 1 to 7 recommend)
$cache_time_limit = 7;
// Try finding the data in the cacge
if(($sitemap_sql_data = $cache->get('_topic_sitemap_sql')) === false)
{
$loc_perms = $auth->acl_group_raw_data(LOC_BOTGROUP,array(LOC_CHECKPERM));
$sitemap_sql_data = array();
if (isset($loc_perms[LOC_BOTGROUP])) {
$loc_perms = $loc_perms[LOC_BOTGROUP];
$sitemap_sql = array(
'SELECT' => 't.topic_id, t.forum_id, t.topic_last_post_time, t.topic_type, t.topic_replies',
'FROM' => array(TOPICS_TABLE => 't'),
'ORDER_BY' => 't.topic_type DESC'
);
/* Disabled for Topic pages function ***************************************************
// Limit URL 50,000 max http://www.sitemaps.org/protocol.php#index
$result = $db->sql_query_limit($db->sql_build_query('SELECT', $sitemap_sql), 50000);
***************************************************************************************/
$result = $db->sql_query($db->sql_build_query('SELECT', $sitemap_sql));
while($row = $db->sql_fetchrow($result))
{
if (isset($loc_perms[$row['forum_id']]) &&
isset($loc_perms[$row['forum_id']][LOC_CHECKPERM]) &&
($loc_perms[$row['forum_id']][LOC_CHECKPERM] == 1))
$sitemap_sql_data[] = array(
'topic_id' => $row['topic_id'],
'forum_id' => $row['forum_id'],
'topic_last_post_time' => $row['topic_last_post_time'],
'topic_type' => $row['topic_type'],
'topic_replies' => $row['topic_replies']
);
}
$db->sql_freeresult($result);
}
// cache this data, this improves performance!
$cache->put('_topic_sitemap_sql', $sitemap_sql_data, 86400*$cache_time_limit);
}
// Return data
return $sitemap_sql_data;
}