<?php

/***************************************************************************

 registration.php
 -----------------
 copyright : (C) 2002-2003 The ezContents Development Team

 ***************************************************************************/

/***************************************************************************
 The ezContents Development Team offers no warranties on this script.
 The owner/licensee of the script is solely responsible for any problems
 caused by installation of the script or use of the script.

 All copyright notices regarding ezContents must remain intact on the
 scripts and in the HTML for the scripts.

 For more info on ezContents,
 visit http://www.ezcontents.org/

/***************************************************************************

/***************************************************************************
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the License which can be found within the
 *	zipped package.
 *
 ***************************************************************************/

function display_registration()
{
	global $EZ_SESSION_VARS;

	if (test_registration()) {
		?>
		<table border="1" cellspacing="1" cellpadding="8">
			<tr><td align="center" valign="top">
					<table border="0" cellspacing="1" cellpadding="6">
						<?php
						$updateisodate = dbDateTime(sprintf("%04d-%02d-%02d", strftime("%Y"), strftime("%m"), strftime("%d")));
						if ($GLOBALS["registration_date"] < strftime($updateisodate)) {
							?>
							<tr><td colspan="2" align="center" valign="top" class="teasercontent">
									<b>*** <?php echo $GLOBALS["tLicenseExpired"]; ?> ***</b>
								</td>
							</tr>
							<?php
						}
						?>
						<tr><td align="right" valign="top">
								<?php echo $GLOBALS["tRegisteredTo"].':'; ?>
							</td>
							<td align="left" valign="top">
								<?php
								$rd1 = explode('-->',$GLOBALS["registration_details"]);
								$registration_details = explode('<--',$rd1[1]);
								echo nl2br(trim(stripslashes($registration_details[0])));
								?>
							</td>
						</tr>
						<tr><td align="right" valign="top">
								<?php
									if (($EZ_SESSION_VARS["PasswordCookie"] != '') && ($EZ_SESSION_VARS["UserGroup"] == $GLOBALS["gsAdminPrivGroup"])) {
										echo '<a href='.BuildLink('./'.$GLOBALS["admin_home"].'register.php').'>';
									}
									echo $GLOBALS["tRegistrationDate"];
									if (($EZ_SESSION_VARS["PasswordCookie"] != '') && ($EZ_SESSION_VARS["UserGroup"] == $GLOBALS["gsAdminPrivGroup"])) {
										echo '</a>';
									}
									echo ':';
								?>
							</td>
							<td align="left" valign="top">
								<?php echo FormatDate(substr($GLOBALS["registration_date"], 0, 10)); ?>
							</td>
						</tr>
						<?php
						if ($GLOBALS["registration_date"] < strftime($updateisodate)) {
							?>
							<tr><td colspan="2" align="center" valign="top" class="teasercontent">
									<input type="button" value="<?php echo $GLOBALS["tRenewLicense"]; ?>" onClick="location.href = '<?php echo BuildLink('./'.$GLOBALS["admin_home"].'register.php'); ?>'">
								</td>
							</tr>
							<?php
						}
						?>
					</table>
				</td>
			</tr>
		</table>
		<?php
	} else {
		echo $GLOBALS["tUnregistered"];
		if (($EZ_SESSION_VARS["PasswordCookie"] != '') && ($EZ_SESSION_VARS["UserGroup"] == $GLOBALS["gsAdminPrivGroup"])) {
			?>
			<br /><input type="button" value="<?php echo $GLOBALS["tRegister"]; ?>" onClick="location.href = '<?php echo BuildLink('./'.$GLOBALS["admin_home"].'register.php'); ?>'">
			<?php
		}
	}
} // function display_registration()


function test_registration()
{
	return ($GLOBALS["registration_hash"] == md5(trim($GLOBALS["registration_date"]).str_replace("\n","",trim(stripslashes($GLOBALS["registration_details"])))));
} // function test_registration()

?>
