vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   vB3 Block PHP, CODE and HTML from unregistered users (https://vborg.vbsupport.ru/showthread.php?t=59648)

Boofo 01-03-2004 10:00 PM

vB3 Block PHP, CODE and HTML from unregistered users
 
vB3 Block PHP, CODE and HTML from unregistered visitors v1.1
(By Boofo)

What does this hack do?
This will block all php, code and html code from all unregistered users. Any code bewteen those tags will be replaced will a line telling them they are not allowed to view the code and to please register. (You can change the messages to whatever you like.) Included is also the code for the QUOTE boxes. I don't use the QUOTE boxes bypass on my board, but I have the option ready in case someone decides to quote code, php or html code to bypass this hack. Anything between the code, php or html tags will be parsed out, even quote tags, as long as it is between one of the other tags within the quote itself. If someone just puts QUOTE tags around the code itself, then it will show as normal (unless you add the quote bypass below).

Version Information:
Version 1.0 --Initial release
Version 1.1 --Updated to now work in the archive. Also added the ability to double-click the code box to copy the code to the clipboard. Only works in IE so far. Will be adding the double-clicking ability for other browers as I find what will work with them.

Installation overview:
Files to edit: (2)
--includes/functions_bbcodeparse.php
--archive/index.php
Templates to edit: 3 (Optional: 2)
--bbcode_code
--bbcode_html
--bbcode_php
(Optional)
--bbcode_sql
--bbcode_quote
Phrases to add: 3 (Optional: 2)
--bf2_block_code
--bf2_block_html
--bf2_block_php
(Optional)
--bf2_sql_code
--bbcode_quote

If you find this hack useful, please click the install button. ;)

Dean C 01-04-2004 12:32 PM

Hehe you beat me to porting it. Good to see you back again Bob :)

Boofo 01-04-2004 12:47 PM

I could never get this to work right before the Gamma. The template conditionals make it so easy now. Would have done it all that way except the global doesn't work in templates (at least I couldn't get it to work there). ;)

Boofo 01-04-2004 03:35 PM

I run RC1 and it works fine for me. Go through the hack again and make sure you added the stuff to the file.

Koutaru 01-04-2004 03:39 PM

Neat :) I'll definately try this one.

Chroder 01-04-2004 05:21 PM

Ah, sweet stuff Boofo :D I'm ginna add this to my board too.

*install

cirisme 01-04-2004 05:27 PM

Does this work with post caching?

Chroder 01-04-2004 05:56 PM

Seems to work fine :)

Boofo 01-04-2004 06:52 PM

Thank you, Chroder, for verifying that. I don't have post caching enabled but I thought it should work with it. ;)

Don't forget the install button, guys. ;)

MindTrix 01-04-2004 07:02 PM

Can this be edited for other bbcode? For example the spoiler one that was recently released, can it be edited along with this so that unregistered users cannot see it?

Boofo 01-04-2004 07:08 PM

I don't think this hack will work with that. Just do an if conditon for the bbuserinfo['userid'] before the spoiler in the postbit (if that's where it is, I haven't looked at the hack). ;)

cirisme 01-04-2004 08:00 PM

Cool. That surpises me considering how the templates, etc work... I tried something similar in b7 so things must have changed with gamma/rc1.

I will definately check it out :)

Boofo 01-04-2004 08:16 PM

Then click the button, my man! ;)

Repec 01-07-2004 11:21 AM

very nice addition Boofo :D

[high]* Repec does the infamous lick of the install button ;)[/high]

Ronin 01-19-2004 04:40 AM

Nice Job.. I'l be using this one as well! Thanks!

cindyd 02-28-2004 08:07 PM

Boofo, can this hack be used to block replies to a post? I want to have cetain user groups see the first question but not the answers. The user group that has paid for membership will be able to see the answers.

So I need to block text in the replies. I don't have any code to block just text. Will this work on 2.3.0?

Boofo 02-28-2004 08:15 PM

This can be modified to work on vB2 fairly easily. As far as blocking text within a message, yes it will. To block part of the text in a message, as it it, no it won't. Again, it can be modified to do so fairly easily I think. Does that help answer your question? If not, pm me with exactly wat you want this to do and we will see about setting it up for you to do that. ;)

coldpride 03-02-2004 12:13 AM

this works good on vb rc4.. Useful hack for coder forums.

Boofo 03-02-2004 12:24 AM

I have an update in the works. ;)

Bulent Tekcan 04-20-2004 09:45 PM

Not work in 3.0.1.....ANy suggestion ?

Boofo 04-20-2004 11:32 PM

I'm not running 3.01 yet. What code is different?

Bulent Tekcan 04-21-2004 09:10 AM

I don't know.But when I post any code,unregistered members still see...

Boofo 04-21-2004 09:35 AM

Then you must have missed a step somewhere.

Bulent Tekcan 04-21-2004 10:49 AM

I think only templates is different.

This is original temp.....

bbcode_code

[CODE]<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">$vbphrase
Code:

:</div>
        <pre class="alt2" style="margin:0px; padding:$stylevar[cellpadding]px; border:1px inset; width:$stylevar[codeblockwidth]; height:{$blockheight}px; overflow:auto">$code</pre>
</div>


bbcode_html

Code:

<div style="margin:20px; margin-top:5px">
        <div class="smallfont" style="margin-bottom:2px">$vbphrase[html_code]:</div>
        <pre class="alt2" style="margin:0px; padding:$stylevar[cellpadding]px; border:1px inset; width:$stylevar[codeblockwidth]; height:{$blockheight}px; overflow:auto">$code</pre>
</div>


bbcode_php

Code:

<div style="margin:20px; margin-top:5px">
        <div class="smallfont" style="margin-bottom:2px">$vbphrase[php_code]:</div>
        <div class="alt2" style="margin:0px; padding:$stylevar[cellpadding]px; border:1px inset; width:$stylevar[codeblockwidth]; height:{$blockheight}px; overflow:auto">
                <code style="white-space:nowrap">
                        <!-- php buffer start -->$code<!-- php buffer end -->
                </code>
        </div>
</div>


Bulent Tekcan 04-22-2004 07:27 AM

Any suggestion ?

Boofo 04-22-2004 08:15 AM

All you need to do is add the code I have in the hack around this part of the template:

$code

Beermonster 04-22-2004 08:28 AM

Can this be changed so that only above a certain user group can see it, not just unregistered.
on my forum once you have registered you still have to make at least 10 posts before becoming a full member with all it's privileges. as I was fed up of people registering to PM a member with a reply :(

[high]* Beermonster clicks install :)[/high]

Boofo 04-22-2004 09:03 AM

Quote:

Originally Posted by Beermonster
Can this be changed so that only above a certain user group can see it, not just unregistered.
on my forum once you have registered you still have to make at least 10 posts before becoming a full member with all it's privileges. as I was fed up of people registering to PM a member with a reply :(

[high]* Beermonster clicks install :)[/high]

Sure. Just change this in the templates for this hack:

HTML Code:

<if condition="$bbuserinfo['userid']">
to whatever you want it to be. You could do this:

HTML Code:

<if condition="$bbuserinfo['usergroupid']==6 OR $bbuserinfo['usergroupid']==5">
and so on. ;)

Beermonster 04-22-2004 09:29 AM

Thanks :)

Bulent Tekcan 04-22-2004 02:07 PM

Still not working my board,anyone test in 3.0.1 ?

Realy great hack but I cannot use :(

Boofo 04-22-2004 03:09 PM

I can't believe it has changed that much where it won't work in 3.0.1. Carefully go through the hack again and make sure you didn't miss anything. Then, let me know and we will see what needs to be done to get it working for you.

Mr. HillBilly 04-22-2004 10:47 PM

Boofo, I think people are having problems with 3.0.1 because the hacks templates are out of date.


I added the lines needed into the default vB 3.0.1 BBcode templates so it will work with the latest versions. I have tested this on an vB 3.0.1 board.


bbcode_code:
[CODE]
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">$vbphrase
Code:

:</div>
<pre class="alt2" style="margin:0px; padding:$stylevar[cellpadding]px; border:1px inset; width:$stylevar[codeblockwidth]; height:{$blockheight}px; overflow:auto"><if condition="$bbuserinfo['userid']">$code<else />$vbphrase[bf2_block_code]</if></pre>
</div>

bbcode_html:
Code:


<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">$vbphrase[html_code]:</div>
<pre class="alt2" style="margin:0px; padding:$stylevar[cellpadding]px; border:1px inset; width:$stylevar[codeblockwidth]; height:{$blockheight}px; overflow:auto"><if condition="$bbuserinfo['userid']">$code<else />$vbphrase[bf2_block_html]</if></pre>
</div>

bbcode_php:
Code:


<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">$vbphrase[php_code]:</div>
<div class="alt2" style="margin:0px; padding:$stylevar[cellpadding]px; border:1px inset; width:$stylevar[codeblockwidth]; height:{$blockheight}px; overflow:auto">
<code style="white-space:nowrap">
<!-- php buffer start --><if condition="$bbuserinfo['userid']">$code<else />$vbphrase[bf2_block_php]</if><!-- php buffer end -->
</code>
</div>
</div>

bbcode_quote:
Code:

<div style="margin:20px; margin-top:5px; <if condition="$show['iewidthfix']">width: 100%;</if>">
<div class="smallfont" style="margin-bottom:2px">$vbphrase[quote]:</div>
<table cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%">
<if condition="$bbuserinfo['userid']">
<tr>
<td class="alt2" style="border:1px inset">
<if condition="$show['username']">
        <div><phrase 1="$username">$vbphrase[originally_posted_by_x]</phrase></div>
        <div style="font-style:italic">$message</div>
<else />
        $message
</if>
                                        <else />$vbphrase[bf2_block_quote]
                                </if>
</td>
</tr>
</table>
</div>

I suggest people use this code on their 3.0.1 boards.

Also, could you provide a way to make it so guests can't see the code in the threads archive?

Bulent Tekcan 04-23-2004 05:33 PM

Did you different change in functions_bbcodeparse.php ? Because my board still not work.

Mr. HillBilly 04-23-2004 06:32 PM

Quote:

Originally Posted by turkeyforum
Did you different change in functions_bbcodeparse.php ? Because my board still not work.

Nope. Make sure you got ever line because the instructions can be confusing since they look the same.

Boofo 04-23-2004 06:59 PM

Quote:

Originally Posted by Mr. HillBilly
Boofo, I think people are having problems with 3.0.1 because the hacks templates are out of date.


I added the lines needed into the default vB 3.0.1 BBcode templates so it will work with the latest versions. I have tested this on an vB 3.0.1 board.

I suggest people use this code on their 3.0.1 boards.

Also, could you provide a way to make it so guests can't see the code in the threads archive?

Can you attach a txt file of the exact code for those templates in a default 3.0.1 installation? I have an update to do for this and I have other code that needs to be added to them as well (Click in box to copy to clipboard, etc.). Also, was the code to find in the php files different?

vau7 04-23-2004 07:33 PM

How can i use it with the url-tag? I would like to make Links hidden to guests.

Mr. HillBilly 04-23-2004 08:37 PM

Quote:

Originally Posted by Boofo
Can you attach a txt file of the exact code for those templates in a default 3.0.1 installation? I have an update to do for this and I have other code that needs to be added to them as well (Click in box to copy to clipboard, etc.). Also, was the code to find in the php files different?

PHP files had no different code.


Heres the .txt you requested

Liquid1ce 04-23-2004 08:39 PM

what about bbcode for links?
IE: [url] tags?

Mr. HillBilly 04-23-2004 08:46 PM

Quote:

Originally Posted by Liquid1ce
what about bbcode for links?
IE: [url] tags?

Let me see if I can do this

Liquid1ce 04-23-2004 08:54 PM

This would hide the links to unreg'd?

Code:

<if condition="$bbuserinfo[userid]">
<if condition="$show['url_bbcode']">
<td><div class="imagebutton" id="cmd_wrap0_code"><img src="$stylevar[imgdir_editor]/code.gif" alt="$vbphrase[wrap_code_tags]" width="21" height="20" /></div></td>
</if>
<else />
<td><img src="$stylevar[imgdir_editor]/mustreg.gif" alt="Must be registered to use these BB codes" width="92" height="20" /></td>
</if>



All times are GMT. The time now is 07:44 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01327 seconds
  • Memory Usage 1,829KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (2)bbcode_html_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete