* You may not redistribute this file or its derivatives without written permission. * * * * Sales Email: sales@crawlability.com * * * *----------------------------vBSEO IS NOT FREE SOFTWARE-----------------------------* * http://www.crawlability.com/vbseo/license/ * ************************************************************************************/ error_reporting(E_ALL & ~E_NOTICE); if (!is_object($vbulletin->db)) { exit; } include_once dirname(__FILE__) . '/../../includes/functions_vbseo.php'; vbseo_extra_inc('linkback'); vbseo_startup(); $vbseodb = vbseo_get_db(); $threads_to_update = $vbseodb->vbseodb_query("\nSELECT s_threadid,s_type\nFROM " . vbseo_tbl_prefix('vbseo_serviceupdate') . "\nWHERE s_threadid>0 AND s_updated = 0\n"); while ($tinfo = @$vbseodb->funcs['fetch_assoc']($threads_to_update)) { if ($tinfo['s_type'] == 1) { vbseo_get_blog_info(array($tinfo['s_threadid'])); $vbseo_url_t = vbseo_blog_url(VBSEO_URL_BLOG_ENTRY, array('b' => $tinfo['s_threadid'])); } else { vbseo_get_thread_info($tinfo['s_threadid']); $vbseo_url_t = vbseo_thread_url($tinfo['s_threadid']); } if (!strstr($vbseo_url_t, '://')) { $vbseo_url_t = $vboptions['bburl2'] . '/' . $vbseo_url_t; } vbseo_do_service_update($vbseo_url_t); $vbseodb->vbseodb_query($q = "\nUPDATE " . vbseo_tbl_prefix('vbseo_serviceupdate') . "\nSET s_updated=1, s_dateline = " . TIMENOW . "\nWHERE s_threadid = " . $tinfo['s_threadid']); } log_cron_action('', $nextitem, 1);
function vbseo_complete_sec($sec, $dat_proc = '') { global $vboptions, $forum, $vbulletin, $vbphrase, $postcache, $stylevar, $vbseo_gcache, $vbseo_linkbacks_no, $bbuserinfo; if (!VBSEO_ENABLED) { return; } if (defined('VBSEO_UNREG_EXPIRED')) { return $newtext; } if (VBSEO_IGNOREPAGES && preg_match('#(' . VBSEO_IGNOREPAGES . ')#i', VBSEO_REQURL)) { return; } if (VBSEO_REWRITE_THREADS_ADDTITLE && ($sec == 'newpost_preview' || $sec == 'postbit_display_complete')) { global $vbseo_previewmessage, $vbseo_cutbburl; if ($GLOBALS['post'] && $GLOBALS['post']['message']) { $ptext =& $GLOBALS['post']['message']; } else { $ptext =& $vbseo_previewmessage; } vbseo_reverse_formats(); $matchfull = preg_quote('http://' . VBSEO_HTTP_HOST, '#'); if (VBSEO_REWRITE_THREADS_ADDTITLE_POST) { $ptext = preg_replace('#(href=")(' . $matchfull . '[^"]*?' . VBSEO_FIND_P_FORMAT . '[^/"]*")#eis', 'vbseo_replace_urls_mini_post("$1","$2","$3")', $ptext); $ptext = preg_replace('#(href=")(' . $matchfull . '[^"]*?showpost\\.' . VBSEO_VB_EXT . '\\?[^"]*?p(?:ostid)?=(\\d+)[^/"]*")#eis', 'vbseo_replace_urls_mini_post("$1","$2","$3")', $ptext); } $ptext = preg_replace('#(href=")(' . $matchfull . '[^"]*?' . VBSEO_FIND_MT_FORMAT . '[^/"]*")#eis', 'vbseo_replace_urls_mini("$1","$2","$3","m")', $ptext); $ptext = preg_replace('#(href=")(' . $matchfull . '[^"]*?' . VBSEO_FIND_T_FORMAT . '[^/"]*")#eis', 'vbseo_replace_urls_mini("$1","$2","$3")', $ptext); $ptext = preg_replace('#(href=")(' . $matchfull . '[^"]*?(?:show|print)thread\\.' . VBSEO_VB_EXT . '\\?[^"]*?t(?:hreadid)?=(\\d+)[^/"]*")#eis', 'vbseo_replace_urls_mini("$1","$2","$3")', $ptext); } if (isset($vbulletin) && !$vbseo_cutbburl) { $vbseo_cutbburl = preg_replace('#/$#', '', $vbulletin->options['bburl']); } if ($sec == 'init_startup' && $vbseo_cutbburl) { vbseo_check_stripsids(); vbseo_prepare_seo_replace(); if (VBSEO_IN_PINGBACK && THIS_SCRIPT == 'showthread') { @header('X-Pingback: ' . $vbseo_cutbburl . '/vbseo-xmlrpc/'); } if (THIS_SCRIPT != 'search') { vbseo_prepare_cat_anchors(); } if (THIS_SCRIPT == 'newreply' || THIS_SCRIPT == 'editpost' || THIS_SCRIPT == 'newthread') { $vbseo_ref = $_SERVER['HTTP_REFERER']; $pre_repl = ''; $q = $_POST['message']; if ($vbseo_ref && strstr(strtolower($vbseo_ref), VBSEO_HTTP_HOST)) { $pre_repl = preg_replace('#/[^/]*$#', '/', $vbseo_ref); } if ($pre_repl && $pre_repl != $vbseo_cutbburl . '/') { $rs = '#((?:<a[^>]*?href="|\\[url="|\\[url\\]|<img[^>]*?src="|\\[img="|\\[img\\]))'; $_POST['message'] = preg_replace($rs . '(' . preg_quote($vbseo_cutbburl) . '/)?([^:"\\[\\]]*?\\.\\.[^:"\\[\\]]*?["\\[])#i', '$1' . $pre_repl . '$3', $_POST['message']); do { $_pmsg = $_POST['message']; $_POST['message'] = preg_replace('#(://[^\\"\\]]*?/)([^/\\"\\]]*/)\\.\\./#', '$1', $_POST['message']); } while ($_POST['message'] != $_pmsg); } } } $newpost_name = ''; if ($sec == 'blog_fpdata_presave' || $sec == 'blog_textdata_start' || $sec == 'blog_data_start') { $newpost_name = 'blog'; } if ($sec == 'newpost_process' || $sec == 'newpost_complete') { $newpost_name = 'newpost'; } if ($sec == 'visitormessagedata_start') { $newpost_name = 'message'; } $clean_redir = $newpost_name ? 1 : 0; if (!$newpost_name && $sec == 'postdata_presave') { $newpost_name = 'edit'; } $may_addttl = $clean_redir && (!isset($_POST['vbseo_is_retrtitle']) || isset($_POST['vbseo_retrtitle'])); $force_addttl = $newpost_name && (isset($_POST['vbseo_is_retrtitle']) && isset($_POST['vbseo_retrtitle'])); $addttl = VBSEO_REWRITE_EXT_ADDTITLE && ($force_addttl || $may_addttl); global ${$newpost_name}; if (isset(${$newpost_name})) { $pmsg_a =& ${$newpost_name}; if (isset($pmsg_a['message'])) { $pmsg =& $pmsg_a['message']; } } if ($clean_redir) { vbseo_get_options(); $redurl = $vboptions['bburl2'] . '/' . VBSEO_REDIRECT_URI . '?redirect='; $pmsg = preg_replace('#' . preg_quote($redurl, '#') . '([^"\\]\\[]*)#eis', 'urldecode(\'$1\')', $pmsg); } if ($addttl) { preg_match_all('#\\[url=?\\"?(.*?)\\"?\\](.+?)\\[\\/url\\]#is', $pmsg, $lmatch); for ($i = 0; $i < count($lmatch[0]); $i++) { $ul = trim($lmatch[1][$i]); $ulin = trim($lmatch[2][$i]); if ($ul && !@strstr($ulin, $ul)) { continue; } if (!@strstr($ulin, '://')) { $ulin = 'http://' . $ulin; } if (!$ul) { $ul = $ulin; } if (preg_match('#^http://#', $ulin) && (!VBSEO_REWRITE_EXT_ADDTITLE_BLACKLIST || !preg_match('#' . VBSEO_REWRITE_EXT_ADDTITLE_BLACKLIST . '#i', $ulin))) { vbseo_reverse_formats(); $matchfull = preg_quote('http://' . VBSEO_HTTP_HOST, '#'); $ismatch = false; if (VBSEO_REWRITE_THREADS_ADDTITLE_POST) { $ismatch |= preg_match('#' . $matchfull . '[^"]*?/' . VBSEO_FIND_P_FORMAT . '#is', $ulin); } $ismatch |= preg_match('#' . $matchfull . '[^"]*?/' . VBSEO_FIND_MT_FORMAT . '#is', $ulin); $ismatch |= preg_match('#' . $matchfull . '[^"]*?/' . VBSEO_FIND_T_FORMAT . '#is', $ulin); $ulin_shot = str_replace(VBSEO_TOPREL_FULL, '', $ulin); if (($arr = vbseo_check_url('VBSEO_URL_FORUM_PAGENUM', $ulin_shot)) || ($arr = vbseo_check_url('VBSEO_URL_FORUM', $ulin_shot))) { if (!isset($arr['forum_id']) && (isset($arr['forum_path']) || isset($arr['forum_title']))) { $arr['forum_id'] = vbseo_reverse_forumtitle($arr); } vbseo_get_forum_info(); if (!vbseo_forum_is_public($vbseo_gcache['forum'][$arr['forum_id']])) { $ismatch = true; } } if (!$ismatch) { $pret = vbseo_http_query_full($ulin); $ptitle = vbseo_get_page_title($pret['content'], defined('VBSEO_MAX_TITLE_LENGTH') ? VBSEO_MAX_TITLE_LENGTH : 0); $pcharset = vbseo_get_page_charset($pret['content'], $pret['headers']); $ptitle = vbseo_convert_charset($ptitle, $pcharset); if ($ptitle && $ptitle != $vboptions['bbtitle']) { $pmsg = str_replace($lmatch[0][$i], '[url=' . $ulin . ']' . $ptitle . '[/url]', $pmsg); } } } } } $trackback = VBSEO_EXT_TRACKBACK && ($sec == 'newpost_complete' || $sec == 'threadmanage_update'); $pingback = VBSEO_EXT_PINGBACK && $sec == 'newpost_complete'; if ($pingback || $trackback) { global $found_object_ids; if (!$vboptions['bburl2'] || !$vbseo_gcache['forum']) { vbseo_get_options(); vbseo_prepare_seo_replace(); vbseo_get_forum_info(); } $r_post_id = $pmsg_a['postid']; if (!$r_post_id && $GLOBALS['threadinfo']) { $r_post_id = $GLOBALS['threadinfo']['firstpostid']; } unset($vbseo_gcache['post'][$r_post_id]); $found_object_ids['prepostthread_ids'] = array($r_post_id); vbseo_get_post_thread_info($r_post_id); $threadid = $vbseo_gcache['post'][$r_post_id]['threadid']; vbseo_get_thread_info($threadid); $forumid = $vbseo_gcache['thread'][$threadid]['forumid']; $vbseo_url_ = vbseo_thread_url_postid($r_post_id); $vbseo_url_t = vbseo_thread_url($threadid); if (!strstr($vbseo_url_, '://')) { $vbseo_url_ = $vboptions['bburl2'] . '/' . $vbseo_url_; } if (!strstr($vbseo_url_t, '://')) { $vbseo_url_t = $vboptions['bburl2'] . '/' . $vbseo_url_t; } if (THIS_SCRIPT == 'newthread') { $vbulletin->db->query_write("INSERT INTO " . vbseo_tbl_prefix('vbseo_serviceupdate') . "\n(s_threadid, s_updated)\nVALUES\n('{$threadid}', 0)\n"); } } if ($sec == 'blog_fpdata_postsave') { global $blogman; if ($blogman && ($bid = $blogman->blog['blogid'])) { $vbulletin->db->query_write("INSERT INTO " . vbseo_tbl_prefix('vbseo_serviceupdate') . "\n(s_threadid, s_updated, s_type)\nVALUES\n('{$bid}', 0, 1)\n"); } } if ($trackback && $_REQUEST['sendtrackbacks']) { $tracurls = explode(' ', $_REQUEST['sendtrackbacks']); $tdetails = vbseo_get_thread_details($r_post_id); $tdetails['pagetext'] = preg_replace('#\\[.+?\\]#', '', $tdetails['pagetext']); vbseo_extra_inc('linkback'); foreach ($tracurls as $turl) { if (trim($turl)) { $turl = trim($turl); if (!preg_match('#^http://#', $turl)) { continue; } if (vbseo_pingback_exists($turl, $threadid)) { continue; } $snippet = vbseo_utf8_substr($tdetails['pagetext'], 0, VBSEO_SNIPPET_LENGTH); $res_success = vbseo_do_trackback($turl, $vbseo_url_t, $vbseo_gcache['thread'][$threadid]['title'], $vboptions['bbtitle'], $snippet . '...'); vbseo_store_pingback($vbseo_url_, $turl, 1, $r_postid, 0, $threadid, 0, $_REQUEST['subject'], $snippet, 0, $res_success, 1, false); } } } if ($pingback && vbseo_forum_is_public($vbseo_gcache['forum'][$forumid])) { vbseo_extra_inc('linkback'); preg_match_all('#\\[url=?\\"?(.*?)\\"?\\]#is', $pmsg, $lmatch); for ($i = 0; $i < count($lmatch[0]); $i++) { $ulin = $lmatch[1][$i]; if (preg_match('#^http://#', $ulin) && !strstr($ulin, VBSEO_HTTP_HOST) && (!VBSEO_REWRITE_EXT_ADDTITLE_BLACKLIST || !preg_match('#' . VBSEO_REWRITE_EXT_ADDTITLE_BLACKLIST . '#i', $ulin))) { if (vbseo_pingback_exists($ulin, $threadid)) { continue; } $res_success = vbseo_do_pingback($vbseo_url_, $ulin); if ($res_success >= 0) { vbseo_store_pingback($vbseo_url_, $ulin, 0, $r_postid, 0, $threadid, 0, $_REQUEST['subject'], $snippet, 0, $res_success, 1); } } } } switch ($sec) { case 'blog_entry_start': vbseo_prepend_template('blog_show_entry', '".(($blog[message] = vbseo_process_content_area($blog[message])) ? "":"")."'); vbseo_prepend_template('blog_comment', '".(($response[message] = vbseo_process_content_area($response[message])) ? "":"")."'); break; case 'blog_entry_complete': if (VBSEO_BOOKMARK_BLOG && vbseo_tpl_exists('blog_show_entry')) { $vbseo_url_b = vbseo_http_s_url('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['VBSEO_URI']); $book_t = urlencode($GLOBALS['blog']['title']); $bmlist = vbseo_get_bookmarks(); $vbseo_post_bookmarks = ''; foreach ($bmlist as $bm) { $blink = str_replace('%url%', urlencode($vbseo_url_b), str_replace('%title%', $book_t, $bm[0])); eval('$vbseo_post_bookmarks .= "' . fetch_template('vbseo_blog_bmarkentry') . '";'); } $vbseo_post_bookmarks = str_replace('"', '\\"', $vbseo_post_bookmarks); $bsection_tpl = str_replace('<!--VBSEO_BOOKMARKS-->', $vbseo_post_bookmarks, fetch_template('vbseo_blog_bmarksection')); if (VBSEO_BOOKMARK_BLOG == 1) { $snr = '#(\\"\\.\\(\\(\\$show\\[\'blograting\'\\]\\) \\? \\(\\".*?)(<[^>]*?id=\\\\"blog_title)#is'; $pm = vbseo_tpl_match('blog_show_entry', $snr); $pm[1] = str_replace('id=\\"blograting\\" style=\\"float:$stylevar[right]\\">', 'id=\\"blograting\\" style=\\"text-align:center\\">', $pm[1]); $bsection = str_replace('<!--BLOG_RATING-->', $pm[1], $bsection_tpl); vbseo_modify_template('blog_show_entry', $snr, $bsection . '$2'); } else { vbseo_modify_template('blog_show_entry', '#("\\.\\(\\(\\$' . 'categorybits)#is', $bsection_tpl . '$1', false, '<!--VBSEO_BOOKMARKS-->'); } vbseo_modify_template('blog_show_entry', '#(<div id=\\\\"blog_message\\\\" style=\\\\")(.*?</div>)#', "\$1min-height:60px;\$2\n<br style=\\\"clear:both\\\" />"); } break; case 'global_start': if (!$vbulletin->userinfo['userid'] && VBSEO_CODE_CLEANUP_PREVIEW && THIS_SCRIPT == 'forumdisplay') { $vbulletin->options['threadpreview'] = 0; $vbseo_gcache['var']['vboptchanged'] = true; } if (!$vbulletin->userinfo['userid'] && VBSEO_FORUMJUMP_OFF && $vbulletin && (THIS_SCRIPT == 'forumdisplay' || THIS_SCRIPT == 'showthread')) { $vbulletin->options['useforumjump'] = 0; $vbseo_gcache['var']['vboptchanged'] = true; } if (VBSEO_CATEGORY_ANCHOR_LINKS) { vbseo_modify_template('forumhome_forumbit_level1_nopost', 'href=\\"forumdisplay', 'id=\\"".$forum[\'nametitle\']."\\" name=\\"".$forum[\'nametitle\']."\\" href=\\"forumdisplay'); } if (VBSEO_IN_REFBACK && (THIS_SCRIPT == 'showthread' || THIS_SCRIPT == 'showpost')) { $vbseo_ref = $_SERVER['HTTP_REFERER']; if ($vbseo_ref && !strstr(strtolower($vbseo_ref), VBSEO_HTTP_HOST) && !strstr(strtolower($vbseo_ref), str_replace('www.', '', VBSEO_HTTP_HOST))) { if (!defined('VBSEO_REFBACK_BLACKLIST') || !preg_match('#' . VBSEO_REFBACK_BLACKLIST . '#i', $vbseo_ref)) { vbseo_extra_inc('linkback'); vbseo_ping_proc($vbseo_ref, VBSEO_TOPREL_FULL . VBSEO_REQURL, 2); } } } break; case 'memberlist_bit': global $userinfo, $usercache; $usercache[$userinfo['userid']] = array('userid' => $userinfo['userid'], 'username' => $userinfo['username']); break; case 'ajax_start': if ($_POST['do'] == 'linkbackmod' && ($linkid = addslashes($_POST['id']))) { $ilink = $vbulletin->db->query_first("\nSELECT l.*, t.forumid\nFROM " . vbseo_tbl_prefix('vbseo_linkback') . " l\nLEFT JOIN " . vbseo_tbl_prefix('thread') . " t ON t.threadid = l.t_threadid\nWHERE t_id='{$linkid}'"); $ismod = can_moderate($ilink['forumid'], 'vbseo_linkbacks') || $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator']; if ($ismod) { vbseo_extra_inc('linkback'); if ($_POST['action'] == 'mod') { $vbulletin->db->query_write("\nUPDATE " . vbseo_tbl_prefix('vbseo_linkback') . "\nSET t_approve=IF(t_approve,0,1)\nWHERE t_id='{$linkid}'"); if (!$ilink['t_approve']) { vbseo_send_notification_pingback($ilink['t_threadid'], $ilink['t_postid'], $ilink['t_src_url'], $ilink['t_title'], $ilink['t_text'], 1, 0); } } if ($_POST['action'] == 'ban') { $purl = parse_url($ilink['t_src_url']); if ($purl['host']) { $bdom = str_replace('www.', '', $purl['host']); vbseo_linkback_bandomain($bdom, 1); $vbulletin->db->query_write("\nUPDATE " . vbseo_tbl_prefix('vbseo_linkback') . "\nSET t_deleted = 1\nWHERE t_src_url LIKE 'http%" . addslashes($bdom) . "/%'"); } } if ($_POST['action'] == 'del') { $vbulletin->db->query_write("\nUPDATE " . vbseo_tbl_prefix('vbseo_linkback') . "\nSET t_deleted = 1\nWHERE t_id = '{$linkid}'"); } vbseo_linkback_approve($linkid); header('Content-Type: text/plain;'); header('Connection: Close'); echo $ilink['t_approve'] ? '0' : '1'; } exit; } if ($_POST['do'] == 'updatelinkback') { $vbulletin->input->clean_array_gpc('p', array('linkid' => TYPE_UINT, 'title' => TYPE_STR)); $linkid = $vbulletin->GPC['linkid']; $ilink = $vbulletin->db->query_first("\nSELECT *\nFROM " . vbseo_tbl_prefix('vbseo_linkback') . " l\nWHERE t_id='" . addslashes($linkid) . "'"); $ismod = can_moderate($ilink['forumid'], 'vbseo_linkbacks') || $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator']; if ($ismod) { $ltitle = convert_urlencoded_unicode($vbulletin->GPC['title']); $vbulletin->db->query_write("\nUPDATE " . vbseo_tbl_prefix('vbseo_linkback') . " l\nSET t_title = '" . addslashes($ltitle) . "'\nWHERE t_id = '" . addslashes($linkid) . "'"); } $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_tag('linkhtml', $ltitle); $xml->print_xml(); } break; case 'forumadmin_update_save': global $vboptions, $forumcache; vbseo_get_options(); vbseo_prepare_seo_replace(); $vboptions['vbseo_opt'] = array(); $forumcache2 = $forumcache; $forumcache = ''; vbseo_get_forum_info(true); $forumcache = $forumcache2; vbseo_check_datastore(true); break; case 'private_insertpm_process': global $pmdm; if (is_object($pmdm) && strstr($pmdm->pmtext['message'], '[post]')) { vbseo_startup(); $pmdm->pmtext['message'] = preg_replace('#\\[post\\](\\d+)\\[\\/post\\]#', '[url]' . $vboptions['bburl2'] . '/showthread.php?p=$1#post$1[/url]', $pmdm->pmtext['message']); $GLOBALS['VBSEO_REWRITE_TEXTURLS'] = 1; $pmdm->pmtext['message'] = make_crawlable($pmdm->pmtext['message']); unset($GLOBALS['VBSEO_REWRITE_TEXTURLS']); } break; case 'cache_templates': global $globaltemplates, $show, $bbuserinfo; if ($_REQUEST['ajax']) { if (THIS_SCRIPT == 'blog_post') { $globaltemplates[] = 'blog_comment'; } if (THIS_SCRIPT == 'group') { $globaltemplates[] = 'socialgroups_message'; } if (THIS_SCRIPT == 'album') { $globaltemplates[] = 'picturecomment_message'; } if (THIS_SCRIPT == 'visitormessage') { $globaltemplates[] = 'memberinfo_visitormessage'; } } if (THIS_SCRIPT == 'blog' && $_REQUEST['do'] == 'blog') { $globaltemplates[] = 'vbseo_blog_bmarkentry'; $globaltemplates[] = 'vbseo_blog_bmarksection'; } if (THIS_SCRIPT == 'moderation') { $globaltemplates[] = 'vbseo_linkbacks'; $globaltemplates[] = 'vbseo_linkbackbit'; } if (THIS_SCRIPT == 'showthread' && (VBSEO_IN_PINGBACK || VBSEO_IN_TRACKBACK || VBSEO_IN_REFBACK)) { $globaltemplates[] = 'vbseo_linkbacks'; $globaltemplates[] = 'vbseo_linkbackbit'; $globaltemplates[] = 'vbseo_linkbackmenu'; $globaltemplates[] = 'vbseo_linkbackmenu_entry'; } if (THIS_SCRIPT == 'misc' && $_REQUEST['do'] == 'pingtrackback') { vbseo_safe_redirect('misc.' . VBSEO_VB_EXT . '?do=linkbacks', array('do')); } if (THIS_SCRIPT == 'misc' && $_REQUEST['do'] == 'linkbacks') { $globaltemplates[] = 'vbseo_help_linkback'; } break; case 'member_infractionbit': $GLOBALS['vbseo_gcache']['post'][$dat_proc['postid']] = $dat_proc; break; case 'parse_templates': vbseo_modify_template('socialgroups_grouplist_bit', '#.$#s', '$0".(($GLOBALS[\'vbseo_gcache\'][\'groups\'][$group[\'groupid\']]=$group)?\'\':\'\')."'); vbseo_modify_template('memberinfo_socialgroupbit', '#.$#s', '$0".(($GLOBALS[\'vbseo_gcache\'][\'groups\'][$socialgroup[\'groupid\']]=$socialgroup)?\'\':\'\')."'); vbseo_modify_template('blog_entry_profile', '#.$#s', '$0".(($GLOBALS[\'vbseo_gcache\'][\'blog\'][$this->blog[\'blogid\']]=$this->blog)?\'\':\'\')."'); vbseo_modify_template('blog_entry_profile', '#.$#s', '$0".(($GLOBALS[\'vblog_categories\']=$this->categories)?\'\':\'\')."'); vbseo_modify_template('album_picturebit', '#.$#s', '$0".(($GLOBALS[\'vbseo_gcache\'][\'pic\'][$picture[\'pictureid\']]=$picture)?\'\':\'\')."'); vbseo_modify_template('albumbit', '#.$#s', '$0".(($GLOBALS[\'vbseo_gcache\'][\'album\'][$album[\'albumid\']]=$album)?\'\':\'\')."'); vbseo_modify_template('memberinfo_albumbit', '#.$#s', '$0".(($GLOBALS[\'vbseo_gcache\'][\'album\'][$album[\'albumid\']]=$album)?\'\':\'\')."'); vbseo_prepend_template('memberinfo_visitormessage', '".(($message[message] = vbseo_process_content_area($message[message])) ? "":"")."'); vbseo_prepend_template('socialgroups_message', '".(($message[message] = vbseo_process_content_area($message[message])) ? "":"")."'); vbseo_prepend_template('picturecomment_message', '".(($message[message] = vbseo_process_content_area($message[message])) ? "":"")."'); vbseo_prepend_template('pt_issuenotebit_user', '".(($note[message] = vbseo_process_content_area($note[message])) ? "":"")."'); vbseo_prepend_template('newpost_preview', '".(($previewmessage = vbseo_process_content_area($previewmessage)) ? "":"")."'); if ((THIS_SCRIPT == 'blog' || THIS_SCRIPT == 'blog_post') && VBSEO_PERMALINK_BLOG > 0) { vbseo_modify_template('blog_comment', '#(blogipaddress.*?)(</div>)#s', '$1 <a href=\\"#comment$response[blogtextid]\\"><img src=\\"$stylevar[imagesfolder]/vbseo/anchor.png\\" border=\\"0\\" alt=\\"$vbphrase[vbseo_permalink]\\" class=\\"inlineimg\\" /></a> $2', 0); vbseo_modify_template('blog_comment', '#(OR \\$show\\[\\\'reportlink\\\'\\])#s', '$1 OR 1', 0); } if (THIS_SCRIPT == 'member' || THIS_SCRIPT == 'visitormessage') { $vmurl = $_GET['tab'] && $_GET['tab'] != 'visitor_messaging' ? 'member.php?u=' . $_GET['u'] : ''; $vmurl .= '#vmessage$message[vmid]'; if (VBSEO_PERMALINK_PROFILE == 2) { vbseo_modify_template('memberinfo_visitormessage', '#\\$message\\[date\\]#s', '<a href=\\"' . $vmurl . '\\">$0</a>', 0); } else { if (VBSEO_PERMALINK_PROFILE == 1) { vbseo_modify_template('memberinfo_visitormessage', '#message\\[time\\].*?\\)\\)\\.\\"#s', '$0 - <a href=\\"' . $vmurl . '\\">$vbphrase[vbseo_permalink]</a>', 0); } } vbseo_modify_template('MEMBERINFO', '#(vBulletin\\.register_control\\(\\\\"vB_TabCtrl\\\\", \\\\"profile_tabs\\\\", \\\\"\\$selected_tab\\\\")#s', "var vbseo_opentab=document.location.hash;\nvbseo_opentab = vbseo_opentab.substring(1,vbseo_opentab.length);\n" . '$1 ? \\"$selected_tab\\" : vbseo_opentab'); } if (THIS_SCRIPT == 'album') { if (VBSEO_PERMALINK_ALBUM == 2) { vbseo_modify_template('picturecomment_message', '#\\$message\\[date\\]#s', '<a href=\\"#picturecomment$message[commentid]\\">$0</a>', 0); } else { if (VBSEO_PERMALINK_ALBUM == 1) { vbseo_modify_template('picturecomment_message', '#message\\[time\\].*?\\)\\)\\.\\"#s', '$0 - <a href=\\"#picturecomment$message[commentid]\\">$vbphrase[vbseo_permalink]</a>', 0); } } } if (THIS_SCRIPT == 'group') { $_plink = 'group.' . VBSEO_VB_EXT . '?groupid=' . $_REQUEST['groupid'] . '#gmessage$message[gmid]'; if (VBSEO_PERMALINK_GROUPS == 2) { vbseo_modify_template('socialgroups_message', '#\\$message\\[date\\]#s', '<a href=\\"' . $_plink . '\\">$0</a>', 0); } else { if (VBSEO_PERMALINK_GROUPS == 1) { vbseo_modify_template('socialgroups_message', '#message\\[time\\].*?\\)\\)\\.\\"#s', '$0 - <a href=\\"' . $_plink . '\\">$vbphrase[vbseo_permalink]</a>', 0); } } } if (VBSEO_IN_PINGBACK || VBSEO_IN_TRACKBACK || VBSEO_IN_REFBACK) { if (can_moderate(0, 'vbseo_linkbacks')) { vbseo_modify_template('USERCP_SHELL', '#(do=viewposts&type=moderated.*?</tr>)#is', '$1 <tr> <td class=\\"".($navclass[moderatedlinkbacks]?$navclass[moderatedlinkbacks]:"alt2")."\\"><a class=\\"smallfont\\" href=\\"moderation.php?$session[sessionurl]do=viewlinkbacks\\">$vbphrase[vbseo_moderated_linkbacks]</a></td> </tr>'); } } if (!$vbulletin->userinfo['userid']) { if (VBSEO_CODE_CLEANUP_MEMBER_DROPDOWN) { if (THIS_SCRIPT == 'showthread') { $tplpostbit = vbseo_get_postbit_tpl(); vbseo_modify_template($tplpostbit, '#<script[^>]+?>[^<]*?postmenu_\\$post.*?</script>#is', ''); vbseo_modify_template($tplpostbit, '#<div class=\\\\"vbmenu_popup.*?</div>#is', ''); } if (THIS_SCRIPT == 'blog') { $blog_tpls = array('blog_sidebar_user', 'blog_entry_with_userinfo', 'blog_entry_without_userinfo', 'blog_list_blogs_blog'); foreach ($blog_tpls as $_btpl) { vbseo_modify_template($_btpl, '#<script[^>]+?>[^<]*?blogusermenu.*?</script>#is', ''); vbseo_modify_template($_btpl, '#<div class=\\\\"vbmenu_popup.*?</div>#is', ''); } } } if (THIS_SCRIPT == 'index') { if (VBSEO_CODE_CLEANUP_LASTPOST == 2) { vbseo_modify_template('FORUMHOME', '#<td[^<]+?vbphrase\\[last_post\\]</td>#is', ''); vbseo_modify_template('forumhome_forumbit_level1_nopost', '#<td[^<]+?vbphrase\\[last_post\\].*?</td>#is', ''); vbseo_modify_template('FORUMDISPLAY', '#<td[^<]+?(<span[^<]+?)?(<a[^<]+?)?vbphrase\\[last_post\\].*?</td>#is', ''); vbseo_modify_template('forumhome_forumbit_level2_post', '#<td[^<]+?forum\\[lastpostinfo\\].*?</td>#is', ''); vbseo_modify_template('forumhome_forumbit_level1_post', '#<td[^<]+?forum\\[lastpostinfo\\].*?</td>#is', ''); vbseo_modify_template('threadbit', '#\\(\\(\\$show\\[\'threadmoved\'.*?/td>\\s*"\\)\\)\\.#is', ''); } if (VBSEO_CODE_CLEANUP_LASTPOST == 1) { vbseo_modify_template('threadbit', '#<a href=[^>]*?->[^>]*?->[^>]*?lastpostid.*?</a>#is', ''); vbseo_modify_template('forumhome_lastpostby', '#<a href=[^>]*?->[^>]*?->[^>]*?lastpostid.*?</a>#is', ''); $vbphrase['by_x'] = strip_tags($vbphrase['by_x']); } vbseo_modify_template('threadbit', '#<a href=\\\\"misc\\.php\\?do=whoposted.*?>(.*?)</a>#is', '$1'); } } break; case 'moderation_start': if ($_REQUEST['do'] == 'viewlinkbacks') { global $navbar, $navclass, $HTML, $navbits, $headinclude, $header, $footer, $db, $show, $navclass, $notices, $pmbox, $notifications_total; if (!can_moderate(0, 'vbseo_linkbacks')) { print_no_permission(); } vbseo_startup(); $vbseolinkbackbits = ''; $perpage = 20; $pagenumber = $_GET['page'] ? $_GET['page'] : 1; $vbseodb = vbseo_get_db(); $tp = $vbseodb->vbseodb_query_first("\nSELECT COUNT(*) as cnt\nFROM " . vbseo_tbl_prefix('vbseo_linkback') . "\nWHERE t_incoming=1 AND t_deleted=0 AND t_approve=0"); $totalposts = $tp['cnt']; $vbseopings = $vbseodb->vbseodb_query($q = "\nSELECT t_id, t_time, t_src_url, t_dest_url, t_type, t_postid, t_postcount, t_threadid, t_page, t_title, t_text, t_approve, forumid\nFROM " . vbseo_tbl_prefix('vbseo_linkback') . "\nLEFT JOIN " . vbseo_tbl_prefix('thread') . " on threadid=t_threadid\nWHERE t_incoming=1 AND t_deleted=0 AND t_approve=0\nORDER BY t_time " . (preg_match('#^(asc|desc)$#i', VBSEO_DEFAULT_LINKBACKS_ORDER) ? VBSEO_DEFAULT_LINKBACKS_ORDER : "DESC") . " LIMIT " . ($pagenumber - 1) * $perpage . "," . $perpage); $pagenav = construct_page_nav($pagenumber, $perpage, $totalposts, "moderation.php?do=viewlinkbacks"); while ($vbseoping = @$vbseodb->funcs['fetch_assoc']($vbseopings)) { if (can_moderate($vbseoping['forumid'], 'vbseo_linkbacks')) { $vbseoping['postno'] = $vbseoping['t_postcount']; $vbseoping['ismod'] = 1; $vbseoping['date'] = vbdate($vbulletin->options['dateformat'], $vbseoping['t_time'], true); $vbseoping['time'] = vbdate($vbulletin->options['timeformat'], $vbseoping['t_time'], true); $vbseoping['t_src_url'] = htmlentities($vbseoping['t_src_url']); $vbseoping['t_dest_url'] = htmlentities($vbseoping['t_dest_url']); $vbseoping['t_text_nohtml'] = htmlspecialchars(strip_tags($vbseoping['t_text'])); $vbseoping['t_title_html'] = htmlspecialchars($vbseoping['t_title']); eval('$vbseolinkbackbits .= "' . fetch_template('vbseo_linkbackbit') . '";'); } } if ($vbseolinkbackbits) { eval('$HTML = "' . fetch_template('vbseo_linkbacks') . '";'); } else { $HTML = $vbphrase['vbseo_no_linkbacks_found']; } unset($vbseolinkbackbits); $navbits[''] = $vbphrase['moderation']; $navbits = construct_navbits($navbits); construct_usercp_nav('moderatedlinkbacks'); eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('USERCP_SHELL') . '");'); } break; case 'misc_start': if ($_REQUEST['do'] == 'linkbacks') { global $navbits, $headinclude, $header, $footer; $navbits = construct_navbits(array('faq.' . VBSEO_VB_EXT . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['faq'], '' => $vbphrase['vbseo_linkbacks'])); @extract($GLOBALS); @eval('$navbar = "' . fetch_template('navbar') . '";'); @eval('print_output("' . fetch_template('vbseo_help_linkback') . '");'); } break; case 'archive_forum_thread': if ($GLOBALS['pda'] == 'vbseo') { $GLOBALS['pda'] = false; } break; case 'archive_navigation': if (VBSEO_ARCHIVE_ORDER_DESC && !$GLOBALS['pda']) { $GLOBALS['pda'] = 'vbseo'; } break; case 'forumrules': $pingrules = '<div>" . construct_phrase("$vbphrase[vbseo_trackback_is_x]", "misc.".VBSEO_VB_EXT."?do=linkbacks#trackbacks", "' . iif(VBSEO_EXT_TRACKBACK, $vbphrase['on'], $vbphrase['off']) . '") . "</div> <div>" . construct_phrase("$vbphrase[vbseo_pingback_is_x]", "misc.".VBSEO_VB_EXT."?do=linkbacks#pingbacks", "' . iif(VBSEO_EXT_PINGBACK, $vbphrase['on'], $vbphrase['off']) . '") . "</div> <div>" . construct_phrase("$vbphrase[vbseo_refback_is_x]", "misc.".VBSEO_VB_EXT."?do=linkbacks#refbacks", "' . iif(VBSEO_IN_REFBACK, $vbphrase['on'], $vbphrase['off']) . '") . "</div>'; vbseo_modify_template('forumrules', '#(html_code_is_x.*?</div>)#s', '$1' . $pingrules, 0, '<!--LINKBACK_POSTRULES-->'); break; case 'showthread_complete': global $onload; if (!$onload) { $onload = "if (is_ie || is_moz) { var cpost=document.location.hash;if(cpost){ if(cobj = fetch_object(cpost.substring(1,cpost.length)))cobj.scrollIntoView(true); }}"; } if (VBSEO_IN_PINGBACK || VBSEO_IN_TRACKBACK || VBSEO_IN_REFBACK) { global $vbseo_bookmarks, $vbseo_linkback_menu, $vbseo_linkback_menu_list, $show, $vbseo_linkback_uri, $thread; $vbseo_url_t = urlencode($vboptions['bburl2'] . '/' . vbseo_thread_url($thread['threadid'])); $book_t = urlencode($thread['title']); $is_public = vbseo_forum_is_public($GLOBALS['forum'], $GLOBALS['foruminfo'], false, true); if ($is_public && VBSEO_BOOKMARK_THREAD) { $bmlist = vbseo_get_bookmarks(); $vbseo_bookmarks = ''; $bmno = 0; foreach ($bmlist as $bm) { $vbseo_bookmarks .= '<tr><td class="vbmenu_option"><img class="inlineimg" src="' . $bm[1] . '" alt="' . $bm[2] . '" /> <a href="' . str_replace('%url%', $vbseo_url_t, str_replace('%title%', $book_t, $bm[0])) . '" target="_blank">' . $bm[2] . '</a><a name="vbseodm_' . $bmno++ . '"></a></td></tr>'; } } eval('$vbseo_linkback_menu = "' . fetch_template('vbseo_linkbackmenu_entry') . '";'); vbseo_modify_template('SHOWTHREAD', '#(<td[^>]*?threadtools)#i', '\\$vbseo_linkback_menu$1', 0, '<!--LINKBACK_MENU-->'); eval('$vbseo_linkback_menu_list = "' . fetch_template('vbseo_linkbackmenu') . '";'); if (!vbseo_tpl_search('SHOWTHREAD', '$vbseo_linkback_menu_list')) { vbseo_modify_template('SHOWTHREAD', '#(</body>)#is', '\\$vbseo_linkback_menu_list' . '$1'); } if ($_GET['nojs']) { preg_match('#<table.*?>(.*?)</table>#is', $vbseo_linkback_menu, $vbseo_m); $vbseo_m[1] = str_replace('vbmenu_option', 'alt1', $vbseo_m[1]); $vbseo_m[1] = str_replace('<td', '<td colspan="2"', $vbseo_m[1]); vbseo_modify_template('SHOWTHREAD', "#(sendtofriend\\.gif.*?sendtofriend\\.gif.*?</tr>)#is", "\$1" . addslashes($vbseo_m[1])); } } break; case 'showthread_post_start': global $vbseolinkbacks, $vbcollapse, $vbseo_linkback_uri, $thread, $db, $show, $found_object_ids; if (defined('VBSEO_PRIVATE_REDIRECT_POSTID')) { vbseo_get_options(); if (!($mode_nonlinear = vbseo_is_threadedmode())) { vbseo_get_forum_info(); $r_post_id = VBSEO_PRIVATE_REDIRECT_POSTID; $found_object_ids['prepostthread_ids'] = array($r_post_id); $parr = vbseo_get_post_thread_info($r_post_id, true); $threadid = $parr[$r_post_id]['threadid']; vbseo_get_thread_info($threadid); $excpars = array('p', 'page'); $vbse_rurl = vbseo_thread_url_postid($r_post_id, isset($_GET['page']) ? $_GET['page'] : 1, $mode_nonlinear); if ($vbse_rurl) { vbseo_url_autoadjust($vbse_rurl, $excpars, false); } } } if (VBSEO_IN_PINGBACK || VBSEO_IN_TRACKBACK || VBSEO_IN_REFBACK) { $vbseolinkbacks = ''; vbseo_get_options(); vbseo_get_forum_info(); $vbseo_gcache['thread'][$thread['threadid']] = $thread; $vbseo_linkback_uri = vbseo_thread_url($thread['threadid']); if (!strstr($vbseo_linkback_uri, '://')) { $vbseo_linkback_uri = preg_replace('#/$#', '', $vbulletin->options['bburl']) . '/' . $vbseo_linkback_uri; } $showactusers = $vboptions['showthreadusers'] == 1 || $vboptions['showthreadusers'] == 2 || ($vboptions['showthreadusers'] > 2 and $vbulletin->userinfo['userid']); if (!vbseo_tpl_search('SHOWTHREAD', '$vbseolinkbacks')) { $search_for = $showactusers ? '".(($show[\'activeusers\']' : '$similarthreads'; if (!vbseo_tpl_search('SHOWTHREAD', $search_for)) { $search_for = '<!-- currently active users -->'; } vbseo_modify_template('SHOWTHREAD', $search_for, "\$vbseolinkbacks\n{$search_for}"); } $vbseolinkbackbits = ''; $vbseo_linkbacks_no = 0; $ismod = can_moderate($thread['forumid'], 'vbseo_linkbacks') || $vbulletin && $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator']; if ($thread['vbseo_linkbacks_no'] || $ismod) { $vbseodb = vbseo_get_db(); $vbseopings = $vbseodb->vbseodb_query("\nSELECT t_id, t_time, t_src_url, t_dest_url, t_type, t_postid, t_postcount, t_threadid, t_page, t_title, t_text, t_approve\nFROM " . vbseo_tbl_prefix('vbseo_linkback') . "\nWHERE t_incoming=1 AND t_deleted=0 AND t_wait=0\nAND " . ($ismod ? '' : 't_approve>0 AND ') . "t_threadid = '" . $thread['threadid'] . "' " . "ORDER BY t_time " . (preg_match('#^(asc|desc)$#i', VBSEO_DEFAULT_LINKBACKS_ORDER) ? VBSEO_DEFAULT_LINKBACKS_ORDER : "DESC")); while ($vbseoping = @$vbseodb->funcs['fetch_assoc']($vbseopings)) { $vbseoping['postno'] = $vbseoping['t_postcount']; $vbseoping['ismod'] = $ismod; $vbseoping['date'] = vbdate($vbulletin->options['dateformat'], $vbseoping['t_time'], true); $vbseoping['time'] = vbdate($vbulletin->options['timeformat'], $vbseoping['t_time'], true); $vbseoping['t_text_nohtml'] = htmlspecialchars(strip_tags($vbseoping['t_text'])); $vbseoping['t_title_html'] = htmlspecialchars($vbseoping['t_title']); if ($vbseoping['t_postid']) { $vbseo_gcache['postpings'][$vbseoping['t_postid']]++; } else { $vbseo_gcache['postcounts'][vbseo_thread_pagenum($vbseoping['t_page'] - 1, 0) + 1]++; } eval('$vbseolinkbackbits .= "' . fetch_template('vbseo_linkbackbit') . '";'); $vbseo_linkbacks_no++; } if ($vbseo_linkbacks_no) { eval('$vbseolinkbacks = "' . fetch_template('vbseo_linkbacks') . '";'); if ($showactusers) { $vbseolinkbacks = '<br />' . $vbseolinkbacks; } else { $vbseolinkbacks = $vbseolinkbacks . '<br />'; } } unset($vbseolinkbackbits); } } break; case 'postbit_display_complete': global $thread, $vbseo_lastmod; if (!isset($vbseo_lastmod) || $dat_proc['dateline'] > $vbseo_lastmod) { $vbseo_lastmod = $dat_proc['dateline']; } $dat_proc['preposts'] = $dat_proc['postcount']; $postcache[$dat_proc['postid']] = $dat_proc; $vbseo_gcache['thread'][$thread['threadid']] = $thread; $vbseo_postbit_pingback = VBSEO_POSTBIT_PINGBACK > 0 && THIS_SCRIPT != 'private' && THIS_SCRIPT != 'member'; $vbseo_bookmark = VBSEO_BOOKMARK_POST; if ($vbseo_postbit_pingback || $vbseo_bookmark) { if (!$vboptions['bburl2']) { vbseo_get_options(); vbseo_prepare_seo_replace(); vbseo_get_forum_info(); } $GLOBALS['post']['linkbacksno'] = $vbseo_gcache['postpings'][$GLOBALS['post']['postid']] + $vbseo_gcache['postcounts'][$GLOBALS['post']['postcount']]; $tplpostbit = vbseo_get_postbit_tpl(); if (!defined('VBSEO_POSTBIT_PINGBACK_CHG_' . $tplpostbit) && vbseo_tpl_exists($tplpostbit)) { define('VBSEO_POSTBIT_PINGBACK_CHG_' . $tplpostbit, 1); $is_public = vbseo_forum_is_public($GLOBALS['forum'], $GLOBALS['foruminfo'], false, true); if ($is_public && $vbseo_bookmark && THIS_SCRIPT == 'showthread' && ($bmlist = vbseo_get_bookmarks())) { $vbseo_url_t = urlencode($vboptions['bburl2'] . '/' . vbseo_thread_url($thread['threadid'], $_GET['page']) . '#') . '$post[postid]'; $vbseo_url_t_iis = urlencode($vboptions['bburl2'] . '/' . vbseo_thread_url($thread['threadid'], $_GET['page'])); $book_t = urlencode($thread['title']); $vbseo_post_bookmarks = ''; foreach ($bmlist as $bm) { $vbseo_post_bookmarks .= '<a href=\\"' . str_replace('%url%', $vbseo_url_t, str_replace('%title%', $book_t, $bm[0])) . '\\" target=\\"_blank\\"><img src=\\"' . $bm[1] . '\\" alt=\\"' . $bm[3] . '\\" border=\\"0\\" /></a>'; } $search_for = '<!--VBSEO_BOOKMARKS-->'; if (!vbseo_tpl_search($tplpostbit, $search_for)) { $search_for = '".(($post[\'editlink\'])'; } vbseo_modify_template($tplpostbit, $search_for, '<div style=\\"float:$stylevar[left]\\">' . $vbseo_post_bookmarks . "</div>\n" . $search_for); } if ($vbseo_postbit_pingback) { $pingtpl = '".($post[\'linkbacksno\']?"<a href=\\"' . ($_POST['ajax'] || THIS_SCRIPT != 'showthread' ? 'showthread.' . VBSEO_VB_EXT . '?p=$post[postid]' : "") . '#linkbacks\\"><img class=\\"inlineimg\\" src=\\"images/vbseo/post_linkback.gif\\" alt=\\"".construct_phrase("$vbphrase[vbseo_no_links_to_this_post]",$post[linkbacksno])."\\" border=\\"0\\" /></a> ":"")."'; $pingtpl2 = '<a href=\\"' . ($_POST['ajax'] || THIS_SCRIPT != 'showthread' ? 'showthread.' . VBSEO_VB_EXT . '?p=$post[postid]' : '#post$post[postid]') . '\\" title=\\"".$vbphrase[\'vbseo_link_to_this_post\']."\\">".$vbphrase[\'vbseo_permalink\']."</a>'; if (VBSEO_POSTBIT_PINGBACK == 1) { $pingtpl .= $pingtpl2; } if (vbseo_tpl_search($tplpostbit, '<!--PERMALINK_INFO-->')) { vbseo_modify_template($tplpostbit, '<!--PERMALINK_INFO-->', $pingtpl); } else { if (VBSEO_POSTBIT_PINGBACK == 1) { vbseo_modify_template($tplpostbit, '#(\\$show\\[\'messageicon\'\\] OR \\$post\\[\'title\'\\])(.*?)(<div.*?</div>)#s', '$1 OR 1$2<table cellspacing=\\"0\\" cellpadding=\\"0\\" width=\\"100%\\" border=\\"0\\"> <tr><td>$3</td> <td><div class=\\"smallfont\\" style=\\"float:right\\">' . $pingtpl . '</div></td> </tr></table>'); } else { vbseo_modify_template($tplpostbit, '#("\\.\\(\\(\\$show\\[\'postcount\'\\])#s', $pingtpl . '$1'); } if (VBSEO_POSTBIT_PINGBACK == 3) { vbseo_modify_template($tplpostbit, '#("\\.\\(\\(\\$show\\[\'postcount\'\\].*?</a>)#s', '$1 (<b>' . $pingtpl2 . '</b>)'); } } } } } break; case 'forumhome_complete': global $vbseo_onload; if (!$onload) { $vbseo_onload = " onload=\"if (is_ie || is_moz) { var cpost=document.location.hash;if(cpost){ if(cobj = fetch_object(cpost.substring(1,cpost.length)))cobj.scrollIntoView(true); }}\""; vbseo_modify_template('FORUMHOME', '<body>', '<body$vbseo_onload>'); } if (!is_array($GLOBALS['birthdays'])) { preg_match_all('#<a href="[^"]*?member\\.php\\?u=(\\d+)".*?>(.+?)<#', $GLOBALS['birthdays'], $birthm); foreach ($birthm[1] as $k => $v) { $GLOBALS['usercache'][$v] = array('userid' => $v, 'username' => $birthm[2][$k]); } } break; case 'threadmanage_update': global $threadinfo; if ($threadinfo['title'] != $_REQUEST['title']) { $vbseodb = vbseo_get_db(); $vbseodb->vbseodb_query("UPDATE " . vbseo_tbl_prefix('post') . "\nSET title = '" . $vbseodb->vbseodb_escape_string('re: ' . $_REQUEST['title']) . "'\nWHERE threadid = " . intval($threadinfo['threadid']) . " AND\ntitle = '" . $vbseodb->vbseodb_escape_string('re: ' . $threadinfo['title']) . "'"); } break; case 'editpost_edit_complete': case 'newreply_form_complete': case 'newthread_form_complete': case 'threadmanage_complete': global $db, $disablesmiliesoption, $threadmanagement, $posticons; if (VBSEO_REWRITE_EXT_ADDTITLE) { $disablesmiliesoption = '<div><label for="qr_retrtitle"><input type="checkbox" name="vbseo_retrtitle" value="1" id="qr_retrtitle" ' . ($_POST['vbseo_retrtitle'] || !isset($_POST['vbseo_is_retrtitle']) ? ' checked' : '') . '/>' . $vbphrase['vbseo_auto_retrieve_titles'] . '</label> <input type="hidden" name="vbseo_is_retrtitle" value="1" /></div>' . $disablesmiliesoption; } if (VBSEO_EXT_TRACKBACK && in_array($sec, array('newthread_form_complete', 'threadmanage_complete', 'newreply_form_complete')) && (!$GLOBALS['threadinfo']['threadid'] || $GLOBALS['threadinfo']['open'] == 1)) { $vbseodb = vbseo_get_db(); $vbseopings = $vbseodb->vbseodb_query("\nSELECT t_time, t_dest_url, t_approve\nFROM " . vbseo_tbl_prefix('vbseo_linkback') . "\nWHERE t_incoming=0 AND t_type=1 AND t_threadid = '" . (isset($GLOBALS['threadinfo']) ? $GLOBALS['threadinfo']['threadid'] : $thread['threadid']) . "'\nORDER BY t_time DESC"); $plist = ''; while ($vbseoping = @$vbseodb->funcs['fetch_assoc']($vbseopings)) { $plist .= '<li><strong>' . (strlen($vbseoping['t_dest_url']) > 50 ? substr($vbseoping['t_dest_url'], 0, 50) . '...' : $vbseoping['t_dest_url']) . '</strong></li>'; } if ($plist) { $plist = "<div>" . $vbphrase[vbseo_already_pinged] . ":<ul type=\"disc\">{$plist}</ul></div>"; } $tracklegend = ' <fieldset class="fieldset"> <legend>' . $vbphrase['vbseo_trackback'] . '</legend> <div style="padding:' . $stylevar['formspacer'] . 'px"> ' . $vbphrase['vbseo_send_trackbacks_to'] . ': <div><label for="trackbackto"><input type="text" class="bginput" size="50" name="sendtrackbacks" value="' . $_REQUEST['sendtrackbacks'] . '" id="trackbackto" tabindex="1" /></label> </div> ' . $plist . ' </div> </fieldset> '; if (in_array($sec, array('threadmanage_complete', 'newreply_form_complete', 'newthread_form_complete'))) { $posticons = $tracklegend . $posticons; } } break; } if (VBSEO_GOOGLE_AD_SEC) { $sps = $usps = array(); switch ($sec) { case 'forumdisplay_complete': $sps[] =& $GLOBALS['threadbits']; break; case 'forumbit_display': $sps[] =& $GLOBALS['forum']['title']; break; case 'forumhome_complete': $sps[] =& $GLOBALS['forumbits']; break; case 'postbit_display_complete': $GLOBALS['post']['title_original'] = $GLOBALS['post']['title']; $GLOBALS['post']['message_original'] = $GLOBALS['post']['message']; $sps[] =& $GLOBALS['post']['message']; $sps[] =& $GLOBALS['post']['title']; $usps[] =& $GLOBALS['post']['signature']; $usps[] =& $GLOBALS['post']['musername']; break; } for ($i = 0; $i < count($sps); $i++) { if ($sps[$i]) { $sps[$i] = vbseo_google_ad_section($sps[$i]); } } for ($i = 0; $i < count($usps); $i++) { if ($usps[$i]) { $usps[$i] = vbseo_google_ad_section($usps[$i], true); } } } }
$vbseo_found = true; } } else { if (VBSEO_REWRITE_THREADS && ($vbseo_arr = vbseo_check_url('VBSEO_URL_THREAD_GOTOPOST_PAGENUM', $vbseo_url_)) || ($vbseo_arr = vbseo_check_url('VBSEO_URL_THREAD_GOTOPOST', $vbseo_url_))) { vbseo_set_self('showthread.' . VBSEO_VB_EXT . '?' . VBSEO_POSTID_URI . '=' . $vbseo_arr['post_id'] . ($vbseo_arr['thread_page'] > 1 ? '&' . VBSEO_PAGENUM_URI . '=' . $vbseo_arr['thread_page'] : '')); $vbseo_found_fn = 'showthread.' . VBSEO_VB_EXT; $vbseo_found = true; define('VBSEO_PRIVATE_REDIRECT_POSTID', $vbseo_arr['post_id']); } else { if (VBSEO_REWRITE_THREADS && ($vbseo_arr2 = $vbseo_arr = vbseo_check_url('VBSEO_URL_THREAD_NEXT', $vbseo_url_)) || ($vbseo_arr3 = $vbseo_arr = vbseo_check_url('VBSEO_URL_THREAD_PREV', $vbseo_url_))) { vbseo_get_forum_info(); vbseo_prepare_seo_replace(); vbseo_get_thread_info($vbseo_arr['thread_id']); $nthread = vbseo_get_next_thread($vbseo_arr['thread_id'], $vbseo_arr3 ? true : false); if ($nthread['threadid']) { vbseo_get_thread_info($nthread['threadid']); $vbseo_url_ = vbseo_thread_url($nthread['threadid']); vbseo_safe_redirect($vbseo_url_); } else { vbseo_set_self('showthread.' . VBSEO_VB_EXT . '?' . VBSEO_THREADID_URI . '=' . $vbseo_arr['thread_id'] . '&goto=' . ($vbseo_arr3 ? 'nextoldest' : 'nextnewest')); $vbseo_found_fn = 'showthread.' . VBSEO_VB_EXT; $vbseo_found = true; } } else { if (VBSEO_REWRITE_MEMBER_LIST && ($vbseo_arr = vbseo_check_url('VBSEO_URL_MEMBERLIST_PAGENUM', $vbseo_url_))) { vbseo_set_self('memberlist.' . VBSEO_VB_EXT . '?' . ($vbseo_arr['page'] > 1 ? VBSEO_PAGENUM_URI . '=' . $vbseo_arr['page'] : '')); $vbseo_found_fn = 'memberlist.' . VBSEO_VB_EXT; $vbseo_found = true; } else { if (VBSEO_REWRITE_MEMBER_LIST && ($vbseo_arr = vbseo_check_url('VBSEO_URL_MEMBERLIST', $vbseo_url_))) { vbseo_set_self('memberlist.' . VBSEO_VB_EXT);
function vbseo_attachment_url($attid, $reformat = '', $d = '', $thumb = '') { global $vbseo_gcache, $found_object_ids; $atarr = $vbseo_gcache['attach'][$attid]; $postid = $atarr['postid']; if (!$attid || !$postid) { return ''; } if (!$vbseo_gcache['post'][$postid]) { vbseo_get_post_thread_info($found_object_ids['postthread_ids']); vbseo_get_thread_info($found_object_ids['postthreads']); } $threadid = $vbseo_gcache['post'][$postid]['threadid']; if (!$threadid) { return ''; } $forumid = $vbseo_gcache['thread'][$threadid]['forumid']; vbseo_forum_seotitle($vbseo_gcache['forum'][$forumid]); $t2 =& $vbseo_gcache['thread'][$threadid]['seotitle']; if (!$t2) { $t2 = vbseo_filter_text($vbseo_gcache['thread'][$threadid]['threadtitle']); } if ($d) { $attid .= 'd' . $d; } if ($thumb) { $attid .= 't'; } $replace = array('%attachment_id%' => $attid, '%original_filename%' => vbseo_filter_text($atarr['filename'], '.'), '%thread_title%' => $vbseo_gcache['thread'][$threadid]['seotitle'], '%forum_title%' => $vbseo_gcache['forum'][$forumid]['seotitle'], '%forum_path%' => $vbseo_gcache['forum'][$forumid]['path'], '%forum_id%' => $forumid); $rets = str_replace(array_keys($replace), $replace, $reformat ? $reformat : VBSEO_ATTACHMENTS_PREFIX . VBSEO_URL_ATTACHMENT); return $rets; }
function make_crawlable(&$newtext) { if (!VBSEO_ENABLED && !isset($_COOKIE['VBSEO_ON_MORE'])) { return $newtext; } if (VBSEO_IGNOREPAGES && (preg_match('#(' . VBSEO_IGNOREPAGES . ')#i', VBSEO_REQURL) || preg_match('#(' . VBSEO_IGNOREPAGES . ')#i', VBSEO_BASE))) { return $newtext; } @define('VBSEO_PROCESS', true); error_reporting(0); vbseo_addon_function('postprocess', $newtext); restore_error_handler(); global $vboptions, $vbulletin, $bbuserinfo, $_COOKIE, $HTTP_COOKIE_VARS; global $vbseo_gcache, $seo_preg_replace, $seo_links_replace, $tempusagecache, $threadcache, $usercache, $found_object_ids; if (isset($_COOKIE['VBSEO_EXPOSE_MORE'])) { Header('X-Processed-By: vBSEO ' . VBSEO_VERSION2_MORE . ' (http://www.vbseo.com)'); } if (VBSEO_CLEANUP_REDIRECT) { $vbseo_non_clean = array('styleid' => array(), 'view' => array('hybrid', 'threaded', 'linear'), 'mode' => array('hybrid', 'threaded', 'linear')); if (THIS_SCRIPT == 'member') { $vbseo_non_clean['do'] = array('getinfo'); } foreach ($vbseo_non_clean as $vbseo_nn => $vbseo_nnopt) { if (isset($_GET[$vbseo_nn]) && (!$vbseo_nnopt || in_array($_GET[$vbseo_nn], $vbseo_nnopt))) { vbseo_safe_redirect(VBSEO_REQURL, array_keys($vbseo_non_clean)); } } } vbseo_get_options(); if (defined('VBSEO_EXPIRED_MORE_LICENSE') || isset($_COOKIE['VBSEO_OFF_MORE']) || isset($_GET['VBSEO_OFF_MORE'])) { return $newtext; } if (VBSEO_LASTMOD_HEADER) { $isloggedin = $bbuserinfo['userid'] <= 0 ? '' : 'yes'; $isloggedin_changed = !isset($_COOKIE['vbseo_loggedin']) || $_COOKIE['vbseo_loggedin'] != $isloggedin; if ($isloggedin_changed) { setcookie('vbseo_loggedin', $isloggedin, $isloggedin ? time() + 3600 : time() - 3600, '/'); } if (!$isloggedin && THIS_SCRIPT == 'showthread') { $lmdate_txt = gmdate('D, d M Y H:i:s', $GLOBALS['vbseo_lastmod'] ? $GLOBALS['vbseo_lastmod'] : time() - 3) . ' GMT'; @header('Last-Modified: ' . $lmdate_txt); if (!VBSEO_IS_ROBOT) { $newtext = str_replace('</head>', "\n<script type=\"text/javascript\"><!--\nfunction vbseo_cache_check()\n{\nif(document.cookie.indexOf('vbseo_loggedin=yes')>0 && \ndocument.cookie.indexOf('vbseo_redirect=yes')<0)\n{\ndocument.cookie = 'vbseo_redirect=yes; path=/';\ndocument.location.reload(true);\n}\n}\nsetTimeout('vbseo_cache_check()', 5); \n//-->\n</script>\n</head>\n", $newtext); } } if ($_COOKIE['vbseo_redirect']) { setcookie('vbseo_redirect', '', time() - 3600, '/'); } } vbseo_check_stripsids(); vbseo_prepare_seo_replace(); if (isset($GLOBALS['vbseo_find_pids']) && $GLOBALS['vbseo_find_pids']) { vbseo_get_posts_info($GLOBALS['vbseo_find_pids']); } foreach ($vbseo_gcache['post'] as $pid => $pv) { $found_object_ids['postthreads'][] = $pv['threadid']; } vbseo_find_ids($newtext); $vbseo_gcache['thread'] = array(); vbseo_get_forum_info(true); if (VBSEO_SITEMAP_MOD && VBSEO_IS_ROBOT) { vbseo_hit_log(); } global $VBSEO_REWRITE_TEXTURLS; if (!$VBSEO_REWRITE_TEXTURLS) { define('VBSEO_SHOW_COPYRIGHT', !isset($tempusagecache['STANDARD_REDIRECT']) && !isset($tempusagecache['WHOPOSTED']) && !isset($tempusagecache['ATTACHMENTS']) && !isset($tempusagecache['SHOWTHREAD_SHOWPOST']) && !isset($tempusagecache['BUDDYLIST']) && !isset($tempusagecache['smiliepopup']) && !isset($tempusagecache['reputation']) && !isset($tempusagecache['im_message']) && !isset($tempusagecache['newattachment']) && THIS_SCRIPT != 'blunts_whodownloaded_ip'); } if (!$VBSEO_REWRITE_TEXTURLS) { if (VBSEO_SHOW_COPYRIGHT && !defined('VBSEO_BRANDING_FREE')) { if (VBSEO_COPYRIGHT == 0) { $vbseo_host = VBSEO_HTTP_HOST; $vbseo_cpno = ord($vbseo_host[strlen($vbseo_host) / 2]) + strlen($vbseo_host); $vbseo_cpno = $vbseo_cpno % 4; } else { $vbseo_cpno = VBSEO_COPYRIGHT - 1; } $vbseo_cpa = array('Search Engine Friendly URLs by vBSEO ' . VBSEO_VERSION2_MORE, 'Content Relevant URLs by vBSEO ' . VBSEO_VERSION2_MORE, 'Search Engine Optimization by vBSEO ' . VBSEO_VERSION2_MORE, 'SEO by vBSEO ' . VBSEO_VERSION2_MORE, 'Search Engine Friendly URLs by vBSEO ' . VBSEO_VERSION2_MORE . ' ©2008, Crawlability, Inc.', 'Content Relevant URLs by vBSEO ' . VBSEO_VERSION2_MORE . ' ©2008, Crawlability, Inc.', 'Search Engine Optimization by vBSEO ' . VBSEO_VERSION2_MORE . ' ©2008, Crawlability, Inc.', 'SEO by vBSEO ' . VBSEO_VERSION2_MORE . ' ©2008, Crawlability, Inc.', 'LinkBacks Enabled by vBSEO ' . VBSEO_VERSION2_MORE, 'LinkBacks Enabled by vBSEO ' . VBSEO_VERSION2_MORE . ' © 2008, Crawlability, Inc.'); $vbseo_cpno = $vbseo_cpno % count($vbseo_cpa); $cp_str = $vbseo_cpa[$vbseo_cpno]; $clinked = !strstr($cp_str, '©'); if (VBSEO_NOVER_INFO) { $cp_str = str_replace(' ' . VBSEO_VERSION2_MORE, '', $cp_str); } if (VBSEO_AFFILIATE_ID) { $cp_str = str_replace($clinked ? 'vBSEO' : $cp_str, '<a href="http://www.vbseo.com/' . VBSEO_AFFILIATE_ID . '/">' . ($clinked ? 'vBSEO' : $cp_str) . '</a>', $cp_str); } else { if ($clinked) { $cp_str = str_replace('vBSEO', '<a href="http://www.crawlability.com/vbseo/">vBSEO</a>', $cp_str); } } if (defined('VBSEO_UNREG')) { $cp_str .= ' (<span style="color:red;font-weight:bold;">' . (preg_match('#^vresp(.*)#', $vboptions['vbseo_confirmation_code'], $unregpm) ? $unregpm[1] : 'Unregistered') . '</span>)'; } $lfollow = THIS_SCRIPT == 'index' || THIS_SCRIPT == 'adv_index'; if (!$lfollow) { $cp_str = str_replace('<a', '<a rel="nofollow"', $cp_str); } if (VBSEO_GOOGLE_AD_SEC) { $cp_str = vbseo_google_ad_section($cp_str, true); } if (strstr($newtext, '<!--VBSEO_COPYRIGHT-->')) { $newtext = str_replace('<!--VBSEO_COPYRIGHT-->', $cp_str, $newtext); } else { if (preg_match('#(Copyright[^<]*?Jelsoft Enterprises Ltd\\.)#im', $newtext, $cpfind)) { $newtext = str_replace($cpfind[1], $cpfind[1] . "\n<br />" . $cp_str, $newtext); } else { $newtext = preg_replace('#(</body>)#is', '<br /><div style="z-index:3" class="smallfont" align="center">' . $cp_str . '</div>\\1', $newtext, 1); } } } } if (VBSEO_SHOW_COPYRIGHT && VBSEO_ARCHIVE_LINKS_FOOTER && THIS_SCRIPT != 'archive') { if (VBSEO_ARCHIVE_LINKS_FOOTER < 3 || !$bbuserinfo['joindate']) { $arc_str = vbseo_prepare_arc_links(); if (strstr($newtext, '<!--VBSEO_ARCHIVE_LINKS-->')) { $newtext = str_replace('<!--VBSEO_ARCHIVE_LINKS-->', $arc_str, $newtext); } else { $newtext = preg_replace('#(</body>)#is', '<br /><div style="z-index:3" class="smallfont" align="center">' . $arc_str . '</div>\\1', $newtext); } } } if (defined('VBSEO_UNREG_EXPIRED')) { return $newtext; } if (VBSEO_CODE_CLEANUP && !isset($_GET['vbseo_nocleanup']) && !$_POST['ajax'] && !$VBSEO_REWRITE_TEXTURLS) { $newtext = preg_replace(array('#(<pre[^>]*?>)(.*?)</pre>#sie', '#>\\s+<#s', '#(<s(?:cript|tyle)[^>]*?>[^<]*?<!)--#si', '#<!--(\\s*(\\[|VBS|google_ad))#s', '#<!--.*?-->#s', '#<!js#', '#\\@vbseo_r_n\\@#'), array("str_replace('\\\\\"', '\"', '\$1'.preg_replace(\"#\r?\n#s\",'@vbseo_r_n@','\$2').'\$3')", '> <', '\\1js', '<!js\\1', '', '<!--', "\n"), $newtext); } if ($found_object_ids['announcements']) { vbseo_clean_object_ids('announcements'); vbseo_get_forum_announcement($found_object_ids['announcements']); } vbseo_clean_object_ids('poll_ids'); vbseo_get_poll_info($pollids); if (VBSEO_REWRITE_ATTACHMENTS) { vbseo_clean_object_ids('attachment_ids'); vbseo_get_attachments_info($found_object_ids['attachment_ids']); } if ($found_object_ids['thread_ids'] || $found_object_ids['postthreads']) { $found_object_ids['thread_ids'] = array_merge($found_object_ids['thread_ids'], $found_object_ids['postthreads']); vbseo_clean_object_ids('thread_ids'); if ($threadcache) { $vbseo_gcache['thread'] = array(); foreach ($threadcache as $tid => $tar) { $vbseo_gcache['thread'][$tar['threadid'] ? $tar['threadid'] : $tid] = $tar; if ($found_object_ids['thread_last'] && in_array($tar['threadid'], $found_object_ids['thread_last'])) { $found_object_ids['user_names'][] = $tar['lastposter']; } } $found_object_ids['thread_ids'] = array_diff($found_object_ids['thread_ids'], array_keys($threadcache)); foreach ($vbseo_gcache['thread'] as $tid => $tar) { $vbseo_gcache['thread'][$tid]['seotitle'] = vbseo_filter_replace_text($tar['title'] ? $tar['title'] : $tar['threadtitle']); $usercache[$tar['postuserid']] = array('userid' => $tar['postuserid'], 'username' => $tar['postusername']); if ($tar['pollid']) { $vbseo_gcache['polls'][$tar['pollid']]['threadid'] = $tid; } } } if (isset($GLOBALS['getlastpost'])) { $vbseo_gcache['thread'][$GLOBALS['getlastpost']['threadid']] = $GLOBALS['getlastpost']; } vbseo_get_thread_info($found_object_ids['thread_ids']); } if ($found_object_ids['prepostthread_ids']) { vbseo_get_post_thread_info($found_object_ids['prepostthread_ids'], true); } if (VBSEO_REWRITE_GROUPS) { if (is_array($GLOBALS['group']) && $GLOBALS['group']['groupid']) { $vbseo_gcache['groups'][$GLOBALS['group']['groupid']] = $GLOBALS['group']; } $found_object_ids['groups'] = array_diff($found_object_ids['groups'], array_keys($vbseo_gcache['groups'])); vbseo_get_group_info($found_object_ids['groups']); } if (VBSEO_REWRITE_BLOGS) { global $categories, $postattach; if ($found_object_ids['blog_ids']) { vbseo_get_blog_info($found_object_ids['blog_ids']); } if (isset($vbulletin->vbblog['categorycache'])) { foreach ($vbulletin->vbblog['categorycache'] as $uid => $catarr) { if (is_array($catarr)) { foreach ($catarr as $cid => $carr) { $vbseo_gcache['blogcat'][$cid] = $carr; } } } } $vblog_cats = $GLOBALS['vblog_categories'] ? $GLOBALS['vblog_categories'] : $GLOBALS['categories']; if (is_array($vblog_cats)) { foreach ($vblog_cats as $bid => $catarr) { if (is_array($catarr)) { foreach ($catarr as $cid => $carr) { if ($carr['blogcategoryid']) { $vbseo_gcache['blogcat'][$carr['blogcategoryid']] = $carr; } } } } } $found_object_ids['blogcat_ids'] = array_diff($found_object_ids['blogcat_ids'], array_keys($vbseo_gcache['blogcat'])); if ($found_object_ids['blogcat_ids']) { vbseo_get_blog_cats($found_object_ids['blogcat_ids']); } if (isset($vbseo_gcache['blog']) && is_array($vbseo_gcache['blog'])) { foreach ($vbseo_gcache['blog'] as $bid => $barr) { $found_object_ids['user_ids'][] = $barr['userid']; } } if (is_array($postattach)) { foreach ($postattach as $pid => $attarr) { if (is_array($attarr)) { foreach ($attarr as $aid => $att) { $vbseo_gcache['battach'][$aid] = $att; } } } } if ($found_object_ids['blogatt_ids']) { vbseo_get_blogatt_info($found_object_ids['blogatt_ids']); } } if (is_array($gpic = $GLOBALS['pictureinfo'])) { $vbseo_gcache['pic'][$gpic['pictureid']] = $gpic; } vbseo_get_object_info('pic'); if (VBSEO_REWRITE_MEMBERS || VBSEO_REWRITE_AVATAR) { if (!empty($found_object_ids['user_ids']) || !empty($found_object_ids['user_names'])) { if (is_array($vbseo_gcache['pic'])) { foreach ($vbseo_gcache['pic'] as $pid => $parr) { $found_object_ids['album'][] = $parr['albumid']; } } if (is_array($galb = $GLOBALS['albuminfo'])) { $vbseo_gcache['album'][$galb['albumid']] = $galb; } vbseo_get_object_info('album'); if (is_array($vbseo_gcache['album'])) { foreach ($vbseo_gcache['album'] as $pid => $parr) { $found_object_ids['user_ids'][] = $parr['userid']; } } $userids = array_unique($found_object_ids['user_ids']); vbseo_clean_object_ids('user_names'); if (isset($GLOBALS['newuserid'])) { $usercache[$GLOBALS['newuserid']] = array('userid' => $GLOBALS['newuserid'], 'username' => $GLOBALS['newusername']); } if (!empty($usercache)) { foreach ($usercache as $uid => $uval) { if ($uid && ($uname = $uval['username'])) { $vbseo_gcache['user'][$uid] = $vbseo_gcache['usernm'][strtolower($uname)] = array('userid' => $uid, 'username' => $uname); } } } if (!empty($vbseo_gcache['post'])) { foreach ($vbseo_gcache['post'] as $pid => $pval) { if (isset($pval['postuserid']) && ($uid = $pval['postuserid']) && ($uname = $pval['postusername'])) { $vbseo_gcache['user'][$uid] = $vbseo_gcache['usernm'][strtolower($uname)] = array('userid' => $uid, 'username' => $uname); } } } $userids = array_diff($userids, array_keys($vbseo_gcache['user'] ? $vbseo_gcache['user'] : array())); $found_object_ids['user_names'] = array_diff($found_object_ids['user_names'], array_keys($vbseo_gcache['usernm'])); if (VBSEO_GET_MEMBER_TITLES && !empty($userids) || !empty($found_object_ids['user_names'])) { vbseo_get_user_info($userids, $found_object_ids['user_names']); } else { for ($ui = 0; $ui < count($userids); $ui++) { $vbseo_gcache['user'][$userids[$ui]] = array('userid' => $userids[$ui]); } } } } $vbse_rurl = $vbse_rurl_check = ''; $force_redirect = false; vbseo_get_options(); $mode_nonlinear = vbseo_is_threadedmode(); if (!$mode_nonlinear && VBSEO_THREAD_301_REDIRECT && (VBSEO_REWRITE_THREADS && THIS_SCRIPT == 'showthread' || VBSEO_REWRITE_PRINTTHREAD && THIS_SCRIPT == 'printthread') && !isset($_GET[VBSEO_PAGENUM_URI_GARS]) && (!isset($_GET['goto']) && ($thisthreadid = $_GET['t']) || defined('VBSEO_PRIVATE_REDIRECT_THREAD') && ($thisthreadid = VBSEO_PRIVATE_REDIRECT_THREAD))) { vbseo_get_thread_info($thisthreadid); $tinfo = $vbseo_gcache['thread'][$thisthreadid]; $thisforumid = $tinfo['forumid']; if (function_exists('fetch_permissions')) { if (!$vbulletin->userinfo['userid']) { $vbseo_gcache['forum'][$thisforumid]['permissions'][1] = fetch_permissions($thisforumid); } } $is_public = vbseo_forum_is_public($vbseo_gcache['forum'][$thisforumid], '', 1); if ($is_public) { $maxpage = vbseo_thread_pagenum($tinfo['replycount'] + 1); $_page = isset($_GET['page']) ? intval($_GET['page']) : 0; if (defined('VBSEO_PRIVATE_REDIRECT_URL')) { $vbse_rurl = VBSEO_PRIVATE_REDIRECT_URL; } else { $vbse_rurl = vbseo_thread_url($thisthreadid, min($_page, $maxpage), $_page > 1 ? THIS_SCRIPT == 'showthread' ? VBSEO_URL_THREAD_PAGENUM : VBSEO_URL_THREAD_PRINT_PAGENUM : (THIS_SCRIPT == 'showthread' ? VBSEO_URL_THREAD : VBSEO_URL_THREAD_PRINT)); } $excpars = array(VBSEO_THREADID_URI, 'threadid', 'page', isset($_GET['pp']) && $_GET['pp'] == $vboptions['maxposts'] ? 'pp' : '', 'posted'); if ($_REQUEST['posted']) { $force_redirect = true; } } } if (THIS_SCRIPT == 'forumdisplay') { if ($_REQUEST['page'] && $GLOBALS['pagenumber'] && $_REQUEST['page'] != $GLOBALS['pagenumber']) { $vbse_rurl = vbseo_forum_url($_GET['f'], $GLOBALS['pagenumber']); } if ($vbse_rurl) { $excpars = array('f', 'page'); } } if ((VBSEO_REWRITE_BLOGS || VBSEO_REWRITE_BLOGS_ENT) && THIS_SCRIPT == 'blog') { if (VBSEO_REWRITE_BLOGS_LIST && $_GET['do'] == 'list' && $_REQUEST['page'] && $_REQUEST['page'] != $_REQUEST['pagenumber']) { $vbse_rurl = vbseo_blog_url($_GET['m'] ? VBSEO_URL_BLOG_MONTH_PAGE : VBSEO_URL_BLOG_LIST_PAGE, $_GET); $excpars = array('do', 'page', 'm', 'y'); } if ((($bid = $_GET['b']) || ($bid = $_GET['blogid'])) && (!$_GET['goto'] || in_array($_GET['goto'], array('next', 'prev')))) { if ($_GET['goto']) { if ($GLOBALS['blogid'] != $bid) { $bid = $_GET['b'] = $GLOBALS['blogid']; } else { $bid = 0; } } if ($bid && VBSEO_REWRITE_BLOGS_ENT) { vbseo_get_blog_info($bid); if ($vbseo_gcache['blog'][$bid]['title']) { $vbse_rurl = vbseo_blog_url(vbseo_vb_gpc('pagenumber') > 1 ? VBSEO_URL_BLOG_ENTRY_PAGE : VBSEO_URL_BLOG_ENTRY, $_GET); } $excpars = array('b'); } } if (VBSEO_REWRITE_BLOGS_ENT && $_REQUEST['do'] == 'blog' && !$_REQUEST['b'] && $_REQUEST['bt'] && $GLOBALS['blogid']) { $vbse_rurl = vbseo_blog_url(vbseo_vb_gpc('pagenumber') > 1 ? VBSEO_URL_BLOG_ENTRY_PAGE : VBSEO_URL_BLOG_ENTRY, array('b' => $GLOBALS['blogid'], 'page' => vbseo_vb_gpc('pagenumber'))); $excpars = array('bt', 'page'); $vbse_rurl .= '#comment' . $_REQUEST['bt']; } if ($_GET['u'] && $_GET[VBSEO_BLOG_CATID_URI] && VBSEO_REWRITE_BLOGS_CAT) { $vbse_rurl = vbseo_blog_url($_GET['page'] ? VBSEO_URL_BLOG_CAT_PAGE : VBSEO_URL_BLOG_CAT, $_GET); $excpars = array('u', VBSEO_BLOG_CATID_URI); } } if (VBSEO_REWRITE_MEMBERS && THIS_SCRIPT == 'album' && !isset($_GET['do'])) { if (isset($_GET['pictureid'])) { $vbse_rurl = vbseo_album_url($_GET['page'] > 1 ? 'VBSEO_URL_MEMBER_PICTURE_PAGE' : 'VBSEO_URL_MEMBER_PICTURE', $_GET); $excpars = array('albumid', 'pictureid', 'page'); } } if (VBSEO_REWRITE_TAGS && THIS_SCRIPT == 'tags' && $_GET['tag']) { $apars = $_GET; $apars['tag'] = urlencode($apars['tag']); $vbse_rurl = vbseo_tags_url($apars['page'] ? VBSEO_URL_TAGS_ENTRYPAGE : VBSEO_URL_TAGS_ENTRY, $apars); $excpars = array('tag', 'page'); } if (!$vbse_rurl) { $vbse_rurl2 = ''; $auto_replace = array('group' => array('groupid', 'do', 'pp', 'page', 'pictureid', 'gmid', 'sort', 'order'), 'tags' => array('tag')); if (in_array(THIS_SCRIPT, array_keys($auto_replace))) { $vbse_rurl2 = vbseo_any_url(VBSEO_REQURL); $excpars = $auto_replace[THIS_SCRIPT]; } if (preg_match('#^(.*)\\?(.*)#', $vbse_rurl2, $pmatch)) { $_SERVER['QUERY_STRING'] = $pmatch[2]; $vbse_rurl2 = $pmatch[1]; } $vbse_rurl = $vbse_rurl2; } if ($vbse_rurl) { vbseo_url_autoadjust($vbse_rurl, $excpars, $force_redirect); } if (defined('VBSEO_PRIVATE_REDIRECT_SUGGEST')) { global $foruminfo; $thisforumid = $foruminfo['forumid']; if (function_exists('fetch_permissions')) { if (!$vbulletin->userinfo['userid']) { $vbseo_gcache['forum'][$thisforumid]['permissions'][1] = fetch_permissions($thisforumid); } } $is_public = vbseo_forum_is_public($vbseo_gcache['forum'][$thisforumid], '', 1); if ($is_public) { if (VBSEO_PRIVATE_REDIRECT_SUGGEST != substr(VBSEO_REQURL, 0, strlen(VBSEO_PRIVATE_REDIRECT_SUGGEST))) { vbseo_safe_redirect(VBSEO_PRIVATE_REDIRECT_SUGGEST, array(), true); } } } if (VBSEO_BASEDEPTH) { if (preg_match('#<base href="([^\\"]*)#i', $newtext, $pm)) { if (preg_replace('#/[^/]*$#', '', $pm[1]) == $vboptions['bburl2']) { define('VBSEO_BASEHREF_INDIR', 1); } } } if (VBSEO_BASEDEPTH && defined('VBSEO_PREPROCESSED')) { $newtext = preg_replace('#<head>#i', "\$0\n" . '<base href="' . $vboptions['bburl2'] . (defined('VBSEO_BASE_URL') ? VBSEO_BASE_URL : '') . '/" />', $newtext, 1); } if (isset($VBSEO_REWRITE_TEXTURLS)) { $newtext = preg_replace('#(' . str_replace('tps\\:', 'tps?\\:', preg_quote($vboptions['bburl2'], '#')) . '/?)([^<\\]\\[\\"\\)\\s]*)#ise', 'vbseo_replace_urls("$1", "$2")', $newtext); } if ($GLOBALS['vbseo_proc_xml']) { $newtext = preg_replace('#(<link>(?:\\<\\!\\[CDATA\\[)?)([^<\\]]*)#ise', 'vbseo_replace_urls("$1", "$2")', $newtext); } if (1) { $newtext = preg_replace('#(value="(?:\\[.*?\\])?)(' . preg_quote($vboptions['bburl2'], '#') . '/?)([^<\\]\\[\\"\\)\\s]*)#ise', 'stripslashes(\'$1\').vbseo_replace_urls("", "$2$3")', $newtext); } if (!isset($VBSEO_REWRITE_TEXTURLS)) { $r_tags = 'a|span'; if (VBSEO_ABSOLUTE_PATH_IN_URL) { $r_tags .= '|form|script|link'; } if (VBSEO_ABSOLUTE_PATH_IN_URL || VBSEO_REWRITE_ATTACHMENTS || VBSEO_REWRITE_AVATAR) { $r_tags .= '|img'; } $r_tattr = 'href|src|action|url|\\.open|\\.location'; $newtext = preg_replace('#(<(?:' . $r_tags . ')([^>]*?)(?:' . $r_tattr . ')\\s*[=\\(]\\s*["\'])([^"\'>\\)]*)(.*?[\\>\\);])([^<]*)(</a>)?#ise', "vbseo_replace_urls('\$1', '\$3', '\$2', '\$4', '\$5', '\$6')", $newtext); global $g_replace_cache; if (!defined('VBSEO_AJAX') && isset($g_replace_cache)) { unset($g_replace_cache); } if (strpos($_SERVER['REQUEST_URI'], 'printthread.' . VBSEO_VB_EXT) !== false) { $obb = $vboptions['relbburl']; $vboptions['relbburl'] = $vboptions['bburl2']; $GLOBALS['VBSEO_REWRITE_PRINTTHREAD'] = 1; $newtext = preg_replace('#(\\([^\\)]*?(?:http://)?[^\\)]*?)(' . preg_quote($vboptions['bburl2'], '#') . '/[^<\\)]*)#ise', 'vbseo_replace_urls("$1", "$2")', $newtext); $vboptions['relbburl'] = $obb; } } if (VBSEO_ADD_ANALYTICS_CODE && VBSEO_ADD_ANALYTICS_CODE_EXT) { $tmode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : vbseo_bbarray_cookie('threadedmode'); if (!$tmode) { $tmode = $bbuserinfo["threadedmode"] ? 'threaded' : ''; } if ($tmode == 'threaded') { $newtext = preg_replace('#^(\\s*pd\\[\\d+\\] = )\'(.+)$#me', '"$1\'".preg_replace("#(pageTracker\\._trackPageview \\()\'(.*?)\'#","\\$1\\\'\\$2\\\'", str_replace("\\\'","\'","$2"))', $newtext); } } $ticonurl = str_replace('.gif', '', VBSEO_TREE_ICON); if (VBSEO_REWRITE_TREE_ICON && strpos($newtext, $ticonurl) !== false) { if (preg_match('#' . $ticonurl . '(_...)?[^>]+?alt="([^"]+)"#', $newtext, $matches)) { $currentdir = $matches[1]; $currentalt = $matches[2]; } $ticonurl_full = $ticonurl . $currentdir . '.gif'; $ticon_format = str_replace('.gif', $currentdir . '.gif', VBSEO_URL_THREAD_TREE_ICON); $ficon_format = str_replace('.gif', $currentdir . '.gif', VBSEO_URL_FORUM_TREE_ICON); $url = $_SERVER['REQUEST_URI']; if ($tempusagecache['FORUMDISPLAY']) { if (preg_match('#' . VBSEO_FORUMID_URI . '=(\\d+)#', $url, $matches)) { $forumid = $matches[1]; $thisforum =& $vbseo_gcache['forum'][$forumid]; $newtext = str_replace($ticonurl_full, vbseo_forum_url($forumid, 0, VBSEO_ICON_PREFIX . $ficon_format), $newtext); $newtext = str_replace($currentalt, str_replace('"', '"', $thisforum['title']), $newtext); } } else { if ($tempusagecache['SHOWTHREAD']) { reset($vbseo_gcache['thread']); list($threadid, $thisthread) = each($vbseo_gcache['thread']); $newtext = str_replace($ticonurl_full, vbseo_thread_url($threadid, 0, VBSEO_ICON_PREFIX . $ticon_format), $newtext); $newtext = str_replace($currentalt, str_replace('"', '"', $thisthread['title']), $newtext); } } } if (THIS_SCRIPT == 'showthread' && VBSEO_REWRITE_THREADS && $GLOBALS['threadedmode']) { preg_match_all('#writeLink\\(\\s*(\\d+)#', $newtext, $posts); reset($vbseo_gcache['thread']); list($threadid, $thisthread) = each($vbseo_gcache['thread']); $gen_post_url = vbseo_thread_url($threadid, 1, VBSEO_URL_THREAD_GOTOPOST, "' + postid + '"); $newtext = preg_replace('#(</body>)#is', ' <script type="text/javascript"> var plist = new Array("' . implode('","', $posts[1]) . '") for(var i=0;i<plist.length;i++){ postid = plist[i] postel = document.getElementById(\'div\'+postid) if(postel){ newurl = \'' . $gen_post_url . '\' postel.innerHTML = postel.innerHTML.replace(\'showthread.' . VBSEO_VB_EXT . '?' . (VBSEO_VB35X ? 'p' : 'postid') . '=\'+postid, newurl); } } </script> \\1', $newtext); } $vbseo_fp = ''; if (VBSEO_REWRITE_META_DESCRIPTION || VBSEO_REWRITE_META_KEYWORDS) { $kw_content = $desc_content = ''; switch (THIS_SCRIPT) { case 'member': $ui =& $GLOBALS['usercache'][$_GET['u']]; $kw_content = $ui['username']; $desc_content = str_replace(array('[username]', '[usertitle]', '[bb_title]', '[bbtitle]'), array($ui['username'], $ui['usertitle'], $vboptions['bbtitle'], $vboptions['bbtitle']), VBSEO_META_DESCRIPTION_MEMBER); $desc_content = @preg_replace('#\\[user_field_(\\d+)\\]#e', '$ui[\'field\'.\'$1\']', $desc_content); break; case 'forumdisplay': $fi =& $GLOBALS['forumcache'][$_GET['f']]; $kw_content = $fi['title']; $kw_content = preg_replace('#[^a-zA-Z0-9_\\x80-\\xff]+#', ',', $kw_content); $desc_content = $fi['title'] . ($_GET['page'] ? ', Page ' . $_GET['page'] : '') . (isset($fi['description']) ? ' - ' . $fi['description'] : ''); break; case 'showpost': case 'showthread': if (VBSEO_REWRITE_META_DESCRIPTION) { $desc_content = vbseo_extract_msg_postbits(); } if (VBSEO_REWRITE_META_KEYWORDS && ($tbits = $GLOBALS['threadinfo']['title'])) { if (VBSEO_FILTER_STOPWORDS != 0 && VBSEO_STOPWORDS) { $tbits = preg_replace('#\\b(' . VBSEO_STOPWORDS . ')\\b#is', '', $tbits); } preg_match_all('#([a-zA-Z0-9_\\x80-\\xff]+)#s', $tbits, $ptext); $kw_content = implode(',', $ptext[1]); } break; case 'blog': if (VBSEO_REWRITE_META_DESCRIPTION && ($desc_content = $GLOBALS['blog']['message'])) { $desc_content = preg_replace('#(<.*?>)+#s', ' ', $desc_content); $desc_content = trim($desc_content); } if (VBSEO_REWRITE_META_KEYWORDS && ($tbits = $GLOBALS['blog']['title'])) { if (VBSEO_FILTER_STOPWORDS != 0 && VBSEO_STOPWORDS) { $tbits = preg_replace('#\\b(' . VBSEO_STOPWORDS . ')\\b#is', '', $tbits); } preg_match_all('#([a-zA-Z0-9_\\x80-\\xff]+)#s', $tbits, $ptext); $kw_content = implode(',', $ptext[1]); } break; } if (VBSEO_REWRITE_META_KEYWORDS && $kw_content) { $kw_content = strip_tags($kw_content); if (VBSEO_STOPWORDS) { $kw_content = preg_replace('#,?\\b(' . VBSEO_STOPWORDS . ')\\b#i', '', $kw_content); } $newtext = preg_replace('#(<meta name="keywords".*?content=)"#is', '$1"' . str_replace('$', '\\$', $kw_content) . ',', $newtext); } if (VBSEO_REWRITE_META_DESCRIPTION && $desc_content) { $desc_content = strip_tags($desc_content); $desc_content = preg_replace('#[\\s\\"]+#s', ' ', $desc_content); if (strlen($desc_content) > VBSEO_META_DESCRIPTION_MAX_CHARS) { $desc_content = vbseo_substr($desc_content, 0, VBSEO_META_DESCRIPTION_MAX_CHARS + 1); $desc_content = preg_replace('#\\s+\\w+$#', '', $desc_content); } $newtext = preg_replace('#(<meta name="description".*?content=)"[^"]*#is', '$1"' . str_replace('$', '\\$', str_replace('"', '"', $desc_content)), $newtext); } } if ($GLOBALS['vbseo_meta']) { foreach ($GLOBALS['vbseo_meta'] as $metaname => $metacont) { $newtext = preg_replace('#(<meta name="' . $metaname . '".*?content=)"[^"]*#is', '$1"' . str_replace('$', '\\$', htmlspecialchars($metacont)), $newtext); } } if (!$GLOBALS['bbuserinfo']['badlocation'] && (THIS_SCRIPT == 'forumdisplay' && ($vbseo_rr = $GLOBALS['vbseo_relev_replace']) && $GLOBALS['foruminfo']['forumid'] || THIS_SCRIPT == 'showthread' && ($vbseo_rr = $GLOBALS['vbseo_relev_replace_t']) && $GLOBALS['threadinfo']['title'])) { $parent_forum = $vbseo_gcache['forum'][$GLOBALS['foruminfo']['parentid']]; $vbseo_rrepl = array('[thread_title]' => $GLOBALS['threadinfo']['title'], '[forum_description]' => $GLOBALS['foruminfo']['description'], '[forum_title]' => $GLOBALS['foruminfo']['title'], '[parent_forum_description]' => $parent_forum['description'], '[parent_forum_title]' => $parent_forum['title'], '[bb_title]' => $vboptions['bbtitle'], '[default_keywords]' => $vboptions['keywords'], '[username]' => $GLOBALS['userinfo']['username'], '[thread_page]' => $_GET['page']); $vbseo_pn = 0; foreach ($vbseo_rr as $rr) { $vbseo_pn++; if ($rr) { $rr = str_replace(array_keys($vbseo_rrepl), array_values($vbseo_rrepl), $rr); if (preg_match('#\\[first_post_(\\d+)_words\\]#', $rr, $fp_m)) { if (!$vbseo_fp) { $vbseo_fp = vbseo_extract_msg_postbits(); } $rr = str_replace('[first_post_' . $fp_m[1] . '_words]', preg_replace('#^\\s*((\\S+\\s+){' . $fp_m[1] . '}).*$#' . (VBSEO_UTF8_SUPPORT ? 'u' : '') . 's', '\\1', $vbseo_fp), $rr); } $rr2 = VBSEO_GOOGLE_AD_SEC ? vbseo_google_ad_section($rr) : $rr; $newtext = str_replace('<!--VBSEO_RR_' . $vbseo_pn . '-->', $rr2, $newtext); $newtext = str_replace('<!--VBSEO_RR_' . $vbseo_pn . '_NOHTML-->', $rr, $newtext); } } } if ($seo_preg_replace && !VBSEO_ACRONYMS_IN_CONTENT) { $newtext = preg_replace(array_keys($seo_preg_replace), $seo_preg_replace, $newtext); } if (VBSEO_ADD_ANALYTICS_CODE && VBSEO_ANALYTICS_CODE) { global $display; $track_url = $more_tracking = ''; if (THIS_SCRIPT == 'search' && $_REQUEST['do'] == 'showresults' && $display['highlight']) { $track_url = 'search.php?q=' . urlencode(implode(' ', $display['highlight'])); } if ($isloggedin_changed) { $more_tracking .= "\n" . 'pageTracker._setVar("' . ($bbuserinfo['userid'] > 0 ? 'member' : 'guest') . '");'; } if (THIS_SCRIPT == 'register') { $vbseo_goal = $_REQUEST['do']; if ($_GET['a'] == 'act') { $vbseo_goal = 'complete'; } if ($GLOBALS['templatename'] == 'register_verify_age') { $vbseo_goal = 'birthday'; } $vbseo_goal_pages = array('coppaform' => 'coppaform.html', 'birthday' => 'enter-birthday.html', 'signup' => 'agreement.html', 'register' => 'regform-show.html', 'addmember' => 'regform-submit.html', 'complete' => 'registration-complete.html'); if (isset($vbseo_goal_pages[$vbseo_goal])) { $more_tracking .= "\n" . 'pageTracker._trackPageview("' . VBSEO_ANALYTICS_GOAL_PATH . $vbseo_goal_pages[$vbseo_goal] . '");'; } } $newtext = preg_replace('#(</body>)#is', ' <script type="text/javascript"><!-- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E")); //--> </script> <script type="text/javascript"><!-- var pageTracker = _gat._getTracker("' . VBSEO_ANALYTICS_CODE . '"); pageTracker._initData(); ' . $more_tracking . ' pageTracker._trackPageview(' . ($track_url ? "'{$track_url}'" : "") . '); //--> </script> ' . '\\1', $newtext, 1); } if (VBSEO_LINK && $GLOBALS['bbuserinfo']['isadmin']) { $config_link = ' <div style="position:absolute;z-index:3;width:100%;left:0px;top:8px;text-align:center;"><a style="BACKGROUND: #FFFFFF; padding:5px; FONT-SIZE: 11px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; COLOR: #003399;" href="' . $vboptions['bburl2'] . '/vbseocp.php">Back to vBSEO Config Panel</a></div> '; $newtext = preg_replace('#(<body.*?>)#is', '\\1' . $config_link, $newtext, 1); } /********************************************************************************/ if (!isset($VBSEO_REWRITE_TEXTURLS)) { } return $newtext; }
function vbseo_ping_proc($src_url, $dest_url, $pingtype = 0, $title = '', $snippet = '') { global $vboptions, $vbseo_gcache; $ping_type_str = ($pingtype == 1 ? 'track' : ($pingtype == 2 ? 'ref' : 'ping')) . 'backs'; $error_msg = array(); $link_confirm = false; vbseo_get_options(false); vbseo_prepare_seo_replace(); vbseo_get_forum_info(); $db = vbseo_get_db(); $matchfull = $vboptions['bburl2']; $postid = $postcount = $threadid = $page = 0; if ($GLOBALS['vbseo_linkback_cleanup']) { $src_url = preg_replace('#' . implode('|', $GLOBALS['vbseo_linkback_cleanup']) . '#', '', $src_url); $dest_url = preg_replace('#' . implode('|', $GLOBALS['vbseo_linkback_cleanup']) . '#', '', $dest_url); } $arr = $arr2 = $arr3 = array(); list($dest_url_pre, $dest_url_post) = explode('#', $dest_url); if (strstr($dest_url_pre, $matchfull)) { $dest_url_pre = substr($dest_url_pre, strlen($matchfull) + 1); $dest_url_pre2 = preg_replace('#\\?.*#', '', $dest_url_pre); if (!($arrt = vbseo_check_url('VBSEO_URL_THREAD_PAGENUM', $dest_url_pre2))) { $arrt = vbseo_check_url('VBSEO_URL_THREAD', $dest_url_pre2); } if (isset($arrt['thread_id'])) { $threadid = $arrt['thread_id']; } if (($arr = vbseo_check_url('VBSEO_URL_POST_SHOW', $dest_url_pre2)) || preg_match('#showpost\\.' . VBSEO_VB_EXT . '\\?[^"]*?p(?:ostid)?=([0-9]+)[^/"]*$#i', $dest_url_pre, $arr2) || preg_match('#showthread\\.' . VBSEO_VB_EXT . '\\?[^"]*?p=([0-9]+)[^/"]*$#i', $dest_url_pre, $arr2) || $arrt && preg_match('#post(\\d+)#', $dest_url_post, $arr3)) { global $found_object_ids; $postid = $arr ? $arr['post_id'] : ($arr2 ? $arr2[1] : $arr3[1] + 0); if ($postid) { $found_object_ids['prepostthread_ids'] = array($postid); vbseo_get_post_thread_info($postid); $threadid = $vbseo_gcache['post'][$postid]['threadid']; $postcount = $vbseo_gcache['post'][$postid]['preposts']; $page = vbseo_thread_pagenum($postcount); $link_confirm = true; } } else { if (preg_match('#showthread\\.' . VBSEO_VB_EXT . '\\?[^"]*?t=([0-9]+)[^/"]*$#i', $dest_url_pre, $arr2) || $arrt && !$dest_url_post) { $threadid = $arr2 ? $arr2[1] : $arrt['thread_id']; $page = $arrt['thread_page'] ? $arrt['thread_page'] : 1; $link_confirm = true; } } vbseo_get_thread_info($threadid); $threadinfo = $vbseo_gcache['thread'][$threadid]; $forumid = $threadinfo['forumid']; if ($threadinfo['visible'] != 1) { $link_confirm = false; } } $put_wait = false; if ($link_confirm) { $c_src_url = preg_replace('|.*?://(www\\.)?|', '', preg_replace('|#.*$|', '', $src_url)); $pret = vbseo_http_query_full($src_url); $pcont = $pret['content']; $purl = parse_url($src_url); if (!$title) { $title = vbseo_get_page_title($pcont); $pcharset = vbseo_get_page_charset($pcont); $title = vbseo_convert_charset($title, $pcharset); } $qf = $db->vbseodb_query_first($q = "SELECT * FROM " . vbseo_tbl_prefix('vbseo_linkback') . "\nWHERE (t_src_url LIKE \"%" . addslashes($c_src_url) . "%\" \n" . (VBSEO_LINKBACK_IGNOREDUPE && $purl['host'] ? "OR (\nt_src_url LIKE \"%" . addslashes(str_replace('www.', '', $purl['host'])) . "/%\" \nAND t_title LIKE \"" . addslashes($title) . "\" \n)" : "") . "\n)\nAND t_threadid = \"{$threadid}\""); if (VBSEO_LINKBACK_REQUIRE_REF && $pingtype == 2 && $qf['t_wait']) { $pingtype = $qf['t_type']; $approve = $vbseo_gcache['forum'][$forumid]['vbseo_moderate_pingback'] ? 1 : 0; $db->vbseodb_query("UPDATE " . vbseo_tbl_prefix('vbseo_linkback') . "\nSET t_wait = 0, t_approve = " . $approve . "\nWHERE t_id = " . $qf['t_id']); vbseo_linkback_approve($qf['t_id']); vbseo_send_notification_pingback($threadid, $postid, $src_url, $qf['t_title'], $qf['t_text'], $approve, VBSEO_PINGBACK_NOTIFY); } else { if (VBSEO_LINKBACK_REQUIRE_REF && $pingtype == 0 && !$qf['t_id']) { $put_wait = true; } } if ($qf['t_id']) { $error_msg = array('code' => 48, 'msg' => 'The pingback has already been registered.'); } else { if ($pingtype == 1 && VBSEO_TRACKBACK_IPCHECK) { $parsed_src_url = @parse_url($src_url); $hostip = gethostbyname($parsed_src_url['host']); if ($hostip != $_SERVER['REMOTE_ADDR']) { $error_msg = array('code' => 47, 'msg' => 'The target server IP address doesn\'t match request host IP.'); } } if (!$error_msg && $pingtype == 2) { $qf2 = $db->vbseodb_query_first($q = "SELECT count(*) as cnt FROM " . vbseo_tbl_prefix('vbseo_linkback') . "\nWHERE t_dest_url LIKE \"%" . addslashes($c_src_url) . "%\" AND\nt_threadid = \"{$threadid}\""); if ($qf2['cnt'] > 0) { $error_msg = array('code' => 4, 'msg' => 'The outgoing linkback has already been registered, refback skipped.'); } } if (!$error_msg && $pingtype != 1) { if (!preg_match('#<a[^>]*?' . preg_quote($dest_url, '#') . '.*?>#', $pcont, $lm) && !preg_match('#<a[^>]*?' . preg_quote($matchfull . '/showthread.php?t=' . $threadid, '#') . '.*?>#', $pcont, $lm)) { $error_msg = array('code' => 17, 'msg' => 'The source URI does not contain a link to the target URI, and so cannot be used as a source.'); } else { $sn = '%vbseo_snippet%'; $snippet = preg_replace('#[ \\t]+#s', " ", preg_replace('#<.*?>#is', '', str_replace($lm[0], $sn, $pcont))); $snippet = preg_replace('#(<\\/?(div|p).*?\\>)#m', "\n\$1", $snippet); $snippet = preg_replace('#^\\s+#m', "", $snippet); $snippet = preg_replace('#[\\r\\n]+#', "\n ", $snippet); $halflen = (int) (VBSEO_SNIPPET_LENGTH / 2); preg_match('#\\s(.{0,' . $halflen . '}' . preg_quote($sn) . '.{0,' . $halflen . '})\\b#', $snippet, $sm); $snippet = trim(str_replace($sn, '', $sm[0])); } } if (VBSEO_PINGBACK_STOPWORDS && (preg_match('#' . VBSEO_PINGBACK_STOPWORDS . '#', $snippet) || preg_match('#' . VBSEO_PINGBACK_STOPWORDS . '#', $title) || preg_match('#' . VBSEO_PINGBACK_STOPWORDS . '#', $threadinfo['title']))) { $error_msg = array('code' => 1, 'msg' => 'The request has been rejected due to anti-SPAM policy.'); } else { if ($purl['host']) { $banned_domains = vbseo_linkback_getbandomains(1, false); if ($banned_domains && preg_match('#(' . $banned_domains . ')#i', $purl['host'], $pm)) { vbseo_linkback_banhit($pm[1], 1); $error_msg = array('code' => 2, 'msg' => 'The request is originated from blacklisted domain.'); } } } if (!$error_msg) { if (VBSEO_MAX_TITLE_LENGTH) { $title = vbseo_substr($title, 0, VBSEO_MAX_TITLE_LENGTH); } vbseo_store_pingback($src_url, $dest_url, $pingtype, $postid, $postcount, $threadid, $page, $title, $snippet, 1, $vbseo_gcache['forum'][$forumid]['vbseo_moderate' . $ping_type_str] ? 0 : 1, 0, $put_wait); } } } else { $error_msg = array('code' => 3, 'msg' => 'The link is not confirmed.'); } return $error_msg; }