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)
-   -   /you, /me, /youid, /myid Hack (https://vborg.vbsupport.ru/showthread.php?t=76245)

Deaths 02-12-2005 10:00 PM

/you, /me, /youid, /myid Hack
 
1.4.2 has been released! Upgrade if /youid and /meid arent working!


To upgrade, just cut (not copy) the youid part above the /you part, and it'll work

This is a hack adds the following BB codes:


"/you" is replaced by the Username viewing the thread*
"/me" is replaced by the thread/post creator*
"/youid" is replaced by the UserID of the user viewing the thread.
"/myid" is replaced by the UserID of the poster of the post.

"/you is great!" Turns into:

Username is great!

"/me" is great!" Turns into:

"Deaths is great!"

"http://www.vbulletin.org/user.php?u=/youid" Turns into:

"http://www.vbulletin.org/user.php?u=123".

"http://www.vbulletin.org/register.php?refferer=/myid" Turns into:

"http://www.vbulletin.org/register.php?refferer=567".

Here are the instructions:
Optionally, you may follow the instructions in install.txt.
Both this post and the .txt file contain the exact same information.

Open includes/functions_bbcodeparse.php:

Find:
PHP Code:

$bbcode str_replace(array('>|||)''<|||)''"|||)'), array('>)''<)','")'), $bbcode); 
    } 
// end smilies 

Below, add:
PHP Code:

// /youid hack by Deaths (Apprentice) | http://www.xgnews.org
global $bbuserinfo;
                
$bbcode str_replace("/youid","" .$bbuserinfo['userid']. "",$bbcode);
// End /youid hack 

Below that, add:

PHP Code:

// /meid hack by Deaths (Apprentice) | http://www.xgnews.org 
  
global $post
  if (
'' == $post[userid]) { 
    global 
$reputation
    if (
'' == $reputation[userid]) { 
      global 
$pm
      if (
'' == $pm[fromuserid]) { 
        
$meUserid $bbuserinfo[userid]; 
      } else { 
        
$meUserid $pm[fromuserid]; 
      } 
    } else { 
      
$meUserid $reputation[userid]; 
    } 
  } else { 
    
$meUserid $post[userid]; 
  } 
  
$bbcode str_replace('/meid',"$meUserid"$bbcode); 
// End /meid hack 

Below that, add:

PHP Code:

// /you hack by Deaths (Apprentice) | http://www.xgnews.org
global $bbuserinfo
                
$bbcode str_replace("/you","<font color=\"#2DA72E\"><i>" .$bbuserinfo['username']. "</i></font> ",$bbcode);
// End /you hack 

Finally, below that, add:

PHP Code:

// /me hack by Deaths (Apprentice) | http://www.xgnews.org
// /me Hack
  
global $post;
  if (
'' == $post[username]) {
    global 
$reputation;
    if (
'' == $reputation[username]) {
      global 
$pm;
      if (
'' == $pm[fromusername]) {
        
$meUsername $bbuserinfo[username];
      } else {
        
$meUsername $pm[fromusername];
      }
    } else {
      
$meUsername $reputation[username];
    }
  } else {
    
$meUsername $post[username];
  }
  
$bbcode preg_replace('#^/me (.*)$#im'"<font color=\"red\">* $meUsername \\1 *</font>"$bbcode);  

// End /me hack 

Now, open newreply.php
Find:
PHP Code:

$pagetext trim(strip_quotes($pagetext)); 

Below, add:
PHP Code:

// /me Hack
$pagetext preg_replace('#^/me(.*)$#im'"[color=\"red\"]* $originalposter\\1[/color]"$pagetext);
// /me Hack 

This is my first publicly released hack, so it might be posible that I made a little mistake somewhere in the code, even though, - and maybe because - it is a very simple hack. If so, please post here, heh.

Hope you like it!

*I'm almost positive these hacks have already been released before, even though I couldn't find them.
I did not copy any code from anyone.
However, if you released this hack before I did, and wish to have the /you and /me hacks removed, please contact me by PM.

Guy G 02-13-2005 04:10 PM

Wow thats kinda cool.
Might install it later..
Good job :)

Deaths 02-13-2005 04:23 PM

Heh, thanks :).

If you use it, don't forget to click the install button!

buro9 02-13-2005 07:33 PM

Quote:

Originally Posted by Deaths
Heh, thanks :).

If you use it, don't forget to click the install button!

Bearing in mind that the bbcodeparse stuff is called from within reputation comments and private messaging as well as the posts and threads... and bearing in mind that you have globalised the $post array... am I correct in assuming that this doesn't work for private messages or reputation comments?

Deaths 02-14-2005 10:12 AM

I believe PM's use the $post array aswell, but I'm not sure about this.
I cannot check it from where am now, though I will look into this ASAP.

This hack was intended for forum post, not for PM's.

I will look into this though, thank you for the feedback.

MissKalunji 02-17-2005 01:10 PM

nice

/me clicks install

yoyoyoyo 02-17-2005 02:42 PM

very nice! I wish I could get this to work in a poll :D I just gave out "Member of the Month" award to /you and now they are all posting acceptance speeches LMAO

Deaths 02-17-2005 03:12 PM

Heh, I did that aswell a while back, on april fools :).

I'll look into the poll thing, but I don't think BB code is allowed in polls...

buro9 02-17-2005 07:31 PM

Quote:

Originally Posted by Deaths
I believe PM's use the $post array aswell, but I'm not sure about this.
I cannot check it from where am now, though I will look into this ASAP.

This hack was intended for forum post, not for PM's.

I will look into this though, thank you for the feedback.

Take inspiration from this snippet I've made on my board:
Code:

  global $post;
  if ('' == $post[username]) {
    global $reputation;
    if ('' == $reputation[username]) {
      global $pm;
      if ('' == $pm[fromusername]) {
        $meUsername = $bbuserinfo[username];
      } else {
        $meUsername = $pm[fromusername];
      }
    } else {
      $meUsername = $reputation[username];
    }
  } else {
    $meUsername = $post[username];
  }

By the end of that $meUsername contains the correct name for a /me code.

yoyoyoyo 02-17-2005 07:51 PM

Quote:

Originally Posted by Deaths
Heh, I did that aswell a while back, on april fools :).

I'll look into the poll thing, but I don't think BB code is allowed in polls...

well... I just found out some mods sure can't take a joke :rolleyes:


All times are GMT. The time now is 09:57 PM.

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.01058 seconds
  • Memory Usage 1,774KB
  • 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
  • (1)bbcode_code_printable
  • (7)bbcode_php_printable
  • (3)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
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete