website/parts/library.php
2000-12-23 08:56:43 +00:00

100 lines
2.2 KiB
PHP

<?
// helpful constants
if (!defined( '_COLORS_' )) {
define ('_COLORS_', 1);
define ('black', "black");
define ('white', "white");
switch ($theme) {
case "christmas":
define ('bgColor', black);
define ('textColor', white);
define ('linkColor', '#aaffaa');
define ('activeLinkColor', white);
define ('visitedLinkColor', '#80ff80');
define ('tableHeadColor', '#900020');
define ('tableBgColor', 'black');
define ('menuHeadColor', '#900020');
define ('menuBgColor', '#084508');
define ('featureHeadColor', tableHeadColor);
define ('featureBgColor', '#083008');
break;
default:
define ('bgColor', black);
define ('textColor', white);
define ('linkColor', '#aaaaff');
define ('activeLinkColor', white);
define ('visitedLinkColor', '#8080ff');
define ('tableHeadColor', '#737b9c');
define ('tableBgColor', 'black');
define ('menuHeadColor', '#737b9c');
define ('menuBgColor', '#4b4f66');
define ('featureHeadColor', tableHeadColor);
define ('featureBgColor', '#252733');
}
}
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.
*/
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);
}
/*
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);
}
} // !_LIBFUNCS_
?>