###############################################################################
# UB_Register.src                                                             #
###############################################################################
# UltraBoard 2000 by UltraScripts.com, Inc.                                   #
# Scripts written by Jacky Wing Wa Yung, WebMaster@UltraScripts.com           #
# Available from http://www.UltraBoard.org/                                   #
# =========================================================================== #
# COPYRIGHT NOTICE :                                                          #
#                                                                             #
# Copyright (c) 1999-2000 UltraScripts.com, Inc. All Rights Reserved.         #
#                                                                             #
# This program is being distributed as shareware. It may be used and modified #
# free for personal, government or non-profit. Any commercial use must be     #
# registered. However, modified versions cannot be sold or distributed. You   #
# cannot alter the copyright and "powered by" notices throughout the scripts. #
# These notices must be clearly visible to the end users.                     #
#                                                                             #
# WARRANTY DISCLAIMER:                                                        #
#                                                                             #
# 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.                                           #
###############################################################################

package Source;

use strict;

sub Register {
  my ($ERROR) = @_;

  (
    my ($Group) = &DB::BinarySelect (
      TABLE   => "Groups",
      COLUMNS => ["ID", "TITLE", "DESCRIPTION"],
      KEY     => $GENERAL::DEFAULT_GROUP
    )
  ) || &HTML::Error(MESSAGE => $DB::Error);

# =========================================================================== #
# Printing Register Form

  &Standard::Require("UB_Register.src", "$UB::INTERFACES_PATH/$SYSTEM::DEFAULT_THEME/UB_Register.src");

  my %FORM = (
    &Standard::ExtraVariables()
  );

  $FORM{'FORM.USERNAME'}          = $UB::QUERY{'FORM_USERNAME'}        || "";
  $FORM{'FORM.PASSWORD'}          = $UB::QUERY{'FORM_PASSWORD'}        || "";
  $FORM{'FORM.VERIFY_PASSWORD'}   = $UB::QUERY{'FORM_VERIFY_PASSWORD'} || "";
  $FORM{'FORM.MEMBERS_GROUP'}     = $Group->{'TITLE'}                       || "";
  $FORM{'FORM.DESCRIPTION.MEMBERS_GROUP'} = $Group->{'DESCRIPTION'}         || "";
  $FORM{'FORM.NICKNAME'}          = $UB::QUERY{'FORM_NICKNAME'}        || "";
  $FORM{'FORM.EMAIL'}             = $UB::QUERY{'FORM_EMAIL'}           || "";

  $FORM{'FORM.CHECKBOX.REMEMBER_PASSWORD'} = &HTML::Checkbox (
    NAME    => "FORM_REMEMBER_PASSWORD",
    VALUE   => "1"                     ,
    CHECKED => $UB::QUERY{'FORM_REMEMBER_PASSWORD'} || ""
  );
  $FORM{'FORM.CHECKBOX.HIDE_EMAIL'}        = &HTML::Checkbox (
    NAME    => "FORM_HIDE_EMAIL",
    VALUE   => "1"              ,
    CHECKED => $UB::QUERY{'FORM_HIDE_EMAIL'} || ""
  );

  $FORM{'ERROR.MESSAGE'}    = ($Register::DYNAMIC{"LANGUAGE.".$ERROR}) ? $Register::DYNAMIC{"LANGUAGE.".$ERROR} : $ERROR;

  &Standard::PrintHTMLHeader();
  print &Register::Parse(\%FORM);
}

###############################################################################
1; # end of UB_Register.src file
###############################################################################