WARHEAD
Компетентный
Приветствую всех!
Сегодня хочу выложить инструкции по vBulletin 4.x.
Итак:
1. Как пофиксить уязвимость хайдов?
1. Заходим в папку includes ищем vS_HHR_Engine.php открываем
2. Удаляем всё и заменяем этим
Далее сохраняем. Готово! Пользуйтесь.
2. Как выравнить аватар, ник, статус?
Чтобы аватар был по центру, войди в шаблон postbit_legacy своего стиля.
Прежде чем проделывать следующее, создай копию этого шаблона (это на всякий случай, мало ли не пойдёт).
Ну а затем, в шаблоне postbit_legacy, найди следующее:
И замени этим:
Чтобы статус (Admin, Пользователь и др.) были по центру, то в этом же шаблоне найди:
И просто по краям поставь <center></center>, то есть получим:
Ник по центру, также в этом же шаблоне ищи следующее:
И меняй на это:
Тема будет обновляться. :af::af::af:
Сегодня хочу выложить инструкции по vBulletin 4.x.
Итак:
1. Как пофиксить уязвимость хайдов?
1. Заходим в папку includes ищем vS_HHR_Engine.php открываем
2. Удаляем всё и заменяем этим
PHP:
<?php
if ($vbulletin->input->clean_gpc('r', 'highlight', TYPE_STR))
{
$vbulletin->GPC['highlight'] = $_GET['highlight'] = preg_replace('#^([\*\s\[]*)#e', "str_replace('[', '', '\\1')", $vbulletin->GPC['highlight']);
}
class vS_HHR_Engine
{
/**
* The vBulletin registry object
*
* @var vB_Registry
*/
var $registry = null;
/**
* Engine Tags
*
* @var array
*/
var $tags = array(
0 => 'HIDE-POSTS',
4 => 'SHOWTOGROUPS'
);
/**
* Engine Settings
*
* @var array
*/
var $settings = array(
'banned' => false,
'dohtml' => false,
);
/**
* Engine Variables
*
* @var array
*/
var $vars = array();
/**
* Constructor
*/
function vS_HHR_Engine(&$registry)
{
// globalize variables
global $show;
// verify vbulletin presence
if (is_object($registry))
{
$this->registry =& $registry;
}
else
{
trigger_error("vB_Database::Registry object is not an object", E_USER_ERROR);
}
// define whether the viewer cannot be view anything by definition
if (substr($this->registry->options['templateversion'], 0, 3) == '3.5')
{
$is_banned = (($this->registry->usergroupcache[$this->registry->userinfo['usergroupid']]['genericoptions'] & $this->registry->bf_ugp_genericoptions['isbannedgroup']) ? true : false);
}
else
{
$is_banned = (!($this->registry->usergroupcache[$this->registry->userinfo['usergroupid']]['genericoptions'] & $this->registry->bf_ugp_genericoptions['isnotbannedgroup']) ? true : false);
}
if (is_member_of($this->registry->userinfo, 3, 4) OR $is_banned OR THIS******* == 'misc')
{
$this->settings['banned'] = true;
}
else
{
$this->settings['banned'] = false;
}
// define whether to use html version of replacements
if (in_array(THIS*******, array('ajax', 'editpost', 'misc', 'newthread', 'newreply', 'printthread', 'showpost', 'showthread', 'vbcms', 'content')))
{
$this->settings['dohtml'] = true;
}
else
{
$this->settings['dohtml'] = false;
}
// apply makeup to $this->tags
foreach ($this->tags as $key => $tag)
{
$this->tags["$tag"] =& $this->tags["$key"];
}
if (isset($this->tags[$this->registry->options['hidetag_shortcut']]))
{
$this->tags[$this->registry->options['hidetag_shortcut']] .= '|HIDE';
}
// define whether to show the buttons
if (in_array(THIS*******, array('editpost', 'newthread', 'newreply')) OR (THIS******* == 'ajax' AND $_POST['do'] == 'quickedit') OR (THIS******* == 'showthread' AND $this->registry->options['quickreply']))
{
global $foruminfo;
$show['toolbar_hposts_button'] =
(
$this->registry->options['enable_hposts_tag']
);
$show['toolbar_showtogroups_button'] = (
$this->registry->options['enable_showtogroups_tag']
);
if ($show['toolbar_hposts_button'] OR $show['toolbar_showtogroups_button'])
{
$show['toolbar_hhr_separator'] = true;
switch ($this->registry->options['hidetag_shortcut'])
{
case 0:
$vbphrase['hidetag_explanation_shortcut'] = $vbphrase['hidetag_explanation_hposts'];
$show['toolbar_shortcut_button'] = $show['toolbar_hposts_button'];
break;
case 4:
$vbphrase['hidetag_explanation_shortcut'] = $vbphrase['hidetag_explanation_showtogroups'];
$show['toolbar_shortcut_button'] = $show['toolbar_showtogroups_button'];
break;
default:
$vbphrase['hidetag_explanation_shortcut'] = '';
$show['toolbar_shortcut_button'] = false;
}
}
else
{
$show['toolbar_hhr_separator'] = false;
$show['toolbar_shortcut_button'] = false;
}
}
}
###########################################################################################################################
# vS-Hide Hack Resurrection - vB Code Parser
###########################################################################################################################
/**
* Main function that is used to parse the tags.
*
* @var string Message (Raw)
*
* @return string Message (Parsed)
*/
function parse_bbcode($message, $forumid, $threadid, $postid, $userid)
{
// globalize variables
global $vbphrase, $stylevar, $show;
// fetch variables
$this->vars = array(
'forumid' => intval($forumid),
'threadid' => intval($threadid),
'postid' => intval($postid),
'userid' => intval($userid)
);
// parse message
$message = preg_replace("/\[(" . $this->tags['HIDE-POSTS'] . ")\]/siU", '[\\1=' . $this->registry->options['hidetag_defaultposts'] . ']', $message);
$message = preg_replace("/\[(" . $this->tags['HIDE-POSTS'] . ")=("|\"|'|)([0-9]+)\\2\](.*)\[\/\\1\]/esiU", "\$this->parse_bbcode_hposts('\\4', \\3)", $message);
$message = preg_replace("/\[(" . $this->tags['HIDE-POSTS'] . ")=" . $this->registry->options['hidetag_defaultposts'] . "\]/siU", '[\\1]', $message);
$message = preg_replace("/\[(" . $this->tags['SHOWTOGROUPS'] . ")\]/siU", '[\\1=' . $this->registry->options['hidetag_defaultgroups'] . ']', $message);
$message = preg_replace("/\[(" . $this->tags['SHOWTOGROUPS'] . ")=("|\"|'|)([0-9,]+)\\2\](.*)\[\/\\1\]/esiU", "\$this->parse_bbcode_showtogroups('\\4', '\\3')", $message);
$message = preg_replace("/\[(" . $this->tags['SHOWTOGROUPS'] . ")=" . $this->registry->options['hidetag_defaultgroups'] . "\]/siU", '[\\1]', $message);
// come to papa
return $message;
}
/**
* Main function that is used to parse the tags in sidebar/vBcms.
*
* @var string Message (Raw)
*
* @author GiveMeaBreak
*
* @return string Message (Parsed)
*/
function parse_bbcode_sidebar($message)
{
global $vbphrase;
while(preg_match("#\[hide=([^\]]+)\](.+?)\[/quote\]#ies", $message))
{
$message = preg_replace( "#\[hide=([^\]]+)\](.+?)\[/hide\]#is", $vbphrase['hide_text_hidded'], $message);
}
while(preg_match("#\[HIDE=([^\]]+)\](.+?)\[/HIDE\]#ies", $message))
{
$message = preg_replace( "#\[HIDE=([^\]]+)\](.+?)\[/HIDE\]#is", $vbphrase['hide_text_hidded'], $message);
}
while(preg_match("#\[SHOWTOGROUPS=([^\]]+)\](.+?)\[/SHOWTOGROUPS\]#ies", $message))
{
$message = preg_replace( "#\[SHOWTOGROUPS=([^\]]+)\](.+?)\[/SHOWTOGROUPS\]#is", $vbphrase['hide_text_hidded'], $message);
}
while(preg_match("#\[showtogroups=([^\]]+)\](.+?)\[/showtogroups\]#ies", $message))
{
$message = preg_replace( "#\[showtogroups=([^\]]+)\](.+?)\[/showtogroups\]#is", $vbphrase['hide_text_hidded'], $message);
}
while(preg_match("#\[HIDE-POSTS=([^\]]+)\](.+?)\[/HIDE-POSTS\]#ies", $message))
{
$message = preg_replace( "#\[HIDE-POSTS=([^\]]+)\](.+?)\[/HIDE-POSTS\]#is", $vbphrase['hide_text_hidded'], $message);
}
while(preg_match("#\[hide-posts=([^\]]+)\](.+?)\[/hide-posts\]#ies", $message))
{
$message = preg_replace( "#\[hide-posts=([^\]]+)\](.+?)\[/hide-posts\]#is", $vbphrase['hide_text_hidded'], $message);
}
$message = preg_replace( "#\[hide\](.+?)\[/hide\]#is", $vbphrase['hide_text_hidded'], $message);
$message = preg_replace( "#\[HIDE\](.+?)\[/HIDE\]#is", $vbphrase['hide_text_hidded'], $message);
$message = preg_replace( "#\[showtogroups\](.+?)\[/showtogroups\]#is", $vbphrase['hide_text_hidded'], $message);
$message = preg_replace( "#\[SHOWTOGROUPS\](.+?)\[/SHOWTOGROUPS\]#is", $vbphrase['hide_text_hidded'], $message);
return $message;
}
/**
* Helper function used to parse HIDE-POSTS
*
* @var string Message (Raw)
* @var int The number of required posts.
*
* @return string Message (Parsed)
*/
function parse_bbcode_hposts($message, $posts_required)
{
// globalize variables
global $vbphrase, $stylevar, $show;
// intialize field counter, for xhtml purposes
static $hidefieldid = 0;
$hidefieldid++;
// correct the escapements
$message = str_replace('\"', '"', $message);
// decide whether the person can view
$canview = false;
if (!$this->settings['banned'])
{
if ($this->can_override())
{
$canview = true;
}
else
{
if ($this->registry->userinfo['userid'] AND $this->registry->userinfo['posts'] >= $posts_required)
{
$canview = true;
}
}
}
// construct caption
if ($this->registry->userinfo['userid'])
{
$caption = construct_phrase($vbphrase['hidetag_caption_hposts_registered'], $posts_required, $this->registry->userinfo['posts']);
}
else if ($posts_required)
{
$caption = construct_phrase($vbphrase['hidetag_caption_hposts_guest_x'], $posts_required);
}
else
{
$caption = construct_phrase($vbphrase['hidetag_caption_hposts_guest']);
}
// construct shortcut for postid
$postid =& $this->vars['postid'];
// construct replacement
if ($this->settings['dohtml'])
{
$templater = vB_Template::create('bbcode_hposts');
$templater->register('canview', $canview);
$templater->register('postid', $postid);
$templater->register('hidefieldid', $hidefieldid);
$templater->register('caption', $caption);
$templater->register('message', $message);
$message = $templater->render();
}
else
{
$message = ($canview ? $message : construct_phrase($vbphrase['hidetag_message_nohtml'], $caption));
}
// come to papa
return $message;
}
/**
* Helper function used to parse SHOWTOGROUPS
*
* @var string Message (Raw)
* @var string Comma-Separated Usergroupids
*
* @return string Message (Parsed)
*/
function parse_bbcode_showtogroups($message, $usergroupids)
{
// globalize variables
global $vbphrase, $stylevar, $show;
// intialize field counter, for xhtml purposes
static $hidefieldid = 0;
$hidefieldid++;
// correct the escapements
$message = str_replace('\"', '"', $message);
// fetch usergroups
$usergroupids = array_intersect(array_keys($this->registry->usergroupcache), explode(",", $usergroupids));
sort($usergroupids, SORT_NUMERIC);
if (sizeof($usergroupids) > 0)
{
foreach ($usergroupids as $usergroupid)
{
$uglist .= (!empty($uglist) ? ', ' : '') . $this->registry->usergroupcache[$usergroupid]['title'] . " :: " . $usergroupid;
}
}
else
{
$uglist = "N/A :: ".$vbphrase['hidetag_invalidgroups'];
}
// decide whether the person can view
$canview = false;
if (!$this->settings['banned'])
{
if ($this->can_override())
{
$canview = true;
}
else
{
if (is_member_of($this->registry->userinfo, $usergroupids))
{
$canview = true;
}
}
}
// construct caption
$caption = construct_phrase($vbphrase['hidetag_caption_showtogroups'], $uglist);
// construct shortcut for postid
$postid =& $this->vars['postid'];
// construct replacement
if ($this->settings['dohtml'])
{
$templater = vB_Template::create('bbcode_showtogroups');
$templater->register('canview', $canview);
$templater->register('postid', $postid);
$templater->register('hidefieldid', $hidefieldid);
$templater->register('caption', $caption);
$templater->register('message', $message);
$message = $templater->render();
}
else
{
$message = ($canview ? $message : construct_phrase($vbphrase['hidetag_message_nohtml'], $caption));
}
// come to papa
return $message;
}
/**
* Helper function used to strip bbcode.
*
* @var string Message (Raw)
* @var string Purpose of Stripping ('editor', 'email', 'dopost')
*
* @return string Message (Parsed)
*/
function strip_bbcode($message, $purpose = '')
{
// globalize variables
global $vbphrase, $stylevar, $show;
// construct replacement
switch ($purpose)
{
case 'editor':
$replacement = $vbphrase['hidetag_stripped_quote'];
break;
case 'email':
$replacement = $vbphrase['hidetag_stripped_email'];
break;
case 'dopost':
$replacement = '';
break;
default:
$replacement = 'vS-Hide Hack Resurrection: invalid_replacion';
break;
}
if (!($purpose == 'dopost' AND $show['toolbar_hposts_button']))
{
$message = preg_replace("/\[(" . $this->tags['HIDE-POSTS'] . ")\](.*)\[\/\\1\]/siU", $replacement, $message);
$message = preg_replace("/\[(" . $this->tags['HIDE-POSTS'] . ")=("|\"|'|)([0-9]+)\\2\](.*)\[\/\\1\]/siU", $replacement, $message);
}
if (!($purpose == 'dopost' AND $show['toolbar_showtogroups_button']))
{
$message = preg_replace("/\[(" . $this->tags['SHOWTOGROUPS'] . ")=("|\"|'|)([0-9,]+)\\2\](.*)\[\/\\1\]/siU", $replacement, $message);
}
// come to papa
return $message;
}
/**
* Returns true if the viewer can view hidden content regardless of conditional, false otherwise.
*
* @return boolean
*/
function can_override()
{
if ($this->registry->userinfo['permissions']['hhroptions'] & $this->registry->bf_ugp['hhroptions']['can_override_hide'])
{
return true;
}
if (in_array(THIS*******, array('editpost', 'newthread')))
{
return true; // can override if [user is editing or making a post]
}
if (THIS******* == 'newreply' AND !$this->vars['postid'])
{
return true; // can override if [user is previewing a new post]
}
if ($this->registry->userinfo['userid'] AND $this->registry->userinfo['userid'] == $this->vars['userid'])
{
return true; // can override if [user is the absolute post's owner (not a guest)]
}
if (can_moderate($this->vars['forumid'], 'caneditposts'))
{
return true; // can override if [user is a moderator of the current forum with post editing permissions]
}
return false;
}
}
$hhr = new vS_HHR_Engine($vbulletin);
/*======================================================================*\
|| #################################################################### ||
|| # vS-Hide Hack Resurrection (Expanded Edition) for vBulletin 3.5.x - 3.8.x by Anton Kanevsky
|| # NulleD By - FintMax
|| #################################################################### ||
\*======================================================================*/
?>
2. Как выравнить аватар, ник, статус?
Чтобы аватар был по центру, войди в шаблон postbit_legacy своего стиля.
Прежде чем проделывать следующее, создай копию этого шаблона (это на всякий случай, мало ли не пойдёт).
Ну а затем, в шаблоне postbit_legacy, найди следующее:
PHP:
<vb:if condition="$show['avatar']">
<a class="postuseravatar" href="{vb:link member, {vb:raw post}}" title="{vb:rawphrase {vb:raw post['onlinestatusphrase']}, {vb:raw post.username}}">
<img src="{vb:raw post.avatarurl}" alt="{vb:rawphrase xs_avatar, {vb:raw post.username}}" title="{vb:rawphrase xs_avatar, {vb:raw post.username}}" />
</a>
</vb:if>
<vb:if condition="$post['userid']">
<hr />
PHP:
<vb:if condition="$show['avatar']">
<a class="postuseravatar" href="{vb:link member, {vb:raw post}}" title="{vb:rawphrase {vb:raw post['onlinestatusphrase']}, {vb:raw post.username}}"></a>
</vb:if>
<vb:if condition="$post['userid']">
<hr />
<center><img src="{vb:raw post.avatarurl}" alt="{vb:rawphrase xs_avatar, {vb:raw post.username}}" title="{vb:rawphrase xs_avatar, {vb:raw post.username}}" /></center>
PHP:
<span class="usertitle">
{vb:raw post.usertitle}
</span>
PHP:
<center><span class="usertitle">
{vb:raw post.usertitle}
</span></center>
PHP:
<div class="postdetails">
<div class="userinfo">
<div class="username_container">
<vb:if condition="$post['userid']">
{vb:raw memberaction_dropdown}
{vb:raw post.onlinestatus}
<vb:else />
PHP:
<div class="postdetails">
<div class="userinfo">
<div class="username_container">
<center><vb:if condition="$post['userid']">
{vb:raw memberaction_dropdown}
{vb:raw post.onlinestatus}
<vb:else /></center>
Последнее редактирование модератором:
