summaryrefslogtreecommitdiff
path: root/src/views/pages/groups.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/views/pages/groups.php')
-rw-r--r--src/views/pages/groups.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/views/pages/groups.php b/src/views/pages/groups.php
new file mode 100644
index 0000000..03f625f
--- /dev/null
+++ b/src/views/pages/groups.php
@@ -0,0 +1,41 @@
+<?php global $mm;
+
+global $illegal_names;
+$illegal_names = array('', 'new');
+global $groupname, $uid;// We will use these to pass the groupname 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');
+ }
+
+ $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');
+ case 'HEAD': // fall-through to GET
+ case 'GET':
+ // We're GETing an existing user
+ include(VIEWPATH.'/pages/users/index.php');
+ }
+}