Diferior CMS on steroids
+1456 / 2338669 ( online 7 )

another sugestion, regarding text formating


Forum posts: 21
brosky (Member) @ 08 03 28 - 14:40:51
Hi,

I've noticed that in torrent description, html is not allowed, or parsed.

It will be much more simple to have the same engine from blog for entering description for torrents.

Like, in blogs you are allowed html code (usefull for images, links, video boxes), but on torrent description you don't have that, only images, and links.

About the links, i have the [url]...[/url] tag.. inside the tag i should write the http link and it displays the entire link... how can i use it to have the link with a chosen name, like in <a href...link> chosen name </a> ?
Avatar
Blog posts: 11
Added downloads: 2
Comments: 18
Forum posts: 573
UnrealX (Lead code monkey) @ 08 03 28 - 20:31:56
HTML is not allowed becouse users can submit downloads aswell. Allowing html would also allow for XSS attacks. I could probably work around that by not allowing HTML for ordinary users.

As for link, try it like this: [ url=http://diferior.com]Diferior[/url]
Forum posts: 21
brosky (Member) @ 08 03 28 - 22:03:19
ok, no html, but can you allow some tags ?
like, the youtube <object>

we need this, because when we submit a movie or a game, it's nicer to have a trailer/gameplay video.
Avatar
Blog posts: 11
Added downloads: 2
Comments: 18
Forum posts: 573
UnrealX (Lead code monkey) @ 08 03 28 - 22:35:19
That's true. I'll see what I can do.
Forum posts: 21
brosky (Member) @ 08 03 28 - 23:18:16
That's true. I'll see what I can do.

as I recall, there is a BBCode tag for youtube clips..

after asking google about it, i've found several tutorials about how to make it, but i don't know where you defined the actual bbcodes... tpl_resources/skio/scripts/post.js ?

anyway, you do I fine job :) i won't mess with my site, maybe i will broke something...
Avatar
Blog posts: 11
Added downloads: 2
Comments: 18
Forum posts: 573
UnrealX (Lead code monkey) @ 08 03 29 - 08:56:35
see functions/text.php
Forum posts: 21
brosky (Member) @ 08 03 29 - 12:16:40 (edited 08 03 29 - 18:14:44)
see functions/text.php

i've found one that's working, but it needs a little cleanup

in functions/text.php

before #Url auto-replace , add:
// [youtube] and [/youtube] $txt = preg_replace("#\[youtube=([0-9]+)[,]([0-9]+)[,]([0-9a-z\-_]+)](.*?)\[/youtube]#si", "<object width=\"\\1\" height=\"\\2\"><param name=\"movie\" value=\"http://www.youtube.com/v/\\3\"></param><embed src=\"http://www.youtube.com/v/\\3\" type=\"application/x-shockwave-flash\" width=\"\\1\" height=\"\\2\"></embed></object>"."[/youtube]", $txt); $txt = str_replace("[/youtube]", "", $txt);

it's working, but it's a mess for the user, because the syntax is like this:

[youtube=width,height,id]description[/youtube]

can you modify just to be
[youtube]full_youtube_link[/youtube]

or

[youtube]video_id[/youtube]
Avatar
Blog posts: 11
Added downloads: 2
Comments: 18
Forum posts: 573
UnrealX (Lead code monkey) @ 08 03 29 - 18:13:56
Try this:
// [youtube] and [/youtube] # Change these to whatever $def_width = 320; $def_height = 240; $txt = preg_replace("#\[youtube\]([0-9a-z\-_]+)\[/youtube\]#si", "<object width=\"$def_width\" height=\"$def_height\"><param name=\"movie\" value=\"http://www.youtube.com/v/\\1\"></param><embed src=\"http://www.youtube.com/v/\\1\" type=\"application/x-shockwave-flash\" width=\"$def_width\" height=\"$def_height\"></embed></object>", $txt);
Called like this: [youtube]video_id[/youtube]
Forum posts: 23
hansmaxwell (Member) @ 09 03 31 - 02:26:49
How do I add a button [youtube] to the panel?

He would have someone to adjust in order to enter the full URL:
[youtube]http://www.youtube.com/watch?v=ThVgvMVniwY[/ youtube]

Thank you for help
Avatar
Blog posts: 11
Added downloads: 2
Comments: 18
Forum posts: 573
UnrealX (Lead code monkey) @ 09 03 31 - 19:22:16
see post.tpl.php for bbcode buttons. Then simply copy and modify one.