File: userData.inc

package info (click to toggle)
gallery 1.5.4-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 26,712 kB
  • ctags: 6,567
  • sloc: php: 33,824; sh: 446; xml: 96; makefile: 88; perl: 61
file content (157 lines) | stat: -rw-r--r-- 4,669 bytes parent folder | download
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php /* $Id: userData.inc 12387 2005-12-23 19:26:50Z jenst $ */ ?>
<?php 
 if (!isset($uname)) {  $uname=""; }
 if (!isset($old_password)) {  $old_password=""; }
 if (!isset($new_password1)) {  $new_password1=""; }
 if (!isset($new_password2)) {  $new_password2=""; }
 if (!isset($fullname)) {  $fullname=""; }
 if (!isset($email)) {  $email=""; }
 if (!isset($send_email)) {  $send_email=""; }
 if (!isset($isAdmin)) { $isAdmin = 0; }

 $hidden = array();
 $yesNoChoices = array(1 => _("Yes"), 0 => _("No"));
?>
<table>
<?php if ($allowChange["member_file"] === true) { ?>
<tr>
	<td><?php echo _("Member file") ?></td>
	<td><input name="membersfile" size="30" type="file"></td>
</tr>
<?php echo errorRow("membersfile");
} 
?>
<tr>
<td><?php if ($allowChange["uname"] || $uname) {
	  echo _("Username") ;
}
?></td>
<td><?php 
if ($allowChange["uname"] === true) {
	echo "\n". '<input type="text" name="uname" value="'. $uname .'">';
} else {
	echo $uname;
	$hidden[]=array('uname', $uname);
}
?></td>
</tr>
<?php if ($allowChange["uname"] || $uname) {
	 echo errorRow("uname");
}

if (isset($allowChange["password"]) && $allowChange["password"] === true) {
    if (isset($allowChange["old_password"]) && $allowChange["old_password"] === true) { ?>
<tr>
	<td><?php echo _("Old Password") ?></td>
	<td><input name="old_password" type="password" value="<?php echo $old_password ?>"></td>
</tr>
<?php echo errorRow("old_password");
}
?>
<tr>
	<td><?php echo _("New Password") ?></td>
	<td><input name="new_password1" type="password" value="<?php echo $new_password1 ?>"></td>
</tr>
<?php echo errorRow("new_password1") ?>
<tr>
	<td><?php echo _("New Password (again)") ?></td>
	<td><input name="new_password2" type="password" value="<?php echo $new_password2 ?>"></td>
</tr>
<?php echo errorRow("new_password2");
}
if ($allowChange["fullname"] === true) { ?>
<tr>
	<td><?php echo _("Full Name") ?></td>
	<td><input name="fullname" type="text" size="25" value="<?php echo $fullname ?>"></td>
</tr>
<?php echo errorRow("fullname");
}
if ($allowChange["email"] === true) { ?>
<tr>
	<td><?php echo _("Email Address") ?></td>
	<td><input name="email" type="text" size="35" value="<?php echo $email ?>"></td>
</tr>
<?php echo errorRow("email");
}
if (isset($allowChange["default_language"]) && $allowChange["default_language"]) {
	if (!$GALLERY_EMBEDDED_INSIDE && 
		$gallery->app->ML_mode > 1 &&
		sizeof($gallery->app->available_lang) > 1) { ?>
<tr>
	<td><?php echo _("Gallery language") ?></td>
	<td><select name="defaultLanguage" size="1">
<?php
		$nls = getNLS();
		foreach ($gallery->app->available_lang as $value) {
			// Only use language from config.php if its 
			// defined in nls.php
			if (!isset($nls['language'][$value])) continue;
		
			if ( isset($defaultLanguage) && $defaultLanguage == $value) {
				$selected="selected";
			} else {
				$selected="";
			}
			echo "\n\t\t<option value=\"$value\" $selected>" 
				. $nls['language'][$value] ."</option>";
		}
?>
</select></td>
</tr>
<?php 	}  
	else { 
		$hidden[]=array('defaultLanguage', $gallery->app->default_language);
	}
}

if (isset($allowChange["canChangeOwnPw"]) && $allowChange["canChangeOwnPw"] === true) { ?>
<tr>
        <td><?php echo _("User can change its own password") ?></td>
        <td><?php echo drawSelect("canChangeOwnPw", $yesNoChoices, $canChangeOwnPw, 1); ?></td>
</tr>
<?php
}

if (isset($allowChange["create_albums"]) && $allowChange["create_albums"] === true) { ?>
<tr>
	<td><?php echo _("User can create albums") ?></td>
	<td><?php echo drawSelect("canCreate", $yesNoChoices, $canCreate, 1); ?></td>
</tr>
<?php
}

if ($gallery->user->isAdmin()) { ?>
<tr>
	<td><?php echo _("User is an admin") ?></td>
	<?php 
		if ($allowChange["admin"] === true) {
		    if ($uname=$gallery->user->getUsername() == $uname) {
			echo '<td>'. $yesNoChoices[$isAdmin] .'</td></tr>';
			echo '<tr><td colspan="2"><i>('. _("you can't un-admin yourself") . ')</i></td>';
			$hidden[]=array('isAdmin', $isAdmin);
		    } else {
			echo '<td>'. drawSelect("isAdmin", $yesNoChoices, $isAdmin, 1) . '</td>';
			echo '<tr><td colspan="2"><i>('. _("Note: Admins can always create albums and are allowed to change their password.") .')</i>';
		    }
		} ?></td>
</tr>
<?php 
}

if ($allowChange["send_email"] === true && $gallery->app->emailOn == "yes") { ?>
<tr>
	<td><?php echo _("Send email to user when account is created") ?></td>
	<td><input checked name="send_email" type="checkbox"></td>
</tr>
<?php 
} else { 
	$hidden[]=array('send_email', "");
}
?>
</table>
<?php
	foreach ($hidden as $line) {
		echo "\n". '<input type="hidden" name="'. $line[0] .'" value="'. $line[1] .'">';
	}
	echo "\n";
?>