#!/usr/bin/perl
###################################################################################
#                                                                                 #
#                   PerlDesk - Customer Help Desk Software                        #
#                                                                                 #
###################################################################################
#                                                                                 #
#     Author: John Bennett	                                                  #
#      Email: j.bennett@perldesk.com                                              #
#        Web: http://www.perldesk.com                                             #
#   Filename: staff.cgi                                                           #
#    Details: The main staff file                                                 #
#    Release: 1.5.5                                                               #
#                                                                                 #
###################################################################################
# Please direct bug reports,suggestions or feedback to the perldesk forums.       #
# www.perldesk.com/board                                                          #
#                                                                                 #
# PerlDesk is free for both commercial and non-commercial use providing that the  #
# copyright headers remain intact and the links remain on the html pages.         #
# Re-distribution of this script without prior consent is strictly prohibited.    # 
#                                                                                 #
###################################################################################
# Please see the README/INSTALL files if you have any problems with this software #                                                            
################################################################################### 
 use CGI qw(:standard);                                 
 use DBI();                                             
 use Digest::MD5;   

 require "/var/www/agenda/cgi-bin/desk/include/pd.cgi";
 require "/var/www/agenda/cgi-bin/desk/include/conf.pl";

 
 if ((-e "install.cgi") || (-e "upgrade.cgi"))
  {
     script_error("You MUST delete install.cgi/upgrade.cgi before using the admin");
  }


eval {

   $dbh      =  DBI->connect("DBI:mysql:$dbname:$dbhost","$dbuser","$dbpass") or script_error("Could not connect to the help desk database");
   %global   =  get_vars();                                    
   $q        =  CGI->new();                         

   &get_time();

   my $lang = $q->param('language');        # Get the language choice, or set it 
      $lang ?                               # as the default.
           $language = $lang :             
           $language = $global{'language'};  

    require "include/admin_subs.cgi";       # Get the Required Files  
    require "include/lang/$language.inc";   # Get the specified lang file
    require "include/parse/admin.cgi";    # The template parsing 

    navigate();                             # Run the program
    $dbh->disconnect;
 };

if ($@)
 {                                               
    script_error("$@");
    exit;
 }                                                       


sub navigate 
   {         
          section($q->param('do')) if  defined $q->param('do');
          section("login")         if  !$q->param('do');  
        exit;	
   }



