Premiumbeat Block Codes

Started by Chen Zhen, July 06, 2013, 09:51:54 pm

Previous topic - Next topic

Chen Zhen

PHP Portal Block Code:
Adjust $playlist_id = 0 to your opted playlist number

/* Set Playlist ID Number  - default is 1  */
/* MP3's using playlist number 99 will play on all blocks... Other mp3 playlist settings are block specific  */
$playlist_id = 1;

global $scripturl, $smcFunc, $boardurl;

/* Adjustable parameters  */
$width = 800;
$height = 215;
$skin = '0000FF';
$skinType = 5;
$autoplay = 'yes';   /*  yes = autoplay,    no = manual play  */

$columns_settings = array('height', 'width', 'autoplay', 'skin');
$a = check_block_playlist($playlist_id);
if ($a == true)
{
$result = $smcFunc['db_query']('', "SELECT myplaylist, height, width, autoplay, type, skin, skin_type FROM {db_prefix}premiumbeat_settings WHERE (myplaylist = {$playlist_id}) LIMIT 1");
while ($val = $smcFunc['db_fetch_assoc']($result))
{
if ((empty($val['myplaylist'])) || (int)$val['myplaylist'] < 1)
continue;

foreach ($columns_settings as $sets)
{
if (empty($val[$sets]))
$val[$sets] = 0;
}
$autoplay = 'no';
if($val['autoplay'] == 1)
$autoplay = 'yes';

if (!$width)
$width = $val['width'];
if (!$height)
$height = $val['height'];
if (!$skin)
$skin = $val['skin'];
if (!$skinType)
$skinType = $val['skin_type'];                        
}
$smcFunc['db_free_result']($result);

}

$_SESSION['premiumbeat_bbc'] = false;
$_SESSION['customMusic_checker'] = true;
$_SESSION['premiumbeat_new'] = true;
if($playlist_id < 0) {$playlist_id = 999;}
$_SESSION['playlist_id'] = $playlist_id;

echo'<div id="premiumbeat_player" style="position:relative;margin:auto;text-align:center;"><script type="text/javascript" src="my_music/swfobject.js"></script>
     
<div id="flashPlayer">
Mp3 Player Malfunction
</div>
<script type="text/javascript">
var so = new SWFObject("my_music/playerMultipleList.swf", "premiumbeat-player", "'.$width.'", "'.$height.'", "9.0.0");
so.addVariable("autoPlay","'.$autoplay.'")
so.addVariable("overColor","'.$skin.'")         
so.addVariable("playerSkin", "'.$skinType.'")       
so.addVariable("playlistPath","',$scripturl,'?action=customMusic", "SESSION")       
        so.addParam("bgcolor", "ffffff");       
        so.useExpressInstall("expressinstall.swf");
        so.addVariable("getURL","")
so.write("flashPlayer");
</script></div>';


function check_block_playlist($play)
{
global $smcFunc;
$result2 = $smcFunc['db_query']('', "SELECT myplaylist FROM {db_prefix}premiumbeat_settings WHERE myplaylist = {$play} LIMIT 1");
$result3 = $smcFunc['db_num_rows']($result2);
$smcFunc['db_free_result']($result2);
if ($result3 > 0)
return true;

return false;
}
echo '<script type="text/javascript">
// when the document has loaded, start the premiumbeat player
window.onload = function () {
    (function () {
        var a = document.getElementById("premiumbeat_player");
        if (a) {
            // Player has loaded!
        }
        else {
            setTimeout(arguments.callee, 50);
        }
    }());
};
</script>';





PHP Block - Popup Player Code:
(Adjust playlist = 0; to your opted playlist number)

/* Adjustable variables: Set playlist ID + match width & height to the proper playlist settings */
/* Setting the playlist ID# to 0 or 999 will allow this block to use playlist permissions */

$playlist ='0';
$width = '220';
$height = '230';

/* Set $position to false to have the button appear in the block and set block body style accordingly  */
/* For $position = false put the following in your body style...  text-align:center;vertical-align:middle;overflow:hidden;  */
$position = 'fixed';

if ($position == 'fixed')
$style = "position:fixed;top:0px;right:0px;";
else
$style="text-align:center";


$url = 'index.php?action=customMusicPopup;playlist='.$playlist.';';
$icon = '<img src ="http://i272.photobucket.com/albums/jj187/ginger_face/mymusic.gif" style="'.$style.'" />';


/*  Do not edit below this line  */

echo ' <script type="text/javascript">
<!--
var WindowObjectReference = null;
function PremiumbeatPopup(strURL,strWidth,strHeight)
{

var strOptions="";
var strType = "console";
if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
WindowObjectReference = window.open(strURL, "newWin", strOptions);
WindowObjectReference.focus();
}
//-->
</script>';

$pop = '<a href="javascript:void(0)" onclick="PremiumbeatPopup(\''.$url.'\',\''.$width.'\',\''.$height.'\')">'.$icon.'</a>';

$_SESSION['premiumbeat_bbc'] = false;
$_SESSION['customMusic_checker'] = true;
$_SESSION['premiumbeat_new'] = true;
echo $pop;






PHP Block - Multiple Playlist Popup Player


/* Premiumbeat PHP ~ popup block with multiple playlist dropdown option */

/* Edit your image location or make it false not to display it */
$image = false;
// $image = 'http://i272.photobucket.com/albums/jj187/ginger_face/mymusic.gif';
$width = '450';
$height = '230';
$autoplay = 'yes';
$title = 'Select Playlist';

/*
*  Set $position to false to have the button appear in the block and set block body style accordingly 
*  For $position = false put the following in your body style...  text-align:center;vertical-align:middle;overflow:hidden;
*/

$position = 'fixed';

/*
* Do not edit below this comment
*/

global $smcFunc, $scripturl, $settings;

$datum = array('myplaylist','title','equip');
$num = 0;
$drop = '';
$_SESSION['premiumbeat_bbc'] = false;
$_SESSION['customMusic_checker'] = true;
$_SESSION['premiumbeat_width'] = $width;
$_SESSION['premiumbeat_height'] = $height;
$_SESSION['premiumbeat_autoplay'] = $autoplay;
$_SESSION['premiumbeat_new'] = true;

if ($position == 'fixed')
$style = "position:fixed;top:0px;right:2px;";
else
$style="text-align:center;";

$result = $smcFunc['db_query']('', "SELECT myplaylist, title, equip
                                    FROM {db_prefix}premiumbeat_settings
                                    WHERE equip > 0");
while ($val = $smcFunc['db_fetch_assoc']($result))
{
foreach ($datum as $data)
$playlists[$num][$data] = $val[$data];

$num++;
}
$smcFunc['db_free_result']($result);

if (empty($playlists))
return false;

foreach ($playlists as $playlist)
$drop .= '<option value="' . $playlist['myplaylist'] . '">' . $playlist['title'] . '</option>';

$playlist = $playlists[0]['myplaylist'];
$Xurl = 'index.php?action=customMusicPopup;playlist=989;playsong=playlist=';
$url = $Xurl . $playlist.';';

if (!$image)
$icon = false;
elseif ($position == 'fixed')
$icon = '<img src ="'.$image.'" alt="" style="position:relative;height:30px;width:59px;float:right;right:2px;" />';
else
$icon = '<span style="display: block;margin-left: auto;margin-right: auto;"><img src ="'.$image.'" alt="" style="position:relative;height:30px;width:59px;" /></span>';
   
echo '
<script type="text/javascript"><!--
var WindowObjectReference = null;
function PremiumbeatPopup(strURL,strWidth,strHeight)
{
var strOptions="";
var strType = "console";
if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
WindowObjectReference = window.open(strURL, "newWin", strOptions);
WindowObjectReference.focus();
}
//--></script>';

if ($icon)
$pop = '<a href="javascript:void(0)" onclick="PremiumbeatPopup(\''.$url.'\',\''.$width.'\',\''.$height.'\')">'.$icon.'</a>';
else
$pop = false;

echo '
<ul id="someID" style="list-style-type:none;'.$style.'">
<li>'
, $pop, '<br />
</li>
<li>
<select id="C4" dir="rtl" onchange="PremiumbeatPopup(\''.$Xurl.'\' + this.options[this.selectedIndex].value,\''.$width.'\',\''.$height.'\')">
<option disabled=true value="0" title="tooltip" selected=true>
',$title,'
</option>
',$drop,'
</select>
</li>
</ul>';