$prior = vbseo_sm_priority($vboptions['vbseo_sm_priority_rt'], $relp);
if($vboptions['vbseo_sm_freq_tsmart'])
{
$dpassed = (time() - $threadrow['lastpost'])/86400;
if($dpassed<3)$freq = 'daily';
else if($dpassed<10)$freq = 'weekly';
else if($dpassed<100)$freq = 'monthly';
else $freq = 'yearly';
}else
$freq = $vboptions['vbseo_sm_freq_t'];
vbseo_log_entry("[showthread] forum_id: $forumid, thread_id: $threadrow[threadid], total posts: $totalposts, pages: $totalpages, views: $threadrow[views] $prior");
//additional code
$alanguages = array ('af','sq','ar','be','bg','ca','zh-CN','hr','cs','da','nl','en','pl','et','tl','fi','fr','gl','de','el','iw','hi','hu','is','id','ga','it','ja','ko','lv','lt','mk','ms','mt','no','fa','pt','ro','ru','sr','sk','sl','es','sw','sv','zh-TW','th','tr','uk','vi','cy','yi');
if(!$archived) {
$strlenhost = strlen($vbseo_vars['bburl']."/");
$currentthreadurl = vbseo_url_thread($threadrow, 1, $archived);
$currentthreadurl_before = substr($currentthreadurl,0,$strlenhost);
$currentthreadurl_after = "/".substr($currentthreadurl,$strlenhost);
$lastpost =& $threadrow['lastpost'];
$vbseo_stat['t'] += sizeof($alanguages);
foreach($alanguages as $language) {
vbseo_add_url($currentthreadurl_before.$language.$currentthreadurl_after, $prior, $lastpost, $freq);
}
}
//end additional code
for($p=1; $p<=$totalpages; $p++)
{
$vbseo_stat[$archived?'at':'t'] += vbseo_add_2urls(
vbseo_url_thread($threadrow, $p, $archived),
vbseo_url_thread($threadrow, $p, $archived, true),
$prior,
$threadrow['lastpost'],
$freq
);
}
if($showpost)
{
$getposts = $db->query("
SELECT p.dateline,p.postid,p.threadid
FROM " . TABLE_PREFIX . "post AS p
WHERE p.threadid = $threadrow[threadid]
AND visible = 1
ORDER BY p.dateline
");
$pcount = 0;
while ($postrow = $db->fetch_array($getposts))
{
$pcount++;
vbseo_log_entry("[showpost] forum_id: $forumid, thread_id: $postrow[threadid], post_id: $postrow[postid]");
$relp = $relp*0.8+$pcount/($threadrow['replycount']+1)*0.2;
$relp*= vbseo_apply_custom_priority('forum', $threadrow['forumid']);
$prior2 = vbseo_sm_priority($vboptions['vbseo_sm_priority_rp'], $relp);
$vbseo_stat['p'] += vbseo_add_2urls(
vbseo_url_post($threadrow, $postrow, $pcount),
vbseo_url_post($threadrow, $postrow, $pcount, true),
$prior2,
$postrow['dateline'],
$vboptions['vbseo_sm_freq_p']
);
}
$db->free_result($getposts);
}
}
$db->free_result($getthreads);
$vbseo_progress['step3'] = 0;
}
vbseo_inc_progress();
}
function vbseo_sitemap_polls($progress)
{
global $db, $vboptions, $vbseo_vars;
if(vbseo_check_progress($progress)) return;
$added_urls = 0;
vbseo_log_entry("[SECTION START] polls", true);
$st = $db->query_first("
SELECT
max(voters) as maxre,min(voters) as minre,avg(voters) as avgre
FROM " . TABLE_PREFIX . "poll
");
foreach($vbseo_vars['forumslist'] as $forumid)
{
$getthreads = $db->query("
SELECT *
FROM " . TABLE_PREFIX . "thread AS thread
WHERE forumid = $forumid
AND visible = 1
AND pollid > 0
");
while ($threadrow = $db->fetch_array($getthreads))
{
$getpoll = $db->query_first("
SELECT *
FROM " . TABLE_PREFIX . "poll
WHERE pollid = ".$threadrow['pollid']."
");
if(!$getpoll)
continue;
vbseo_log_entry("[poll] forum_id: $forumid, thread_id: $threadrow[threadid], pollid: $threadrow[pollid]");
$added_urls++;
$relp2 = vbseo_math_avg_weight($getpoll['voters'], $st['minre'], $st['maxre'], $st['avgre']);
$relp2*= vbseo_apply_custom_priority('forum', $threadrow['forumid']);
$prior = vbseo_sm_priority($vboptions['vbseo_sm_priority_rpoll'], $relp2);
$added_urls += vbseo_add_2urls(
vbseo_url_poll($threadrow, $getpoll),
vbseo_url_poll($threadrow, $getpoll, true),
$prior,
$getpoll['dateline'],
$vboptions['vbseo_sm_freq_poll']
);
}
$db->free_result($getthreads);
}
vbseo_inc_progress();
return $added_urls;
}
function vbseo_sitemap_blogs($progress)
{
global $db, $vboptions, $vbseo_vars;
if(vbseo_check_progress($progress)) return;
if(!vbseo_dbtbl_exists('blog'))
return 0;
vbseo_log_entry("[SECTION START] blogs", true);
vbseo_add_url(VBSEO_ON ? vbseo_any_url($vbseo_vars['bburl'].'/blog.'.VBSEO_PHP_EXT) : $vbseo_vars['bburl'].'/blog.'.VBSEO_PHP_EXT, 1.0);
$added_urls = 0;