"#8800FF",
"bgcolor" => "#FFFFFF",
"bottommsg" => "",
"bug" => null,
"centralbannerbgimage" => null,
"cssfiles" => array(),
"cyears" => date("Y"),
"defaultpage" => "$_SERVER[DOCUMENT_ROOT]/Simpleweb/empty.php",
"globalnav" =>array(),
"grade" => array(),
"homepage" => "members",
"imagepath" => array(0 => "Simpleweb/images"),
"includepath" => array(),
"jsfiles" => array(),
"lang" => "EN",
"leftbannerbgimage" => null,
"localnav" =>array(),
"logo" => null,
"name" => "No name",
"navexclude" => "",
"rightbannerbgimage" => null,
"stringcolor" => "#666666",
"stringheight" => 2);
// Set languages
function SetLanguages() {
global $Config;
global $Messages;
$argnum = func_num_args();
if ($argnum == 0)
return;
$lang = strtoupper(func_get_arg(0));
$Config["name"] = $Messages[$lang]["no name"];
if ($argnum == 1)
$Config["lang"] = $lang;
else {
$Config["lang"] = array();
for ($arg=0; $arg<$argnum; $arg++) {
$lang = strtoupper(func_get_arg($arg));
$Config["lang"][] = $lang;
$Config[$lang] = array("cssfiles" =>array(),
"globalnav" =>array(),
"grade" => array(),
"imagepath" => array(),
"includepath" => array(),
"jsfiles" =>array(),
"lang" => $lang,
"localnav" =>array(),
"name" => $Messages[$lang]["no name"]);
}
}
}
// Display language navigation
function DisplayLanguageNavigation() {
global $Config;
if (!is_array($Config["lang"]))
return;
$string = "";
foreach ($Config["lang"] as $lang)
$string .= "$lang - ";
echo ereg_replace (' - $', " ", $string);
}
// Set config field
function SetConfigField ($field, $val, $lang = null) {
global $Config;
if ((!$lang) || (!isset($Config[$lang])))
if (is_array($Config[$field]))
$Config[$field][] = $val;
else
$Config[$field] = $val;
else
if (is_array($Config[$lang][$field]))
$Config[$lang][$field][] = $val;
else
$Config[$lang][$field] = $val;
}
// Get config field
function GetConfigField ($field, $lang = -1) {
global $Config;
if ($lang == -1)
$lang = GetLanguage();
if (empty($Config[$lang][$field]))
return $Config[$field];
return $Config[$lang][$field];
}
// Add a link to global navigation
function AddLinkToGlobalNavigation($name, $url, $lang = null) {
SetConfigField("globalnav", array("name" => $name, "url" => $url), $lang);
}
// Display global navigation
function DisplayGlobalNavigation() {
$list = GetConfigField("globalnav");
$string = "";
foreach ($list as $link)
$string .= '' . $link["name"] . ' - ';
echo ereg_replace (' - $', " ", $string);
}
// Add a link to local navigation
function AddLinkToLocalNavigation($name, $url, $lang = null) {
SetConfigField("localnav", array("name" => $name, "url" => $url), $lang);
}
// Display local navigation
function DisplayLocalNavigation() {
$list = GetConfigField("localnav");
$string = "";
foreach ($list as $link)
$string .= '' . $link["name"] . ' - ';
echo ereg_replace (' - $', " ", $string);
}
// Set background color
function SetBackgroundColor($color, $lang = null) {
SetConfigField("bgcolor", $color, $lang);
}
// Set banner background color
function SetBannerBackgroundColor($color, $lang = null) {
SetConfigField("bannerbgcolor", $color, $lang);
}
// Set left banner background image
function SetLeftBannerBackgroundimage($image, $lang = null) {
SetConfigField("leftbannerbgimage", $image, $lang);
}
// Set central banner background image
function SetCentralBannerBackgroundimage($image, $lang = null) {
SetConfigField("centralbannerbgimage", $image, $lang);
}
// Set right banner background image
function SetRightBannerBackgroundimage($image, $lang = null) {
SetConfigField("rightbannerbgimage", $image, $lang);
}
// Set string color and height
function SetStringColor($color, $lang = null) {
SetConfigField("stringcolor", $color, $lang);
}
function SetStringHeight($height, $lang = null) {
SetConfigField("stringheight", $height, $lang);
}
// Set site logo
function SetSiteLogo($logo, $lang = null) {
SetConfigField("logo", $logo, $lang);
}
// Set right top corner image
function SetRightTopCornerImage($img, $alt, $lang = null) {
SetConfigField("righttopcornerimage", array("img" => $img, "alt" => $alt), $lang);
}
// Set site name
function SetSiteName($name, $lang = null) {
SetConfigField("name", $name, $lang);
}
// Set site url
function SetSiteUrl($url, $lang = null) {
SetConfigField("url", $url, $lang);
}
// Get site url
function GetSiteUrl() {
$url = GetConfigField("url");
if (($url) && ($url != "/"))
return "http://" . $url;
else
return "/";
}
// Set bug
function SetBug($bug, $lang = null) {
SetConfigField("bug", $bug, $lang);
}
// Set navigation exclusion regexp
function SetNavigationExclusionRegexp($regex) {
SetConfigField("navexclude", $regex, $lang);
}
// Set grade meaning
function SetGradeMeaning() {
foreach (func_get_args() as $arg)
SetConfigField("grade", $arg, $lang);
}
// Set home page directory
function SetHomePageDir($dir) {
SetConfigField("homepage", $dir, $lang);
}
// Default page
function SetDefaultPage($page, $lang = null) {
SetConfigField("defaultpage", $page, $lang);
}
// Add include path
function AddIncludePath() {
foreach (func_get_args() as $arg)
SetConfigField("includepath", $arg, $lang);
}
// Include PHP Extension
function IncludePhpExtension() {
$list = array_unique(array_merge(GetConfigField("includepath"),
GetConfigField("includepath", "")));
foreach ($list as $path) {
$dir = opendir($path);
$path .= "/";
while ($entry = readdir($dir))
if ((!is_dir($path . $entry)) && (ereg('\.php$', $entry)))
include ($path . $entry);
}
}
// Add image path
function AddImagePath() {
foreach (func_get_args() as $arg)
SetConfigField("imagepath", $arg, $lang);
}
// Set bottom message
function SetBottomMessage ($msg, $lang = null) {
SetConfigField("bottommsg", $msg, $lang);
}
// Set copyright years
function SetCopyrightYears ($cyears, $lang = null) {
SetConfigField("cyears", $syears, $lang);
}
// Add a CSS file
function AddCSSFile($file, $lang = null) {
global $_SERVER;
if (file_exists("$_SERVER[DOCUMENT_ROOT]/$file"))
SetConfigField("cssfiles", $file, $lang);
}
// Display CSS links
function DisplayCSSLinks() {
$files = GetConfigField("cssfiles");
foreach ($files as $file)
echo "\n";
}
// Add a JS file
function AddJSFile($file, $lang = null) {
global $_SERVER;
if (file_exists("$_SERVER[DOCUMENT_ROOT]/$file"))
SetConfigField("jsfiles", $file, $lang);
}
// Display JS links
function DisplayJSLinks() {
$files = GetConfigField("jsfiles");
foreach ($files as $file)
echo "\n";
}
$included["Simpleweb/configuration.php"] = 1;
}
?>