Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Mick. on July 14, 2007, 12:18:47 PM

Title: Titled Links
Post by: Mick. on July 14, 2007, 12:18:47 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=835)

Titled Links


Created By: SlammedDime
Taken Over: JBlaze
Updated By: JBlaze
Taken Over: idesignSMF
Updated By: idesignSMF
Compatible: SMF 2.0



(https://www.idesignsmf.com/images/idesignadvert.png) (https://www.idesignsmf.com)

Introduction
Using this mod will give URLs posted in your topics an automatic title.  I saw this on another forum I visit and thought it to be pretty nifty, so I coded this up for SMF.

If a user posts a link outside of  bbcode tags, this mod will find them, look up the webpage, get the title, and replace the link with a bbcoded url with the webpages title... similar to below:

http://www.mysitehere.com (http://www.mysitehere.com)
  
will be transformed into

My Website Title (http://www.mysitehere.com)

If the page or title cannot be found, the URL in the post is not changed.

This change is made when the post is made or edited, it is not done on the fly, as that may cause lags in load time.

There are also options in the admin interface for Posts so you can turn this feature on or off, and also limit the number of URLs to convert.

convert_urls.php is a tool that can be used to convert all urls in existing messages to titled urls.  I have tested this on a message table with 12,000 messages and it worked as it should, but I cannot promise that it will always work.  Any errors should be reported to the topic for this mod.

Installation
1. Download from the SimpleMachines.org Mod Site (http://custom.simplemachines.org/mods/).
2. Upload to your forum using the built-in Package Manager.
3. Install using the built-in Package Manager.

Support
For best support, please visit http://www.jblaze.net/forum (http://www.jblaze.net/forum).

Changelog

1.5 Updated to SMF 2.0.17
1.2: Taken over by JBlaze, updated for RC3/1.1.11
1.1b: Same bug, typo...
1.1a: Bug with URLs that had regex characters in them.
1.1: No code changes, just updated installer for 1.1.3.
1.1: Added settings to 'Posts And Topics'.  Removed XSS vulnerability.
1.0: Initial Release
Title: Re: Titled Links
Post by: vosje505 on July 14, 2007, 01:46:53 PM
great mod :D

i love it.

only got 1 problem

you've set it to convert http://www.

but my site begins with http://forum

what do i exactly change to get it replace it when there's only http:// instead of http://www
Title: Re: Titled Links
Post by: SlammedDime on July 14, 2007, 02:25:47 PM
Hrm... I'll have to check the regular expression.  Thanks

Edit: It seemed to work fine for me on my test site.  I used the same regex that Simple Machines does when finding urls in a post to automatically link them.  I tested http://forum.myspace.com and it worked.  I also tested http://www.joomla.com and it worked.  Keep in mind, if you were to enter forum.myspace.com, it would not work, conversely if you entered www.joomla.com, it would work.
Title: Re: Titled Links
Post by: vosje505 on July 14, 2007, 02:31:36 PM
sorry my mistake.

its not that what caused my problem it are characters like ? and # and thos kinda characters

thanx for looking into it ;)
Title: Re: Titled Links
Post by: kamili34 on July 14, 2007, 09:08:08 PM
Thanks work wonderful  :P
Title: Re: Titled Links
Post by: SlammedDime on July 15, 2007, 05:27:49 AM
Glad to provide... :)
Title: Re: Titled Links
Post by: L.G.S on July 15, 2007, 02:16:31 PM
Great mod but:

It doesn't seem to work properly with links that don't end with an extension (like the forum topic links).

It works for my site, Google and all that, but if I use a topic url such as http://www.ruthlessintent.com/board/index.php?topic=5000 all I get in the post is the same link, but it is in between a [url*] and then a [/url%] tag. (Yes, the star is there to stop the bbcode taking over, but the percent sign is what is actually on my forum)

Here is an example

http://www.ruthlessintent.com/board/index.php?topic=47624.0
Title: Re: Titled Links
Post by: SlammedDime on July 15, 2007, 05:23:12 PM
Oops.  I'll upload a new version to use with that bug fixed.  Thanks!  Thats what I get for switching from str_replace to preg_replace.
Title: Re: Titled Links
Post by: vosje505 on July 15, 2007, 05:37:19 PM
hi Matt,

im trying your new version 1.1a but now im getting the following error :

Fatal error: Call to undefined function: preg_quot() in /storage/mijndomein/users/040205/public/sites/forum.jccarsystems.nl/Sources/Subs-Post.php on line 313

what can i do about it?

thx in advance
Title: Re: Titled Links
Post by: kamili34 on July 15, 2007, 08:34:55 PM
I got the same error as user above.  :'(
Title: Re: Titled Links
Post by: FUBAR on July 16, 2007, 03:06:07 AM
Quote from: vosje505 on July 15, 2007, 05:37:19 PM
hi Matt,

im trying your new version 1.1a but now im getting the following error :

Fatal error: Call to undefined function: preg_quot() in /storage/mijndomein/users/040205/public/sites/forum.jccarsystems.nl/Sources/Subs-Post.php on line 313

what can i do about it?

thx in advance

I am getting this same error when posting but only when a link is included in the post.
Title: Re: Titled Links
Post by: SlammedDime on July 16, 2007, 04:24:16 AM
forgot the e on quote... damn I shouldn't code right before work.  updated to 1.1b...
Title: Re: Titled Links
Post by: vosje505 on July 16, 2007, 04:45:26 AM
Quote from: Matt @ ARTcom on July 16, 2007, 04:24:16 AM
forgot the e on quote... damn I shouldn't code right before work.  updated to 1.1b...

works like a charm  :D :D ;D

thx Matt

only you forgot to upload 1.1b ;) ive changed it manually and it works perfect now.

keep up the great work
Title: Re: Titled Links
Post by: vosje505 on July 16, 2007, 05:01:39 AM
Quote from: vosje505 on July 16, 2007, 04:45:26 AM
Quote from: Matt @ ARTcom on July 16, 2007, 04:24:16 AM
forgot the e on quote... damn I shouldn't code right before work.  updated to 1.1b...
i was too early great mod Matt

works like a charm  :D :D ;D

thx Matt

only you forgot to upload 1.1b ;) ive changed it manually and it works perfect now.

keep up the great work

I was too early for upload

Great mod Matt (http://forum.jccarsystems.nl/Smileys/default/thumbsup.gif)

Thanks
Title: Re: Titled Links
Post by: SlammedDime on July 16, 2007, 05:13:25 AM
:)
Title: Re: Titled Links
Post by: L.G.S on July 16, 2007, 05:55:20 AM
Where has my post disapeared to??

I posted that when I updated It doesnt even let me reply let alone quote.
Title: Re: Titled Links
Post by: fangweile on July 16, 2007, 06:10:18 AM
It doesnt work for me.
Quote
I type http://mysitehere.com but it still displayed
http://mysitehere.com (http://mysitehere.com)

it is just converted the url to [*url=http://mysitehere.com]http://mysitehere.com[/url]
Title: Re: Titled Links
Post by: vosje505 on July 16, 2007, 06:19:43 AM
Quote from: fangweile on July 16, 2007, 06:10:18 AM
It doesnt work for me.
Quote
I type http://mysitehere.com but it still displayed
http://mysitehere.com (http://mysitehere.com)

have you tried an existing site??? like http://www.simplemachines.org

it is just converted the url to [*url=http://mysitehere.com]http://mysitehere.com[/url]


have you tried an existing site? somthing like http://www.simplemachines.org
Title: Re: Titled Links
Post by: fangweile on July 16, 2007, 06:26:36 AM
yeah, I have try it but still doesn't work.
Title: Re: Titled Links
Post by: kamili34 on July 16, 2007, 08:10:56 AM
In my forum mod works ok.  ;)
Title: Re: Titled Links
Post by: L.G.S on July 16, 2007, 08:43:16 AM
Your mod seems to be selective of something.

If I add my topic links into a post, some will work and some will give me the % url bbcode again.

If I edit this same post, then click save, it will change what links work and what don't, AGAIN.

My links are all the same in terms of the URL so what's the problem with this mod?
Title: Re: Titled Links
Post by: SlammedDime on July 16, 2007, 02:40:44 PM
Have you changed any of the settings for the mod?  Under Post and Topics in your settings.  The default number of links to change is 5, so if you have 10 links in your post, and click save, the first 5 will be changed.  If you edit the post and save it again, the second 5 will then be changed, and so on and so forth.
Title: Re: Titled Links
Post by: SlammedDime on July 16, 2007, 02:43:22 PM
Quote from: fangweile on July 16, 2007, 06:10:18 AM
It doesnt work for me.
Quote
I type http://mysitehere.com but it still displayed
http://mysitehere.com (http://mysitehere.com)

it is just converted the url to [*url=http://mysitehere.com]http://mysitehere.com[/url]

Using that specific example returns the proper result... visit mysitehere.com... see what the title is...
Title: Re: Titled Links
Post by: L.G.S on July 16, 2007, 06:01:27 PM
ok thanks it worked.

Title: Re: Titled Links
Post by: fangweile on July 17, 2007, 12:01:13 AM
I used simplemachines.org as my example but it only display this.

[url=http://www.simplemachines.org/]http://www.simplemachines.org/[/url]
Title: Re: Titled Links
Post by: L.G.S on July 17, 2007, 08:35:33 AM
Is there anyway to make all posted links change into titled links? Right now I have  a lot of links that I want to change but its not possible to go into every post and resave.
Title: Re: Titled Links
Post by: SlammedDime on July 17, 2007, 03:53:31 PM
Quote from: L.G.S on July 17, 2007, 08:35:33 AM
Is there anyway to make all posted links change into titled links? Right now I have  a lot of links that I want to change but its not possible to go into every post and resave.
Based on the stats on your board, you have over 120000 posts.... I would imagine that it would take a great deal of time for a script to run through every post and change any urls found inside of it.  I could write a script to do it, but I have no clue as to how long it would take or what server load would be incurred.  I would recommend that you test the script on a backup database/smf install first to be sure that it will work properly first.

fangweile - do you have a live version of this somewhere that I can test?  I tested 5 different variations of the sm.org url, and all but one work worked, and rightfully so.  The other thing I could suggest is to visit Sources/Subs-Post.php, find the added code from the mod, and you'll see a line that says $request = @file_get_contents($uri_modified);.  Remove the '@', try again, and then view your forum error log to see if there are any errors, and if so, report them back here.

Did you visit your admin panel under Posts and Topics and ensure that the mod is turned on?
Title: Re: Titled Links
Post by: L.G.S on July 17, 2007, 03:59:36 PM
Thanks, I'd like the script if you can :P
Title: Re: Titled Links
Post by: SlammedDime on July 17, 2007, 04:14:21 PM
Quote from: L.G.S on July 17, 2007, 03:59:36 PM
Thanks, I'd like the script if you can :P
No problem, I'll see if I can whip it up tomorrow.
Title: Re: Titled Links
Post by: SlammedDime on July 19, 2007, 09:11:01 PM
I haven't forgotten about you.  I'm looking at a few different scripts to modify to accomplish what is needed without crashing the server due to load and also ensure that things are setup properly before the script is run.  Main reason: might not be a bad idea to include it for those that wish to do the same. :)
Title: Re: Titled Links
Post by: L.G.S on July 20, 2007, 04:42:48 AM
Thanks. Can it also have a break of 30 seconds between each part? My host is picky with that kind of thing
Title: Re: Titled Links
Post by: SlammedDime on July 20, 2007, 05:38:16 AM
Quote from: L.G.S on July 20, 2007, 04:42:48 AM
Thanks. Can it also have a break of 30 seconds between each part? My host is picky with that kind of thing
It can be done, but I think the way I am coding it, 30 seconds won't be needed.  I'm going to generate upwards of 500,000 messages into my test database to test this on.
Title: Re: Titled Links
Post by: SlammedDime on July 20, 2007, 06:11:47 PM
Ok, I've finished the tool.  Let me know how it goes.  I've attached it to the mods download page.

A brief overview of what it does:
It works 500 messages at a time, pulling them from the database, running through them one at a time, discarding the ones that don't have urls, and converting the urls in the ones that do.  It then updates any messages changed in the database.  It then pauses for 5 seconds, where you can see the status of the script, then continues.  I've monitored my system while this was running on a 12000 row message table and the cpu usage was nill.  The main factor in time is the response from the websites the script is getting the urls from.  I've used the same time limit of 3 seconds for retreiving the title that I did in the mod itself.  If it doesn't happen within 3 seconds, the url is skipped.

After the tool is done, it will print some stats.  I'm very curious in them and would appreciate you posting them.  I can't give a good time estimate on how long it will take to convert the urls, but I will say that with over 120000 posts, it will take a minimum of an hour.  I figure around 5% of the messages will have urls, so thats at least 6000 urls, and at an average of around 1 second an url, you're looking to have at least 1.5 hours for the conversion.  The script does require that your board is in maintenance mode, so no one will be able to access your board while you're doing this.
Title: Re: Titled Links
Post by: L.G.S on July 20, 2007, 07:08:45 PM
Seeing as you say it may take an hour, I'll wait until tomorrow, do the script then post the result ;)
Title: Re: Titled Links
Post by: SlammedDime on July 20, 2007, 07:42:08 PM
If you have a backup of your database, I would strongly suggest that you test this on a backup.  If you dont have one, I would STRONGLY suggest you create one before doing this.  This script worked just fine locally, but I have no idea how it will work in the real world.
Title: Re: Titled Links
Post by: Mr.CoWbOy on July 20, 2007, 09:38:59 PM
HeLLo..

its very nice thnx for it..

but ; it didnt work on my forum..

i tried a few links and didnt change anythng.. and i uninstall again..

i ll wait new version (:
Title: Re: Titled Links
Post by: SlammedDime on July 21, 2007, 01:58:56 AM
It works just fine.  Did you make sure that it was enabled in your forum Admin under Post settings?
Title: Re: Titled Links
Post by: SlammedDime on July 31, 2007, 03:21:11 AM
L.G.S - Did you ever get around to running the converter?
Title: Re: Titled Links
Post by: L.G.S on July 31, 2007, 04:42:53 AM
Uploading my database now, I'll post when its done ;)
Title: Re: Titled Links
Post by: karlbenson on August 10, 2007, 08:48:45 AM
line 35 of install.xml typo
$timeout = ini_get('default_socket_tiemout');
Title: Re: Titled Links
Post by: SlammedDime on August 10, 2007, 10:01:58 AM
Thank you sir. :)
Title: Re: Titled Links
Post by: karlbenson on August 10, 2007, 10:06:23 AM
Matt does this mod do Internal links aswell?

It would be very SEO friendly to have it dig out the title to any untitled urls posted in posts.
(and save time aswell - for example on here)

I was actually planning on making this mod. Its been on my to-do list for a while. But I just came across your mod.
Title: Re: Titled Links
Post by: SlammedDime on August 10, 2007, 12:31:13 PM
By internal, do you mean, if I post

http://www.simplemachines.org/community/index.php?topic=182573.40

Will it change to

[url=http://www.simplemachines.org/community/index.php?topic=182573.40]Titled Links[/url]

Then the answer is yes.
Title: Re: Titled Links
Post by: karlbenson on August 10, 2007, 01:39:45 PM
cool!.
Title: Re: Titled Links
Post by: L.G.S on August 10, 2007, 03:24:36 PM
Woah forgot about this. Will try the script very soon.
Title: Re: Titled Links
Post by: karlbenson on August 10, 2007, 03:42:54 PM
maybe for internal links it would be better to query the database than use file_get_contents.
It would be mean less queries.  Although you'd have to make sure the topic being read is in a non-private forum.
Title: Re: Titled Links
Post by: SlammedDime on August 10, 2007, 03:53:41 PM
Quote from: karlbenson on August 10, 2007, 03:42:54 PM
maybe for internal links it would be better to query the database than use file_get_contents.
It would be mean less queries.  Although you'd have to make sure the topic being read is in a non-private forum.
Not a bad thought at all.  I'll implement that in the next version.
Title: Re: Titled Links
Post by: Mskina on August 14, 2007, 09:28:07 AM
Quote from: Matt @ ARTcom on August 10, 2007, 12:31:13 PM
if I post

http://www.simplemachines.org/community/index.php?topic=182573.40

Will it change to

[url=http://www.simplemachines.org/community/index.php?topic=182573.40]Titled Links[/url]

Then the answer is yes.
Hi!

If i post a internal link, it renames into "Ingresar" (Login in spanish)

Only works on no-ocults forums?
Title: Re: Titled Links
Post by: Fustrate on August 14, 2007, 12:17:57 PM
Well, the tool told me to...

QuoteStats:
  5627 messages
  47 had URLs to convert
  61 URLs were converted
  Overall, the script took 267.245465517 seconds to execute.
  About 5.68607373441 seconds per message
  About 4.3810732052 seconds per url

not many urls :P surprising, given the type of forum it is... but whatever :)
Title: Re: Titled Links
Post by: karlbenson on August 14, 2007, 12:59:46 PM
@Mskina
If a guest can't see the topic, then this script won't be able to get the topic title.
(because currently it gets/sources the internal links externally)
Title: Re: Titled Links
Post by: Chriss Cohn on August 17, 2007, 04:27:23 PM
Great Mod Matt!
Before i install, do i understand it right, that if i put the title in for myself then the mod doest look-up the title?

What is the thing with the guests? They can acces not all my boards, so is this a problem?

Regards, Christian
Title: Re: Titled Links
Post by: karlbenson on August 17, 2007, 04:37:19 PM
In boards where your guests cannot access, any use of this mod will end up with links titled along the lines of asking you to login. (i believe)
(evne if you are already logged in)
Title: Re: Titled Links
Post by: SlammedDime on August 17, 2007, 05:05:02 PM
What karlbenson said is correct.  When I do the new version with local lookups, I'll code it so that the url isn't changed if guests don't have access to the board that the topic is in.
Title: Re: Titled Links
Post by: Chriss Cohn on August 17, 2007, 05:07:31 PM
Thx, just tried the mod and i think there is still alot room to improve it...
I know a similar "mod" from vbulletin and there are 2 features more, which i think they must strongly includet here also:

1. Even if you use to put a URL into a BB-Code Tag [*URL] or with this button -> (http://www.simplemachines.org/community/Themes/smsite/images/bbc/url.gif) , it should lookup the URL if you dont put a title for it in.

So if i write this for example: [*URL]http://www.simplemachines.org[/URL] It should find the Title a use it for it...
But if i put in this for example:[*URL=http://www.simplemachines.org]Simplemachines is cool![/URL] it should to use the title which the user put in (in this case "Simplemachines is cool).

2. It must be capable of finding non-www URLS and Internal URL + it should work when using in a area where guests can not access...


So Matt, if you put this in, then you are "the true god of SMF-URLS". No, this would be great if you could put these 2 point in....


Regards, Christian
Title: Re: Titled Links
Post by: karlbenson on August 17, 2007, 05:14:49 PM
Quote from: SlammedDime on August 17, 2007, 05:05:02 PM
What karlbenson said is correct.  When I do the new version with local lookups, I'll code it so that the url isn't changed if guests don't have access to the board that the topic is in.

OMG.  I was like who the **** are you.  Then realised you have changed your name Matt. :D :D :D
Title: Re: Titled Links
Post by: SlammedDime on August 17, 2007, 05:36:40 PM
Quote from: g-c on August 17, 2007, 05:07:31 PM
Thx, just tried the mod and i think there is still alot room to improve it...
I know a similar "mod" from vbulletin and there are 2 features more, which i think they must strongly includet here also:

1. Even if you use to put a URL into a BB-Code Tag [*URL] or with this button -> (http://www.simplemachines.org/community/Themes/smsite/images/bbc/url.gif) , it should lookup the URL if you dont put a title for it in.

So if i write this for example: [*URL]http://www.simplemachines.org[/URL] It should find the Title a use it for it...
But if i put in this for example:[*URL=http://www.simplemachines.org]Simplemachines is cool![/URL] it should to use the title which the user put in (in this case "Simplemachines is cool).

2. It must be capable of finding non-www URLS and Internal URL + it should work when using in a area where guests can not access...


So Matt, if you put this in, then you are "the true god of SMF-URLS". No, this would be great if you could put these 2 point in....


Regards, Christian

On point 1 - I'll code this in and create an additional option for it.

On point 2 - it will get non www preceded urls so long as there is http://.  Its quite difficult to determine urls otherwise.    As for guests / titles... I don't think this would be a good feature.  Lets say you have a topic titled 'LittleJohnny is a pain the ass' in a team board, and a team member posts a link to that topic on a public board, and then LittleJohnny happens to see that post on the public board with a link to a topic about him that he can't access.  Seems wrong imo, and its not something I want to have users of this mod complaining about in the future.
Title: Re: Titled Links
Post by: Chriss Cohn on August 17, 2007, 05:52:49 PM
QuoteOn point 1 - I'll code this in and create an additional option for it.
Great! Nothing more to say then just: Great work!
Thanks!

QuoteOn point 2 - it will get non www preceded urls so long as there is http://.  Its quite difficult to determine urls otherwise.
If this will be in in Next version - great! I just tried it with some links and it had not worked(1.1c)....

QuoteAs for guests / titles... I don't think this would be a good feature. Lets say you have a topic titled 'LittleJohnny is a pain the ass' in ateam board, and a team member posts a link to that topic on a publicboard, and then LittleJohnny happens to see that post on the publicboard with a link to a topic about him that he can't access.  Seemswrong imo, and its not something I want to have users of this modcomplaining about in the future.

I think we talking away from each other, i explained it in a confusing way or you didn't understand it, but related to this quote:
Im using SEF-Urls, so if i or somebody would link withing a public-board into a team-board (who the hell do something stupid - all my mods are not allowed to do so), they would still see the topic-name because of the SEF-URLS.

But my entire Request on the second part of Point 2 was:
This mod should also work(lookup titles) if im posting inside an non-public team-board a URL to any Adress in the Internet. Currently it wont work in non-public areas...
But that is also not bad to solve it:
QuoteI'll code it so that the url isn't changed if guests don't have access to the board that the topic is in.


Regards, Christian
Title: Re: Titled Links
Post by: SlammedDime on August 18, 2007, 03:48:30 AM
Quote from: g-c on August 17, 2007, 05:52:49 PM
This mod should also work(lookup titles) if im posting inside an non-public team-board a URL to any Adress in the Internet. Currently it wont work in non-public areas...
But that is also not bad to solve it:
QuoteI'll code it so that the url isn't changed if guests don't have access to the board that the topic is in.


Regards, Christian

It should do this without a problem already.
Title: Re: Titled Links
Post by: L.G.S on August 18, 2007, 11:01:37 AM
Don't know what ya php script did but it got to 6% (took 20 mins) then it timed out on me. Why would it do that? Didn't convert any URLs from what I can see either.
Title: Re: Titled Links
Post by: SlammedDime on August 18, 2007, 11:18:50 AM
Did it say maximum execution time exceeded?
Title: Re: Titled Links
Post by: sodmanccc on August 24, 2007, 01:36:29 AM
really nice takes the title of the url to make it a text link
very nice!
Title: Re: Titled Links
Post by: L.G.S on August 24, 2007, 04:29:59 AM
Quote from: SlammedDime on August 18, 2007, 11:18:50 AM
Did it say maximum execution time exceeded?

It didn't say anything, just spat out a php file.
Title: Re: Titled Links
Post by: Shaman666 on September 01, 2007, 10:05:07 AM
I have same problem convering with php... Any help?
Title: Re: Titled Links
Post by: SlammedDime on September 01, 2007, 01:17:17 PM
All I can think of is to reduce the number of messages it does at once.  In the file you'll find a line

      LIMIT ' . $start . ', 500'); around line 150.

Change 500 to 250 and see if that helps.
Title: Re: Titled Links
Post by: kamili34 on September 02, 2007, 01:07:55 PM
1.     Wykonaj modyfikację     ./Sources/Subs-Post.php     Not success
Title: Re: Titled Links
Post by: SlammedDime on September 02, 2007, 01:28:33 PM
You'll have to open Subs-Post.php and manually modify the file then.  Looks like some other mod got to it first.
Title: Re: Titled Links
Post by: L.G.S on September 02, 2007, 03:16:54 PM
Quote from: SlammedDime on September 01, 2007, 01:17:17 PM
All I can think of is to reduce the number of messages it does at once.  In the file you'll find a line

      LIMIT ' . $start . ', 500'); around line 150.

Change 500 to 250 and see if that helps.

Did that, got to like 4% and it just stopped. No feedback whatso ever and all was left was the SMF logo bar at the top.
Title: Re: Titled Links
Post by: kamili34 on September 02, 2007, 04:29:12 PM
Ok thanks  :)
Title: Re: Titled Links
Post by: GrnEyedDvl on September 09, 2007, 03:03:26 PM
If someone uses the {url} tags it doesnt display properly, but it works great if they just paste the link in their thread.

Example, if they click the Insert Hyperlink button and put this:
[url]http://www.twmodsquad.com/index.php[/url]

Then it displays normal, but if you click the Modify button the new code shows up as this:

[url=http://www.twmodsquad.com/index.php]http://www.twmodsquad.com/index.php[/url]

Maybe you could change the mod so that clicking the Insert Hyperlink button brings up a code like this:
[url=Website Here]Title Here[/url]

That way posts from people who click the Insert Hyperlink button look the same as all the rest
Title: Re: Titled Links
Post by: davs on September 16, 2007, 01:36:24 PM
hi all,
i have just install titled_links_1.1c, and start convert_urls.php, but it's not working (www.mojstudent.net/smf ), do i must to turn ON somewhere this feauture?

Thx in advice.
p.s. sorry for my english

davs
www.mojstudent.net
Title: Re: Titled Links
Post by: karlbenson on September 16, 2007, 02:12:30 PM
would also be good if this mod supported [iurl][/iurl] tags aswell.
Title: Re: Titled Links
Post by: davs on September 16, 2007, 02:19:16 PM
that means that i must turn off the tags??
Title: Re: Titled Links
Post by: karlbenson on September 16, 2007, 02:22:04 PM
lol sorry, davs, some part of my post was bbcode and was converted.  Mine was just a general point unrelated to your posts.
Title: Re: Titled Links
Post by: Chriss Cohn on September 20, 2007, 04:33:49 PM
Any updates Matt?
Is there some sort of "deadline" when the new version with the promised features comes out?
Regards, Christian
Title: Re: Titled Links
Post by: SlammedDime on September 20, 2007, 07:02:57 PM
No updates.  School outweighs my mods here at SMF at this point.  I can't give any ETAs.
Title: Re: Titled Links
Post by: karlbenson on September 20, 2007, 07:43:33 PM
Good good. Nice to see someone ensuring School work comes first.
Title: Re: Titled Links
Post by: Boxxer on November 07, 2007, 07:13:17 PM
First, i love this Mod :)
Second, sry 4 my bad english ;)
Is it possible that the Mod converts the HTML imagetag into bb?
I have the RSS FeedPoster installed an this Mod posted some html-imagecode like this:
<img src="http://static3.gigagfx.de/images/cache/9f/ee3b179f780a688d6ff5c7487b3a5c.jpg" width="120" height="90" style="float: left; padding-right:3px; padding-bottom:3px;" alt="" title="" />

And my next question:
I run the convert_urls.php and it works fine, but there is one problem whit the german "Specialletters" like ÄÖÜß and so on.
After running the convert_urls.php i have some trash in my database: öl
Please have a look at thishttp://forum.gamescreens.de/gigagames_und_esports_news/feedsoldner_2_wer_traut_sich_die_entwicklung_zu-t398.0.html;msg400;topicseen#msg400 (http://forum.gamescreens.de/gigagames_und_esports_news/feedsoldner_2_wer_traut_sich_die_entwicklung_zu-t398.0.html;msg400;topicseen#msg400)
Whats wrong there?

I realy hope you understand what i want to say :-[

greetz Boxxer
Title: Re: Titled Links
Post by: Chriss Cohn on December 22, 2007, 03:19:21 PM
Hmm no updates so far..... looking forward to it....
Title: Re: Titled Links
Post by: Chriss Cohn on May 17, 2008, 04:56:29 PM
Quote from: Chriss Cohn on December 22, 2007, 03:19:21 PM
Hmm no updates so far..... looking forward to it....
Is this mod dead? It was one of my most anticipated ones.....

Regards, Christian
Title: Re: Titled Links
Post by: SlammedDime on May 18, 2008, 05:14:12 PM
Nope, not dead.  I've just graduated from college and returned from my honeymoon, so I plan on updating all of my mods for 2.0, as well as adding a few features to ones that have been requested.
Title: Re: Titled Links
Post by: Chriss Cohn on May 18, 2008, 05:37:30 PM
Quote from: SlammedDime on May 18, 2008, 05:14:12 PM
Nope, not dead.  I've just graduated from college and returned from my honeymoon, so I plan on updating all of my mods for 2.0, as well as adding a few features to ones that have been requested.
Thats great to hear! Congrats!
Best Regards, Christian
Title: Re: Titled Links
Post by: LadyC on May 30, 2008, 01:27:32 PM
congrats on the new marital bliss.

i've installed this, but on 1.1.5. it says it installed correctly, and it is enabled in the admin panel, but it doesn't convert anything. is this because of the version software i'm running?

i have not installed the convert url file though... call me stupid, but i'm not sure what directory to install it in. i'm not sure if it would serve any point though, if the mod isn't working in the first place.

i just can't figure what i'm doing wrong.
Title: Re: Titled Links
Post by: SlammedDime on May 30, 2008, 03:58:11 PM
Are there any errors in your error log?
Title: Re: Titled Links
Post by: LadyC on May 30, 2008, 06:09:15 PM
oh my gosh, i'm looking now. i've got several hundred pages of forum errors, and the forum is only like three days old. what the heck is UP with this? i'll have to weed through tons of pages to find any specific to this mod!
Title: Re: Titled Links
Post by: Alan S on June 23, 2008, 11:54:58 AM
The convert_urls script freezes for me on step 2 , With the url

convert_urls.php?step=2&line=10500&rows=93122

All i get is the header saying Convert Urls tool and nothing else. The script gets up to about 9% and then that happens?
Title: Re: Titled Links
Post by: Boxer2 on July 01, 2008, 04:12:14 PM
Im on version 1.1.5 and i have problem with this mod since i upgrade forum, all links that alre leading to links on my forum are having error title "403 Forbidden"


Does anyone knows what is the problem???
Title: Re: Titled Links
Post by: SlammedDime on July 02, 2008, 03:45:27 AM
Link to your site?
Title: Re: Titled Links
Post by: Boxer2 on July 02, 2008, 07:25:29 AM
http://alfisti.hr/forum
Title: Re: Titled Links
Post by: kizer on October 09, 2008, 12:56:35 PM
Im not sure why, but when I preview the post it displays like it should, but when I actually post it doesn't work. I think I noticed the problem when I added karls video mod.

http://www.simplemachines.org/community/index.php?topic=200401.0
Title: Re: Titled Links
Post by: insanehsp on October 28, 2008, 07:08:12 AM
Will there be a version of this mod for SMF 2.0 ?
Title: Re: Titled Links
Post by: SlammedDime on October 28, 2008, 11:29:32 AM
yes, once 2.0 is in RC release, i will be updating it with some suggestions provided here as well
Title: Re: Titled Links
Post by: Shadow1243 on November 16, 2008, 03:10:57 PM
 Don't working smf 1.1.7

+

where i must upload "convert_urls.php" ??? forum main index ???
Title: Re: Titled Links
Post by: master2oo8 on November 23, 2008, 05:06:58 PM
Quote from: SlammedDime on October 28, 2008, 11:29:32 AM
yes, once 2.0 is in RC release, i will be updating it with some suggestions provided here as well
Do you can make now a SMF  2.0 Beta 4 Version? :)
Would be very cool.

Quote from: Shadow1243 on November 16, 2008, 03:10:57 PM
Don't working smf 1.1.7

+

where i must upload "convert_urls.php" ??? forum main index ???
You can upload it where you want ;)
Title: Re: Titled Links
Post by: Boby_ on November 27, 2008, 09:21:16 AM
Quote from: kizer on October 09, 2008, 12:56:35 PM
Im not sure why, but when I preview the post it displays like it should, but when I actually post it doesn't work.

The same for me - I see the Title instead of URL in Preview but when I actualy post there is only the link, not the Title.
Title: Re: Titled Links
Post by: lunzet on January 06, 2009, 06:07:26 AM
I would love to see an working update to this mod for SMF 1.1.7.

I also would like to ask if its possible to just get a fixed String as Title for every Link

e.g.
now --> My Website Title (http://www.mysitehere.com)
future --> LINK (http://www.mysitehere.com)
future --> LINK (http://www.yahoo.com)

Maybe configurable?

Thanks
Title: Re: Titled Links
Post by: CraigW on January 07, 2009, 11:08:23 AM
Can I request that this mod does not change links within code tags.
Its annoying if I want to post examples of HTML for example.

eg if I type in this:

<a href="http://www.google.co.uk">example</a>


its changed to this

<a href="[url=http://www.google.co.uk]Google[/url]">example</a>


Or maybe some way of disabling it for individual posts? Like a checkbox on "Additional Options"?
Title: Re: Titled Links
Post by: SlammedDime on January 07, 2009, 12:33:20 PM
Thanks for the info CraigW... I hadn't thought of that.  I'll implement that in the next version as well.
Title: Re: Titled Links
Post by: aw06 on January 10, 2009, 03:51:57 PM
How do i uninstall this mod ...

im getting this error
Error in Package Installation
At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF.


Execute Modification  ./Themes/default/languages/Modifications.english.php  Test failed
Title: Re: Titled Links
Post by: SlammedDime on January 10, 2009, 05:35:25 PM
uninstall, then go into the Modifications.english.php and remove any of the language strings from the mod.

Or you can uninstall and just ignore the error.
Title: Re: Titled Links
Post by: aw06 on January 10, 2009, 05:36:37 PM
Quote from: SlammedDime on January 10, 2009, 05:35:25 PM
uninstall, then go into the Modifications.english.php and remove any of the language strings from the mod.

Or you can uninstall and just ignore the error.

how do i find all the strings related to the mod ?
Title: Re: Titled Links
Post by: SlammedDime on January 10, 2009, 05:44:30 PM
There's only a few.  If you go to the mod's download page, and select your version of SMF from the small drop down in the upper right corner, then click submit, you can see the manual install/uninstall procedures, just look for for the modifcations to Modifications.english.php and there will be the strings.
Title: Re: Titled Links
Post by: aw06 on January 10, 2009, 06:03:53 PM
Kool ...

I have this mod working on one forum .. but its just not working on another ...

when url is inserted it does the change in the preview ... but once you post it doenst do anything ...

im wondering if its conflicting with auto embed youtube mod
Title: Re: Titled Links
Post by: SlammedDime on January 10, 2009, 06:40:20 PM
it very well may be... I haven't had a chance to experiment with the two together yet.
Title: Re: Titled Links
Post by: darklord2 on January 25, 2009, 03:16:29 PM
Sounds great, but where can i switch it On/Off? (i'm not using default theme)
Title: Re: Titled Links
Post by: darklord2 on January 25, 2009, 03:39:32 PM
I found the answer, don't know why! but I noticed that after installation when i checked destination files, there is absolutely no change!!! even a single char, nether added nor deleted!!!

other packages can be installed!
Title: Re: Titled Links
Post by: Zagdul on January 30, 2009, 12:09:05 PM
Quote from: CraigW on January 07, 2009, 11:08:23 AM
Can I request that this mod does not change links within code tags.
Its annoying if I want to post examples of HTML for example.

eg if I type in this:

<a href="http://www.google.co.uk">example</a>


its changed to this

<a href="[url=http://www.google.co.uk]Google[/url]">example</a>


Or maybe some way of disabling it for individual posts? Like a checkbox on "Additional Options"?
Hello Craig,

You can force SMF to not parse links in [ code ] tags. I've done this on my site to avoid this because this isn't the only url mod I have installed.

@SlammedDime
I am wondering if there is a way to code in some exclusions for websites titles.

Some background...
I run a WoW Guild site and I'm trying to get the itemstats code to work so that when you post a link to an item in world of warcraft, it searches an outside website (www.wowhead.com) for the item color (in WoW items in the game have different colors associated with them based on how good they are) and it provides a nice hover over link.

If I were able to get your Titled Links to do this in one step, it would help my progress a lot.

Currently if I paste a url from wowhead with titled links, it gets me the whole title. If I Were able to exclude some of the page title, I would be able to kill two birds with one stone.

An example:

With your mod (works awesome by the way  :-[ )

http://www.wowhead.com/?spell=12472 =

Icy Veins - Spell - World of Warcraft (http://www.wowhead.com/?spell=12472)

Which is exactly what it's supposed to do and is working as intended.

What I'd like it to display:

Icy Veins (http://www.wowhead.com/?spell=12472)

[url=http://www.wowhead.com/?spell=12472]Icy Veins[/url]

I've posted the code here because the pre-post result is vital for the second step to work properly.

Here (the second step):
http://www.wowhead.com/?forums&topic=3464#p37618

Unless I can get either your mod to remove the rest of the title or have some kind of exclusion in custom BBCode to ignore the {content} containing the rest of the page title.

If you have any help you'd like to give to assist me, I'd be much appricated.

On another note, yes, I've tried the mod Itemstats, the problem is that it doesn't work with spells. If I want to get the WoWhead options to work, I need to change the item color manually.

My thread with notes:
testing [wowitem] (http://virtual-progression.com/forum/index.php?topic=666)
Title: Re: Titled Links
Post by: ElectroPheonix on March 15, 2009, 06:50:38 AM
Hi,

I have the same problem some of the people previously had. So far I can't find a solution on this site...

The installation went well. I haven't run the convert php yet but was testing how the links would work...

So far, it works when previewed, but when the post is saved, the complete url is displayed. I would like to know why it's working on first preview and doesn't work for when saved. And of course how to fix it...

Any help would be appreciated by tons!
Title: Re: Titled Links
Post by: Polilla on April 08, 2009, 08:18:33 PM
Por favor puede mirar este enlace:

Please see this link can:

http://www.simplemachines.org/community/index.php?topic=303177.0

Problema:

Trouble:

Instalado mod. funciona en PREVISUALIZACION, NO funciona en PUBLICACION

Mod installed. works in preview, works RELEASE NO

Gracias, por favor espero su ayuda.

   Thanks for your help I hope.


SlammedDime Por favor ayuda, me interesa mucho este mod.

Enhorabuena por el mod.

Please help, I am very interested in this mod. Congratulations on the

mod.

Ya que no responde privados, agradeceria su ayuda como autor de este

mod.

Saludos.

Private and that does not respond, we would appreciate your help as the

author of this mod.

Greetings.
Title: Re: Titled Links
Post by: SlammedDime on April 09, 2009, 01:09:07 PM
Something must have changed in the SMF code in one of the security fixes to have caused this issue.  I originally did this mod because I thought it might be an interesting feature on some boards, however I think I am going to discontinue developing on it.  If anyone wishes to take over the mod, please contact me.
Title: Re: Titled Links
Post by: Polilla on April 10, 2009, 07:49:14 AM
Quote from: SlammedDime on April 09, 2009, 01:09:07 PM
Something must have changed in the SMF code in one of the security fixes to have caused this issue.  I originally did this mod because I thought it might be an interesting feature on some boards, however I think I am going to discontinue developing on it.  If anyone wishes to take over the mod, please contact me.

Gracias por responder, pero alguien puede decirme porque NO funciona cuando se publica el post.

Thanks for responding, but can someone tell me because it will not work when you publish the post.
Title: Re: Titled Links
Post by: Polilla on April 10, 2009, 07:36:10 PM
Solucionado gracias a FRANK RIO LYNN de la web www.sharedownload.org, una pagina legal donde me han brindado todo el apoyo y la solucion a mi problema, que no era otra que para que el mod. funcione sin problemas por lo menos en mi caso era comprobar que en:

Códigos BBC tengamos DEStildada la opcion de:

"Crear automáticamente los enlaces cuando se escriben URLs"

Como digo funcionando al 100%, agradezco nuevamente la ayuda prestada por vicram10 y FRANK RIO LYNN
Title: Re: Titled Links
Post by: ElectroPheonix on May 21, 2009, 08:51:07 PM
Quote from: SlammedDime on April 09, 2009, 01:09:07 PM
Something must have changed in the SMF code in one of the security fixes to have caused this issue.  I originally did this mod because I thought it might be an interesting feature on some boards, however I think I am going to discontinue developing on it.  If anyone wishes to take over the mod, please contact me.

That's a shame. I can tell you it is a very useful mod. It prevents URLs being posted everywhere and that seems to prevent some crawlers from grabbing links off page but mostly I like it because it makes things nice and neat... but thanks for the work so far. I can it for the news and PMs so far but not on the main board...
Title: Re: Titled Links
Post by: probinson77 on June 16, 2009, 04:17:09 PM
I've updated this mod to work with 2.0RC1-1.  All I did was format everything correctly for SMF2.  I didn't make any changes to the functionality of the code at all (mainly because I wouldn't even know where to start), but it seems to work quite well as originally designed.  I even packaged it up to the best of my limited knowledge, and with the permission of the original mod author, I will post that package here.

It works great...  EXCEPT it has a conflict with aeva 6.9.99.  That is probably why the users above are seeing that in the preview it looks OK, but when you actually go to post, it posts the full link instead of the link title. If aeva is installed, the links do not get titled.  Uninstall aeva, and it works great.  I think it has something to do with the parse_bbc2 function in the aeva code, but I am woefully ignorant of exactly how either of these mods actually work.   :P

Would anyone be willing or able to help me figure out the conflict is?
Title: Re: Titled Links
Post by: Özgür on February 13, 2010, 01:48:53 PM
Is there any package for 2.0 here?
Title: Re: Titled Links
Post by: aw06 on March 23, 2010, 01:58:28 AM
Will this be updated to work on 2.0 Rc3 ?
Title: Re: Titled Links
Post by: aw06 on April 07, 2010, 01:00:43 PM
Bump
Title: Re: Titled Links
Post by: ~DS~ on May 03, 2010, 07:29:46 AM
Thank you JBlaze for taking over and keep the mod alive.
Time for me to ditch Show Local Url Titles mod.
Title: Re: Titled Links
Post by: JBlaze on May 03, 2010, 07:45:38 AM
This mod has been updated for 1.1.11 and 2.0 RC3
Title: Re: Titled Links
Post by: ~DS~ on May 03, 2010, 07:59:33 AM
You like bugs dont you JBlaze?  :P
In my localhost with no mods installed expect this works great with no issues.

On my live site is a bit weird, because it doesn't show the title in post, before posting I see the preview showing it just fine but not on post.
Title: Re: Titled Links
Post by: ~DS~ on May 03, 2010, 08:20:00 AM
Look like a conflit with Aeva which is the only first mod that comes to mind and I installed them on localhost as will which cause the url not to show the title.
Title: Re: Titled Links
Post by: JBlaze on May 03, 2010, 08:21:40 AM
Don't know why it works in the preview and not in the post...

But I do know that the URL's need to have the trailing slash :P

In other words, http://www.facebook.com/ instead of http://www.facebook.com

Edit: Yea, a few posts up there's mention of a conflict with Aeva.
Title: Re: Titled Links
Post by: !RFAN on May 03, 2010, 08:22:49 AM
will it have any conflicting issue with AEVA ??
Title: Re: Titled Links
Post by: JBlaze on May 03, 2010, 08:23:59 AM
Quote from: amigozone on May 03, 2010, 08:22:49 AM
will it have any conflicting issue with AEVA ??
Unfortunately yes. Since both mods deal with preparsing URL's, they will conflict. I won't have a workaround for a bit until I figure out how to get around it.
Title: Re: Titled Links
Post by: ~DS~ on May 03, 2010, 08:29:56 AM
Quote from: amigozone on May 03, 2010, 08:22:49 AM
will it have any conflicting issue with AEVA ??
http://www.simplemachines.org/community/index.php?topic=182573.msg2113118#msg2113118
Title: Re: Titled Links
Post by: luismanson on May 03, 2010, 01:04:13 PM
sorry if i already asked, but is there any chance to support prettyURLs ??? PLEASE! :)
Title: Re: Titled Links
Post by: ~DS~ on May 03, 2010, 01:47:20 PM
Quote from: luismanson on May 03, 2010, 01:04:13 PM
sorry if i already asked, but is there any chance to support prettyURLs ??? PLEASE! :)
How do you mean? I tested with SimpleSEF on localhost, seem to work fine without issues. So I think it might support prettyURLs as well. Expect for AeMe of course.
Title: Re: Titled Links
Post by: aw06 on May 03, 2010, 02:22:13 PM
Thanks for the update, installed and working fine on Rc3
Title: Re: Titled Links
Post by: luismanson on May 03, 2010, 02:33:19 PM
just tested, it wont work with prettyURLs :(
Title: Re: Titled Links
Post by: ~DS~ on May 03, 2010, 02:44:46 PM
Quote from: luismanson on May 03, 2010, 02:33:19 PM
just tested, it wont work with prettyURLs :(
I just tested with prettyURLs, it works fine. Do you have Aeva installed? What SMF version?
Title: Re: Titled Links
Post by: luismanson on May 03, 2010, 04:59:54 PM
Quote from: Dismal Shadow on May 03, 2010, 02:44:46 PM
Quote from: luismanson on May 03, 2010, 02:33:19 PM
just tested, it wont work with prettyURLs :(
I just tested with prettyURLs, it works fine. Do you have Aeva installed? What SMF version?

RC3, i dont have aeva... i will take a look again
Title: Re: Titled Links
Post by: ~DS~ on May 03, 2010, 05:02:43 PM
Quote from: luismanson on May 03, 2010, 04:59:54 PM
Quote from: Dismal Shadow on May 03, 2010, 02:44:46 PM
Quote from: luismanson on May 03, 2010, 02:33:19 PM
just tested, it wont work with prettyURLs :(
I just tested with prettyURLs, it works fine. Do you have Aeva installed? What SMF version?

RC3, i dont have aeva... i will take a look again
Did you try this:
Posts and Topics » Post Settings> Convert links to titled URL's checked?
Title: Re: Titled Links
Post by: luismanson on May 03, 2010, 05:26:28 PM
Is working!!!! :D
i had the other mod installed + this one was not enabled, sorry
Title: Re: Titled Links
Post by: luismanson on May 03, 2010, 05:30:51 PM
Spanish latin:

$txt['convert_urls'] = 'Convertir enlaces a titulos';
$txt['title_url_count'] = 'maximas URLs para colocar titular';
$txt['title_url_count_zero'] = '0 para no limite';
$txt['title_url_count_urls'] = 'URL';
[code]
Title: Re: Titled Links
Post by: !RFAN on May 03, 2010, 11:01:27 PM
Quote from: Dismal Shadow on May 03, 2010, 08:29:56 AM
Quote from: amigozone on May 03, 2010, 08:22:49 AM
will it have any conflicting issue with AEVA ??
http://www.simplemachines.org/community/index.php?topic=182573.msg2113118#msg2113118

hmmm. so there is a conflict???
will it be fixed??
Title: Re: Titled Links
Post by: ~DS~ on May 03, 2010, 11:03:17 PM
Quote from: amigozone on May 03, 2010, 11:01:27 PM
Quote from: Dismal Shadow on May 03, 2010, 08:29:56 AM
Quote from: amigozone on May 03, 2010, 08:22:49 AM
will it have any conflicting issue with AEVA ??
http://www.simplemachines.org/community/index.php?topic=182573.msg2113118#msg2113118

hmmm. so there is a conflict???
will it be fixed??
http://www.simplemachines.org/community/index.php?topic=182573.msg2611089#msg2611089
Title: Re: Titled Links
Post by: luismanson on May 04, 2010, 08:10:31 AM
am i the only one with some links shown as $2 ?
i have found that external URLs posted without URL BBCODE get shown as this :(
it might be my forum, anyone else?
Title: Re: Titled Links
Post by: JBlaze on May 04, 2010, 11:11:20 AM
Quote from: luismanson on May 04, 2010, 08:10:31 AM
am i the only one with some links shown as $2 ?
i have found that external URLs posted without URL BBCODE get shown as this :(
it might be my forum, anyone else?

What version SMF?
What error are you getting exactly?
Title: Re: Titled Links
Post by: luismanson on May 04, 2010, 09:13:00 PM
Quote from: JBlaze on May 04, 2010, 11:11:20 AM
What version SMF?
What error are you getting exactly?

RC3

i see links to the right url, but the text is $2
this only happens when a link is posted without the URL bbcode
Example:
[nobbc]http://google.com[nobbc] shows as $2
[nobbc]http://yahoo.com (http://yahoo.com)[nobbc] shows fine


Title: Re: Titled Links
Post by: luismanson on May 05, 2010, 05:53:38 PM
i had made some more tests, can someone confirm if its only my case?



* source WITH url bbcode

with http [url]http://google.com[/url]
[url]google.com[/url]


* RESULTS (as the user sees the post)

with http $2[/url]       ($2 link to google)
google.com      (link to google.com with http)




* source with NO url bbcode

with http: http://google.com
google.com


* RESULTS  (as the user sees the post)
with http [url]http://google.com    (no link, no closing tag)
google.com (no link, no tags either)




RESULTS of the preview (the user sees like this):





Title: Re: Titled Links
Post by: InfoStrides on May 12, 2010, 03:27:31 AM
I installed it on my forum. It is not working. What could have happened? My website is http://www.theinfostrides.com
Title: Re: Titled Links
Post by: JBlaze on May 12, 2010, 03:28:11 AM
Quote from: TheInfostrides.Com on May 12, 2010, 03:27:31 AM

I installed it on my forum. It is not working. What could have happened?

How is it "not working". Please explain.
Title: Re: Titled Links
Post by: ~DS~ on May 12, 2010, 04:28:26 AM
Quote from: TheInfostrides.Com on May 12, 2010, 03:27:31 AM
I installed it on my forum. It is not working. What could have happened? My website is http://www.theinfostrides.com
http://www.simplemachines.org/community/index.php?topic=182573.msg2611871#msg2611871
Title: Re: Titled Links
Post by: luismanson on May 12, 2010, 10:03:44 AM
Quote from: Dismal Shadow on May 12, 2010, 04:28:26 AM
Quote from: TheInfostrides.Com on May 12, 2010, 03:27:31 AM
I installed it on my forum. It is not working. What could have happened? My website is http://www.theinfostrides.com
http://www.simplemachines.org/community/index.php?topic=182573.msg2611871#msg2611871

Next time just post the link to the solution, you are giving google a proof of how idiot im :P
Title: Re: Titled Links
Post by: InfoStrides on May 12, 2010, 11:37:29 AM
Quote from: JBlaze on May 12, 2010, 03:28:11 AM
Quote from: TheInfostrides.Com on May 12, 2010, 03:27:31 AM

I installed it on my forum. It is not working. What could have happened?

How is it "not working". Please explain.

Yes. It is not working. I did the right settings in the admin area. I even used the convert_url.php scripts, which gave confirmation of success but practically no. I check some posts but could not see any change even new posts. Refer to below for instance:

http://www.theinfostrides.com/index.php?topic=3195.0
http://www.theinfostrides.com/index.php?topic=3184.0
Title: Re: Titled Links
Post by: InfoStrides on May 12, 2010, 11:38:42 AM
Quote from: Dismal Shadow on May 12, 2010, 04:28:26 AM
Quote from: TheInfostrides.Com on May 12, 2010, 03:27:31 AM
I installed it on my forum. It is not working. What could have happened? My website is http://www.theinfostrides.com
http://www.simplemachines.org/community/index.php?topic=182573.msg2611871#msg2611871

??? What should I check here?
Title: Re: Titled Links
Post by: JBlaze on May 12, 2010, 11:43:29 AM
Quote from: TheInfostrides.Com on May 12, 2010, 11:38:42 AM
??? What should I check here?

Are you using AEVA?
Title: Re: Titled Links
Post by: InfoStrides on May 19, 2010, 03:40:57 AM
Quote from: JBlaze on May 12, 2010, 11:43:29 AM
Quote from: TheInfostrides.Com on May 12, 2010, 11:38:42 AM
??? What should I check here?

Are you using AEVA?

Yes
Title: Re: Titled Links
Post by: ~DS~ on May 28, 2010, 04:15:57 PM
Any news on this JB?
Title: Re: Titled Links
Post by: JBlaze on May 28, 2010, 05:21:38 PM
Haven't had a chance to update this yet. Will update it when I do.
Title: Re: Titled Links
Post by: rd on May 28, 2010, 05:37:42 PM
This will be really useful for my site: http://iduke.info

It would be awesome if you could update this JB.
Title: Re: Titled Links
Post by: JBlaze on May 28, 2010, 06:05:45 PM
It works fine unless you are using AEVA.

I will begin working on a fix once I get done with RL.
Title: Re: Titled Links
Post by: coolfx350 on June 03, 2010, 03:30:46 PM
AEVA is the problem, if I uninstall AEVA, it started to work fine.

I love this mod, but I also love AEVA, please please post fix soon :)

thanks.
Title: Re: Titled Links
Post by: coolfx350 on June 14, 2010, 08:24:18 AM
any ideas when we can expect to see a fix?  just curious if i should wait, or get another mod to replace AVEA
Title: Re: Titled Links
Post by: Bugo on June 15, 2010, 11:08:43 PM
When other sites in the windows-1251, and my, for example, in utf-8, then post the transformation any links from these sites looks like «РњРѕСЃРєРІРёС‡ 2141 РљР РђРЎРћРўРђ РџРћ АМЕРР�љРђРќРЎРљР�.» etc.
Title: Re: Titled Links
Post by: Nao 尚 on June 21, 2010, 11:19:14 AM
Quote from: rm -rf on May 28, 2010, 06:05:45 PM
It works fine unless you are using AEVA.
Hey... It's Aeva! You should know better, I'm always bothering everyone with that ::)

QuoteI will begin working on a fix once I get done with RL.
Do you need any help?
Title: Re: Titled Links
Post by: JBlaze on June 21, 2010, 11:31:59 AM
Quote from: Nao on June 21, 2010, 11:19:14 AM
QuoteI will begin working on a fix once I get done with RL.
Do you need any help?
With real life? I could always use help :P

Other than that, I want to see what I can do without requesting assistance first, but thanks :)
Title: Re: Titled Links
Post by: coolfx350 on June 22, 2010, 01:24:46 PM
Quote from: Nao on June 21, 2010, 11:19:14 AM
Quote from: rm -rf on May 28, 2010, 06:05:45 PM
It works fine unless you are using AEVA.
Hey... It's Aeva! You should know better, I'm always bothering everyone with that ::)

QuoteI will begin working on a fix once I get done with RL.
Do you need any help?

Ya, please make it compatible with Avea, Avea is the most popular mod in SMF, no one can live without, but this wonderful mod just choose to go against it :(   LOL
Title: Re: Titled Links
Post by: Nao 尚 on June 22, 2010, 02:57:11 PM
Quote from: petecheng on June 22, 2010, 01:24:46 PM
Ya, please make it compatible with Avea, Avea is the most popular mod in SMF, no one can live without, but this wonderful mod just choose to go against it :(   LOL
Yes, people can live without it, really...

And the fact is that Aeva Media does the same thing as Titled Links when it comes to videos, so I guess it's not surprising they're conflicting. I haven't actually looked into the Titled Links code but I'm sure both of our mods are trying to do the same thing at the same time, hence the conflict.
Title: Re: Titled Links
Post by: JBlaze on June 22, 2010, 03:03:44 PM
The conflict comes in the fact that AEVA processes URL's before Titled Links does, and in turn conflicts with the preparse_code() function. I'll get to working on this when I get a chance.
Title: Re: Titled Links
Post by: coolfx350 on June 22, 2010, 03:04:53 PM
Yes, I realized that, but I strongly believe you two are smart enough to come up with a solution.  :)
Title: Re: Titled Links
Post by: JBlaze on June 22, 2010, 03:05:54 PM
Well if people keep pestering me to do it, I may not do it ;)
Title: Re: Titled Links
Post by: coolfx350 on June 22, 2010, 03:07:56 PM
Quote from: rm -rf on June 22, 2010, 03:03:44 PM
The conflict comes in the fact that AEVA processes URL's before Titled Links does, and in turn conflicts with the preparse_code() function. I'll get to working on this when I get a chance.

sorry for being really impatience.  I appreciate your efforts.
Title: Re: Titled Links
Post by: ~DS~ on June 22, 2010, 03:08:46 PM
Quote from: rm -rf on June 22, 2010, 03:05:54 PM
Well if people keep pestering me to do it, I may not do it ;)

/me gives him a cookies
:P
Title: Re: Titled Links
Post by: Nao 尚 on June 22, 2010, 06:46:51 PM
JBlaze, do you want me to set a variable so you can check it and not call your stuff in case it's set? Or the other way around, but I'm not sure it'd work as well.
Title: Re: Titled Links
Post by: JBlaze on June 22, 2010, 07:15:35 PM
Quote from: Nao on June 22, 2010, 06:46:51 PM
JBlaze, do you want me to set a variable so you can check it and not call your stuff in case it's set? Or the other way around, but I'm not sure it'd work as well.
Up to you. What's happening is that Titled Links is modifying any urls that are not encapsed in the [url] tag, but at the same time, AEVA is also checking those URLs for any media content, thus the conflict. I'll play around a bit with it when I get some time to see if I can just force a workaround, but if you want to, you can do it as well.

Up to you :)

And thanks.
Title: Re: Titled Links
Post by: Nao 尚 on June 23, 2010, 01:40:16 AM
Well, I guess you still have to test all URLs because some may not be parsed by AeMe.
What happens here is that you want to make sure you don't touch URLs that are already parsed (i.e. [url=...]Title[/url])
Do you already do that?
Title: Re: Titled Links
Post by: JBlaze on June 23, 2010, 01:45:21 AM
Indeed, it only looks for URLs that are either not encased in the url tags, or those that don't have titles already.

i.e. it will parse http://www.google.com and [url=http://www.google.com]http://www.google.com[/url], but not [url=http://www.google.com]Google[/url]

Code (location preparseCode()) Select
// Time to do some cool stuff with URL's
if (!$previewing && $modSettings['convert_urls'])
{

// We're gonna save the old socket timeout, reduce it down to 3 seconds, so we prevent this from hanging up
// We are supressing the errors in case the user cannot change this value on their server.
$timeout = ini_get('default_socket_timeout');
@ini_set('default_socket_timeout',3);

$message = preg_replace(array('~(?<=[\s>\.(;\'"]|^)((?:http)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i', '~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i'), array('[url]$1[/url%]', '[url]$1[/url%]'), $message);

// Now we find the urls that we just changed, so we can run through them and get titles
preg_match_all("~\[url\](.+?)\[/url%\]~smi", $message, $urls);

if (!empty($urls[0]))
{

// Lets make a counter so we don't exceed the settings...
$title_counter = 0;
foreach($urls[1] as $uri)
{
// If our counter has exceeded the amount, replace the remaining urls back to what they were and get outta dodge.
if(!empty($modSettings['title_url_count']) && $title_counter++ >= $modSettings['title_url_count'])
{
$message = preg_replace('~\[url\]' . $uri . '\[/url%\]~', $uri, $message);
continue;
}

// Attach http:// to the url...
$uri_modified = strpos($uri, 'http://') === false ? 'http://' . $uri : $uri;

// Use the @ to suppress errors from the function not finding a url, which will still return false if
// there is an error.  This just prevents the error log from filling up without cause.
// In 2.0, we have fetch_web_data() which makes our lives easier :)
require_once($sourcedir . '/Subs-Package.php');
$request = @fetch_web_data($uri_modified);

if ($request !== false && preg_match('~<title>(.+?)</title>~smi', $request, $matches))
{
$title = $smcFunc['htmlspecialchars'](stripslashes($matches[1]), ENT_QUOTES);
// Need to fix the &amp;amp;
$title = str_replace('&amp;amp;', '&amp;', $title);
// w00t!  Changin the link to titlize it (is that word?)
$message = str_replace('[url]' . $uri . '[/url%]', '[url=' . $uri_modified . ']' . $title . '[/url]', $message);
}

// Looks like we couldn't get the title, darn.  Back to the original we go...
else
$message = str_replace('[url]' . $uri . '[/url%]', $uri, $message);
}
}
// Change it back to what it was.  Suppress again incase...
@ini_set('default_socket_timeout',$timeout);
}
Title: Re: Titled Links
Post by: Nao 尚 on June 23, 2010, 04:10:15 AM
Hmm... Then neither of the mods should be conflicting with each other...?!
It'll have to wait until one of us can look into it a bit more.

PS: gotta love fetch_web_data, eh? :) Though I think the last time I looked into that function, I noticed a few areas that could use some improvement.
Title: Re: Titled Links
Post by: JBlaze on June 23, 2010, 04:34:29 AM
Indeed, thats probably why I havent found a solution yet. Its annoying me lol.

As for fetch_web_data i love it. Reduces the annoyance of support requests due to crappy hosts ;)
Title: Re: Titled Links
Post by: Nao 尚 on June 23, 2010, 06:15:34 AM
Quote from: JBlaze on June 23, 2010, 04:34:29 AM
Indeed, thats probably why I havent found a solution yet. Its annoying me lol.
OTOH, whoever fixes it will enjoy a hell of an endorphine boost I guess. ;)

QuoteAs for fetch_web_data i love it. Reduces the annoyance of support requests due to crappy hosts ;)
Sure :)
Title: Re: Titled Links
Post by: KensonPlays on August 01, 2010, 12:51:26 AM
convert_urls stats:
  1460 messages
  6 had URLs to convert
  7 URLs were converted
  Overall, the script took 15.116133213043 seconds to execute.
  About 2.5193555355072 seconds per message
  About 2.1594476018633 seconds per url
Title: Re: Titled Links
Post by: Nao 尚 on August 01, 2010, 03:59:20 AM
Quote from: Kcmartz on August 01, 2010, 12:51:26 AM
convert_urls stats:
Fascinating. So, in the light of this, what will you do? Convert to vBulletin, or just troll everywhere like you seem to enjoy doing?
Title: Re: Titled Links
Post by: coolfx350 on August 01, 2010, 07:53:42 PM
I guess waiting for the fix is hopeless.
Title: Re: Titled Links
Post by: Afro on August 04, 2010, 07:25:39 AM
Quote from: Nao 尚 on August 01, 2010, 03:59:20 AM
Quote from: Kcmartz on August 01, 2010, 12:51:26 AM
convert_urls stats:
Fascinating. So, in the light of this, what will you do? Convert to vBulletin, or just troll everywhere like you seem to enjoy doing?

8) ;D
Title: Re: Titled Links
Post by: Nao 尚 on August 04, 2010, 08:35:29 AM
Quote from: petecheng on August 01, 2010, 07:53:42 PM
I guess waiting for the fix is hopeless.
I wouldn't say that. But I just don't have myself.
Although if I had a copy of a fresh Subs.php with Titled Links applied to it and one with AeMe or Aeva Lite applied to it, I could do a quick diff and look into it faster.
Title: Re: Titled Links
Post by: JBlaze on August 05, 2010, 01:39:31 PM
I honestly don't have the time nor desire to look into finding a fix anymore considering all the "DO IT FOR ME NOW!" messages I've been getting.

Pity how a few can ruin it for the many.
Title: Re: Titled Links
Post by: Nao 尚 on August 05, 2010, 04:55:30 PM
It's a classic, yeah. :(
Title: Re: Titled Links
Post by: HollowMac on August 18, 2010, 06:28:48 AM
Hello,

I have a problem with this URL and the ® caracter : http://www.plexiglas.com/acrylicsheet/technicaldata/properties#breakage

Also with this page : http://www.antweb.org/description.do?rank=genus&name=myrmica&project=worldants the title is not fully displayed.

Any idea ?

Thank you for this great plugin ;)

edit : i can solve my first problem by adding this in Subs-Post.php :
$title = htmlentities($title, ENT_COMPAT, 'UTF-8');

This code can also solve the display of special characters "àéèïî", etc. for french people ;)

I will soon purpose you my french traduction of your plugin ;)
Title: Re: Titled Links
Post by: coolfx350 on September 16, 2010, 04:24:26 PM
Nao 尚 <-- let me send you mine....

Thanks for working on this.
Title: Re: Titled Links
Post by: Sirius OCTeam on September 22, 2010, 02:35:36 AM
Hello

doesn't work if we ommit the ending slah on a domain

http://www.simplemachines.org <= no title retreived
http://www.simplemachines.org/ <= title ok
Title: Re: Titled Links
Post by: DirtRider on September 30, 2010, 09:44:20 AM
Where do I find the setting for this mod in my Admin CP  :P
Title: Re: Titled Links
Post by: Bugo on September 30, 2010, 09:50:36 AM
Quote
There are also options in the admin interface for Posts so you can turn this feature on or off, and also limit the number of URLs to convert.
Title: Re: Titled Links
Post by: DirtRider on September 30, 2010, 09:57:49 AM
Quote from: Bugo on September 30, 2010, 09:50:36 AM
Quote
There are also options in the admin interface for Posts so you can turn this feature on or off, and also limit the number of URLs to convert.

Thanks I kept looking over it  ;D However this mod does not work for me at all
Title: Re: Titled Links
Post by: Sirius OCTeam on October 16, 2010, 12:34:56 PM
Hello

Congrats for this mod, that should be implemented as a default option in smf.

Unfortunately, it only works (on my board at least) in the message preview, once I post the message, title has gone and got standard url instead

Anyone got this issue too ?
Title: Re: Titled Links
Post by: IrateZebra on October 17, 2010, 02:01:14 AM
Quote from: Sirius OCTeam on October 16, 2010, 12:34:56 PM
Hello

Congrats for this mod, that should be implemented as a default option in smf.

Unfortunately, it only works (on my board at least) in the message preview, once I post the message, title has gone and got standard url instead

Anyone got this issue too ?
Do you have Aeva installed on your forum?
Title: Re: Titled Links
Post by: Sirius OCTeam on October 17, 2010, 05:17:34 AM
ah yes (related ?)
Title: Re: Titled Links
Post by: IrateZebra on October 17, 2010, 03:13:05 PM
Quote from: Sirius OCTeam on October 17, 2010, 05:17:34 AM
ah yes (related ?)
Very related. There is a known conflict with this mod and Aeva (see this post (http://www.simplemachines.org/community/index.php?topic=182573.msg2113118#msg2113118))

There is still no current resolution.
Title: Re: Titled Links
Post by: eckostylez on October 19, 2010, 04:57:22 AM
Quote
Stats:
  1329 messages
  58 had URLs to convert
  104 URLs were converted
  Overall, the script took 76.7803888321 seconds to execute.
  About 1.32379980745 seconds per message
  About 0.738272969539 seconds per URL
Title: Re: Titled Links
Post by: Spuds on December 17, 2010, 07:03:34 PM
QuoteVery related. There is a known conflict with this mod and Aeva (see this post)

There is still no current resolution.

Here is an attempt to fix this problem for 2.0 only (sorry kids).  Basically Aeva will wrap any links in
[url]your link[/url]
or
[url=your link]your link[/url]
tags and the regex in this mod only looks for plain links .... Really  the best thing to do is a rewrite so this mod is a function and then call it before Aeva does its work (maybe?) ... but here is an attempt to update what we have to be Aeva aware ... this is for TESTING only.

With that said, in Subs-Post.php find:

// Time to do some cool stuff with URL's
if (!$previewing && $modSettings['convert_urls'])
{

// We're gonna save the old socket timeout, reduce it down to 3 seconds, so we prevent this from hanging up
// We are supressing the errors in case the user cannot change this value on their server.
$timeout = ini_get('default_socket_timeout');
@ini_set('default_socket_timeout',3);

$message = preg_replace(array('~(?<=[\s>\.(;\'"]|^)((?:http)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i', '~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i'), array('[url]$1[/url%]', '[url]$1[/url%]'), $message);

// Now we find the urls that we just changed, so we can run through them and get titles
preg_match_all("~\[url\](.+?)\[/url%\]~smi", $message, $urls);

if (!empty($urls[0]))
{

// Lets make a counter so we don't exceed the settings...
$title_counter = 0;
foreach($urls[1] as $uri)
{
// If our counter has exceeded the amount, replace the remaining urls back to what they were and get outta dodge.
if(!empty($modSettings['title_url_count']) && $title_counter++ >= $modSettings['title_url_count'])
{
$message = preg_replace('~\[url\]' . $uri . '\[/url%\]~', $uri, $message);
continue;
}

// Attach http:// to the url...
$uri_modified = strpos($uri, 'http://') === false ? 'http://' . $uri : $uri;

// Use the @ to suppress errors from the function not finding a url, which will still return false if
// there is an error.  This just prevents the error log from filling up without cause.
// In 2.0, we have fetch_web_data() which makes our lives easier :)
require_once($sourcedir . '/Subs-Package.php');
$request = @fetch_web_data($uri_modified);

if ($request !== false && preg_match('~<title>(.+?)</title>~smi', $request, $matches))
{
$title = $smcFunc['htmlspecialchars'](stripslashes($matches[1]), ENT_QUOTES);
// Need to fix the &amp;amp;
$title = str_replace('&amp;amp;', '&amp;', $title);
// w00t!  Changin the link to titlize it (is that word?)
$message = str_replace('[url]' . $uri . '[/url%]', '[url=' . $uri_modified . ']' . $title . '[/url]', $message);
}

// Looks like we couldn't get the title, darn.  Back to the original we go...
else
$message = str_replace('[url]' . $uri . '[/url%]', $uri, $message);
}
}
// Change it back to what it was.  Suppress again incase...
@ini_set('default_socket_timeout',$timeout);
}


replace with:

// Time to do some cool stuff with URL's
if (!$previewing && $modSettings['convert_urls'])
{

// We're gonna save the old socket timeout, reduce it down to 3 seconds, so we prevent this from hanging up
// We are supressing the errors in case the user cannot change this value on their server.
$timeout = ini_get('default_socket_timeout');
@ini_set('default_socket_timeout',3);

// Aeva converts links as part of its onposting operations, namely [url]$1[/url] & [url=http://$1]$1[/url]
// we need to revert these for this mod to work and put them back if needed
if (isset($modSettings['aeva_enable'])) {
// maybe its [url=http://bbb.bbb.bbb]bbb.bbb.bbb[/url]
preg_match_all("~\[url=(https?:\/\/(.+?))\](?:https?:\/\/)?(.+?)\[/url\]~si", $message, $pre_urls, PREG_SET_ORDER);
foreach($pre_urls as $uri_check) {
if (isset($uri_check[2]) && isset($uri_check[3]) && ($uri_check[2] == $uri_check[3])) {
// link is the same as the title ... so set it back to be just a non bbc link for now
$message = str_replace($uri_check[0], $uri_check[2], $message);
}
}
// maybe it just like [url]bbb.bbb.bbb[/url]
preg_match_all("~\[url\](https?:\/\/(.+?))\[/url\]~si", $message, $pre_urls, PREG_SET_ORDER);
foreach($pre_urls as $uri_check) {
// link is the same as the title ... so set it back to be just a non bbc link for now
$message = str_replace($uri_check[0], $uri_check[1], $message);
}
}

$message = preg_replace(
array('~(?<=[\s>\.(;\'"]|^)((?:http)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i', '~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i'),
array('[url]$1[/url%]', '[url]$1[/url%]'), $message);

// Now we find the urls that we just changed, so we can run through them and get titles
preg_match_all("~\[url\](.+?)\[/url%\]~smi", $message, $urls);

if (!empty($urls[0]))
{
// Lets make a counter so we don't exceed the settings...
$title_counter = 0;
foreach($urls[1] as $uri)
{
// Attach http:// to the url... make sure there is a trailing '/'
$uri_modified = trim((strpos($uri, 'http://') === false ? 'http://' . $uri : $uri));
if ($uri_modified[strlen($uri_modified)-1] != '/')
$uri_modified .= '/';

// If our counter has exceeded the amount, replace the remaining urls back to what they were and get outta dodge.
if(!empty($modSettings['title_url_count']) && $title_counter++ >= $modSettings['title_url_count'])
{
if (isset($modSettings['aeva_enable']))
$message = preg_replace('~\[url\]' . $uri . '\[/url%\]~', '[url=' . $uri_modified . ']' . $uri . '[/url]', $message);
else
$message = preg_replace('~\[url\]' . $uri . '\[/url%\]~', $uri, $message);
continue;
}

// Use the @ to suppress errors from the function not finding a url, which will still return false if
// there is an error.  This just prevents the error log from filling up without cause.
// In 2.0, we have fetch_web_data() which makes our lives easier :)
require_once($sourcedir . '/Subs-Package.php');
$request = @fetch_web_data($uri_modified);

if ($request !== false && preg_match('~<title>(.+?)</title>~smi', $request, $matches))
{
$title = $smcFunc['htmlspecialchars'](stripslashes($matches[1]), ENT_QUOTES);
// Need to fix the &amp;amp;
$title = str_replace('&amp;amp;', '&amp;', $title);
// w00t!  Changin the link to titlize it (is that word?)
$message = str_replace('[url]' . $uri . '[/url%]', '[url=' . $uri_modified . ']' . $title . '[/url]', $message);
}

// Looks like we couldn't get the title, darn.  Back to the original we go...
else {
if (isset($modSettings['aeva_enable']))
$message = preg_replace('~\[url\]' . $uri . '\[/url%\]~', '[url=' . $uri_modified . ']' . $uri . '[/url]', $message);
else
$message = str_replace('[url]' . $uri . '[/url%]', $uri, $message) . '******';
}
}
}
// Change it back to what it was.  Suppress again incase...
@ini_set('default_socket_timeout',$timeout);
}
Title: Re: Titled Links
Post by: king kratos on January 05, 2011, 01:00:47 AM
Quote from: Spuds on December 17, 2010, 07:03:34 PM
QuoteVery related. There is a known conflict with this mod and Aeva (see this post)

There is still no current resolution.

Here is an attempt to fix this problem for 2.0 only (sorry kids).  Basically Aeva will wrap any links in
[url]your link[/url]
or
[url=your link]your link[/url]
tags and the regex in this mod only looks for plain links .... Really  the best thing to do is a rewrite so this mod is a function and then call it before Aeva does its work (maybe?) ... but here is an attempt to update what we have to be Aeva aware ... this is for TESTING only.

With that said, in Subs-Post.php find:

// Time to do some cool stuff with URL's
if (!$previewing && $modSettings['convert_urls'])
{

// We're gonna save the old socket timeout, reduce it down to 3 seconds, so we prevent this from hanging up
// We are supressing the errors in case the user cannot change this value on their server.
$timeout = ini_get('default_socket_timeout');
@ini_set('default_socket_timeout',3);

$message = preg_replace(array('~(?<=[\s>\.(;\'"]|^)((?:http)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i', '~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i'), array('[url]$1[/url%]', '[url]$1[/url%]'), $message);

// Now we find the urls that we just changed, so we can run through them and get titles
preg_match_all("~\[url\](.+?)\[/url%\]~smi", $message, $urls);

if (!empty($urls[0]))
{

// Lets make a counter so we don't exceed the settings...
$title_counter = 0;
foreach($urls[1] as $uri)
{
// If our counter has exceeded the amount, replace the remaining urls back to what they were and get outta dodge.
if(!empty($modSettings['title_url_count']) && $title_counter++ >= $modSettings['title_url_count'])
{
$message = preg_replace('~\[url\]' . $uri . '\[/url%\]~', $uri, $message);
continue;
}

// Attach http:// to the url...
$uri_modified = strpos($uri, 'http://') === false ? 'http://' . $uri : $uri;

// Use the @ to suppress errors from the function not finding a url, which will still return false if
// there is an error.  This just prevents the error log from filling up without cause.
// In 2.0, we have fetch_web_data() which makes our lives easier :)
require_once($sourcedir . '/Subs-Package.php');
$request = @fetch_web_data($uri_modified);

if ($request !== false && preg_match('~<title>(.+?)</title>~smi', $request, $matches))
{
$title = $smcFunc['htmlspecialchars'](stripslashes($matches[1]), ENT_QUOTES);
// Need to fix the &amp;amp;
$title = str_replace('&amp;amp;', '&amp;', $title);
// w00t!  Changin the link to titlize it (is that word?)
$message = str_replace('[url]' . $uri . '[/url%]', '[url=' . $uri_modified . ']' . $title . '[/url]', $message);
}

// Looks like we couldn't get the title, darn.  Back to the original we go...
else
$message = str_replace('[url]' . $uri . '[/url%]', $uri, $message);
}
}
// Change it back to what it was.  Suppress again incase...
@ini_set('default_socket_timeout',$timeout);
}


replace with:

// Time to do some cool stuff with URL's
if (!$previewing && $modSettings['convert_urls'])
{

// We're gonna save the old socket timeout, reduce it down to 3 seconds, so we prevent this from hanging up
// We are supressing the errors in case the user cannot change this value on their server.
$timeout = ini_get('default_socket_timeout');
@ini_set('default_socket_timeout',3);

// Aeva converts links as part of its onposting operations, namely [url]$1[/url] & [url=http://$1]$1[/url]
// we need to revert these for this mod to work and put them back if needed
if (isset($modSettings['aeva_enable'])) {
// maybe its [url=http://bbb.bbb.bbb]bbb.bbb.bbb[/url]
preg_match_all("~\[url=(https?:\/\/(.+?))\](?:https?:\/\/)?(.+?)\[/url\]~si", $message, $pre_urls, PREG_SET_ORDER);
foreach($pre_urls as $uri_check) {
if (isset($uri_check[2]) && isset($uri_check[3]) && ($uri_check[2] == $uri_check[3])) {
// link is the same as the title ... so set it back to be just a non bbc link for now
$message = str_replace($uri_check[0], $uri_check[2], $message);
}
}
// maybe it just like [url]bbb.bbb.bbb[/url]
preg_match_all("~\[url\](https?:\/\/(.+?))\[/url\]~si", $message, $pre_urls, PREG_SET_ORDER);
foreach($pre_urls as $uri_check) {
// link is the same as the title ... so set it back to be just a non bbc link for now
$message = str_replace($uri_check[0], $uri_check[1], $message);
}
}

$message = preg_replace(
array('~(?<=[\s>\.(;\'"]|^)((?:http)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i', '~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i'),
array('[url]$1[/url%]', '[url]$1[/url%]'), $message);

// Now we find the urls that we just changed, so we can run through them and get titles
preg_match_all("~\[url\](.+?)\[/url%\]~smi", $message, $urls);

if (!empty($urls[0]))
{
// Lets make a counter so we don't exceed the settings...
$title_counter = 0;
foreach($urls[1] as $uri)
{
// Attach http:// to the url... make sure there is a trailing '/'
$uri_modified = trim((strpos($uri, 'http://') === false ? 'http://' . $uri : $uri));
if ($uri_modified[strlen($uri_modified)-1] != '/')
$uri_modified .= '/';

// If our counter has exceeded the amount, replace the remaining urls back to what they were and get outta dodge.
if(!empty($modSettings['title_url_count']) && $title_counter++ >= $modSettings['title_url_count'])
{
if (isset($modSettings['aeva_enable']))
$message = preg_replace('~\[url\]' . $uri . '\[/url%\]~', '[url=' . $uri_modified . ']' . $uri . '[/url]', $message);
else
$message = preg_replace('~\[url\]' . $uri . '\[/url%\]~', $uri, $message);
continue;
}

// Use the @ to suppress errors from the function not finding a url, which will still return false if
// there is an error.  This just prevents the error log from filling up without cause.
// In 2.0, we have fetch_web_data() which makes our lives easier :)
require_once($sourcedir . '/Subs-Package.php');
$request = @fetch_web_data($uri_modified);

if ($request !== false && preg_match('~<title>(.+?)</title>~smi', $request, $matches))
{
$title = $smcFunc['htmlspecialchars'](stripslashes($matches[1]), ENT_QUOTES);
// Need to fix the &amp;amp;
$title = str_replace('&amp;amp;', '&amp;', $title);
// w00t!  Changin the link to titlize it (is that word?)
$message = str_replace('[url]' . $uri . '[/url%]', '[url=' . $uri_modified . ']' . $title . '[/url]', $message);
}

// Looks like we couldn't get the title, darn.  Back to the original we go...
else {
if (isset($modSettings['aeva_enable']))
$message = preg_replace('~\[url\]' . $uri . '\[/url%\]~', '[url=' . $uri_modified . ']' . $uri . '[/url]', $message);
else
$message = str_replace('[url]' . $uri . '[/url%]', $uri, $message) . '******';
}
}
}
// Change it back to what it was.  Suppress again incase...
@ini_set('default_socket_timeout',$timeout);
}


This code works just fine with 2.0 RC4 with the fix provided. However, it must be installed while emulating RC3.

Kratos
Title: Re: Titled Links
Post by: My LG Cookie Fresh on January 05, 2011, 05:39:14 AM
Sorry if This has already to post this but I didn't install this mod and it sill works...?
Title: Re: Titled Links
Post by: impreza on January 05, 2011, 06:17:34 AM
Cool addition, I like it
Title: Re: Titled Links
Post by: willerby on January 15, 2011, 06:33:22 PM
If I post a link from a topic in my forum that is on a member only board it gives me a link titled Login? Otherwise great mod.
Title: Re: Titled Links
Post by: JBlaze on January 15, 2011, 06:38:18 PM
Quote from: laetabi on January 15, 2011, 06:33:22 PM
If I post a link from a topic in my forum that is on a member only board it gives me a link titled Login? Otherwise great mod.
That's because the script fetches the page as a guest, and "Login" is the page title when prompted to login on a board guests can't see.
Title: Re: Titled Links
Post by: Sirius OCTeam on January 16, 2011, 01:06:23 PM
QuoteThis code works just fine with 2.0 RC4 with the fix provided

I confirm too, conflict with aeva fixed with this code.

Thanks
Title: Re: Titled Links
Post by: Pause on February 02, 2011, 06:35:46 PM
Great mod which I'm using with the Aeva compatible code, thanks.

One small issue however is that certain characters are converted to their html entities (such as ", < and > instead displaying as &quot;, &lt;, and &gt;).
Title: Re: Titled Links
Post by: Spuds on February 03, 2011, 10:48:12 PM
QuoteOne small issue however is that certain characters are converted to their html entities (such as ", < and > instead displaying as &quot;, &lt;, and &gt;).
The reality is that you are going to find several small things and its really not the mods fault but the fault of the web page that you are scraping the title from.   I've been using the mod for a couple of months now and have run across some interesting uses of the title tag.

Anyway here are a couple of lines you can add to help clean up the titles based on some of what I have seen over the last couple of months.  Find these lines


            if ($request !== false && preg_match('~<title>(.+?)</title>~smi', $request, $matches))
            {
               $title = $smcFunc['htmlspecialchars'](stripslashes($matches[1]), ENT_QUOTES);
               // Need to fix the &amp;amp;
               $title = str_replace('&amp;amp;', '&amp;', $title);
               // w00t!  Changin the link to titlize it (is that word?)
               $message = str_replace('[url]' . $uri . '[/url%]', '[url=' . $uri_modified . ']' . $title . '[/url]', $message);
            }


replace them with these

            if ($request !== false && preg_match('~<title>(.+?)</title>~smi', $request, $matches))
            {
// Undo htmlspecial first as we redo shortly
$title = trim(html_entity_decode(un_htmlspecialchars($matches[1])));

// remove dumb stuff we find in titles
$title = str_replace(array('&mdash;',"\n","\t"),array('-',' ',' '),$title);
$title = preg_replace('~\s{2,20}~',' ',$title);
$title = $smcFunc['htmlspecialchars'](stripslashes($title), ENT_QUOTES);

// w00t!  Changin the link to titlize it (is that word?)
$message = str_replace('[url]' . $uri . '[/url%]', '[url=' . $uri_modified . ']' . $title . '[/url]', $message);
            }

and see if that fixes the issue you are seeing ...
Title: Re: Titled Links
Post by: Pause on February 04, 2011, 01:23:11 AM
Quote from: Spuds on February 03, 2011, 10:48:12 PM
The reality is that you are going to find several small things and its really not the mods fault but the fault of the web page that you are scraping the title from.   I've been using the mod for a couple of months now and have run across some interesting uses of the title tag.
True, it can be odd what some sites put in there at times.

Quote from: Spuds on February 03, 2011, 10:48:12 PMand see if that fixes the issue you are seeing ...
It does indeed, thank you.  :)
Title: Re: Titled Links
Post by: seficar on February 15, 2011, 08:25:15 AM
is it ok to install this 2.0 RC5?
Title: Re: Titled Links
Post by: JBlaze on February 15, 2011, 03:48:12 PM
Quote from: seficar on February 15, 2011, 08:25:15 AM
is it ok to install this 2.0 RC5?
Not yet. I haven't got around to updating my mods.
Title: Re: Titled Links
Post by: ssdevious on February 24, 2011, 08:26:00 AM
Greetings,

first of all, thanks for this great mod, I've been looking for exactly this thing, but I've got one question.

There were 2 files in the downloads: 1) convert_urls.php and 2) titled_links_v1.2.zip - to install this mod, which one should I use? The .zip one and don't care about the .php one, or it must be uploaded somewhere as well?

Thanks for clarifying this issue.

Best Regards,
SS-Totenkopf
Title: Re: Titled Links
Post by: ssdevious on February 24, 2011, 12:34:41 PM
Thank you.

One more thing. How do I use the .php? Copy it? Where? How to run it?

Thanks.

Best Regards,
SS-Totenkopf
Title: Re: Titled Links
Post by: coolfx350 on June 09, 2011, 03:51:44 PM
thanks for the fix, but all my forums are still on SMF 1.1.13. oh well.
Title: Re: Titled Links
Post by: yakyakyak on June 11, 2011, 08:42:00 AM
Tried this out and must say it's not really practical.

share a link from anywhere on the forum ie. moderators only board and post it in admin only and all it translates to is Login

please expand what sense is there in the current way links are translated as guest only view or am i missing something?

thanks
Title: Re: Titled Links
Post by: technica on August 24, 2011, 12:36:31 PM
does this mod works for smf 1.1.14?

I dont see any changes in the links after installing this mod on my smf forum.

please help.
Title: Re: Titled Links
Post by: Shorti25 on August 28, 2011, 09:23:24 AM
need it for 2.0 final please
Title: Re: Titled Links
Post by: Guillelmus on August 30, 2011, 03:53:08 AM
Umlauts don't work in some links
http://www.youtube.com/watch?v=tu1bF_zGCdw renders into Vintiöt - Vesipuisto Surina - YouTube
should be -> Vintiöt
However in some links umlauts work ok. Any idea on how to fix?

Great mod, btw!
Title: Re: Titled Links
Post by: Inti31 on August 30, 2011, 05:08:38 AM
just modified it a little bit and it runs fine for 2.0 Gold.

converting took seconds (in maintenance mode) - nearly 2500 posts (hey, i started 5 month ago...  ;) )

all works well:
my testcode

Testlinks:
[hr]
Link to linked-urls - page 1
just added this simple link
[nobbc]http://www.simplemachines.org/community/index.php?topic=182573.0[/nobbc]
Result (after klick on save):
http://www.simplemachines.org/community/index.php?topic=182573.0
[hr]
Link to mod
just added this simple link
[nobbc]http://custom.simplemachines.org/mods/index.php?mod=835[/nobbc]
Result:
http://custom.simplemachines.org/mods/index.php?mod=835
[hr]
Link to guestbook (main forum)
[nobbc]http://epica-forum.de/index.php?page=pg_gaestebuch[/nobbc]
Result:
http://epica-forum.de/index.php?page=pg_gaestebuch


the German umlaut (ä) is parsed correct....

addition, all umlauts are okay like ä,ö,ü,ß, also arabic characters are shown...


nice...

cheers inti31
Title: Re: Titled Links
Post by: Guillelmus on August 30, 2011, 05:52:54 AM
Quote from: Inti31 on August 30, 2011, 05:08:38 AM
just modified it a little bit and it runs fine for 2.0 Gold.

(...)

the result - see testforum: http://aida32-inventory.netboom.de/smf/index.php?topic=305.0

the German umlaut (ä) is parsed correct....

addition, all umlauts are okay like ä,ö,ü,ß, also arabic characters are shown...
Is this page parsed correctly? http://www.google.fi/intl/fi/webmasters/

To me it looks like: Googlen ylläpitokeskus

The problem is propably UTF-8 conversion. Did you manage to fix this?
Title: Re: Titled Links
Post by: Inti31 on August 30, 2011, 06:11:11 AM
my test- and main forum run under german-utf8.

original link
http://www.google.fi/intl/fi/webmasters/
result:

      Googlen ylläpitokeskus. Hanki tietoja indeksoimisesta ja hakuliikenteestä. Lisää liikennettä
      sivustoosi.
     (http://www.google.fi/intl/fi/webmasters/)

there are spaces/tabs in the title of this page (see source code)
source information of that page:

    <title>
      Googlen ylläpitokeskus. Hanki tietoja indeksoimisesta ja hakuliikenteestä. Lisää liikennettä
      sivustoosi.
    </title>


nevertheless - it is parsed correct:
[url=http://www.google.fi/intl/fi/webmasters/]
      Googlen ylläpitokeskus. Hanki tietoja indeksoimisesta ja hakuliikenteestä. Lisää liikennettä
      sivustoosi.
    [/url]



but this is simple to correct it like this:
Googlen ylläpitokeskus. Hanki tietoja indeksoimisesta ja hakuliikenteestä. Lisää liikennettä sivustoosi. (http://www.google.fi/intl/fi/webmasters/)

addition:
not sure if this is the reason... Did you try "convert html entities to utf8" - find here: Administrate-Maintenance-Database?
Title: Re: Titled Links
Post by: Guillelmus on August 30, 2011, 06:23:11 AM
So, here's the solution for forums running ISO8859-1

// Check if UTF8 and convert if needed
if (mb_detect_encoding($title, 'UTF-8', true))
{
   $title = utf8_decode($title);
}
Title: Re: Titled Links
Post by: Inti31 on August 30, 2011, 06:27:43 AM
and you place that code where?

cheers Inti31
Title: Re: Titled Links
Post by: Guillelmus on August 31, 2011, 06:34:05 AM
Quote from: Inti31 on August 30, 2011, 06:27:43 AM
and you place that code where?

cheers Inti31
Just after $title is initiated.
Title: Re: Titled Links
Post by: cebu on October 10, 2011, 10:45:35 PM
i love this mod. im currently using this in one of my forum running SMF 1.1.15

hopefully and update for the SMF 2.0.1 will be available, since i have another forum running on that version.
Title: Re: Titled Links
Post by: Guillelmus on October 18, 2011, 08:54:15 AM
Quote from: cebu on October 10, 2011, 10:45:35 PM
i love this mod. im currently using this in one of my forum running SMF 1.1.15

hopefully and update for the SMF 2.0.1 will be available, since i have another forum running on that version.
Just emulate the version, runs fine.
Title: Re: Titled Links
Post by: lepidas on December 20, 2011, 03:45:45 AM
Quote from: Guillelmus on October 18, 2011, 08:54:15 AM
Quote from: cebu on October 10, 2011, 10:45:35 PM
i love this mod. im currently using this in one of my forum running SMF 1.1.15

hopefully and update for the SMF 2.0.1 will be available, since i have another forum running on that version.
Just emulate the version, runs fine.
how is that possible?I have a forum SMF 2.0.1 but cant have Titled Links :(
Title: Re: Titled Links
Post by: live627 on January 01, 2012, 06:11:43 PM
This installs without error on 2.0.2 with emulation to 2.0 RC3.
Title: Re: Titled Links
Post by: lifeguard81 on July 17, 2012, 09:54:34 AM
Quote from: live627 on January 01, 2012, 06:11:43 PM
This installs without error on 2.0.2 with emulation to 2.0 RC3.
Yes, it will install, but doesnt work.
Title: Re: Titled Links
Post by: DaKrampus on August 26, 2012, 03:23:51 AM
Quote from: yakyakyak on June 11, 2011, 08:42:00 AM
Tried this out and must say it's not really practical.

share a link from anywhere on the forum ie. moderators only board and post it in admin only and all it translates to is Login

please expand what sense is there in the current way links are translated as guest only view or am i missing something?

thanks

I did a workaround.....
find in Subs-Post.php:
// w00t!  Changin the link to titlize it (is that word?)
Above (!!!) add:

if(strlen($title)<6)
{
$urix = $uri;
if(strpos($uri, '?') !== false)
{
$urix = str_replace('?','\?', $uri);
}
if(strpos($urix, '&') !== false)
{
$urix = str_replace('&','\&', $urix);
}
$message = preg_replace('~\[url\]' . $urix . '\[/url%\]~', $uri, $message);
continue;
}


This will skip converting for all titles shorter than 6 chars... ("Login" has 5 chars and is skipped)
If you are using non-english utf8, and the word login (check in $txt[34]) has non-standard chars in it, you would have to replace strlen($title) with mb_strlen($title,'UTF-8')
Attention: it will also skip external titles that are shorter than 6 chars... but i prefer the real link to such a short title for external links anyway)
Da
Title: Re: Titled Links
Post by: DaKrampus on August 26, 2012, 05:19:39 AM
Ah and btw found a little bug.

find:
// If our counter has exceeded the amount, replace the remaining urls back to what they were and get outta dodge.
if(!empty($modSettings['title_url_count']) && $title_counter++ >= $modSettings['title_url_count'])
{
$message = preg_replace('~\[url\]' . $uri . '\[/url%\]~', $uri, $message);
continue;
}


problem is, if there is a ? (questionmark) in the uri, it will break the regex... (only happens if the urlcount is higher than the one in the settings and if the url contains a "?" )
so here is my fix:
replace with
// If our counter has exceeded the amount, replace the remaining urls back to what they were and get outta dodge.
if(!empty($modSettings['title_url_count']) && $title_counter++ >= $modSettings['title_url_count'])
{

$urix = $uri;
if(strpos($uri, '?') !== false)
{
$urix = str_replace('?','\?', $uri);
}
if(strpos($urix, '&') !== false)
{
$urix = str_replace('&','\&', $urix);
}
$message = preg_replace('~\[url\]' . $urix . '\[/url%\]~', $uri, $message);
continue;
}

hope it helps...

Da
Title: Re: Titled Links
Post by: qubbah on March 04, 2013, 08:45:34 PM
what is the different between this mod with show the local url. tq
Title: Re: Titled Links
Post by: Mick. on March 04, 2013, 09:09:28 PM
I looked at that mod and my first thought is that, local urls. No external ones.
Title: Re: Titled Links
Post by: Biology Forums on September 25, 2013, 08:41:38 PM
Is there any other method to accomplish this without the extensive coding?
Title: Re: Titled Links
Post by: Arantor on September 25, 2013, 08:42:17 PM
Um... no?
Title: Re: Titled Links
Post by: Biology Forums on April 01, 2014, 02:32:58 PM
Just tested this mod on a fresh install of 1.1.19 and it doesn't work.
Title: Re: Titled Links
Post by: Biology Forums on August 19, 2014, 01:12:04 PM
One problem I have with this is that it converts all links. I believe that if links are embedded in [url][/url], it should show the link URL instead of the title.
Title: Re: Titled Links
Post by: spiros on March 31, 2019, 08:47:21 AM
Just tested and it says not compatible with 2.0.15.
Title: Re: Titled Links
Post by: lurkalot on March 31, 2019, 09:11:52 AM
Quote from: spiros on March 31, 2019, 08:47:21 AM
Just tested and it says not compatible with 2.0.15.

Yes the install says, <install for="2.0 RC3">
Title: Re: Titled Links
Post by: shadav on September 19, 2019, 12:29:23 PM
this doesn't seem to work  :(

2.0.15

installed emulating  2.0 RC4
went to post settings and clicked the box for Convert links to titled URL's and left the setting at 0 for Maximum URLs to title

i've tested posting links but they don't convert

I uploaded convert_urls.php and tried to run it but getting a 500 error

Title: Re: Titled Links
Post by: Mick. on September 19, 2019, 06:49:39 PM
@shadav This mod is very old.

In Sources/Subs-Post.php find:



// Time to do some cool stuff with URL's
if (!$previewing && $modSettings['convert_urls'])
{

// We're gonna save the old socket timeout, reduce it down to 3 seconds, so we prevent this from hanging up
// We are supressing the errors in case the user cannot change this value on their server.
$timeout = ini_get('default_socket_timeout');
@ini_set('default_socket_timeout',3);

$message = preg_replace(array('~(?<=[\s>\.(;\'"]|^)((?:http)://[\w\-_%@:|]+(?:\.[\w\-_%]+)*(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i', '~(?<=[\s>(\'<]|^)(www(?:\.[\w\-_]+)+(?::\d+)?(?:/[\w\-_\~%\.@,\?&;=#+:\'\\\\]*|[\(\{][\w\-_\~%\.@,\?&;=#(){}+:\'\\\\]*)*[/\w\-_\~%@\?;=#}\\\\])~i'), array('[url]$1[/url%]', '[url]$1[/url%]'), $message);

// Now we find the urls that we just changed, so we can run through them and get titles
preg_match_all("~\[url\](.+?)\[/url%\]~smi", $message, $urls);

if (!empty($urls[0]))
{

// Lets make a counter so we don't exceed the settings...
$title_counter = 0;
foreach($urls[1] as $uri)
{
// If our counter has exceeded the amount, replace the remaining urls back to what they were and get outta dodge.
if(!empty($modSettings['title_url_count']) && $title_counter++ >= $modSettings['title_url_count'])
{
$message = preg_replace('~\[url\]' . $uri . '\[/url%\]~', $uri, $message);
continue;
}

// Attach http:// to the url...
$uri_modified = strpos($uri, 'http://') === false ? 'http://' . $uri : $uri;

// Use the @ to suppress errors from the function not finding a url, which will still return false if
// there is an error.  This just prevents the error log from filling up without cause.
// In 2.0, we have fetch_web_data() which makes our lives easier :)
require_once($sourcedir . '/Subs-Package.php');
$request = @fetch_web_data($uri_modified);

if ($request !== false && preg_match('~<title>(.+?)</title>~smi', $request, $matches))
{
$title = $smcFunc['htmlspecialchars'](stripslashes($matches[1]), ENT_QUOTES);
// Need to fix the &amp;amp;
$title = str_replace('&amp;amp;', '&amp;', $title);
// w00t!  Changin the link to titlize it (is that word?)
$message = str_replace('[url]' . $uri . '[/url%]', '[url=' . $uri_modified . ']' . $title . '[/url]', $message);
}

// Looks like we couldn't get the title, darn.  Back to the original we go...
else
$message = str_replace('[url]' . $uri . '[/url%]', $uri, $message);
}
}
// Change it back to what it was.  Suppress again incase...
@ini_set('default_socket_timeout',$timeout);
}


There are 3 instances of http. Change it to https. I will update the package when i can. Ty.
Title: Re: Titled Links
Post by: 1.1Nerd on September 03, 2020, 10:19:01 PM
Hello, the package for this mod seems to be broken. It is not a compressed but bare php file. Could you please reupload it? Thank you!
Title: Re: Titled Links
Post by: Mick. on September 04, 2020, 04:49:57 PM
Quote from: 1.1Nerd on September 03, 2020, 10:19:01 PM
Hello, the package for this mod seems to be broken. It is not a compressed but bare php file. Could you please reupload it? Thank you!
Not sure why it was missing. Try again.
Title: Re: Titled Links
Post by: 1.1Nerd on September 05, 2020, 04:44:36 AM
Hello Mick, thank you. The package download now worked but the current package no longer seems to be supporting the SMF 1.1 branch - I wanted to use that package on my old 1.1 Board. Could you please kindly provide the 1.2 (?) version wich still support the 1.1 branch. Thank you!
Title: Re: Titled Links
Post by: spiros on September 05, 2020, 05:13:31 AM
I tried the latest version of the mod but when I modify a post and paste a forum topic URL and then click save nothing happens. Also, I cannot find anywhere on admin panel its settings.

I also tried the convert_urls script on SMF 2.0.17 and it gives HTTP ERROR 500
Title: Re: Titled Links
Post by: alexetgus on September 05, 2020, 07:13:29 AM
Hi!

Oooooh! That's a very good idea! :)
I'll test it quickly ;)


EDIT :
Why don't you use the SSI.php file for the script convert_urls.php? You'd avoid a lot of trouble.


Title: Re: Titled Links
Post by: alexetgus on September 05, 2020, 07:52:37 AM
I have just tested very quickly and I already have one or two questions:

- The mod doesn't follow redirections?! (Example : No WWW to WWW, HTTP to HTTPS)
- I have the impression that the mod only follows HTTPS links, am i right?
- A BBCode tag (any one) prevents the title on the link, not just the URL & IURL tags. It's a pity.

- Exceptions should be added, for localhost for example... ;)


EDIT

The file convert_urls.php is obsolete for PHP 7.x...
Use SSI.php and the SMF functions for fix the problem!
Title: Re: Titled Links
Post by: spiros on September 05, 2020, 09:47:42 AM
Quote from: alexetgus on September 05, 2020, 07:13:29 AM
EDIT :
Why don't you use the SSI.php file for the script convert_urls.php? You'd avoid a lot of trouble.

Hi, not sure how that can be done. Sorry, not a coder :)
Title: Re: Titled Links
Post by: alexetgus on September 05, 2020, 09:55:43 AM
Ah! Indeed.
Too bad, it's a real shame.

Yet SSI.php is easy to use, it's as if you were on SMF in an external page.
Look here : https://wiki.simplemachines.org/smf/Category:SSI (https://wiki.simplemachines.org/smf/Category:SSI)

If you were using SSI.php, your convert_urls.php file would be usable.
Title: Re: Titled Links
Post by: spiros on September 05, 2020, 10:00:54 AM
Quote from: spiros on September 05, 2020, 09:47:42 AM
Sorry, not a coder :)

Quote from: alexetgus on September 05, 2020, 09:55:43 AM
If you were using SSI.php, your convert_urls.php file would be usable.

Looks like this needs coding to me :)
Title: Re: Titled Links
Post by: alexetgus on September 05, 2020, 10:03:54 AM
Okay, i'll shut up... :-X

And yet, you have created a mod, you the non-coder... :-\

But! :-X :-X :-X
Title: Re: Titled Links
Post by: shadav on September 05, 2020, 11:49:42 AM
Quote from: alexetgus on September 05, 2020, 10:03:54 AM
Okay, i'll shut up... :-X

And yet, you have created a mod, you the non-coder... :-\

But! :-X :-X :-X

I think you are confused ;)
they didn't create the mod, they are just trying to use it

Mick is currently the one supporting the mod

Quote from: Mick. on July 14, 2007, 12:18:47 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=835)

Titled Links


Created By: SlammedDime
Taken Over: JBlaze
Updated By: JBlaze
Taken Over: idesignSMF
Updated By: idesignSMF
Compatible: SMF 2.0
Title: Re: Titled Links
Post by: alexetgus on September 05, 2020, 12:00:45 PM
It's a real shame, this Mod is a great idea!

As far as I'm concerned, I'm going to try to apply what I proposed earlier.
Then I don't know if I will be allowed to publish my work at SMF.
There is no license. I guess it's a free licence if no licence is specified.
In any case, even if SMF refuses, I will publish my work on my Github account.

Title: Re: Titled Links
Post by: Arantor on September 05, 2020, 12:32:18 PM
Quote from: alexetgus on September 05, 2020, 12:00:45 PM
It's a real shame, this Mod is a great idea!

As far as I'm concerned, I'm going to try to apply what I proposed earlier.
Then I don't know if I will be allowed to publish my work at SMF.
There is no license. I guess it's a free licence if no licence is specified.
In any case, even if SMF refuses, I will publish my work on my Github account.



A lack of licence does NOT mean you can just do what you like. On the contrary, it means you have zero rights beyond what is implied by being on this site - that you can use it. That's what copyright law says.

You are fine to post changes on *this* site, ideally in this thread, as a series of changes (not even a modified package) but that's about it. Publishing to your GitHub is a violation of copyright law without the permission of the current author.
Title: Re: Titled Links
Post by: alexetgus on September 05, 2020, 02:24:20 PM
I assume that a Mod that is released without a license inherits the SMF BSD license, which is a free license.
If our friend wanted to impose certain restrictions on his mod, it had to be done by choosing the right license. No ?

I have published 2 Mods and in these Mods there is a GNU license. ;)

Title: Re: Titled Links
Post by: SychO on September 05, 2020, 02:32:21 PM
Quote from: alexetgus on September 05, 2020, 02:24:20 PM
I assume that a Mod that is released without a license inherits the SMF BSD license, which is a free license.

Not really no, a mod without a license is a mod without a license. Unfortunately you cannot make that assumption :-\
Title: Re: Titled Links
Post by: Arantor on September 05, 2020, 02:54:48 PM
Worse, this mod is old enough that it predates SMF's BSD licence so if you made *that* assumption, you'd be on even shakier legal ground.

This is why you cannot make this assumption and when no licence is present, assume you do not have permission. Especially as SlammedDime, who contributed to this mod, frequently tagged his mods CC-SA-ND which would prevent modified versions.

And while we're on the subject, GPL licensed mods for SMF are probably on equally dubious grounds if the FSF's interpretation of the licence were ever to be taken, because they would presume that the underlying code for SMF was available on copyleft grounds as strong as the GPL provides, *which it is not*. But that's a whole other story and an argument I really don't want to have today. (Long story short: the only time you can *safely* legally make an SMF mod GPL is if the entirety of its code makes zero changes to SMF and uses no SMF code in it. The minute you do file edits, you have a legal problem. Similar story with the APL or the MPL, and massively so for the AGPL. The only truly safe licence in this context you can make a mod available under is the BSD licence, and you can't release a mod previously not under that licence as under that licence without permission from the copyright holder(s).)
Title: Re: Titled Links
Post by: alexetgus on September 05, 2020, 06:48:32 PM
Information taken, "an oeuvre" without indication of licence is automatically under copyleft, in the public domain.
It is up to the author and the author alone to submit his code to a licence. If he does not do so, the code is free to be taken up, modified, distributed, sold, etc...

Originally, we don't even know where this code comes from. It was non-coders who presented it without a licence...
If there was a breach of licence, it was certainly not by me.
Title: Re: Titled Links
Post by: Arantor on September 05, 2020, 07:33:16 PM
No, it really isn't. Under the Berne convention it is copyrighted to the author with no implied onwards rights. If that were truly so, SMF wouldn't nearly have imploded 10 years ago when the developers threatened to remove their code from the project. But it isn't so, and copyright exists. Copy left as you suggest is not automatic and is explicitly granted over and above the provisions of copyright law by the license itself.

There is some leeway because transferring a mod's ownership implies some rights held by the receiver and it is on their discretion alone that you might be able to share it elsewhere.
Title: Re: Titled Links
Post by: alexetgus on September 05, 2020, 07:37:35 PM
Anyway, i will first modify and improve this Mod for me.
Then we'll see if anyone is interested.

We're not talking about millions of dollars, but just an SMF Mod that I'd like to see improved. ;)
Title: Re: Titled Links
Post by: Arantor on September 05, 2020, 07:49:59 PM
Posting here in this thread will be fine. It's only anything else that's troublesome.
Title: Re: Titled Links
Post by: 1.1Nerd on September 06, 2020, 07:12:43 AM
Any heads up on the version compatible with SMF 1.1? Thank you
Title: Re: Titled Links
Post by: Arantor on September 06, 2020, 07:31:42 AM
Unlikely to still exist. It was written a decade ago, by a different author who doesn't keep his old mods.

And as you can see from recent notes, the 2.0 version has some issues which the 1.1 version would also have if it still existed, but it probably doesn't.
Title: Re: Titled Links
Post by: alexetgus on October 01, 2020, 07:46:18 AM
Hi,

I have just discovered a bug (for admins).
When BBCode HTML is used, the mod still converts the links.

For example:
[html]<iframe title="Arte - Le godcast de Dieu" data-dnt-embed data-src="https://www.arteradio.com/son/61664529/godcast_le_podcast_de_dieu?embed" style="border:1px #DADADA solid;" name="" scrolling="no" scrolling="no" align="bottom" width="600" height="125"></iframe>[/html]


Becomes:
[html]<iframe title="Arte - Le godcast de Dieu" data-dnt-embed data-src="[url=https://www.arteradio.com/son/61664529/godcast_le_podcast_de_dieu?embed"]Godcast, le podcast de Dieu | ARTE Radio[/url] style="border:1px #DADADA solid;" name="" scrolling="no" scrolling="no" align="bottom" width="600" height="125"></iframe>[/html]



This forces you to deactivate the mod, post your message, then reactivate the mod.
It is not very practical...