collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 220
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Blocks speak! Do you have an interest in getting more blocks - or even making your own? The Blocks Board is for you!

Author Topic: Auto tiny urls in chat  (Read 14133 times)

0 Members and 1 Guest are viewing this topic.

Offline TigPT

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 1.1.8
  • SP Version: 2.2
Auto tiny urls in chat
« on: January 13, 2010, 08:29:41 PM »
First of all, gratz for your great work.

Would be great if you could add a auto tiny url converter like tiny url or goo.gl service so che urls past in the chat box don't become so borring in space and sometimes breaking the layout.

Anyone else think that this will be a interesting feature?

Anyone know if it will be easy to implement and want to start it?

(sadly i don't have know-how for that so i do my best with brainstorming :))

Offline H

  • Comrade
  • *
  • Posts: 656
  • Gender: Male
  • SMF Version: None
  • SP Version: None
Re: Auto tiny urls in chat
« Reply #1 on: January 14, 2010, 02:55:21 PM »
Really there is no need to use an external service like tinyurl. Instead you could just replace the link with the text link (e.g link)

I think this'd be a good idea though
-HFormer Simple Machines Support

Offline Robbo

  • Beer is good!
  • Comrade
  • *
  • Posts: 223
  • Gender: Male
    • Australian Savage (Game Community)
  • SMF Version: 2 RC1.2
  • SP Version: None
Re: Auto tiny urls in chat
« Reply #2 on: January 18, 2010, 11:33:42 AM »
Making a mod for this now. Will most likely be added to the next version of SP.

Offline TigPT

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 1.1.8
  • SP Version: 2.2
Re: Auto tiny urls in chat
« Reply #3 on: January 18, 2010, 11:35:44 AM »
thanks for the feedback. Think it will be a lot interesting.

Offline Robbo

  • Beer is good!
  • Comrade
  • *
  • Posts: 223
  • Gender: Male
    • Australian Savage (Game Community)
  • SMF Version: 2 RC1.2
  • SP Version: None
Re: Auto tiny urls in chat
« Reply #4 on: January 18, 2010, 01:44:28 PM »
This should work fine. The only thing it doesn't do is update with AJAX. So when you first post with AJAX you won't see the link converted however everyone else would and you will once the page is loaded again.

Package attached.

EDIT: removed package, was broken.
« Last Edit: January 19, 2010, 05:53:35 PM by Robbo »

Offline TigPT

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 1.1.8
  • SP Version: 2.2
Re: Auto tiny urls in chat
« Reply #5 on: January 18, 2010, 02:06:32 PM »
Think that will be very good for now. Just bad that i installed it and it seems to not be working.

Installed all fine but when i past a big url like this one it keeps the same.
http://lusorobotica.com/index.php/topic,1908.0.html

Offline Robbo

  • Beer is good!
  • Comrade
  • *
  • Posts: 223
  • Gender: Male
    • Australian Savage (Game Community)
  • SMF Version: 2 RC1.2
  • SP Version: None
Re: Auto tiny urls in chat
« Reply #6 on: January 18, 2010, 02:11:32 PM »
You need to set it in the shoutbox settings btw.

I probably should have mentioned that...

Offline TigPT

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 1.1.8
  • SP Version: 2.2
Re: Auto tiny urls in chat
« Reply #7 on: January 18, 2010, 02:12:58 PM »
You need to set it in the shoutbox settings btw.

I probably should have mentioned that...

I did inserted the url "link" in the settings, but it replaces de url too.

Check out our checkbox:
http://lusorobotica.com/index.php

And as i can look at code, it looks like it only will work for inside links, and not for external ones. Am i right?

Offline Robbo

  • Beer is good!
  • Comrade
  • *
  • Posts: 223
  • Gender: Male
    • Australian Savage (Game Community)
  • SMF Version: 2 RC1.2
  • SP Version: None
Re: Auto tiny urls in chat
« Reply #8 on: January 18, 2010, 02:14:44 PM »
Ah crap. I have the same problem. I'll quickly fix it...

Offline TigPT

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 1.1.8
  • SP Version: 2.2
Re: Auto tiny urls in chat
« Reply #9 on: January 18, 2010, 02:24:50 PM »
No problem. Thats why we are a community, to help each others.

Thanks a lot for being development a feature that i would like but can't do myself :P

Offline Robbo

  • Beer is good!
  • Comrade
  • *
  • Posts: 223
  • Gender: Male
    • Australian Savage (Game Community)
  • SMF Version: 2 RC1.2
  • SP Version: None
Re: Auto tiny urls in chat
« Reply #10 on: January 18, 2010, 02:32:42 PM »
It is a problem with my REGEX. I'm too tired to fix it now, I'll just make more mistakes. Should be done by this time tomorrow though.

*goes to sleep*

Offline TigPT

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 1.1.8
  • SP Version: 2.2
Re: Auto tiny urls in chat
« Reply #11 on: January 18, 2010, 02:33:43 PM »
Sure, sleep well.

Offline Robbo

  • Beer is good!
  • Comrade
  • *
  • Posts: 223
  • Gender: Male
    • Australian Savage (Game Community)
  • SMF Version: 2 RC1.2
  • SP Version: None
Re: Auto tiny urls in chat
« Reply #12 on: January 19, 2010, 05:54:00 PM »
Ok this should work fine now...

Attached.

Offline TigPT

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 1.1.8
  • SP Version: 2.2
Re: Auto tiny urls in chat
« Reply #13 on: January 19, 2010, 06:06:01 PM »
I'm getting a error installing the package:
Quote
.   Adicionar Depois   ./Sources/Subs-Portal.php   Teste falhado
Quote
Encontrar [Seleccione]
while ($row = mysql_fetch_assoc($request))
      {
Adicionar Depois [Seleccione]

            // Convert links...
            if (!empty($parameters['link']))
                $row['body'] = preg_replace('#(([a-zA-Z]+://)([a-zA-Z0-9?&%.;:/=+_-]*))#', '' . $parameters['link'] . '', $row['body']);

Offline Robbo

  • Beer is good!
  • Comrade
  • *
  • Posts: 223
  • Gender: Male
    • Australian Savage (Game Community)
  • SMF Version: 2 RC1.2
  • SP Version: None
Re: Auto tiny urls in chat
« Reply #14 on: January 19, 2010, 07:01:56 PM »
*sigh*

Can you translate that for me?

Offline TigPT

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 1.1.8
  • SP Version: 2.2
Re: Auto tiny urls in chat
« Reply #15 on: January 19, 2010, 07:05:37 PM »
Translation
Quote
.   Add after   ./Sources/Subs-Portal.php   Test Faild
Quote
Find [Seleccione]
while ($row = mysql_fetch_assoc($request))
      {
Add after [Seleccione]

            // Convert links...
            if (!empty($parameters['link']))
                $row['body'] = preg_replace('#(([a-zA-Z]+://)([a-zA-Z0-9?&%.;:/=+_-]*))#', '' . $parameters['link'] . '', $row['body']);

Offline Robbo

  • Beer is good!
  • Comrade
  • *
  • Posts: 223
  • Gender: Male
    • Australian Savage (Game Community)
  • SMF Version: 2 RC1.2
  • SP Version: None
Re: Auto tiny urls in chat
« Reply #16 on: January 19, 2010, 07:12:05 PM »
Oh you are on an old version of Simple Portal? This mod is only tested on SMF 2.0 RC2 + SP 2.3.1 and SMF 1.1.11 + SP 2.3.1

Offline TigPT

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 1.1.8
  • SP Version: 2.2
Re: Auto tiny urls in chat
« Reply #17 on: January 19, 2010, 07:17:23 PM »
I'm running SMF 2.0 RC2 and SP 2.3.1

http://lusorobotica.com/

Offline Robbo

  • Beer is good!
  • Comrade
  • *
  • Posts: 223
  • Gender: Male
    • Australian Savage (Game Community)
  • SMF Version: 2 RC1.2
  • SP Version: None
Re: Auto tiny urls in chat
« Reply #18 on: January 19, 2010, 11:22:57 PM »
Hmmm, I will have another look at it tonight. Actually looking at your post I think it might be a simple typo. I'll get onto it as soon as possible.

*hates making stupid mistakes*

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Auto tiny urls in chat
« Reply #19 on: January 20, 2010, 02:09:08 PM »
Although it can be optimized more, this should do it:

./Sources/Subs-Portal.php

Code: (Find) [Select]
$shouts[$shout['id']]['text'] = censorText($shouts[$shout['id']]['text']);
Code: (Replace) [Select]
$shouts[$shout['id']]['text'] = censorText($shouts[$shout['id']]['text']);
$shouts[$shout['id']]['text'] = preg_replace('~<a([^>]+>)([^<]+)</a>~', '<a$1[link]</a>', $shouts[$shout['id']]['text']);
And slowly, you come to realize... It's all as it should be...

Offline TigPT

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 1.1.8
  • SP Version: 2.2
Re: Auto tiny urls in chat
« Reply #20 on: January 20, 2010, 06:40:55 PM »
it looks like that ajax was in infinit loop and my hosting team shouted down the server due to the extreme bandwith consuption. :|

Any help on how to remove it is apreciated ;)

Offline TigPT

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 1.1.8
  • SP Version: 2.2
Re: Auto tiny urls in chat
« Reply #21 on: January 20, 2010, 08:02:24 PM »
HostGator worked very well and the server is back on. I disabled the shoutbox for now, and backuped everything in order to format and reinstall.

Need it as fresh as possible so i will not be testing this new mod in the working copy of it :P

By the way, don't use it for now since it have that bug in the ajax causing a infinit loop of calls.

Offline Robbo

  • Beer is good!
  • Comrade
  • *
  • Posts: 223
  • Gender: Male
    • Australian Savage (Game Community)
  • SMF Version: 2 RC1.2
  • SP Version: None
Re: Auto tiny urls in chat
« Reply #22 on: January 20, 2010, 10:58:06 PM »
Although it can be optimized more, this should do it:

./Sources/Subs-Portal.php

Code: (Find) [Select]
$shouts[$shout['id']]['text'] = censorText($shouts[$shout['id']]['text']);
Code: (Replace) [Select]
$shouts[$shout['id']]['text'] = censorText($shouts[$shout['id']]['text']);
$shouts[$shout['id']]['text'] = preg_replace('~<a([^>]+>)([^<]+)</a>~', '<a$1[link]</a>', $shouts[$shout['id']]['text']);
Yeah I was going to do that but I am shit at regex and took the lazy way out.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Auto tiny urls in chat
« Reply #23 on: January 21, 2010, 03:00:49 AM »
HostGator worked very well and the server is back on. I disabled the shoutbox for now, and backuped everything in order to format and reinstall.

Need it as fresh as possible so i will not be testing this new mod in the working copy of it :P

By the way, don't use it for now since it have that bug in the ajax causing a infinit loop of calls.

I don't think it is infinite AJAX loops, but might be this:

http://simpleportal.net/index.php?topic=4126.msg26219#msg26219

In any case, please start a new topic about your issue.
And slowly, you come to realize... It's all as it should be...