<?
//load prefs & settings
$do_init = 1; //required to initialize settings
include("../settings.php");
include("../includes/functions.php");
include("settings.php");
include("includes/functions.php");
//setup constants
$now_date = formatDate();
$default_mod = "admin";
//set the default module
if(isset($_GET['mod']))
$mod = $_GET['mod'];
else
$mod = $default_mod;
$title = "AphBox Administrator ($company_name)";
if($mod != $default_mod) {
//go through modules array to find the data on the selected module
foreach($admin_modules as $this_module) {
if($this_module[0] == $mod) {
if(substr($this_module[1], 0, 1) == "-")
$this_module[1] = substr($this_module[1], 1);
$title .= " - ".$this_module[1];
$admin_title = $this_module[1];
$admin_return_mod = "?mod=admin";
$return_link_name = "Admin Menu";
//look for a custom module to if it exists
$custom_mod_file = "custom/modules/".$this_module[0].".php";
if(file_exists($custom_mod_file))
$mod_file = $custom_mod_file;
else
$mod_file = "modules/".$this_module[0].".php";
}
}
} else {
$mod_file = "modules/$default_mod.php";
$admin_return_mod = $return_link;
$return_link_name = "Site";
}
//run a check to see if any logins exist
$result = mysql_query("SELECT id FROM $admin_table_name");
$numlogins = mysql_num_rows($result);
if(!$numlogins) {
$create_initial_account = 1;
$mod_file = "modules/account.php";
$admin_return_mod = $return_link;
$return_link_name = "Site";
$title .= " - Create Initial Admin Account";
$admin_title = "Create Initial Admin Account";
}
//make sure the file exists and then process it in a buffer
if(isset($mod_file) && file_exists($mod_file)) {
ob_start();
include($mod_file);
$mod_buffer = ob_get_contents();
ob_end_clean();
} else { //the file does not exist
$mod_buffer = "<p class=\"errortext\">The selected admin module does not exist.</p>\n";
$admin_title = "Module not found";
$admin_return_mod = "?mod=admin";
$return_link_name = "Admin Menu";
}
if($database_down)
$mod_buffer = "<p class=\"errortext\">The database is offline or inaccessible.</p>\n";
if(!isset($download_content)) {
//setup skin import
if(!isset($aphbox_skin) || !$aphbox_skin)
$aphbox_skin = "basicbox";
$skin_css_file = "custom/skins/$aphbox_skin/_skin.css";
if(!file_exists($skin_css_file))
$skin_css_file = "includes/skins/$aphbox_skin/_skin.css";
if(file_exists($skin_css_file))
$skin_import = "<style type=\"text/css\">@import url(\"$skin_css_file\");</style>";
else
$skin_import = "";
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><? print $title; ?></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="AphBox Administrator <? print $aphbox_vers; ?> by Aphotic Design" />
<meta name="generator" content="PHP <? print phpversion(); ?>" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="robot" content="nofollow" />
<link rel="shortcut icon" href="favicon.ico" />
<style type="text/css">@import url("includes/css/admin.css");</style>
<style type="text/css">@import url("custom/css/custom.css");</style>
<? print $skin_import; ?>
<script type="text/javascript" src="includes/aphbox.js"></script>
<? if(isset($fckinstance_name)) { ?>
<script type="text/javascript">
/* Custom FCKEditor functions */
function FCKeditor_OnComplete( editorInstance ) { //this should fix the Safari resizing bug
var fck_iframe = document.getElementById('<? print $fckinstance_name; ?>___Frame');
var fck_editing_area = fck_iframe.contentDocument.getElementById('xEditingArea');
fck_editing_area.style.height = '100.1%';
setTimeout(function() {fck_editing_area.style.height = '100%'}, 100);
}
</script>
<? } ?>
</head>
<body<? if(isset($onload_script)) print " onload=\"$onload_script\""; ?>>
<div id="admintop">
<div id="adminleft">
<div id="adminright">
<div id="admintopleft">
<div id="admintopright">
<div id="adminbottom">
<div id="adminbottomleft">
<div id="adminbottomright">
<div id="admincontainer">
<?
if(isset($logged_in_as))
print "<p id=\"adminloggedinas\">$logged_in_as</p>\n";
print "<img id=\"adminbranding\" src=\"$company_logo\" alt=\"$company_name\" />\n";
print "<h1>$admin_title</h1>\n";
if(!isset($return_link_hidden))
print "<p class=\"gobacklink\"><a href=\"$admin_return_mod\">Return to $return_link_name</a></p>\n";
print $mod_buffer;
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?
print "<p id=\"adminsiteinfo\">AphBox Administrator $aphbox_vers ©$aphbox_year by <a href=\"http://www.aphoticdesign.com\">Aphotic</a>.</p>\n";
?>
<div id="pagescreen"><div id="overlay"> </div></div>
</body>
</html>
<? } else {
//download the content of $download_content as $download_filename, generally a text file
if(isset($download_filename) && $download_filename) {
if(!isset($download_type) || !$download_type)
$download_type = "text/plain";
header("Content-Type: $download_type");
header("Content-Disposition: attachment; filename=\"$download_filename\"");
}
print $download_content;
}
?>