forked from craigk5n/webcalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_nonusers.php
129 lines (118 loc) · 4.18 KB
/
edit_nonusers.php
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php // $Id: edit_nonusers.php,v 1.29 2009/11/22 16:47:45 bbannon Exp $
include_once 'includes/init.php';
print_header( array( 'js/translate.js.php' ),
'<script type="text/javascript" src="includes/js/edit_nonusers.js"></script>',
'', true, '', true, false );
if ( ! $is_admin ) {
echo print_not_auth ( true ) . '
</body>
</html>';
exit;
}
if ( ! $NONUSER_PREFIX ) {
echo print_error_header() . translate( 'NONUSER_PREFIX not set' ) . '
</body>
</html>';
exit;
}
$add = getValue ( 'add' );
$nid = getValue ( 'nid' );
// Adding/Editing nonuser calendar.
if ( ( ( $add == '1' ) || ( ! empty ( $nid ) ) ) && empty ( $error ) ) {
$userlist = user_get_users();
$button = translate ( 'Add' );
$buttonAction = 'Add';
$nid = clean_html ( $nid );
if ( ! empty ( $nid ) ) {
nonuser_load_variables ( $nid, 'nonusertemp_' );
$id_display = $nid . '
<input type="hidden" name="nid" value="' . $nid . '" />';
$button = translate ( 'Save' );
$buttonAction = 'Save';
// $nonusertemp_login = substr ( $nonusertemp_login,
// strlen ( $NONUSER_PREFIX ) );
} else
$id_display = '
<input type="text" name="nid" id="calid" size="20" '
. 'onchange="check_name();" maxlength="20" /> '
. translate ( 'word characters only' );
echo '
<form action="edit_nonusers_handler.php" name="editnonuser" method="post" '
. 'onsubmit="return valid_form( this );">'
. ( empty ( $nonusertemp_admin ) ? '' : '
<input type="hidden" name="old_admin" value="'
. $nonusertemp_admin . '" />' ) . '
<h2>' . ( empty ( $nid )
? translate ( 'Add User' ) : translate ( 'Edit User' ) ) . '</h2>
<table>
<tr>
<td><label for="calid">' . translate ( 'Calendar ID' )
. ':</label></td>
<td>' . $id_display . '</td>
</tr>
<tr>
<td><label for="nfirstname">' . translate ( 'First Name' )
. ':</label></td>
<td><input type="text" name="nfirstname" id="nfirstname" size="20" '
. 'maxlength="25" value="'
. ( empty ( $nonusertemp_firstname )
? '' : htmlspecialchars ( $nonusertemp_firstname ) ) . '" /></td>
</tr>
<tr>
<td><label for="nlastname">' . translate ( 'Last Name' )
. ':</label></td>
<td><input type="text" name="nlastname" id="nlastname" size="20" '
. 'maxlength="25" value="'
. ( empty ( $nonusertemp_lastname )
? '' : htmlspecialchars ( $nonusertemp_lastname ) ) . '" /></td>
</tr>
<tr>
<td><label for="nadmin">' . translate ( 'Admin' ) . ':</label></td>
<td>
<select name="nadmin" id="nadmin">';
for ( $i = 0, $cnt = count ( $userlist ); $i < $cnt; $i++ ) {
echo '
<option value="' . $userlist[$i]['cal_login'] . '"'
. ( ! empty ( $nonusertemp_admin ) &&
$nonusertemp_admin == $userlist[$i]['cal_login']
? ' selected="selected"' : '' ) . '>' . $userlist[$i]['cal_fullname']
. '</option>';
}
echo '
</select>
</td>
</tr>';
if ( ! $use_http_auth ) {
echo '
<tr>
<td class="aligntop"><label for="ispublic">'
. translate ( 'Is public calendar' ) . ':</td>
<td>
<input type="radio" name="ispublic" value="Y" '
. ( ! empty ( $nonusertemp_is_public ) && $nonusertemp_is_public == 'Y'
? ' checked="checked"' : '' ) . ' /> ' . translate ( 'Yes' )
. ' <input type="radio" name="ispublic" value="N" '
. ( empty ( $nonusertemp_is_public ) || $nonusertemp_is_public != 'Y'
? ' checked="checked"' : '' ) . ' /> ' . translate ( 'No' ) . '<br />';
if ( ! empty ( $nonusertemp_login ) ) {
$nu_url = $SERVER_URL . 'nulogin.php?login=' . $nonusertemp_login;
echo $nu_url;
}
echo '
</td>
</tr>';
}
echo '
</table><br />
<input type="submit" name="' . $buttonAction
. '" value="' . $button . '" />'
. ( empty ( $nid ) ? '' : '
<input type="submit" name="delete" value="' . translate ( 'Delete' )
. '" onclick="return confirm( \''
. translate( 'Are you sure you want to delete this entry?' )
. '\')" />' ) . '
</form>
';
}
echo print_trailer ( false, true, true );
?>