Index.php

From Rhypedigital

Jump to: navigation, search
<?php
 
#
#  File     : index.php
#  Copyright: 2009
#           : Rhype Digital Ltd
#  License  : This file is released under the terms of the Rhype Digital Software Licence.
#           : Use of this software is prohibited without express permission of Rhype
#           : Digital Ltd.
#  EMail    : copyright@rhypedigital.com
#
 
set_include_path
      (  get_include_path() . PATH_SEPARATOR . '.'
      )  ;
 
require_once   ('RiPHPLib/DB/DB.php'         ) ;
require_once   ('RiPHPLib/MVC/Controller.php') ;
require_once   ('RiPHPLib/MVC/Document.php'  ) ;
require_once   ('RiPHPLib/CGI/CGI.php'       ) ;
require_once   ('RiPHPLib/Support/Debug.php' ) ;
require_once   ('Lib/Constants.php'    ) ;
require_once   ('Lib/Config.php'       ) ;
 
#Use this to connect to database
#$dbh    = new RPL_DB_DB
#         (  array
#            (  'hostname' => Lib_Config::$DB_HOSTNAME,
#               'database' => Lib_Config::$DB_DATABASE,
#               'username' => Lib_Config::$DB_USERNAME,
#               'password' => Lib_Config::$DB_PASSWORD,
#               'type'     => Lib_Config::$DB_TYPE
#         )  )  ;
#$dbh->connect  (true)   ;
 
 
$cgi        = RPL_CGI_CGI::CGI    () ;
$cgi->decodeSEO() ;
 
$switcher   = new RPL_MVC_Controller ($dbh, $cgi) ;
$script     = $cgi->param ('script', 'IndexCtrl') ;
$action     = $cgi->param ('action', 'init'     ) ;
 
try
{
   $doc     = $switcher->executeByParam ('Ctrl/' . $script, $action) ;
}
catch (Exception $e)
{
   print $e->getMessage() ;
   print '<br/>' ;
   print RPL_Support_Debug::traceAsHTML ($e) ;
   exit  (1) ;
}
 
#$dbh->commit () ;
RPL_MVC_Document::renderDocument ($doc, $cgi) ;
?>