Location: PHPKode > projects > Web Application Gateway > wagateway/install/install.php
<?

/*************************************************************************************

    COPYRIGHT NOTICE

    This copyright notice must appear at the top of all scripts which are part of
    the Web Application Gateway package.

    Copyright (C) 2001-2008 Gregory Engel
    
    All rights reserved
    
    8547 E Arapahoe Rd, #J-504
    Greenwood Village, CO  80112 USA
    hide@address.com

    This program is free software; you can redistribute it and/or modify it under
    the terms of the GNU General Public License as published by the Free Software
    Foundation; either version 2 of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

    The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
    A copy is included with the WAG package and is found in the text file gpl.txt

    You should have received a copy of the GNU General Public License (gpl.txt, gpl.html)
    along with the WAG distribution package; if not, the GNU General Public License can
    be found at http://www.gnu.org/copyleft/gpl.html, or by writing to:
    
    Free Software Foundation, Inc.
    59 Temple Place - Suite 330
    Boston, MA  02111-1307, USA.

    This script is part of the Web Application Gateway (WAG) Project. The WAG software
    is free, subject to the terms of the GNU General Public License as published by the
    Free Software Foundation, either version 2 of the License, or (at your option) any
    later version.
    
    $Revision: 49 $
    $LastChangedDate: 2008-01-14 14:21:17 -0700 (Mon, 14 Jan 2008) $
    $LastChangedBy: gpeangel $
 
*************************************************************************************/

/*
    
    The following informs the user if the web server has not been configured to allow 
    for proper installation of WAG.
    
    ?><div style="font-family: arial; font-size: 20pt; line-height: 25pt;">
        If you see this text in your browser when you attempt to access the Web 
        Application Gateway (WAG), it means the web server is not configured to run 
        PHP-scripts, and therefor WAG will not be able to run.
    </div><div style="display: none"><?

*/

$inst_step = strip_tags($_REQUEST["inst_step"]);

if (strlen($inst_step) == 0)
    {
    
    $inst_step = 1;
    
    session_start();
    
    }

// Verify directory path to the WAG installation directory.  WAG may be installed 
// in the web server document root or in a subdirectory to the document root.

$document_root = $_SERVER["DOCUMENT_ROOT"]."/";
$server_name = $_SERVER["SERVER_NAME"]."/";
$install_dir = "/";

if (!is_file($document_root."/main.php") && !is_file($document_root."/js/main.js") && !is_file($document_root."/admin/index.php"))
    {
    
    // Looks like WAG was installed in a subdirectory to the web server document root
    
    $install_dir = "";
    
    $ary_doc_root = explode("/", $document_root);
    $ary_script_path = explode("/", dirname($_SERVER['SCRIPT_FILENAME']));
    
    for ($i = count($ary_doc_root) - 1; $i <= count($ary_script_path); $i++)
        {
        
        $install_dir = $ary_script_path[$i];

        if (is_file($document_root.$install_dir."/main.php") && is_file($document_root.$install_dir."/js/main.js") && is_file($document_root.$install_dir."/admin/index.php"))
            {
            
            // This appears to be the root directory for WAG
            
            break;

            }
        } 
    }

$wag_install_dir = $document_root.$install_dir."/";
$wag_web_root = $server_name.$install_dir."/";

$_SESSION["WAGATEWAY"]["INSTALL_DIR"] = $wag_install_dir;
$_SESSION["WAGATEWAY"]["WEB_ROOT"] = $wag_web_root;

require_once("../common/functions.php");

if (file_exists($_SESSION["WAGATEWAY"]["INSTALL_DIR"]."config.php"))
    {
    
    require($_SESSION["WAGATEWAY"]["INSTALL_DIR"]."config.php");
    
    if ($config_integrity_check == 1)
        {
        header("Location: http://".$_SESSION["WAGATEWAY"]["WEB_ROOT"]."/index.php");
        }
    else
        {
        // FIXME:  Code to handle incomplete install
        }
    }
    
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Web Application Gateway - Configuration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../common/gateway.css" />

<style type="text/css">
<!-- 

p, li, blockquote
  {
  font-size: 8pt;
  }
  
-->
</style>

</head>
<body bgcolor="#ffffff">

<table align="center" bgcolor="#f5f5f5" border="0" cellpadding="20" cellspacing="0" style="border: solid black 1px;" width="600px">
    <tr>
        <th>Web Application Gateway - Configuration</th>
    </tr>
</table>

<?

include("inst_".$inst_step."_inc.php");

?>

</body>
</html>
Return current item: Web Application Gateway