Location: PHPKode > projects > Web Application Gateway > wagateway/menu_panel.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: 56 $
    $LastChangedDate: 2008-01-16 09:52:29 -0700 (Wed, 16 Jan 2008) $
    $LastChangedBy: gpeangel $
 
*************************************************************************************/

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

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

<html>
<head>
<link rel="stylesheet" type="text/css" href="common/gateway.css" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
</head>

<body bgcolor="#ffffff">

<table border="0" cellspacing="0" cellpadding="0" width="175"> 
    <tr>
        <td class="root_td" style="padding-bottom: 10px;">
            <a href="splash.php" onmouseout="javascript:window.status=''; return true;" onmouseover="javascript:window.status=''; return true;" onmousemove="javascript:window.status='<? echo $_SESSION["WAGATEWAY"]["SITE_NAME"]; ?> home position';" target="main_frame">Home</a>
        </td>
    </tr>
    <?
    if (in_array(1, $_SESSION["WAGATEWAY"]["GROUPS"]))
        {
        ?>
        <tr>
            <td bgcolor="#000000" style="height: 1px;"></td>
        </tr>
        <tr>
            <td class="root_td" style="padding-bottom: 10px; padding-top: 10px;">
                <a href="admin/index.php" onmouseout="javascript:window.status=''; return true;" onmouseover="javascript:window.status=''; return true;" onmousemove="javascript:window.status='<? echo $_SESSION["WAGATEWAY"]["SITE_NAME"]; ?> administration';" target="main_frame">Administration</a>
            </td>
        </tr>
        <?
        }
    ?>
    <tr>
        <td bgcolor="#000000" style="height: 1px;"></td>
    </tr>
    <tr>
        <td class="root_td" style="padding-bottom: 10px; padding-top: 10px;">
            <a href="javascript:requestLogoff();" onmouseout="javascript:window.status=''; return true;" onmouseover="javascript:window.status=''; return true;" onmousemove="javascript:window.status='Log off of <? echo $_SESSION["WAGATEWAY"]["SITE_NAME"]; ?>';" target="_top">Log Off</a>
        </td>
    </tr>
    <tr>
        <td bgcolor="#000000" style="height: 1px;"></td>
    </tr>
    <tr>
        <td class="root_td" style="padding-bottom: 10px; padding-top: 10px;">
            APPLICATIONS
        </td>
    </tr>
    <tr>
        <td bgcolor="#000000" style="height: 1px;"></td>
    </tr>
    <?
    
    $query = "SELECT * FROM ".$_SESSION["WAGATEWAY"]["DB_TABLE_PREFIX"]."Applications WHERE app_status = 1 ORDER BY app_menu_title";
    $result = mysql_query($query, $db_conn) or die (DBError($_SERVER["PHP_SELF"]."\n\n".$query."\n\n".mysql_errno().": ".mysql_error()));
    
    $row_count = mysql_num_rows($result);
    
    if ($row_count > 0)
        {
    
        for ($i = 0; $i < $row_count; $i++)
            {
            
            $row = mysql_fetch_array($result);
            
            $has_permission = 0;
            
            // First check if user has explicit permission to access this application
            if (in_array($row["app_id"], $_SESSION["WAGATEWAY"]["APPS"]))
                {
                $has_permission = 1;
                }
            
            // Next, check if any groups contain this application and whether or not this user
            // belongs to any of those groups
            
            // Collect groups to which this application belongs
            
            if ($has_permission == 0)
                {
                $query_appgroups = "SELECT ag_grp_id FROM ".$_SESSION["WAGATEWAY"]["DB_TABLE_PREFIX"]."AppGroups WHERE ag_app_id = ".$row["app_id"];
                $result_appgroups = mysql_query($query_appgroups, $db_conn) or die (DBError($_SERVER["PHP_SELF"]."\n\n".$query_appgroups."\n\n".mysql_errno().": ".mysql_error()));
                
                while ($row_appgroups = mysql_fetch_array($result_appgroups, MYSQL_NUM))
                    {
                    if (in_array($row_appgroups[0], $_SESSION["WAGATEWAY"]["GROUPS"]))
                        {
                        $has_permission = 1;
                        }
                    }
                }
            
            if ($has_permission == 1 && $_SESSION["WAGATEWAY"]["PASSWORD_FORCE_CHANGE"] == 0)
                {
                ?>
                <tr>
                    <td class="root_td">
                        <a href="apps/<? echo $row["app_location"]; ?>/index.php" onmouseout="javascript:window.status=''; return true;" onmouseover="javascript:window.status=''; return true;" onmousemove="javascript:window.status='<? echo $row["app_description"]; ?>';" target="main_frame" title="<? echo $row["app_description"]; ?>"><? echo $row["app_menu_title"]; ?></a>
                    </td>
                </tr>
                <?
                }
            }
        }
    
    $query = "SELECT * FROM ".$_SESSION["WAGATEWAY"]["DB_TABLE_PREFIX"]."MenuNodes ORDER BY mnod_Title";
    $result = mysql_query($query, $db_conn) or die (DBError($_SERVER["PHP_SELF"]."\n\n".$query."\n\n".mysql_errno().": ".mysql_error()));
    
    $row_count = mysql_num_rows($result);
    
    if ($row_count > 0)
        {
    
        for ($i = 0; $i < $row_count; $i++)
            {
            
            $row = mysql_fetch_array($result);
            
            ?>
            <tr>
                <td class="root_td">
                    <?
                    if (strlen(trim($row["mnod_URL"])) > 0)
                        {
                        ?>
                        <a href="<? echo $row["mnod_url"]; ?>" target="<? echo $row["mnod_target"]; ?>"><? echo $row["mnod_title"]; ?></a>
                        <?
                        }
                    ?>
                </td>
            </tr>
            <?
            }
        }
    ?>
</table>

</body>
</html>

Return current item: Web Application Gateway