Alternc  latest
Alternc logiel libre pour l'hébergement
adm_edit.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  LICENSE
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License (GPL)
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  To read the license please visit http://www.gnu.org/copyleft/gpl.html
17  ----------------------------------------------------------------------
18 */
19 
20 /**
21  * Show a form to edit an account
22  *
23  * @copyright AlternC-Team 2000-2017 https://alternc.com/
24  */
25 
26 require_once("../class/config.php");
27 include_once("head.php");
28 
29 if (!$admin->enabled) {
30  $msg->raise("ERROR", "admin", _("This page is restricted to authorized staff"));
31  echo $msg->msg_html_all();
32  exit();
33 }
34 
35 $fields = array (
36  "uid" => array ("request", "integer", 0),
37 );
39 
40 $subadmin=variable_get("subadmin_restriction");
41 
42 if ($subadmin==0 && !$admin->checkcreator($uid)) {
43  $msg->raise("ERROR", "admin", _("This page is restricted to authorized staff"));
44  echo $msg->msg_html_all();
45  exit();
46 }
47 
48 $r=$admin->get($uid);
49 
50 $c=$admin->listPasswordPolicies();
51 $passwd_classcount = $c['adm']['classcount'];
52 
53 ?>
54 <h3><?php __("Member Edition"); ?></h3>
55 <hr id="topbar"/>
56 <br />
57 <?php
58 echo $msg->msg_html_all();
59 ?>
60 <form method="post" action="adm_doedit.php" name="main" id="main" autocomplete="off">
61  <?php csrf_get(); ?>
62 
63 <table class="tedit">
64 <tr>
65  <th><input type="hidden" name="uid" value="<?php echo $uid ?>" />
66 <?php __("Username"); ?></th>
67  <td><?php echo $r["login"]; ?></td>
68 </tr>
69 <tr>
70  <th><label><?php __("Account Enabled?"); ?></label></th>
71  <td>
72  <?php if ($r["uid"]==$mem->user["uid"]) { ?>
73  <?php __("You cannot disable your own account."); ?>
74  <?php } else { ?>
75  <input type="radio" class="inc" id="enabled0" name="enabled" value="0"<?php cbox($r["enabled"]==0); ?> /><label for="enabled0"><?php __("No"); ?></label><br />
76  <input type="radio" class="inc" id="enabled1" name="enabled" value="1"<?php cbox($r["enabled"]==1); ?> /><label for="enabled1"><?php __("Yes"); ?></label><br />
77  <?php } ?>
78  </td>
79 </tr>
80 
81 <tr>
82  <th><label for="pass"><?php __("Password"); ?></label></th>
83  <td><input type="password" class="int" id="pass" autocomplete="off" name="pass" value="" size="20" maxlength="64" /><?php display_div_generate_password(DEFAULT_PASS_SIZE,"#pass","#passconf",$passwd_classcount); ?></td>
84 </tr>
85 <tr>
86  <th><label for="passconf"><?php __("Confirm password"); ?></label></th>
87  <td><input type="password" class="int" id="passconf" autocomplete="off" name="passconf" value="" size="20" maxlength="64" /></td>
88 </tr>
89 <tr>
90  <th><label><?php __("Password change allowed?"); ?></label></th>
91  <td>
92  <input type="radio" class="inc" id="canpass0" name="canpass" value="0"<?php cbox($r["canpass"]==0); ?>/><label for="canpass0"><?php __("No"); ?></label><br />
93  <input type="radio" class="inc" id="canpass1" name="canpass" value="1"<?php cbox($r["canpass"]==1); ?>/><label for="canpass1"><?php __("Yes"); ?></label><br />
94  </td>
95 </tr>
96  <tr>
97  <th><label for="notes"><?php __("Notes"); ?></label></th>
98  <td><textarea name="notes" id="notes" class="int" cols="32" rows="5"><?php ehe($r['notes']); ?></textarea></td>
99 </tr>
100 <tr>
101  <th><label for="nom"><?php echo _("Surname")."</label> / <label for=\"prenom\">"._("First Name"); ?></label></th>
102  <td><input type="text" class="int" name="nom" id="nom" value="<?php ehe($r["nom"]); ?>" size="20" maxlength="128" />&nbsp;/&nbsp;<input type="text" class="int" name="prenom" id="prenom" value="<?php ehe($r["prenom"]); ?>" size="20" maxlength="128" /></td>
103 </tr>
104 <tr>
105  <th><label for="nmail"><?php __("Email address"); ?></label></th>
106  <td><input type="text" class="int" name="nmail" id="nmail" value="<?php ehe($r["mail"]); ?>" size="30" maxlength="128" /></td>
107 </tr>
108 <tr>
109  <th><label for="type"><?php __("Account type"); ?></label></th>
110  <td><select name="type" id="type" class="inl">
111  <?php
112  eoption($quota->listtype(), $r['type'], true);
113 ?></select>&nbsp; <input type="checkbox" name="reset_quotas" id="reset_quotas" class="inc" /><label for="reset_quotas"><?php __("Reset quotas to default?") ?></label></td>
114 </tr>
115 <tr>
116  <th><label for="duration"><?php __("Period"); ?></label></th>
117  <td><?php echo duration_list('duration', $r['duration']) ?></td>
118 </tr>
119 <tr class="trbtn"><td colspan="2">
120  <input type="submit" class="inb" name="submit" value="<?php __("Edit this account"); ?>" />
121  <input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='adm_list.php'" />
122 </td>
123 </tr>
124 </table>
125 </form>
126 
127 <br/>
128 
129 <?php if($r['duration']) { ?>
130 <form method="post" action="adm_dorenew.php">
131  <?php csrf_get(); ?>
132 <input type="hidden" name="uid" value="<?php echo $uid ?>" />
133 <table border="1" cellspacing="0" cellpadding="4" class="tedit">
134 <tr>
135  <th><label for="periods"><?php __("Renew for") ?></label></th>
136  <td><input name="periods" id="periods" type="text" size="2" value="1"/><?php echo ' ' . _('period(s)') ?></td>
137 </tr>
138 <tr>
139  <td colspan="2" align="center"><input type="submit" class="inb" name="submit" value="<?php __("Renew"); ?>" />
140 </td>
141 </tr>
142 </table>
143 </form>
144 <?php } /* Renewal */ ?>
145 
146 <p>
147 <?php
148 if ($mem->user["uid"]==2000 && $r["uid"]!=2000) { // Only ADMIN (2000) can change the admin status of accounts
149 if ($r["su"]) {
150 ?>
151 <b><?php __("This account is a super-admin account"); ?></b>
152 <br/>
153 <br/>
154 <?php if ($admin->onesu()) {
155  __("There is only one administrator account, you cannot turn this account back to normal");
156 } else {
157 ?>
158 <span class="ina"><a href="adm_donosu.php?uid=<?php echo $r["uid"]; ?>"><?php __("Turn this account back to normal"); ?></a></span>
159 <?php }
160 } else { ?>
161 <span class="ina"><a href="adm_dosu.php?uid=<?php echo $r["uid"]; ?>"><?php __("Make this account a super admin one"); ?></a></span>
162 <?php } ?>
163 </p>
164 
165 <p><?php
166  }
167 if ($c=$admin->get($r["creator"])) {
168  printf(_("Account created by %s"),$c["login"]);
169  }
170 ?>
171 </p>
172 <script type="text/javascript">
173  document.forms['main'].pass.focus();
174 </script>
175 <?php include_once("foot.php"); ?>
exit
Definition: adm_doadd.php:70
$subadmin
Definition: adm_edit.php:40
if(! $admin->enabled) $fields
Show a form to edit an account.
Definition: adm_edit.php:35
if($subadmin==0 &&! $admin->checkcreator($uid)) $r
Definition: adm_edit.php:48
$c
Definition: adm_edit.php:50
$passwd_classcount
Definition: adm_edit.php:51
$mem
Definition: bootstrap.php:71
$msg
Definition: bootstrap.php:75
variable_get($name, $default=null, $createit_comment=null)
Return a persistent variable.
Definition: variables.php:85
const DEFAULT_PASS_SIZE
Define constants from vars of /etc/alternc/local.sh The you can't choose where is the AlternC Panel.
Definition: config.php:81
display_div_generate_password($pass_size=DEFAULT_PASS_SIZE, $fields_to_fill1="", $fields_to_fill2="", $classcount=3)
Show a button to set a random password for a password field.
Definition: functions.php:922
eoption($values, $cur, $onedim=false)
select_values($arr,$cur) echo des <option> du tableau $values ou de la table sql $values selectionne ...
Definition: functions.php:619
duration_list($name, $selected=0)
Definition: functions.php:586
ehe($str, $display=TRUE)
Echo the HTMLSpecialChars version of a value.
Definition: functions.php:647
__($str)
Definition: functions.php:404
cbox($test, $echo=true)
ECHOes checked="checked" only if the parameter is true useful for checkboxes and radio buttons.
Definition: functions.php:345
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
Definition: functions.php:688
csrf_get($return=false)
Give a new CSRF uniq token for a form the session must be up since the CSRF is linked to the session ...
Definition: functions.php:1159
$uid