website/parts/library.php

108 lines
2.1 KiB
PHP
Raw Normal View History

<?
// helpful constants
if (!defined( '_COLORS_' )) {
2000-11-13 17:55:00 +00:00
define ('_COLORS_', 1);
2007-03-16 00:49:05 +00:00
define ('black', "black");
define ('white', "white");
2007-03-16 00:49:05 +00:00
define ('thisURL', $_SERVER['SCRIPT_NAME']);
if (!$currPage)
$currPage = 'none';
if (!$theme && date ('m') == 12)
$theme = "christmas";
2003-01-02 07:44:25 +00:00
if (!$theme)
$theme = "quakeforge";
switch ($theme) {
case "christmas":
define ('bgColor', black);
define ('tableHeadColor', '#7f000c');
define ('tableBgColor', black);
2007-03-16 00:49:05 +00:00
define ('featureHeadColor', '#7f000c');
define ('featureBgColor', '#083008');
break;
default:
define ('bgColor', black);
define ('tableHeadColor', '#737b9c');
define ('tableBgColor', black);
2007-03-16 00:49:05 +00:00
define ('featureHeadColor', '#737b9c');
define ('featureBgColor', '#262633');
}
}
if (!defined ('_SQLCONSTS_')) {
define ('_SQLCONSTS_', 1);
require siteHome . '/../etc/sql.conf';
}
if (!defined ('_ARRAY_')) { // Treat array handler special
require siteHome . "/lib/array.php";
}
if (!defined ('_LIBFUNCS_')) {
define ('_LIBFUNCS_', 1);
/*
reqIfNeeded
Require a library module if it hasn't already been.
*/
2007-03-16 00:49:05 +00:00
function reqIfNeeded ($libNames)
{
global $has, $needs;
$libs = explode(' ', $libNames);
for ($i = 0 ; $i < count ($libs) ; $i++ ) {
$lib = $libs[$i];
if ((inArray ($libs[$i], $needs)) && (!inArray ($libs[$i], $has))) {
include siteHome . "/lib/$libs[$i].php";
}
}
}
/*
have
Tell the library that module X is loaded
*/
function have ($libName)
{
global $has;
addToArray ($libName, $has);
}
2007-03-16 00:49:05 +00:00
/*
need
Load module X if it hasn't been already, taking care to retain the
integrity of the $needs array.
*/
function need ($libNames)
{
global $needs;
$libs = explode(' ', $libNames);
for ($i = 0 ; $i < count ($libs) ; $i++ ) {
addToArray ($libs[$i], $needs);
}
reqIfNeeded ($libNames);
}
2007-03-16 00:49:05 +00:00
function bailout ($str)
{
if (strlen ($str))
echo $str;
require siteHome . '/parts/postamble.php'; // end page
die;
}
} // !_LIBFUNCS_
?>