السلام عليكم ورحمة الله
لقدم قام الاخ الغالى Dar4arab بوضع هذا الهاك ولكنه لم يضع له شرح
ولقد قمت بتجربته على النسخة 3.5.4 وتم عمل الهاك بنجاح
هذا هو الشرح :
ولكن الهاك مختلف عن الهاكات الاخرى الخاصة بالاخفاء
الهاك يقوم باخفاء المحتوى عن العضو الذى مشاركاته اقل من 5 مشاركات
نبدأ ببسم الله
اولا قم بأخذ نسخة احتياظة من كل ملف راح تقوم بتعديله
اولا بعد فك الضغط عن المرفق راح يظهر لك صورتان بعنوان hide.gif ، showtogroups.gif
قم رفع الصورتان الى مجلد بعنوان editor بداخل مجلد الصور" images " داخل مجلد المنتدى ليكون بهذا المسار :
./images/editor/hide.gif
./images/editor/showtogroups.gif
ملحوظة : يتم وضع الصورتان فى مجلد الصور الخاص بالاستايل الموجود على نسخة المنتدى
==========================
بعد ذلك نتقل الى مرحلة اخرى وهى التعديل على الملفات :
اولا : التعديل على ملف : search.php الذى يوجد فى المجلد الرئيسى للمنتدى
قم بالبحث فيه عن هذا الكود :
كود PHP:
$post['pagetext'] = preg_replace('#\[quote(=("|"|\'|)??.*\\2)?\](((?>[^\[]*?|(?R)|.))*)\[/quote\]#siUe', "process_quote_removal('\\3', \$display['highlight'])", $post['pagetext']);
اضف تحته هذا الكود :
كود PHP:
$post['pagetext'] = strip_tags(str_replace("<br />", "\n", parseHide($post['pagetext'])));
بعد ذلك قم بحفظ الملف ورفعه الى مكانه
ثانيا : التعديل على ملف : index.php الذى يوجد بداخل مجلد archive :
قم بالبحث عن الكود :
كود PHP:
$post['pagetext_simp'] = strip_bbcode($post['pagetext']);
استبدله بالكود :
كود PHP:
/**
/* [hide] Hack Resurrection (Limited) for vBulletin 3.5
/* Author: Dark Visor
/* E-mail: ankan925@optonline.net
/*
/* OLD VERSION OF THIS CODE:
/* $post['pagetext_simp'] = strip_bbcode($post['pagetext']);
*/
$post['pagetext_simp'] = stripHide($post['pagetext'], 'archive');
$post['pagetext_simp'] = strip_bbcode($post['pagetext_simp']);
/**
/* [hide] Hack Resurrection for vBulletin 3.5 [END]
*/
ثم قم بحفظ الملف ورفعه
ثالثا : التعديل على الملف : functions.php والذى ستجده بداخل مجلد includes :
ابحث عن :
كود PHP:
// #############################################################################
/**
* Performs general clean-up after the system exits, such as running shutdown queries
*/
function exec_shut_down()
اضف اعلاه :
كود PHP:
// #############################################################################
/**
* [hide] Hack Resurrection (Limited) by Dark Visor :: Custom Function
* Parses the text block for [hide] and [SHOWTOGROUPS] tags and calls the apporpriate functions to perform replacements.
*
* @param string Raw text block that needs parsing
*
* @return string Parsed text block
*/
function parseHide($text)
{
global $vbulletin;
$text = preg_replace("/\[hide\]/siU", "[hide=".$vbulletin->options['hidetag_defaultposts']."]", $text);
$text = preg_replace_callback("/\[hide=("|\"|'|)([0-9]*)\\1\](.*)\[\/hide\]/siU",
create_function(
'$matches',
'return parseHide2($matches[2],$matches[3]);'
),
$text);
$text = preg_replace_callback("/\[showtogroups=("|\"|'|)([0-9,]+)\\1\](.*)\[\/showtogroups\]/siU",
create_function(
'$matches',
'return parseShowToGroups($matches[2],$matches[3]);'
),
$text);
return $text;
}
// #############################################################################
/**
* [hide] Hack Resurrection (Limited) by Dark Visor :: Custom Function
* Parses the [hide] tag and replaces it with appropriate HTML code.
*
* @param int The amount of required posts
* @param string Raw text block that needs parsing
*
* @return string Parsed text block
*/
function parseHide2($postsrequired,$text)
{
// ####################################################
// init
// ####################################################
global $vbulletin, $vbphrase, $thread, $threadinfo, $post;
$forumid = (is_array($thread) ? $thread['forumid'] : $threadinfo['forumid']);
if (THIS_SCRIPT == 'search')
{
$forumid = $post['forumid'];
}
$threadid = (is_array($thread) ? $thread['threadid'] : $threadinfo['threadid']);
if (THIS_SCRIPT == 'search')
{
$threadid = $post['threadid'];
}
$threaddata = (is_array($thread) ? $thread : $threadinfo);
$posterid = (is_array($post) ? $post['userid'] : $threaddata['postuserid']);
// ####################################################
$postsrequired = intval($postsrequired);
$hidetag['usergroups_viewer'] = $vbulletin->userinfo['usergroupid'] . iif(!empty($vbulletin->userinfo['membergroupids']), ",", "") . $vbulletin->userinfo['membergroupids'];
$hidetag['usergroups_viewer'] = explode(",", $hidetag['usergroups_viewer']);
// ####################################################
// check user's eligibility to view the content
// ####################################################
$hidetag['canview'] = false;
foreach($hidetag['usergroups_viewer'] as $usergroup)
{
if (in_array($usergroup, array(5,6)))
{
$hidetag['canview'] = true; // allowed if [user = supermod | user = admin]
}
}
if (can_moderate($forumid) AND in_array(THIS_SCRIPT, array('forumdisplay', 'showthread', 'showpost', 'archive', 'printthread')))
{
$hidetag['canview'] = true; // allowed if [user = mod]
}
if ($vbulletin->userinfo['posts'] >= $postsrequired)
{
$hidetag['canview'] = true; // allowed if [user = conditional match]
}
if ($vbulletin->userinfo['usergroupid'] == 3 OR $vbulletin->userinfo['usergroupid'] == 4)
{
$hidetag['canview'] = false; // disallowed if [user has changed his/her email and is not confirmed or is an unmoderated coppa]
}
if ($vbulletin->userinfo['userid'] != NULL AND $vbulletin->userinfo['userid'] == $posterid)
{
$hidetag['canview'] = true; // allowed if [user matched but not guest]
}
if (!$post['postid'] AND in_array(THIS_SCRIPT, array('newthread', 'newreply')))
{
$hidetag['canview'] = true; // allowed if [user is making a post]
}
if (in_array(THIS_SCRIPT, array('editpost')))
{
$hidetag['canview'] = true; // allowed if [user is editing a post]
}
// ####################################################
// output
// ####################################################
if ($vbulletin->userinfo['userid'] == NULL)
{
if ($postsrequired == 0)
{
$vbphrase['hidetag_and_x_posts'] = "";
}
else
{
$vbphrase['hidetag_and_x_posts'] = " " . construct_phrase($vbphrase['hidetag_and_x_posts'], $postsrequired);
}
$text = "<font color='" . $vbulletin->options['hidetag_color'] . "'><b>" . construct_phrase($vbphrase['hidetag_posts_guest_caption'], $vbphrase['hidetag_and_x_posts']) . ":</b><br />" . $vbphrase['hidetag_accessdenied'] . "</font>";
}
elseif ($hidetag['canview'] == true)
{
$text = "<font color='" . $vbulletin->options['hidetag_color'] . "'><b>" . construct_phrase($vbphrase['hidetag_posts_registered_caption'], $postsrequired, $vbulletin->userinfo['posts']) . ":</b><br />" . $text . "</font>";
}
else
{
$text = "<font color='" . $vbulletin->options['hidetag_color'] . "'><b>" . construct_phrase($vbphrase['hidetag_posts_registered_caption'], $postsrequired, $vbulletin->userinfo['posts']) . ":</b><br />" . $vbphrase['hidetag_accessdenied'] . "</font>";
}
return $text;
}
// #############################################################################
/**
* [hide] Hack Resurrection (Limited) by Dark Visor :: Custom Function
* Parses the [SHOWTOGROUPS] tag and replaces it with appropriate HTML code.
*
* @param string A list of acceptable userids, separated by commas
* @param string Raw text block that needs parsing
*
* @return string Parsed text block
*/
function parseShowToGroups($usergroupids,$text)
{
// ####################################################
// init
// ####################################################
global $vbulletin, $vbphrase, $db, $thread, $threadinfo, $post;
$forumid = (is_array($thread) ? $thread['forumid'] : $threadinfo['forumid']);
if (THIS_SCRIPT == 'search')
{
$forumid = $post['forumid'];
}
$threadid = (is_array($thread) ? $thread['threadid'] : $threadinfo['threadid']);
if (THIS_SCRIPT == 'search')
{
$threadid = $post['threadid'];
}
$threaddata = (is_array($thread) ? $thread : $threadinfo);
$posterid = (is_array($post) ? $post['userid'] : $threaddata['postuserid']);
// ####################################################
$hidetag['usergroups_viewer'] = $vbulletin->userinfo['usergroupid'] . iif(!empty($vbulletin->userinfo['membergroupids']), ",", "") . $vbulletin->userinfo['membergroupids'];
$hidetag['usergroups_viewer'] = explode(",", $hidetag['usergroups_viewer']);
$hidetag['usergroups_allowed_list'] = '';
// hash the group names so that they are called only once
static $mysql_data = '';
static $usergroups_data = '';
$hidetag['usergroups_allowed'] = explode(",", $usergroupids);
if ($mysql_data == '')
{
$mysql_data = $db->query_read("SELECT usergroupid,title FROM " . TABLE_PREFIX . "usergroup ORDER BY usergroupid");
}
if ($usergroups_data == '')
{
while ($i = $db->fetch_array($mysql_data))
{
$usergroups_data[] = $i;
}
}
// end hash
// retrieve usergroup titles from hash
foreach ($usergroups_data as $row)
{
if (in_array($row['usergroupid'],$hidetag['usergroups_allowed']))
{
$hidetag['usergroups_list'] = $hidetag['usergroups_list'] . iif($hidetag['usergroups_list'] == '', "", ", ") . $row['title'] . " :: " . $row['usergroupid'];
}
}
if (empty($hidetag['usergroups_list']))
{
$hidetag['usergroups_list'] = "N/A :: 0";
}
// end retrieve
// ####################################################
// check user's eligibility to view the content
// ####################################################
$hidetag['canview'] = false;
foreach ($hidetag['usergroups_viewer'] as $usergroup)
{
if (in_array($usergroup, array(5,6)) OR in_array($usergroup, $hidetag['usergroups_allowed']))
{
$hidetag['canview'] = true; // allowed if [user = conditional match | user = supermod | user = admin]
}
}
if (can_moderate($forumid) AND in_array(THIS_SCRIPT, array('forumdisplay', 'showthread', 'archive', 'printthread')))
{
$hidetag['canview'] = true; // allowed if [user = mod]
}
if ($vbulletin->userinfo['usergroupid'] == 3 OR $vbulletin->userinfo['usergroupid'] == 4)
{
$hidetag['canview'] = false; // disallowed if [user has changed his/her email and is not confirmed or is an unmoderated coppa]
}
if ($vbulletin->userinfo['userid'] != NULL AND $vbulletin->userinfo['userid'] == $posterid)
{
$hidetag['canview'] = true; // allowed if [user matched but not guest]
}
if (!$post['postid'] AND in_array(THIS_SCRIPT, array('newthread', 'newreply')))
{
$hidetag['canview'] = true; // allowed if [user is making a post]
}
if (in_array(THIS_SCRIPT, array('editpost')))
{
$hidetag['canview'] = true; // allowed if [user is editing a post]
}
// ####################################################
// output
// ####################################################
if ($hidetag['canview'] == true)
{
$text = "<font color='" . $vbulletin->options['hidetag_color'] . "'><strong>" . construct_phrase($vbphrase['hidetag_showtogroups_caption'], $hidetag['usergroups_list']) . ":</strong><br />" . $text . "</font>";
}
else
{
$text = "<font color='" . $vbulletin->options['hidetag_color'] . "'><strong>" . construct_phrase($vbphrase['hidetag_showtogroups_caption'], $hidetag['usergroups_list']) . ":</strong><br />" . $vbphrase['hidetag_accessdenied'] . "</font>";
}
return $text;
}
// #############################################################################
/**
* [hide] Hack Resurrection (Limited) by Dark Visor :: Custom Function
* Strips [hide], [SHOWTOGROUPS] from where it should not be shown.
*
* @param string Raw text block that needs parsing
* @param string A place pointer, which defines the replacement.
*
* @return string Parsed text block
*/
function stripHide($text,$where='')
{
global $vbphrase;
switch ($where)
{
case 'editor':
$replacement = $vbphrase['hidetag_stripped_quote'];
break;
case 'email':
$replacement = $vbphrase['hidetag_stripped_email'];
break;
case 'archive':
$replacement = $vbphrase['hidetag_stripped_archive'];
break;
default:
$replacement = "[hide] Hack Resurrection by Dark Visor: Undefined Replacement [ErrorCode SH01]";
break;
}
$text = preg_replace("/\[hide\](.*)\[\/hide\]/siU", $replacement, $text);
$text = preg_replace("/\[hide=("|\"|'|)([0-9]*)\\1\](.*)\[\/hide\]/siU", $replacement, $text);
$text = preg_replace("/\[showtogroups=("|\"|'|)([0-9,]+)\\1\](.*)\[\/showtogroups\]/siU", $replacement, $text);
return $text;
}
ثم قم بحفظ المف ورفعه
رابعا : التعديل على الملف functions_digest.php بداخل مجلد includes :
ابحث عن :
كود PHP:
$post['pagetext'] = unhtmlspecialchars(strip_bbcode($post['pagetext']));
اضف اعلاه:
كود PHP:
$post['pagetext'] = strip_tags(str_replace("<br />", "\n", stripHide($post['pagetext'], 'email')));
واحفظ الملف
خامسا : التعديل على الملف functions_forumdisplay.php بداخل مجلد includes :
ابحث عن :
كود PHP:
$thread['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(
strip_bbcode($thread['preview'], false, true),
$vbulletin->options['threadpreview']
اضف اعلاه :
كود PHP:
$thread['preview'] = strip_tags(str_replace("<br />", "\n", parseHide($thread['preview'])));
واحفظ الملف
سادسا: التعديل على ملف functions_newpost.php فى مجلد includes :
ابحث عن :
كود PHP:
$pagetext = strip_bbcode($pagetext, 1);
اضف اعلاه :
كود PHP:
$pagetext = stripHide($pagetext, 'email');
واحفظه
سابعا : التعديل على ملف vbulletin_textedit.js فى مجلد clientscript :
ابحث عن :
كود PHP:
case 'PHP':
{
this.apply_format('removeformat');
}
اضف اسفله :
كود PHP:
break;
case 'HIDE':
case 'SHOWTOGROUPS':
{
useoption = true;
}
واحفظ الملف
=======================
الخطوة القبل الاخيرة
وهى التعديل على تمبلت editor_toolbar_on
قم بالحث عن :
كود PHP:
$vBeditTemplate[extrabuttons]
اضف اعلاه :
كود PHP:
<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
<td><div class="imagebutton" id="{$editorid}_cmd_wrap0_hide"><img src="$stylevar[imgdir_editor]/hide.gif" width="41" height="20" alt="$vbphrase[wrap_hide_tags]" /></div></td>
<td><div class="imagebutton" id="{$editorid}_cmd_wrap0_showtogroups"><img src="$stylevar[imgdir_editor]/showtogroups.gif" width="31" height="20" alt="$vbphrase[wrap_showtogroups_tags]" /></div></td>
==============
الخطوه الاخيره
وهى رفع ملف PRODUCT
قم برفع ملف product-darkvisor_hide.xml من لوحة التحكم
وبهذا نكون قد انتهينا من تركيب الهاك بنجاح
لتشغيل الهاك :
عند اخفاء نص نقوم بعمله كالاتى :
النص المراد اخفائه
واى سؤال انا تحت امركم
اخوكم Dr.MinD :shiny: