<?
error_reporting (E_ALL ^ E_NOTICE);
////////////////////////////////////////////////////////////////////////
/*SMI - SHOUTcast Management Interface
A web based shoutcast server management program
Founding Author: Scott D. Harvanek <scotth@sourcemirrors.org>

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, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.*/
////////////////////////////////////////////////////////////////////////
ob_start();
?>
<html>
<head>
<title>
<?
require('include/functions.inc.php');

// Check that SMI is installed - if not, redirect to install
if(check_install() == "1") {
        header('Location: install/install.php');
} else {
serviceTitle(); ?>
</title>
<link rel="stylesheet" type="text/css" href="include/smi.css">
<link rel="shortcut icon" type="image/x-icon" href="imgs/favicon.ico">

<SCRIPT language="JavaScript" type="text/javascript">
<!--
function go_there()
{
 var where_to= confirm("Do you really want to delete this server?");
 if (where_to== true)
 {
   window.location="delete.php";
 }
 else
 {
  window.location="home.php";
  }
}
//-->
</SCRIPT>
<script type="text/javascript">
<!--
function updateClock ( )
{
  var currentTime = new Date ( );
  var currentHours = currentTime.getHours ( );
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );
  // Pad the minutes and seconds with leading zeros, if required
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
  // Convert the hours component to 12-hour format if needed
  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;
  // Compose the string for display
  var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
  // Update the time display
  document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}
// -->
</script>
<script type="text/javascript" src="include/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
        $(".serid").hover(function() {
                $(".popup").fadeIn("fast");
        }, function() {
                $(".popup").fadeOut("slow");
        });
});
</script>
<script type="text/javascript">
      $(document).ready(function() {
        $('#rowclick tr')
          .filter(':has(:checkbox:checked)')
          .addClass('selected')
          .end()
          .click(function(event) {
          $(this).toggleClass('selected');
          if (event.target.type !== 'checkbox') {
            $(this).toggleClass('selected');
            $(':checkbox', this).trigger('click');
          }
        });
      });
</script>
</head>
<body onload="updateClock(); setInterval('updateClock()', 1000 )">
<?session_start();
if(!$_SESSION['username']){
?>
<div class="header">
<img src="imgs/smi-header.jpg" alt="SMI Header">
<br></div>
<?
echo "<center>Please <a href=\"login.php\">LOGIN</a></center>";
echo $_SESSION['username'];
	die('Unauthenticated');
}
?>
<div class="header">
<img src="imgs/smi-header.jpg" alt="SMI Header">
<br></div>
<table border="0" cellpadding="0" cellspacing="0" align="right" width="100%">
        <tr>
                <td align="left" class="headbarfont"><img src="imgs/time.png" border="0" class="textmiddle">
  		<span id="clock">&nbsp;</span>
		<? //echo strftime("%T"); 
		echo "&nbsp;&nbsp;&nbsp;"; echo "<img src=\"imgs/date.png\" border=\"0\" class=\"textmiddle\">&nbsp;".date('Y-m-d')."";?>&nbsp;&nbsp;<img src="imgs/headbar-spacer.png" border="0" class="textmiddle">&nbsp;
		<a class="headbarlink" href="home.php"><img src="imgs/home.png" border="0" class="textmiddle">&nbsp;Home</a>
		&nbsp; <a class="headbarlink" href="new.php"><img src="imgs/new_server.png" border="0" class="textmiddle">&nbsp;New Server</a>
		&nbsp; <a class="headbarlink" href="users.php"><img src="imgs/user_management.png" border="0" class="textmiddle">&nbsp;User Management</a>
		&nbsp; <a class="headbarlink" href="eventlog.php"><img src="imgs/event_log.png" border="0" class="textmiddle">&nbsp;Event Log</a>
		&nbsp; <a class="headbarlink" href="setup.php"><img src="imgs/settings.png" border="0" class="textmiddle">&nbsp;Settings</a>
		&nbsp; <a class="headbarlink" href="media.php"><img src="imgs/sound.png" border="0" class="textmiddle">&nbsp;Media</a>
                </td>
                <td align="right" class="headbarfont">
                        Current User:&nbsp;&nbsp;&nbsp;<?echo "<img src=\"imgs/user.png\" border=\"0\" class=\"textmiddle\">&nbsp;".$_SESSION['username']."";?>&nbsp;&nbsp;&nbsp;<?echo "<img src=\"imgs/ip.png\" border=\"0\" class=\"textmiddle\">&nbsp;".$_SESSION["ip"]."";?>&nbsp;&nbsp;&nbsp;<img src="imgs/logout.png" border="0" class="textmiddle">&nbsp;<a class="headbarlink" href="logout.php">Logout</a>
                </td>
        </tr>
        <tr>
                <td valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%" background="imgs/menufade.png">
        <tr>
                <td valign="top" align="left">
                <img src="imgs/menuleft.png">
                </td>
        </tr>
</table>
                </td>
                <td valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%" background="imgs/menufade.png">
        <tr>
                <td valign="top" align="right">
                <img src="imgs/menuright.png">
                </td>
        </tr>
</table>
                </td>
        </tr>

</table>
<hr><hr><hr>
<?
} // End: if(check_install() == "1")
?>
