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
|
<?php global $VARS, $CONTACT_METHODS;
$t = $VARS['template'];
$user = $VARS['user'];
function inputText($user, $key, $label, $hint='') {
global $VARS; $t = $VARS['template'];
$current_setting = $user->getConf($key);
$t->inputText("user_$key", $label, $hint, $current_setting,
!$user->canEdit());
}
function inputArray($user, $key, $arr) {
global $VARS; $t = $VARS['template'];
$defaults = $user->getConfArray($key);
foreach ($arr as $value => $label) {
$t->inputBool($name, $value, $label,
in_array($value, $defaults), !$user->canEdit());
}
}
////////////////////////////////////////////////////////////////////////////////
$t->header("Users: $username");
$t->tag('h1', array(), ($user->canEdit()?'Edit':'View')." User (UID: $uid)");
if ($user->canEdit()) {
$t->openTag('form', array('method'=>'post',
'action'=>$t->url("users/$username")));
} else {
$t->openTag('form');
}
$t->openFieldset("Login / Authentication");
// Username ////////////////////////////////////////////////////////////////////
if (isset($VARS['changed name']) && !$VARS['changed_name']) {
$t->inputP("Error setting username to ".
"<q>$new_name</q>. This is probably because".
" a user with that name already exists.",
true);
}
$t->inputText('auth_name','Username',
"This is the name you use to log in, but it is also a ".
"short name that is used in various places, think of it ".
"as a sort of <q>Twitter name</q>.",
$user->getName(), !$user->canEdit());
// Password ////////////////////////////////////////////////////////////////////
if (@$VARS['pw_updated']===true) {
$t->inputP('Password successfully updated.');
}
if (@$VARS['pw mixmatch']===true) {
$t->inputP("Passwords don't match.", true);
}
if ($user->canEdit()) inputNewPassword($user, 'auth_password','Reset Password');
////////////////////////////////////////////////////////////////////////////////
$t->closeFieldset();
$t->openFieldset("Information");
inputText($user, 'firstname','First Name','');
inputText($user, 'lastname','Last Name','');
inputText($user, 'hsclass','Highschool Class of',
'Please put the full year (ex: 2012)');
$t->closeFieldset();
$t->openFieldset("Contact");
// TODO: I should make this a setting for admins to set.
$hints = array('email'=>
"Right now you can only have one email address, ".
"but I'm working on making it so you can have ".
"multiple.",
'phone'=>
"A home phone number isn't much use here because it is ".
"used to text-message you (if you enable it), and ".
"contact you at competition."
);
$use_arr = array();
foreach ($CONTACT_METHODS as $method) {
inputText($user,
$method->addr_slug,
ucwords($method->addr_word),
$hints[$method->addr_slug]);
$use_arr[$method->verb_slug] = ucwords($method->verb_word);
}
$t->inputP("When I recieve a message, notify me using the following methods:");
inputArray($user, 'use', $use_arr);
$t->closeFieldSet();
$t->openFieldSet('Groups');
$group_arr = array();
foreach ($VARS['groups'] as $group_name) {
$group_arr[$group_name] = ucwords($group_name);
}
inputArray($user, 'groups', $group_arr);
$t->closeFieldset();
if ($user->canEdit()) {
$t->tag('input', array('type'=>'submit', 'value'=>'Save'));
}
$t->closeTag('form');
$t->footer();
|