Вы находитесь на странице: 1из 9

#

#-----[ open posting.php ]-------------------------------------------


#

#
#-----[ find ]---------------------------------------------
#

if( $attach_sig && $user_sig != '' && $userdata['user_sig_bbcode_uid'] )


{
$user_sig = bbencode_second_pass($user_sig,
$userdata['user_sig_bbcode_uid']);
}

if( $bbcode_on )
{
$preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
}

#
#-----[ replace with ]-------------------------------------------
#

$valid = false;
if( $userdata['session_logged_in'] ) {
$sql = "select p.poster_id, p.topic_id
from " . posts_table . " p
where p.topic_id = $topic_id
and p.poster_id = " . $userdata['user_id'];
$resultat = $db->sql_query($sql);
$valid = $db->sql_numrows($resultat) ? true : false;}

if( $attach_sig && $user_sig != '' && $userdata['user_sig_bbcode_uid'] )


{
$user_sig = bbencode_second_pass($user_sig,
$userdata['user_sig_bbcode_uid']);
$user_sig = bbencode_third_pass($user_sig,
$userdata['user_sig_bbcode_uid'], $valid);
}

if( $bbcode_on )
{
$preview_message = bbencode_second_pass($preview_message, $bbcode_uid);
$preview_message = bbencode_third_pass($preview_message, $bbcode_uid,
$valid);
}

#
#-----[ find ]---------------------------------------------
#

if ( !preg_match('/^re:/', $subject) && strlen($subject) > 0 )


{
$subject = 're: ' . $subject;
}

#
#-----[ add below ]-------------------------------------------
#

if( !$userdata['session_logged_in'] ) {$message = hide_in_quote($message);}


else { $sql = "select p.poster_id, p.topic_id
from " . posts_table . " p
where p.topic_id = $topic_id
and p.poster_id = " . $userdata['user_id'];
$resultat = $db->sql_query($sql);
if(!$db->sql_numrows($resultat)) {$message = hide_in_quote($message);}
}

#
#-----[ open viewtopic.php ]---------------------------------------------
#

#
#-----[ find ]---------------------------------------------
#

//
// generate a 'show posts in previous x days' select box. if the postdays var is
posted
// then get it's value, find the number of topics with dates newer than it (to
properly
// handle pagination) and alter the main query
//

#
#-----[ add below ]-------------------------------------------
#

$valid = false;
if( $userdata['session_logged_in'] ) {
$sql = "select p.poster_id, p.topic_id
from " . posts_table . " p
where p.topic_id = $topic_id
and p.poster_id = " . $userdata['user_id'];
$resultat = $db->sql_query($sql);
$valid = $db->sql_numrows($resultat) ? true : false;}

#
#-----[ find ]---------------------------------------------
#-----[ be sure to use a recent version of phpbb or you will not find this
part ]---------------------------------------------
#

if ($user_sig != '' && $user_sig_bbcode_uid != '')


{
$user_sig = ($board_config['allow_bbcode']) ?
bbencode_second_pass($user_sig, $user_sig_bbcode_uid) :
preg_replace("/\:$user_sig_bbcode_uid/si", '', $user_sig);
}

if ($bbcode_uid != '')
{
$message = ($board_config['allow_bbcode']) ?
bbencode_second_pass($message, $bbcode_uid) : preg_replace("/\:$bbcode_uid/si",
'', $message);
}

#
#-----[ replace with ]-------------------------------------------
#

if ( $user_sig != '' && $user_sig_bbcode_uid != '' )


{
$user_sig = ($board_config['allow_bbcode']) ?
bbencode_second_pass($user_sig, $user_sig_bbcode_uid) :
preg_replace("/\:$user_sig_bbcode_uid/si", '', $user_sig);
$user_sig = bbencode_third_pass($user_sig, $user_sig_bbcode_uid, $valid);
}

if ( $bbcode_uid != '' )
{
$message = ($board_config['allow_bbcode']) ?
bbencode_second_pass($message, $bbcode_uid) : preg_replace("/\:$bbcode_uid/si",
'', $message);
$message = bbencode_third_pass($message, $bbcode_uid, $valid);
}

#
#-----[ open serarch.php ]---------------------------------------------
#

#
#-----[ find ]---------------------------------------------
#

//
// if the board has html off but the post has html
// on then we process it, else leave it alone
//
if ( $return_chars != -1 )

#
#-----[ replace with ]---------------------------------------------
#

//
// if the board has html off but the post has html
// on then we process it, else leave it alone
//
if( $return_chars == -1 )

#
#-----[ find ]---------------------------------------------
#

if ( $bbcode_uid != '' )
{
$message = ( $board_config['allow_bbcode'] ) ?
bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si',
']', $message);
}

#
#-----[ replace with ]---------------------------------------------
#

if ( $bbcode_uid != '' )
{
$message = ( $board_config['allow_bbcode'] ) ?
bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si',
']', $message);
$message = bbencode_third_pass($message, $bbcode_uid, false);
}

#
#-----[ open topic_review.php (in includes
directory) ]---------------------------------------------
#

#
#-----[ find ]---------------------------------------------
#

//
// okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
//
if ( $row = $db->sql_fetchrow($result) )
{

#
#-----[ add below ]---------------------------------------------
#

$valid = false;
if( $userdata['session_logged_in'] ) {
$sql = "select p.poster_id, p.topic_id
from " . posts_table . " p
where p.topic_id = $topic_id
and p.poster_id = " . $userdata['user_id'];
$resultat = $db->sql_query($sql);
$valid = $db->sql_numrows($resultat) ? true : false;}

#
#-----[ find ]---------------------------------------------
#

if ( $bbcode_uid != "" )
{
$message = ( $board_config['allow_bbcode'] ) ?
bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si',
']', $message);
}

#
#-----[ replace with ]---------------------------------------------
#
if ( $bbcode_uid != "" )
{
$message = ( $board_config['allow_bbcode'] ) ?
bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si',
']', $message);
$message = bbencode_third_pass($message, $bbcode_uid, $valid);
}

#
#-----[ open bbcode.php (includes
directory) ]---------------------------------------------
#

#
#-----[ find ]---------------------------------------------
#

$bbcode_tpl['email'] = str_replace('{email}', '\\1', $bbcode_tpl['email']);

#
#-----[ add below ]---------------------------------------------
#

$bbcode_tpl['show'] = str_replace('{modhide_title}', $lang['modhide_title'],


$bbcode_tpl['show']);
$bbcode_tpl['show'] = str_replace('{htexte}', '\\1', $bbcode_tpl['show']);
$bbcode_tpl['hide'] = str_replace('{modhide_title}', $lang['modhide_title'],
$bbcode_tpl['hide']);
$bbcode_tpl['hide'] = str_replace('{modhide_info}', $lang['modhide_info'],
$bbcode_tpl['hide']);

#
#-----[ find ]---------------------------------------------
#

/**
* does second-pass bbencoding. this should be used before displaying the message
in
* a thread. assumes the message is already first-pass encoded, and we are given
the
* correct uid as used in first-pass encoding.
*/

#
#-----[ add before !!!! ]---------------------------------------------
#

function hide_in_quote($text)
{
global $lang;

$text =
preg_replace("#\[hide\](.*?)\[\/hide\]#si",$lang['modhide_quote'],$text);
return $text;
}

function bbencode_third_pass($text, $uid, $deprotect)


{
global $bbcode_tpl;

// pad it with a space so we can distinguish between false and matching


the 1st char (index 0).
// this is important; bbencode_quote(), bbencode_list(), and
bbencode_code() all depend on it.
$text = " " . $text;

// first: if there isn't a "[" and a "]" in the message, don't bother.
if (! (strpos($text, "[") && strpos($text, "]")) )
{
// remove padding, return.
$text = substr($text, 1);
return $text;
}
// patterns and replacements for url and email tags..
$patterns = array();
$replacements = array();

if ( $deprotect ) {
$patterns[0] = "#\[hide:$uid\](.*?)\[/hide:$uid\]#si";
$replacements[0] = $bbcode_tpl['show'];
}
else
{
$patterns[0] = "#\[hide:$uid\](.*?)\[/hide:$uid\]#si";
$replacements[0] = $bbcode_tpl['hide'];
}

$text = preg_replace($patterns, $replacements, $text);

// remove our padding from the string..


$text = substr($text, 1);

return $text;
}

#
#-----[ find ]---------------------------------------------
#

// [img]image_url_here[/img] code..
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^
\?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' .
str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);

#
#-----[ add below ]---------------------------------------------
#

//[hide]message[/hide]
$text = preg_replace("#\[hide\](.*?)\[\/hide\]#si","[hide:$uid]\\1[/hide:$uid]",
$text);

#
#-----[ open bbcode.tpl (template
directory) ]---------------------------------------------
#

#
#-----[ add at top ]---------------------------------------------
#

<!-- begin show -->


</span>
<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1">
<tr>
<td><span class="genmed"><b>{modhide_title}</b></span></td>
</tr>
<tr>
<td class="quote">
{htexte}
</td>
</tr>
</table>
<span class="postbody">
<!-- end show -->

<!-- begin hide -->


</span>
<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1">
<tr>
<td><span class="genmed"><b>{modhide_title}</b></span></td>
</tr>
<tr>
<td class="quote">
<center>{modhide_info}</center>
</td>
</tr>
</table>
<span class="postbody">
<!-- end hide -->

#
#-----[ open posting_body.tpl ]---------------------------------------------
#
#
#-----[ find ]---------------------------------------------
#
<img border="0" src="mods/bbcode_box/images/spoil.gif" class="postimage"
name="spoil" type="image" onclick="bbcspoil()" onmouseover="helpline('spoil')"
alt="" />

#
#-----[ add after ]---------------------------------------------
#
<img border="0" src="mods/bbcode_box/images/hide.gif" class="postimage"
name="hide" type="image" onclick="bbchide()" onmouseover="helpline('hide')"
alt="hide" />

#
#-----[ open lang_main.php ]---------------------------------------------
#

#
#-----[ find ]---------------------------------------------
#

>

#
#-----[ add before ]---------------------------------------------
#

// mod "hide"
$lang['modhide_title'] = 'protected message :';
$lang['modhide_info'] = '--- if you are a *registered user* : you need to post in
this topic to see the message ---';
$lang['modhide_quote'] = '--- phpbb : the protected message is not copied in this
quote ---';

#
#-----[ open add_bbcode.js ]---------------------------------------------
#

#
#-----[ find ]---------------------------------------------
#
googlevid_help = "post a google video";

#
#-----[ add below ]---------------------------------------------
#

hide_help = "hidden text, log in and make a post to read";

#
#-----[ find ]---------------------------------------------
#
var gvideo = 0;

#
#-----[ add below ]---------------------------------------------
#
var hide = 0;

#
#-----[ find ]---------------------------------------------
#
function bbclist() {

#
#-----[ add !!!!! before !!!!!! ]---------------------------------------------
#

function bbchide() {
var txtarea = document.post.message;

if ((clientver >= 4) && is_ie && is_win) {


theselection = document.selection.createrange().text;
if (theselection != '') {
document.selection.createrange().text = "[hide]" + theselection +
"[/hide]";
document.post.message.focus();
return;
}
}
else if (txtarea.selectionend && (txtarea.selectionend -
txtarea.selectionstart > 0))
{
mozwrap(txtarea, "[hide]", "[/hide]");
return;
}
if (hide == 0) {
toadd = "[hide]";
document.post.hide.src = "mods/bbcode_box/images/hide1.gif";
hide = 1;
} else {
toadd = "[/hide]";
document.post.hide.src = "mods/bbcode_box/images/hide.gif";
hide = 0;
}
postwrite(toadd);
}

#
#-----[ open bbcode_box.js and perform same steps as for
add_bbcode.js ]---------------------------------------------
#

#
#-----[ create an icon for hide function, name it hide.gif and hide1.gif and put
it in mods/images folder ]---------------------------------------------
#

Вам также может понравиться