Location: PHPKode > projects > vuBB Community Forums > templates/css.php
<?php
/**
 * vuBB
 * Copyright 2005-2006 the vuBB Group
 *
 * http://www.vubb.com/
 * http://community.vubb.com/
 */

// Get the config
include('../config.php');

function database_connect($db_host, $db_user, $db_pass, $db)
{
	global $hard_config;
	if (isset($hard_config['pconnect']) && $hard_config['pconnect']) {
		@mysql_pconnect($db_host, $db_user, $db_pass);
	} else {
		@mysql_connect($db_host, $db_user, $db_pass);
	}
	
	@mysql_select_db($db);
}

// Connect to database.
database_connect($database['server'], $database['username'], $database['password'], $database['dbname']);

// Fetch configuration.
$config_querya = @mysql_query("SELECT `name`, `value` FROM `config`"); 

$site_config = array(); 
while ($carray = @mysql_fetch_array($config_querya)) 
{ 
	$site_config[$carray['name']] = $carray['value']; 
}

$site_config['template'] = $site_config['template'] ? $site_config['template'] : 'core';

// CSS Content Type.
header('Content-Type: text/css');

$path_to = './'.$site_config['template'].'/';

// Fetch CSS (if it exists)
if (file_exists($path_to.'style.css'))
{
	$css = file_get_contents($path_to.'style.css');
}
else if (file_exists($path_to.'styles.css'))
{
	$css = file_get_contents($path_to.'styles.css');
}
else
{
	$css = "/*\n\hide@address.com CSS found.\n*/";
}

// Replace variables.
$css = str_replace('%path%', $site_config['site_url'].'templates/'.$site_config['template'], $css);

// Output.
echo "/*\n\tvuBB\n\tCSS Finder\n\n\tAll CSS Copyright its respective owners.\n*/\n\n".$css;

// Exit.
exit;
?>
Return current item: vuBB Community Forums