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';
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
?>
33 rodolico 48
 
36 rodolico 49
<html>
50
    <head>
51
        <title><?php echo $page_title;?></title>
52
        <link type="text/css" rel="stylesheet" href="style.css">
53
    </head>
54
    <body>
55
       <?php
56
          if ( $error ) {
57
             print "<h1>Serious Error encountered</h1><p>$error</p>";
58
             die($error);
59
          }
60
          if ( $dbVersion != $DB_REQUIRED_VERSION ) {
61
             print "<h1><b>Warning</b>: Database is version $dbVersion, but requires version $DB_REQUIRED_VERSION. Repair immediately</h1>";
62
             die;
63
          }
64
       ?>
65
        <header>
66
            <div class='header'>
67
            <h3>Computer Asset Management Program</h3>
68
            <p><i>Licensed under GPLv2</i>, Version <?php print "$VERSION, $BUILD_DATE"; ?></p>
69
            </div>
70
            <div class='login'>
71
                <?php
72
/*
73
                    if(!$user) {
74
                        show_login_form();
75
                    } else {
76
                        echo "Hello {$user->name}.<br />";
77
                        show_logout_button();
78
                        show_help_button();
79
                    }
80
*/
81
                ?>
82
            </div>
83
        </header>
84
        <table class='content'>
85
            <tr>
86
                <!--<td valign='top'>
37 rodolico 87
                  <?php include_once('menu.php'); ?>
36 rodolico 88
                </td>-->
89
                <td valign='top'>
90