Location: PHPKode > projects > Web Application Gateway > wagateway/docs/create_app.html
<!-- 
/*************************************************************************************

    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: 45 $
    $LastChangedDate: 2008-01-14 14:15:32 -0700 (Mon, 14 Jan 2008) $
    $LastChangedBy: gpeangel $
 
*************************************************************************************/
 -->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>WAG - Creating a WAG Hosted Application</title>

<!-- The wagsession.js script needs to be included to keep the session alive when this page is accessed -->
<script type="text/javascript" src="../../js/wagsession.js"></script>

<link rel="stylesheet" type="text/css" href="../common/gateway.css" />
<link rel="stylesheet" type="text/css" href="docs.css" />
</head>

<body bgcolor="#ffffff">

<table bgcolor="#f5f5f5" border="0" cellpadding="4" cellspacing="0" style="margin-bottom: 15px;" width="100%">
    <tr>
        <td><b><a href="../admin/index.php" onmouseout="javascript:window.status=''; return true;" onmouseover="javascript:window.status=''; return true;" onmousemove="javascript:window.status='Administration';" target="_self">Administration</a> - <a href="index.html" onmouseout="javascript:window.status=''; return true;" onmouseover="javascript:window.status=''; return true;" onmousemove="javascript:window.status='Documentation Index';" target="_self">Documentation Index</a> - Creating a WAG Hosted Application</b></td>
    </tr>
</table>

<p style="font-size: 11pt;"><b><u>Minimum Requirements</u></b></p>

<p><b>Installation Directory</b></p>

<p>In order to be properly detected and administered by WAG, applications must be located under the "apps" sub-directory from the main WAG installation directory.  Each application must be installed in its own, unique directory under "apps".</p>

<p>For example, if WAG was installed in</p>

<pre>

/var/www/localhost/wagateway/

</pre>

<p>and you wish to create an application called <b>MyCoolApp</b>, it would need to be installed in the</p>

<pre>

/var/www/localhost/wagateway/apps/<b>mycoolapp</b>/

</pre>

<p>sub-directory.  It doesn't matter what your application directory is called.  It does have to be a unique name, however.  If it isn't, your application will overwrite critical files of what every application previously existed.</p>

<p><b>Application Information File - inf.php</b></p>

<p>When a system administrator selects <b>Administration > Applications</b>, WAG searches through each of the sub-directories under the <b>apps</b> directory, looking for an <b>inf.php</b> file.  This is the application information file and contains basic information about the application which resides in any particular sub-directory under <b>apps</b>.  The application information file must contain at least the following three variable definitions:</p>

<li><code>$app_guid</code></li>

<p>A global unique identifier for the application.  This value is used by WAG to correctly identify each application and keep track of related session values, such as database connection variables, even if there are applications with identical values for <code>$app_name</code> (see below).  The value for <code>$app_guid</code> cannot be blank.  A PHP script,  <b>create_guid.php</b>, is available in the <b>apps</b> directory for generating an application GUID.</p>

<pre>

# ./create_guid.php
GUID:  fc4b1581642fb99fa4f75fd2d0b1c781

</pre>

<li><code>$app_name</code></li>

<p>The application name as it will appear on the WAG application menu.  It is best to keep this name as short as possible.  The value for <code>$app_name</code> cannot be blank and can be no greater than 50 characters.</p>

<li><code>$app_description</code></li>

<p>A description for the application.  This value can be used in fly-over tips, help files, etc.  The value for <code>$app_description</code> can be blank and can be no greater than 255 characters.</p>

<p>An example <b>inf.php</b> file would look like the following:</p>

<pre>

&lt;?php

$app_guid = "fc4b1581642fb99fa4f75fd2d0b1c781";
$app_name = "My Cool App";
$app_description = "My Cool Application will bring world peace, solve world hunger, fold the laundry and never, ever crash.";

?&gt;

</pre>

<p><b>Page Access Security</b></p>

<p>To ensure WAG is able to restrict access to your application by authorized users, the following two lines must be included at the beginning of each distinct script of your application:</p>

<pre>

&lt;?php

require("../../common/access.php");
require("inf.php");

?&gt;

</pre>

<p>This code prevents unauthorized access to your scripts even if access is attempted via the complete URL.  There is no need to include a call to <code>session_start()</code> as session management is provided by the Web Application Gateway and initiated by including the above reference to <b>access.php</b>.  If you wish to prevent unrestricted access to scrips which are included in other scripts by calls to <code>include()</code>, <code>require()</code> or <code>require_once()</code>, place a reference to <b>/common/include_access.php</b> at the beginning of the included script.  <b>include_access.php</b> does not contain session management code.</p>

<p><b>NOTE:</b>  The reference to <b>access.php</b> and <b>include_access.php</b> may be different depending on whether or not your script resides in your application's root directory or in a sub-directory beneath the application root directory.</p>

<p>Once the minimum requirements have been satisfied, your shell application is ready for development.</p>

<p style="font-size: 11pt;"><b><u>Extending an Application's Functionality</u></b></p>

<p><b>Application Configuration File - config.php</b></p>

<p>If you want your application to play well with others, it is recommended that you use the <code>$app_guid</code> value as the key value for a session array of values unique to your application.  This is particularly important for database connections and form values which may conflict with naming conventions for other applications.  For example:</p>

<pre>

$_SESSION[$app_guid]["APPDB_SERVER"] = "localhost";

</pre>

<p>By using this method, if a user were to open a popup window in your application, enter values, change to a second application which you did not write, return to your application popup windows and elect to save the changes, the values should save correctly assuming the rest of your code uses this method correctly.</p>

<p>Work in progress...</p>

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