summaryrefslogtreecommitdiff
path: root/src/views/pages/groups.php
blob: 03f625f6f0ce22f8e10d3cba4f59882f4cf88285 (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
<?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');
	}
}