Author |
Topic |
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 06 December 2005 : 11:51:15
|
I've been fiddling around with some javascript to circumvent the Eolas patents which will change IE very soon. Based on those javascript functions I decided to create some additional forumcode that allows users to embed video/flash directly in their posts, at least in IE and on Windows.
demo: http://oxle.com/topic.asp?tid=3392 (it looks differently when your logged in/not logged in, so you can use demo/demo to log in).
Update 20-02-2006: Installation guide & fix for non-oxle code forums is available at http://oxle.com/topic.asp?tid=3437< |
portfolio - linkshrinker - oxle - twitter |
Edited by - MarcelG on 20 February 2006 04:28:11 |
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 06 December 2005 : 14:01:15
|
Given that I'm working on a band's website, working with video and flash is always a welcome addition. Count me in as anxiously waiting. < |
|
|
Helterskelter
Junior Member
United Kingdom
331 Posts |
Posted - 07 December 2005 : 01:59:44
|
Very good.....
Just made me late for work, watching all the clips though......< |
|
Edited by - Helterskelter on 07 December 2005 02:00:03 |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 07 December 2005 : 02:46:25
|
Yes, videos in topics would be cool.. That way the users could comment the videos also. Now I use the Classifieds Mod that I modified to show files in different categories but then there is no comments. It's very secure though.. There is NO way to link to the files from another server =) < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 07 December 2005 : 05:20:48
|
I've just discovered that the method I'm currenlty using is not very safe, and an easy target for cross site scripting attacks. I'll focus on getting this straight before releasing it as a mod out in the open. If you want you can have a look at the source at oxle (login demo/demo) http://oxle.com/source.asp?page=embedding.js (look at the last 4 functions) http://oxle.com/scoure.asp?page=inc_func_common.asp (look at the function extratags) The input syntax for the embedding is like this: [wmv]urltowmvfile[/wmv]
The outpoutsyntax for the embedded video is this: <script language="javascript">EmbedWMVideoT("urltowmvfile",320,240,false);</script>
This is handled by the extratags function. However, I just tried the following: [wmv]urltowmvfile",480,320,true,"false[/wmv]
And, indeed inc_func_common.asp interpreted the code like this: <script language="javascript">EmbedWMVideoT("urltowmvfile",480,320,true,"false",320,240,false);</script>
The last 4 parameters are completely ignored by the functions : Result ; a video that's 480 pixels wide, and 320 tall, and that autostarts...
I think I need to find a method that strips the comma's from the input, breaking the embedding.
Update I updated the functions to stop as soon as there are more than the required parameters. I now just need to prevent access to other functions. For instance, this works too: [wmv]bla");EmbedWMVideo("MU",800,600,"true");//[/wmv]< |
portfolio - linkshrinker - oxle - twitter |
Edited by - MarcelG on 07 December 2005 05:51:12 |
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 07 December 2005 : 06:53:51
|
Quickest way would be to filter out the double quote, which is an illegal character for Windows filenames anyway
< |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 07 December 2005 : 10:27:28
|
I think I fixed it. Instead of using the extratags function, I created 4 seperate functions ; ReplaceWMVTags, ReplaceQTTags, ReplaceVMATags and ReplaceFlashTags. These functions are constructed like this: In these functions, I check if the part between the tags contains an illegal character ( ,()"; ) and if so, I replace the entire part between the tags with the text "illegal". This value is then parsed in the javascript function, which gives stops the execution of the function, and gives an error message back. Demo: http://oxle.com/topic.asp?tid=3393 (login demo/demo).
More details: http://oxle.com/source.asp?page=embedding.js (look at the last 4 functions) http://oxle.com/source.asp?page=inc_func_common.asp (look at the 4 functions mentioned above)
Perhaps someone knows a more clever way of handling these tags, so all input is appreciated!< |
portfolio - linkshrinker - oxle - twitter |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 19 December 2005 : 10:45:37
|
Wow. I've definatly got to try this when I get home.< |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 20 December 2005 : 03:35:26
|
I'm gonna try this one today! Thanks alot Marcel! < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 20 December 2005 : 03:44:17
|
Is there any way to have an icon or something on forum.asp that show if there is an embedded video in the topic? I think it would be nice to those with a slow connection =) < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 20 December 2005 : 03:50:39
|
And couldn't you make it possible to turn this feature on/off in every user's profile? So that they can choose if they want an ordinary link or this "direct-play-thingy"... < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 20 December 2005 : 05:22:04
|
You could do something with Message Icons to show the type of content. If you've got it installed already on your forum, you could do something like if Instr(txtmessage, "[wmv]")>0 then MessageIcon = WMVIcon
BTW, (except for the Flash embedding) it's not a direct play thing ; all media will only load upon clicking the play buttons, but I'm sure you could create a member-field that defines if the media should be shown as direct embedded media or linked media files. It would require an addition of a db field though (or you could work with cookies)< |
portfolio - linkshrinker - oxle - twitter |
Edited by - MarcelG on 20 December 2005 05:25:57 |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 20 December 2005 : 06:16:15
|
Ah, I didn't know it was that simple, then I could do that with threads that have pics in them also.. Thanks alot =)
I'll have a look at the profile stuff also if I get this working =) < |
/Tribaliztic - www.gotlandrace.se -
|
|
|
eauxvives
Junior Member
Bhutan
145 Posts |
Posted - 28 December 2005 : 09:59:55
|
quote: Originally posted by MarcelG
If you've got it installed already on your forum, you could do something like if Instr(txtmessage, "[wmv]")>0 then MessageIcon = WMVIcon
sorry I didn't quite get this. could you explain a bit more fore dummies like me?< |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 28 December 2005 : 10:47:32
|
No problem. Here's a clarification. If - and only if - you've got the MessageIcons mod installed on your forum, you can assign specific icons to a message. However, if you want to 'automate' that process, to show for example a Flash icon for every post that contains an instance of the embedded flash-tag, you need to find out whether or not there is an instance of [flash][/flash] inside the actual message. If so, assign the appropiate (oh, I hate that word, did I write it ok?) message icon to that message, and override the manually assigned icon.
So far for normal language, we now need to translate that to ASP. In ASP we've got the InStr function. The InStr function returns the position of the first occurrence of one string within another.
So, with that in mind, and knowing that the message being posted is put in the variable txtmessage (in post_info.asp), we can do the following check in post_info.asp:
if Isntr(textmessage,"[flash]") > 0 then If there is an instance of [flash] inside the posted message, the Instr function will return the position of that instance. That position is never zero (as the first position is 1), except when there's no instance of [flash] in txtmessage available at all.
So, when the result of Instr is greater than zero, we know for sure that there's been an instance of [flash]. Knowing that, we can assign an alternate message icon. However, I just checked post_info.asp at oxle, and I saw that instaed of putting the messageicon into a variable, it uses the cLng(Request.Form("strMessageIcon")) method. So, we need to replace all isntances of cLng(Request.Form("strMessageIcon")) by a newly created variable, and load cLng(Request.Form("strMessageIcon")) into that variable. We can then change the content of that variable with this:
if Isntr(textmessage,"[flash]") > 0 and Isntr(textmessage,"[/flash]") > 0 then
thenewvariable = "whateveryoulike"
end if
I hope this clarifies things a bit.< |
portfolio - linkshrinker - oxle - twitter |
|
|
Topic |
|