###############################################################################
# UB_Profile.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 Profile {

  (
    my ($Profile) = &DB::BinarySelect (
      TABLE   => "Profiles",
      KEY     => $UB::QUERY{'UID'}
    )
  ) || &HTML::Error(CODE => "ACCOUNT_NOT_FOUND");

  (
    my ($Account) = &DB::BinarySelect (
      TABLE   => "Accounts",
      KEY     => $UB::QUERY{'UID'}
    )
  ) || &HTML::Error(CODE => "ACCOUNT_NOT_FOUND");

  &Standard::Require("UltraBoard.lib", "$UB::LIBRARIES_PATH/UltraBoard.lib");

# =========================================================================== #
# Printing Profile

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

  $Profile->{'SIGNATURE'}  = &UltraBoard::Encode($Profile->{'SIGNATURE'}, 1);

  my %PROFILE = (
    "PROFILE.USERNAME"  => $Account->{'USERNAME'}        ,
    "PROFILE.NICKNAME"  => $Account->{'NICKNAME'}        ,
    "PROFILE.EMAIL"     => $Account->{'EMAIL'}           ,

    "PROFILE.LEVEL"       => $Account->{'LEVEL_TEXT'},
    "PROFILE.GROUP"       => $Account->{'GROUP_TEXT'},
    "PROFILE.STATUS"      => ($Account->{'STATUS'} eq "50") ? 1 : 0,

    "PROFILE.TOTAL_POSTS" => $Account->{'TOTAL_POSTS'},

    "PROFILE.REGISTERED_DATE" => $Account->{'REGISTERED_DATE'},
    "PROFILE.REGISTERED_TIME" => $Account->{'REGISTERED_TIME'},

    "PROFILE.LAST_POST_DATE"  => $Account->{'LAST_POST_DATE'},
    "PROFILE.LAST_POST_TIME"  => $Account->{'LAST_POST_TIME'},

    "PROFILE.LAST_LOGIN_DATE" => $Account->{'LAST_LOGIN_DATE'},
    "PROFILE.LAST_LOGIN_TIME" => $Account->{'LAST_LOGIN_TIME'},

    "PROFILE.HOMEPAGE"  => $Profile->{'HOMEPAGE'}  ,
    "PROFILE.LOCATION"  => $Profile->{'LOCATION'}  ,
    "PROFILE.OCCUPATION"=> $Profile->{'OCCUPATION'},
    "PROFILE.INTERESTS" => $Profile->{'INTEREST'}  ,
    "PROFILE.ICQ"       => $Profile->{'ICQ'}       ,
    "PROFILE.AGE"       => $Profile->{'AGE'}       ,
    "PROFILE.COMMENTS"  => $Profile->{'COMMENTS'}  ,
    "PROFILE.SIGNATURE" => $Profile->{'SIGNATURE'} ,

    &Standard::ExtraVariables()
  );

  if ($Account->{'HIDE_EMAIL'} == 1) {
    $PROFILE{'PROFILE.EMAIL'} = "";
  }

  if ($Profile->{'PHOTO'}) {
    $PROFILE{'PROFILE.PHOTO'} = "<img src=\"".$SYSTEM::UPLOAD_URL."/".$Profile->{'PHOTO'}."\" border=\"0\">";
  }

  &Standard::PrintHTMLHeader();
  print &Profile::Parse(\%PROFILE);
}

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