Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.

Paste

Pasted as PHP by registered user atmaca ( 4 days ago )
<?php
/*functions_vbseo_vb.php birinci parça. Devamı gelecek. */
/************************************************************************************
* vBSEO 3.6.0 for vBulletin v3.x & v4.x by Crawlability, Inc.                       *
*                                                                                   *
* Copyright © 2011, Crawlability, Inc. All rights reserved.                         *
* 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/                                        *
************************************************************************************/

function vbseo_process_template($type, $pdata = array())
{
if(VBSEO_VB4)
return vbseo_process_template_vb4($type, $pdata);
else
return vbseo_process_template_vb3($type, $pdata);
}
function vbseo_vbroute_var()
{
global $vbulletin;
return ($vbulletin && $vbulletin->options['route_requestvar']) ?
$vbulletin->options['route_requestvar']: 'r';
}
function vbseo_vbtemplate_render_any($tpl, $params)
{
global $show, $vbphrase;
if(VBSEO_VB4)
{
$templater = vB_Template::create($tpl);
foreach($params as $pk => $pv)
$templater->register($pk, $pv);
$out = $templater->render();
}else
{
foreach($params as $pk => $pv)
$$pk = $pv;
eval(vbseo_eval_template($tpl, '$out'));
}
return $out;
}
function vbseo_vbtemplate_render($tpl, $params)
{
$navbar = render_navbar_template($navbits);
if(VBSEO_VB4)
{
$templater = vB_Template::create($tpl);
$templater->register_page_templates();
$templater->register('navbar', $navbar);
foreach($params as $pk => $pv)
$templater->register($pk, $pv);
$out = $templater->render();
}else
{
foreach($params as $pk => $pv)
$$pk = $pv;
eval(vbseo_eval_template('navbar', '$navbar'));
eval(vbseo_eval_template('USERCP_SHELL', '$out'));
}
return $out;
}
function vbseo_process_template_vb4($type, $pdata = array())
{
global $vbulletin, $vbphrase;
switch($type)
{
case 'forumrules':
$pingrules = 
"\n<li>' . vB_Template_Runtime::parsePhrase('vbseo_trackback_is_x', 'misc.'.VBSEO_VB_EXT.'?do=linkbacks#trackbacks', vB_Template_Runtime::parsePhrase(iif(VBSEO_EXT_TRACKBACK, 'on', 'off'))) .'</li>"
."\n<li>' . vB_Template_Runtime::parsePhrase('vbseo_pingback_is_x', 'misc.'.VBSEO_VB_EXT.'?do=linkbacks#pingbacks', vB_Template_Runtime::parsePhrase(iif(VBSEO_EXT_PINGBACK, 'on', 'off'))) .'</li>"
."\n<li>' . vB_Template_Runtime::parsePhrase('vbseo_refback_is_x', 'misc.'.VBSEO_VB_EXT.'?do=linkbacks#refbacks', vB_Template_Runtime::parsePhrase(iif(VBSEO_EXT_REFBACK, 'on', 'off'))) .'</li>"
;
vbseo_modify_template('forumrules', '#(html_code_is_x.*?</li>)#s', '$1' . $pingrules, 0, '<!--LINKBACK_POSTRULES-->');
break;
case 'postbit_bookmarks':
if(($search_for = $pdata['search_for']) == 'editlink')
$search_for = '\'; if ($post[\'editlink\'])';
$pdata['abm'] = str_replace('$post[postid]', '\'.$post[postid].\'', $pdata['abm']);
vbseo_modify_template( $pdata['tpl'], $search_for,
'<div style="float:\'.vB_Template_Runtime::fetchStylevar("left").\'">' . $pdata['abm'] . "</div>\n" . $search_for
);
break;
case 'postbit_linkback':
$tplpostbit = vbseo_get_postbit_tpl();
$pingtpl = '".($post[\'linkbacksno\']?"<a href=\"' . (($_POST['ajax'] || (THIS_SCRIPT != 'showthread'))?'showthread.' . VBSEO_VB_EXT . '?p=$post[postid]':"") . '#linkbacks\"><img class=\\"inlineimg\\" src=\\"'.vBSEO_Storage::path('fimages').'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 'linkback_menu':
global $vbseo_bookmarks, $show;
$show['vbseo_bookmarks'] = $vbseo_bookmarks;
$_q = vbseo_fetch_tpl('vbseo_linkbackmenu_entry');
vbseo_modify_template('SHOWTHREAD', '#(<li[^>]*?threadtools)#i', $_q.'$1', 0, '<!--LINKBACK_MENU-->');
break;
case 'misc_linkbacks':
$navbits = construct_navbits(array('faq.' . VBSEO_VB_EXT . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['faq'],
'' => $vbphrase['vbseo_linkbacks']
));
$navbar = render_navbar_template($navbits);
$templater = vB_Template::create('vbseo_help_linkback');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
print_output($templater->render());
exit;
break;	
case 'linkbacks_list':
if (!vbseo_tpl_search('SHOWTHREAD', '[vbseolinkbacks]'))
{
$search_for = $pdata['showactusers'] ? '; if ($show[\'activeusers\']' : ' . $similarthreads';
if (!vbseo_tpl_search('SHOWTHREAD', $search_for))
$search_for = '<!-- currently active users -->';
vbseo_modify_template('SHOWTHREAD', $search_for, ".\$show[vbseolinkbacks]$search_for");
}
break;
case 'notices':
global $notices;
if($notices)
{
$_js_snr = '#(\$show\\[\'notices\'\\].*?)(<ol.*?\$notices.*?</ol>)#s';
vbseo_modify_template('navbar', $_js_snr, '$1<!--VBSEO_VIRTUAL_HTML-->$2<!--/VBSEO_VIRTUAL_HTML-->');
}
break;
case 'lastpost_col':                       
vbseo_modify_template('FORUMHOME',
'#<span[^>]*forumlastpost.*?</span>#is', '');
vbseo_modify_template('forumhome_forumbit_level1_nopost',
'#<span[^>]*forumlastpost.*?</span>#is', '');
vbseo_modify_template('FORUMDISPLAY',
'#<span[^>]*forumlastpost.*?</span>#is', '');
vbseo_modify_template('forumhome_forumbit_level2_post',
'#<div[^>]*forumlastpost td.*?</div>.*?</div>#is', '');
vbseo_modify_template('forumhome_forumbit_level1_post',
'#<div[^>]*forumlastpost td.*?</div>.*?</div>#is', '');
break;
case 'lastpost_links':
vbseo_modify_template('forumhome_lastpostby',
'#<a href=[^>]*?lastpostid[^>]*?><img[^<]*?</a>#is', '');
vbseo_modify_template('forumhome_lastpostby',
'$memberaction_dropdown', '$lastpostinfo[\'lastposter\']');
$vbphrase['by_x'] = strip_tags($vbphrase['by_x']);
break;
}
}
function vbseo_int_var(&$thevar)
{
if(is_array($thevar))
{
foreach($thevar as $k=>$v)
$thevar[$k] = intval($v);
}else
$thevar = intval($thevar);
}
function vbseo_vb_userinfo($field = '', $isint = false)
{
global $vbulletin, $bbuserinfo;
if(is_object($vbulletin) && $vbulletin->userinfo && (!$field || isset($vbulletin->userinfo[$field])))
$uid = $field ? $vbulletin->userinfo[$field] : $vbulletin->userinfo;
else
if($bbuserinfo[$field])
$uid = $field ? $bbuserinfo[$field] : $bbuserinfo;
else
$uid = vBSEO_Storage::get('c'.$field);
return $isint ? intval($uid) : $uid;
}
function vbseo_vb_userid()
{
return vbseo_vb_userinfo('userid', true);
}
function vbseo_process_template_vb3($type, $pdata = array())
{
global $vbulletin, $vbphrase;
switch($type)
{
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 'postbit_bookmarks':
if(($search_for = $pdata['search_for']) == 'editlink')
$search_for = '".(($post[\'editlink\'])';
vbseo_modify_template( $pdata['tpl'], $search_for,
'<div style=\\"float:$stylevar[left]\\">' . str_replace('"', '\\"', $pdata['abm']). "</div>\n" . $search_for
);
break;
case 'postbit_linkback':
$tplpostbit = vbseo_get_postbit_tpl();
$pingtpl = '".($post[\'linkbacksno\']?"<a href=\"' . (($_POST['ajax'] || (THIS_SCRIPT != 'showthread'))?'showthread.' . VBSEO_VB_EXT . '?p=$post[postid]':"") . '#linkbacks\"><img class=\\"inlineimg\\" src=\\"'.vBSEO_Storage::path('fimages').'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 'linkback_menu':
global $vbseo_bookmarks, $vbseo_linkback_menu, $vbseo_linkback_menu_list, $show, $vbseo_linkback_uri, $thread;
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');
break;
case 'misc_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 = "' . vbseo_fetch_tpl('navbar') . '";');
eval('print_output("' . vbseo_fetch_tpl('vbseo_help_linkback') . '");');
exit;
break;	
case 'linkbacks_list':
if (!vbseo_tpl_search('SHOWTHREAD', '$vbseolinkbacks'))
{
$search_for = $pdata['showactusers'] ? '".(($show[\'activeusers\']' : '$similarthreads';
if (!vbseo_tpl_search('SHOWTHREAD', $search_for))
$search_for = '<!-- currently active users -->';
vbseo_modify_template('SHOWTHREAD', $search_for, "\$show[vbseolinkbacks]\n$search_for");
}
break;
case 'notices':
global $notices;
if($notices)
{
$_js_snr = '#(\$show\[\'notices\'\].*?)(<table.*?\$notices.*?</table>)#s';
vbseo_modify_template('navbar', $_js_snr, '$1<!--VBSEO_VIRTUAL_HTML-->$2<!--/VBSEO_VIRTUAL_HTML-->');
}
break;
case 'lastpost_col':
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', '');
break;
case 'lastpost_links':
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']);
break;
}
}
function vbseo_fetch_tpl($tplname)
{
return
(class_exists('vB_Template') && method_exists(vB_Template, 'fetch_template_raw')) ? 
vB_Template::fetch_template_raw($tplname) : 
fetch_template($tplname);
}
function vbseo_eval_template($tpl, $varname, $append = false)
{
$tplcode = vbseo_fetch_tpl($tpl);
$enclose = VBSEO_VB4 ? "'" : '"';
$tplcode = '$final_rendered = ' . $enclose . $tplcode . $enclose .';';
if(!VBSEO_VB4 && strstr($tpl, 'vbseo'))
{
while(strstr($tplcode, '<vb:each'))
{
if($xn++>5)break;
$tplcode = preg_replace(
'#^(.*)<vb:each from=\\\\"(.*?)\\\\" key=\\\\"(.*?)\\\\" value=\\\\"(.*?)\\\\">(.*?)</vb:each>#is',
'
\\$_tfe'.$xn.' = "";
if(is_array(\\$$2))
foreach(\\$$2 as \\$$3=>\\$$4){
\\$_tfe'.$xn.' .= "$5";
}; $1 \\$_tfe'.$xn,
$tplcode);
}
}
if($varname)
$tplcode .= $varname . ($append ? '.' : '') . '=$final_rendered;';
return $tplcode;
}
function vbseo_modify_template34($tplname, $searchfor, $replacewith, $show = false, $strsearch = '')
{
if(VBSEO_VB4)
{
$replacewith = str_replace("'", "\\'", $replacewith);
$replacewith = preg_replace('#\$stylevar\[(.*?)\]#', "'.vB_Template_Runtime::fetchStylevar(\"$1\").'", $replacewith);
$replacewith = preg_replace('#(\$[\w\_]+?\[.*?\])#m', "'.$1.'", $replacewith);
$searchfor = preg_replace('#(\\\\\$[\w\_]+?\\\\\[)(.*?)(\\\\\])#m', "\' \. $1'$2'$3 \. \'", $searchfor);
}else
{
$replacewith = str_replace('"', '\\"', $replacewith);
}
return vbseo_modify_template($tplname, $searchfor, $replacewith, $show, $strsearch);
}
function vbseo_modify_template($tplname, $searchfor, $replacewith, $show = false, $strsearch = '')
{
global $vbulletin;
$_thistpl = $_thistpl1 = '';    
if (vbseo_tpl_exists($tplname))
{
$_thistpl = & $vbulletin->templatecache[$tplname];
$_thistpl1 = $_thistpl;
if($strsearch && strstr($_thistpl, $strsearch))
{
$_thistpl = str_replace($strsearch, 
preg_replace('#^[\s\-]+#', '', preg_replace('#\$\d+#', '', $replacewith)), $_thistpl);
}else
if($searchfor[0] == '#')
{
$_thistpl = preg_replace($searchfor, $replacewith, $_thistpl);
}else
$_thistpl = str_replace($searchfor, $replacewith, $_thistpl);
}
if ($show)
echo $vbulletin->templatecache[$tplname];
return $_thistpl != $_thistpl1;
}
function vbseo_cache_templates()
{
global $globaltemplates, $bootstrap;
$tlikes = 0;
$gtpointer = array();
if($_REQUEST['ajax'])
{
if(THIS_SCRIPT == 'blog_post')
$gtpointer[] = 'blog_comment';
if(THIS_SCRIPT == 'group')
$gtpointer[] = 'socialgroups_message';
if(THIS_SCRIPT == 'album')
$gtpointer[] = 'picturecomment_message';
if(THIS_SCRIPT == 'visitormessage')
$gtpointer[] = 'memberinfo_visitormessage';
if($_REQUEST['do'] == 'vbseoui')
$tlikes = 3;
}
if(THIS_SCRIPT == 'picturecomment')
$gtpointer[] = 'picturecomment_message';
if (in_array(THIS_SCRIPT, array('entry', 'blog')) && $_REQUEST['do'] == 'blog')
{
$gtpointer[] = 'vbseo_blog_bmarkentry';
$gtpointer[] = 'vbseo_blog_bmarksection';
if(VBSEO_LIKE_BLOG)
$tlikes = 1;	
}
if((THIS_SCRIPT=='vbcms') && defined('VB_ENTRY'))
{
if(VBSEO_LIKE_CMS)
$tlikes = 1;	
}
if (THIS_SCRIPT == 'moderation')
{
$gtpointer[] = 'vbseo_linkbacks';
$gtpointer[] = 'vbseo_linkbackbit';
}
if (THIS_SCRIPT == 'showthread')
{
if(VBSEO_IN_PINGBACK || VBSEO_IN_TRACKBACK || VBSEO_IN_REFBACK || VBSEO_BOOKMARK_THREAD)
{
$gtpointer[] = 'vbseo_linkbacks';
$gtpointer[] = 'vbseo_linkbackbit';
$gtpointer[] = 'vbseo_linkbackmenu';
$gtpointer[] = 'vbseo_linkbackmenu_entry';
}
$tlikes = 3;	
}
if (THIS_SCRIPT == 'index')
if(VBSEO_LIKE_POST)
{                        
$gtpointer[] = 'vbseo_likes_widget';
}
if (THIS_SCRIPT == 'member')
{
$tlikes = 2;	
}
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'))
{
$gtpointer[] = 'vbseo_help_linkback';
}
if($tlikes && VBSEO_LIKE_POST)
{
vbseo_extra_inc('ui');
$gtpointer[] = 'vbseo_likeshare';
$gtpointer[] = 'vbseo_ui_headinc';
if($tlikes == 3)
{
$gtpointer[] = 'vbseo_like_tree';
}
if($tlikes == 2)
{
$gtpointer[] = 'vbseo_profile_menu';
$gtpointer[] = 'vbseo_likes_list_container';
$gtpointer[] = 'vbseo_likebit';
}
}
if(VBSEO_VB4 && $bootstrap)
{
$bootstrap->cache_templates = array_merge($bootstrap->cache_templates, $gtpointer);
}
else
if(is_array($globaltemplates))
$globaltemplates = array_merge($globaltemplates, $gtpointer);
}
function vbseo_content_type($cinfo)
{
if($cinfo['albumid'])
return 'album';
else
if($cinfo['groupid'])
return 'group';
else
if(VBSEO_VB4)
{
if(class_exists('vB_Types') && $cinfo['contenttypeid'])
{
$types = vB_Types::instance();
if($cinfo['contenttypeid'] == $types->getContentTypeID('vBForum_Album'))
return 'album';
else
if($cinfo['contenttypeid'] == $types->getContentTypeID('vBForum_SocialGroup'))
return 'group';
else
if($cinfo['contenttypeid'] == $types->getContentTypeID('vBBlog_BlogEntry'))
return 'blog';
else
if($cinfo['contenttypeid'] == $types->getContentTypeID('vBCms_Section'))
return 'cms_section';
else
if($cinfo['contenttypeid'] == $types->getContentTypeID('vBCms_Article'))
return 'cms_article';
else
return 'forum';
}else
if(!$cinfo['contenttypeid'] || $cinfo['contenttypeid']<3)
return 'forum';
}
}
function vbseo_attachment_contentid($attinfo)
{
if($attinfo['albumid'])
return $attinfo['albumid'];
else
if($attinfo['groupid'])
return $attinfo['groupid'];
else
return $attinfo['contentid'];
}

 

Revise this Paste

Your Name: Code Language: