View Full Version : [you] hack
wrongful
01-23-2004, 04:28 PM
Is there a chance of someone being able to port over this hack or the original author doing it. Also maybe with the option to limit its use by usergroup.
https://vborg.vbsupport.ru/showthread.php?t=49458&page=1&pp=15
LOL. Weird. I was just coming here to request that.
NTLDR
01-23-2004, 08:02 PM
In includes/functions.php find:
// do vBulletin 3 replacement variables
if (!empty($style['replacements']))
{
if (!isset($replacementvars))
{
$replacementvars = unserialize($style['replacements']);
}
// this is WAY too slow!
//$newtext = strtr($newtext, $replacementvars);
// using str_replace() has case-sensitivity issues...
//$newtext = str_replace(array_keys($replacementvars), $replacementvars, $newtext);
// this is slower than str_replace() but is case-insensitive, so we'll use it.
$newtext = preg_replace(array_keys($replacementvars), $replacementvars, $newtext);
}
return $newtext;
Replace with:
// do vBulletin 3 replacement variables
if (!isset($replacementvars))
{
$replacementvars = unserialize($style['replacements']);
}
global $bbuserinfo;
$replacementvars['/{bbusername}/i'] = $bbuserinfo['username'];
// this is WAY too slow!
//$newtext = strtr($newtext, $replacementvars);
// using str_replace() has case-sensitivity issues...
//$newtext = str_replace(array_keys($replacementvars), $replacementvars, $newtext);
// this is slower than str_replace() but is case-insensitive, so we'll use it.
$newtext = preg_replace(array_keys($replacementvars), $replacementvars, $newtext);
return $newtext;
Then use {bbusername} in your posts etc
wrongful
01-23-2004, 09:03 PM
Great! Thank You.
eXtremeTim
01-23-2004, 09:59 PM
Thanks saved me the trouble of making it :)
eXtremeTim
01-23-2004, 10:09 PM
Now anyway so you can edit a post and it not get all screwed up? As in not lock in your username instead of {bbusername}
Boofo
01-24-2004, 03:14 AM
Where will this all work at? Just in posts? Any way to get it to work in thread titles, too?
wrongful
01-24-2004, 03:25 AM
Where will this all work at? Just in posts? Any way to get it to work in thread titles, too?It does work in thread titles too
Boofo
01-24-2004, 03:43 AM
Great! How about the seach page? ;)
NTLDR, how would I add this code to this? It has the microstats hack in it.
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// ! MicroStats Hack for vB 3.0 Gamma By: Apoco !
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function process_replacement_vars($newtext, $sendheader = 1)
{
// parses replacement vars
global $DB_site, $vboptions, $style, $stylevar, $newpmmsg, $_SERVER, $microstats;
static $replacementvars;
if (connection_status())
{
exit;
}
// do vBulletin 3 replacement variables
if (!empty($style['replacements']))
{
if (!isset($replacementvars))
{
$replacementvars = unserialize($style['replacements']);
}
// this is WAY too slow!
//$newtext = strtr($newtext, $replacementvars);
// using str_replace() has case-sensitivity issues...
//$newtext = str_replace(array_keys($replacementvars), $replacementvars, $newtext);
// this is slower than str_replace() but is case-insensitive, so we'll use it.
$newtext = preg_replace(array_keys($replacementvars), $replacementvars, $newtext);
}
$newtext = str_replace(('{microstats}'), $microstats, $newtext);
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
return $newtext;
}
assassingod
01-24-2004, 08:07 AM
Try using:
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// ! MicroStats Hack for vB 3.0 Gamma By: Apoco !
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function process_replacement_vars($newtext, $sendheader = 1)
{
// parses replacement vars
global $DB_site, $vboptions, $style, $stylevar, $newpmmsg, $_SERVER, $microstats, $bbuserinfo;
if (connection_status())
{
exit;
}
// do vBulletin 3 replacement variables
if (!empty($style['replacements']))
{
if (!isset($replacementvars))
{
$replacementvars = unserialize($style['replacements']);
}
$replacementvars['/{bbusername}/i'] = $bbuserinfo['username'];
// this is WAY too slow!
//$newtext = strtr($newtext, $replacementvars);
// using str_replace() has case-sensitivity issues...
//$newtext = str_replace(array_keys($replacementvars), $replacementvars, $newtext);
// this is slower than str_replace() but is case-insensitive, so we'll use it.
$newtext = preg_replace(array_keys($replacementvars), $replacementvars, $newtext);
}
$newtext = str_replace(('{microstats}'), $microstats, $newtext);
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
return $newtext;
}
djnoz
01-24-2004, 08:55 AM
In case anyone asks, to make it work for [ you ] instead, replace the appropriate line with this:
$replacementvars['/\[you\]/i'] = $bbuserinfo['username'];
Thanks guys!!!
I know I may be getting picky now but...
In the vB2 version I had, the [you] code was left in the reply. This made it easy to see if someone typed really your name, or used the [you] code. In this version, the [you] code is replaced w/ my name in the reply. Anyway to keep the [you] in there when replying instead?
Did that even make sense? Previously, when hitting reply, one could see if a person was really talking to you or using the [you] code.
djnoz
01-24-2004, 02:15 PM
If you wanted to do this, it would require removal of the original [ you ] hack and modifications to the bbcodeparse php file. However, the you hack would no longer work in thread titles if you did this. If you want people to know the difference, you could try formatting... eg:
$replacementvars['/\[you\]/i'] = "<i>$bbuserinfo['username']</i>";
or something
BTW, NTLDR, thanks for sharing. It was quite a fun prank =)
Link14716
01-24-2004, 02:18 PM
Thanks guys!!!
I know I may be getting picky now but...
In the vB2 version I had, the [you] code was left in the reply. This made it easy to see if someone typed really your name, or used the [you] code. In this version, the [you] code is replaced w/ my name in the reply. Anyway to keep the [you] in there when replying instead?
Did that even make sense? Previously, when hitting reply, one could see if a person was really talking to you or using the [you] code.
Try this.
Find: $replacementvars['/{bbusername}/i'] = $bbuserinfo['username']; Replace with: if (THIS_SCRIPT != "editpost") {
$replacementvars['/{bbusername}/i'] = $bbuserinfo['username'];
}
EDIT: I just tested it and it works perfectly.
Link: I don't think that worked, but it may be because I can't explain it.
Is it possible that when someone quotes another person, they see the [you] in the quote instead of their own name?
EDIT: and it looks like it only works in the thread title once. When I post a thread, my name is in the title. Other users only see my name too.
Boofo
01-24-2004, 06:37 PM
Try using:
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// ! MicroStats Hack for vB 3.0 Gamma By: Apoco !
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function process_replacement_vars($newtext, $sendheader = 1)
{
// parses replacement vars
global $DB_site, $vboptions, $style, $stylevar, $newpmmsg, $_SERVER, $microstats, $bbuserinfo;
if (connection_status())
{
exit;
}
// do vBulletin 3 replacement variables
if (!empty($style['replacements']))
{
if (!isset($replacementvars))
{
$replacementvars = unserialize($style['replacements']);
}
$replacementvars['/{bbusername}/i'] = $bbuserinfo['username'];
// this is WAY too slow!
//$newtext = strtr($newtext, $replacementvars);
// using str_replace() has case-sensitivity issues...
//$newtext = str_replace(array_keys($replacementvars), $replacementvars, $newtext);
// this is slower than str_replace() but is case-insensitive, so we'll use it.
$newtext = preg_replace(array_keys($replacementvars), $replacementvars, $newtext);
}
$newtext = str_replace(('{microstats}'), $microstats, $newtext);
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
return $newtext;
}
Thanks, Steve. I ended up going with this and it seems to work. ;)
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// ! MicroStats Hack for vB 3.0 Gamma By: Apoco !
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function process_replacement_vars($newtext, $sendheader = 1)
{
// parses replacement vars
global $DB_site, $vboptions, $style, $stylevar, $newpmmsg, $_SERVER, $microstats, $bbuserinfo;
static $replacementvars;
if (connection_status())
{
exit;
}
// do vBulletin 3 replacement variables
if (!isset($replacementvars))
{
$replacementvars = unserialize($style['replacements']);
}
$replacementvars['/{bbusername}/i'] = $bbuserinfo['username'];
// this is WAY too slow!
//$newtext = strtr($newtext, $replacementvars);
// using str_replace() has case-sensitivity issues...
//$newtext = str_replace(array_keys($replacementvars), $replacementvars, $newtext);
// this is slower than str_replace() but is case-insensitive, so we'll use it.
$newtext = preg_replace(array_keys($replacementvars), $replacementvars, $newtext);
$newtext = str_replace(('{microstats}'), $microstats, $newtext);
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
return $newtext;
}
Boofo
01-24-2004, 06:56 PM
Link: I don't think that worked, but it may be because I can't explain it.
Is it possible that when someone quotes another person, they see the [you] in the quote instead of their own name?
EDIT: and it looks like it only works in the thread title once. When I post a thread, my name is in the title. Other users only see my name too.
I just tried it and the title goes with whoever is looking at the thread on my site. I posted 2 messages in there and logged out and viewed the thread as Unregistered and that is what showsed up in both mesages and the thread title.
NTLDR
01-24-2004, 07:03 PM
It should replace it on any page, anywhere as long as the page goes through process_replacement_vars(), which all the main vB (forum) pages that output something do.
@flypaper, I'm a bit confused as to how you'd like this to work.
Boofo
01-24-2004, 07:23 PM
Anyway to fix it so you won't see {bbusername} in the email that gets sent if you are subscribed to the thread? ;)
NTLDR
01-24-2004, 07:46 PM
Untested as usual, in includes/functions.php find:
$touser['languageid'] = iif($touser['languageid'] == 0, $vboptions['languageid'], $touser['languageid']);
Add after:
$temptext = $pagetext;
$pagetext = preg_replace('/{bbusername}/i', $touser['username'], $pagetext);
Find:
vbmail($touser['email'], $subject, $message);
Add after:
$pagetext = $temptext;
Boofo
01-24-2004, 11:10 PM
I can't find any of the code you said to search for in the functions.php.
EDIT: I found the code in functions_newpost.php. It seems to work except for the thread title in the message and the Subject of the message. Can those be fixed?
It should replace it on any page, anywhere as long as the page goes through process_replacement_vars(), which all the main vB (forum) pages that output something do.
@flypaper, I'm a bit confused as to how you'd like this to work.
Lemme do an example and tell me if this can be done w/ vb3...
(original post with [you] hack): flypaper is cool.
(post quoted for reply w/ current hack): flypaper is cool.
(post quoted for reply w/ vb2 hack): [you] is cool.
Personally, I think it works better if the [you] code shows up in the quoted post. Hopefully, that makes sense now. Either way, I really appreciate the help.
Boofo
01-25-2004, 10:50 AM
Lemme do an example and tell me if this can be done w/ vb3...
(original post with [you] hack): flypaper is cool.
(post quoted for reply w/ current hack): flypaper is cool.
(post quoted for reply w/ vb2 hack): [you] is cool.
Personally, I think it works better if the [you] code shows up in the quoted post. Hopefully, that makes sense now. Either way, I really appreciate the help.
That would be ok if it only showed up as [you] for the Admins and Mods. Otherwise, once everyone on the forum sees what the code is to do it, then you have everyone doing it and it gets old really quick. It kills it basically. On my site, once I get the thread title and subject of the email notifications taken care of, I am going to change the word for the hack to something no one will figure out so it won't get abused on the site. ;)
NTLDR
01-25-2004, 04:30 PM
@Boofo, sorry I meant functions_newpost.php ;)
For the [you] part I think he means [you] appears and isn't the next to get the username.
To fix thread titles, find again in functions_newpost.php:
$threadinfo['title'] = unhtmlspecialchars($threadinfo['title']);
Add after:
$temptitle = $threadinfo['title'];
Find: (you added this code from the above instructions)
$pagetext = preg_replace('/{bbusername}/i', $touser['username'], $pagetext);
Add after:
$threadinfo['title'] = preg_replace('/{bbusername}/i', $touser['username'], $threadinfo['title']);
Find (again you added this from the above posts instructions):
$pagetext = $temptext;
Add after:
$threadinfo['title'] = $temptitle
To get [you] working as I think you want it too, try this it should work:
in newreply.php find:
$pagetext = htmlspecialchars_uni($postinfo['pagetext']);
Add before:
$pagetext = preg_replace('/{bbusername}/i', '\[you\]', $pagetext);
Boofo
01-25-2004, 07:01 PM
This:
$threadinfo['title'] = $temptitle
is supposed to have a semi-colon after it, right? ;)
Also, I put this:
$temptitle = $threadinfo['title'];
AFTER the 2nd instance of this:
$threadinfo['title'] = unhtmlspecialchars($threadinfo['title']);
since it shows in 2 places in the file. Is it in the right place now?
NTLDR
01-25-2004, 09:03 PM
Yes and yes ;)
Boofo
01-26-2004, 12:12 AM
Thank you and thank you, sir. ;)
That would be ok if it only showed up as [you] for the Admins and Mods. Otherwise, once everyone on the forum sees what the code is to do it, then you have everyone doing it and it gets old really quick. It kills it basically. On my site, once I get the thread title and subject of the email notifications taken care of, I am going to change the word for the hack to something no one will figure out so it won't get abused on the site. ;)
LOL
I enjoy watching my users abuse the n00bs. That's fun to me.
Boofo
01-26-2004, 08:58 PM
LOL
I enjoy watching my users abuse the n00bs. That's fun to me.
Did the [you] code NTLDR post for you work like you wanted it to?
Boofo
01-27-2004, 12:15 AM
NTLDR, one last area. Can we get this to work for the forum names in the archive display?
NTLDR
01-27-2004, 10:25 AM
That would require a fair bit of modding has none of the archive is passed through the replacement vars function. If I get time I'll take a look.
Did the [you] code NTLDR post for you work like you wanted it to?
I thought he was replying to you. I'm confused.
Boofo
01-27-2004, 11:54 AM
That would require a fair bit of modding has none of the archive is passed through the replacement vars function. If I get time I'll take a look.
I got it all to work except one place. It is the navbar right after you click on a forum that has the [you] code in it. Everywhere else in the archive it works great. ;)
Beermonster
03-05-2004, 05:12 PM
Thanks guy's I love this hack it's got to be the funniest ever
Primeval
03-18-2006, 05:15 AM
Any chance for someone to make this work on 3.0.9 ?
I just tested the code and it gave me a parse error from somewhere else.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.