vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Forum Display Enhancements - Collapsable First Post using AJAX (or Last Post!) (https://vborg.vbsupport.ru/showthread.php?t=145187)

jasculs 07-06-2007 05:25 AM

The mod is great!

However it doesn't work with the "Hide Links From Guest" mod:

https://vborg.vbsupport.ru/showthread.php?t=123415

Guests are able to see the links in the ajax post. Anything I can do to make it work?

magnus 07-06-2007 10:47 AM

Quote:

Originally Posted by jasculs (Post 1284139)
The mod is great!

However it doesn't work with the "Hide Links From Guest" mod:

https://vborg.vbsupport.ru/showthread.php?t=123415

Guests are able to see the links in the ajax post. Anything I can do to make it work?

Right off the bat, I'd say you'd just need to run whatever regular expression match/replace he's probably using against the returned message value.

It's something I can look at when I get some time.

jasculs 07-06-2007 01:16 PM

Quote:

Right off the bat, I'd say you'd just need to run whatever regular expression match/replace he's probably using against the returned message value.
I don't quite understand really. Anyway you can give an example. Would that require a plugin for me to add? I'm ok with finding things in the code, but I'm not sure what I should look for as far as a regular expression match/replace.

magnus 07-06-2007 02:37 PM

In one of the plugins for the link hack, you'll most likely find a bit of code that does all the processing you're looking for. Something that uses a regexp to match for http then replaces it with the specified phrase.

Taking that bit of code, and placing it in vbpost_ajax.php where the message text is retrieved should yield the desired result.

Invalid ID 07-06-2007 02:53 PM

Amazing

jasculs 07-06-2007 03:52 PM

Quote:

Originally Posted by magnus (Post 1284410)
In one of the plugins for the link hack, you'll most likely find a bit of code that does all the processing you're looking for. Something that uses a regexp to match for http then replaces it with the specified phrase.

Taking that bit of code, and placing it in vbpost_ajax.php where the message text is retrieved should yield the desired result.

Would what your talking about be in this plugin somewhere? This is the plugin that hides the links in the posts. If it is in here can you point it out for me and maybe tell me where to put in the vbpost_ajax.php file? I would really appreciate it.

Code:

if (ereg("(showthread)", $GLOBALS[vbulletin]->scriptpath))
{
        if ($this->registry->options['hlfg_global'])
        {
                $groups = explode(',',$this->registry->options['hlfg_groups']);
                if ($this->registry->options['hlfg_posts'] AND !$this->registry->userinfo['userid'] OR $this->registry->options['hlfg_posts'] AND (is_member_of($this->registry->userinfo, $groups) OR $groups[0] == 0))
                {
                        if (!$forum['forum_hlfg'])
                        {
                                $pattern = '/(<a.*?<*a>)/';
                                $message_array = preg_split($pattern, $this->post['message'], 65535, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);

                                if ($this->registry->options['hlfg_misc'] == '')
                                {
                                        $this->registry->options['hlfg_misc'] = "\e";
                                }

                                $ugids = explode(',',$this->registry->options['hlfg_ugids']);
                                if ($ugids[0] == '')
                                {
                                        $ugids[0] = '0';
                                }

                                foreach($message_array as $message_key => $message_value)
                                {
                                        if (!preg_match("/" . $this->registry->options['hlfg_misc'] . "/", $message_value) AND (!strstr($this->registry->options['hlfg_users'], $post[musername])) AND ($post['userid'] != $this->registry->userinfo['userid'] OR !$this->registry->options['hlfg_own']) AND (!is_member_of($post['usergroupid'], $ugids)))
                                        {
                                                $message_array[$message_key] = preg_replace("!<a[^>]*(http|www|mailto)(.*)</a>|\b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b!siU", $this->registry->options['hlfg_info'], $message_value);
                                        }
                                }
                                $this->post['message'] = implode("", $message_array);
                        }
                }
        }
}


magnus 07-06-2007 05:14 PM

Yep, that looks like it. I had hoped it would've been contained within a function, as that would've been ideal -- however, that will work.

Try this:

Open up vbpost_ajax.php, look for:
PHP Code:

//if ($_SERVER['REQUEST_METHOD'] == 'POST' AND 

Above it, paste the following:
PHP Code:

    if ($vbulletin->options['hlfg_global'])
    {
        
$groups explode(',',$vbulletin->options['hlfg_groups']);
        if (
$vbulletin->options['hlfg_posts'] AND !$vbulletin->options['userid'] OR $vbulletin->options['hlfg_posts'] AND (is_member_of($vbulletin->userinfo$groups) OR $groups[0] == 0))
        {
            if (!
$foruminfo['forum_hlfg'])
            {
                
$pattern '/(<a.*?<*a>)/';
                
$message_array preg_split($pattern$post['message'], 65535PREG_SPLIT_DELIM_CAPTURE PREG_SPLIT_NO_EMPTY);

                if (
$vbulletin->options['hlfg_misc'] == '')
                {
                    
$vbulletin->options['hlfg_misc'] = "\e"
                }

                
$ugids explode(',',$vbulletin->options['hlfg_ugids']);
                if (
$ugids[0] == '')
                {
                    
$ugids[0] = '0';
                }

                foreach(
$message_array as $message_key => $message_value)
                {
                    if (!
preg_match("/" $vbulletin->options['hlfg_misc'] . "/"$message_value) AND (!strstr($vbulletin->options['hlfg_users'], $post[musername])) AND ($post['userid'] != $vbulletin->userinfo['userid'] OR !$vbulletin->options['hlfg_own']) AND (!is_member_of($post['usergroupid'], $ugids)))
                    {
                        
$message_array[$message_key] = preg_replace("!<a[^>]*(http|www|mailto)(.*)</a>|\b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b!siU"$vbulletin->options['hlfg_info'], $message_value);
                    }
                }
                
$post['message'] = implode(""$message_array);
            }
        }
    } 

Keep in mind I haven't had a chance to test this, so I'd suggest backing up your original vbpost_ajax.php. Let me know if that works, if not, when I get some free time I'll install the links hack on my test forum.

jasculs 07-06-2007 05:21 PM

That worked except it blocked the links for everyone, not just guests. Anyway I can add a condition or something so it just blocks it for unregistered users only? Thanks for the help.

alessai 07-06-2007 05:22 PM

magnus.... could yo see my suggestion ? and is it possible?

magnus 07-06-2007 07:04 PM

Quote:

Originally Posted by alessai (Post 1284510)
magnus.... could yo see my suggestion ? and is it possible?

I need more information before I could even remotely begin to address your question. For example, a link to whichever modification you're trying to use in conjuction with this one.


All times are GMT. The time now is 11:32 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.01646 seconds
  • Memory Usage 1,781KB
  • 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
  • (2)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (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