Files
ohmj2/Scripts/menu.php

212 lines
6.1 KiB
PHP

<?php
/***************************************************************************
menu.php - Manage the differents menu entries.
-------------------
begin : Dec UTC 2002
copyright : (C) 2002-2005 by NADAL Jean-Baptiste
email : jbnadal@ifrance.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. *
* *
***************************************************************************
* $Id: menu.php,v 1.5 2005/01/30 22:20:22 jb Exp $
***************************************************************************/
function printMenuEntry ($name, $href)
{
echo "
<tr> <td valign=\"middle\" align=\"center\"
width=\"20%\">
<img src=\"/legacy/Imgs/icon_puce_over.gif\"
border=\"0\" alt=\"*\"/></td>
<td valign=\"middle\" nowrap=\"nowrap\"
align=\"left\" width=\"80%\" >
<a href=\"".$href."\" >
<font face=\"\" color=\"#ffffff\" size=\"-1\">
$name </font></a> </td> </tr>
";
}
function printGeneralMenu ()
{
global $menu;
global $MENU_GENERAL;
$i = 0;
while ($menu[$i] [0] != "NULL") {
if ($menu[$i] [2] == $MENU_GENERAL)
printMenuEntry ($menu[$i][0], $menu[$i][1]);
$i++;
}
}
function printAuthentification ()
{
$pseudo = $_SESSION['pseudo'];
if ($pseudo == "")
printConnectBox();
else {
printDeconnectBox();
/* Print the member section.*/
printMemberSection ();
}
}
function printConnectBox()
{
echo "
<table cellspacing=\"0\" cellpadding=\"1\"
width=\"95%\" border=\"0\">
<tbody>
<tr>
<td valign=\"middle\" align=\"left\" >
<font face=\"helvetica,verdana\" size=\"-1\">
<b>Authentification</b></font>
<hr />
</td></tr>
<tr>
<td align=\"center\" bgcolor=\"#f6ae20\" >
<form action=\"/legacy/Scripts/login.php?op=verifid\"
method=\"post\">
<font size=\"1\">Pseudonyme</font> <br />
<input name=\"pseudo\" type=\"text\"
size=\"12\" maxlength=\"11\" /><br />
<font size=\"1\">Mot de passe</font><br />
<input name =\"password\" type=\"password\"
size=\"12\" maxlength=\"11\" />
<br /><br />
<input name=\"OK\" type=\"submit\"
value=\"LOGIN\" />
</form>
</td></tr></tbody>
</table>";
}
function printDeconnectBox ()
{
$pseudo = $_SESSION['pseudo'];
echo "
<table cellspacing=\"0\" cellpadding=\"1\"
width=\"95%\" border=\"0\">
<tbody>
<tr>
<td valign=\"middle\" align=\"left\" colspan=\"2\">
<font face=\"helvetica,verdana\" size=\"-1\">
<b>Authentification</b></font>
<hr />
</td></tr>
<tr>
<td valign=\"middle\" align=\"center\"
width=\"20%\">
<img src=\"/legacy/Imgs/icon_puce_over.gif\"
border=\"0\" alt=\"*\"/></td>
<td align=\"center\" bgcolor=\"#f6ae20\" >
<a href=/legacy/Scripts/logout.php >
<font face=\"\" color=\"#ffffff\" size=\"-1\">
Quitter la session de $pseudo </font></a> </td> </tr>
</font></a>
</td></tr></tbody>
</table>";
}
function printAdministrationMenu ()
{
global $MENU_ADMIN, $USER_ADMIN;
global $menu;
$pseudo = $_SESSION['pseudo'];
$state = $_SESSION['state'];
if (($pseudo != "") && ($state & $USER_ADMIN)) {
echo "
<table cellspacing=\"0\" cellpadding=\"1\" width=\"95%\"
border=\"0\">
<tbody>
<tr>
<td valign=\"middle\" align=\"right\"
bgcolor=\"#f2ae26\" colspan=\"2\">
<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"
border=\"0\">
<tbody>
<tr>
<td valign=\"middle\" align=\"left\">
<font face=\"helvetica,verdana\"
color=\"#000000\" size=\"-1\">
<b>Administration</b></font>
</td>
</tr></tbody></table>
<hr />
</td></tr>
";
$i = 0;
while ($menu[$i] [0] != "NULL") {
if ($menu[$i] [2] == $MENU_ADMIN)
printMenuEntry ($menu[$i][0], $menu[$i][1]);
$i++;
}
echo "
</tbody></table>";
}
}
function printMemberSection ()
{
global $MENU_MEMBRE, $MODERATOR, $MENU_MOD;
global $menu, $pseudo, $state;
if ($pseudo != "") {
echo "
<table cellspacing=\"0\" cellpadding=\"1\" width=\"95%\"
border=\"0\">
<tbody>
<tr>
<td valign=\"middle\" align=\"right\"
bgcolor=\"#f2ae26\" colspan=\"2\">
<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\"
border=\"0\">
<tbody>
<tr>
<td valign=\"middle\" align=\"left\">
<font face=\"helvetica,verdana\"
color=\"#000000\" size=\"-1\">
<b>Section membre</b></font>
</td>
</tr></tbody></table>
<hr />
</td></tr>
";
$i = 0;
while ($menu[$i] [0] != "NULL") {
if ($menu[$i] [2] == $MENU_MEMBRE)
printMenuEntry ($menu[$i][0], $menu[$i][1]);
if (($menu[$i] [2] == $MENU_MOD) && ($state & $MODERATOR))
printMenuEntry ($menu[$i][0], $menu[$i][1]);
$i++;
}
echo "
</tbody></table>";
}
}
?>