PDA

View Full Version : Admin text Hack all vb2


miz
04-16-2004, 10:00 PM
ok this hack added new bbcode

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

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

so lets start :

open admin/functions.php

find :

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

After add :

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

find :

// ###################### 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 :

// ###################### 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 :

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

After Add :

$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



// ###################### 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 ;]