function vbseo_get_post_thread_info($ids, $implicit = false)
{
global $vbseo_gcache;
global $found_object_ids;
if (!$ids) return array();
if (!is_array($ids)) $ids = array($ids);
$lookupids = array();
foreach($ids as $id)
if($id)
{
if (isset($vbseo_gcache['post'][$id]) && $vbseo_gcache['post'][$id]['threadid'] && !$implicit) continue;
$vbseo_gcache['post'][$id] = array();
$lookupids[] = $id;
}
vbseo_int_var($lookupids);
if (empty($lookupids))return array();
$db = vbseo_get_db();
$db->vbseodb_select_db();
$rid = $db->vbseodb_query($q = "
select p.postid, t.threadid, t.title, p.dateline
from " . vbseo_tbl_prefix('thread') . " t, " . vbseo_tbl_prefix('post') . " p
where
p.postid in (" . join(',', $lookupids) . ")
AND p.threadid=t.threadid
");
$postids = array();
if ($rid)
{
while ($post = @$db->funcs['fetch_assoc']($rid))
{
if (@in_array($post['postid'], $found_object_ids['prepostthread_ids']))
{
$bbu = vbseo_vb_userinfo();
if(function_exists('fetch_coventry'))
{
if($coventry = fetch_coventry('string'))
$whr = " AND p.userid NOT IN ($coventry)";
}
$dbret = $db->vbseodb_query_first("
select count(*) as preposts
from " . vbseo_tbl_prefix('post') . " p
where
p.threadid='" . $post['threadid'] . "'
AND p.visible=1
AND p.dateline " . (($bbu[&#039;postorder&#039;] == 0) ? &#039;<=&#039; : &#039;>=&#039;) . $post[&#039;dateline&#039;] . "
$whr
");
$post[&#039;preposts&#039;] = $dbret[&#039;preposts&#039;];
$post[&#039;prepostsproc&#039;] = isset($bbu[&#039;postorder&#039;]);
}
$vbseo_gcache[&#039;post&#039;][$post[&#039;postid&#039;]] = $post;
$found_object_ids[&#039;postthreads&#039;][] = $post[&#039;threadid&#039;];
}
$db->vbseodb_free_result($rid);
}
$arr = array();
foreach($ids as $id)
{
$arr[$id] = $vbseo_gcache[&#039;post&#039;][$id];
}
return $arr;
}
function vbseo_get_forum_announcement($id, $aids = 0)
{
global $vboptions, $vbseo_gcache, $vbseo_precache, $usercache;
$ids = is_array($id) ? $id : array($id);
if (isset($vbseo_precache[&#039;announcements&#039;]))
{
foreach($vbseo_precache[&#039;announcements&#039;] as $ann)
foreach($ids as $fid)
{
$vbseo_gcache[&#039;forum&#039;][$fid][&#039;announcement&#039;][$ann[&#039;announcementid&#039;]] = $ann[&#039;title&#039;];
$usercache[$ann[&#039;userid&#039;]] = array(&#039;userid&#039; => $ann[&#039;userid&#039;],
&#039;username&#039; => $ann[&#039;username&#039;]
);
}
return;
}
vbseo_int_var($ids);
$db = vbseo_get_db();
$idlist = &#039;&#039;;
for($i = 0; $i < count($ids); $i++)
{
$idlist .= ($i?&#039;,&#039;:&#039;&#039;) . $ids[$i];
$pl = $vbseo_gcache[&#039;forum&#039;][$ids[$i]][&#039;parentlist&#039;];
if ($pl)
$idlist .= &#039;,&#039; . $pl;
}
$rid = $db->vbseodb_query($q = "
SELECT
forumid,announcementid,title
FROM " . vbseo_tbl_prefix(&#039;announcement&#039;) . " AS announcement
WHERE " . ($aids?"announcementid=&#039;$aids&#039;":"startdate <= " . (time() - $vboptions[&#039;hourdiff&#039;]) . "
AND enddate >= " . (time() - $vboptions[&#039;hourdiff&#039;]) . "
AND forumid IN (" . $idlist . ",-1)
ORDER BY startdate DESC")
);
if ($rid)
{
while ($arr = @$db->funcs[&#039;fetch_assoc&#039;]($rid))
{
$fid = $arr[&#039;forumid&#039;];
if ($aids)$ids = array($fid);
for($i = 0; $i < count($ids); $i++)
{
if (isset($vbseo_gcache[&#039;forum&#039;][$ids[$i]]))
{
$forum = &$vbseo_gcache[&#039;forum&#039;][$ids[$i]];
if (($fid == -1) ||
($ids[$i] == $fid) ||
preg_match(&#039;#\b&#039; . $fid . &#039;\b#&#039;, $forum[&#039;parentlist&#039;]))
$forum[&#039;announcement&#039;][$arr[&#039;announcementid&#039;]] = $arr[&#039;title&#039;];
}
}
if ($aids)return $arr;
}
$db->vbseodb_free_result($rid);
}
return $forum;
}
function vbseo_get_poll_info($ids)
{
global $vbseo_gcache, $pollinfo;
if (!$ids) return array();
if (!is_array($ids)) $ids = array($ids);
if ($pollinfo)
{
$vbseo_gcache[&#039;polls&#039;][$pollinfo[&#039;pollid&#039;]] = $pollinfo;
$ids = array_diff($ids, array($pollinfo[&#039;pollid&#039;]));
}
if (isset($vbseo_gcache[&#039;polls&#039;]) && $vbseo_gcache[&#039;polls&#039;])
$ids = array_diff($ids, array_keys($vbseo_gcache[&#039;polls&#039;]));
vbseo_int_var($ids);
if (!empty($ids))
{
$db = vbseo_get_db();
$rid = $db->vbseodb_query($q = "
SELECT
pollid, question
FROM " . vbseo_tbl_prefix(&#039;poll&#039;) . "
WHERE pollid IN (" . implode(&#039;,&#039;, $ids) . ")");
if ($rid)
{
while ($arr = @$db->funcs[&#039;fetch_assoc&#039;]($rid))
$vbseo_gcache[&#039;polls&#039;][$arr[&#039;pollid&#039;]] = $arr;
$db->vbseodb_free_result($rid);
}
}
}
function vbseo_get_forum_info($implicit = false)
{
global $vbseo_gcache, $vbulletin, $vboptions, $usercache, 
$forumcache, $threadcache, $vbseo_cache, $found_object_ids;
vbseo_cache_start();
$f_allow = (!$found_object_ids[&#039;forum_last&#039;] ||
($found_object_ids[&#039;forum_last&#039;][0] && $forumcache[$found_object_ids[&#039;forum_last&#039;][0]] && $forumcache[$found_object_ids[&#039;forum_last&#039;][0]][&#039;lastposter&#039;])
);
$fp_cached = $vboptions[&#039;vbseo_opt&#039;][&#039;forumpaths&#039;] ? true : false;
$vbseo_fp = $fp_cached ? $vboptions[&#039;vbseo_opt&#039;][&#039;forumpaths&#039;] : array();
$savecache = false;
if (!$vbseo_gcache[&#039;forum&#039;])
$vbseo_gcache[&#039;forum&#039;] = $vbseo_cache->cacheget(&#039;forum&#039;);
if (is_object($vbulletin) && $vbulletin->forumcache)
$fc = &$vbulletin->forumcache;
else
$fc = &$forumcache;
if (empty($vbseo_gcache[&#039;forum&#039;]) || ($implicit && $f_allow))
{
if (is_array($fc) && $f_allow)
{
foreach($fc as $forum_id => $arr)
{
$arr[&#039;parentlist&#039;] = substr($arr[&#039;parentlist&#039;], 0, -3);
$vbseo_gcache[&#039;forum&#039;][$arr[&#039;forumid&#039;]] = $arr;
}
}
else
{
$db = vbseo_get_db();
$rid = $db->vbseodb_query("select forumid" . (VBSEO_GET_FORUM_TITLES ? &#039;, title&#039; : &#039;&#039;) . 
", parentlist, lastpost, lastposter, daysprune, parentid, threadcount, lastthreadid, lastthread, lastpostid from " . vbseo_tbl_prefix(&#039;forum&#039;) );
if ($rid)
{
while ($arr = @$db->funcs[&#039;fetch_assoc&#039;]($rid))
{
$arr[&#039;parentlist&#039;] = substr($arr[&#039;parentlist&#039;], 0, -3);
$vbseo_gcache[&#039;forum&#039;][$arr[&#039;forumid&#039;]] = $arr;
}
$db->vbseodb_free_result($rid);
}
}
$forumids = $vbseo_gcache[&#039;forum&#039;] ? array_keys($vbseo_gcache[&#039;forum&#039;]) : array();
foreach($forumids as $forumid)
{
$forum = &$vbseo_gcache[&#039;forum&#039;][$forumid];
if (isset($forum[&#039;lastthreadid&#039;]) && ($tid = $forum[&#039;lastthreadid&#039;]) && !in_array(THIS_SCRIPT, array(&#039;showthread&#039;, &#039;printthread&#039;, &#039;showpost&#039;)))
{
$threadcache[$tid] = array_merge(isset($threadcache[$tid])?$threadcache[$tid]:array(),
array(&#039;threadid&#039; => $forum[&#039;lastthreadid&#039;],
&#039;title&#039; => $forum[&#039;lastthread&#039;],
&#039;forumid&#039; => $forumid,
&#039;lastpost&#039; => $forum[&#039;lastpost&#039;],
&#039;lastpostid&#039; => $forum[&#039;lastpostid&#039;],
&#039;lastposter&#039; => $forum[&#039;lastposter&#039;]
));
}
if ($fp_cached)
continue;
$parentlist = array_reverse(explode(&#039;,&#039;, $forum[&#039;parentlist&#039;]));
$forum[&#039;patharr&#039;] = array();
if (VBSEO_GET_FORUM_PATH)
for($i = 0; isset($parentlist[$i]) && ($id = $parentlist[$i]); $i++)
{
vbseo_forum_seotitle($vbseo_gcache[&#039;forum&#039;][$id]);
$replace = array(&#039;%forum_id%&#039; => $id,
&#039;%forum_title%&#039; => $vbseo_gcache[&#039;forum&#039;][$id][&#039;seotitle&#039;],
);
$forum[&#039;patharr&#039;] [] = str_replace(array_keys($replace), $replace, VBSEO_FORUM_TITLE_BIT);
}
$fc[$forumid][&#039;path&#039;] = $forum[&#039;path&#039;] = @implode(&#039;/&#039;, $forum[&#039;patharr&#039;]);
}
$savecache = true;
}
if (!$fp_cached)
{
$vboptions[&#039;vbseo_opt&#039;] = array();
vbseo_check_datastore();
}
if(is_array($vbseo_gcache[&#039;forum&#039;]))
foreach($vbseo_gcache[&#039;forum&#039;] as $forumid => $arr)
{
if (isset($arr[&#039;lastposter&#039;]) && $found_object_ids[&#039;forum_last&#039;] && in_array($arr[&#039;forumid&#039;], $found_object_ids[&#039;forum_last&#039;]))
$found_object_ids[&#039;user_names&#039;][] = $arr[&#039;lastposter&#039;];
if (!isset($arr[&#039;path&#039;]) && $fp_cached)
$vbseo_gcache[&#039;forum&#039;][$forumid][&#039;path&#039;] = $vbseo_fp[$forumid];
if (isset($arr[&#039;lastpostid&#039;]))
{
$lpostid = $arr[&#039;lastpostid&#039;];
if (!isset($vbseo_gcache[&#039;post&#039;][$lpostid]) && isset($arr[&#039;lastthreadid&#039;]))
$vbseo_gcache[&#039;post&#039;][$lpostid] = array(&#039;postid&#039; => $lpostid,
&#039;threadid&#039; => $arr[&#039;lastthreadid&#039;],
);
}
}
if ($savecache)
{
if(is_array($vbseo_gcache[&#039;forum&#039;]))
foreach($vbseo_gcache[&#039;forum&#039;] as $forumid=>$finfo)
if($finfo[&#039;forumread&#039;])
unset($vbseo_gcache[&#039;forum&#039;][$forumid][&#039;forumread&#039;]);
$vbseo_cache->cacheset(&#039;forum&#039;, $vbseo_gcache[&#039;forum&#039;]);
}
vbseo_prepare_cat_anchors();
if (isset($id)) return $vbseo_gcache[&#039;forum&#039;][$id];
return $vbseo_gcache[&#039;forum&#039;];
}
function vbseo_get_thread_details($postid)
{
$db = vbseo_get_db();
vbseo_int_var($postid);
return $db->vbseodb_query_first("SELECT p.pagetext,p.postid FROM " . vbseo_tbl_prefix(&#039;post&#039;) . " p
WHERE p.postid=&#039;$postid&#039;
"
);
}
function vbseo_get_attachments_info($ids)
{
global $vbseo_gcache, $found_object_ids;
if (!$ids) return array();
if (!is_array($ids)) $ids = array($ids);
global $postattach;
if (is_array($postattach))
foreach($postattach as $pid => $attarr)
{
if (is_array($attarr))
foreach($attarr as $id => $arr)
{
$vbseo_gcache[&#039;attach&#039;][$id] = $arr;
$found_object_ids[&#039;postthread_ids&#039;][] = $arr[&#039;postid&#039;];
}
}
$lookupids = array();
foreach($ids as $id)
if($id)
{
if (isset($vbseo_gcache[&#039;attach&#039;][$id])) continue;
$vbseo_gcache[&#039;attach&#039;][$id] = array();
$lookupids[] = $id;
}
if (empty($lookupids))return array();
vbseo_int_var($lookupids);
$db = vbseo_get_db();
$rid = $db->vbseodb_query($q = "
select at.attachmentid,at.filename,".(VBSEO_VB4 ? &#039;contenttypeid, contentid, caption&#039; : &#039;at.postid&#039;)."
from " . vbseo_tbl_prefix(&#039;attachment&#039;) . " at
where
at.attachmentid IN (" . implode(&#039;,&#039;, $lookupids) . ")
");
if ($rid)
{
while ($att = @$db->funcs[&#039;fetch_assoc&#039;]($rid))
{
if($att[&#039;contenttypeid&#039;] == 1)
$att[&#039;postid&#039;] = $att[&#039;contentid&#039;];
if($att[&#039;postid&#039;])
$found_object_ids[&#039;postthread_ids&#039;][] = $att[&#039;postid&#039;];
$vbseo_gcache[&#039;attach&#039;][$att[&#039;attachmentid&#039;]] = $att;
}
$db->vbseodb_free_result($rid);
}
return $vbseo_gcache[&#039;attach&#039;];
}
function vbseo_get_thread_info($ids)
{
global $vbseo_gcache, $found_object_ids;
$haslastpostid = vbseo_vbversion()>=&#039;3.6&#039;;
$hasthreadprefixes = vbseo_vbversion()>=&#039;3.8&#039;;
if (!$ids) return array();
if (!is_array($ids)) $ids = array($ids);
$lookupids = array();
foreach($ids as $id)
if ($id)
{
if (isset($vbseo_gcache[&#039;thread&#039;][$id]))
{ 
if(!VBSEO_URL_THREAD_PREFIX || $vbseo_gcache[&#039;thread&#039;][$id][&#039;prefixid&#039;])
continue;
}else
{
$vbseo_gcache[&#039;thread&#039;][$id] = array();
}
$lookupids[] = $id;
}
vbseo_int_var($lookupids);
if (!empty($lookupids))
{
$where = array(&#039;&#039;);
$db = vbseo_get_db();
$rid = $db->vbseodb_query(
"select t.forumid, t.threadid, " . 
(VBSEO_GET_THREAD_TITLES ? &#039;t.title, &#039; : &#039;&#039;) . 
((VBSEO_URL_THREAD_PREFIX && $hasthreadprefixes) ? &#039;t.prefixid, &#039; : &#039;&#039;) . 
"t.replycount, t.lastposter, ".($haslastpostid?"firstpostid,lastpostid, ":"").
(VBSEO_LIKE_POST ? "vbseo_likes,":"").
"lastpost, visible
from " . vbseo_tbl_prefix(&#039;thread&#039;) . " t
where
t.threadid in (" . join(&#039;,&#039;, $lookupids) . ")
");
if ($rid)
{
while ($thread = @$db->funcs[&#039;fetch_assoc&#039;]($rid))
{
vbseo_thread_seotitle($thread);
$vbseo_gcache[&#039;thread&#039;][$thread[&#039;threadid&#039;]] = $thread;
if ($found_object_ids[&#039;thread_last&#039;] && in_array($thread[&#039;threadid&#039;], $found_object_ids[&#039;thread_last&#039;]))
$found_object_ids[&#039;user_names&#039;][] = $thread[&#039;lastposter&#039;];
}
$db->vbseodb_free_result($rid);
}
}
$arr = array();
foreach($ids as $id)
$arr[$id] = $vbseo_gcache[&#039;thread&#039;][$id];
return $arr;
}
function vbseo_get_posts_info($postids)
{
global $vbseo_gcache;
if (!$postids)return;
$db = vbseo_get_db();
vbseo_int_var($postids);
$preq = "select postid, threadid
from " . vbseo_tbl_prefix(&#039;post&#039;) . "
where postid in (&#039;" . implode("&#039;,&#039;", array_unique($postids)) . "&#039;)";
$rid = $db->vbseodb_query($preq);
if ($rid)
{
while ($arr = @$db->funcs[&#039;fetch_assoc&#039;]($rid))
{
$vbseo_gcache[&#039;post&#039;][$arr[&#039;postid&#039;]] = $arr;
}
$db->vbseodb_free_result($rid);
}
}
function vbseo_get_user_info($userids, $user_names = array())
{
global $vbseo_gcache;
$whr = $whr2 = &#039;&#039;;
vbseo_int_var($userids);
if(!is_array($userids))
$userids = array($userids);
if (!empty($userids))
$whr .= "u.userid in (&#039;" . implode("&#039;,&#039;", $userids) . "&#039;)";
if (!empty($user_names) && strstr(VBSEO_URL_MEMBER, &#039;%user_id%&#039;))
{
$unw = &#039;&#039;;
foreach($user_names as $uind => $uname)
$unw .= ($unw?&#039;,&#039;:&#039;&#039;) . "&#039;" . str_replace("&#039;", "\\&#039;", str_replace("\\", "\\\\", $uname)) . "&#039;";
$whr2 = "u.username in ($unw)";
}
if ($whr || $whr2)
{
$db = vbseo_get_db();
$preq = "select u.userid, u.username
from " . vbseo_tbl_prefix(&#039;user&#039;) . " u
where ";
if ($db->mysql_version[0] > &#039;3&#039;)
$rid = $db->vbseodb_query(($whr?"( $preq  $whr )":"") . (($whr && $whr2)?"\nUNION ":"") . ($whr2?"( $preq  $whr2 )":""));
else
$rid = $db->vbseodb_query($preq . $whr . (($whr && $whr2) ? &#039; OR &#039; : &#039;&#039;) . $whr2);
if ($rid)
{
while ($arr = @$db->funcs[&#039;fetch_assoc&#039;]($rid))
{
$vbseo_gcache[&#039;user&#039;][$arr[&#039;userid&#039;]] =
$vbseo_gcache[&#039;usernm&#039;][strtolower($arr[&#039;username&#039;])] =
$arr;
}
$db->vbseodb_free_result($rid);
}
}
}
function vbseo_get_blog_info($ids, $buser = false, $comment = false)
{
global $vbseo_gcache;
if($comment)
{
$cvar  = &#039;blog_text&#039;;
$idvar = &#039;blogtextid&#039;;
$buser = &#039;bloguserid&#039;;
$fields = "b.userid, b.username, b.blogtextid, b.blogid, b.state";
}else
{
$cvar = &#039;blog&#039;;
$idvar = &#039;blogid&#039;;
$buser = &#039;userid&#039;;
$fields = "b.userid, b.username, b.blogid, b.title, b.state";
}
if (!$ids) return array();
if (!is_array($ids)) $ids = array($ids);
$lookupids = array();
foreach($ids as $id)
if($id)
{
$id = intval($id);
if (isset($vbseo_gcache[$cvar][$id]) && isset($vbseo_gcache[$cvar][$id][&#039;userid&#039;])) continue;
$lookupids[$id]++;
}
if (!empty($lookupids))
{
$db = vbseo_get_db();
$db->vbseodb_select_db();
$rid = $db->vbseodb_query($q="
select $fields ".
((VBSEO_VB4 && $buser) ? ",bu.options_member":"")."
from " . vbseo_tbl_prefix($cvar) . " b ".
($buser ? "left join ".vbseo_tbl_prefix(&#039;blog_user&#039;)." as bu on bu.bloguserid=b.".$buser : "")."
where
".$idvar." in (" . join(&#039;,&#039;, array_keys($lookupids)) . ")
");
if ($rid)
{
while ($bl = @$db->funcs[&#039;fetch_assoc&#039;]($rid))
$vbseo_gcache[$cvar][$bl[$idvar]] = $bl;
$db->vbseodb_free_result($rid);
}
}
if(count($ids)==1)
return $vbseo_gcache[$cvar][$ids[0]];
else
return;
}
function vbseo_get_blogatt_info($ids)
{
global $vbseo_gcache;
if (!$ids) return array();
if (!is_array($ids)) $ids = array($ids);
$lookupids = array();
foreach($ids as $id)
if($id)
{
$id = intval($id);
if (isset($vbseo_gcache[&#039;battach&#039;][$id])) continue;
$lookupids[$id]++;
}
if (empty($lookupids))
return;
$db = vbseo_get_db();
$db->vbseodb_select_db();
$rid = $db->vbseodb_query($q="
select attachmentid, blogid, userid, filename, dateline
from " . vbseo_tbl_prefix(&#039;blog_attachment&#039;) . "
where
attachmentid in (" . join(&#039;,&#039;, array_keys($lookupids)) . ")
");
if ($rid)
{
while ($bl = @$db->funcs[&#039;fetch_assoc&#039;]($rid))
$vbseo_gcache[&#039;battach&#039;][$bl[&#039;attachmentid&#039;]] = $bl;
$db->vbseodb_free_result($rid);
}
return;
}
function vbseo_get_blog_cats($ids)
{
global $vbseo_gcache;
if (!$ids) return array();
if (!is_array($ids)) $ids = array($ids);
$lookupids = array();
foreach($ids as $id)
if($id)
{
$id = intval($id);
if (isset($vbseo_gcache[&#039;blogcat&#039;][$id])) continue;
$lookupids[] = $id;
}
if (empty($lookupids))return array();
$db = vbseo_get_db();
$db->vbseodb_select_db();
$rid = $db->vbseodb_query("
select blogcategoryid, title, userid
from " . vbseo_tbl_prefix(&#039;blog_category&#039;) . "
where
blogcategoryid in (" . join(&#039;,&#039;, $lookupids) . ")
");
if ($rid)
{
while ($bl = @$db->funcs[&#039;fetch_assoc&#039;]($rid))
$vbseo_gcache[&#039;blogcat&#039;][$bl[&#039;blogcategoryid&#039;]] = $bl;
$db->vbseodb_free_result($rid);
}
return;
}
function vbseo_get_group_info($ids)
{
global $vbseo_gcache;
if (!$ids) return array();
if (!is_array($ids)) $ids = array($ids);
$lookupids = array();
foreach($ids as $id)
if($id)
{
$id = intval($id);
if (isset($vbseo_gcache[&#039;groups&#039;][$id])) continue;
$lookupids[] = $id;
}
if (empty($lookupids))return array();
$db = vbseo_get_db();
$db->vbseodb_select_db();
$rid = $db->vbseodb_query("
select groupid, name, visible, deleted
from " . vbseo_tbl_prefix(&#039;socialgroup&#039;) . "
where
groupid in (" . join(&#039;,&#039;, $lookupids) . ")
");
if ($rid)
{
while ($bl = @$db->funcs[&#039;fetch_assoc&#039;]($rid))
$vbseo_gcache[&#039;groups&#039;][$bl[&#039;groupid&#039;]] = $bl;
$db->vbseodb_free_result($rid);
}
return;
}
function vbseo_get_object_info($otype, $ids = array())
{
global $vbseo_gcache, $found_object_ids;
if($ids)
$found_object_ids[$otype] = $ids;
vbseo_clean_object_ids($otype);
if (!$ids = $found_object_ids[$otype])
return;
if(is_array($vbseo_gcache[$otype]))
$ids = array_diff($ids, array_keys($vbseo_gcache[$otype]));
$lookupids = array();
foreach($ids as $id)
if($id)
{
$id = intval($id);
$lookupids[] = $id;
}
if (empty($lookupids))return array();
$db = vbseo_get_db();
$db->vbseodb_select_db();
switch($otype)
{
case &#039;groupsdis&#039;:
$q = "select d.discussionid as tyid, d.discussionid, d.groupid, gm.title, gm.gmid
from " . vbseo_tbl_prefix(&#039;discussion&#039;) . " d
left join " . vbseo_tbl_prefix(&#039;groupmessage&#039;) ." gm on gm.gmid = d.firstpostid
where d.discussionid in (" . join(&#039;,&#039;, $lookupids) . ")";
break;
case &#039;blogcp_ids&#039;:
$q = "select customblockid as tyid, userid, title
from " . vbseo_tbl_prefix(&#039;blog_custom_block&#039;) . "
where customblockid in (" . join(&#039;,&#039;, $lookupids) . ")";
break;
case &#039;album&#039;:
$q = "select albumid as tyid, albumid, userid, title
from " . vbseo_tbl_prefix(&#039;album&#039;) . "
where albumid in (" . join(&#039;,&#039;, $lookupids) . ")";
break;
case &#039;cmscont&#039;:
$q = "select n.nodeid as tyid, n.url, n.parentnode, n.contenttypeid, n.userid, n.setpublish, 
n.publishdate, n.hidden, n.permissionsfrom, ni.title
from " . vbseo_tbl_prefix(&#039;cms_node&#039;) . " as n
left join " . vbseo_tbl_prefix(&#039;cms_nodeinfo&#039;) . " as ni on n.nodeid=ni.nodeid
where n.nodeid in (" . join(&#039;,&#039;, $lookupids) . ")";
break;
case &#039;cms_cat&#039;:
$q = "select categoryid as tyid, categoryid, parentnode, category
from " . vbseo_tbl_prefix(&#039;cms_category&#039;) . "
where categoryid in (" . join(&#039;,&#039;, $lookupids) . ")";
break;
case VBSEO_PIC_STORAGE:
if(VBSEO_VB4)
return vbseo_get_attachments_info($lookupids);
$q = "select p.pictureid as tyid, p.pictureid, ap.albumid, caption, extension
from " . vbseo_tbl_prefix(&#039;picture&#039;) . " p
join " . vbseo_tbl_prefix(&#039;albumpicture&#039;) . " ap on ap.pictureid=p.pictureid
where p.pictureid in (" . join(&#039;,&#039;, $lookupids) . ")";
break;
}
$rid = $db->vbseodb_query($q);
if ($rid)
{
while ($bl = @$db->funcs[&#039;fetch_assoc&#039;]($rid))
$vbseo_gcache[$otype][$bl[&#039;tyid&#039;]] = $bl;
$db->vbseodb_free_result($rid);
}
return;
}
function vbseo_extract_msg_postbits()
{
global $vbulletin;
$msg = &#039;&#039;;
$pbits = $GLOBALS[&#039;postbits&#039;];
if(!$pbits)
$pbits = vBSEO_Storage::get(&#039;cms_text&#039;);
if($pbits)
{
preg_match(&#039;#<!--\s*message\s*-->(.*?)<!--\s*/\s*message\s*-->#s&#039;, $pbits, $post_match);
if(!$post_match || (isset($vbulletin) && $vbulletin->gars) )
preg_match(&#039;#post_message_.*?\>(.*?)&#039;.(VBSEO_VB4? &#039;</blockquote>&#039; : &#039;</div>&#039;).&#039;#s&#039;, $pbits, $post_match);
$msg = preg_replace(&#039;#<!--.*?-->#s&#039;, &#039;&#039;, $msg);
$msg = str_replace(&#039;>Quote:<&#039;, &#039;&#039;, $post_match[1]);
$msg = preg_replace(&#039;#<div>Originally Posted by.*?</div>#&#039;, &#039;&#039;, $msg);
$msg = preg_replace(&#039;#<script.*?\>.*?</script>#is&#039;, &#039;&#039;, $msg);
$msg = preg_replace(&#039;#(<.*?\>)+#s&#039;, &#039; &#039;, $msg);
$msg = trim($msg);
}
return $msg;
}
?>

Add a code snippet to your website: www.paste.org