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)
-   -   MultiQuote (https://vborg.vbsupport.ru/showthread.php?t=59702)

Chroder 01-04-2004 10:00 PM

MultiQuote
 
Introduction
This multiquote hack allows your members to select multiple posts to quote from. These posts can be on a different page, in a different thread, or on an entirely different forum. Don't worry, the hack checks to make sure the user has read permissions on the post so no sneaky members can insert random post ID's in hopes to find what's going on in your secret staff forums.

What's new in this "version 2"?
  • Better programmed!
  • "Go Advanced" works with Quick Reply
  • Fixed the bug with IE not "turning on" the MQ icons when re-viewing a thread with MQ'd posts.
  • Included vB3-styled icons (I just resized the images posted by Hoffi -- thanks Hoffi!)
Overview
  • vB files to modify: 1 (newreply.php)
  • Templates to modify: 2 (SHOWTHREAD, postbit)
  • Phrases to create: 1 (multiquote)
  • Files to upload: 3 (2 images, 1 Javascript file)
(Included missing Javascript file from post #75. Sorry for the delays, I don't come around often!)

BillaBongUSA 01-05-2004 01:38 AM

Sweet, I'll download it and give it a try right now...

MGM 01-05-2004 01:44 AM

sweeet, nice hack man, thanks for creating it!

is there a way to have the multiquote's show up in the Quick Reply though?

/me clicks install

Chroder 01-05-2004 01:54 AM

Mabe on a click-to-click basis (ie. only the page the posts are on) but even that is a little over-the-top I think. 'Cuz you'll have all that text you'll be adding to the QR.

But I'm not the best at javascript -- mabe another guru will code it ;)

BillaBongUSA 01-05-2004 01:55 AM

I just installed it with no problems at all, nice job. :) But shouldn't the multi-quote button be added into the postbit_legacy template as well?

Chroder 01-05-2004 02:02 AM

It could... But I've got school tomorrow -- c'mon! :p I'll do it later perhaps, the HTML is the same (<img ...>).

Koutaru 01-05-2004 02:32 AM

Nice :) I was waiting for this one! Will definately install ;) Thanks

mtellin 01-05-2004 03:53 AM

great hack, I had been waiting for something like this :)

[high]* mtellin clicks install[/high]

tomshawk 01-05-2004 04:49 AM

Installed and works like a champ

Clicks install

;)

mtellin 01-05-2004 04:55 AM

I already un-installed it without thinking, but I got a SQL error when I clicked the quote button, then unclick it and hit the post reply button...anyone else get this?

Chroder 01-05-2004 05:17 AM

Quote:

Originally Posted by mtellin
I already un-installed it without thinking, but I got a SQL error when I clicked the quote button, then unclick it and hit the post reply button...anyone else get this?

Your fast :p I was right in the middle of fixing it when you posted ;) Anyway, see first post and you can download the new file. Only the code in newreply.php was updated. (You'll see an 'updated' text next to it in the HTML instructions).

mtellin 01-05-2004 05:41 AM

Quote:

Originally Posted by Chroder
Your fast :p I was right in the middle of fixing it when you posted ;) Anyway, see first post and you can download the new file. Only the code in newreply.php was updated. (You'll see an 'updated' text next to it in the HTML instructions).

:) thanks, did the trick

NuclioN 01-05-2004 09:00 AM

When quoting (after the updated file) and reply with quick reply another mysql error:

Database error in vBulletin 3.0.0 Release Candidate 1:

Invalid SQL: SELECT postid, username, pagetext FROM vb3_post WHERE postid IN(6566,6568) AND postid <> ORDER BY postid ASC
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY postid ASC' at line 1

mysql error number: 1064

Chroder 01-05-2004 10:03 PM

Another update that deals with these things more cleanly. I'm working on an addition that'll allow the "go advance" in the QR to also have all the quotes.

Change the newreply.php code to the following:

PHP Code:

//############################################################################
 //# START MULTI QUOTE                                                     #
  //############################################################################
  
if(isset($_COOKIE[COOKIE_PREFIX 'mq']))
  {
      
$pids $_COOKIE[COOKIE_PREFIX 'mq'];
      
$pids urldecode($pids);
  
      if(!empty(
$pids) && preg_match("/^[0-9,]+$/"$pids))
      {
         
$mq_postid = (empty($_REQUEST['noquote']) ? "AND postid <> {$postinfo['postid']}'');
          
         
$q $DB_site->query("SELECT postid, username, pagetext FROM ".TABLE_PREFIX."post WHERE postid IN($pids$mq_postid ORDER BY postid ASC LIMIT 20");
          while(
$row $DB_site->fetch_array($q))
          {
             
$originalposter fetch_quote_username($row['username']);
              
$pagetext htmlspecialchars_uni($row['pagetext']);
              
$pagetext trim(strip_quotes($pagetext));
          eval(
'$newpost[\'message\'] .= "' fetch_template('newpost_quote'10) . '\n";');
          }
      }
  
     
setcookie(COOKIE_PREFIX 'mq'''time() - 3600$vboptions['cookiepath'], $vboptions['cookiedomain']);
  }
  
//############################################################################
 //# END MULTI QUOTE                                                         #
  //############################################################################ 

This should fix all mysql errors recieved above, on my test board it seemed to do fine :) It also now checks that the $pids is only numbers/commas so there are no tricky users trying to screw up the board.

[Updated file uploaded in first post]

mtellin 01-05-2004 10:22 PM

I still get one error with this, when I click the multi quote button and then click go advanced I get this:

Database error in vBulletin 3.0.0 Release Candidate 1:

Invalid SQL: SELECT postid, username, pagetext FROM post WHERE postid IN(19123) AND postid <> ORDER BY postid ASC LIMIT 20
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY postid ASC LIMIT 20' at line 1

mysql error number: 1064

EDIT: looks like NuclioN already posted this

Chroder 01-05-2004 11:43 PM

I can't recreate this problem on my localhost, so I asume this was prior to the Jan05-2 update? So its fixed -- correct?

mtellin 01-05-2004 11:49 PM

Quote:

Originally Posted by Chroder
I can't recreate this problem on my localhost, so I asume this was prior to the Jan05-2 update? So its fixed -- correct?

in my case it wasnt, thats with your latest version that you have :(

BillaBongUSA 01-06-2004 12:01 AM

Yeah, I just updated everything with the new code that you just posted, and I'm getting the same error when I click on the "Go Advanced" button.

NuclioN 01-06-2004 12:20 AM

The go advanced button is producing this error but after your last update the quick reply gives that error again. I hope you can fix it because this is a great addition. :)

Chroder 01-06-2004 01:43 AM

Ok, clicking MQ button followed by a "Go Advanced" in the QR gives an error? I think I've found it, forgot a '!' on a line. But before I make an 'update' would someone please try it? :p

PHP Code:

//############################################################################
 //# START MULTI QUOTE                                                     #
  //############################################################################
  
if(isset($_COOKIE[COOKIE_PREFIX 'mq']))
  {
      
$pids $_COOKIE[COOKIE_PREFIX 'mq'];
      
$pids urldecode($pids);
  
      if(!empty(
$pids) && preg_match("/^[0-9,]+$/"$pids))
      {
         
$mq_postid = (!empty($_REQUEST['noquote']) ? "AND postid <> {$postinfo['postid']}'');
          
         
$q $DB_site->query("SELECT postid, username, pagetext FROM ".TABLE_PREFIX."post WHERE postid IN($pids$mq_postid ORDER BY postid ASC LIMIT 20");
          while(
$row $DB_site->fetch_array($q))
          {
             
$originalposter fetch_quote_username($row['username']);
              
$pagetext htmlspecialchars_uni($row['pagetext']);
              
$pagetext trim(strip_quotes($pagetext));
          eval(
'$newpost[\'message\'] .= "' fetch_template('newpost_quote'10) . '\n";');
          }
      }
  
     
setcookie(COOKIE_PREFIX 'mq'''time() - 3600$vboptions['cookiepath'], $vboptions['cookiedomain']);
  }
  
//############################################################################
 //# END MULTI QUOTE                                                         #
  //############################################################################ 

Sorry if even this doesn't work. Not thinking clearly today. :tired:

// edit. yep, the correct code..

mtellin 01-06-2004 01:54 AM

I got a parse error when I tried that one, no matter what type of reply I tried

Chroder 01-06-2004 02:03 AM

You sure you pasted it correctly? I've got the exact code and nothing is comeing up for me. Whats the error your getting?

BillaBongUSA 01-06-2004 02:12 AM

That new code seems to work okay for me.

mtellin 01-06-2004 02:20 AM

Quote:

Originally Posted by Chroder
You sure you pasted it correctly? I've got the exact code and nothing is comeing up for me. Whats the error your getting?

Yup it was something completly unrelated that I messed up, wasnt your code and its working now

However for me if I click more than one to quote, and then click post reply, it only has one quoted (but I didnt get any errors when clicking one to quote then clicking go advanced)

BillaBongUSA 01-06-2004 02:42 AM

Yeah, same here, but I think that that only happens when you try to quote the last reply in the thread. Any other reply that I try to quote works, but when I try to quote the last reply, it doesn't show up.

[Edit: I don't know if that was very clear... To clarify, if I select three posts to quote, they will all show up. But if one of those is the last post in the thread, only two will show up, and the last post in the thread is omitted.]

Zelda-King 01-06-2004 03:52 PM

Yeah, I get a database error when using Quick Reply (which is important to fix as most people use Quick Reply). Same one as posted already;

Database error in vBulletin 3.0.0 Release Candidate 2:

Invalid SQL: SELECT postid, username, pagetext FROM post WHERE postid IN(19134) AND postid <> ORDER BY postid ASC LIMIT 20
mysql error: You have an error in your SQL syntax near 'ORDER BY postid ASC LIMIT 20' at line 1

mysql error number: 1064

Also, considering this works across threads and such, shouldn't the button for selected posts stay on? If you go back to a post on another page that you selected, the button turns off though the quote still works.

Chroder 01-06-2004 06:57 PM

PHP Code:

//############################################################################
//# START MULTI QUOTE                                                        #
//############################################################################
if(isset($_COOKIE[COOKIE_PREFIX 'mq']))
{
    
$pids $_COOKIE[COOKIE_PREFIX 'mq'];
    
$pids urldecode($pids);

    if(!empty(
$pids) && preg_match("/^[0-9,]+$/"$pids))
    {
        if(
$_REQUEST['noquote'])
            
$mq_postid '';
        elseif(!empty(
$postinfo['postid']))
            
$mq_postid "AND postid <> {$postinfo['postid']}";
        else
            
$mq_postid '';

        
$q $DB_site->query("SELECT username, pagetext FROM ".TABLE_PREFIX."post WHERE postid IN($pids$mq_postid ORDER BY postid ASC LIMIT 20");
        while(
$row $DB_site->fetch_array($q))
        {
            
$originalposter fetch_quote_username($row['username']);
            
$pagetext htmlspecialchars_uni($row['pagetext']);
            
$pagetext trim(strip_quotes($pagetext));
            eval(
'$newpost[\'message\'] .= "' fetch_template('newpost_quote'10) . '\n";');
        }
    }

    
setcookie(COOKIE_PREFIX 'mq'''time() - 3600$vboptions['cookiepath'], $vboptions['cookiedomain']);
}
//############################################################################
//# END MULTI QUOTE                                                          #
//############################################################################ 

That should fix the last post not being included. I got screwed up because in RC2 (mabe RC1?) the template changed and the reply button actually replies to the _last_ post as to the first post. So I was having trouble reproducing the bug ;)

I'll update the main file with this code. The "go advanced" in the quick reply still doesn't show the quotes, though I'm working on it :)

Chroder 01-06-2004 07:06 PM

Zelda-King -- I assume you were using the code from the file? I posted a fix to that above, but the main file is now updated.

Quote:

Originally Posted by Zelda-King
Also, considering this works across threads and such, shouldn't the button for selected posts stay on? If you go back to a post on another page that you selected, the button turns off though the quote still works.

It should be doing this already, that is the reason for the mq_init() function. Is anyone else not getting this functionality? Remember that the New Reply page, when loaded, will clear the cookie that has saved the posts you've selected. This is the intended action, because after they've been added to the message box they're not needed. Though the problem comes with the "go advanced" button in the QR that will not display the quotes but will still clear them.

BillaBongUSA 01-06-2004 09:01 PM

Yeah, the button doesn't stay on for me cross-thread either.

Chroder 01-06-2004 10:36 PM

Doh. Seems to only work in Moz. I'll look into that too.

Zelda-King 01-07-2004 04:09 PM

Yeah, I'm using Internet Explorer 6. The database problem I had is fixed now I downloaded the Jan 6th update. I redid the hack from scratch just in case.

EDIT: Just to say, seeing as this hack requires postbit alterations, the button also shows in PMs and usernotes. It doesn't do anything of course, though I get errors on my usernotes page. ie, I get that alert "done but with errors on page".

Erwin 01-09-2004 02:22 AM

Great hack. Should be made standard in vB3. :)

Erwin 01-09-2004 02:24 AM

Quote:

Originally Posted by Zelda-King
Yeah, I'm using Internet Explorer 6. The database problem I had is fixed now I downloaded the Jan 6th update. I redid the hack from scratch just in case.

EDIT: Just to say, seeing as this hack requires postbit alterations, the button also shows in PMs and usernotes. It doesn't do anything of course, though I get errors on my usernotes page. ie, I get that alert "done but with errors on page".

For a quick and dirty way to make it so that the button does not show up in PM or usernote, just wrap it with a conditional:

<if condition="$SHOWQUICKREPLY">button</if>

Zelda-King 01-09-2004 07:41 AM

Oh yes! Why didn't I think of conditions? :/

Nice one! :)

NuclioN 01-09-2004 09:31 AM

Where to add that code Erwin?

Erwin 01-09-2004 09:32 AM

Quote:

Originally Posted by NuclioN
Where to add that code Erwin?

I haven't installed this hack, so I don't know exactly. Whatever the <img src=...> is for the button. :)

pie 01-09-2004 11:56 AM

Doesnt work, I multi quote a few posts, click QUOTE MESSAGE IN REPLY. And no quotes appear

SnowBot 01-10-2004 08:19 AM

How can we format it so it looks like the quotes on here? I mean the box around the quotes? :) so it looks nice and neat like vb.org's do and make a space between the quote box and the start of the users comment as now there is no line return.

Zelda-King 01-16-2004 09:41 PM

The mq_script template needs caching in showthread.php to avoid one extra query.

Under
PHP Code:

'im_yahoo'

add
PHP Code:

'mq_script'


anabolicedge 01-17-2004 06:11 PM

this isnt working for my site... ive read the instuctions a few time and re-did it all 3 times... i dont see no quick reply button or check box?? Can someone help.. here's my site

http://www.anabolicedge.net/forum


All times are GMT. The time now is 04:40 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.02637 seconds
  • Memory Usage 1,871KB
  • 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
  • (5)bbcode_php_printable
  • (7)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
  • (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