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)
-   -   Show Thread Enhancements - Replace URL's With Page Title (https://vborg.vbsupport.ru/showthread.php?t=155909)

PurpleButterfly 10-22-2007 10:37 PM

Any advice on why it's not working in my 3.6.8 forum? I installed and it's showing up in the admin CP, but none of the test posts I'm making are showing page titles, only the URL as usual. I've tried all sorts of URL's....

Jafo232 10-26-2007 02:40 AM

Who is your host? Is it dreamhost?

PurpleButterfly 10-26-2007 05:03 AM

Quote:

Originally Posted by Jafo232 (Post 1368832)
Who is your host? Is it dreamhost?

No, Fused Network and they are *awesome*....is there an issue w/this not working with hosting companies who have higher security settings?

Jafo232 10-26-2007 11:35 PM

Some hosts disable the fopen option to URL's, this sounds like the case with your host.

PurpleButterfly 10-27-2007 01:37 AM

Ahhh, okay. Thanks for taking the time to let me know this. :)

Almotmaiz.Net 10-27-2007 04:27 PM

i love it , good work :)

click Installed

TrioxX 12-06-2007 06:49 AM

Really great hack if it would work for me :/ Ive imported the xml, but the urls are the same as before...

i've created a new thread with the text http://www.google.de/search?hl=de&q=test&meta=. If i understand the function of this plugin correctly, it must show me test - Google-Search and not http://www.google.de/search?hl=de&q=test&meta=. Right? If yes... Where is the problem?!? Safe mode? Mod Rewrite?

Jafo232 12-06-2007 07:38 AM

Has your host disabled fopen()?

Phooey 12-06-2007 03:50 PM

Yet another vBSEO feature for free, thanks!

/installed

karnevil 12-09-2007 06:58 PM

Probably a daft question - all my links to forums work perfectly with this mod, but links to threads instead of showing the original URL, or the thread title, just show the link as the forum title. I assume it has something to do with title tags - how would I change this to be the Thread title as opposed to the Forum title.

Does that make sense? Thankyou x

Jafo232 12-10-2007 02:03 AM

Hmm, I assume you will have to edit a template or a VB setting to use the threads title for the page title.. I kinda thought they all did already, but maybe your template needs updating..

karnevil 12-10-2007 11:18 AM

Thanks Jafo - been trying to work it out for ages and have got completely nowhere.

Heres how the links come up

http://www.legalbeagles.info/forums/...ead.php?t=3539

On VB org they come up as

https://vborg.vbsupport.ru/showthrea...=155909&page=7

On another site where it does work they come up as

http://www.consumeractiongroup.co.uk...olicitors.html


Thats what I want mine to do....

karnevil 12-10-2007 12:30 PM

Ahhh think we ran out of VBSEO.... :(

Is that the only way to do it ?

Jafo232 12-10-2007 04:03 PM

Not sure what is happening, because the site you link to isn't online..

Jafo232 12-19-2007 04:11 AM

Quote:

Originally Posted by karnevil (Post 1398524)
Ahhh think we ran out of VBSEO.... :(

Is that the only way to do it ?

I have no idea what you are saying.

Satz 12-19-2007 11:06 AM

i tried everythin..still no luck for me :(

there is no way otherthan buying VBseo ? for Title_based_url.html ?

katan 12-19-2007 03:48 PM

thanks you!!!

Jafo232 12-19-2007 04:29 PM

Quote:

Originally Posted by Satz (Post 1404468)
i tried everythin..still no luck for me :(

there is no way otherthan buying VBseo ? for Title_based_url.html ?

This mod does not create title_based_url.html. Your misunderstand it.

sweede 12-19-2007 05:08 PM

Go to the admin CP

Plugins & Products -> Plugin Manager

Look for "Product : Title Replace"

Edit the plugin labeled Title Replace
Replace the contents of the Plugin PHP Code with the code below.

The code below does NOT use cURL or fopen and does not run into the problem of either cURL not being installed or hosts that have URL opens with fopen disabled.

fsocketopen will retrieve the first 8k of the HTML file to look for the <title></title> tags. if it does not find them, it will end the connection and return the pasted URL as is.

I should warn you that i havent tested this code for basic PHP Errors. it would be wise to copy the existing plugin PHP Code to notepad for a backup before pasting the code below.

-- See my post below with the change that uses fread() opposed to while(!feof(resource) )

Jafo232 12-19-2007 05:36 PM

This above code entry does NOT just open the first 8k.. Consider:

Code:

<?php
error_reporting(E_ALL);

function auto_title_http_get($url){

        $url_stuff = parse_url($url);
        $port = isset($url_stuff['port']) ? $url_stuff['port'] : 80;

        $fp = fsockopen($url_stuff['host'], $port);

        $query  = "GET " . $url_stuff['path'] ."?". $url_stuff['query'] . " HTTP/1.0\n";
        $query .= "Host: " . $url_stuff['host'];
        $query .= "\n\n";

        fwrite($fp, $query);

        while ($tmp = fread($fp, 8192))
        {
            $buffer .= $tmp;
        }

        preg_match('/Content-Length: ([0-9]+)/', $buffer, $parts);

        return substr($buffer, - $parts[1]);

    }


echo auto_title_http_get('http://fedora.inode.at/6/i386/iso/FC-6-i386-DVD.iso');

?>

And watch your servers memory get gobbled up and and PHP timeout.. Hence why fopen is preferred.

sweede 12-19-2007 06:23 PM

while(!feof) , while NOT end of file. the correct methon would be to use fread(resource, bytes) , which reads the stream until bytes and then closes the stream.

I actually tested this one.


HTML Code:


if (!function_exists(convert_url_to_bbcode_callback_auto_title)) {
    function convert_url_to_bbcode_callback_auto_title($messagetext, $prepend)
    {
            // the auto parser - adds [url] tags around neccessary things
            $messagetext = str_replace('\"', '"', $messagetext);
            $prepend = str_replace('\"', '"', $prepend);

            static $urlSearchArray, $urlReplaceArray, $emailSearchArray, $emailReplaceArray;
            if (empty($urlSearchArray))
            {
                    $taglist = '\[b|\[i|\[u|\[left|\[center|\[right|\[indent|\[quote|\[highlight|\[\*' .
                            '|\[/b|\[/i|\[/u|\[/left|\[/center|\[/right|\[/indent|\[/quote|\[/highlight';
                    $urlSearchArray = array(
                            "#(^|(?<=[^_a-z0-9-=\]\"'/@]|(?<=" . $taglist . ")\]))((https?|ftp|gopher|news|telnet)://|www\.)((\[(?!/)|[^\s[^$`\"'|{}<>])+)(?!\[/url|\[/img)(?=[,.!)]*(\)\s|\)$|[\s[]|$))#siU"
                    );

                    $urlReplaceArray = array(
                            "[url]\\2\\4[/url]"
                    );




                    $emailSearchArray = array(
                            "/([ \n\r\t])([_a-z0-9-]+(\.[_a-z0-9-]+)*@[^\s]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))/si",
                            "/^([_a-z0-9-]+(\.[_a-z0-9-]+)*@[^\s]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))/si"
                    );

                    $emailReplaceArray = array(
                            "\\1[email]\\2[/email]",
                            "[email]\\0[/email]"
                    );
            }

            $text = preg_replace_callback($urlSearchArray, "auto_title", $messagetext);

            if (strpos($text, "@"))
            {
                    $text = preg_replace($emailSearchArray, $emailReplaceArray, $text);
            }

            return $prepend . $text;
    }
   
    function auto_title_http_get($url){

        $url_stuff = parse_url($url);
        $port = isset($url_stuff['port']) ? $url_stuff['port'] : 80;

        $fp = fsockopen($url_stuff['host'], $port);

        $query  = "GET " . $url_stuff['path'] ."?". $url_stuff['query'] . " HTTP/1.0\n";
        $query .= "Host: " . $url_stuff['host'];
        $query .= "\n\n";

        fwrite($fp, $query);

      $buffer = fread($fp, 8192);

        preg_match('/Content-Length: ([0-9]+)/', $buffer, $parts);

        return substr($buffer, - $parts[1]);

    }
    function auto_title ($text)
    {

        if ($text[2] == 'www.' or $text[2] == 'WWW.') {
            $text[4] = $text[2] . $text[4];
            $text[2] = 'http://';
        }

        $paged = @fopen( $text[2] . $text[4], "r" ); #echo $page . "DONE";

        $page = auto_title_http_get($paged);

        preg_match("/<title>[\n\r\s]*(.*)[\n\r\s]*<\/title>/", $page, $title);

        if ($title[1] == '') {
            $title[1] = $text[2] . $text[4];
        }
            return "[url=\"" . $text[2] . $text[4] . "\"]" . preg_replace("/\&.+\;/", '', $title[1]) . "[/url]";
    }

}

$messagetext = preg_replace(
    '#(^|\[/(' . $skiptaglist . ')\])(.*(\[(' . $skiptaglist . ')|$))#siUe',
    "convert_url_to_bbcode_callback_auto_title('\\3', '\\1')",
    $messagetext
);


Jafo232 12-19-2007 06:42 PM

You are going to find that fsockopen can fall under the same security restrictions as fopen depending on the host.. Examples:

http://www.110mb.com/forum/external-...d-t3690.0.html

http://www.thescripts.com/forum/thread2690.html

http://www.webhostingtalk.com/archiv.../t-501791.html

http://forum.unlimitedmb.com/showthread.php?t=799

http://www.google.com/search?hl=en&c...ed&btnG=Search

So, yeah, I suppose your method COULD replace fopen, but the same reason why you would want to, could apply also to your solution.

HDT 12-19-2007 11:22 PM

After installed look like old thread that contains link do not retrieve the title,this need to rebuild thread and post cache?

Work on new parsed link only.

Please advise.

Jafo232 12-20-2007 01:11 AM

Works on new threads only.

HDT 12-20-2007 02:21 PM

Thanks Jafo for your confirmation.great work!

ymy 12-20-2007 06:51 PM

Quote:

Originally Posted by Phooey (Post 1396252)
Yet another vBSEO feature for free, thanks!

/installed

No, vBSEO feature work with external and internal URL
this hack only external URL :confused:

VADOS 12-20-2007 07:52 PM

*installed*
Thanx 4 the hack.

But could you tell me please how can I make links will be parsing without any external info, such as
Quote:

- Page 2 - My Board Name
I want to make links only with the name of the thread, but no more external info.

Jafo232 12-21-2007 01:08 AM

Quote:

Originally Posted by VADOS (Post 1405705)
*installed*
Thanx 4 the hack.

But could you tell me please how can I make links will be parsing without any external info, such as


I want to make links only with the name of the thread, but no more external info.

It only reads the pages title. So my advice would be to work on your page titles. :)

VADOS 12-21-2007 06:07 PM

So sorry... =(
*uninstalled*

KURTZ 12-25-2007 09:16 PM

runs perfectly on 3.7.0B3 :D

Jafo232 01-07-2008 10:16 AM

It should.. Only really uses one hook, and I don't think it will change until around version 4.0.

Bexter 01-12-2008 11:50 AM

Lovely mod, been looking for something like this for ages, but havent found something as perfect :D

It automatically converts URLs in the shoutbox as well.

Was wondering if there was a way for it to convert the urls in cyb chatbox too as i've just installed that on my test forum, and the admins are leaning more towards cyb chatbox than vbshout :O


Thanks :D

Jafo232 01-15-2008 11:31 AM

It all depends on how the plugin works. If it isn't converting URL's already, then it probably won't work with it.

Jase2 02-14-2008 01:11 PM

This work with vB 3.7 ??

Regards Jason :)

Jafo232 02-14-2008 01:24 PM

I have no idea and will not know until 3.7 is officially released. Right now, those using it in production environments are being a bit reckless..

Bexter 02-14-2008 07:09 PM

I installed this on my test forum, which is running 3.7 beta 3, and it works great.

I've not got 3.7 beta 4 on my main site (:O :S) and installed this on there and again works great :D

Baldilocks 03-14-2008 11:09 AM

Installed!! Nice mod!

Jafo232 03-18-2008 01:40 PM

Great, glad it worked out!

dieselpowered 03-23-2008 07:23 PM

Works perfect, thanks!

dieselpowered 03-23-2008 07:26 PM

Oh one question...is there a way to limit the number of characters that are displayed?


All times are GMT. The time now is 01:31 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.02065 seconds
  • Memory Usage 1,831KB
  • 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
  • (1)bbcode_html_printable
  • (6)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