Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons

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

Version: 3.5.0 RC3 Rating:
Released: 09-16-2005 Last Update: Never Installs: 18
Uses Plugins Template Edits
Code Changes  
No support by the author.

This just a port over from my existing hack for version 3.0.x

https://vborg.vbsupport.ru/showthread.php?t=78235


What this hack does::

This hack allows your users to upload media files via your board file management and play the media fields within their post.. It is adivisable to have one inline per post.


Foreword:

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.

Files To edit: 1
Queries to run: 0
Uses Product: Yes
Template Edits: 2

File Edit

includes/class_postbit.php


Find
PHP Code:
function process_attachments()
    {
        global 
$stylevar$show$vbphrase
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=  "attachment.php?"$this->registry->session->vars['sessionurl'] ."attachmentid="
Look for

PHP Code:

$attachment
['attachmentextension'] = strtolower(file_extension($attachment['filename']));
                
$attachment['filesize'] = vb_number_format($attachment['filesize'], 1true); 
Add Under

PHP Code:
//start Play inline
          //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'];  
//end play inline 
PHP Code:
else
                            {
                                eval(
'$this->post[\'imageattachmentlinks\'] .= "' fetch_template('postbit_attachment') . '";');
                                
$show['imageattachmentlink'] = true;
                            }
                            break; 

Add Undder

PHP Code:

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

Template Edit

Postbit template

Look for

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

Add Under

HTML 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>

Postbit legacy template

Look for

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

Add Under

HTML 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>

Upload the included XML as product.



Demo











If you use this hack please click install.

Show Your Support

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

Comments
  #22  
Old 10-31-2005, 07:59 PM
davidw's Avatar
davidw davidw is offline
 
Join Date: Jul 2005
Location: Arkansas
Posts: 2,815
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm working on it at the moment as I don't have avi set up yet - testing to make sure it works - did you edit the xml file? This launches the player.
Reply With Quote
  #23  
Old 10-31-2005, 08:10 PM
cbr929rrerion cbr929rrerion is offline
 
Join Date: Oct 2005
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am not very good at that..

If anyone can get avi and mpg and wvm to work I would love it..
Reply With Quote
  #24  
Old 10-31-2005, 08:19 PM
davidw's Avatar
davidw davidw is offline
 
Join Date: Jul 2005
Location: Arkansas
Posts: 2,815
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok here's the sample: http://www.christianboards.org/showt...=2252#post2252
Reply With Quote
  #25  
Old 10-31-2005, 08:26 PM
davidw's Avatar
davidw davidw is offline
 
Join Date: Jul 2005
Location: Arkansas
Posts: 2,815
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's the instructions on how I did it...

I'm using this loosely for avi as examples on how to edit; replace with the appropriate file type

In your class_postbit.php file

Find:

PHP Code:
// wma attachment
    
global $wmaid,$wmafilename,$wmaextension,$wmafilenameandlocation,$wmafilesize
Add after:

PHP Code:
// avi attachment
    
global $aviid,$avifilename,$aviextension,$aviafilenameandlocation,$avifilesize
(replacing wma with avi in each)

Find:

PHP Code:
            //wma attachment
            
$wmaid=$post['userid'];
            
$wmafilename=$attachment['filename'];
         
$wmaextension=$attachment['attachmentextension'];                                     
         
$wmafilenameandlocation=$media_controller $attachmentid ;            
            
$wmafilesize=$attachment['filesize']; 

Add after:

PHP Code:
            //avi attachment
            
$aviid=$post['userid'];
            
$avifilename=$attachment['filename'];
         
$aviextension=$attachment['attachmentextension'];                                     
         
$avifilenameandlocation=$media_controller $attachmentid ;            
            
$avifilesize=$attachment['filesize']; 
(replacing wma with avi in each)

Find:

PHP Code:
                     case 'wma':
                         eval(
'$this->post[\'wmaattachments\'] .= "' fetch_template('postbit_attachmentwma') . '";');                     
                         
$show['wmaattachment'] = true;                     
                     break; 
Add after:

PHP Code:
                     case 'avi':
                         eval(
'$this->post[\'aviattachments\'] .= "' fetch_template('postbit_attachmentavi') . '";');                     
                         
$show['aviattachment'] = true;                     
                     break; 
(replacing wma with avi in each)

Postbit template edit (I use postbit legacy, you'll have to compare to postbit for the changes)

Find:

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

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

</if> 
Add after:

PHP Code:
<if condition="$show[aviattachment]">
<
fieldset class="fieldset">
<
legend>$vbphrase[attach_avi$avifilename</legend>

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

</if> 
(replacing wma with avi in each)


ADMINCP - Attachments - Extensions & Sizes - Add New Extension

Extension: avi
Max Filesize(in bytes) 5000000 (or whatever you want
Mime Type: Content-type: video/x-ms-avi
Display thumbnail for this type? No
Open this attachment in a new browser window? No (Really this is your choice)
Enabled Yes

XML edit

Add this after one of your templates: (It will end in </template>)
PHP Code:
<template name="postbit_attachmentavi" templatetype="template" date="1125000000" username="christianb" version="3.5.0">
        <![
CDATA[    
                <
br>
                <
center>
             <
table border="0" align="center" width="400" cellspacing="0" cellpadding="0" height="275">
                    <
tr>
                     <
td class="thead" width="100%" height="25">
                      <
center>
                          <
font color="#FFFFFF">
                              
AVI Attachment 
                          
</font>
                      </
center>
                  </
td>             
                    </
tr>
                    <
tr>
                     <
td width="100%" height="225">             
                      <
center>             
                          <
object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" id="Player" width="400" height="225" 
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">

<
param name="URL" value="$avifilenameandlocation">
<
param name="rate" value="1">
<
param name="balance" value="0">
<
param name="currentPosition" value="1">
<
param name="defaultFrame" value>
<
param name="playCount" value="1">
<
param name="autoStart" value="-1">
<
param name="loop" value="-1">
<
param name="currentMarker" value="0">
<
param name="invokeURLs" value="-1">
<
param name="baseURL" value>
<
param name="volume" value="200">
<
param name="mute" value="0">
<
param name="uiMode" value="full">
<
param name="stretchToFit" value="0">
<
param name="windowlessVideo" value="0">
<
param name="enabled" value="-1">
<
param name="enableContextMenu" value="0">
<
param name="fullScreen" value="0">
<
param name="SAMIStyle" value>
<
param name="SAMILang" value>
<
param name="SAMIFilename" value>
<
param name="captioningID" value>
<
param name="enableErrorDialogs" value="0">
<
param name="_cx" value="7938">
<
param name="_cy" value="6482">

<
embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows95/downloads/contents/wurecommended/s_wufeatured/mediaplayer/default.asp" src="$wmafilenameandlocation
rate=1
balance
=0
currentPosition
=1
playCount
=1
autoStart
=1
loop
=-1
currentMarker
=0
invokeURLs
=-1
volume
=200
mute
=0
uiMode
=full
stretchToFit
=0
windowlessVideo
=0
enabled
=-1
enableContextMenu
=0
fullScreen
=0
SAMIStyle
SAMILang
SAMIFilename
captioningID
enableErrorDialogs
=0
_cx
=7938
_cy
=6482
width
=400 
height
=225>
</
embed>
</
object>
                      </
center>
                        </
td>
                 </
tr>             
                    <
tr>
                     <
td class="thead" width="100%" height="25">
                      <
center>
                          <
font color="#6600FF">
                              <
a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]target="_blank">$attachment[filename]</a> <span class="smallfont">($attachment[filesizebytes$attachment[counterviews)</span>
                          </
font>
                      </
center>
                  </
td>             
                    </
tr>
                
                </
table>
                </
center>
                <
br>
            ]]>
    </
template
Don't forget to update your phrase manager:

Add New Phrase

Phrase Type: Global
Varname: attach_avi
Text: AVI (doesn't really matter - shows up in your legend)
Reply With Quote
  #26  
Old 11-01-2005, 04:04 AM
AdamMarrer AdamMarrer is offline
 
Join Date: Oct 2005
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

After making these changes I can't upload these two file formats, after upload is done it just rests the screen never showing the attachments. Any ideas?
Reply With Quote
  #27  
Old 11-01-2005, 09:39 AM
davidw's Avatar
davidw davidw is offline
 
Join Date: Jul 2005
Location: Arkansas
Posts: 2,815
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

wmv was part of the default code, you shouldn't have had to change anything for that file format.
Reply With Quote
  #28  
Old 11-01-2005, 11:59 AM
cbr929rrerion cbr929rrerion is offline
 
Join Date: Oct 2005
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

th default code did not work.. all that was displayed was a ling to it, still had to click and download it.. any ideas where its wrong?
Reply With Quote
  #29  
Old 11-01-2005, 12:37 PM
davidw's Avatar
davidw davidw is offline
 
Join Date: Jul 2005
Location: Arkansas
Posts: 2,815
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you checked your message attachment options in AdminCP?

vBulletin Options -> Message Attachment Options

View Attached Images Inline - Yes or Yes, if post has only one attachment

Also, are your attachments currently being stored in the filesystem or database? Not sure, but this might make a difference.
Reply With Quote
  #30  
Old 11-01-2005, 01:51 PM
cbr929rrerion cbr929rrerion is offline
 
Join Date: Oct 2005
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes show attachements and file system..
Reply With Quote
  #31  
Old 11-01-2005, 04:04 PM
davidw's Avatar
davidw davidw is offline
 
Join Date: Jul 2005
Location: Arkansas
Posts: 2,815
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The only thing I can think of is to uninstall it - make the changes - reinstall it.
I don't understand why it wouldn't work on your site, as it does work on mine - unless there's another setting I've overlooked.
Reply With Quote
Reply

Thread Tools

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 01:12 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.09116 seconds
  • Memory Usage 2,448KB
  • 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
  • (4)bbcode_html
  • (15)bbcode_php
  • (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
  • (3)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