<?php
	$break = explode('/', $_SERVER["SCRIPT_NAME"]);
	if($break[count($break) - 1] != "index.php") { header("Location: ../index.php"); exit(); } 
?>
			<div class="componentheading"><?php echo UNIVERSE_ID; ?> Universe Portal</div>
<?php
if($session->logged_in and $session->isAdmin() and $database->checkForUpdateStatus())
{
?>
			<div class="module_menu">
				<div>
					<div>
						<div>
							<h3>Software Update Available</h3>
							<h1>A software update is available for Universal Unreal.</h1>
							It is important to keep your installation of Universal
							Unreal up to date to ensure server security and stability.
							Learn more and download this recent update at:<br><br>
							<a href="<?php echo $database->getUpdateLocation(); ?>"><?php echo $database->getUpdateLocation(); ?></a>
						</div>
					</div>
				</div>
			</div>
<?php
}
?>
<?php
if($session->logged_in and $session->userHasBuddyNotification)
{
?>
			<div class="module_menu">
				<div>
					<div>
						<div>
							<h3>Buddy Request Notification</h3>
								<h1><a href="index.php?p=buddies">You have one or more unanswered buddy requests</a></h1>
						</div>
					</div>
				</div>
			</div>
<?php
}
?>
			<div class="module_menu">
				<div>
					<div>
						<div>
							<h3><?php if(substr(strtoupper($session->username),-1) == "S") $postFix = "'"; else $postFix = "'s"; echo $session->username . $postFix; ?> Notifications</h3>
<?php
	$bNotification = false;
	
	if($session->logged_in and $session->userinfo['accepted_settings'] == 0)
	{
		echo "<h1>Please verify your account settings</h1><h2>When you created your account, Universal Unreal asked you only for basic information. For a better Universal Unreal experience, please confirm your account settings by <a href=\"index.php?p=account\">visiting the 'Account' page now.</a></h2><br>";
	}
	
	// check for portal announcements
	if(strlen(PORTAL_MSG) > 0)
	{
		$bNotification = true;
		echo "<h1>Administrator Announcement:</h1><h2>".PORTAL_MSG."</h2><br>";
	}
	
	if(!$bNotification and $session->logged_in)
	{
		echo "<h1>No new notifications</h1>";
	}
	
	if($session->logged_in)
	{
		$random_tip = array("you can search and add buddies from the 'buddies' page. Just click on the 'Buddies' link to get started.",
							 "once you've sent a buddy request, that person must approve it before you can become buddies.",
							 "you can set up your account to automatically accept buddy requests. That option is located on the 'Account' page.",
							 "to get a full list of universe servers in quickly, just say '!info servers' from in-game.",
							 "Universal Unreal logs all of your private messages for you to look at again later. Click the 'Private Messages' link to view your message history.",
							 "you can private message your buddies in-game from this website. Click the 'Private Messages' link to send a message to an online buddy.",
							 "take some time to get to know the Universal Unreal in-game commands. Just head over to the 'Help &amp; How To Use' area to learn more.");
		srand(time());
		$sizeof = count($random_tip);
		$arrRand = (rand()%$sizeof);
		echo "Tip: ".$random_tip[$arrRand];
	}
	else
	{
		echo "<h1>Want to know more about Universal Unreal?</h1>\n";
		echo "<h2>Universal Unreal is a system by which players can better connect with each other.\n";
		echo "If you are playing on a server that participates, Universal Unreal has the ability to\n";
		echo "notify you when one of your friends joins another server, even if you aren't playing on\n";
		echo "that server at that time! And that's only a fraction of what Universal Unreal can do.<br><br>\n";
		echo "<a href=\"index.php?p=about\">To learn more, visit the About page!</a><br><br>\n";
		echo "<a href=\"index.php?p=register\">Ready to sign up? Click here to register for an account!</a></h2>";
	}
?>
						</div>
					</div>
				</div>
			</div>