@@ -4,18 +4,18 @@ |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch ($modx->manager->action) { |
| 7 | - case 16: |
|
| 8 | - if (!$modx->hasPermission('edit_template')) { |
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 19: |
|
| 13 | - if (!$modx->hasPermission('new_template')) { |
|
| 7 | + case 16: |
|
| 8 | + if (!$modx->hasPermission('edit_template')) { |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 19: |
|
| 13 | + if (!$modx->hasPermission('new_template')) { |
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 14 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch ($modx->manager->action) {
|
| 7 | - case 88: |
|
| 8 | - if (!$modx->hasPermission('edit_web_user')) {
|
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 87: |
|
| 13 | - if (!$modx->hasPermission('new_web_user')) {
|
|
| 7 | + case 88: |
|
| 8 | + if (!$modx->hasPermission('edit_web_user')) {
|
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 87: |
|
| 13 | + if (!$modx->hasPermission('new_web_user')) {
|
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 14 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -3,18 +3,18 @@ |
||
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
|
| 4 | 4 | } |
| 5 | 5 | switch ($modx->manager->action) {
|
| 6 | - case 107: |
|
| 7 | - if (!$modx->hasPermission('new_module')) {
|
|
| 6 | + case 107: |
|
| 7 | + if (!$modx->hasPermission('new_module')) {
|
|
| 8 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 9 | + } |
|
| 10 | + break; |
|
| 11 | + case 108: |
|
| 12 | + if (!$modx->hasPermission('edit_module')) {
|
|
| 13 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 14 | + } |
|
| 15 | + break; |
|
| 16 | + default: |
|
| 8 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 9 | - } |
|
| 10 | - break; |
|
| 11 | - case 108: |
|
| 12 | - if (!$modx->hasPermission('edit_module')) {
|
|
| 13 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 14 | - } |
|
| 15 | - break; |
|
| 16 | - default: |
|
| 17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 18 | 18 | } |
| 19 | 19 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
| 20 | 20 | // Get table names (alphabetical) |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch ((int) $modx->manager->action) { |
| 7 | - case 35: |
|
| 8 | - if (!$modx->hasPermission('edit_role')) { |
|
| 7 | + case 35: |
|
| 8 | + if (!$modx->hasPermission('edit_role')) { |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 38: |
|
| 13 | + if (!$modx->hasPermission('new_role')) { |
|
| 14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + } |
|
| 16 | + break; |
|
| 17 | + default: |
|
| 9 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 38: |
|
| 13 | - if (!$modx->hasPermission('new_role')) { |
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -276,19 +276,19 @@ |
||
| 276 | 276 | |
| 277 | 277 | // invoke OnBeforeDocFormSave event |
| 278 | 278 | switch ($modx->config['docid_incrmnt_method']) { |
| 279 | - case '1': |
|
| 280 | - $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
|
| 281 | - $where = "T1.id IS NULL"; |
|
| 282 | - $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
| 283 | - $id = $modx->db->getValue($rs); |
|
| 279 | + case '1': |
|
| 280 | + $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
|
| 281 | + $where = "T1.id IS NULL"; |
|
| 282 | + $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
| 283 | + $id = $modx->db->getValue($rs); |
|
| 284 | + break; |
|
| 285 | + case '2': |
|
| 286 | + $rs = $modx->db->select('MAX(id)+1', $tbl_site_content); |
|
| 287 | + $id = $modx->db->getValue($rs); |
|
| 284 | 288 | break; |
| 285 | - case '2': |
|
| 286 | - $rs = $modx->db->select('MAX(id)+1', $tbl_site_content); |
|
| 287 | - $id = $modx->db->getValue($rs); |
|
| 288 | - break; |
|
| 289 | 289 | |
| 290 | - default: |
|
| 291 | - $id = ''; |
|
| 290 | + default: |
|
| 291 | + $id = ''; |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | $modx->invokeEvent("OnBeforeDocFormSave", array( |
@@ -60,109 +60,109 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | switch ($input['mode']) { |
| 63 | - case '87': // new user |
|
| 64 | - // check if this user name already exist |
|
| 65 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
| 66 | - $limit = $modx->db->getValue($rs); |
|
| 67 | - if ($limit > 0) { |
|
| 68 | - webAlertAndQuit("User name is already in use!"); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - // check if the email address already exist |
|
| 72 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 73 | - $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
| 63 | + case '87': // new user |
|
| 64 | + // check if this user name already exist |
|
| 65 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
| 74 | 66 | $limit = $modx->db->getValue($rs); |
| 75 | 67 | if ($limit > 0) { |
| 76 | - webAlertAndQuit("Email is already in use!"); |
|
| 68 | + webAlertAndQuit("User name is already in use!"); |
|
| 77 | 69 | } |
| 78 | - } |
|
| 79 | 70 | |
| 80 | - // generate a new password for this user |
|
| 81 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 82 | - if (strlen($specifiedpassword) < 6) { |
|
| 83 | - webAlertAndQuit("Password is too short!"); |
|
| 84 | - } else { |
|
| 85 | - $newpassword = $specifiedpassword; |
|
| 71 | + // check if the email address already exist |
|
| 72 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 73 | + $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
| 74 | + $limit = $modx->db->getValue($rs); |
|
| 75 | + if ($limit > 0) { |
|
| 76 | + webAlertAndQuit("Email is already in use!"); |
|
| 77 | + } |
|
| 86 | 78 | } |
| 87 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 88 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 89 | - } elseif ($passwordgenmethod == 'g') { |
|
| 90 | - $newpassword = generate_password(8); |
|
| 91 | - } else { |
|
| 92 | - webAlertAndQuit("No password generation method specified!"); |
|
| 93 | - } |
|
| 94 | 79 | |
| 95 | - // invoke OnBeforeWUsrFormSave event |
|
| 96 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 97 | - "mode" => "new", |
|
| 98 | - )); |
|
| 99 | - |
|
| 100 | - // create the user account |
|
| 101 | - $field = array(); |
|
| 102 | - $field['username'] = $esc_newusername; |
|
| 103 | - $field['password'] = md5($newpassword); |
|
| 104 | - $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
| 105 | - |
|
| 106 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 107 | - $field = $modx->db->escape($field); |
|
| 108 | - $modx->db->insert($field, $tbl_web_user_attributes); |
|
| 109 | - |
|
| 110 | - // Save User Settings |
|
| 111 | - saveUserSettings($internalKey); |
|
| 112 | - |
|
| 113 | - // Set the item name for logger |
|
| 114 | - $_SESSION['itemname'] = $newusername; |
|
| 115 | - |
|
| 116 | - /*******************************************************************************/ |
|
| 117 | - // put the user in the user_groups he/ she should be in |
|
| 118 | - // first, check that up_perms are switched on! |
|
| 119 | - if ($use_udperms == 1) { |
|
| 120 | - if (!empty($user_groups)) { |
|
| 121 | - for ($i = 0; $i < count($user_groups); $i++) { |
|
| 122 | - $f = array(); |
|
| 123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
| 124 | - $f['webuser'] = $internalKey; |
|
| 125 | - $modx->db->insert($f, $tbl_web_groups); |
|
| 80 | + // generate a new password for this user |
|
| 81 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 82 | + if (strlen($specifiedpassword) < 6) { |
|
| 83 | + webAlertAndQuit("Password is too short!"); |
|
| 84 | + } else { |
|
| 85 | + $newpassword = $specifiedpassword; |
|
| 126 | 86 | } |
| 127 | - } |
|
| 128 | - } |
|
| 129 | - // end of user_groups stuff! |
|
| 130 | - |
|
| 131 | - // invoke OnWebSaveUser event |
|
| 132 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
| 133 | - "mode" => "new", |
|
| 134 | - "userid" => $internalKey, |
|
| 135 | - "username" => $newusername, |
|
| 136 | - "userpassword" => $newpassword, |
|
| 137 | - "useremail" => $email, |
|
| 138 | - "userfullname" => $fullname |
|
| 139 | - )); |
|
| 140 | - |
|
| 141 | - // invoke OnWUsrFormSave event |
|
| 142 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
| 143 | - "mode" => "new", |
|
| 144 | - "id" => $internalKey |
|
| 145 | - )); |
|
| 146 | - |
|
| 147 | - if ($passwordnotifymethod == 'e') { |
|
| 148 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 149 | - if ($input['stay'] != '') { |
|
| 150 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 152 | - header($header); |
|
| 87 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 88 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 89 | + } elseif ($passwordgenmethod == 'g') { |
|
| 90 | + $newpassword = generate_password(8); |
|
| 153 | 91 | } else { |
| 154 | - $header = "Location: index.php?a=99&r=2"; |
|
| 155 | - header($header); |
|
| 92 | + webAlertAndQuit("No password generation method specified!"); |
|
| 156 | 93 | } |
| 157 | - } else { |
|
| 158 | - if ($input['stay'] != '') { |
|
| 159 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 161 | - } else { |
|
| 162 | - $stayUrl = "index.php?a=99&r=2"; |
|
| 94 | + |
|
| 95 | + // invoke OnBeforeWUsrFormSave event |
|
| 96 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 97 | + "mode" => "new", |
|
| 98 | + )); |
|
| 99 | + |
|
| 100 | + // create the user account |
|
| 101 | + $field = array(); |
|
| 102 | + $field['username'] = $esc_newusername; |
|
| 103 | + $field['password'] = md5($newpassword); |
|
| 104 | + $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
| 105 | + |
|
| 106 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 107 | + $field = $modx->db->escape($field); |
|
| 108 | + $modx->db->insert($field, $tbl_web_user_attributes); |
|
| 109 | + |
|
| 110 | + // Save User Settings |
|
| 111 | + saveUserSettings($internalKey); |
|
| 112 | + |
|
| 113 | + // Set the item name for logger |
|
| 114 | + $_SESSION['itemname'] = $newusername; |
|
| 115 | + |
|
| 116 | + /*******************************************************************************/ |
|
| 117 | + // put the user in the user_groups he/ she should be in |
|
| 118 | + // first, check that up_perms are switched on! |
|
| 119 | + if ($use_udperms == 1) { |
|
| 120 | + if (!empty($user_groups)) { |
|
| 121 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
| 122 | + $f = array(); |
|
| 123 | + $f['webgroup'] = (int)$user_groups[$i]; |
|
| 124 | + $f['webuser'] = $internalKey; |
|
| 125 | + $modx->db->insert($f, $tbl_web_groups); |
|
| 126 | + } |
|
| 127 | + } |
|
| 163 | 128 | } |
| 129 | + // end of user_groups stuff! |
|
| 130 | + |
|
| 131 | + // invoke OnWebSaveUser event |
|
| 132 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
| 133 | + "mode" => "new", |
|
| 134 | + "userid" => $internalKey, |
|
| 135 | + "username" => $newusername, |
|
| 136 | + "userpassword" => $newpassword, |
|
| 137 | + "useremail" => $email, |
|
| 138 | + "userfullname" => $fullname |
|
| 139 | + )); |
|
| 140 | + |
|
| 141 | + // invoke OnWUsrFormSave event |
|
| 142 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
| 143 | + "mode" => "new", |
|
| 144 | + "id" => $internalKey |
|
| 145 | + )); |
|
| 164 | 146 | |
| 165 | - include_once "header.inc.php"; ?> |
|
| 147 | + if ($passwordnotifymethod == 'e') { |
|
| 148 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 149 | + if ($input['stay'] != '') { |
|
| 150 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 151 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 152 | + header($header); |
|
| 153 | + } else { |
|
| 154 | + $header = "Location: index.php?a=99&r=2"; |
|
| 155 | + header($header); |
|
| 156 | + } |
|
| 157 | + } else { |
|
| 158 | + if ($input['stay'] != '') { |
|
| 159 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
| 160 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 161 | + } else { |
|
| 162 | + $stayUrl = "index.php?a=99&r=2"; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + include_once "header.inc.php"; ?> |
|
| 166 | 166 | |
| 167 | 167 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
| 168 | 168 | |
@@ -184,123 +184,123 @@ discard block |
||
| 184 | 184 | </div> |
| 185 | 185 | <?php |
| 186 | 186 | |
| 187 | - include_once "footer.inc.php"; |
|
| 188 | - } |
|
| 189 | - break; |
|
| 190 | - case '88': // edit user |
|
| 191 | - // generate a new password for this user |
|
| 192 | - if ($genpassword == 1) { |
|
| 193 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 194 | - if (strlen($specifiedpassword) < 6) { |
|
| 195 | - webAlertAndQuit("Password is too short!"); |
|
| 187 | + include_once "footer.inc.php"; |
|
| 188 | + } |
|
| 189 | + break; |
|
| 190 | + case '88': // edit user |
|
| 191 | + // generate a new password for this user |
|
| 192 | + if ($genpassword == 1) { |
|
| 193 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 194 | + if (strlen($specifiedpassword) < 6) { |
|
| 195 | + webAlertAndQuit("Password is too short!"); |
|
| 196 | + } else { |
|
| 197 | + $newpassword = $specifiedpassword; |
|
| 198 | + } |
|
| 199 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 200 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 201 | + } elseif ($passwordgenmethod == 'g') { |
|
| 202 | + $newpassword = generate_password(8); |
|
| 196 | 203 | } else { |
| 197 | - $newpassword = $specifiedpassword; |
|
| 204 | + webAlertAndQuit("No password generation method specified!"); |
|
| 198 | 205 | } |
| 199 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 200 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 201 | - } elseif ($passwordgenmethod == 'g') { |
|
| 202 | - $newpassword = generate_password(8); |
|
| 203 | - } else { |
|
| 204 | - webAlertAndQuit("No password generation method specified!"); |
|
| 205 | 206 | } |
| 206 | - } |
|
| 207 | - if ($passwordnotifymethod == 'e') { |
|
| 208 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - // check if the username already exist |
|
| 212 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
| 213 | - $limit = $modx->db->getValue($rs); |
|
| 214 | - if ($limit > 0) { |
|
| 215 | - webAlertAndQuit("User name is already in use!"); |
|
| 216 | - } |
|
| 207 | + if ($passwordnotifymethod == 'e') { |
|
| 208 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 209 | + } |
|
| 217 | 210 | |
| 218 | - // check if the email address already exists |
|
| 219 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 220 | - $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
| 211 | + // check if the username already exist |
|
| 212 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
| 221 | 213 | $limit = $modx->db->getValue($rs); |
| 222 | 214 | if ($limit > 0) { |
| 223 | - webAlertAndQuit("Email is already in use!"); |
|
| 215 | + webAlertAndQuit("User name is already in use!"); |
|
| 216 | + } |
|
| 217 | + |
|
| 218 | + // check if the email address already exists |
|
| 219 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
| 220 | + $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
| 221 | + $limit = $modx->db->getValue($rs); |
|
| 222 | + if ($limit > 0) { |
|
| 223 | + webAlertAndQuit("Email is already in use!"); |
|
| 224 | + } |
|
| 224 | 225 | } |
| 225 | - } |
|
| 226 | 226 | |
| 227 | - // invoke OnBeforeWUsrFormSave event |
|
| 228 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 229 | - "mode" => "upd", |
|
| 230 | - "id" => $id |
|
| 231 | - )); |
|
| 227 | + // invoke OnBeforeWUsrFormSave event |
|
| 228 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
| 229 | + "mode" => "upd", |
|
| 230 | + "id" => $id |
|
| 231 | + )); |
|
| 232 | 232 | |
| 233 | - // update user name and password |
|
| 234 | - $field = array(); |
|
| 235 | - $field['username'] = $esc_newusername; |
|
| 236 | - if ($genpassword == 1) { |
|
| 237 | - $field['password'] = md5($newpassword); |
|
| 238 | - } |
|
| 239 | - $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
| 240 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 241 | - $field = $modx->db->escape($field); |
|
| 242 | - $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
| 243 | - |
|
| 244 | - // Save User Settings |
|
| 245 | - saveUserSettings($id); |
|
| 246 | - |
|
| 247 | - // Set the item name for logger |
|
| 248 | - $_SESSION['itemname'] = $newusername; |
|
| 249 | - |
|
| 250 | - /*******************************************************************************/ |
|
| 251 | - // put the user in the user_groups he/ she should be in |
|
| 252 | - // first, check that up_perms are switched on! |
|
| 253 | - if ($use_udperms == 1) { |
|
| 254 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
| 255 | - $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
| 256 | - if (!empty($user_groups)) { |
|
| 257 | - for ($i = 0; $i < count($user_groups); $i++) { |
|
| 258 | - $field = array(); |
|
| 259 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
| 260 | - $field['webuser'] = $id; |
|
| 261 | - $modx->db->insert($field, $tbl_web_groups); |
|
| 233 | + // update user name and password |
|
| 234 | + $field = array(); |
|
| 235 | + $field['username'] = $esc_newusername; |
|
| 236 | + if ($genpassword == 1) { |
|
| 237 | + $field['password'] = md5($newpassword); |
|
| 238 | + } |
|
| 239 | + $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
| 240 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 241 | + $field = $modx->db->escape($field); |
|
| 242 | + $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
| 243 | + |
|
| 244 | + // Save User Settings |
|
| 245 | + saveUserSettings($id); |
|
| 246 | + |
|
| 247 | + // Set the item name for logger |
|
| 248 | + $_SESSION['itemname'] = $newusername; |
|
| 249 | + |
|
| 250 | + /*******************************************************************************/ |
|
| 251 | + // put the user in the user_groups he/ she should be in |
|
| 252 | + // first, check that up_perms are switched on! |
|
| 253 | + if ($use_udperms == 1) { |
|
| 254 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
| 255 | + $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
| 256 | + if (!empty($user_groups)) { |
|
| 257 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
| 258 | + $field = array(); |
|
| 259 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
| 260 | + $field['webuser'] = $id; |
|
| 261 | + $modx->db->insert($field, $tbl_web_groups); |
|
| 262 | + } |
|
| 262 | 263 | } |
| 263 | 264 | } |
| 264 | - } |
|
| 265 | - // end of user_groups stuff! |
|
| 266 | - /*******************************************************************************/ |
|
| 267 | - |
|
| 268 | - // invoke OnWebSaveUser event |
|
| 269 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
| 270 | - "mode" => "upd", |
|
| 271 | - "userid" => $id, |
|
| 272 | - "username" => $newusername, |
|
| 273 | - "userpassword" => $newpassword, |
|
| 274 | - "useremail" => $email, |
|
| 275 | - "userfullname" => $fullname, |
|
| 276 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
| 277 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
| 278 | - )); |
|
| 279 | - |
|
| 280 | - // invoke OnWebChangePassword event |
|
| 281 | - if ($genpassword == 1) { |
|
| 282 | - $modx->invokeEvent("OnWebChangePassword", array( |
|
| 265 | + // end of user_groups stuff! |
|
| 266 | + /*******************************************************************************/ |
|
| 267 | + |
|
| 268 | + // invoke OnWebSaveUser event |
|
| 269 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
| 270 | + "mode" => "upd", |
|
| 283 | 271 | "userid" => $id, |
| 284 | 272 | "username" => $newusername, |
| 285 | - "userpassword" => $newpassword |
|
| 273 | + "userpassword" => $newpassword, |
|
| 274 | + "useremail" => $email, |
|
| 275 | + "userfullname" => $fullname, |
|
| 276 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
| 277 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
| 286 | 278 | )); |
| 287 | - } |
|
| 288 | - |
|
| 289 | - // invoke OnWUsrFormSave event |
|
| 290 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
| 291 | - "mode" => "upd", |
|
| 292 | - "id" => $id |
|
| 293 | - )); |
|
| 294 | 279 | |
| 295 | - if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 296 | - if ($input['stay'] != '') { |
|
| 297 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 298 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 299 | - } else { |
|
| 300 | - $stayUrl = "index.php?a=99&r=2"; |
|
| 280 | + // invoke OnWebChangePassword event |
|
| 281 | + if ($genpassword == 1) { |
|
| 282 | + $modx->invokeEvent("OnWebChangePassword", array( |
|
| 283 | + "userid" => $id, |
|
| 284 | + "username" => $newusername, |
|
| 285 | + "userpassword" => $newpassword |
|
| 286 | + )); |
|
| 301 | 287 | } |
| 302 | 288 | |
| 303 | - include_once "header.inc.php"; ?> |
|
| 289 | + // invoke OnWUsrFormSave event |
|
| 290 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
| 291 | + "mode" => "upd", |
|
| 292 | + "id" => $id |
|
| 293 | + )); |
|
| 294 | + |
|
| 295 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 296 | + if ($input['stay'] != '') { |
|
| 297 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 298 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 299 | + } else { |
|
| 300 | + $stayUrl = "index.php?a=99&r=2"; |
|
| 301 | + } |
|
| 302 | + |
|
| 303 | + include_once "header.inc.php"; ?> |
|
| 304 | 304 | |
| 305 | 305 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
| 306 | 306 | |
@@ -320,20 +320,20 @@ discard block |
||
| 320 | 320 | </div> |
| 321 | 321 | <?php |
| 322 | 322 | |
| 323 | - include_once "footer.inc.php"; |
|
| 324 | - } else { |
|
| 325 | - if ($input['stay'] != '') { |
|
| 326 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 327 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 328 | - header($header); |
|
| 323 | + include_once "footer.inc.php"; |
|
| 329 | 324 | } else { |
| 330 | - $header = "Location: index.php?a=99&r=2"; |
|
| 331 | - header($header); |
|
| 325 | + if ($input['stay'] != '') { |
|
| 326 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
| 327 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 328 | + header($header); |
|
| 329 | + } else { |
|
| 330 | + $header = "Location: index.php?a=99&r=2"; |
|
| 331 | + header($header); |
|
| 332 | + } |
|
| 332 | 333 | } |
| 333 | - } |
|
| 334 | - break; |
|
| 335 | - default: |
|
| 336 | - webAlertAndQuit("No operation set in request."); |
|
| 334 | + break; |
|
| 335 | + default: |
|
| 336 | + webAlertAndQuit("No operation set in request."); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
@@ -68,109 +68,109 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | switch ($input['mode']) { |
| 71 | - case '11': // new user |
|
| 72 | - // check if this user name already exist |
|
| 73 | - $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername))); |
|
| 74 | - $limit = $modx->db->getValue($rs); |
|
| 75 | - if ($limit > 0) { |
|
| 76 | - webAlertAndQuit("User name is already in use!"); |
|
| 77 | - } |
|
| 71 | + case '11': // new user |
|
| 72 | + // check if this user name already exist |
|
| 73 | + $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername))); |
|
| 74 | + $limit = $modx->db->getValue($rs); |
|
| 75 | + if ($limit > 0) { |
|
| 76 | + webAlertAndQuit("User name is already in use!"); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - // check if the email address already exist |
|
| 80 | - $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id)); |
|
| 81 | - $limit = $modx->db->getValue($rs); |
|
| 82 | - if ($limit > 0) { |
|
| 83 | - webAlertAndQuit("Email is already in use!"); |
|
| 84 | - } |
|
| 79 | + // check if the email address already exist |
|
| 80 | + $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id)); |
|
| 81 | + $limit = $modx->db->getValue($rs); |
|
| 82 | + if ($limit > 0) { |
|
| 83 | + webAlertAndQuit("Email is already in use!"); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - // generate a new password for this user |
|
| 87 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 88 | - if (strlen($specifiedpassword) < 6) { |
|
| 89 | - webAlertAndQuit("Password is too short!"); |
|
| 86 | + // generate a new password for this user |
|
| 87 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 88 | + if (strlen($specifiedpassword) < 6) { |
|
| 89 | + webAlertAndQuit("Password is too short!"); |
|
| 90 | + } else { |
|
| 91 | + $newpassword = $specifiedpassword; |
|
| 92 | + } |
|
| 93 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 94 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 95 | + } elseif ($passwordgenmethod == 'g') { |
|
| 96 | + $newpassword = generate_password(8); |
|
| 90 | 97 | } else { |
| 91 | - $newpassword = $specifiedpassword; |
|
| 98 | + webAlertAndQuit("No password generation method specified!"); |
|
| 92 | 99 | } |
| 93 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 94 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 95 | - } elseif ($passwordgenmethod == 'g') { |
|
| 96 | - $newpassword = generate_password(8); |
|
| 97 | - } else { |
|
| 98 | - webAlertAndQuit("No password generation method specified!"); |
|
| 99 | - } |
|
| 100 | 100 | |
| 101 | - // invoke OnBeforeUserFormSave event |
|
| 102 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
| 103 | - "mode" => "new", |
|
| 104 | - )); |
|
| 105 | - |
|
| 106 | - // create the user account |
|
| 107 | - $internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users); |
|
| 108 | - |
|
| 109 | - $field = array(); |
|
| 110 | - $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
| 111 | - $modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
| 112 | - |
|
| 113 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 114 | - $field = $modx->db->escape($field); |
|
| 115 | - $modx->db->insert($field, $tbl_user_attributes); |
|
| 116 | - |
|
| 117 | - // Save user settings |
|
| 118 | - saveUserSettings($internalKey); |
|
| 119 | - |
|
| 120 | - // invoke OnManagerSaveUser event |
|
| 121 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
| 122 | - "mode" => "new", |
|
| 123 | - "userid" => $internalKey, |
|
| 124 | - "username" => $newusername, |
|
| 125 | - "userpassword" => $newpassword, |
|
| 126 | - "useremail" => $email, |
|
| 127 | - "userfullname" => $fullname, |
|
| 128 | - "userroleid" => $role |
|
| 129 | - )); |
|
| 130 | - |
|
| 131 | - // invoke OnUserFormSave event |
|
| 132 | - $modx->invokeEvent("OnUserFormSave", array( |
|
| 133 | - "mode" => "new", |
|
| 134 | - "id" => $internalKey |
|
| 135 | - )); |
|
| 136 | - |
|
| 137 | - // Set the item name for logger |
|
| 138 | - $_SESSION['itemname'] = $newusername; |
|
| 139 | - |
|
| 140 | - /*******************************************************************************/ |
|
| 141 | - // put the user in the user_groups he/ she should be in |
|
| 142 | - // first, check that up_perms are switched on! |
|
| 143 | - if ($use_udperms == 1) { |
|
| 144 | - if (!empty($user_groups)) { |
|
| 145 | - for ($i = 0; $i < count($user_groups); $i++) { |
|
| 146 | - $f = array(); |
|
| 147 | - $f['user_group'] = (int)$user_groups[$i]; |
|
| 148 | - $f['member'] = $internalKey; |
|
| 149 | - $modx->db->insert($f, $tbl_member_groups); |
|
| 101 | + // invoke OnBeforeUserFormSave event |
|
| 102 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
| 103 | + "mode" => "new", |
|
| 104 | + )); |
|
| 105 | + |
|
| 106 | + // create the user account |
|
| 107 | + $internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users); |
|
| 108 | + |
|
| 109 | + $field = array(); |
|
| 110 | + $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
| 111 | + $modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
| 112 | + |
|
| 113 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 114 | + $field = $modx->db->escape($field); |
|
| 115 | + $modx->db->insert($field, $tbl_user_attributes); |
|
| 116 | + |
|
| 117 | + // Save user settings |
|
| 118 | + saveUserSettings($internalKey); |
|
| 119 | + |
|
| 120 | + // invoke OnManagerSaveUser event |
|
| 121 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
| 122 | + "mode" => "new", |
|
| 123 | + "userid" => $internalKey, |
|
| 124 | + "username" => $newusername, |
|
| 125 | + "userpassword" => $newpassword, |
|
| 126 | + "useremail" => $email, |
|
| 127 | + "userfullname" => $fullname, |
|
| 128 | + "userroleid" => $role |
|
| 129 | + )); |
|
| 130 | + |
|
| 131 | + // invoke OnUserFormSave event |
|
| 132 | + $modx->invokeEvent("OnUserFormSave", array( |
|
| 133 | + "mode" => "new", |
|
| 134 | + "id" => $internalKey |
|
| 135 | + )); |
|
| 136 | + |
|
| 137 | + // Set the item name for logger |
|
| 138 | + $_SESSION['itemname'] = $newusername; |
|
| 139 | + |
|
| 140 | + /*******************************************************************************/ |
|
| 141 | + // put the user in the user_groups he/ she should be in |
|
| 142 | + // first, check that up_perms are switched on! |
|
| 143 | + if ($use_udperms == 1) { |
|
| 144 | + if (!empty($user_groups)) { |
|
| 145 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
| 146 | + $f = array(); |
|
| 147 | + $f['user_group'] = (int)$user_groups[$i]; |
|
| 148 | + $f['member'] = $internalKey; |
|
| 149 | + $modx->db->insert($f, $tbl_member_groups); |
|
| 150 | + } |
|
| 150 | 151 | } |
| 151 | 152 | } |
| 152 | - } |
|
| 153 | - // end of user_groups stuff! |
|
| 154 | - |
|
| 155 | - if ($passwordnotifymethod == 'e') { |
|
| 156 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 157 | - if ($input['stay'] != '') { |
|
| 158 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
| 159 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 160 | - header($header); |
|
| 161 | - } else { |
|
| 162 | - $header = "Location: index.php?a=75&r=2"; |
|
| 163 | - header($header); |
|
| 164 | - } |
|
| 165 | - } else { |
|
| 166 | - if ($input['stay'] != '') { |
|
| 167 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
| 168 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 153 | + // end of user_groups stuff! |
|
| 154 | + |
|
| 155 | + if ($passwordnotifymethod == 'e') { |
|
| 156 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 157 | + if ($input['stay'] != '') { |
|
| 158 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
| 159 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 160 | + header($header); |
|
| 161 | + } else { |
|
| 162 | + $header = "Location: index.php?a=75&r=2"; |
|
| 163 | + header($header); |
|
| 164 | + } |
|
| 169 | 165 | } else { |
| 170 | - $stayUrl = "index.php?a=75&r=2"; |
|
| 171 | - } |
|
| 166 | + if ($input['stay'] != '') { |
|
| 167 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
| 168 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 169 | + } else { |
|
| 170 | + $stayUrl = "index.php?a=75&r=2"; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - include_once "header.inc.php"; ?> |
|
| 173 | + include_once "header.inc.php"; ?> |
|
| 174 | 174 | |
| 175 | 175 | <h1><?php echo $_lang['user_title']; ?></h1> |
| 176 | 176 | |
@@ -192,124 +192,124 @@ discard block |
||
| 192 | 192 | </div> |
| 193 | 193 | <?php |
| 194 | 194 | |
| 195 | - include_once "footer.inc.php"; |
|
| 196 | - } |
|
| 197 | - break; |
|
| 198 | - case '12': // edit user |
|
| 199 | - // generate a new password for this user |
|
| 200 | - if ($genpassword == 1) { |
|
| 201 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 202 | - if (strlen($specifiedpassword) < 6) { |
|
| 203 | - webAlertAndQuit("Password is too short!"); |
|
| 195 | + include_once "footer.inc.php"; |
|
| 196 | + } |
|
| 197 | + break; |
|
| 198 | + case '12': // edit user |
|
| 199 | + // generate a new password for this user |
|
| 200 | + if ($genpassword == 1) { |
|
| 201 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 202 | + if (strlen($specifiedpassword) < 6) { |
|
| 203 | + webAlertAndQuit("Password is too short!"); |
|
| 204 | + } else { |
|
| 205 | + $newpassword = $specifiedpassword; |
|
| 206 | + } |
|
| 207 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 208 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 209 | + } elseif ($passwordgenmethod == 'g') { |
|
| 210 | + $newpassword = generate_password(8); |
|
| 204 | 211 | } else { |
| 205 | - $newpassword = $specifiedpassword; |
|
| 212 | + webAlertAndQuit("No password generation method specified!"); |
|
| 206 | 213 | } |
| 207 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 208 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
| 209 | - } elseif ($passwordgenmethod == 'g') { |
|
| 210 | - $newpassword = generate_password(8); |
|
| 211 | - } else { |
|
| 212 | - webAlertAndQuit("No password generation method specified!"); |
|
| 213 | 214 | } |
| 214 | - } |
|
| 215 | - if ($passwordnotifymethod == 'e') { |
|
| 216 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 217 | - } |
|
| 215 | + if ($passwordnotifymethod == 'e') { |
|
| 216 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | - // check if the username already exist |
|
| 220 | - $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id)); |
|
| 221 | - $limit = $modx->db->getValue($rs); |
|
| 222 | - if ($limit > 0) { |
|
| 223 | - webAlertAndQuit("User name is already in use!"); |
|
| 224 | - } |
|
| 219 | + // check if the username already exist |
|
| 220 | + $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id)); |
|
| 221 | + $limit = $modx->db->getValue($rs); |
|
| 222 | + if ($limit > 0) { |
|
| 223 | + webAlertAndQuit("User name is already in use!"); |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - // check if the email address already exists |
|
| 227 | - $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id)); |
|
| 228 | - $limit = $modx->db->getValue($rs); |
|
| 229 | - if ($limit > 0) { |
|
| 230 | - webAlertAndQuit("Email is already in use!"); |
|
| 231 | - } |
|
| 226 | + // check if the email address already exists |
|
| 227 | + $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id)); |
|
| 228 | + $limit = $modx->db->getValue($rs); |
|
| 229 | + if ($limit > 0) { |
|
| 230 | + webAlertAndQuit("Email is already in use!"); |
|
| 231 | + } |
|
| 232 | 232 | |
| 233 | - // invoke OnBeforeUserFormSave event |
|
| 234 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
| 235 | - "mode" => "upd", |
|
| 236 | - "id" => $id |
|
| 237 | - )); |
|
| 233 | + // invoke OnBeforeUserFormSave event |
|
| 234 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
| 235 | + "mode" => "upd", |
|
| 236 | + "id" => $id |
|
| 237 | + )); |
|
| 238 | 238 | |
| 239 | - // update user name and password |
|
| 240 | - $field = array(); |
|
| 241 | - $field['username'] = $modx->db->escape($newusername); |
|
| 242 | - if ($genpassword == 1) { |
|
| 243 | - $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
| 244 | - } |
|
| 245 | - $modx->db->update($field, $tbl_manager_users, "id='{$id}'"); |
|
| 246 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 247 | - $field = $modx->db->escape($field); |
|
| 248 | - $modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
| 249 | - |
|
| 250 | - // Save user settings |
|
| 251 | - saveUserSettings($id); |
|
| 252 | - |
|
| 253 | - // Set the item name for logger |
|
| 254 | - $_SESSION['itemname'] = $newusername; |
|
| 255 | - |
|
| 256 | - // invoke OnManagerSaveUser event |
|
| 257 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
| 258 | - "mode" => "upd", |
|
| 259 | - "userid" => $id, |
|
| 260 | - "username" => $newusername, |
|
| 261 | - "userpassword" => $newpassword, |
|
| 262 | - "useremail" => $email, |
|
| 263 | - "userfullname" => $fullname, |
|
| 264 | - "userroleid" => $role, |
|
| 265 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
| 266 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
| 267 | - )); |
|
| 268 | - |
|
| 269 | - // invoke OnManagerChangePassword event |
|
| 270 | - if ($genpassword == 1) { |
|
| 271 | - $modx->invokeEvent("OnManagerChangePassword", array( |
|
| 239 | + // update user name and password |
|
| 240 | + $field = array(); |
|
| 241 | + $field['username'] = $modx->db->escape($newusername); |
|
| 242 | + if ($genpassword == 1) { |
|
| 243 | + $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
| 244 | + } |
|
| 245 | + $modx->db->update($field, $tbl_manager_users, "id='{$id}'"); |
|
| 246 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 247 | + $field = $modx->db->escape($field); |
|
| 248 | + $modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
| 249 | + |
|
| 250 | + // Save user settings |
|
| 251 | + saveUserSettings($id); |
|
| 252 | + |
|
| 253 | + // Set the item name for logger |
|
| 254 | + $_SESSION['itemname'] = $newusername; |
|
| 255 | + |
|
| 256 | + // invoke OnManagerSaveUser event |
|
| 257 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
| 258 | + "mode" => "upd", |
|
| 272 | 259 | "userid" => $id, |
| 273 | 260 | "username" => $newusername, |
| 274 | - "userpassword" => $newpassword |
|
| 261 | + "userpassword" => $newpassword, |
|
| 262 | + "useremail" => $email, |
|
| 263 | + "userfullname" => $fullname, |
|
| 264 | + "userroleid" => $role, |
|
| 265 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
| 266 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
| 267 | + )); |
|
| 268 | + |
|
| 269 | + // invoke OnManagerChangePassword event |
|
| 270 | + if ($genpassword == 1) { |
|
| 271 | + $modx->invokeEvent("OnManagerChangePassword", array( |
|
| 272 | + "userid" => $id, |
|
| 273 | + "username" => $newusername, |
|
| 274 | + "userpassword" => $newpassword |
|
| 275 | + )); |
|
| 276 | + } |
|
| 277 | + |
|
| 278 | + // invoke OnUserFormSave event |
|
| 279 | + $modx->invokeEvent("OnUserFormSave", array( |
|
| 280 | + "mode" => "upd", |
|
| 281 | + "id" => $id |
|
| 275 | 282 | )); |
| 276 | - } |
|
| 277 | 283 | |
| 278 | - // invoke OnUserFormSave event |
|
| 279 | - $modx->invokeEvent("OnUserFormSave", array( |
|
| 280 | - "mode" => "upd", |
|
| 281 | - "id" => $id |
|
| 282 | - )); |
|
| 283 | - |
|
| 284 | - /*******************************************************************************/ |
|
| 285 | - // put the user in the user_groups he/ she should be in |
|
| 286 | - // first, check that up_perms are switched on! |
|
| 287 | - if ($use_udperms == 1) { |
|
| 288 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
| 289 | - $modx->db->delete($tbl_member_groups, "member='{$id}'"); |
|
| 290 | - if (!empty($user_groups)) { |
|
| 291 | - for ($i = 0; $i < count($user_groups); $i++) { |
|
| 292 | - $field = array(); |
|
| 293 | - $field['user_group'] = (int)$user_groups[$i]; |
|
| 294 | - $field['member'] = $id; |
|
| 295 | - $modx->db->insert($field, $tbl_member_groups); |
|
| 284 | + /*******************************************************************************/ |
|
| 285 | + // put the user in the user_groups he/ she should be in |
|
| 286 | + // first, check that up_perms are switched on! |
|
| 287 | + if ($use_udperms == 1) { |
|
| 288 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
| 289 | + $modx->db->delete($tbl_member_groups, "member='{$id}'"); |
|
| 290 | + if (!empty($user_groups)) { |
|
| 291 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
| 292 | + $field = array(); |
|
| 293 | + $field['user_group'] = (int)$user_groups[$i]; |
|
| 294 | + $field['member'] = $id; |
|
| 295 | + $modx->db->insert($field, $tbl_member_groups); |
|
| 296 | + } |
|
| 296 | 297 | } |
| 297 | 298 | } |
| 298 | - } |
|
| 299 | - // end of user_groups stuff! |
|
| 300 | - /*******************************************************************************/ |
|
| 301 | - if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
| 302 | - $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
| 303 | - } |
|
| 304 | - if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 305 | - if ($input['stay'] != '') { |
|
| 306 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
| 307 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 308 | - } else { |
|
| 309 | - $stayUrl = "index.php?a=75&r=2"; |
|
| 299 | + // end of user_groups stuff! |
|
| 300 | + /*******************************************************************************/ |
|
| 301 | + if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
| 302 | + $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
| 310 | 303 | } |
| 304 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
| 305 | + if ($input['stay'] != '') { |
|
| 306 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
| 307 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 308 | + } else { |
|
| 309 | + $stayUrl = "index.php?a=75&r=2"; |
|
| 310 | + } |
|
| 311 | 311 | |
| 312 | - include_once "header.inc.php"; ?> |
|
| 312 | + include_once "header.inc.php"; ?> |
|
| 313 | 313 | |
| 314 | 314 | <h1><?php echo $_lang['user_title']; ?></h1> |
| 315 | 315 | |
@@ -329,20 +329,20 @@ discard block |
||
| 329 | 329 | </div> |
| 330 | 330 | <?php |
| 331 | 331 | |
| 332 | - include_once "footer.inc.php"; |
|
| 333 | - } else { |
|
| 334 | - if ($input['stay'] != '') { |
|
| 335 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
| 336 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 337 | - header($header); |
|
| 332 | + include_once "footer.inc.php"; |
|
| 338 | 333 | } else { |
| 339 | - $header = "Location: index.php?a=75&r=2"; |
|
| 340 | - header($header); |
|
| 334 | + if ($input['stay'] != '') { |
|
| 335 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
| 336 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 337 | + header($header); |
|
| 338 | + } else { |
|
| 339 | + $header = "Location: index.php?a=75&r=2"; |
|
| 340 | + header($header); |
|
| 341 | + } |
|
| 341 | 342 | } |
| 342 | - } |
|
| 343 | - break; |
|
| 344 | - default: |
|
| 345 | - webAlertAndQuit("No operation set in request."); |
|
| 343 | + break; |
|
| 344 | + default: |
|
| 345 | + webAlertAndQuit("No operation set in request."); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /** |
@@ -166,82 +166,82 @@ |
||
| 166 | 166 | |
| 167 | 167 | for ($i=0;$i<count($warnings);$i++) { |
| 168 | 168 | switch ($warnings[$i][0]) { |
| 169 | - case $_lang['configcheck_configinc']: |
|
| 170 | - $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
|
| 171 | - if (!$_SESSION["mgrConfigCheck"]) { |
|
| 172 | - $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_configinc']); |
|
| 173 | - } |
|
| 174 | - break; |
|
| 175 | - case $_lang['configcheck_installer']: |
|
| 176 | - $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
|
| 177 | - if (!$_SESSION["mgrConfigCheck"]) { |
|
| 178 | - $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_installer']); |
|
| 179 | - } |
|
| 180 | - break; |
|
| 181 | - case $_lang['configcheck_cache']: |
|
| 182 | - $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
|
| 183 | - if (!$_SESSION["mgrConfigCheck"]) { |
|
| 184 | - $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_cache']); |
|
| 185 | - } |
|
| 186 | - break; |
|
| 187 | - case $_lang['configcheck_images']: |
|
| 188 | - $warnings[$i][1] = $_lang['configcheck_images_msg']; |
|
| 189 | - if (!$_SESSION["mgrConfigCheck"]) { |
|
| 190 | - $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_images']); |
|
| 191 | - } |
|
| 192 | - break; |
|
| 193 | - case $_lang['configcheck_sysfiles_mod']: |
|
| 194 | - $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
|
| 195 | - $warnings[$i][2] = '<ul><li>' . implode('</li><li>', $sysfiles_check) . '</li></ul>'; |
|
| 196 | - if ($modx->hasPermission('settings')) { |
|
| 197 | - $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
| 198 | - } |
|
| 199 | - if (!$_SESSION["mgrConfigCheck"]) { |
|
| 200 | - $modx->logEvent(0, 3, $warnings[$i][1] . " " . implode(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']); |
|
| 201 | - } |
|
| 202 | - break; |
|
| 203 | - case $_lang['configcheck_lang_difference']: |
|
| 204 | - $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
|
| 205 | - break; |
|
| 206 | - case $_lang['configcheck_php_gdzip']: |
|
| 207 | - $warnings[$i][1] = $_lang['configcheck_php_gdzip_msg']; |
|
| 208 | - break; |
|
| 209 | - case $_lang['configcheck_unauthorizedpage_unpublished']: |
|
| 210 | - $warnings[$i][1] = $_lang['configcheck_unauthorizedpage_unpublished_msg']; |
|
| 211 | - break; |
|
| 212 | - case $_lang['configcheck_errorpage_unpublished']: |
|
| 213 | - $warnings[$i][1] = $_lang['configcheck_errorpage_unpublished_msg']; |
|
| 214 | - break; |
|
| 215 | - case $_lang['configcheck_unauthorizedpage_unavailable']: |
|
| 216 | - $warnings[$i][1] = $_lang['configcheck_unauthorizedpage_unavailable_msg']; |
|
| 217 | - break; |
|
| 218 | - case $_lang['configcheck_errorpage_unavailable']: |
|
| 219 | - $warnings[$i][1] = $_lang['configcheck_errorpage_unavailable_msg']; |
|
| 220 | - break; |
|
| 221 | - case $_lang['configcheck_validate_referer']: |
|
| 222 | - $msg = $_lang['configcheck_validate_referer_msg']; |
|
| 223 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
| 224 | - $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n"; |
|
| 225 | - break; |
|
| 226 | - case $_lang['configcheck_templateswitcher_present']: |
|
| 227 | - $msg = $_lang["configcheck_templateswitcher_present_msg"]; |
|
| 228 | - if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
| 229 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"]; |
|
| 230 | - } |
|
| 231 | - if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
| 232 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"]; |
|
| 233 | - } |
|
| 234 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
| 235 | - $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n"; |
|
| 236 | - break; |
|
| 237 | - case $_lang['configcheck_rb_base_dir']: |
|
| 238 | - $warnings[$i][1] = $_lang['configcheck_rb_base_dir_msg']; |
|
| 239 | - break; |
|
| 240 | - case $_lang['configcheck_filemanager_path']: |
|
| 241 | - $warnings[$i][1] = $_lang['configcheck_filemanager_path_msg']; |
|
| 242 | - break; |
|
| 243 | - default: |
|
| 244 | - $warnings[$i][1] = $_lang['configcheck_default_msg']; |
|
| 169 | + case $_lang['configcheck_configinc']: |
|
| 170 | + $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
|
| 171 | + if (!$_SESSION["mgrConfigCheck"]) { |
|
| 172 | + $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_configinc']); |
|
| 173 | + } |
|
| 174 | + break; |
|
| 175 | + case $_lang['configcheck_installer']: |
|
| 176 | + $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
|
| 177 | + if (!$_SESSION["mgrConfigCheck"]) { |
|
| 178 | + $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_installer']); |
|
| 179 | + } |
|
| 180 | + break; |
|
| 181 | + case $_lang['configcheck_cache']: |
|
| 182 | + $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
|
| 183 | + if (!$_SESSION["mgrConfigCheck"]) { |
|
| 184 | + $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_cache']); |
|
| 185 | + } |
|
| 186 | + break; |
|
| 187 | + case $_lang['configcheck_images']: |
|
| 188 | + $warnings[$i][1] = $_lang['configcheck_images_msg']; |
|
| 189 | + if (!$_SESSION["mgrConfigCheck"]) { |
|
| 190 | + $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_images']); |
|
| 191 | + } |
|
| 192 | + break; |
|
| 193 | + case $_lang['configcheck_sysfiles_mod']: |
|
| 194 | + $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
|
| 195 | + $warnings[$i][2] = '<ul><li>' . implode('</li><li>', $sysfiles_check) . '</li></ul>'; |
|
| 196 | + if ($modx->hasPermission('settings')) { |
|
| 197 | + $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
| 198 | + } |
|
| 199 | + if (!$_SESSION["mgrConfigCheck"]) { |
|
| 200 | + $modx->logEvent(0, 3, $warnings[$i][1] . " " . implode(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']); |
|
| 201 | + } |
|
| 202 | + break; |
|
| 203 | + case $_lang['configcheck_lang_difference']: |
|
| 204 | + $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
|
| 205 | + break; |
|
| 206 | + case $_lang['configcheck_php_gdzip']: |
|
| 207 | + $warnings[$i][1] = $_lang['configcheck_php_gdzip_msg']; |
|
| 208 | + break; |
|
| 209 | + case $_lang['configcheck_unauthorizedpage_unpublished']: |
|
| 210 | + $warnings[$i][1] = $_lang['configcheck_unauthorizedpage_unpublished_msg']; |
|
| 211 | + break; |
|
| 212 | + case $_lang['configcheck_errorpage_unpublished']: |
|
| 213 | + $warnings[$i][1] = $_lang['configcheck_errorpage_unpublished_msg']; |
|
| 214 | + break; |
|
| 215 | + case $_lang['configcheck_unauthorizedpage_unavailable']: |
|
| 216 | + $warnings[$i][1] = $_lang['configcheck_unauthorizedpage_unavailable_msg']; |
|
| 217 | + break; |
|
| 218 | + case $_lang['configcheck_errorpage_unavailable']: |
|
| 219 | + $warnings[$i][1] = $_lang['configcheck_errorpage_unavailable_msg']; |
|
| 220 | + break; |
|
| 221 | + case $_lang['configcheck_validate_referer']: |
|
| 222 | + $msg = $_lang['configcheck_validate_referer_msg']; |
|
| 223 | + $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
| 224 | + $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n"; |
|
| 225 | + break; |
|
| 226 | + case $_lang['configcheck_templateswitcher_present']: |
|
| 227 | + $msg = $_lang["configcheck_templateswitcher_present_msg"]; |
|
| 228 | + if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
| 229 | + $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"]; |
|
| 230 | + } |
|
| 231 | + if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
| 232 | + $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"]; |
|
| 233 | + } |
|
| 234 | + $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
| 235 | + $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n"; |
|
| 236 | + break; |
|
| 237 | + case $_lang['configcheck_rb_base_dir']: |
|
| 238 | + $warnings[$i][1] = $_lang['configcheck_rb_base_dir_msg']; |
|
| 239 | + break; |
|
| 240 | + case $_lang['configcheck_filemanager_path']: |
|
| 241 | + $warnings[$i][1] = $_lang['configcheck_filemanager_path_msg']; |
|
| 242 | + break; |
|
| 243 | + default: |
|
| 244 | + $warnings[$i][1] = $_lang['configcheck_default_msg']; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ; |