<? 
	include("vars.inc.php"); 
	// SysUptime ###############################################################
	$UP=explode(",",exec("sudo -u root $EASYPORTAL_SH uptime"));
	
	
	if($UP[0]>0) {
		if($UP[0]>1) {
			$UPTIME = $UP[0]." Tage ";
		} else {
			$UPTIME = $UP[0]." Tag ";
		}	
	}
	
	if($UP[1]>0) {
		if($UP[1]>1) {
			$UPTIME .= $UP[1]." Stunden "; 
		} else {
			$UPTIME .= $UP[1]." Stunde "; 
		}
	}
	
	if($UP[2]>0) {
		if($UP[2]>1) {
			$UPTIME .= $UP[2]." Minuten";
		} else {
			$UPTIME .= $UP[2]." Minute";
		}
	}
	
	
	
	// VDR-Uptime berechnen ####################################################
	$vdrstart=exec("sudo -u root $EASYPORTAL_SH vdruptime");
	
	if(strlen($vdrstart>0)) {
		$vdrdate=exec("sudo -u root $EASYPORTAL_SH vdrdate");
		$age = strtotime($vdrdate)- strtotime($vdrstart);
		
		$TAGE = floor($age / 86400);
		$age = $age - $TAGE * 86400;
		$STUNDEN = floor($age / 3600);
		$age = $age - $STUNDEN * 3600;
		$MINUTEN = floor($age / 60);
	
		if($TAGE>0) {
			if($TAGE>1) {
				$vdruptime = "$TAGE Tage ";
			} else {
				$vdruptime = "$TAGE Tag ";
			}	
		}
	
		if($STUNDEN>0) {
			if($STUNDEN>1) {
				$vdruptime .= "$STUNDEN Stunden "; 
			} else {
				$vdruptime .= "$STUNDEN Stunde "; 
			}
		}
	
		if($MINUTEN>0) {
			if($MINUTEN>1) {
				$vdruptime .= "$MINUTEN Minuten";
			} else {
				$vdruptime .= "$MINUTEN Minute";
			}
		}
	} else {
		$vdruptime = $UP_VDRSTOP;
	}
	
	
	
		
?>
<div id="informationen" class="CatContainer">
	<div class="title">
		<img src="images/time.png" align="left" class="icon">Zeit / Uptime
	</div>
	<div class="content">
		<table width="95%">
			<tr>
				<td>Systemzeit:</td>
				<td><b><? echo passthru("sudo -u root $EASYPORTAL_SH date"); ?></b></td>
			</tr>
			<tr>
				<td>Uptime:</td>
				<td><b><? echo $UPTIME; ?></b></td>
			</tr>
			<tr>
				<td>VDR-Uptime:</td>
				<td><b><? echo $vdruptime; ?></b></td>
			</tr>
		</table>
	</div>
</div> 