<?php
if (!defined('ADMIN_FILE') || !is_admin_modul($aid, "Mp3Player")) die("Illegal File Access");

function pmain(){
	global $prefix, $db, $bgcolor1, $bgcolor4, $admin_file;
	include ("header.php");
	GraphicAdmin();
	OpenTable();

echo "<script language=\"javascript\" type=\"text/javascript\">
<!-- Begin
function Start(page) {
OpenWin = this.open(page, \"CtrlWindow\", \"toolbar=no,width=500,height=500,menubar=no,location=no,scrollbars=yes,resizable=yes\");
}
// End -->
</script>";



CloseTable();

OpenTable();
	$result = $db->sql_query("SELECT content FROM ".$prefix."_mp3player WHERE mid='Mp3Player'");
	if (! list($content) = $db->sql_fetchrow($result)){
		$content = "Здесь Ваши пояснения к модулю";
		$db->sql_query("INSERT INTO ".$prefix."_mp3player (mid, content) VALUES ('Mp3Player', '$content')");
	}

echo "<script language=\"javascript\" type=\"text/javascript\">
<!--
    var RndNum4NoCash = Math.round(Math.random() * 1000000000);
    document.write('<sc' + 'ript language=\"JavaScript\" type=\"text/javascript\" src=\"http://ad.adriver.ru/cgi-bin/erle.cgi?sid=73289&amp;target=top&amp;bt=16&amp;pz=0&amp;rnd=' + RndNum4NoCash + '\"><\/sc' + 'ript>');
//-->
</script>";


	echo "<b>Предпросмотр</b><br><hr>$content<hr>"
	."<form method=\"post\" action=\"".$admin_file.".php?op=mp3player_save\">"
	."<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"$bgcolor4\" align=\"center\">"
	."<tr bgcolor=\"$bgcolor1\"><td>Содержание страницы</td><td>"
	."<textarea name=\"content\" cols=\"30\" rows=\"25\" style=\"width:500px\">$content</textarea>"
	."</td></tr></table><br><center><input type=\"submit\" value=\"Сохранить\"></center></form>";
echo "<center><br>";
echo "<a href=\"javascript:OpenWindow(&#039;modules/Tiny_mce/admin.php&#039;, &#039;Redaktor&#039;, &#039;500&#039;, &#039;450&#039;)\" title=\"HTML редактор\"><b>HTML редактор</b></a></center>";
CloseTable();

include ("footer.php");
}

function mp3player_save($content){
	global $prefix, $db, $admin_file;
    $content = stripslashes(FixQuotes($content));
	$db->sql_query("UPDATE ".$prefix."_mp3player SET content='$content' WHERE mid='Mp3Player'");
    Header("Location: ".$admin_file.".php?op=mp3player");
}

switch ($op) {

case "mp3player":
    pmain();
    break;

	case "mp3player_save":
	mp3player_save($content);
	break;
}
?>