Well this is the admin.php file for Internet_TV:
Code
<?
/**************************************************************************/
/* PostNuke: Internet TV Block/Module */
/* ===================================== */
/* */
/* Modified for PostNuke by Kemas Yunus Antonius */
/* (kyantonius@kyantonius.com) */
/* http://www.kyantonius.com */
/* March 26, 2003 */
/**************************************************************************/
/* PHP-NUKE: Internet TV 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. */
/* */
/* */
/**************************************************************************/
if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); }
modules_get_language();
modules_get_manual();
function main() {
global $language, $admin, $tvid ;
include ('header.php');
GraphicAdmin();
OpenTable();
echo ("<center><font class=\"title\"><b>Internet TV "._ADMINISTRATION."</b></font></center>");
CloseTable();
echo "<br>";
OpenTable();
echo "<center><b>"._INTVPROG."</b></center><br>";
$count = 0;
$idnum = 1;
$result = mysql_query("SELECT tv_id, tv_name, tv_language FROM internet_tv ORDER BY tv_name ASC");
while(list($tv_id, $tv_name, $tv_language) = mysql_fetch_row($result)) {
if ($tv_language == "") {
$tv_language = ""._ALL."";
}
if ($tv_id != "") {
if ($count == 0) {
echo "<table border=\"1\" width=\"100%\">";
$count = 1;
}
echo "<tr><td><b>$idnum</b></td><td width=\"100%\"> $tv_name </td><td align=\"center\"> $tv_language </td><td nowrap> (<a href=\"admin.php?module=Internet_TV&op=ITVedit&tvid=$tv_id\">"._EDIT."</a>-<a href=\"admin.php?module=Internet_TV&op=ITVdelete&tvid=$tv_id\">"._DELETE."</a>) </td></tr>";
$idnum = $idnum + 1;
} }
if (($tv_id == "") AND ($count == 0)) {
echo "<center><i>"._INTVNOST."</i></center>";
}
if ($count == 1) {
echo "</table>";
}
echo "<br><center><a href=\"admin.php?module=Internet_TV&op=ITVnew\">"._INTVNEW."</a>";
CloseTable();
echo "<br>";
OpenTable();
$result = mysql_query("SELECT modulename, auto_start, picture, picture_dir, defpicture, nopicture_name, tvvert, tvhor FROM internet_tv_settings");
list($modulename, $auto_start, $picture, $picture_dir, $defpicture, $nopicture_name, $tvvert, $tvhor) = mysql_fetch_row($result);
echo "<center><b>"._INTVBLSET."</b></center><br>"
."<form action='admin.php?module=Internet_TV&op=main' method='post'>"
."<table border='0'><tr><td>"
.""._INTVMODNAME.":</td><td><select name='xmodulename'>";
$handle=opendir('modules');
while ($file = readdir($handle)) {
if ( (!ereg("[.]",$file)) ) {
$modulelist .= "$file ";
}
}
closedir($handle);
$modulelist = explode(" ", $modulelist);
sort($modulelist);
for ($i=0; $i < sizeof($modulelist); $i++) {
if($modulelist[$i]!="") {
echo "<option name='xmodulename' value='$modulelist[$i]' ";
if($modulelist[$i]==$modulename) echo "selected";
echo ">$modulelist[$i]\n";
}
}
echo "</select>"
."</td></tr><tr><td>"._INTVAUTOST.":</td><td>";
if ($auto_start==1) {
echo "<input type='radio' name='xautostart' value='1' checked>"._YES."
<input type='radio' name='xautostart' value='0'>"._NO."";
} else {
echo "<input type='radio' name='xautostart' value='1'>"._YES."
<input type='radio' name='xautostart' value='0' checked>"._NO."";
}
echo "</td></tr><tr><td>"._INTVPICCHO.":</td><td>";
if ($picture==1) {
echo "<input type='radio' name='xpicture' value='1' checked>"._YES."
<input type='radio' name='xpicture' value='0'>"._NO."";
} else {
echo "<input type='radio' name='xpicture' value='1'>"._YES."
<input type='radio' name='xpicture' value='0' checked>"._NO."";
}
echo "</td></tr><tr><td>"
.""._INTVPICDIR.":</td><td>"
."<input type=\"text\" name=\"xpicturedir\" size=\"50\" maxlength=\"50\" value=\"$picture_dir\">"
."</td></tr><tr><td>"._INTVPICDEF.":</td><td>";
if ($defpicture==1) {
echo "<input type='radio' name='xdefpicture' value='1' checked>"._YES."
<input type='radio' name='xdefpicture' value='0'>"._NO."";
} else {
echo "<input type='radio' name='xdefpicture' value='1'>"._YES."
<input type='radio' name='xdefpicture' value='0' checked>"._NO."";
}
echo "</td></tr><tr><td>"
.""._INTVNOPICNAME.":</td><td>"
."<input type=\"text\" name=\"xnopicturename\" size=\"50\" maxlength=\"50\" value=\"$nopicture_name\">"
."</td></tr><tr><td>"
.""._INTVHEIGHT.":</td><td>"
."<input type=\"text\" name=\"xtvvert\" size=\"5\" maxlength=\"3\" value=\"$tvvert\">"
."</td></tr><tr><td>"
.""._INTVWIDTH.":</td><td>"
."<input type=\"text\" name=\"xtvhor\" size=\"5\" maxlength=\"3\" value=\"$tvhor\">"
."</td></tr><tr><td></td><td>";
echo "</td></tr><tr><td><br><br>"
."<input type=\"hidden\" name=\"op\" value=\"ITVsettings\">"
."<input type=\"submit\" value=\""._SAVECHANGES."\">"
."</tr></td></table></form>";
CloseTable();
include ('footer.php');
}
function ITVdelete() {
global $tvid;
mysql_query("DELETE FROM internet_tv WHERE tv_id=$tvid");
header("Location: admin.php?module=Internet_TV&op=main");
}
function ITVedit() {
global $tvid, $multilingual;
include ('header.php');
GraphicAdmin();
echo "
<script language=\"JavaScript\" type=\"text/javascript\">
function checkform (form)
{
if (form.tvname.value == \"\") {
alert(\""._INTVERR1."\" );
form.tvname.focus();
return false ;
}
if (form.tvstream.value == \"http://\"){
alert( \""._INTVERR2."\" );
form.tvstream.focus();
return false ;
}
return true ;
}
</script>";
OpenTable();
echo "<center><font class=\"title\"><b>Internet TV "._ADMINISTRATION."</b></font></center>";
CloseTable();
echo "<br>";
$result = mysql_query("SELECT tv_name, tv_stream, tv_url, tv_picture, tv_language FROM internet_tv WHERE tv_id=$tvid");
list($tv_name, $tv_stream, $tv_url, $tv_picture, $tv_language) = mysql_fetch_row($result);
OpenTable();
echo "<center><font class=\"option\"><b>"._INTVEDIT."</b></font></center><br>";
echo "<br><br>"
."<form action=\"admin.php?module=Internet_TV&op=main\" method=\"post\" onsubmit=\"return checkform(this);\">"
."<table border='0'><tr><td>"
.""._INTVNAME.":</td><td>"
."<input type=\"text\" name=\"tvname\" size=\"20\" maxlength=\"20\" value=\"$tv_name\">"
."</td></tr><tr><td>"
.""._INTVSTREAM.":</td><td>"
."<input type=\"text\" name=\"tvstream\" size=\"50\" maxlength=\"75\" value=\"$tv_stream\">"
."</td></tr><tr><td>"
.""._INTVURL.":</td><td>"
."<input type=\"text\" name=\"tvurl\" size=\"50\" maxlength=\"50\" value=\"$tv_url\">"
." ("._OPTION.")</td></tr><tr><td>"
.""._INTVPICT.":</td><td>"
."<input type=\"text\" name=\"tvpicture\" size=\"50\" maxlength=\"50\" value=\"$tv_picture\"> ("._INTVPICTDIR.")"
."</td></tr><tr><td>";
if ($multilingual == 0) {
echo "<br><br><b>"._LANGUAGE.": </b>"
."<select name=\"tvlanguage\" class=\"pn-text\">";
$lang = languagelist();
$sel_lang[$currentlang] = ' selected';
print '<option value="">'._ALL.'</option>';
$handle = opendir('language');
while ($f = readdir($handle))
{
if (is_dir("language/$f") && (!empty($lang[$f])))
{
$langlist[$f] = $lang[$f];
}
}
asort($langlist);
// a bit ugly, but it works in E_ALL conditions (Andy Varganov)
foreach ($langlist as $k=>$v){
echo '<option value="'.$k.'"';
if (isset($sel_lang[$k])) echo ' selected';
echo '>'. $v . '</option>\n';
}
}
echo "</select>";
echo "</td></tr><tr><td><br><br>"
."<input type=\"hidden\" NAME=\"tvid\" size=\"50\" value=\"$tvid\">"
."<input type=\"hidden\" name=\"op\" value=\"ITVchange\">"
."<input type=\"submit\" value=\""._SAVECHANGES."\">"
."</tr></td></table></form>";
CloseTable();
include ('footer.php');
}
function ITVchange($tvid, $tvname, $tvstream, $tvurl, $tvpicture, $tvlanguage) {
global $prefix;
mysql_query("UPDATE internet_tv SET tv_name='$tvname', tv_stream='$tvstream', tv_url='$tvurl', tv_picture='$tvpicture', tv_language='$tvlanguage' WHERE tv_id=$tvid");
header("Location: admin.php?module=Internet_TV&op=main");
}
function ITVnew() {
global $tvid, $multilingual;
include ('header.php');
GraphicAdmin();
echo "
<script language=\"JavaScript\" type=\"text/javascript\">
function checkform (form)
{
if (form.tvname.value == \"\") {
alert(\""._INTVERR1."\" );
form.tvname.focus();
return false ;
}
if (form.tvstream.value == \"http://\") {
alert( \""._INTVERR2."\" );
form.tvstream.focus();
return false ;
}
return true ;
}
</script>";
OpenTable();
echo "<center><font class=\"title\"><b>Internet TV "._ADMINISTRATION."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"option\"><b>"._INTVNEW."</b></font></center><br>";
echo "<br><br>"
."<form action=\"admin.php?module=Internet_TV&op=main\" method=\"post\" onsubmit=\"return checkform(this);\">"
."<table border='0'><tr><td>"
.""._INTVNAME.":</td><td>"
."<input type=\"text\" name=\"tvname\" size=\"20\" maxlength=\"20\">"
."</td></tr><tr><td>"
.""._INTVSTREAM.":</td><td>"
."<input type=\"text\" name=\"tvstream\" size=\"50\" maxlength=\"75\" value=\"http://\">"
."</td></tr><tr><td>"
.""._INTVURL.":</td><td>"
."<input type=\"text\" name=\"tvurl\" size=\"50\" maxlength=\"50\" value=\"http://\">"
." ("._OPTION.")</td></tr><tr><td>"
.""._INTVPICT.":</td><td>"
."<input type=\"text\" name=\"tvpicture\" size=\"50\" maxlength=\"50\" > ("._INTVPICTDIR.")"
."</td></tr><tr><td>";
if ($multilingual == 0) {
echo "<br><br><b>"._LANGUAGE.": </b>"
."<select name=\"tvlanguage\" class=\"pn-text\">";
$lang = languagelist();
$sel_lang[$currentlang] = ' selected';
print '<option value="">'._ALL.'</option>';
$handle = opendir('language');
while ($f = readdir($handle))
{
if (is_dir("language/$f") && (!empty($lang[$f])))
{
$langlist[$f] = $lang[$f];
}
}
asort($langlist);
// a bit ugly, but it works in E_ALL conditions (Andy Varganov)
foreach ($langlist as $k=>$v){
echo '<option value="'.$k.'"';
if (isset($sel_lang[$k])) echo ' selected';
echo '>'. $v . '</option>\n';
}
}
echo "</select>";
echo "</td></tr><tr><td><br><br>"
."<input type=\"hidden\" name=\"op\" value=\"ITVadd\">"
."<input type=\"submit\" value=\""._SAVECHANGES."\">"
."</tr></td></table></form>";
CloseTable();
include ('footer.php');
}
function ITVadd($tvname, $tvstream, $tvurl, $tvpicture, $tvlanguage) {
global $prefix;
mysql_query("INSERT INTO internet_tv VALUES ('','$tvname', '$tvstream', '$tvurl', '$tvpicture', '$tvlanguage')");
header("Location: admin.php?module=Internet_TV&op=main");
}
function ITVsettings($xmodulename, $xautostart, $xpicture, $xpicturedir, $xdefpicture, $xnopicturename, $xtvvert, $xtvhor) {
global $prefix;
mysql_query("UPDATE internet_tv_settings SET modulename='$xmodulename', auto_start='$xautostart', picture='$xpicture', picture_dir='$xpicturedir', defpicture='$xdefpicture', nopicture_name='$xnopicturename', tvvert='$xtvvert', tvhor='$xtvhor'");
header("Location: admin.php?module=Internet_TV&op=main");
}
switch($op) {
case "main":
main();
break;
case "ITVdelete":
ITVdelete();
break;
case "ITVedit":
ITVedit();
break;
case "ITVchange":
ITVchange($tvid, $tvname, $tvstream, $tvurl, $tvpicture, $tvlanguage);
break;
case "ITVnew":
ITVnew();
break;
case "ITVadd":
ITVadd($tvname, $tvstream, $tvurl, $tvpicture, $tvlanguage);
break;
case "ITVsettings":
ITVsettings($xmodulename, $xautostart, $xpicture, $xpicturedir, $xdefpicture, $xnopicturename, $xtvvert, $xtvhor);
break;
}
?>
/**************************************************************************/
/* PostNuke: Internet TV Block/Module */
/* ===================================== */
/* */
/* Modified for PostNuke by Kemas Yunus Antonius */
/* (kyantonius@kyantonius.com) */
/* http://www.kyantonius.com */
/* March 26, 2003 */
/**************************************************************************/
/* PHP-NUKE: Internet TV 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. */
/* */
/* */
/**************************************************************************/
if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); }
modules_get_language();
modules_get_manual();
function main() {
global $language, $admin, $tvid ;
include ('header.php');
GraphicAdmin();
OpenTable();
echo ("<center><font class=\"title\"><b>Internet TV "._ADMINISTRATION."</b></font></center>");
CloseTable();
echo "<br>";
OpenTable();
echo "<center><b>"._INTVPROG."</b></center><br>";
$count = 0;
$idnum = 1;
$result = mysql_query("SELECT tv_id, tv_name, tv_language FROM internet_tv ORDER BY tv_name ASC");
while(list($tv_id, $tv_name, $tv_language) = mysql_fetch_row($result)) {
if ($tv_language == "") {
$tv_language = ""._ALL."";
}
if ($tv_id != "") {
if ($count == 0) {
echo "<table border=\"1\" width=\"100%\">";
$count = 1;
}
echo "<tr><td><b>$idnum</b></td><td width=\"100%\"> $tv_name </td><td align=\"center\"> $tv_language </td><td nowrap> (<a href=\"admin.php?module=Internet_TV&op=ITVedit&tvid=$tv_id\">"._EDIT."</a>-<a href=\"admin.php?module=Internet_TV&op=ITVdelete&tvid=$tv_id\">"._DELETE."</a>) </td></tr>";
$idnum = $idnum + 1;
} }
if (($tv_id == "") AND ($count == 0)) {
echo "<center><i>"._INTVNOST."</i></center>";
}
if ($count == 1) {
echo "</table>";
}
echo "<br><center><a href=\"admin.php?module=Internet_TV&op=ITVnew\">"._INTVNEW."</a>";
CloseTable();
echo "<br>";
OpenTable();
$result = mysql_query("SELECT modulename, auto_start, picture, picture_dir, defpicture, nopicture_name, tvvert, tvhor FROM internet_tv_settings");
list($modulename, $auto_start, $picture, $picture_dir, $defpicture, $nopicture_name, $tvvert, $tvhor) = mysql_fetch_row($result);
echo "<center><b>"._INTVBLSET."</b></center><br>"
."<form action='admin.php?module=Internet_TV&op=main' method='post'>"
."<table border='0'><tr><td>"
.""._INTVMODNAME.":</td><td><select name='xmodulename'>";
$handle=opendir('modules');
while ($file = readdir($handle)) {
if ( (!ereg("[.]",$file)) ) {
$modulelist .= "$file ";
}
}
closedir($handle);
$modulelist = explode(" ", $modulelist);
sort($modulelist);
for ($i=0; $i < sizeof($modulelist); $i++) {
if($modulelist[$i]!="") {
echo "<option name='xmodulename' value='$modulelist[$i]' ";
if($modulelist[$i]==$modulename) echo "selected";
echo ">$modulelist[$i]\n";
}
}
echo "</select>"
."</td></tr><tr><td>"._INTVAUTOST.":</td><td>";
if ($auto_start==1) {
echo "<input type='radio' name='xautostart' value='1' checked>"._YES."
<input type='radio' name='xautostart' value='0'>"._NO."";
} else {
echo "<input type='radio' name='xautostart' value='1'>"._YES."
<input type='radio' name='xautostart' value='0' checked>"._NO."";
}
echo "</td></tr><tr><td>"._INTVPICCHO.":</td><td>";
if ($picture==1) {
echo "<input type='radio' name='xpicture' value='1' checked>"._YES."
<input type='radio' name='xpicture' value='0'>"._NO."";
} else {
echo "<input type='radio' name='xpicture' value='1'>"._YES."
<input type='radio' name='xpicture' value='0' checked>"._NO."";
}
echo "</td></tr><tr><td>"
.""._INTVPICDIR.":</td><td>"
."<input type=\"text\" name=\"xpicturedir\" size=\"50\" maxlength=\"50\" value=\"$picture_dir\">"
."</td></tr><tr><td>"._INTVPICDEF.":</td><td>";
if ($defpicture==1) {
echo "<input type='radio' name='xdefpicture' value='1' checked>"._YES."
<input type='radio' name='xdefpicture' value='0'>"._NO."";
} else {
echo "<input type='radio' name='xdefpicture' value='1'>"._YES."
<input type='radio' name='xdefpicture' value='0' checked>"._NO."";
}
echo "</td></tr><tr><td>"
.""._INTVNOPICNAME.":</td><td>"
."<input type=\"text\" name=\"xnopicturename\" size=\"50\" maxlength=\"50\" value=\"$nopicture_name\">"
."</td></tr><tr><td>"
.""._INTVHEIGHT.":</td><td>"
."<input type=\"text\" name=\"xtvvert\" size=\"5\" maxlength=\"3\" value=\"$tvvert\">"
."</td></tr><tr><td>"
.""._INTVWIDTH.":</td><td>"
."<input type=\"text\" name=\"xtvhor\" size=\"5\" maxlength=\"3\" value=\"$tvhor\">"
."</td></tr><tr><td></td><td>";
echo "</td></tr><tr><td><br><br>"
."<input type=\"hidden\" name=\"op\" value=\"ITVsettings\">"
."<input type=\"submit\" value=\""._SAVECHANGES."\">"
."</tr></td></table></form>";
CloseTable();
include ('footer.php');
}
function ITVdelete() {
global $tvid;
mysql_query("DELETE FROM internet_tv WHERE tv_id=$tvid");
header("Location: admin.php?module=Internet_TV&op=main");
}
function ITVedit() {
global $tvid, $multilingual;
include ('header.php');
GraphicAdmin();
echo "
<script language=\"JavaScript\" type=\"text/javascript\">
function checkform (form)
{
if (form.tvname.value == \"\") {
alert(\""._INTVERR1."\" );
form.tvname.focus();
return false ;
}
if (form.tvstream.value == \"http://\"){
alert( \""._INTVERR2."\" );
form.tvstream.focus();
return false ;
}
return true ;
}
</script>";
OpenTable();
echo "<center><font class=\"title\"><b>Internet TV "._ADMINISTRATION."</b></font></center>";
CloseTable();
echo "<br>";
$result = mysql_query("SELECT tv_name, tv_stream, tv_url, tv_picture, tv_language FROM internet_tv WHERE tv_id=$tvid");
list($tv_name, $tv_stream, $tv_url, $tv_picture, $tv_language) = mysql_fetch_row($result);
OpenTable();
echo "<center><font class=\"option\"><b>"._INTVEDIT."</b></font></center><br>";
echo "<br><br>"
."<form action=\"admin.php?module=Internet_TV&op=main\" method=\"post\" onsubmit=\"return checkform(this);\">"
."<table border='0'><tr><td>"
.""._INTVNAME.":</td><td>"
."<input type=\"text\" name=\"tvname\" size=\"20\" maxlength=\"20\" value=\"$tv_name\">"
."</td></tr><tr><td>"
.""._INTVSTREAM.":</td><td>"
."<input type=\"text\" name=\"tvstream\" size=\"50\" maxlength=\"75\" value=\"$tv_stream\">"
."</td></tr><tr><td>"
.""._INTVURL.":</td><td>"
."<input type=\"text\" name=\"tvurl\" size=\"50\" maxlength=\"50\" value=\"$tv_url\">"
." ("._OPTION.")</td></tr><tr><td>"
.""._INTVPICT.":</td><td>"
."<input type=\"text\" name=\"tvpicture\" size=\"50\" maxlength=\"50\" value=\"$tv_picture\"> ("._INTVPICTDIR.")"
."</td></tr><tr><td>";
if ($multilingual == 0) {
echo "<br><br><b>"._LANGUAGE.": </b>"
."<select name=\"tvlanguage\" class=\"pn-text\">";
$lang = languagelist();
$sel_lang[$currentlang] = ' selected';
print '<option value="">'._ALL.'</option>';
$handle = opendir('language');
while ($f = readdir($handle))
{
if (is_dir("language/$f") && (!empty($lang[$f])))
{
$langlist[$f] = $lang[$f];
}
}
asort($langlist);
// a bit ugly, but it works in E_ALL conditions (Andy Varganov)
foreach ($langlist as $k=>$v){
echo '<option value="'.$k.'"';
if (isset($sel_lang[$k])) echo ' selected';
echo '>'. $v . '</option>\n';
}
}
echo "</select>";
echo "</td></tr><tr><td><br><br>"
."<input type=\"hidden\" NAME=\"tvid\" size=\"50\" value=\"$tvid\">"
."<input type=\"hidden\" name=\"op\" value=\"ITVchange\">"
."<input type=\"submit\" value=\""._SAVECHANGES."\">"
."</tr></td></table></form>";
CloseTable();
include ('footer.php');
}
function ITVchange($tvid, $tvname, $tvstream, $tvurl, $tvpicture, $tvlanguage) {
global $prefix;
mysql_query("UPDATE internet_tv SET tv_name='$tvname', tv_stream='$tvstream', tv_url='$tvurl', tv_picture='$tvpicture', tv_language='$tvlanguage' WHERE tv_id=$tvid");
header("Location: admin.php?module=Internet_TV&op=main");
}
function ITVnew() {
global $tvid, $multilingual;
include ('header.php');
GraphicAdmin();
echo "
<script language=\"JavaScript\" type=\"text/javascript\">
function checkform (form)
{
if (form.tvname.value == \"\") {
alert(\""._INTVERR1."\" );
form.tvname.focus();
return false ;
}
if (form.tvstream.value == \"http://\") {
alert( \""._INTVERR2."\" );
form.tvstream.focus();
return false ;
}
return true ;
}
</script>";
OpenTable();
echo "<center><font class=\"title\"><b>Internet TV "._ADMINISTRATION."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"option\"><b>"._INTVNEW."</b></font></center><br>";
echo "<br><br>"
."<form action=\"admin.php?module=Internet_TV&op=main\" method=\"post\" onsubmit=\"return checkform(this);\">"
."<table border='0'><tr><td>"
.""._INTVNAME.":</td><td>"
."<input type=\"text\" name=\"tvname\" size=\"20\" maxlength=\"20\">"
."</td></tr><tr><td>"
.""._INTVSTREAM.":</td><td>"
."<input type=\"text\" name=\"tvstream\" size=\"50\" maxlength=\"75\" value=\"http://\">"
."</td></tr><tr><td>"
.""._INTVURL.":</td><td>"
."<input type=\"text\" name=\"tvurl\" size=\"50\" maxlength=\"50\" value=\"http://\">"
." ("._OPTION.")</td></tr><tr><td>"
.""._INTVPICT.":</td><td>"
."<input type=\"text\" name=\"tvpicture\" size=\"50\" maxlength=\"50\" > ("._INTVPICTDIR.")"
."</td></tr><tr><td>";
if ($multilingual == 0) {
echo "<br><br><b>"._LANGUAGE.": </b>"
."<select name=\"tvlanguage\" class=\"pn-text\">";
$lang = languagelist();
$sel_lang[$currentlang] = ' selected';
print '<option value="">'._ALL.'</option>';
$handle = opendir('language');
while ($f = readdir($handle))
{
if (is_dir("language/$f") && (!empty($lang[$f])))
{
$langlist[$f] = $lang[$f];
}
}
asort($langlist);
// a bit ugly, but it works in E_ALL conditions (Andy Varganov)
foreach ($langlist as $k=>$v){
echo '<option value="'.$k.'"';
if (isset($sel_lang[$k])) echo ' selected';
echo '>'. $v . '</option>\n';
}
}
echo "</select>";
echo "</td></tr><tr><td><br><br>"
."<input type=\"hidden\" name=\"op\" value=\"ITVadd\">"
."<input type=\"submit\" value=\""._SAVECHANGES."\">"
."</tr></td></table></form>";
CloseTable();
include ('footer.php');
}
function ITVadd($tvname, $tvstream, $tvurl, $tvpicture, $tvlanguage) {
global $prefix;
mysql_query("INSERT INTO internet_tv VALUES ('','$tvname', '$tvstream', '$tvurl', '$tvpicture', '$tvlanguage')");
header("Location: admin.php?module=Internet_TV&op=main");
}
function ITVsettings($xmodulename, $xautostart, $xpicture, $xpicturedir, $xdefpicture, $xnopicturename, $xtvvert, $xtvhor) {
global $prefix;
mysql_query("UPDATE internet_tv_settings SET modulename='$xmodulename', auto_start='$xautostart', picture='$xpicture', picture_dir='$xpicturedir', defpicture='$xdefpicture', nopicture_name='$xnopicturename', tvvert='$xtvvert', tvhor='$xtvhor'");
header("Location: admin.php?module=Internet_TV&op=main");
}
switch($op) {
case "main":
main();
break;
case "ITVdelete":
ITVdelete();
break;
case "ITVedit":
ITVedit();
break;
case "ITVchange":
ITVchange($tvid, $tvname, $tvstream, $tvurl, $tvpicture, $tvlanguage);
break;
case "ITVnew":
ITVnew();
break;
case "ITVadd":
ITVadd($tvname, $tvstream, $tvurl, $tvpicture, $tvlanguage);
break;
case "ITVsettings":
ITVsettings($xmodulename, $xautostart, $xpicture, $xpicturedir, $xdefpicture, $xnopicturename, $xtvvert, $xtvhor);
break;
}
?>
Somehow old code. Whats is easy to detect in order to make it run with PN .762 and PHP 5.1x??
I suspect from:
1- Module call format
2- $_SERVER and SELF calls not compatible with PHP 5.1.x
3- PN DB connections
So, any tip will be appreciated. It could be a similar 'old' module that was fixed so I can use it as example.
Later
p.d.
Below is the index.php file:
Code
<?php
/**************************************************************************/
/* PostNuke: Internet TV Block/Module */
/* ===================================== */
/* */
/* Modified for PostNuke by Kemas Yunus Antonius */
/* (kyantonius@kyantonius.com) */
/* http://www.kyantonius.com */
/* Initial Release : March 26, 2003 */
/**************************************************************************/
/* PHP-NUKE: Internet TV 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. */
/* */
/* */
/**************************************************************************/
//******************************************//
// DO NOT CHANGE ANYTHING ON THIS SCRIPT !! //
// LEAVE COPYRIGHT IN PLACE //
//******************************************//
// standard for modules security system
if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}
// Security check
if (!pnSecAuthAction(0, 'Internet TV::', '::', ACCESS_READ)) {
include 'header.php';
echo _BADAUTHKEY;
include 'footer.php';
return;
}
$ModName = basename( dirname( __file__ ) );
include("mainfile.php");
modules_get_language();
global $tv, $currentlang, $TVFloatCookie ;
$currentlang = pnUserGetLang();
//standard for module name recognition
include("header.php");
$tv = $_POST['tvselect'];
$PHP_SELF = $_SERVER['PHP_SELF'];
// block settings
$result = mysql_query("SELECT auto_start, picture, picture_dir, defpicture, nopicture_name, tvvert, tvhor FROM internet_tv_settings");
list($auto_start, $picture, $picture_dir, $defpicture, $nopicture_name, $tvvert, $tvhor) = mysql_fetch_row($result);
if ($auto_start == 0)
{$autostart = "false";}
else
{$autostart = "true";}
//tv station selection
if ($tv == 0){
$result=mysql_query("SELECT tv_id, tv_name, tv_stream, tv_url, tv_picture FROM internet_tv WHERE tv_language='$currentlang' OR tv_language=''");
$num=mysql_numrows($result);
if ($num == 1){
list($tv_id, $tv_name, $tv_stream, $tv_url, $tv_picture) = mysql_fetch_row($result);
$stream = $tv_stream;
if ($tv_url !="" AND $tv_url != "http://"){
$url = $tv_url;}
$stationname = $tv_name;
$tvstart = $autostart;
$tv = $tv_id;}
else {
$stationname = ""._INTVNOC."";}
}else {
$result = mysql_query("SELECT tv_name, tv_stream, tv_url, tv_picture FROM internet_tv WHERE tv_id='$tv'");
list($tv_name, $tv_stream, $tv_url, $tv_picture) = mysql_fetch_row($result);
$stream = $tv_stream;
if ($tv_url !="" AND $tv_url != "http://"){
$url = $tv_url;}
$stationname = $tv_name;
$tvstart = "true";
}
// function to check for real player files
function checkreal2($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);
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;
} else {
return false;
}
}
// script for opening window
echo "<SCRIPT LANGUAGE=\"JavaScript\">
function launch(url) {
remote = open(url, \"\", \"width=190,height=190,left=0,top=0\");
}
</SCRIPT>";
// picture settings
$picture_name = $tv_picture;
if ($picture == 1 and ($picture_name =="" and $defpicture == 1))
{$picture_name = $nopicture_name;}
// content to display
if(isset($TVFloatCookie))
{ $tvcontent = "<center>"._INTVDIS."</center>";}
else {
if ($url !=""){
$tvcontent = "<center>"._INTVSEL.":<br> <a HREF=$url target=\"_blank\">$stationname</a><br><br>";
if ($picture == 1 and $picture_name != ""){
$tvcontent .= "<a href= $url target=\"_blank\"><img border=\"0\" src='$picture_dir/$picture_name'></a><br><br>";}
}
else {
$tvcontent = "<center>"._INTVSEL.":<br> $stationname</a><br><br>";
if ($picture == 1 and $picture_name != ""){
$tvcontent .= "<img border=\"0\" src='$picture_dir/$picture_name'></a><br><br>";}
}
if (checkreal2($stream) == true)
{$tvcontent .= "
<OBJECT ID=player CLASSID='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'
HEIGHT=$tvvert WIDTH=$tvhor>
<PARAM NAME='controls' VALUE='ImageWindow,StatusBAr,Controlpanel'>
<PARAM NAME='console' VALUE='Clip1'>
<PARAM NAME='autostart' VALUE=$tvstart>
<PARAM NAME='src' VALUE='$stream'>
<EMBED SRC='$stream' type='audio/x-pn-realaudio-plugin' CONSOLE='Clip1' CONTROLS='ImageWindow,StatusBar,ControlPanel'
HEIGHT=$tvvert WIDTH=$tvhor AUTOSTART=$tvstart pluginspage='http://www.real.com/'></EMBED>
<noembed><a href='$stream'>Play $stationname</a></noembed>
</OBJECT>";
}
else
{$tvcontent .= "
<OBJECT ID='Player' HEIGHT=$tvvert WIDTH=$tvhor 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='$stream'>
<PARAM NAME='ShowControls' VALUE='true'>
<PARAM NAME='ShowStatusBar' VALUE='true'>
<PARAM NAME='Autostart' VALUE='$tvstart'>
<PARAM NAME='ShowPositionControls' value='False'>
<PARAM NAME='ShowTracker' value='False'>
<EMBED type='application/x-mplayer2'
pluginspage = 'http://www.microsoft.com/Windows/MediaPlayer/'
SRC='$stream'
name='Player'
width=$tvvert
height=$tvhor
AutoStart='$tvstart'
showcontrols='$ShowControls' showstatusbar='$ShowStatusBar' showdisplay='$ShowDisplay'>
</EMBED>
<noembed><a href='$stream'>Play $stationname</a></noembed>
</OBJECT>";
}
if ($num != 1){
$tvcontent .= "<br><br><form name=\"form\" method=\"post\" action=\"modules.php?op=modload&name=$ModName&file=index\">";
$tvcontent .= "<select name=\"tvselect\" onchange=\"form.submit()\">";
$tvcontent .= "<option>- "._INTVCHO." -</option>";
$result = mysql_query("SELECT tv_id, tv_name FROM internet_tv WHERE tv_language='$currentlang' OR tv_language='' ORDER BY tv_name ASC");
while(list($tv_id, $tv_name) = mysql_fetch_row($result)) {
$tvcontent .= "<OPTION VALUE=\"$tv_id\">$tv_name</option>";}
$tvcontent .= "</select></form>";
}
else
{
$tvcontent .= "<br><br>";
}
if(!$tv){}
else
{
$tvcontent .= "";
}
$tvcontent .= "<a href=\"javascript:launch('modules.php?op=modload&name=Internet_TV&file=popup&tv=$tv&num=$num')\">"._INTVFLO."</A><br><br><a HREF=\"modules/Internet_TV/copyright.php\" target=\"_blank\">PN Internet TV v.1.1</a><br>";
$tvcontent .= "</center>";
}
$title = ereg_replace("_", " ", $ModName);
openTable();
echo "<center>$tvcontent</center>";
CloseTable();
include("footer.php");
?>
/**************************************************************************/
/* PostNuke: Internet TV Block/Module */
/* ===================================== */
/* */
/* Modified for PostNuke by Kemas Yunus Antonius */
/* (kyantonius@kyantonius.com) */
/* http://www.kyantonius.com */
/* Initial Release : March 26, 2003 */
/**************************************************************************/
/* PHP-NUKE: Internet TV 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. */
/* */
/* */
/**************************************************************************/
//******************************************//
// DO NOT CHANGE ANYTHING ON THIS SCRIPT !! //
// LEAVE COPYRIGHT IN PLACE //
//******************************************//
// standard for modules security system
if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}
// Security check
if (!pnSecAuthAction(0, 'Internet TV::', '::', ACCESS_READ)) {
include 'header.php';
echo _BADAUTHKEY;
include 'footer.php';
return;
}
$ModName = basename( dirname( __file__ ) );
include("mainfile.php");
modules_get_language();
global $tv, $currentlang, $TVFloatCookie ;
$currentlang = pnUserGetLang();
//standard for module name recognition
include("header.php");
$tv = $_POST['tvselect'];
$PHP_SELF = $_SERVER['PHP_SELF'];
// block settings
$result = mysql_query("SELECT auto_start, picture, picture_dir, defpicture, nopicture_name, tvvert, tvhor FROM internet_tv_settings");
list($auto_start, $picture, $picture_dir, $defpicture, $nopicture_name, $tvvert, $tvhor) = mysql_fetch_row($result);
if ($auto_start == 0)
{$autostart = "false";}
else
{$autostart = "true";}
//tv station selection
if ($tv == 0){
$result=mysql_query("SELECT tv_id, tv_name, tv_stream, tv_url, tv_picture FROM internet_tv WHERE tv_language='$currentlang' OR tv_language=''");
$num=mysql_numrows($result);
if ($num == 1){
list($tv_id, $tv_name, $tv_stream, $tv_url, $tv_picture) = mysql_fetch_row($result);
$stream = $tv_stream;
if ($tv_url !="" AND $tv_url != "http://"){
$url = $tv_url;}
$stationname = $tv_name;
$tvstart = $autostart;
$tv = $tv_id;}
else {
$stationname = ""._INTVNOC."";}
}else {
$result = mysql_query("SELECT tv_name, tv_stream, tv_url, tv_picture FROM internet_tv WHERE tv_id='$tv'");
list($tv_name, $tv_stream, $tv_url, $tv_picture) = mysql_fetch_row($result);
$stream = $tv_stream;
if ($tv_url !="" AND $tv_url != "http://"){
$url = $tv_url;}
$stationname = $tv_name;
$tvstart = "true";
}
// function to check for real player files
function checkreal2($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);
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;
} else {
return false;
}
}
// script for opening window
echo "<SCRIPT LANGUAGE=\"JavaScript\">
function launch(url) {
remote = open(url, \"\", \"width=190,height=190,left=0,top=0\");
}
</SCRIPT>";
// picture settings
$picture_name = $tv_picture;
if ($picture == 1 and ($picture_name =="" and $defpicture == 1))
{$picture_name = $nopicture_name;}
// content to display
if(isset($TVFloatCookie))
{ $tvcontent = "<center>"._INTVDIS."</center>";}
else {
if ($url !=""){
$tvcontent = "<center>"._INTVSEL.":<br> <a HREF=$url target=\"_blank\">$stationname</a><br><br>";
if ($picture == 1 and $picture_name != ""){
$tvcontent .= "<a href= $url target=\"_blank\"><img border=\"0\" src='$picture_dir/$picture_name'></a><br><br>";}
}
else {
$tvcontent = "<center>"._INTVSEL.":<br> $stationname</a><br><br>";
if ($picture == 1 and $picture_name != ""){
$tvcontent .= "<img border=\"0\" src='$picture_dir/$picture_name'></a><br><br>";}
}
if (checkreal2($stream) == true)
{$tvcontent .= "
<OBJECT ID=player CLASSID='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'
HEIGHT=$tvvert WIDTH=$tvhor>
<PARAM NAME='controls' VALUE='ImageWindow,StatusBAr,Controlpanel'>
<PARAM NAME='console' VALUE='Clip1'>
<PARAM NAME='autostart' VALUE=$tvstart>
<PARAM NAME='src' VALUE='$stream'>
<EMBED SRC='$stream' type='audio/x-pn-realaudio-plugin' CONSOLE='Clip1' CONTROLS='ImageWindow,StatusBar,ControlPanel'
HEIGHT=$tvvert WIDTH=$tvhor AUTOSTART=$tvstart pluginspage='http://www.real.com/'></EMBED>
<noembed><a href='$stream'>Play $stationname</a></noembed>
</OBJECT>";
}
else
{$tvcontent .= "
<OBJECT ID='Player' HEIGHT=$tvvert WIDTH=$tvhor 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='$stream'>
<PARAM NAME='ShowControls' VALUE='true'>
<PARAM NAME='ShowStatusBar' VALUE='true'>
<PARAM NAME='Autostart' VALUE='$tvstart'>
<PARAM NAME='ShowPositionControls' value='False'>
<PARAM NAME='ShowTracker' value='False'>
<EMBED type='application/x-mplayer2'
pluginspage = 'http://www.microsoft.com/Windows/MediaPlayer/'
SRC='$stream'
name='Player'
width=$tvvert
height=$tvhor
AutoStart='$tvstart'
showcontrols='$ShowControls' showstatusbar='$ShowStatusBar' showdisplay='$ShowDisplay'>
</EMBED>
<noembed><a href='$stream'>Play $stationname</a></noembed>
</OBJECT>";
}
if ($num != 1){
$tvcontent .= "<br><br><form name=\"form\" method=\"post\" action=\"modules.php?op=modload&name=$ModName&file=index\">";
$tvcontent .= "<select name=\"tvselect\" onchange=\"form.submit()\">";
$tvcontent .= "<option>- "._INTVCHO." -</option>";
$result = mysql_query("SELECT tv_id, tv_name FROM internet_tv WHERE tv_language='$currentlang' OR tv_language='' ORDER BY tv_name ASC");
while(list($tv_id, $tv_name) = mysql_fetch_row($result)) {
$tvcontent .= "<OPTION VALUE=\"$tv_id\">$tv_name</option>";}
$tvcontent .= "</select></form>";
}
else
{
$tvcontent .= "<br><br>";
}
if(!$tv){}
else
{
$tvcontent .= "";
}
$tvcontent .= "<a href=\"javascript:launch('modules.php?op=modload&name=Internet_TV&file=popup&tv=$tv&num=$num')\">"._INTVFLO."</A><br><br><a HREF=\"modules/Internet_TV/copyright.php\" target=\"_blank\">PN Internet TV v.1.1</a><br>";
$tvcontent .= "</center>";
}
$title = ereg_replace("_", " ", $ModName);
openTable();
echo "<center>$tvcontent</center>";
CloseTable();
include("footer.php");
?>