function vbseo_reverse_forumtitle($arr) { global $vbseo_gcache; $fid = 0; vbseo_prepare_seo_replace(); vbseo_get_forum_info(); if (isset($arr['forum_path'])) { reset($vbseo_gcache['forum']); while (list(, $forum) = each($vbseo_gcache['forum'])) { if ($forum['path'] == $arr['forum_path']) { $fid = $forum['forumid']; break; } } } else { if (isset($arr['forum_title'])) { reset($vbseo_gcache['forum']); $ue_title = urlencode($arr['forum_title']); while (list(, $forum) = each($vbseo_gcache['forum'])) { if (vbseo_forum_seotitle($forum)) { } if ($forum['seotitle'] == $ue_title) { $fid = $forum['forumid']; break; } } } } return $fid; }
function vbseo_get_forum_info($implicit = false) { global $vbseo_gcache, $vboptions, $usercache, $forumcache, $threadcache, $vbseo_cache, $found_object_ids; vbseo_cache_start(); $f_allow = !$found_object_ids['forum_last'] || $found_object_ids['forum_last'][0] && $forumcache[$found_object_ids['forum_last'][0]] && $forumcache[$found_object_ids['forum_last'][0]]['lastposter']; $fp_cached = $vboptions['vbseo_opt']['forumpaths'] ? true : false; $vbseo_fp = $fp_cached ? $vboptions['vbseo_opt']['forumpaths'] : array(); $savecache = false; if (!$vbseo_gcache['forum']) { $vbseo_gcache['forum'] = $vbseo_cache->cacheget('forum'); } if (empty($vbseo_gcache['forum']) || $implicit && $f_allow) { $vbseo_gcache['forum'] = array(); if (is_array($forumcache) && $f_allow) { foreach ($forumcache as $forum_id => $arr) { $arr['parentlist'] = substr($arr['parentlist'], 0, -3); $vbseo_gcache['forum'][$arr['forumid']] = $arr; } } else { $db = vbseo_get_db(); $rid = $db->vbseodb_query("select forumid" . (VBSEO_GET_FORUM_TITLES ? ', title' : '') . ", parentlist, lastpost, lastposter, daysprune, parentid, threadcount from " . vbseo_tbl_prefix('forum')); if ($rid) { while ($arr = @$db->funcs['fetch_assoc']($rid)) { $arr['parentlist'] = substr($arr['parentlist'], 0, -3); $vbseo_gcache['forum'][$arr['forumid']] = $arr; } $db->vbseodb_free_result($rid); } } $forumids = array_keys($vbseo_gcache['forum']); foreach ($forumids as $forumid) { $forum =& $vbseo_gcache['forum'][$forumid]; if (isset($forum['lastthreadid']) && ($tid = $forum['lastthreadid']) && !in_array(THIS_SCRIPT, array('showthread', 'printthread', 'showpost'))) { $threadcache[$tid] = array_merge(isset($threadcache[$tid]) ? $threadcache[$tid] : array(), array('threadid' => $forum['lastthreadid'], 'title' => $forum['lastthread'], 'forumid' => $forumid, 'lastpostid' => $forum['lastpostid'], 'lastposter' => $forum['lastposter'])); } if ($fp_cached) { continue; } $parentlist = array_reverse(explode(',', $forum['parentlist'])); $forum['patharr'] = array(); for ($i = 0; isset($parentlist[$i]) && ($id = $parentlist[$i]); $i++) { vbseo_forum_seotitle($vbseo_gcache['forum'][$id]); $replace = array('%forum_id%' => $id, '%forum_title%' => $vbseo_gcache['forum'][$id]['seotitle']); $forum['patharr'][] = str_replace(array_keys($replace), $replace, VBSEO_FORUM_TITLE_BIT); } $forumcache[$forumid]['path'] = $forum['path'] = @implode('/', $forum['patharr']); } $savecache = true; } if (!$fp_cached) { $vboptions['vbseo_opt'] = array(); vbseo_check_datastore(); } foreach ($vbseo_gcache['forum'] as $forumid => $arr) { if (isset($arr['lastposter']) && $found_object_ids['forum_last'] && in_array($arr['forumid'], $found_object_ids['forum_last'])) { $found_object_ids['user_names'][] = $arr['lastposter']; } if (!isset($arr['path']) && $fp_cached) { $vbseo_gcache['forum'][$forumid]['path'] = $vbseo_fp[$forumid]; } if (isset($arr['lastpostid'])) { $lpostid = $arr['lastpostid']; if (!isset($vbseo_gcache['post'][$lpostid]) && isset($arr['lastthreadid'])) { $vbseo_gcache['post'][$lpostid] = array('postid' => $lpostid, 'threadid' => $arr['lastthreadid']); } } } if ($savecache) { $vbseo_cache->cacheset('forum', $vbseo_gcache['forum']); } vbseo_prepare_cat_anchors(); if (isset($id)) { return $vbseo_gcache['forum'][$id]; } return $vbseo_gcache['forum']; }