| [ Index ] |
PHP Cross Reference of Web Application Component Toolkit |
[Summary view] [Print] [Text view]
1 <?php 2 //-------------------------------------------------------------------------------- 3 // Copyright 2003 Procata, Inc. 4 // Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html) 5 //-------------------------------------------------------------------------------- 6 /** 7 * @package WACT 8 * @version $Id: common.inc.php,v 1.43 2004/11/20 17:23:14 jeffmoore Exp $ 9 */ 10 11 // please don't mangle anything 12 set_magic_quotes_runtime(0); 13 14 /** 15 * Define WACT_ROOT, set error reporting and determine PHP version 16 */ 17 define('WACT_ROOT', dirname(__FILE__) . '/'); 18 19 /** 20 * Define WACT_MAIN_DIR - the directory containing the script where 21 * execution began (a users script) to calculate relative directory locations 22 * for templates etc. 23 */ 24 if ( !defined('WACT_MAIN_DIR') ) { 25 if ( php_sapi_name() != 'cli' ) { 26 define('WACT_MAIN_DIR',getcwd()); 27 } else { 28 // CLI working dir is the users working dir 29 define('WACT_MAIN_DIR',dirname(getcwd().'/'.$_SERVER['SCRIPT_FILENAME'])); 30 } 31 } 32 33 // we run best (fastest) in php 4.3, but we can run as far back as 4.1.0 34 /** 35 * Load is_a() emulation if necessary 36 */ 37 if (!function_exists('is_a')) { 38 require_once WACT_ROOT . 'util/phpcompat/is_a.php'; 39 } 40 41 if (! defined('WACT_ERROR_FACTORY')) { 42 define('WACT_ERROR_FACTORY', WACT_ROOT . 'error/factory/wact.inc.php'); 43 } 44 45 if (! defined('WACT_ERROR_HANDLER')) { 46 define('WACT_ERROR_HANDLER', WACT_ROOT . 'error/handler/debug.inc.php'); 47 } 48 49 /** 50 * Raise an error message. All framework error messages should be triggered using 51 * this function. This allows for framework error messages to be internationalized. 52 */ 53 function RaiseError($group, $id, $info=NULL) { 54 require_once WACT_ERROR_FACTORY; 55 RaiseErrorHandler($group, $id, $info); 56 } 57 58 /** 59 ** Standard error handler checks for error suppression and delegates actual error 60 ** handling when a real error occurrs. 61 */ 62 function ErrorHandlerDispatch($ErrorNumber, $ErrorMessage, $FileName, $LineNumber) { 63 64 if ( ( $ErrorNumber & error_reporting() ) != $ErrorNumber ) { 65 return; // Ignore this error because of error suppression 66 } 67 68 require_once WACT_ERROR_HANDLER; 69 HandleError($ErrorNumber, $ErrorMessage, $FileName, $LineNumber); 70 } 71 72 // Only set the WACT error handler if there isn't an error handler already set. 73 if (set_error_handler('ErrorHandlerDispatch') !== NULL) { 74 restore_error_handler(); 75 } 76 77 if (! defined('WACT_CONFIG_MODULE')) { 78 define('WACT_CONFIG_MODULE', WACT_ROOT . 'config/ini/single.inc.php'); 79 } 80 require_once WACT_CONFIG_MODULE; 81 82 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sun Nov 28 19:36:09 2004 | Cross-referenced by PHPXref 0.5 |