diff options
Diffstat (limited to 'src/views/pages/users.php')
-rw-r--r-- | src/views/pages/users.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/views/pages/users.php b/src/views/pages/users.php new file mode 100644 index 0000000..9c12ee7 --- /dev/null +++ b/src/views/pages/users.php @@ -0,0 +1,44 @@ +<?php global $mm; + +global $illegal_names; +$illegal_names = array('', 'new'); +global $username, $uid;// We will use these to pass the username to sub-views. + +$page_parts = explode('/', PAGE); +if (isset($page_parts[1])) { + $username = $page_parts[1]; + if ($username == '') { + unset($username); + } +} + +if (isset($username)) { // URI: "users/*" + // We'll be handing this off to another view. + if ($username === 'new') { + include(VIEWPATH.'/pages/users/new.php'); + exit(); + } + + $uid = $mm->getUID($username); + if ($mm->getStatus($uid)===3) $uid = false; // ignore groups. + + if ($uid===false) { + include(VIEWPATH.'/pages/users/404.php'); + } else { + include(VIEWPATH.'/pages/users/individual.php'); + } +} else { // URI: "users" + $method = $_SERVER['REQUEST_METHOD']; + switch ($method) { + case 'PUT': + case 'POST': + // We're POSTing a new user + include(VIEWPATH.'/pages/users/create.php'); + break; + case 'HEAD': // fall-through to GET + case 'GET': + // We're GETing an existing user + include(VIEWPATH.'/pages/users/index.php'); + break; + } +} |