File: /var/www/ilya/data/www/kamforum.ru/init.php
<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board v2.1.5
| =============================================
| by Matthew Mecham
| (c) 2001 - 2004 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| Time: Sun, 09 Oct 2005 11:51:26 GMT
| Release: 1a47e28f0443faa9f14d0c0a45151e54
| Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
| > INIT (Yes, it is)
| > Basic class to initialize defines and other stuff
| > Date started: Wednesday 19th July 2005 (14:57)
|
+--------------------------------------------------------------------------
*/
/**
* INIT File
*
* Sets up globals
*
* @package InvisionPowerBoard
* @author Matt Mecham
* @copyright Invision Power Services, Inc.
* @version 2.1
*/
//-----------------------------------------------
// USER CONFIGURABLE ELEMENTS
//-----------------------------------------------
/**
* ROOT PATH
*
* If __FILE__ is not supported, try ./ and
* turn off "USE_SHUTDOWN" or manually add in
* the full path
* @since 2.0.0.2005-01-01
*/
define( 'ROOT_PATH', dirname( __FILE__ ) ."/" );
/**
* USE SHUT DOWN
*
* Enable shut down features?
* Uses PHPs register_shutdown_function to save
* low priority tasks until end of exec
* @since 2.0.0.2005-01-01
*/
define ( 'USE_SHUTDOWN', IPB_THIS_SCRIPT == 'public' ? 1 : 0 );
/**
* IPS KERNEL PATH
*
* @since 2.0.0.2005-01-01
*/
define( 'KERNEL_PATH' , ROOT_PATH.'ips_kernel/' );
/**
* LEGACY MODE
*
* Legacy mode? Will enable hacks for 2.0 to work
* with a little modification
* @since 2.1.0.2005-07-12
*/
define( 'LEGACY_MODE', 0 );
/**
* USE MODULES
*
* Enable module usage?
* (Vital for some mods and IPB enhancements)
* @since 2.0.0.2005-01-01
*/
define ( 'USE_MODULES', 1 );
/**
* CUSTOM ERROR
*
* Enable custom error handling?
* Useful to trap skin errors, etc
* @since 2.0.0.2005-01-01
*/
define( 'CUSTOM_ERROR', 1 );
/**
* TRIAL VERSION
*
* Seriously, like, leave this alone
* @since 2.0.0.2005-01-01
*/
define( 'TRIAL_VERSION', 0 );
//-----------------------------------------------
// NO USER EDITABLE SECTIONS BELOW
//-----------------------------------------------
@set_magic_quotes_runtime(0);
error_reporting (E_ERROR | E_WARNING | E_PARSE);
/**
* IN IPB
*
* @since 2.0.0.2005-01-01
*/
define ( 'IN_IPB', 1 );
/**
* IN ACP
*
* @since 2.0.0.2005-01-01
*/
define ( 'IN_ACP', 1 );
/**
* DEV MODE
*
* Seriously, like, leave this alone too
* @since 2.0.0.2005-01-01
*/
define ( 'IN_DEV', 0 );
/**
* SAFE MODE
*
* Seriously, like, leave this alone too
* @since 2.0.0.2005-01-01
*/
if ( IPB_THIS_SCRIPT != 'public' )
{
if ( function_exists('ini_get') )
{
define ( 'SAFE_MODE_ON', @ini_get("safe_mode") ? 1 : 0 );
}
else
{
define ( 'SAFE_MODE_ON', 1 );
}
}
else
{
define ( 'SAFE_MODE_ON', 0 );
}
/**
* INITIATED
*
* Seriously, like, leave this alone too
* @since 2.1.0.2005-07-19
*/
define ( 'IPB_INIT_DONE', 1 );
//-----------------------------------------------
// Use custom handler?
//-----------------------------------------------
if ( CUSTOM_ERROR )
{
set_error_handler("my_error_handler");
}
//===========================================================================
// DEBUG CLASS
//===========================================================================
/**
* Debug class
*
* @package InvisionPowerBoard
* @author Matt Mecham
* @version 2.1
*/
class Debug
{
function startTimer()
{
global $starttime;
$mtime = microtime ();
$mtime = explode (' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
}
function endTimer()
{
global $starttime;
$mtime = microtime ();
$mtime = explode (' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = round (($endtime - $starttime), 5);
return $totaltime;
}
}
/*-------------------------------------------------------------------------*/
// GLOBAL ROUTINES
/*-------------------------------------------------------------------------*/
/**
* Fatal error
*
* @param string Message
* @param string Help
* @return void
*/
function fatal_error($message="", $help="")
{
echo("$message<br><br>$help");
exit;
}
/*-------------------------------------------------------------------------*/
// Custom error handler
/*-------------------------------------------------------------------------*/
/**
* Custom error handler
*
* @param integer Error number
* @param string Error string
* @param string Error file
* @param string Error line number
* @return void
*/
function my_error_handler( $errno, $errstr, $errfile, $errline )
{
// Did we turn off errors with @?
if ( ! error_reporting() )
{
return;
}
$errfile = str_replace( @getcwd(), "", $errfile );
switch ($errno)
{
case E_ERROR:
echo "<b>IPB Ошибка</b> [$errno] $errstr (Строка: $errline файла $errfile)<br />\n";
exit(1);
break;
case E_WARNING:
if ( strstr( $errstr, 'load_template(./skin_cache/cacheid_' ) )
{
if ( IPB_THIS_SCRIPT != 'admin' )
{
echo "<div style='font-family:sans-serif'><b>IPB Ошибка шаблона:</b> Невозможно загрузить требуемый шаблон.
<br /><br />Во-первых, проверьте и удалите любые другие стилевые настройки, нажав <a href='index.php?setskin&id=0'>сюда</a>
<br /><br />Потом, пожалуйста, зайдите в <a href='admin.php'>админцентр форума</a> и исправьте этот шаблон.
<br /><br /><span style='font-size:90%;color:gray'>Ошибка: $errstr</span></div>";
}
else
{
skin_emergency();
}
}
else
{
echo "<b>IPB Предупреждение</b> [$errno] $errstr (Строка: $errline файла $errfile)<br />\n";
}
break;
default:
//Do nothing
break;
}
}