| 1 |
rodolico |
1 |
<?php
|
|
|
2 |
|
| 36 |
rodolico |
3 |
$VERSION='2.0a';
|
|
|
4 |
$BUILD_DATE='20181118';
|
|
|
5 |
$DB_REQUIRED_VERSION = '0.1';
|
|
|
6 |
$error = '';
|
| 1 |
rodolico |
7 |
|
| 36 |
rodolico |
8 |
// locate the config file
|
|
|
9 |
$error = "Site is broken. No configuration file found. Tell the developers.";
|
|
|
10 |
foreach ( array( '/../camp2_config.php', '/../private/camp2_config.php', 'config.php' ) as $search ) {
|
|
|
11 |
if ( file_exists( realpath( $_SERVER['DOCUMENT_ROOT'] . $search ) ) ) {
|
|
|
12 |
$config = realpath( $_SERVER['DOCUMENT_ROOT'] . $search );
|
|
|
13 |
include_once( $config );
|
|
|
14 |
//print "<pre>loading from $config\n</pre>";
|
|
|
15 |
$error = '';
|
|
|
16 |
break;
|
|
|
17 |
} // if
|
|
|
18 |
} // for
|
|
|
19 |
|
|
|
20 |
//print_r( ini_get('include_path') ); die;
|
|
|
21 |
|
|
|
22 |
include_once( 'DBQuery.class.php' );
|
|
|
23 |
// make the database connection
|
|
|
24 |
$dbVersion = '';
|
|
|
25 |
$dbConnection = new DBQuery( DBSERVER, DBUSER, DBPASS, DBNAME );
|
|
|
26 |
if ( $dbConnection->connect_errno ) {
|
|
|
27 |
$error = "Failed to connect to MySQL: (" . $dbConnection->connect_errno . ") " . $dbConnection->connect_error;
|
|
|
28 |
} else {
|
|
|
29 |
$dbVersion = $dbConnection->getOneDBValue( "select key_value from _system where group_name = 'database' and key_name = 'version'" );
|
| 21 |
rodolico |
30 |
}
|
| 20 |
rodolico |
31 |
|
| 37 |
rodolico |
32 |
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . realpath( dirname ( __FILE__ ) ) . '/include' );
|
| 36 |
rodolico |
33 |
|
|
|
34 |
include_once( 'functions.php' );
|
|
|
35 |
|
| 33 |
rodolico |
36 |
/* get the information about who is logged in, and what they are allowed to access */
|
|
|
37 |
// get current user
|
|
|
38 |
$currentUser = 'rodolico';
|
|
|
39 |
// get permissions for the current user
|
|
|
40 |
$auth['client'] = array();
|
|
|
41 |
$auth['site'] = array();
|
|
|
42 |
$auth['device'] = array();
|
|
|
43 |
$auth['menu'] = array();
|
|
|
44 |
|
| 36 |
rodolico |
45 |
//Setup our HTML header here.
|
|
|
46 |
if(!isset($page_title)) { $page_title = "Untitled"; }
|
|
|
47 |
?>
|
|
|
48 |
<html>
|
| 42 |
rodolico |
49 |
<head>
|
|
|
50 |
<title><?php echo $page_title;?></title>
|
|
|
51 |
<script language="javascript">
|
|
|
52 |
function eToggle(anctag,darg) {
|
|
|
53 |
var ele = document.getElementById(darg);
|
|
|
54 |
var text = document.getElementById(anctag);
|
|
|
55 |
if(ele.style.display == "block") {
|
|
|
56 |
ele.style.display = "none";
|
|
|
57 |
text.innerHTML = "Show " + darg;
|
|
|
58 |
} else {
|
|
|
59 |
ele.style.display = "block";
|
|
|
60 |
text.innerHTML = "Hide " + darg;
|
|
|
61 |
}
|
|
|
62 |
}
|
|
|
63 |
</script>
|
|
|
64 |
<link type="text/css" rel="stylesheet" href="style.css">
|
|
|
65 |
<link rel="stylesheet" type="text/css" href="camp.css">
|
|
|
66 |
</head>
|
|
|
67 |
<body>
|
|
|
68 |
<div id="titleimage">
|
|
|
69 |
<h1>
|
|
|
70 |
Computer Asset Management Program
|
|
|
71 |
</h1>
|
|
|
72 |
<h2>
|
|
|
73 |
Version <?php print "$VERSION, $BUILD_DATE"; ?>
|
|
|
74 |
</h2>
|
|
|
75 |
</div>
|
|
|
76 |
<?php
|
|
|
77 |
if ( $error ) {
|
|
|
78 |
print "<h1>Serious Error encountered</h1><p>$error</p>";
|
|
|
79 |
die($error);
|
|
|
80 |
}
|
|
|
81 |
if ( $dbVersion != $DB_REQUIRED_VERSION ) {
|
|
|
82 |
print "<h1><b>Warning</b>: Database is version $dbVersion, but requires version $DB_REQUIRED_VERSION. Repair immediately</h1>";
|
|
|
83 |
die;
|
|
|
84 |
}
|
|
|
85 |
?>
|
|
|
86 |
<div class='login'>
|
|
|
87 |
<?php
|
|
|
88 |
/*
|
|
|
89 |
if(!$user) {
|
|
|
90 |
show_login_form();
|
|
|
91 |
} else {
|
|
|
92 |
echo "Hello {$user->name}.<br />";
|
|
|
93 |
show_logout_button();
|
|
|
94 |
show_help_button();
|
|
|
95 |
}
|
|
|
96 |
*/
|
|
|
97 |
?>
|
|
|
98 |
</div>
|
|
|
99 |
<?php include_once('menu.php'); ?>
|
|
|
100 |
<div id="content">
|