1
wishcraft
XOOPS 2.5.3 - Blocking Duplicate Call - Flowplayer Block

Okey for a second example this script header from the top of www.istreamtv.com.au :- if you look at the HTML of the base file on this site with line 16 where the script is and follow it through then you will find what i am saying is true.

See how it has trigger the block generation code twice and made two salts and tripped the recent block code release for secure video playback using ajax and json.

For example this line:

<script type="text/javascript">
//<![CDATA[
dojson_player_block("http://www.istreamtv.co.nz","flowplayer","2","player_block_one","1","39674926f53b47e3e53d9bb1daf5ae81291872ff","205px","160px","1");
//]]></script>


Which will load a video player in the div player_block_one which appear again with a different salt 'dae25acfd3a8096bd1311c8c2675212c3f2dfa21' at the base cause the block code was called for a second time.

//<![CDATA[
dojson_player_block("http://www.istreamtv.co.nz","flowplayer","2","player_block_one","1","dae25acfd3a8096bd1311c8c2675212c3f2dfa21","205px","160px","1");
//]]></script>


This code is generated in the class player.php by the routine getJS();

Which looks like currently still with no trap for the item.

function getJS($block=false$width ''$height '') {
        static 
$_loadedJS false;
        
xoops_loadLanguage('modinfo''flowplayer');
        
        if (
is_object($GLOBALS['xoTheme'])&&$_loadedJS==false) {
            if (
$this->_ModConfig['force_jquery']&&!$GLOBALS['loaded_jquery']) {
                
$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_FLOWPLAYER_JQUERY, array('type'=>'text/javascript'));
                
$GLOBALS['loaded_jquery']=true;
            }
            
$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_FLOWPLAYER_FLOWPLAYER, array('type'=>'text/javascript'));
            
$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_FLOWPLAYER_CORE, array('type'=>'text/javascript'));
            
$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_FLOWPLAYER_JSON_FUNCTIONS, array('type'=>'text/javascript'));
            
$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL.sprintf(_MI_FLOWPLAYER_STYLE$GLOBALS['xoopsConfig']['language']), array('type'=>'text/css'));
            
$_loadedJS true;
        }
        if (empty(
$width))
            
$width $this->getVar('width');
        if (empty(
$height))
            
$height $this->getVar('width');
        
$uid 0;
        if (
is_object($GLOBALS['xoopsUser']))
            
$uid $GLOBALS['xoopsUser']->getVar('uid');
            
        if (
$GLOBALS['_returned'][$this->getVar('fid')][$block]==false) {
            
$GLOBALS['_returned'][$this->getVar('fid')][$block] = true;
            if (
$block==false) {
                return 
'dojson_player("'.XOOPS_URL.'","'._MI_FLOWPLAYER_DIRNAME.'","'.$this->getVar('fid').'","div_'.$this->getReference($block).'","'.$uid.'","'.sha1(XOOPS_LICENSE_KEY.$this->_ModConfig['salt'].$uid.date('Ymdhis')).'","'.$width.'","'.$height.'","'.($block==true?'1':'0').'");';
            } else {
                return 
'dojson_player_block("'.XOOPS_URL.'","'._MI_FLOWPLAYER_DIRNAME.'","'.$this->getVar('fid').'","%resolve%","'.$uid.'","'.sha1(XOOPS_LICENSE_KEY.$this->_ModConfig['salt'].$uid.date('Ymdhis')).'","%width%","%height%","'.($block==true?'1':'0').'");';
            }
        }
        return 
'';
    }


Which is then interner called by the block routine b_flowplayer_block_player_show; which looks like:

function b_flowplayer_block_player_show$options )
{
    if (!isset(
$GLOBALS['_done']))
        
$GLOBALS['_done'] = array();
        
    
$player_handler xoops_getmodulehandler('player''flowplayer');
    if (!
$player $player_handler->get($options[0]))
        return 
false;

    
$block = array();
    
$block['width'] = $options[1]; 
    
$block['height'] = $options[2];
    
$block['id'] = $options[3];
    
    if (!isset(
$GLOBALS['_done'][$block['id']])) {
        
$GLOBALS['xoTheme']->addScript('', array('type'=>'text/javascript'), str_replace('%resolve%'$block['id'], str_replace('%height%'$block['height'], str_replace('%width%'$block['width'], $player->getJS(true)))));
        
$GLOBALS['_done'][$block['id']]=true;
        return 
$block;
    }
    return 
false;
}

Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

Login

Who's Online

168 user(s) are online (125 user(s) are browsing Support Forums)


Members: 0


Guests: 168


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits