#!/usr/bin/perl
###################################################################################
#                                                                                 #
#                   PerlDesk - Customer Help Desk Software                        #
#                                                                                 #
###################################################################################
#                                                                                 #
#     Author: John Bennett	                                                  #
#      Email: j.bennett@perldesk.com                                              #
#        Web: http://www.perldesk.com                                             #
#   Filename: pdesk.cgi                                                           #
#    Details: The main navigation 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";

 my $FILENAME = "pdesk.cgi";                # This file name
 
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();
   
   $language = $q->param('lang');
   $language = $global{'language'} if !$language;            

    require "include/subs.cgi";             # Get the Required Files  
    require "include/lang/$language.inc";   # Get the specified lang file
    require "include/parse/user.cgi";       # The template parsing 
    navigate();                             # Run the program
  
   $dbh->disconnect;
 };

if ($@) {                                               
           script_error("$@");              # There was an error, Make a quick exit!
           exit;
        }                                                        


sub navigate 
 { 
      $template{'mainfile'} = $FILENAME; 
      section($q->param('do')) if defined $q->param('do');

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

      exit;	
 }



