Location: PHPKode > projects > WB News > global.php
<?php

/*========================================================*\
||########################################################||
||#                                                      #||
||#     WB News v2.0.0                                   #||
||# ---------------------------------------------------- #||
||#     Copyright (c) 2004-2007                          #||
||#     Created: 30th Dec 2006                           #||
||#     Filename: global.php                             #||
||#                                                      #||
||########################################################||
/*========================================================*/

/**
 *  @author $Author: pmcilwaine $
 *	@version $Id: global.php,v 1.3.2.3 2008/06/21 02:31:09 pmcilwaine Exp $
 */

define( "DEBUG", FALSE );
error_reporting( DEBUG ? E_ALL : ini_get("error_reporting") );

/** enable short tags e.g. <?= ?> **/
if ( !ini_get( "short_open_tag" ) )
{
	ini_set( "short_open_tag", 1 );
}

/** fix bug with register_globals=On, it is suggested its off **/
$install_path = "";

/* get wbnews install directory without config */
$installpath = substr(__FILE__, 0, (($pos = strpos(__FILE__, basename(__FILE__))) != -1 ? $pos : 0));
if ( !is_dir($installpath) )
{
	echo "Fatal Error: Cannot find WB News Install Path";
	exit;
}

if ( __FILE__ == $_SERVER["SCRIPT_FILENAME"] ) 
{
	return;
}

require_once( $installpath . "config.php" );
require_once( $installpath . "/includes/constants.php" );
require_once( INCDIR . "/common.php" );
require_once( LIBDIR . "/db/" . $config["dbserver"] . "/DB_Sql.php" );
require_once( LIBDIR . "/DBase.php" );
require_once( LIBDIR . "/TemplateEngine.php" );

/** get mailer class **/
require_once( LIBDIR . "/Mailer.php" );
$mail = new Mailer();

$DB =& new DBase( $config["dbhost"], $config["dbuser"], $config["dbpass"], $config["dbname"], $config["dbport"] );

$tmpl =& new TemplateEngine();

if ( headers_sent( $file, $line ) )
{
	$mail->alert_webmaster( $_SERVER["SCRIPT_FILENAME"] . ": output before headers sent" );
?>
	<div style="width: 70%;margin-left: 15%;border: 2px solid #DA0000;padding: 10px;background: #FDFD31;">
		<h1 style="padding: 0px;margin: 0px;">Error Occurred</h1>
		<p style="margin-bottom: 5px;">
			A server error has occurred on line <?= $line ?> in <?= $file ?>. An email has
			been dispatched to the webmaster.
		</p>
	</div>
<?php
	exit;
}

if ( !isset($_SESSION) )
{
	session_start();
}

require_once( LIBDIR . "/Auth/Auth.php" );
require_once( INCDIR . "/function.php" );

$userinfo = array();
if ( isset($_COOKIE[WBNEWS_SESSION_NAME]) )
{
 	$userinfo = userinfo( $_COOKIE[WBNEWS_SESSION_NAME] );
}

/** setup auth variable **/
$auth = new Auth( $userinfo );

$n_configs = $DB->ListBy( TBL_NEWSCONFIG, NULL, array( "var", "value" ) );
if ( is_array($n_configs) )
{
	foreach ( $n_configs as $n_config )
	{
		$config[ $n_config["var"] ] = $n_config["value"];
	}
}
else
{
	$config["themeid"] = NULL;
}

$DB->query( "SELECT \"themepath\" FROM " . TBL_THEMES . " WHERE \"themeid\"='" . $config["themeid"] . "'" );
if ( !$DB->next_Record() )
{
	$config["themepath"] = NULL;
	return;
}

$config["themepath"] = $DB->field( "themepath" );

require_once( INCDIR . "/function.php" );

/**
 * TODO remove old deprecated code in future versions
 */
$newsConfig = array();

return;

?>
Return current item: WB News