summaryrefslogtreecommitdiff
path: root/pages/admin.php
blob: 3f924c7b38c65be9fceab6cd428123576961699a (plain)
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
<div class="admin">
  <div class="header">Admin</div>
<?php
if($loggedin == true) {
?>
<?php 
  $users = new Users($DATA_DIR . "/users.xml");
  if($userid) $UID = $userid;
  else $UID = $HTTP_COOKIE_VARS["UserID"];
  $user = $users->findUser($UID);
?>
<div class="logout">
<a href="?page=admin&amp;action=logout">Logout <em><?php echo $UID;?></em></a>
</div>
<div class="menu">
<?php
include_once($UTIL_DIR . "/modules.php");

foreach($modules as $modulename => $module) {
  if($m == $modulename) $admin_module = $module;
  echo "<div class=\"entry\"><a href=\"?page=admin&amp;m=$modulename\">$module->admin_title</a></div>\n";
}
?>
</div>
<div class="submenu">
<?php
if($admin_module) {
  foreach($admin_module->admin_submodules as $submodulename => $submodule) {
    if($s == $submodule) {
      $admin_submodule = $s;
      $admin_submodule_name = $submodulename;
    }
    echo "<div class=\"subentry\"><a href=\"?page=admin&amp;m=$m&amp;s=$submodule\">$submodulename</a></div>\n";
  }
}
?>
</div>
<div class="form">
<?php
if($admin_submodule) {
  echo "<div class=\"submodule_header\">$admin_submodule_name</div>\n";
  $admin_module->admin($admin_submodule, $a, $vars);
}
?>
</div>
<?php
} else { // logged in?
?>
<div class="form">
<form action="?page=admin&amp;action=login" method="post">
<p>UserID: <input name="userid"/></p>
<p>Password: <input name="password" type="password"/></p>
<p><button type="submit">Login</button></p>
</form>
</div>
<?php
}
?>
</div>