| Author |
Add embed Youtube |
|
Kang
Home away from home Joined: 15-Feb-2003 Posts: 163
From: Malaysia
|
Posted: 2009-08-18 06:03
1. Is it possible to embed Youtube to forum? If possible, can we add youtube BBCODE?
2. How to enable BBCODE in signature?
Thank you in advance!
----------------- Warm regard from Malaysia!
|
|
BigDaveKnight
Quite a regular Joined: 19-May-2006 Posts: 42
From: Portsmouth, Hampshire, UK
|
Posted: 2009-10-07 14:49
I've not been able to do either of these Kang, although it IS possible to use HTML in signature.
|
|
avw
MPN Developer Joined: 07-Nov-2001 Posts: 1300
From: Houten
|
Posted: 2009-10-16 13:42
Hi Kang,
Interesting question. The embedded code contains a lot of forbidden tags. As soon as you allow them in the sanitizing code, pasting the embedded HTML is likely to give a working embedding but we sanitize the content because a lot of attackers try to abuse the forum for inserting attacking code.
A BBCODE solution would be nice. I can think of a special form with a textarea that we offer to the user where the user can paste them embedded html code and upon close of that form, the system tries to parse the html embedding code into an array of fields for the BBCODE presentation.
Sounds like a lot of work, how often would you need it and which restrictions would you like to apply to the embedded code? Eg, fullscreen HD display in a forum thread seems to be inapropriate. Should display take place in the thread or in a new window?
Any other suggestions?
|
|
p0rt
Not too shy to talk Joined: 07-Jul-2006 Posts: 25
|
Posted: 2011-01-10 07:30
you can add youtube to bbcode http://nullnuke.netai.net/forum.php?op=topic&topic=20&forum=17&min=0#22in sanitize.class.php find var $skip_action_tag = array( '' ); and below add var $skip_clickable_tag = array( 'youtube', 'img' ); then the ghetto bit, in function makeClickable( &$string ) { under $delim = preg_quote( $delim ); add !!! CODE !!! foreach( $this -> skip_clickable_tag as $key ) { if ( eregi( $delim[0] . $key . $delim[1], $string ) ) {
if ( eregi( $delim[0] . "youtube" . $delim[1], $string ) ) {
$string = str_replace("watch?v=", "v/", $string);
} return $string; }
} and for the bbcode replacements use !!! CODE !!! $youtubetag_array[] = "#\[youtube]([^?\n\r\t].*?)\[/youtube]#i";
$youtubetagreplacments_array[] = "<object width=\"480\" height=\"385\"><param name=\"movie\" value=\"\\1\"></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src=\"\\1\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"480\" height=\"385\"></embed></object>";
|
|
todi
Not too shy to talk Joined: 23-Sep-2004 Posts: 30
From: Germany
|
Posted: 2011-02-05 14:28
And where do we put the bbcode replacements?
----------------- Regards todi
|
|
p0rt
Not too shy to talk Joined: 07-Jul-2006 Posts: 25
|
Posted: 2011-04-11 22:13
classes/subs/sanitizer/core_CheckInput.subclass.php !!! CODE !!! function adjustHTML( &$message, $usersig = NULL ) { $srch = array ( '<code>' , '</code>' , '<blockquote>' , '</blockquote>' );
$repl = array ( '<div class="codefrag"><h6>!!! CODE !!!</h6><hr class="lft" /><code>' , '</code><hr class="lft" /></div>' , '<div class="quote"><h6>!!! QUOTE !!!</h6><hr class="lft" /><blockquote>' , '</blockquote><hr class="lft" /></div>' );
}
|
|
Trivian
Just popping in Joined: 18-Oct-2011 Posts: 1
|
Posted: 2011-10-18 14:53
Thanks for the code. It passes perfectly for me!
|