ed2k links support (with bb-codes)

Started by tFF, April 05, 2007, 07:28:10 AM

Previous topic - Next topic

coris

Hello, thanks for the mod, but it give me this error:

Parse error: syntax error, unexpected '.' in /mounted-storage/home91a/sub007/sc42775-VLOU/thephoenix-team.com/smf/Sources/Subs.php on line 1863

$data = preg_replace('~(?<=[\s>\.(;\'"]|^)(ed2k://\|file\|(.+?)\|.+?)(?=[?,\s\[\]()*\\\]|$|<br />|&nbsp;|&gt;|&lt;|&quot;|'|\.(?:\.|;|&nbsp;|\s|$|<br />))~i', '[ed2k]$1[/ed2k]', $data);

tFF

#41
Quote from: coris on May 30, 2008, 03:39:53 PM
Hello, thanks for the mod, but it give me this error:

Strange things are.

In the notification of your post by e-mail i've got the following code fragment:
// tFF - ed2k // eDonkey links then...
               if (!isset($disabled['ed2k']) && strpos($data, 'ed2k://') !== false)
               {
                     $data = preg_replace('~(?<=[\s>\.(;\'"]|^)(ed2k://\|file\|(.+?)\|.+?)(?=[?,\s\[\]()*\\\]|$|<br />|&nbsp;|&gt;|&lt;|&quot;|'|\.(?:\.|;|&nbsp;|\s|$|<br />))~i', '[ed2k]$1[/ed2k]', $data);
               }
               // tFF - ed2k

But here in your post there is a single line of code and no any reference that you had modified the post. So, merging all together I'm able to locate the exact place. And here comes the second funny thing.

The second funny thing is: I see no such line of code u mentioned above. I've just searched thru all versions of the mod i ever released (3.0.1 - 3.1.1). Nothing.

Take a look at the latest version (3.1.1), the code should be like this there:
// tFF - ed2k
// eDonkey links then...
if (!isset($disabled['ed2k']) && strpos($data, 'ed2k://') !== false)
{
$data = preg_replace('~(?<=[\s>\.(;\'"]|^)(ed2k://\|file\|(.+?)\|.+?)(?=[?,\s\[\]()*\\\]|$|<br />|&nbsp;|&gt;|&lt;|&quot;|&#039;|\.(?:\.|;|&nbsp;|\s|$|<br />))~i', '[ed2k]$1[/ed2k]', $data);
}
// /tFF - ed2k


Compare
yours:

$data = preg_replace('~(?<=[\s>\.(;\'"]|^)(ed2k://\|file\|(.+?)\|.+?)(?=[?,\s\[\]()*\\\]|$|<br />|&nbsp;|&gt;|&lt;|&quot;|'|\.(?:\.|;|&nbsp;|\s|$|<br />))~i', '[ed2k]$1[/ed2k]', $data);

and mine:

$data = preg_replace('~(?<=[\s>\.(;\'"]|^)(ed2k://\|file\|(.+?)\|.+?)(?=[?,\s\[\]()*\\\]|$|<br />|&nbsp;|&gt;|&lt;|&quot;|&#039;|\.(?:\.|;|&nbsp;|\s|$|<br />))~i', '[ed2k]$1[/ed2k]', $data);


Finally. As far as your code is not original, I won't parse your regular expression and the code for errors. I have no idea what is that to the moment.

Later:
Ok... I see the difference:
"&#039;" in mine turned into "'" (single quote) in yours thus it terminates the string and makes the code invalid.
Fix it and see what happens.
So it goes...

coris

#42
Thanks tFF, now works perfectly. I follow the instructions from this link: http://custom.simplemachines.org/mods/index.php?mod=716

Maybe, you should update it, to fix that error.

Thanks again

LATER

This type of e-link doesn't work:
ed2k://|file|(ThePhoenixTeam) Super GALS! -DVDRip Dual- 27 [CA4A4319].mkv|295222080|3D73494CC43364459AEABB96A5EF2370|h=O7UIOJZ4KHSWIQ43GJVZKYBIN5RPQ26X|/

It could be because it have the CRC code?

Another things, the spaces code (%20) can't disapeared and turn to a space in the link?

tFF

#43
Quote from: coris on May 30, 2008, 04:54:13 PM
Maybe, you should update it, to fix that error.
I can't update that stuff. As far as i can see, manual installation instruction is purely automatic: guess, it parses mod's installation script and renders it on a page. Somehow it also converts symbol codes into alphanumeric representation.

It's time for bug report to simplemachines' web-developers.. I would be grateful if you sent them such report. :)

Quote from: coris on May 30, 2008, 04:54:13 PM
LATER

This type of e-link doesn't work:
ed2k://|file|(ThePhoenixTeam) Super GALS! -DVDRip Dual- 27 [CA4A4319].mkv|295222080|3D73494CC43364459AEABB96A5EF2370|h=O7UIOJZ4KHSWIQ43GJVZKYBIN5RPQ26X|/

It could be because it have the CRC code?
Have no idea... I'll check when time permits.

Quote from: coris on May 30, 2008, 04:54:13 PM
Another things, the spaces code (%20) can't disapeared and turn to a space in the link?
Yeah... I've got such requests in this thread already and i could only advise to replace spaces with something else as far as filename means not as too much for ed2k-link as its hash.
Honestly, I haven't updated myself to SMF 1.1.5 yet and that's why I've postponed further requests implementation and development until i have some time to update my forum, check twice and then implement all todos and stuff.
So it goes...

coris

Yes, I know that the filename is not really important as the hash, but is more pretty to see the links with the spaces in the link :P

Thanks for your time

ë®â§e®

Can i update the mod with 1.1.5 version? I tried to do it manually bu it doesn't readed the bbcode e so anything has changed...  How to add manually informations about file's size ?

tFF

Quote from: ë®â§e® on June 04, 2008, 09:21:19 AM
Can i update the mod with 1.1.5 version? I tried to do it manually bu it doesn't readed the bbcode e so anything has changed...  How to add manually informations about file's size ?
I'll do my best to update it as soon as possible. Sorry for inconvenience.
So it goes...

ë®â§e®

ok guy, i'll wait for your update, see you soon, bye

tFF

#48
I've just installed clean SMF115 (not an update from 114). Then applied the mod, everything has been installed successfully. So current release has just been promoted to be 1.1.5 compatible.

Second, you could try to download the mod for installation from your hard drive (with 'Browse'). In the mod's installation script it is stated that the mod is compatible with SMF from 1.1.1 thru 1.1.99 and 1.1 (1.1 branch in brief).

Finally, I do remember that there were some problems (in this thread) that the mod couldn't be installed on an older upgraded SMF. That was fixed in previous releases and shouldn't occur. Nevertheless I'll check it later on.

Added later:
Finally, I've tested the mod on both installations: fresh and upgraded (1.1.3 thru 1.1.5). Everything works fine.

Next release will address issues with spaces and linefeeds.
So it goes...

coris

Quote from: coris on May 30, 2008, 04:54:13 PM
This type of e-link doesn't work:
ed2k://|file|(ThePhoenixTeam) Super GALS! -DVDRip Dual- 27 [CA4A4319].mkv|295222080|3D73494CC43364459AEABB96A5EF2370|h=O7UIOJZ4KHSWIQ43GJVZKYBIN5RPQ26X|/

I found why this type of e-link doesn't work. Is beacuse the brackets. I hope that you can fix that, cause this mod is relly usefull.

Thanks again

ë®â§e®


tFF

#51
Quote from: coris on June 05, 2008, 04:10:13 PM
I found why this type of e-link doesn't work. Is beacuse the brackets. I hope that you can fix that, cause this mod is relly usefull.
Not simply 'brackets' but SQUARE brackets u mean. The answer is: no chance to fix it for the way you post your link.
SQUARE brackets are reserved for bb-codes... So if u trace smf's bb-codes parsing logic then u'll see that

  • before we parse we have
ed2k://|file|(ThePhoenixTeam) Super GALS! -DVDRip Dual- 27 [CA4A4319].mkv|295222080|3D73494CC43364459AEABB96A5EF2370|h=O7UIOJZ4KHSWIQ43GJVZKYBIN5RPQ26X|/
  • then SMF starts splitting text into text itself and bb-codes separately (oversimplified)
  • as a result we get BEFORE we come to bb-codes
    ed2k://|file|(ThePhoenixTeam) Super GALS! -DVDRip Dual- 27 [

    • This is it. Finita. Hence you don't get what you expect. Ed2k-mod's routines even don't get touched at this point.
    Q: How to fix it?
    A: Just use [ed2k] tags instead of simply throwing a link with square brackets inside alone.
So it goes...

coris

#52
Ok, thanks tFF. I'll use that form. Finally I hope that you can fix the issue with the spaces :)

I hope not being very tedious.

coris

tFF have you take a look about how to fix the spaces in the names of e-links?

Thanks.

tFF

Quote from: coris on July 01, 2008, 12:28:32 PM
tFF have you take a look about how to fix the spaces in the names of e-links?
haven't yet. sorry. that summer season gives no chance for free coding. :) i'll do my best to fix it as soon as possible.
So it goes...

coris

Ok tFF. No problem, when you can will be ok :)

coris


tFF

So it goes...

EkSeS

Quote from: tFF on August 18, 2008, 03:47:37 PM
Quote from: coris on August 18, 2008, 03:44:39 PM
There's any new? Thanks
September. I'll do my best. I'll try. :)

Now it's March :)

Do someone think about update this package to smf rc1 ( or later rc2 ) ?

tFF

Hello everyone.

Quote from: EkSeS on March 17, 2009, 11:19:12 PM
Do someone think about update this package to smf rc1 ( or later rc2 ) ?
I think it's no sense to upgrade this mod for RC.
Let's wait for SMF2 release and see if EDonkey mod is still requested.
So it goes...

Advertisement: