1
I use the debaser module and would like only registered users to play the radio. It works with setting the block access to registered users but debaser opens a popup to play the internet radio. This is ideal as the viewer can listen while browsing the site.
The problem is that the URL of that popup can access the radio without being logged in and I tried adding the isuser smarty to the popup page and it executes correctly but can't recognize the user so it returns the {else} result. I guess it is because there is no SQL query in the page. What must be done to make it work?
This is code for debaser_radiopopup.html. My edit is red.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<{$xoops_langcode}>" lang="<{$xoops_langcode}>">
<head>
<meta http-equiv="content-type" content="text/html; charset=<{$xoops_charset}>" />
<meta http-equiv="content-language" content="<{$xoops_langcode}>" />
<title><{$radio_name}></title>
<link rel="stylesheet" type="text/css" media="screen" href="<{$xoops_url}>/xoops.css" />
<link rel="stylesheet" type="text/css" media="screen" href="<{$maintheme}>" />
<script src='<{$xoops_url}>/modules/debaser/js/resizewindow.js' type='text/javascript'></script>
</head>
<body onload="resizeWinTo('radiodiv');" style="padding:0px; margin:0px;">
<div style="position: absolute; top: 0px; left:0px; width:350px;" id="radiodiv">
[color=990000]<{if $xoops_isuser}>[/color]
<table class="outer"><tr><td class="odd">
<{if $pictureavail == true}>
<div align="center"><img src="<{$xoops_url}>/modules/debaser/images/<{$radio_picture}>" alt="<{$radio_name}>" /></div>
<{/if}>
<div align="center"><{$radioplayer}></div>
<{if $urlavail == true}>
<div align="center"><a href="<{$radio_url}>" target="_blank"><{$radio_name}></a></div>
<{/if}>
</td></tr></table>
[color=990000]<{else}>
You must be logged in to play radio
<{/if}>[/color]
</div>
</body>
</html>
And this for popup.php which I didn't make any changes.
<?php
/**************************************************************************/
/* PHP-NUKE: Internet Radio Block/Module */
/* ===================================== */
/* */
/* Copyright (c) 2003 by René Hart (webmaster@just4me.nl) */
/* http://www.just4me.nl */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/* */
/* Internet Radio Block/Module V3.0 by Rene Hart (webmaster@just4me.nl) */
/* http://www.just4me.nl */
/* For PHP-Nuke */
/* */
/* */
/**************************************************************************/
//******************************************//
// DO NOT CHANGE ANYTHING ON THIS SCRIPT !! //
// LEAVE COPYRIGHT IN PLACE //
//******************************************//
/* This version ported to E-Xoops and extensively modifiedby Bob Janes <bob@bobjanes.com>
18 October 2003
This version ported to XOOPS and extensively modified
by frankblack <frankblack@myxoops.de
*/
include '../../mainfile.php';
require_once XOOPS_ROOT_PATH.'/class/template.php';
$xoopsTpl = new XoopsTpl();
$radio_id = $_GET['select'];
$sql = "
SELECT radio_name, radio_stream, radio_url, radio_picture
FROM ".$xoopsDB->prefix('debaserradio')."
WHERE radio_id = ".intval($radio_id)."";
$result = $xoopsDB->query($sql);
list($radio_name, $radio_stream, $radio_url, $radio_picture) = $xoopsDB->fetchRow($result);
$xoopsTpl->assign('radio_name', $radio_name);
$xoopsTpl->assign('radio_url', $radio_url);
if ($radio_url != '') {
$xoopsTpl->assign('urlavail', true);
$xoopsTpl->assign('radio_url', $radio_url);
}
if ($radio_picture != '') {
$xoopsTpl->assign('pictureavail', true);
$xoopsTpl->assign('radio_picture', $radio_picture);
}
if (check_real($radio_stream) == true) {
$xoopsTpl->assign('radioplayer', "<object id=player classid='clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa' height='60' width='300'>
<param name='controls' value='controlpanel,statusfield' />
<param name='console' value='clip1' />
<param name='autostart' value='1' />
<param name='src' value='$radio_stream' />
<embed src='$radio_stream' type='audio/x-pn-realaudio-plugin' console='clip1' controls='controlpanel,statusfield' height='60' width='300' autostart='true' pluginspage='http://www.real.com/'>
</embed>
<noembed><a href='$radio_stream>play $radio_name</a></noembed>
</object>");
}
else {
$xoopsTpl->assign('radioplayer', "
<object id='player' height='50' width='300' classid='clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=6,4,7,1112' standby='loading microsoft® windows® media player components...' type='application/x-oleobject'>
<param name='filename' value='$radio_stream' />
<param name='showcontrols' value='true' />
<param name='showstatusbar' value='true' />
<param name='showpositioncontrols' value='false' />
<param name='showtracker' value='false' />
<embed type='application/x-mplayer2' pluginspage = 'http://www.microsoft.com/windows/mediaplayer/' src='$radio_stream' name='player' width='300 height='60' autostart='true' showcontrols='1' showstatusbar='1' showdisplay='1'>
</embed>
<noembed><a href='$radio_stream'>play $radio_name</a></noembed>
</object>");
}
/* Function to check for real player files */
function check_real($t_url) {
$temp_url = basename($t_url);
$temp_url = trim($temp_url);
$temp_url = strtolower($temp_url);
$check_ram = substr($temp_url, -3);
$check_rm = substr($temp_url, -2);
$check_smil = substr($temp_url, -4);
if ($check_rm == "rm") {
return true;
}
elseif ($check_ram == "ram") {
return true;
}
elseif ($check_rm == "ra") {
return true;
}
elseif ($check_ram == "pls") {
return true;
}
elseif ($check_ram == "rpm") {
return true;
}
elseif ($check_smil == "smil") {
return true;
}
else {
return false;
}
}
$xoopsTpl->assign("maintheme", xoops_getcss($xoopsConfig['theme_set']));
$xoopsTpl->display('db:debaser_radiopopup.html');
?>