1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
<?/*
+-------------------------------------------------------------------------+
| raXnet Authentication Scripts |
+-------------------------------------------------------------------------+
| This code is currently maintained and debugged by Ian Berry, any |
| questions or comments regarding this code should be directed to: |
| - iberry@raxnet.net |
+-------------------------------------------------------------------------+
| - raXnet - http://www.raxnet.net/ |
+-------------------------------------------------------------------------+
*/?>
<?
function DrawMenu($userid, $menuid, $print_bullets) {
$current_path = dirname(__FILE__);
include ("$current_path/database.php");
include ("$current_path/config.php");
/* get the current use logged in (if there is one) */
if ($userid=="COOKIE") {
$userid = $HTTP_COOKIE_VARS[$conf_cookiename];
}
/* decide whether we want to print bullets and set what a "bullet" is */
if ($print_bullets == "true") {
$bullet = " ";
}
$res_id = mysql_query("select itemorder from menu where id=$menuid", $cnn_id);
/* decide whether this menu is sorted alphabetically or seqentially */
if (mysql_result($res_id, 0, "itemorder") == 1) {
$sql_sort_string = "cname, name";
}else{
$sql_sort_string = "c.sequence,i.sequence";
}
if ($config["global_auth"]["value"] == "on") {
/* auth is on: show items based on user logged in */
$res_id = mysql_query("select a.sectionid, a.userid,
s.id, s.section,
c.name as cname,c.id, c.imagepath as cimagepath,
i.*
from auth_acl a
left join auth_sections s
on a.sectionid=s.id
left join menu_items i
on a.sectionid=i.sectionid
left join menu_category c
on c.id=i.categoryid
where a.userid=$userid
and i.menuid=$menuid
order by $sql_sort_string",$cnn_id);
}else{
/* auth is off: show all items */
$res_id = mysql_query("select
c.name as cname,c.id, c.imagepath as cimagepath,
i.*
from menu_items i
left join menu_category c
on c.id=i.categoryid
where i.menuid=$menuid
order by $sql_sort_string",$cnn_id);
}
$rows = mysql_num_rows($res_id);
/* loop, loop, loop */
while ($i < $rows) {
if (mysql_result($res_id, $i, "cname") != $old_cat_name) {
if (mysql_result($res_id, $i, "imagepath") == "") {
if ($i != 0) {
?><br><?
}
}
if (mysql_result($res_id, $i, "cimagepath") == "") {
?><strong><?print mysql_result($res_id, $i, "cname");?></strong><br><?
}else{
?><img src="<?print mysql_result($res_id, $i, "cimagepath");?>" border="0" alt="<?print mysql_result($res_id, $i, "cname");?>"><br><?
}
$old_cat_name = mysql_result($res_id, $i, "cname");
}
print $bullet;
if (mysql_result($res_id, $i, "imagepath") == "") {
?><a href="<?print mysql_result($res_id, $i, "url");?>" target="<?if (mysql_result($res_id, $i, "parent")==""){?>_self<?}else{?><?print mysql_result($res_id, $i, "parent");?><?}?>"><?print mysql_result($res_id, $i, "name");?></a><br><?
}else{
?><a href="<?print mysql_result($res_id, $i, "url");?>" target="<?if (mysql_result($res_id, $i, "parent")==""){?>_self<?}else{?><?print mysql_result($res_id, $i, "parent");?><?}?>"><img src="<?print mysql_result($res_id, $i, "imagepath");?>" border="0" alt="<?print mysql_result($res_id, $i, "name");?>"></a><br><?
}
$i++;
}
}
function LogoutUser($redirect_page) {
$current_path = dirname(__FILE__);
include ("$current_path/config.php");
header ("Set-Cookie: $conf_cookiename=; path=/;");
header("Location: $redirect_page");
}
?>
|