vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Miscellaneous Hacks - Who Quoted Me (https://vborg.vbsupport.ru/showthread.php?t=255285)

Swedie 12-01-2011 06:13 PM

Yeah, same problem here. It doesn't update... WTF: Must fix!

Swedie 12-01-2011 07:11 PM

The problem lies in the preg_match function. It's incorrect and fails finding quotes when there are line breaks (what I guess) in the post that is being quoted.

I wish I knew regex code well enough, but I don't, so I can only fix this by making an ugly piece of hack without regex that finds the quotes and puts then in an array. I might post it here, but beware it's fugly code.

Swedie 12-01-2011 07:58 PM

I figured it out pretty decently what caused it. It was the first preg_match but also for me I needed /is for case incensitive version.

Replace all the code in the plugin for this mod: Find Quotes

Code:

if(preg_match("/\[quote=(.*)\](.*)\[\/quote\]/is", $post['message']))
{
  preg_match_all("/\[quote=(.*?)\](.*?)\[\/quote\]/is", $post['message'], $quotematch);
        $quotecount = count($quotematch[0]);
        $tempcount = 0;
        $quotearray = array();

        while ($tempcount < $quotecount)
        {
                $username = explode(';', $quotematch[1][$tempcount]);
                $quoteduserid = $vbulletin->db->query_first(
                        "SELECT userid FROM " . TABLE_PREFIX . "user
                        WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username[0])) . "'"
                );

                if (!in_array($quoteduserid['userid'], $quotearray))
                {
                        if ($quoteduserid['userid'] > 0)
                        {
                                $vbulletin->db->query_write("
                                        INSERT INTO " . TABLE_PREFIX . "quotedatanew (quoted,quoter,postid,dateline)
                                        VALUES ('" . $quoteduserid['userid'] . "','" . $vbulletin->userinfo['userid'] . "','" . $post['postid'] . "','" . time() . "')"
                                );
                                $quotearray[] = $quoteduserid['userid'];
                        }
                }
                $tempcount++;
        }
}

This means this mod works up to version 4.x.x.

henriof9 12-13-2011 04:45 PM

[QUOTE=Swedie;2273791]I figured it out pretty decently what caused it. It was the first preg_match but also for me I needed /is for case incensitive version.

Replace all the code in the plugin for this mod: Find Quotes

Code:

if(preg_match("/\[quote=(.*)\](.*)\[\/quote\]/is", $post['message']))
{
  preg_match_all("/\

       
Quote:

       
       
               
       
       

                       

                       
                               

                                        Originally Posted by (.*?)\
                                       
                               

                               
(.*?)\[\/quote\]/is", $post['message'], $quotematch);
        $quotecount = count($quotematch[0]);
        $tempcount = 0;
        $quotearray = array();

        while ($tempcount < $quotecount)
        {
                $username = explode(';', $quotematch[1][$tempcount]);
                $quoteduserid = $vbulletin->db->query_first(
                        "SELECT userid FROM " . TABLE_PREFIX . "user
                        WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username[0])) . "'"
                );

                if (!in_array($quoteduserid['userid'], $quotearray))
                {
                        if ($quoteduserid['userid'] > 0)
                        {
                                $vbulletin->db->query_write("
                                        INSERT INTO " . TABLE_PREFIX . "quotedatanew (quoted,quoter,postid,dateline)
                                        VALUES ('" . $quoteduserid['userid'] . "','" . $vbulletin->userinfo['userid'] . "','" . $post['postid'] . "','" . time() . "')"
                                );
                                $quotearray[] = $quoteduserid['userid'];
                        }
                }
                $tempcount++;
        }
}

                       
                       

               


Quote:

Originally Posted by (.*?)\

This means this mod works up to version 4.x.x.

Thanks, I have taken the hint from @inpicos post #65 and it works perfectly now. :)

Breakpoint 12-20-2011 11:29 PM

Let me know when updates, would love to try with out fixing code :D

thenamesgould 01-28-2012 12:42 AM

I like it, thanks! The only thing is the quotes in the off-limits areas, but we can be careful not to do any for now. Cheers. :D

vauge 08-17-2012 01:47 PM

Is there a way to easily turn this off per user?

scott_237 09-11-2012 01:20 PM

I think this works MOST of the time, but I'm admin on my forums and I only get notified for a small percentage of the quotes, no all of them. Why is this?

EliasAlucard 10-02-2012 07:42 PM

Quote:

Originally Posted by scott_237 (Post 2364615)
I think this works MOST of the time, but I'm admin on my forums and I only get notified for a small percentage of the quotes, no all of them. Why is this?

Yeah, I noticed now that it hasn't been working the past 3-4 days. I'm using vB 4.2.0 and it seems like this plugin could need an update.

farazfaraz 11-02-2012 10:52 PM

dont show

why?


All times are GMT. The time now is 12:47 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.01107 seconds
  • Memory Usage 1,748KB
  • 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
  • (3)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
  • (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