vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Admin text Hack all vb2 (https://vborg.vbsupport.ru/showthread.php?t=63991)

miz 04-16-2004 10:00 PM

Admin text Hack all vb2
 
ok this hack added new bbcode

for exsample if some user want to say something only that only admins will see
then he do [admin] what he want to say [/admin]

and "what he want to say" will be viewable only for admins

so lets start :

open admin/functions.php

find :

PHP Code:

"/(\[)(php)(])(\r\n)*(.*)(\[\/php\])/esiU"

After add :

PHP Code:

"/(\[)(admin)(])(\r\n)*(.*)(\[\/admin\])/esiU"

find :

PHP Code:

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  
$foundcode str_replace("\\\"","\"",$foundcode);
  return 
"</normalfont><blockquote><pre><smallfont>code:</smallfont><hr>" str_replace("<br>"""str_replace("<br />"""$foundcode) ) . "<hr></pre></blockquote><normalfont>";


After Add :

PHP Code:

// ###################### Start Admin ########################
function admin($admintext) {
  global 
$post$bbuserinfo$DB_site;
  if (
$bbuserinfo['usergroupid']!=6) {
    
$admintext="";
  }
  return 
"$admintext";


Save the file and upload it back to your server

open root/newreply.php

Find :

PHP Code:

$pagetext trim(preg_replace("/(\[quote])(.*)(\[\/quote])/siU"""$pagetext)); 

After Add :

PHP Code:

$pagetext trim(preg_replace("/(\[admin])(.*)(\[\/admin])/siU"""$pagetext)); 

Thats All

Enjoy.

Aaron1 04-18-2004 09:35 AM

Interesting!
I could use that! Cool :)


So if i wanted to add supermoderators or another usergroup i just change this:

if ($bbuserinfo['usergroupid']!=6) {

to this?:

if ($bbuserinfo['usergroupid']!=5 AND $bbuserinfo['usergroupid']!=6 AND $bbuserinfo['usergroupid']!=7) {

miz 04-18-2004 12:44 PM

if (($bbuserinfo['usergroupid']!=5) or ($bbuserinfo['usergroupid']!=6) or ($bbuserinfo['usergroupid']!=7)) {

this is the right syntex

i dont think some1 can be in 3 usergroups ;)

Aaron1 04-18-2004 02:09 PM

Hmm thanks, but that doesn't work for me, ackwardly enough, mine does though :-)

---------------------------------------------------------
function admin($admintext) {
global $post, $bbuserinfo, $DB_site;
if ($bbuserinfo['usergroupid']!=5 AND $bbuserinfo['usergroupid']!=6 AND $bbuserinfo['usergroupid']!=7) {
$adminktext="";
}
return "$admintext";
}
---------------------------------------------------------

If i am not mistaken (i could be though) the script above means (simply said):

If user is NOT in groupid 5 and NOT in group id 6 and NOT in group id 7 show nothing, if he is, show admin text.

Forgive me i am trying to learn PHP abit, and i hope i doing ok :)


And i have another question, how do you design the $admintext? Can i use stylesheet for that? If i try this, it will show the div class box for people that aren't allow to see it.

return "<div class=\"admtxt\">$talktext</div>";

Thanks again!

/Aaron

-

Dimitrix 04-18-2004 02:24 PM

AND is not the correct syntax but it will work (I guess)
Use && instead of AND, but if it works for you, good
Dimitry

miz 04-18-2004 09:26 PM

admin text is not desgined its return it as normal text like all other threads text
if u want to desgin its throw the templte engine u can call to admin text car with gettemplte engine

and 1 more thing

when u past parts of code please use the php tags
so unlincened users wont be able to see parts of code
thanx

Aaron1 04-19-2004 09:12 AM

Sorry Miz, you are right, i forgot about it!
Can you take a look if i am close on using a template for this?
I already created a special template with the $admintext in it. But not sure about the code in functions.php

I attached the code this time :-)

miz 04-19-2004 10:47 AM

nop
u ++++ed up the text hehe
its get the admin text any way
change it to be like that

PHP Code:


// ###################### Start admin ######################## 
function admin($admintext) { 
  global 
$post$bbuserinfo$DB_site
  if ((
$bbuserinfo['usergroupid']!=5) && ($bbuserinfo['usergroupid']!=6) && ($bbuserinfo['usergroupid']!=7)) {
    
$admintext=""
  } else {
  eval(
"\$admintext = \"".gettemplate("admin_text")."\";");
}
  return 
"$admintext"


u missed this else part..

Aaron1 04-19-2004 10:54 AM

Woohaa! To cool, that worked Miz! :-)
Thanks for the help! Appreciated!

miz 04-20-2004 03:06 PM

np, if u liked this hack please press the install button ;]


All times are GMT. The time now is 08:42 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.01036 seconds
  • Memory Usage 1,746KB
  • 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
  • (7)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete