#!/usr/bin/perl
# ----------------------------------------------------------------------------
# This software is Copyright (C) 2007, All Rights Reserved
# ----------------------------------------------------------------------------
# This program is protected by local and international copyright laws. Any
# use of this program is subject to the the terms of the license agreement
# included as part of this distribution archive. Any other uses are strictly
# prohibited without the written permission of the Vendor and all
# other rights are reserved.
# -----------------------------------------------------------------------------
# Warning : Modifying this program violates your license agreement!
# -----------------------------------------------------------------------------

package IT::Globals;
require Exporter;

# This module just creates global aliases variables in all the modules that include
# it.  So if you re-assign $FORM in one module it will be re-assigned in the others

$VERSION   = "1.00";
@EXPORT    = (
  '$CRLF',                      # \r\n
  '$CGIDIR',                    # directory path of cgi script, eg: /www/cgi-bin/thisApp
  '$CGIURL',                    # web url of cgi script,        eg: http://www.example.com/cgi-bin/thisApp/app.cgi
  '$CGIURL_HOST',               # website domain,               eg: www.example.com
  '$CGIURL_PROTOCOL',           # http protocol (http or http), eg: http
  '$COOKIE',                    # hash of cookies
  '$CURRENT_USER',              # hash of record fields from the currently logged in user
  '$DATADIR',                   # data file directory,          eg: /www/cgi-bin/thisApp/data/
  '$DEBUG_ENABLED',
  '$FORM',                      # hash of form name/value pairs.  If there is duplicate names the last name/value submitted is used
  '$FORM_ARRAYS',               # hash of form names with an array of one or more values for each.
  '$FORM_UPLOADS',              # hash of form uploads
  '$INI',                       # hash of INI settings from config.ini
  '$IS_WINDOWS',                # is windows OS? 0 or 1
  '$PROGRAM_BUILD',             #
  '$PROGRAM_KEY',               #
  '$PROGRAM_ID',                #
  '$PROGRAM_VERSION',           #
  '$SCHEMA_FILEPATH',
  '$SETTINGS',                  # hash of program settings
  '$SETTINGS_DATAFILE',
  '$CURRENT_CONNECTION_NAME',
  '$TARGET_CONNECTION_NAME',
  '$TABLE_PREFIX',
  '$THUMBNAIL_PREFIX',

  # imported function names (define here and aliases below so autoloader knows where to look)
  '&template',
  '&templateCell',
  '&firstDefinedValue',
);
@EXPORT_OK = qw();
@ISA       = qw(Exporter);

use strict;

use vars qw($FORM $FORM_ARRAYS $FORM_UPLOADS);
use vars qw($IS_WINDOWS $CGIURL_PROTOCOL $CGIURL_HOST $CGIURL $CRLF);

# define globals
$IS_WINDOWS = 0;
if ($^O =~ /mswin|win32/i) { $IS_WINDOWS = 1; }
$CGIURL_PROTOCOL = lc($ENV{'HTTPS'}) eq 'on' ? 'https' : 'http';
$CGIURL_HOST     = $ENV{'HTTP_HOST'} || $ENV{'SERVER_NAME'};
$CGIURL          = $CGIURL_PROTOCOL . '://' . $CGIURL_HOST . $ENV{'SCRIPT_NAME'};
$CRLF            = "\x0D\x0A";

use vars qw($CURRENT_CONNECTION_NAME $TARGET_CONNECTION_NAME);
$CURRENT_CONNECTION_NAME = "current";
$TARGET_CONNECTION_NAME  = "target";

use vars qw($THUMBNAIL_PREFIX);
$THUMBNAIL_PREFIX = "_thumb";

use vars qw($CGIDIR);
$CGIDIR = $main::CGIDIR;

use vars qw($DEBUG_ENABLED);
$DEBUG_ENABLED = 0;

# define function aliases
*template              = \&IT::Template::template;
*templateCell          = \&IT::Template::templateCell;
*firstDefinedValue     = \&IT::Common::firstDefinedValue;

# ----------------------------------------------------------------------------
# end of file
1;

