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)
-   -   /me code Version 3 (https://vborg.vbsupport.ru/showthread.php?t=59698)

Boofo 03-27-2004 12:37 PM

I have it set for 20,000 characters. How long was the post?

Frugal 03-27-2004 12:39 PM

Quote:

Originally Posted by Boofo
I have it set for 20,000 characters. How long was the post?

About 27000 characters.

Frugal

Boofo 03-27-2004 12:41 PM

I'll up it to 50 k and then you can try it again. Give me 5 minutes. ;)

masahiko 03-27-2004 07:38 PM

Thanks for this great little hack. Below is what I used to get it working on 3.0 Gold (replaces the original post). This code works with PMs as well, and uses the same formatting as the "highlight" tag so it can be used on a per-style basis.

The major difference is the editing of private.php in two spots. I know using $post in private.php probably isn't the best way to go about it, but it is quick and only takes two lines.

code is updated, bug in WYSIWYG mode when editing posts is fixed.
code is updated, bug in pm previews is fixed see the funcitons_newpost changes.

includes/functions_newpost.php

Find:

PHP Code:

        $previewmessage parse_bbcode($newpost['message'], $foruminfo['forumid'], iif($newpost['disablesmilies'], 01)); 

ABOVE, ADD:

PHP Code:

        // /me hack
        
global $post;
        
$post[username] = $bbuserinfo[username];
        
// /me hack 


includes/functions_bbcodeparse.php

Find:

PHP Code:

    // ********************* PARSE BBCODE TAGS *************************** 

ABOVE, ADD:

PHP Code:

        // /me Hack 
                
global $post
                
$bbcode preg_replace('#^/me (.*)$#im'"<div><span class=\"highlight\">* $post[username] \\1</span></div>"$bbcode);
        
// /me Hack 


newreply.php

Find:

PHP Code:

                $pagetext trim(strip_quotes($pagetext)); 

UNDERNEATH, ADD:

PHP Code:

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



private.php

Find:

PHP Code:

                                // quote reply
                                
$originalposter fetch_quote_username($pm['fromusername']); 

UNDERNEATH, ADD:

PHP Code:

                                // /me Hack
                                        
$pm['message'] = preg_replace('#^/me(.*)$#im'"[highlight]* $originalposter\\1[/highlight]"$pm['message']); 
                                
// /me Hack 

Find:

PHP Code:

        $pm['message'] = parse_pm_bbcode($pm['message'], $pm['allowsmilie']); 

ABOVE IT, ADD:

PHP Code:

        // /me Hack
        
global $post;
        
$post[username] = $pm[fromusername];
        
// /me Hack 


Boofo 03-27-2004 07:40 PM

What about the editpost.php? ;)

masahiko 03-27-2004 07:43 PM

Quote:

Originally Posted by Boofo
What about the editpost.php? ;)

i haven't had any issues with editing posts. were there problems with it?

Boofo 03-27-2004 07:49 PM

I don't know. I use the hack_me.php file, but I thought when editing posts there might be a problem so I just thought I would mention it. ;)

Is there a way to make the whole line parse if there is bbcode BEFORE the /me code? They had that with an addon for the vB2 /me code.

msimplay 03-27-2004 08:08 PM

i prefer hack_me.php works perfectly in vb3 gold

masahiko 03-27-2004 08:13 PM

Quote:

Originally Posted by Boofo
I don't know. I use the hack_me.php file, but I thought when editing posts there might be a problem so I just thought I would mention it. ;)

i figured out where people where having the problem. the code i posted is updated to fix it.

Quote:

Originally Posted by Boofo
Is there a way to make the whole line parse if there is bbcode BEFORE the /me code? They had that with an addon for the vB2 /me code.

changing '#^/me(.*)$#im' to '#/me(.*)$#im' in all the preg_replace() calls should let it start anywhere inside the line and end at the end of the line.

Boofo 03-27-2004 08:48 PM

Is there a way to have it parse the whole line in the hightlight color when there is the /me code in it no matter where the /me code is in the line? Does that make any sense?

draculanowaday 03-28-2004 06:55 AM

thanks, work well with Vb 3.0 Gold :)

Aleksey 03-28-2004 03:21 PM

Ok, just to clearfy, if I put "/me" it will say username of a person who is looking at my post?

Boofo 03-28-2004 03:23 PM

No it will say:

/me like this hack

masahiko 03-28-2004 09:37 PM

Quote:

Originally Posted by Boofo
Is there a way to have it parse the whole line in the hightlight color when there is the /me code in it no matter where the /me code is in the line? Does that make any sense?

change:
'#^/me(.*)$#im'

to:
'#^(.*)/me(.*)$#im'

change:
$post[username] \\1

to:
\\1 $post[username] \\2

change:
$originalposter \\1

to:
\\1 $originalposter \\2

in all the preg_replace() calls and it should do what you want.

this text that /me typed

would come out as:

* this text that masahiko typed

make sense? of course, i haven't used the hack_me.php version so all my example chages are based of the original/my own.

Bernd Glasstett 03-29-2004 07:29 AM

Ok, we had a major issue now with the file-version of this hack (where the file is included). Some threads where no longer readable, especially some with an URL in it. We took the hack out and everything went fine again.

My guess is that some of the preg_replace's are not defined clear enough.

ChuanSE 03-29-2004 08:39 AM

strange, i just got 5 identical mails of the latest post in this thread?
Am i the only one?

Frugal 03-29-2004 08:50 AM

Quote:

Originally Posted by Bernd Glasstett
Ok, we had a major issue now with the file-version of this hack (where the file is included). Some threads where no longer readable, especially some with an URL in it. We took the hack out and everything went fine again.

My guess is that some of the preg_replace's are not defined clear enough.

Yup this is exactly what happened on my site.

Frugal

ChuanSE 03-29-2004 09:17 AM

I can't say i have these probs at my board tho

the hack works fine, the url's are fine

sure you guyz didn't messed up some code somewhere?

Boofo 03-29-2004 09:19 AM

Quote:

Originally Posted by masahiko
Thanks for this great little hack. Below is what I used to get it working on 3.0 Gold (replaces the original post). This code works with PMs as well, and uses the same formatting as the "highlight" tag so it can be used on a per-style basis.

The major difference is the editing of private.php in two spots. I know using $post in private.php probably isn't the best way to go about it, but it is quick and only takes two lines.

code is updated, bug in WYSIWYG mode when editing posts is fixed.

includes/functions_bbcodeparse.php

Find:

PHP Code:

    // ********************* PARSE BBCODE TAGS *************************** 

ABOVE, ADD:

PHP Code:

        // /me Hack 
                
global $post
                
$bbcode preg_replace('#^/me (.*)$#im'"<div><span class=\"highlight\">* $post[username] \\1</span></div>"$bbcode);
        
// /me Hack 


newreply.php

Find:

PHP Code:

                $pagetext trim(strip_quotes($pagetext)); 

UNDERNEATH, ADD:

PHP Code:

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



private.php

Find:

PHP Code:

                                // quote reply
                                
$originalposter fetch_quote_username($pm['fromusername']); 

UNDERNEATH, ADD:

PHP Code:

                                // /me Hack
                                        
$pm['message'] = preg_replace('#^/me(.*)$#im'"[highlight]* $originalposter\\1[/highlight]"$pm['message']); 
                                
// /me Hack 

Find:

PHP Code:

        $pm['message'] = parse_pm_bbcode($pm['message'], $pm['allowsmilie']); 

ABOVE IT, ADD:

PHP Code:

        // /me Hack
        
global $post;
        
$post[username] = $pm[fromusername];
        
// /me Hack 


This doesn't seem to working when previewing a PM and doesn't work in the show_pm. It works great in the quote pm, though. Also, if I use other fonts for this, it doesn't seem to work. The link below will show you the testing thread for this.

http://www.bearfacts2.com/forums/showthread.php?t=437

Any idea how to fix the pm stuff and the different font stuff?

Frugal 03-29-2004 10:05 AM

Quote:

Originally Posted by ChuanSE
I can't say i have these probs at my board tho

the hack works fine, the url's are fine

sure you guyz didn't messed up some code somewhere?

Unlikely, I am pretty experienced at this and have been installing hacks since UBB v1 (so about 4 years experience and countless hacks installed during those years), also this hack is one of the simpler hacks, 1 line pasted into 3 files and one php page created by copying and pasting, not much to mess up and very easy to check.

As far as I can tell the problem is related to url's with /me in them (could just be coincidence though, also all the problem posts on my site had urls using vB code rather than just being parsed ie HERE as opposed to http://www.redfoxdk.com/falcon/falcon_downloads/Rattys_missileFix%20_BMSdatav1.61.zip), although I suspect it could also be caused by a conflict between 2 hacks. Chances are Bernd Glasstett and myself both have the conflicting hack.

Mind you it is also possible that the problem is just hard to notice because it only affects a small number of posts. I have 1500 posts per day on my forum and only found 4 recent posts that wouldn't open. I notice that both Bernd and myself have very busy forums whilst those who have stated they are not experiencing the problem have fairly quiet forums.

This could simply be a timebomb waiting to happen on your forum.

Frugal

masahiko 03-29-2004 07:48 PM

Quote:

Originally Posted by Boofo
This doesn't seem to working when previewing a PM and doesn't work in the show_pm. It works great in the quote pm, though. Also, if I use other fonts for this, it doesn't seem to work. The link below will show you the testing thread for this.

http://www.bearfacts2.com/forums/showthread.php?t=437

Any idea how to fix the pm stuff and the different font stuff?

i updated my post with a fix for the pm previews.

i'm assuming that you're using font tags around the /me text. if you're using my code then it'll never work because the /me part isn't the first thing on the line. you'll have to use one of the preg changes i gave you erlier. i'm using my own hack verbatum so i'm not going to test that. if you do change it you'll have to watch for conflicts in the code thats being replaced. if you have one tag that changes the font inside another font tag, the inside one will take over.

Boofo 03-31-2004 08:04 AM

Using that preg_replace you posted didn't fix it. It still doesn't work with other fonts for me. And it STILL doesn't work in the show_pm. When viewing a pm with the /me code, you see the /me code. It works great in preview mode and quoting a private message, but not viewing a private message from someone who has the /me code in it. Does that make any sense?

kanezfan 04-06-2004 04:21 AM

maybe i'm an idiot, but i'm trying to install this on vb3 gold and I when i use find on either dreamweaver or wordpad, i can't find
Code:

$pagetext = trim(strip_quotes($pagetext));
in newreply.php. Am i retarded or can you tell me what line it's on? i think it's me though, because when i scroll down the file in Dreamweaver, if i search for just pagetext, it doesn't find it, but i can see the word pagetext right there in the file. it's pissing me off, but that's what you get for trying to install a hack at 1:30 in the morning.

RixiuS 04-09-2004 02:36 AM

what about newthread?

Boofo 04-09-2004 05:22 AM

Quote:

Originally Posted by kanezfan
maybe i'm an idiot, but i'm trying to install this on vb3 gold and I when i use find on either dreamweaver or wordpad, i can't find
Code:

$pagetext = trim(strip_quotes($pagetext));
in newreply.php. Am i retarded or can you tell me what line it's on? i think it's me though, because when i scroll down the file in Dreamweaver, if i search for just pagetext, it doesn't find it, but i can see the word pagetext right there in the file. it's pissing me off, but that's what you get for trying to install a hack at 1:30 in the morning.

You need to get a better editor. Try EditPlus 2. ;)

ChuanSE 04-10-2004 05:12 AM

Hehehe Boofo, he should find it with notepad :D

But hey, the line has to be pasted without spaces at the end, etc...
Otherwise he says "can't find" indeed.

Stray 04-11-2004 02:07 PM

I'm using the hack_me.php version and I was wondering how I'd go about making the text bold and putting another asterisk at the end of the phrase.

BarHopper 04-12-2004 11:59 AM

<a href="http://www.game-realms.net/vb/showthread.php?p=11874#post11874" target="_blank">http://www.game-realms.net/vb/showth...1874#post11874</a>

how can i change the colour? The red doesnt really suit it at all.

Synicide 04-13-2004 05:16 AM

Quote:

Originally Posted by BarHopper
http://www.game-realms.net/vb/showth...1874#post11874

how can i change the colour? The red doesnt really suit it at all.

Works perfectly. I love you all. :D

[high]* Synicide throws kisses to everybody.[/high]

Edgewize 04-14-2004 01:26 AM

If anyone is having trouble with my original hack_me.php version posted a few pages back, then I'm at a loss. It must be a conflict with another poorly written hack because all that my code does is insert code tags before and after the /me line, as if they were typed by the user himself. There is no way that vB tags can cause a post or a thread to just 'disappear' unless some custom change has been made to the bbcode parser.

For the record, the original hack_me version that I posted in this thread works fine for my vB 3.0 Gold sites.

Boofo 04-14-2004 02:45 AM

Quote:

Originally Posted by Edgewize
If anyone is having trouble with my original hack_me.php version posted a few pages back, then I'm at a loss. It must be a conflict with another poorly written hack because all that my code does is insert code tags before and after the /me line, as if they were typed by the user himself. There is no way that vB tags can cause a post or a thread to just 'disappear' unless some custom change has been made to the bbcode parser.

For the record, the original hack_me version that I posted in this thread works fine for my vB 3.0 Gold sites.

I went back to using your code. I couldn't get any of the others to work everywhere. ;)

Edgewize 04-14-2004 03:08 PM

Oops, right after I say that, I discover a problem :) New version fixes a very obscure bug with one-line quotes. Just a minor display bug, could accidentally change the color of text that came right before a /me. Check the original post:

https://vborg.vbsupport.ru/showthrea...334#post484334

Boofo 04-14-2004 04:26 PM

Quote:

Originally Posted by Edgewize
Oops, right after I say that, I discover a problem :) New version fixes a very obscure bug with one-line quotes. Just a minor display bug, could accidentally change the color of text that came right before a /me. Check the original post:

https://vborg.vbsupport.ru/showthrea...334#post484334

What did you change in it? I see the s is gone and a t is added. Anything else? ;)

And I wanted to ask. How come if I use highlight instead of color=, all the /me lines are in bold?

Edgewize 04-16-2004 06:12 AM

All the occurrances of \s were replaced with [ \t] (that's [(space)\t]). \s also matches newlines, so that could get into trouble and match too much in very particular situations. Also, the parenthesis groups were shifted around a bit, but I can't remember why ;)

I have no idea why highlight would do that. As you can see, it just inserts a tag before any bbcode processing is done ... does your highlight normally make things bold?

Wolf42 04-16-2004 01:39 PM

[high]* Wolf42 clicks install
[/high]

Its still a nice hack. Thank you very much. :D

Boofo 04-16-2004 03:06 PM

Quote:

Originally Posted by Edgewize
All the occurrances of \s were replaced with [ \t] (that's [(space)\t]). \s also matches newlines, so that could get into trouble and match too much in very particular situations. Also, the parenthesis groups were shifted around a bit, but I can't remember why ;)

I have no idea why highlight would do that. As you can see, it just inserts a tag before any bbcode processing is done ... does your highlight normally make things bold?

To tell you the truth, I'm not sure if the highlight tags does that also, or not. I never paid much attention to it until now. Where would that code be on vB3, do you know?

TouchingVirus 04-17-2004 09:32 PM

The highlight code appears in functions_bbcode.php at line 203..i think this is what you were looking for..

PHP Code:

// [HIGHLIGHT]
    
$bbcodes['custom']['find']['[highlight]'] = '#\[highlight\](.*)\[/highlight\]#esiU';
    
$bbcodes['custom']['replace']['[highlight]'] = "handle_bbcode_parameter('\\1', '" str_replace("'""\'"'<span class="highlight">\1</span>') . "')";
    
$bbcodes['custom']['recurse']['highlight'][0] = array('replace_html' => "<span class=\"highlight\">\\7</span>"); 


Boofo 04-17-2004 09:48 PM

Why would it be in bold when I use it with this hack? Any idea? ;)

sabret00the 04-18-2004 09:20 AM

ok i've enhanced this code for the benefit of sites with multiple stylesets (conflicting colours)

1. Open includes/functions_bbcodeparse.php:

Find:

PHP Code:

         $bbcode str_replace(array('&gt;|||)''&lt;|||)''&quot;|||)'), array('&gt;)''&lt;)','&quot;)'), $bbcode);
     } 
// end smilies 

UNDERNEATH, ADD:

PHP Code:

 // /me Hack
       
global $post;
      
$bbcode preg_replace('#^/me (.*)$#im'"<span class=\"highlight\">* $post[username] \\1</span>"$bbcode);
 
// /me Hack 


2. Open newreply.php:

Find:

PHP Code:

 $pagetext trim(strip_quotes($pagetext)); 

UNDERNEATH, ADD:

PHP Code:

 // /me Hack
                 
$pagetext preg_replace('#^/me(.*)$#im'"* $originalposter\\1"$pagetext);
 
// /me Hack 

Done and you also maintain XHTML compliancy :D

SySt3M 04-19-2004 12:53 PM

thanks very much, nifty little addition this one

/me clicks install


All times are GMT. The time now is 11:19 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.01770 seconds
  • Memory Usage 1,901KB
  • 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
  • (2)bbcode_code_printable
  • (23)bbcode_php_printable
  • (14)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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