<?php

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

 register.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.
 *
 ***************************************************************************/

include_once ("rootdatapath.php");
require_once ($GLOBALS["rootdp"]."include/config.php");
require_once ($GLOBALS["rootdp"]."include/db.php");
require_once ($GLOBALS["rootdp"]."include/session.php");
include ($GLOBALS["rootdp"]."include/settings.php");

// Validate the user's level of access for this form.
if (($EZ_SESSION_VARS["PasswordCookie"] != '') && ($EZ_SESSION_VARS["UserGroup"] == $GLOBALS["gsAdminPrivGroup"])) {
	include ($GLOBALS["rootdp"]."include/functions.php");
	include ("adminfunctions.php");
	include ($GLOBALS["rootdp"]."include/registration.php");

	includeLanguageFiles('admin');


	$GLOBALS["specialedit"] = True;
	$GLOBALS["tabindex"] = 1024;

	if ($HTTP_POST_VARS["submitted"] == "yes") {
		// User has submitted the data
		Register();
		Header("Location: ".BuildLink($GLOBALS["rootdp"].'about.php'));
	}
	frmRegister();
}




function frmRegister()
{
	global $HTTP_POST_VARS;

	adminformheader();
	adminformopen('hashcode');
	adminformtitle(2,$GLOBALS["tRegister"]);
	echo $GLOBALS["strErrors"];
	?>
	<tr class="tablecontent">
		<?php FieldHeading("RegistrationHash","hashcode"); ?>
		<td valign="top" class="content">
			<input type="text" name="hashcode" size="40" value="<?php echo $GLOBALS["registration_hash"]; ?>" maxlength="32">
		</td>
	</tr>
	<tr class="tablecontent">
		<?php FieldHeading("RegistrationBlock","registrationblock"); ?>
		<td valign="top" class="content">
			<textarea name="registrationblock" rows="6" cols="64"><?php echo stripslashes($GLOBALS["registration_details"]); ?></textarea>
		</td>
	</tr>
	<tr class="tablecontent">
		<?php FieldHeading("RegistrationDate","RegistrationDay"); ?>
		<td colspan="3" valign="top" class="content">
			<?php admindatedisplay('Registration',$GLOBALS["registration_date"]); ?>
       </td>
   </tr>
	<?php
	adminformsavebar(2,$GLOBALS["rootdp"].'about.php');
	adminhelpmsg(2);
	adminformclose();
} // function frmRegister()


function Register()
{
	global $HTTP_POST_VARS;

	$registrationisodate = sprintf("%04d-%02d-%02d", $HTTP_POST_VARS["RegistrationYear"], $HTTP_POST_VARS["RegistrationMonth"], $HTTP_POST_VARS["RegistrationDay"]);
	$registrationblock = trim(stripslashes($HTTP_POST_VARS["registrationblock"]));

	$cssSettingsModified = False;
	if (UpdateSetting($HTTP_POST_VARS["hashcode"],'registration_hash'))	{ $cssSettingsModified = True; }
	if (UpdateSetting($registrationblock,'registration_details'))	{ $cssSettingsModified = True; }
	if (UpdateSetting($registrationisodate,'registration_date'))	{ $cssSettingsModified = True; }

} // function Register()


include($GLOBALS["rootdp"]."include/javafuncs.php");

?>
