Alternc  latest
Alternc logiel libre pour l'hébergement
adm_doedit.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  * Edit an account settings (name, password, etc.)
22  *
23  * @copyright AlternC-Team 2000-2017 https://alternc.com/
24  */
25 
26 require_once("../class/config.php");
27 
28 if (!$admin->enabled) {
29  $msg->raise("ERROR", "admin", _("This page is restricted to authorized staff"));
30  echo $msg->msg_html_all();
31  exit();
32 }
33 
34 $subadmin=variable_get("subadmin_restriction");
35 
36 $fields = array (
37  "uid" => array ("post", "integer", 0),
38  "enabled" => array ("post", "boolean", true),
39  "pass" => array ("post", "string", ""),
40  "passconf" => array ("post", "string", ""),
41  "canpass" => array ("post", "boolean", true),
42  "notes" => array ("post", "string", ""),
43  "nom" => array ("post", "string", ""),
44  "prenom" => array ("post", "string", ""),
45  "nmail" => array ("post", "string", ""),
46  "type" => array ("post", "string", ""),
47  "duration" => array ("post", "integer", 0),
48  "reset_quotas" => array ("post", "string", false),
49 );
51 
52 
53 if ($subadmin==0 && !$admin->checkcreator($uid)) {
54  $msg->raise("ERROR", "admin", _("This page is restricted to authorized staff"));
55  echo $msg->msg_html_all();
56  exit();
57 }
58 
59 if ($pass != $passconf) {
60  $msg->raise("ERROR", "admin", _("Passwords do not match"));
61  include("adm_edit.php");
62  exit();
63 }
64 // When changing its own account, enabled forced to 1.
65 if ($uid==$mem->user["uid"]) {
66  $enabled=1;
67 }
68 
69 if (!$admin->update_mem($uid, $nmail, $nom, $prenom, $pass, $enabled, $canpass, $type, $duration, $notes, $reset_quotas)){
70  include("adm_edit.php");
71 } else {
72  $msg->raise("INFO", "admin", _("The member has been successfully edited"));
73  include("adm_list.php");
74 }
exit
Definition: adm_doadd.php:70
$fields
Definition: adm_doedit.php:36
if(! $admin->enabled) $subadmin
Edit an account settings (name, password, etc.)
Definition: adm_doedit.php:34
$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
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
$uid