@@ -4,18 +4,18 @@ |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch ($modx->getManagerApi()->action) { |
| 7 | - case 102: |
|
| 8 | - if (!$modx->hasPermission('edit_plugin')) { |
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 101: |
|
| 13 | - if (!$modx->hasPermission('new_plugin')) { |
|
| 7 | + case 102: |
|
| 8 | + if (!$modx->hasPermission('edit_plugin')) { |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 101: |
|
| 13 | + if (!$modx->hasPermission('new_plugin')) { |
|
| 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->getManagerApi()->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')) {
|
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 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: |
|
| 18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch($modx->getManagerApi()->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')) { |
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 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: |
|
| 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->getManagerApi()->action) { |
| 7 | - case 22: |
|
| 8 | - if (!$modx->hasPermission('edit_snippet')) { |
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 23: |
|
| 13 | - if (!$modx->hasPermission('new_snippet')) { |
|
| 7 | + case 22: |
|
| 8 | + if (!$modx->hasPermission('edit_snippet')) { |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 23: |
|
| 13 | + if (!$modx->hasPermission('new_snippet')) { |
|
| 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; |
@@ -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->getManagerApi()->action) {
|
| 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: |
|
| 17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 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: |
|
| 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($modx->getManagerApi()->action) { |
| 7 | - case 12: |
|
| 8 | - if(!$modx->hasPermission('edit_user')) { |
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 11: |
|
| 13 | - if(!$modx->hasPermission('new_user')) { |
|
| 14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | - } |
|
| 16 | - break; |
|
| 17 | - default: |
|
| 18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + case 12: |
|
| 8 | + if(!$modx->hasPermission('edit_user')) { |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 11: |
|
| 13 | + if(!$modx->hasPermission('new_user')) { |
|
| 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 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch ((int)$modx->getManagerApi()->action) { |
| 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')) { |
|
| 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: |
|
| 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 | $role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | switch ($modx->getManagerApi()->action) { |
| 7 | - case 78: |
|
| 8 | - if (!$modx->hasPermission('edit_chunk')) { |
|
| 9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | - } |
|
| 11 | - break; |
|
| 12 | - case 77: |
|
| 13 | - if (!$modx->hasPermission('new_chunk')) { |
|
| 7 | + case 78: |
|
| 8 | + if (!$modx->hasPermission('edit_chunk')) { |
|
| 9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 10 | + } |
|
| 11 | + break; |
|
| 12 | + case 77: |
|
| 13 | + if (!$modx->hasPermission('new_chunk')) { |
|
| 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; |
@@ -67,110 +67,110 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | switch($input['mode']) { |
| 70 | - case '11' : // new user |
|
| 71 | - // check if this user name already exist |
|
| 72 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->getDatabase()->escape($newusername))); |
|
| 73 | - $limit = $modx->getDatabase()->getValue($rs); |
|
| 74 | - if($limit > 0) { |
|
| 75 | - webAlertAndQuit("User name is already in use!", 12); |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - // check if the email address already exist |
|
| 79 | - $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->getDatabase()->escape($email), $id)); |
|
| 80 | - $limit = $modx->getDatabase()->getValue($rs); |
|
| 81 | - if($limit > 0) { |
|
| 82 | - webAlertAndQuit("Email is already in use!", 12); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - // generate a new password for this user |
|
| 86 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 87 | - if(strlen($specifiedpassword) < 6) { |
|
| 88 | - webAlertAndQuit("Password is too short!", 12); |
|
| 89 | - } else { |
|
| 90 | - $newpassword = $specifiedpassword; |
|
| 91 | - } |
|
| 92 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 93 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
| 94 | - } elseif($passwordgenmethod == 'g') { |
|
| 95 | - $newpassword = generate_password(8); |
|
| 96 | - } else { |
|
| 97 | - webAlertAndQuit("No password generation method specified!", 12); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - // invoke OnBeforeUserFormSave event |
|
| 101 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
| 102 | - "mode" => "new", |
|
| 103 | - )); |
|
| 104 | - |
|
| 105 | - // create the user account |
|
| 106 | - $internalKey = $modx->getDatabase()->insert(array('username' => $modx->getDatabase()->escape($newusername)), $tbl_manager_users); |
|
| 107 | - |
|
| 108 | - $field = array(); |
|
| 109 | - $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
| 110 | - $modx->getDatabase()->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
| 111 | - |
|
| 112 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 113 | - $field = $modx->getDatabase()->escape($field); |
|
| 114 | - $modx->getDatabase()->insert($field, $tbl_user_attributes); |
|
| 115 | - |
|
| 116 | - // Save user settings |
|
| 117 | - saveManagerUserSettings($internalKey); |
|
| 118 | - |
|
| 119 | - // invoke OnManagerSaveUser event |
|
| 120 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
| 121 | - "mode" => "new", |
|
| 122 | - "userid" => $internalKey, |
|
| 123 | - "username" => $newusername, |
|
| 124 | - "userpassword" => $newpassword, |
|
| 125 | - "useremail" => $email, |
|
| 126 | - "userfullname" => $fullname, |
|
| 127 | - "userroleid" => $role |
|
| 128 | - )); |
|
| 129 | - |
|
| 130 | - // invoke OnUserFormSave event |
|
| 131 | - $modx->invokeEvent("OnUserFormSave", array( |
|
| 132 | - "mode" => "new", |
|
| 133 | - "id" => $internalKey |
|
| 134 | - )); |
|
| 135 | - |
|
| 136 | - // Set the item name for logger |
|
| 137 | - $_SESSION['itemname'] = $newusername; |
|
| 138 | - |
|
| 139 | - /*******************************************************************************/ |
|
| 140 | - // put the user in the user_groups he/ she should be in |
|
| 141 | - // first, check that up_perms are switched on! |
|
| 142 | - if($use_udperms == 1) { |
|
| 143 | - if(!empty($user_groups)) { |
|
| 144 | - for($i = 0; $i < count($user_groups); $i++) { |
|
| 145 | - $f = array(); |
|
| 146 | - $f['user_group'] = (int)$user_groups[$i]; |
|
| 147 | - $f['member'] = $internalKey; |
|
| 148 | - $modx->getDatabase()->insert($f, $tbl_member_groups); |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - // end of user_groups stuff! |
|
| 153 | - |
|
| 154 | - if($passwordnotifymethod == 'e') { |
|
| 155 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
| 156 | - if($input['stay'] != '') { |
|
| 157 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
| 158 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 159 | - header($header); |
|
| 160 | - } else { |
|
| 161 | - $header = "Location: index.php?a=75&r=2"; |
|
| 162 | - header($header); |
|
| 163 | - } |
|
| 164 | - } else { |
|
| 165 | - if($input['stay'] != '') { |
|
| 166 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
| 167 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 168 | - } else { |
|
| 169 | - $stayUrl = "index.php?a=75&r=2"; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - include_once "header.inc.php"; |
|
| 173 | - ?> |
|
| 70 | + case '11' : // new user |
|
| 71 | + // check if this user name already exist |
|
| 72 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->getDatabase()->escape($newusername))); |
|
| 73 | + $limit = $modx->getDatabase()->getValue($rs); |
|
| 74 | + if($limit > 0) { |
|
| 75 | + webAlertAndQuit("User name is already in use!", 12); |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + // check if the email address already exist |
|
| 79 | + $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->getDatabase()->escape($email), $id)); |
|
| 80 | + $limit = $modx->getDatabase()->getValue($rs); |
|
| 81 | + if($limit > 0) { |
|
| 82 | + webAlertAndQuit("Email is already in use!", 12); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + // generate a new password for this user |
|
| 86 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
| 87 | + if(strlen($specifiedpassword) < 6) { |
|
| 88 | + webAlertAndQuit("Password is too short!", 12); |
|
| 89 | + } else { |
|
| 90 | + $newpassword = $specifiedpassword; |
|
| 91 | + } |
|
| 92 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 93 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
| 94 | + } elseif($passwordgenmethod == 'g') { |
|
| 95 | + $newpassword = generate_password(8); |
|
| 96 | + } else { |
|
| 97 | + webAlertAndQuit("No password generation method specified!", 12); |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + // invoke OnBeforeUserFormSave event |
|
| 101 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
| 102 | + "mode" => "new", |
|
| 103 | + )); |
|
| 104 | + |
|
| 105 | + // create the user account |
|
| 106 | + $internalKey = $modx->getDatabase()->insert(array('username' => $modx->getDatabase()->escape($newusername)), $tbl_manager_users); |
|
| 107 | + |
|
| 108 | + $field = array(); |
|
| 109 | + $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
| 110 | + $modx->getDatabase()->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
| 111 | + |
|
| 112 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
| 113 | + $field = $modx->getDatabase()->escape($field); |
|
| 114 | + $modx->getDatabase()->insert($field, $tbl_user_attributes); |
|
| 115 | + |
|
| 116 | + // Save user settings |
|
| 117 | + saveManagerUserSettings($internalKey); |
|
| 118 | + |
|
| 119 | + // invoke OnManagerSaveUser event |
|
| 120 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
| 121 | + "mode" => "new", |
|
| 122 | + "userid" => $internalKey, |
|
| 123 | + "username" => $newusername, |
|
| 124 | + "userpassword" => $newpassword, |
|
| 125 | + "useremail" => $email, |
|
| 126 | + "userfullname" => $fullname, |
|
| 127 | + "userroleid" => $role |
|
| 128 | + )); |
|
| 129 | + |
|
| 130 | + // invoke OnUserFormSave event |
|
| 131 | + $modx->invokeEvent("OnUserFormSave", array( |
|
| 132 | + "mode" => "new", |
|
| 133 | + "id" => $internalKey |
|
| 134 | + )); |
|
| 135 | + |
|
| 136 | + // Set the item name for logger |
|
| 137 | + $_SESSION['itemname'] = $newusername; |
|
| 138 | + |
|
| 139 | + /*******************************************************************************/ |
|
| 140 | + // put the user in the user_groups he/ she should be in |
|
| 141 | + // first, check that up_perms are switched on! |
|
| 142 | + if($use_udperms == 1) { |
|
| 143 | + if(!empty($user_groups)) { |
|
| 144 | + for($i = 0; $i < count($user_groups); $i++) { |
|
| 145 | + $f = array(); |
|
| 146 | + $f['user_group'] = (int)$user_groups[$i]; |
|
| 147 | + $f['member'] = $internalKey; |
|
| 148 | + $modx->getDatabase()->insert($f, $tbl_member_groups); |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + // end of user_groups stuff! |
|
| 153 | + |
|
| 154 | + if($passwordnotifymethod == 'e') { |
|
| 155 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
| 156 | + if($input['stay'] != '') { |
|
| 157 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
| 158 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 159 | + header($header); |
|
| 160 | + } else { |
|
| 161 | + $header = "Location: index.php?a=75&r=2"; |
|
| 162 | + header($header); |
|
| 163 | + } |
|
| 164 | + } else { |
|
| 165 | + if($input['stay'] != '') { |
|
| 166 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
| 167 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 168 | + } else { |
|
| 169 | + $stayUrl = "index.php?a=75&r=2"; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + include_once "header.inc.php"; |
|
| 173 | + ?> |
|
| 174 | 174 | |
| 175 | 175 | <h1><?php echo $_lang['user_title']; ?></h1> |
| 176 | 176 | |
@@ -192,125 +192,125 @@ 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!", 12); |
|
| 204 | - } else { |
|
| 205 | - $newpassword = $specifiedpassword; |
|
| 206 | - } |
|
| 207 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 208 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
| 209 | - } elseif($passwordgenmethod == 'g') { |
|
| 210 | - $newpassword = generate_password(8); |
|
| 211 | - } else { |
|
| 212 | - webAlertAndQuit("No password generation method specified!", 12); |
|
| 213 | - } |
|
| 214 | - } |
|
| 215 | - if($passwordnotifymethod == 'e') { |
|
| 216 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - // check if the username already exist |
|
| 220 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->getDatabase()->escape($newusername), $id)); |
|
| 221 | - $limit = $modx->getDatabase()->getValue($rs); |
|
| 222 | - if($limit > 0) { |
|
| 223 | - webAlertAndQuit("User name is already in use!", 12); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - // check if the email address already exists |
|
| 227 | - $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->getDatabase()->escape($email), $id)); |
|
| 228 | - $limit = $modx->getDatabase()->getValue($rs); |
|
| 229 | - if($limit > 0) { |
|
| 230 | - webAlertAndQuit("Email is already in use!", 12); |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - // invoke OnBeforeUserFormSave event |
|
| 234 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
| 235 | - "mode" => "upd", |
|
| 236 | - "id" => $id |
|
| 237 | - )); |
|
| 238 | - |
|
| 239 | - // update user name and password |
|
| 240 | - $field = array(); |
|
| 241 | - $field['username'] = $modx->getDatabase()->escape($newusername); |
|
| 242 | - if($genpassword == 1) { |
|
| 243 | - $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
| 244 | - } |
|
| 245 | - $modx->getDatabase()->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->getDatabase()->escape($field); |
|
| 248 | - $modx->getDatabase()->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
| 249 | - |
|
| 250 | - // Save user settings |
|
| 251 | - saveManagerUserSettings($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( |
|
| 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 |
|
| 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->getDatabase()->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->getDatabase()->insert($field, $tbl_member_groups); |
|
| 296 | - } |
|
| 297 | - } |
|
| 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"; |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - include_once "header.inc.php"; |
|
| 313 | - ?> |
|
| 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!", 12); |
|
| 204 | + } else { |
|
| 205 | + $newpassword = $specifiedpassword; |
|
| 206 | + } |
|
| 207 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
| 208 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
| 209 | + } elseif($passwordgenmethod == 'g') { |
|
| 210 | + $newpassword = generate_password(8); |
|
| 211 | + } else { |
|
| 212 | + webAlertAndQuit("No password generation method specified!", 12); |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | + if($passwordnotifymethod == 'e') { |
|
| 216 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + // check if the username already exist |
|
| 220 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->getDatabase()->escape($newusername), $id)); |
|
| 221 | + $limit = $modx->getDatabase()->getValue($rs); |
|
| 222 | + if($limit > 0) { |
|
| 223 | + webAlertAndQuit("User name is already in use!", 12); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + // check if the email address already exists |
|
| 227 | + $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->getDatabase()->escape($email), $id)); |
|
| 228 | + $limit = $modx->getDatabase()->getValue($rs); |
|
| 229 | + if($limit > 0) { |
|
| 230 | + webAlertAndQuit("Email is already in use!", 12); |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + // invoke OnBeforeUserFormSave event |
|
| 234 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
| 235 | + "mode" => "upd", |
|
| 236 | + "id" => $id |
|
| 237 | + )); |
|
| 238 | + |
|
| 239 | + // update user name and password |
|
| 240 | + $field = array(); |
|
| 241 | + $field['username'] = $modx->getDatabase()->escape($newusername); |
|
| 242 | + if($genpassword == 1) { |
|
| 243 | + $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
| 244 | + } |
|
| 245 | + $modx->getDatabase()->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->getDatabase()->escape($field); |
|
| 248 | + $modx->getDatabase()->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
| 249 | + |
|
| 250 | + // Save user settings |
|
| 251 | + saveManagerUserSettings($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( |
|
| 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 |
|
| 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->getDatabase()->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->getDatabase()->insert($field, $tbl_member_groups); |
|
| 296 | + } |
|
| 297 | + } |
|
| 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"; |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + include_once "header.inc.php"; |
|
| 313 | + ?> |
|
| 314 | 314 | |
| 315 | 315 | <h1><?php echo $_lang['user_title']; ?></h1> |
| 316 | 316 | |
@@ -330,18 +330,18 @@ discard block |
||
| 330 | 330 | </div> |
| 331 | 331 | <?php |
| 332 | 332 | |
| 333 | - include_once "footer.inc.php"; |
|
| 334 | - } else { |
|
| 335 | - if($input['stay'] != '') { |
|
| 336 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
| 337 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 338 | - header($header); |
|
| 339 | - } else { |
|
| 340 | - $header = "Location: index.php?a=75&r=2"; |
|
| 341 | - header($header); |
|
| 342 | - } |
|
| 343 | - } |
|
| 344 | - break; |
|
| 345 | - default: |
|
| 346 | - webAlertAndQuit("No operation set in request.", 12); |
|
| 333 | + include_once "footer.inc.php"; |
|
| 334 | + } else { |
|
| 335 | + if($input['stay'] != '') { |
|
| 336 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
| 337 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
| 338 | + header($header); |
|
| 339 | + } else { |
|
| 340 | + $header = "Location: index.php?a=75&r=2"; |
|
| 341 | + header($header); |
|
| 342 | + } |
|
| 343 | + } |
|
| 344 | + break; |
|
| 345 | + default: |
|
| 346 | + webAlertAndQuit("No operation set in request.", 12); |
|
| 347 | 347 | } |