Subversion Repositories computer_asset_manager_v2

Rev

Rev 36 | Rev 42 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

<?php

   $VERSION='2.0a';
   $BUILD_DATE='20181118';
   $DB_REQUIRED_VERSION = '0.1';
   $error = '';

   // locate the config file
   $error = "Site is broken. No configuration file found. Tell the developers.";
   foreach ( array( '/../camp2_config.php', '/../private/camp2_config.php', 'config.php' ) as $search ) {
      if ( file_exists( realpath( $_SERVER['DOCUMENT_ROOT'] . $search ) ) ) {
         $config = realpath( $_SERVER['DOCUMENT_ROOT'] . $search );
         include_once( $config );
         //print "<pre>loading from $config\n</pre>";
         $error = '';
         break;
      } // if
   } // for

   //print_r( ini_get('include_path') ); die;

   include_once( 'DBQuery.class.php' );
   // make the database connection
   $dbVersion = '';
   $dbConnection = new DBQuery( DBSERVER, DBUSER, DBPASS, DBNAME );
   if ( $dbConnection->connect_errno ) {
      $error = "Failed to connect to MySQL: (" . $dbConnection->connect_errno . ") " . $dbConnection->connect_error;
   } else {
      $dbVersion = $dbConnection->getOneDBValue( "select key_value from _system where group_name = 'database' and key_name = 'version'" );
   }

   ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . realpath( dirname ( __FILE__ ) ) . '/include' ); 

   include_once( 'functions.php' );
   
   /* get the information about who is logged in, and what they are allowed to access */
   // get current user
   $currentUser = 'rodolico';
   // get permissions for the current user
   $auth['client'] = array();
   $auth['site'] = array();
   $auth['device'] = array();
   $auth['menu'] = array();

   //Setup our HTML header here.
   if(!isset($page_title)) { $page_title = "Untitled"; }
?>

<html>
    <head>
        <title><?php echo $page_title;?></title>
        <link type="text/css" rel="stylesheet" href="style.css">
    </head>
    <body>
       <?php
          if ( $error ) {
             print "<h1>Serious Error encountered</h1><p>$error</p>";
             die($error);
          }
          if ( $dbVersion != $DB_REQUIRED_VERSION ) {
             print "<h1><b>Warning</b>: Database is version $dbVersion, but requires version $DB_REQUIRED_VERSION. Repair immediately</h1>";
             die;
          }
       ?>
        <header>
            <div class='header'>
            <h3>Computer Asset Management Program</h3>
            <p><i>Licensed under GPLv2</i>, Version <?php print "$VERSION, $BUILD_DATE"; ?></p>
            </div>
            <div class='login'>
                <?php
/*
                    if(!$user) {
                        show_login_form();
                    } else {
                        echo "Hello {$user->name}.<br />";
                        show_logout_button();
                        show_help_button();
                    }
*/
                ?>
            </div>
        </header>
        <table class='content'>
            <tr>
                <!--<td valign='top'>
                  <?php include_once('menu.php'); ?>
                </td>-->
                <td valign='top'>