Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Playing Flash and Media Files Inline Details »»
Playing Flash and Media Files Inline
Version: 1.00, by Moya Moya is offline
Developer Last Online: Aug 2009 Show Printable Version Email this Page

Version: 3.0.9 Rating:
Released: 03-16-2005 Last Update: 03-16-2005 Installs: 21
 
No support by the author.

Is it possible? Is there any security issue? I am thinking of releasing this hack, but I am not sure about the demands and security issue on this.

History:

Originally, I have window media files played directly (inline) in phpbb. When I moved to vb, I tried to seek help from vb.com to modify their attachment system without success. I understand that Vb's attachment system for security purpose. Therefore, I have to find other means to achieve what I want. I come up with this hack when my board is at its infancy stage. It probably still is infancy because, it is used as a test and fun board when I am at work .


Requirement:

This hack might not work on all system due to different configuration, platform, and such. I will try to help you all as much as I can.

This hack will use your board attachment system to run mp3, wma, wmv, flash files. It is a bit server intensive. So be warned


Security Risk:

It has been known that flash files can be used to exploit and compromise certain securities on user computer. You might want to verify your flash attachment before enable flash playing inline on your forum.

Enut with the blah blah ??

Open your functions_showthread.php

Find

PHP Code:
function construct_postbit($post$maintemplatename 'postbit'$alternate '')

Add under

PHP Code:
// flash attachment
    
global $flashid,$flashfilename,$flashextension,$flashfilenameandlocation,$flashfilesize;

// wma attachment
    
global $wmaid,$wmafilename,$wmaextension,$wmafilenameandlocation,$wmafilesize;
    
// wmv attachment
    
global $wmvid,$wmvfilename,$wmvextension,$wmvfilenameandlocation,$wmvfilesize;    
    
// mp3 attachment
    
global $mp3id,$mp3filename,$mp3extension,$mp3filenameandlocation,$mp3filesize;
//default media tag
    
$media_controller"$vboptions[bburl]/attachment.php?attachmentid="

Find

PHP Code:
$attachment['filename'] = fetch_censored_text(htmlspecialchars_uni($attachment['filename']));
            
$attachment['attachmentextension'] = strtolower(file_extension($attachment['filename']));
            
$attachment['filesize'] = vb_number_format($attachment['filesize'], 1true); 

Add Under

PHP Code:
//flash attachment
            
$flashfilename=$attachment['filename'];                            
            
$flashextension=$attachment['attachmentextension'];                            
            
$flashfilesize=$attachment['filesize'];                            
            
$flashid=$post['userid'];                            
            
$flashfilenameandlocation=$media_controller $attachmentid  ;
            
//wma attachment
            
$wmaid=$post['userid'];
            
$wmafilename=$attachment['filename'];
            
$wmaextension=$attachment['attachmentextension'];                                        
            
$wmafilenameandlocation=$media_controller $attachmentid  ;            
            
$wmafilesize=$attachment['filesize'];            
            
//wmv attachment
            
$wmvid=$post['userid'];
            
$wmvfilename=$attachment['filename'];
            
$wmvextension=$attachment['attachmentextension'];                            
            
$wmvfilenameandlocation=$media_controller $attachmentid  ;            
            
$wmvfilesize=$attachment['filesize'];            
            
//wmv attachment
            
$mp3id=$post['userid'];
            
$mp3filename=$attachment['filename'];
            
$mp3extension=$attachment['attachmentextension'];
            
$mp3filenameandlocation=$media_controller $attachmentid  ;
            
$mp3filesize=$attachment['filesize']; 

Find

PHP Code:

eval('$post[\'imageattachmentlinks\'] .= "' fetch_template('postbit_attachment') . '";');
                            
$show['imageattachmentlink'] = true;
                        }
                        break; 

Add Under

PHP Code:

case 'swf':
                        eval(
'$post[\'flashattachments\'] .= "' fetch_template('postbit_attachmentflash') . '";');                        
                        
$show['flashattachment'] = true;                        
                    break;    
                    
                    case 
'wma':
                        eval(
'$post[\'wmaattachments\'] .= "' fetch_template('postbit_attachmentwma') . '";');                        
                        
$show['wmaattachment'] = true;                        
                    break;    
                    
                    case 
'wmv':
                        eval(
'$post[\'wmvattachments\'] .= "' fetch_template('postbit_attachmentwmv') . '";');                        
                        
$show['wmvattachment'] = true;                        
                    break;    
                    
                    case 
'mp3':
                        eval(
'$post[\'mp3attachments\'] .= "' fetch_template('postbit_attachmentmp3') . '";');                        
                        
$show['mp3attachment'] = true;                        
                    break; 
GLOBAL Phrases:

Var: attach_wmv
Text: Window Media Video

Var: attach_mp3
Text: MPEG-1 layer 3 Audio Encoding :

Var: attached_flash
Text: Attached Flash File:

Var :attach_wma
Text : Window Media Audio :

Templates:

Go to your Postbit template

Find

Code:
					$post[imageattachments]
					</div>
				</fieldset>
			</if>

Add Under

Code:
<if condition="$show[flashattachment]">
<fieldset class="fieldset">
<legend>$vbphrase[attached_flash] $flashfilename </legend>

<div style="padding:$stylevar[formspacer]px">
$post[flashattachments]
</div>
</fieldset>

</if>



<if condition="$show[wmaattachment]">
<fieldset class="fieldset">
<legend>$vbphrase[attach_wma] $wmafilename</legend>

<div style="padding:$stylevar[formspacer]px">
$post[wmaattachments]
</div>
</fieldset>

</if>

<if condition="$show[wmvattachment]">
<fieldset class="fieldset">
<legend>$vbphrase[attach_wmv] $wmvfilename</legend>

<div style="padding:$stylevar[formspacer]px">
$post[wmvattachments]



</div>
</fieldset>

</if>
	
<if condition="$show[mp3attachment]">
<fieldset class="fieldset">
<legend>

$vbphrase[attach_mp3] $mp3filename</legend>

<div style="padding:$stylevar[formspacer]px">
$post[mp3attachments]

</div>
</fieldset>

</if>


Go to your board admin and add the templates under postbits.


The included templates file uses the existing templates on my board. Feel free to modified.


If you need help drop a line here or at www.aotrangmongmo.com

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 04-03-2005, 08:25 AM
JohnBee JohnBee is offline
 
Join Date: Oct 2004
Posts: 544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am a little confused about the last part....

are you saying to created templates for each section?
or including each file type into the postbit template?

I installed this hack but when I upload a swf attachment nothing happens.
Reply With Quote
  #33  
Old 04-05-2005, 07:16 PM
DjJoschimo DjJoschimo is offline
 
Join Date: Aug 2004
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

me too :ermm:
Reply With Quote
  #34  
Old 04-10-2005, 03:37 PM
mmdmk mmdmk is offline
 
Join Date: Apr 2005
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

works not by me. I had installed the hack, but the forum displaying 'blank' attachments.

can you examine your hack?
Reply With Quote
  #35  
Old 05-01-2005, 06:37 PM
Moya's Avatar
Moya Moya is offline
 
Join Date: May 2004
Posts: 356
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by JohnBee
I am a little confused about the last part....

are you saying to created templates for each section?
or including each file type into the postbit template?

I installed this hack but when I upload a swf attachment nothing happens.

Hi John You will have to create new templates for each media. I have inclued them in the attached files
Reply With Quote
  #36  
Old 05-01-2005, 06:38 PM
Moya's Avatar
Moya Moya is offline
 
Join Date: May 2004
Posts: 356
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mmdmk
works not by me. I had installed the hack, but the forum displaying 'blank' attachments.

can you examine your hack?

mmdmk and DjJoschimo

Is it possible for me to take a look at an example link?

Thanks
Reply With Quote
  #37  
Old 05-03-2005, 06:30 PM
nickrabbit nickrabbit is offline
 
Join Date: Mar 2005
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This might solve some issues, or maybe not... I noticed in your hack that you make reference to "'postbit_attachmentflash". I looked in my postbit templates, and couldn't find one called 'postbit_attachmentflash', but did find one called 'postbit_attachmentswf'. I changed the code to refernce that template instead, and then it worked!

Now, that being said, I have one more question. You think we could alter it somehow to diplay in the correct height/width? Perhaps if you set the height/width in the name of the file somehow (ie 125x300.swf) and then extract that height/ width and display as part of the postbit_attachmentswf template? Dunno... I'm not that familar with PHP, so this is jsut a guess...
Reply With Quote
  #38  
Old 05-03-2005, 09:03 PM
nickrabbit nickrabbit is offline
 
Join Date: Mar 2005
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In case anyone is interested, I figured out a way to do the above working off of the really great code above-- just for flash though. I'm just going to go ahead and post all the code I found to work for me. I'm not a PHP queen, so some of this is guessed-- feel free to make suggestions on the messiness. Follow the placement instructions as above.

When in place, you should be able to attach any swf and have it embedded at the correct width X height as long as the file begins with the format w_h.swf or wxh.swf or wXh.swf. i.e., something like this:

120_300_myfile.swf
130x400.swf
140X500_thisRocks.swf

**** VERY SERIOUS SECURITY RISKS HERE. REALLY. SERIOSLY. IF you don't care if someone uses this to hack your board and blow it up, then you can use it. heh heh.

Here's the code.

functions_showthread.php:

find
PHP Code:
function construct_postbit($post$maintemplatename 'postbit'$alternate ''

Add under

PHP Code:
// flash attachment hack
global $flashid,$flashfilename,$flashextension,$flashfilenameandlocation,$flashfilesize,$flashfiledimen,$flashheight,$flashwidth
Find
PHP Code:
$attachment['filename'] = fetch_censored_text(htmlspecialchars_uni($attachment['filename'])); 
            
$attachment['attachmentextension'] = strtolower(file_extension($attachment['filename'])); 
            
$attachment['filesize'] = vb_number_format($attachment['filesize'], 1true); 

Add under:

PHP Code:
//flash attachment hack
$flashid=$post['userid'];   
$flashfilename=$attachment['filename']; 
$flashextension=$attachment['attachmentextension'];   
$flashfilesize=$attachment['filesize'];  
$flashfiledimen=$attachment['filename'];  
list(
$flashwidth$flashheight) = split('[_xX.]',$flashfiledimen);                                             
$flashfilenameandlocation=$media_controller $attachmentid  
Find

PHP Code:
eval('$post[\'imageattachmentlinks\'] .= "' fetch_template('postbit_attachment') . '";'); 
                            
$show['imageattachmentlink'] = true
                        } 
                        break; 
Add under:
PHP Code:
//flash attachment hack
case 'swf'
eval(
'$post[\'flashattachments\'] .= "' fetch_template('postbit_attachmentswf') . '";');                         
$show['flashattachment'] = true;                         
break; 
GLOBAL Phrases:

Var: attached_flash
Text: Attached Flash File:

Templates:

Go to your Postbit template (edit templates)

Find

Code:
	$post[imageattachments]
					</div>
				</fieldset>
			</if>
Add under

Code:
<if condition="$show[flashattachment]">
<fieldset class="fieldset">
<legend>$vbphrase[attached_flash] $flashfilename </legend>

<div style="padding:$stylevar[formspacer]px">
$post[flashattachments]
</div>
</fieldset>

</if>
Finally, also under postbit_templates you should have something called postbit_attachmentswf. IF you don't have it, create it with this code:
Code:
<br>
<smallfont>
Attachment Reference: = $attachmentid<br>
(Post Reference: = $post[postid])<br>
<embed src="attachment.php?attachmentid=$attachmentid" width="$flashwidth" height="$flashheight" type=application/x-shockwave-flash></embed><br><br>
</smallfont>
Reply With Quote
  #39  
Old 05-22-2005, 04:11 PM
ericgtr's Avatar
ericgtr ericgtr is offline
 
Join Date: Apr 2003
Location: Portland, Oregon
Posts: 1,407
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Stitch, I have decided to take some time and work with this, it's a great mod and I have it tweaked they way I need it. The only thing prevent me from putting into production is the fact that it preloads the file (wmv or mp3) and that is a killer when you have an attachment in ever post on the page.

I set it not to autoplay but I need a paramater of some kind that prevents it from preloading until the play button is pushed.
Reply With Quote
  #40  
Old 05-27-2005, 04:00 PM
Moya's Avatar
Moya Moya is offline
 
Join Date: May 2004
Posts: 356
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ericgtr
Stitch, I have decided to take some time and work with this, it's a great mod and I have it tweaked they way I need it. The only thing prevent me from putting into production is the fact that it preloads the file (wmv or mp3) and that is a killer when you have an attachment in ever post on the page.

I set it not to autoplay but I need a paramater of some kind that prevents it from preloading until the play button is pushed.

Hi Eric

I think the preloading or buffering is set locally under window media setup. I don't think we can control it though
Reply With Quote
  #41  
Old 05-30-2005, 03:35 AM
Osiris2k Osiris2k is offline
 
Join Date: Oct 2004
Posts: 51
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so is this safe to use then? which forums have it? just so i can check em out before installing!

this is a great idea btw.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:06 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05190 seconds
  • Memory Usage 2,393KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (12)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete