Subversion Repositories computer_asset_manager_v2

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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