@@ -3,12 +3,12 @@ |
||
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 | if(!$modx->hasPermission('edit_template')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | -if(!$modx->hasPermission('edit_template')) { |
|
5 | +if (!$modx->hasPermission('edit_template')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
15 | -$tmplvar = EvolutionCMS\Models\SiteTmplvar::with(['tmplvarAccess','tmplvarTemplate'])->findOrFail($id); |
|
15 | +$tmplvar = EvolutionCMS\Models\SiteTmplvar::with(['tmplvarAccess', 'tmplvarTemplate'])->findOrFail($id); |
|
16 | 16 | $name = $tmplvar->name; |
17 | 17 | $count = EvolutionCMS\Models\SiteTmplvar::where('name', 'like', $name.' '.$_lang['duplicated_el_suffix'].'%')->count(); |
18 | -if($count>=1) $count = ' '.($count+1); |
|
18 | +if ($count >= 1) $count = ' '.($count + 1); |
|
19 | 19 | else $count = ''; |
20 | 20 | |
21 | 21 | |
@@ -38,5 +38,5 @@ discard block |
||
38 | 38 | $_SESSION['itemname'] = $newTmplvar->name; |
39 | 39 | |
40 | 40 | // finish duplicating - redirect to new variable |
41 | -$header="Location: index.php?r=2&a=301&id=".$newTmplvar->getKey(); |
|
41 | +$header = "Location: index.php?r=2&a=301&id=".$newTmplvar->getKey(); |
|
42 | 42 | header($header); |
@@ -15,8 +15,11 @@ |
||
15 | 15 | $tmplvar = EvolutionCMS\Models\SiteTmplvar::with(['tmplvarAccess','tmplvarTemplate'])->findOrFail($id); |
16 | 16 | $name = $tmplvar->name; |
17 | 17 | $count = EvolutionCMS\Models\SiteTmplvar::where('name', 'like', $name.' '.$_lang['duplicated_el_suffix'].'%')->count(); |
18 | -if($count>=1) $count = ' '.($count+1); |
|
19 | -else $count = ''; |
|
18 | +if($count>=1) { |
|
19 | + $count = ' '.($count+1); |
|
20 | +} else { |
|
21 | + $count = ''; |
|
22 | +} |
|
20 | 23 | |
21 | 24 | |
22 | 25 | $newTmplvar = $tmplvar->replicate(); |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | -if(!$modx->hasPermission('delete_web_user')) { |
|
5 | +if (!$modx->hasPermission('delete_web_user')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -39,5 +39,5 @@ discard block |
||
39 | 39 | "id" => $id |
40 | 40 | )); |
41 | 41 | |
42 | -$header="Location: index.php?a=99"; |
|
42 | +$header = "Location: index.php?a=99"; |
|
43 | 43 | header($header); |
@@ -3,12 +3,12 @@ |
||
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 | if(!$modx->hasPermission('new_chunk')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | -if(!$modx->hasPermission('new_chunk')) { |
|
5 | +if (!$modx->hasPermission('new_chunk')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $htmlsnippet = EvolutionCMS\Models\SiteHtmlsnippet::findOrFail($id); |
16 | 16 | $name = $htmlsnippet->name; |
17 | 17 | $count = EvolutionCMS\Models\SiteHtmlsnippet::where('name', 'like', $name.' '.$_lang['duplicated_el_suffix'].'%')->count(); |
18 | -if($count>=1) $count = ' '.($count+1); |
|
18 | +if ($count >= 1) $count = ' '.($count + 1); |
|
19 | 19 | else $count = ''; |
20 | 20 | |
21 | 21 | // duplicate htmlsnippet |
@@ -26,5 +26,5 @@ discard block |
||
26 | 26 | $_SESSION['itemname'] = $newHtmlsnippet->name; |
27 | 27 | |
28 | 28 | // finish duplicating - redirect to new chunk |
29 | -$header="Location: index.php?r=2&a=78&id=".$newHtmlsnippet->getKey(); |
|
29 | +$header = "Location: index.php?r=2&a=78&id=".$newHtmlsnippet->getKey(); |
|
30 | 30 | header($header); |
@@ -15,8 +15,11 @@ |
||
15 | 15 | $htmlsnippet = EvolutionCMS\Models\SiteHtmlsnippet::findOrFail($id); |
16 | 16 | $name = $htmlsnippet->name; |
17 | 17 | $count = EvolutionCMS\Models\SiteHtmlsnippet::where('name', 'like', $name.' '.$_lang['duplicated_el_suffix'].'%')->count(); |
18 | -if($count>=1) $count = ' '.($count+1); |
|
19 | -else $count = ''; |
|
18 | +if($count>=1) { |
|
19 | + $count = ' '.($count+1); |
|
20 | +} else { |
|
21 | + $count = ''; |
|
22 | +} |
|
20 | 23 | |
21 | 24 | // duplicate htmlsnippet |
22 | 25 | $newHtmlsnippet = $htmlsnippet->replicate(); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | if (!$modx->hasPermission('save_chunk')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = (int)$_POST['id']; |
|
9 | +$id = (int) $_POST['id']; |
|
10 | 10 | $snippet = $_POST['post']; |
11 | 11 | $name = trim($_POST['name']); |
12 | 12 | $description = $_POST['description']; |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | |
17 | 17 | //Kyle Jaebker - added category support |
18 | 18 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
19 | - $category = (int)$_POST['categoryid']; |
|
19 | + $category = (int) $_POST['categoryid']; |
|
20 | 20 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
21 | 21 | $category = 0; |
22 | 22 | } else { |
23 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
23 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
24 | 24 | $category = checkCategory($_POST['newcategory']); |
25 | 25 | if (!$category) { |
26 | 26 | $category = newCategory($_POST['newcategory']); |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | )); |
45 | 45 | |
46 | 46 | // disallow duplicate names for new chunks |
47 | - if (EvolutionCMS\Models\SiteHtmlsnippet::where('name','=',$name)->first()) { |
|
47 | + if (EvolutionCMS\Models\SiteHtmlsnippet::where('name', '=', $name)->first()) { |
|
48 | 48 | $modx->getManagerApi()->saveFormValues(77); |
49 | 49 | $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['chunk'], $name), "index.php?a=77"); |
50 | 50 | } |
51 | 51 | |
52 | 52 | //do stuff to save the new doc |
53 | - $id = EvolutionCMS\Models\SiteHtmlsnippet::create(compact('name', 'description','snippet','locked','category','editor_type','editor_name','disabled','createdon','editedon'))->getKey(); |
|
53 | + $id = EvolutionCMS\Models\SiteHtmlsnippet::create(compact('name', 'description', 'snippet', 'locked', 'category', 'editor_type', 'editor_name', 'disabled', 'createdon', 'editedon'))->getKey(); |
|
54 | 54 | |
55 | 55 | // invoke OnChunkFormSave event |
56 | 56 | $modx->invokeEvent("OnChunkFormSave", array( |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // finished emptying cache - redirect |
68 | 68 | if ($_POST['stay'] != '') { |
69 | 69 | $a = ($_POST['stay'] == '2') ? "78&id=$id" : "77"; |
70 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
70 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
71 | 71 | header($header); |
72 | 72 | } else { |
73 | 73 | $header = "Location: index.php?a=76&r=2"; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | )); |
83 | 83 | |
84 | 84 | // disallow duplicate names for chunks |
85 | - if (EvolutionCMS\Models\SiteHtmlsnippet::where('id','!=',$id)->where('name','=',$name)->first()) { |
|
85 | + if (EvolutionCMS\Models\SiteHtmlsnippet::where('id', '!=', $id)->where('name', '=', $name)->first()) { |
|
86 | 86 | $modx->getManagerApi()->saveFormValues(78); |
87 | 87 | $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['chunk'], $name), "index.php?a=78&id={$id}"); |
88 | 88 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | //do stuff to save the edited doc |
91 | 91 | $chunk = EvolutionCMS\Models\SiteHtmlsnippet::find($id); |
92 | 92 | |
93 | - $chunk->update(compact('name', 'description','snippet','locked','category','editor_type','editor_name','disabled','editedon')); |
|
93 | + $chunk->update(compact('name', 'description', 'snippet', 'locked', 'category', 'editor_type', 'editor_name', 'disabled', 'editedon')); |
|
94 | 94 | |
95 | 95 | // invoke OnChunkFormSave event |
96 | 96 | $modx->invokeEvent("OnChunkFormSave", array( |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | // finished emptying cache - redirect |
108 | 108 | if ($_POST['stay'] != '') { |
109 | 109 | $a = ($_POST['stay'] == '2') ? "78&id=$id" : "77"; |
110 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
110 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
111 | 111 | header($header); |
112 | 112 | } else { |
113 | 113 | $modx->unlockElement(3, $id); |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
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 | if (!$modx->hasPermission('save_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $input = $_POST; |
@@ -39,131 +39,131 @@ discard block |
||
39 | 39 | |
40 | 40 | // verify password |
41 | 41 | if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
42 | - webAlertAndQuit("Password typed is mismatched", 12); |
|
42 | + webAlertAndQuit("Password typed is mismatched", 12); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // verify email |
46 | 46 | if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
47 | - webAlertAndQuit("E-mail address doesn't seem to be valid!", 12); |
|
47 | + webAlertAndQuit("E-mail address doesn't seem to be valid!", 12); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // verify admin security |
51 | 51 | if ($_SESSION['mgrRole'] != 1) { |
52 | - // Check to see if user tried to spoof a "1" (admin) role |
|
52 | + // Check to see if user tried to spoof a "1" (admin) role |
|
53 | 53 | if (!$modx->hasPermission('save_user')) { |
54 | - webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12); |
|
55 | - } |
|
56 | - // Verify that the user being edited wasn't an admin and the user ID got spoofed |
|
57 | - if (EvolutionCMS\Models\ManagerUser::where('role', '=', 1)->where('internalKey', '=', $id)->first()) { |
|
58 | - webAlertAndQuit("You cannot alter an administrative user.", 12); |
|
59 | - } |
|
54 | + webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12); |
|
55 | + } |
|
56 | + // Verify that the user being edited wasn't an admin and the user ID got spoofed |
|
57 | + if (EvolutionCMS\Models\ManagerUser::where('role', '=', 1)->where('internalKey', '=', $id)->first()) { |
|
58 | + webAlertAndQuit("You cannot alter an administrative user.", 12); |
|
59 | + } |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | 63 | switch ($input['mode']) { |
64 | - case '11' : // new user |
|
65 | - // check if this user name already exist |
|
66 | - if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->first()) { |
|
67 | - webAlertAndQuit("User name is already in use!", 12); |
|
68 | - } |
|
69 | - |
|
70 | - // check if the email address already exist |
|
71 | - if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
72 | - webAlertAndQuit("Email is already in use!", 12); |
|
73 | - } |
|
74 | - |
|
75 | - // generate a new password for this user |
|
64 | + case '11' : // new user |
|
65 | + // check if this user name already exist |
|
66 | + if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->first()) { |
|
67 | + webAlertAndQuit("User name is already in use!", 12); |
|
68 | + } |
|
69 | + |
|
70 | + // check if the email address already exist |
|
71 | + if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
72 | + webAlertAndQuit("Email is already in use!", 12); |
|
73 | + } |
|
74 | + |
|
75 | + // generate a new password for this user |
|
76 | 76 | if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
77 | 77 | if (strlen($specifiedpassword) < 6) { |
78 | - webAlertAndQuit("Password is too short!", 12); |
|
79 | - } else { |
|
80 | - $newpassword = $specifiedpassword; |
|
81 | - } |
|
78 | + webAlertAndQuit("Password is too short!", 12); |
|
79 | + } else { |
|
80 | + $newpassword = $specifiedpassword; |
|
81 | + } |
|
82 | 82 | } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
83 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
83 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
84 | 84 | } elseif ($passwordgenmethod == 'g') { |
85 | - $newpassword = generate_password(8); |
|
86 | - } else { |
|
87 | - webAlertAndQuit("No password generation method specified!", 12); |
|
88 | - } |
|
89 | - |
|
90 | - // invoke OnBeforeUserFormSave event |
|
91 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
92 | - "mode" => "new", |
|
93 | - )); |
|
94 | - |
|
95 | - // create the user account |
|
96 | - $field = array(); |
|
97 | - $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
98 | - $field['username'] = $newusername; |
|
99 | - $managerUser= EvolutionCMS\Models\ManagerUser::create($field); |
|
100 | - $internalKey = $managerUser->getKey(); |
|
101 | - $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
102 | - $managerUser->attributes()->create($field); |
|
85 | + $newpassword = generate_password(8); |
|
86 | + } else { |
|
87 | + webAlertAndQuit("No password generation method specified!", 12); |
|
88 | + } |
|
89 | + |
|
90 | + // invoke OnBeforeUserFormSave event |
|
91 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
92 | + "mode" => "new", |
|
93 | + )); |
|
94 | + |
|
95 | + // create the user account |
|
96 | + $field = array(); |
|
97 | + $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
98 | + $field['username'] = $newusername; |
|
99 | + $managerUser= EvolutionCMS\Models\ManagerUser::create($field); |
|
100 | + $internalKey = $managerUser->getKey(); |
|
101 | + $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
102 | + $managerUser->attributes()->create($field); |
|
103 | 103 | |
104 | 104 | $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', |
105 | 105 | 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
106 | 106 | $field = $modx->db->escape($field); |
107 | 107 | $modx->db->insert($field, $tbl_user_attributes); |
108 | 108 | |
109 | - // Save user settings |
|
109 | + // Save user settings |
|
110 | 110 | saveManagerUserSettings($internalKey); |
111 | 111 | |
112 | - // invoke OnManagerSaveUser event |
|
113 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
114 | - "mode" => "new", |
|
115 | - "userid" => $internalKey, |
|
116 | - "username" => $newusername, |
|
117 | - "userpassword" => $newpassword, |
|
118 | - "useremail" => $email, |
|
119 | - "userfullname" => $fullname, |
|
120 | - "userroleid" => $role |
|
121 | - )); |
|
122 | - |
|
123 | - // invoke OnUserFormSave event |
|
124 | - $modx->invokeEvent("OnUserFormSave", array( |
|
125 | - "mode" => "new", |
|
126 | - "id" => $internalKey |
|
127 | - )); |
|
128 | - |
|
129 | - // Set the item name for logger |
|
130 | - $_SESSION['itemname'] = $newusername; |
|
131 | - |
|
132 | - /*******************************************************************************/ |
|
133 | - // put the user in the user_groups he/ she should be in |
|
134 | - // first, check that up_perms are switched on! |
|
135 | - if($modx->getConfig('use_udperms') == 1) { |
|
136 | - if(!empty($user_groups)) { |
|
137 | - for($i = 0; $i < count($user_groups); $i++) { |
|
138 | - $field = array(); |
|
139 | - $field['user_group'] = (int)$user_groups[$i]; |
|
140 | - $field['member'] = $id; |
|
141 | - $managerUser->memberGroups()->create($field); |
|
142 | - } |
|
143 | - } |
|
144 | - } |
|
145 | - // end of user_groups stuff! |
|
112 | + // invoke OnManagerSaveUser event |
|
113 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
114 | + "mode" => "new", |
|
115 | + "userid" => $internalKey, |
|
116 | + "username" => $newusername, |
|
117 | + "userpassword" => $newpassword, |
|
118 | + "useremail" => $email, |
|
119 | + "userfullname" => $fullname, |
|
120 | + "userroleid" => $role |
|
121 | + )); |
|
122 | + |
|
123 | + // invoke OnUserFormSave event |
|
124 | + $modx->invokeEvent("OnUserFormSave", array( |
|
125 | + "mode" => "new", |
|
126 | + "id" => $internalKey |
|
127 | + )); |
|
128 | + |
|
129 | + // Set the item name for logger |
|
130 | + $_SESSION['itemname'] = $newusername; |
|
131 | + |
|
132 | + /*******************************************************************************/ |
|
133 | + // put the user in the user_groups he/ she should be in |
|
134 | + // first, check that up_perms are switched on! |
|
135 | + if($modx->getConfig('use_udperms') == 1) { |
|
136 | + if(!empty($user_groups)) { |
|
137 | + for($i = 0; $i < count($user_groups); $i++) { |
|
138 | + $field = array(); |
|
139 | + $field['user_group'] = (int)$user_groups[$i]; |
|
140 | + $field['member'] = $id; |
|
141 | + $managerUser->memberGroups()->create($field); |
|
142 | + } |
|
143 | + } |
|
144 | + } |
|
145 | + // end of user_groups stuff! |
|
146 | 146 | |
147 | 147 | if ($passwordnotifymethod == 'e') { |
148 | 148 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
149 | 149 | if ($input['stay'] != '') { |
150 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | - header($header); |
|
153 | - } else { |
|
154 | - $header = "Location: index.php?a=75&r=2"; |
|
155 | - header($header); |
|
156 | - } |
|
157 | - } else { |
|
150 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
151 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | + header($header); |
|
153 | + } else { |
|
154 | + $header = "Location: index.php?a=75&r=2"; |
|
155 | + header($header); |
|
156 | + } |
|
157 | + } else { |
|
158 | 158 | if ($input['stay'] != '') { |
159 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | - } else { |
|
162 | - $stayUrl = "index.php?a=75&r=2"; |
|
163 | - } |
|
159 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
160 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | + } else { |
|
162 | + $stayUrl = "index.php?a=75&r=2"; |
|
163 | + } |
|
164 | 164 | |
165 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
166 | - ?> |
|
165 | + include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
166 | + ?> |
|
167 | 167 | |
168 | 168 | <h1><?php echo $_lang['user_title']; ?></h1> |
169 | 169 | |
@@ -185,123 +185,123 @@ discard block |
||
185 | 185 | </div> |
186 | 186 | <?php |
187 | 187 | |
188 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
189 | - } |
|
190 | - break; |
|
191 | - case '12' : // edit user |
|
192 | - // generate a new password for this user |
|
188 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
189 | + } |
|
190 | + break; |
|
191 | + case '12' : // edit user |
|
192 | + // generate a new password for this user |
|
193 | 193 | if ($genpassword == 1) { |
194 | 194 | if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
195 | 195 | if (strlen($specifiedpassword) < 6) { |
196 | - webAlertAndQuit("Password is too short!", 12); |
|
197 | - } else { |
|
198 | - $newpassword = $specifiedpassword; |
|
199 | - } |
|
196 | + webAlertAndQuit("Password is too short!", 12); |
|
197 | + } else { |
|
198 | + $newpassword = $specifiedpassword; |
|
199 | + } |
|
200 | 200 | } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
201 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
201 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
202 | 202 | } elseif ($passwordgenmethod == 'g') { |
203 | - $newpassword = generate_password(8); |
|
204 | - } else { |
|
205 | - webAlertAndQuit("No password generation method specified!", 12); |
|
206 | - } |
|
207 | - } |
|
203 | + $newpassword = generate_password(8); |
|
204 | + } else { |
|
205 | + webAlertAndQuit("No password generation method specified!", 12); |
|
206 | + } |
|
207 | + } |
|
208 | 208 | if ($passwordnotifymethod == 'e') { |
209 | 209 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
210 | - } |
|
211 | - |
|
212 | - // check if the username already exist |
|
213 | - if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->where('id', '!=', $id)->first()) { |
|
214 | - webAlertAndQuit("User name is already in use!", 12); |
|
215 | - } |
|
216 | - |
|
217 | - // check if the email address already exists |
|
218 | - if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
219 | - webAlertAndQuit("Email is already in use!", 12); |
|
220 | - } |
|
221 | - |
|
222 | - // invoke OnBeforeUserFormSave event |
|
223 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
224 | - "mode" => "upd", |
|
225 | - "id" => $id |
|
226 | - )); |
|
227 | - |
|
228 | - // update user name and password |
|
229 | - $field = array(); |
|
230 | - $field['username'] = $newusername; |
|
210 | + } |
|
211 | + |
|
212 | + // check if the username already exist |
|
213 | + if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->where('id', '!=', $id)->first()) { |
|
214 | + webAlertAndQuit("User name is already in use!", 12); |
|
215 | + } |
|
216 | + |
|
217 | + // check if the email address already exists |
|
218 | + if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
219 | + webAlertAndQuit("Email is already in use!", 12); |
|
220 | + } |
|
221 | + |
|
222 | + // invoke OnBeforeUserFormSave event |
|
223 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
224 | + "mode" => "upd", |
|
225 | + "id" => $id |
|
226 | + )); |
|
227 | + |
|
228 | + // update user name and password |
|
229 | + $field = array(); |
|
230 | + $field['username'] = $newusername; |
|
231 | 231 | if ($genpassword == 1) { |
232 | - $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
233 | - } |
|
234 | - $managerUser = EvolutionCMS\Models\ManagerUser::find($id); |
|
235 | - $managerUser->update($field); |
|
232 | + $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
233 | + } |
|
234 | + $managerUser = EvolutionCMS\Models\ManagerUser::find($id); |
|
235 | + $managerUser->update($field); |
|
236 | 236 | $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', |
237 | 237 | 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', |
238 | 238 | 'blockedafter'); |
239 | - $managerUser->attributes->update($field); |
|
239 | + $managerUser->attributes->update($field); |
|
240 | 240 | |
241 | - // Save user settings |
|
241 | + // Save user settings |
|
242 | 242 | saveManagerUserSettings($id); |
243 | 243 | |
244 | - // Set the item name for logger |
|
245 | - $_SESSION['itemname'] = $newusername; |
|
246 | - |
|
247 | - // invoke OnManagerSaveUser event |
|
248 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
249 | - "mode" => "upd", |
|
250 | - "userid" => $id, |
|
251 | - "username" => $newusername, |
|
252 | - "userpassword" => $newpassword, |
|
253 | - "useremail" => $email, |
|
254 | - "userfullname" => $fullname, |
|
255 | - "userroleid" => $role, |
|
256 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
257 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
258 | - )); |
|
259 | - |
|
260 | - // invoke OnManagerChangePassword event |
|
244 | + // Set the item name for logger |
|
245 | + $_SESSION['itemname'] = $newusername; |
|
246 | + |
|
247 | + // invoke OnManagerSaveUser event |
|
248 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
249 | + "mode" => "upd", |
|
250 | + "userid" => $id, |
|
251 | + "username" => $newusername, |
|
252 | + "userpassword" => $newpassword, |
|
253 | + "useremail" => $email, |
|
254 | + "userfullname" => $fullname, |
|
255 | + "userroleid" => $role, |
|
256 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
257 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
258 | + )); |
|
259 | + |
|
260 | + // invoke OnManagerChangePassword event |
|
261 | 261 | if ($genpassword == 1) { |
262 | - $modx->invokeEvent("OnManagerChangePassword", array( |
|
263 | - "userid" => $id, |
|
264 | - "username" => $newusername, |
|
265 | - "userpassword" => $newpassword |
|
266 | - )); |
|
267 | - } |
|
268 | - |
|
269 | - // invoke OnUserFormSave event |
|
270 | - $modx->invokeEvent("OnUserFormSave", array( |
|
271 | - "mode" => "upd", |
|
272 | - "id" => $id |
|
273 | - )); |
|
274 | - |
|
275 | - /*******************************************************************************/ |
|
276 | - // put the user in the user_groups he/ she should be in |
|
277 | - // first, check that up_perms are switched on! |
|
278 | - if($modx->getConfig('use_udperms') == 1) { |
|
279 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
280 | - $managerUser->memberGroups()->delete(); |
|
262 | + $modx->invokeEvent("OnManagerChangePassword", array( |
|
263 | + "userid" => $id, |
|
264 | + "username" => $newusername, |
|
265 | + "userpassword" => $newpassword |
|
266 | + )); |
|
267 | + } |
|
268 | + |
|
269 | + // invoke OnUserFormSave event |
|
270 | + $modx->invokeEvent("OnUserFormSave", array( |
|
271 | + "mode" => "upd", |
|
272 | + "id" => $id |
|
273 | + )); |
|
274 | + |
|
275 | + /*******************************************************************************/ |
|
276 | + // put the user in the user_groups he/ she should be in |
|
277 | + // first, check that up_perms are switched on! |
|
278 | + if($modx->getConfig('use_udperms') == 1) { |
|
279 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
280 | + $managerUser->memberGroups()->delete(); |
|
281 | 281 | if (!empty($user_groups)) { |
282 | 282 | for ($i = 0; $i < count($user_groups); $i++) { |
283 | - $field = array(); |
|
284 | - $field['user_group'] = (int)$user_groups[$i]; |
|
285 | - $field['member'] = $id; |
|
286 | - $managerUser->memberGroups()->create($field); |
|
287 | - } |
|
288 | - } |
|
289 | - } |
|
290 | - // end of user_groups stuff! |
|
291 | - /*******************************************************************************/ |
|
283 | + $field = array(); |
|
284 | + $field['user_group'] = (int)$user_groups[$i]; |
|
285 | + $field['member'] = $id; |
|
286 | + $managerUser->memberGroups()->create($field); |
|
287 | + } |
|
288 | + } |
|
289 | + } |
|
290 | + // end of user_groups stuff! |
|
291 | + /*******************************************************************************/ |
|
292 | 292 | if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
293 | - $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
294 | - } |
|
293 | + $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
294 | + } |
|
295 | 295 | if ($genpassword == 1 && $passwordnotifymethod == 's') { |
296 | 296 | if ($input['stay'] != '') { |
297 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
298 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
299 | - } else { |
|
300 | - $stayUrl = "index.php?a=75&r=2"; |
|
301 | - } |
|
297 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
298 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
299 | + } else { |
|
300 | + $stayUrl = "index.php?a=75&r=2"; |
|
301 | + } |
|
302 | 302 | |
303 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
304 | - ?> |
|
303 | + include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
304 | + ?> |
|
305 | 305 | |
306 | 306 | <h1><?php echo $_lang['user_title']; ?></h1> |
307 | 307 | |
@@ -324,18 +324,18 @@ discard block |
||
324 | 324 | </div> |
325 | 325 | <?php |
326 | 326 | |
327 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
328 | - } else { |
|
327 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
328 | + } else { |
|
329 | 329 | if ($input['stay'] != '') { |
330 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
331 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
332 | - header($header); |
|
333 | - } else { |
|
334 | - $header = "Location: index.php?a=75&r=2"; |
|
335 | - header($header); |
|
336 | - } |
|
337 | - } |
|
338 | - break; |
|
339 | - default: |
|
340 | - webAlertAndQuit("No operation set in request.", 12); |
|
330 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
331 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
332 | + header($header); |
|
333 | + } else { |
|
334 | + $header = "Location: index.php?a=75&r=2"; |
|
335 | + header($header); |
|
336 | + } |
|
337 | + } |
|
338 | + break; |
|
339 | + default: |
|
340 | + webAlertAndQuit("No operation set in request.", 12); |
|
341 | 341 | } |
@@ -61,109 +61,109 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | switch ($input['mode']) { |
64 | - case '11' : // new user |
|
65 | - // check if this user name already exist |
|
66 | - if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->first()) { |
|
67 | - webAlertAndQuit("User name is already in use!", 12); |
|
68 | - } |
|
69 | - |
|
70 | - // check if the email address already exist |
|
71 | - if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
72 | - webAlertAndQuit("Email is already in use!", 12); |
|
73 | - } |
|
74 | - |
|
75 | - // generate a new password for this user |
|
76 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
77 | - if (strlen($specifiedpassword) < 6) { |
|
78 | - webAlertAndQuit("Password is too short!", 12); |
|
79 | - } else { |
|
80 | - $newpassword = $specifiedpassword; |
|
81 | - } |
|
82 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
83 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
84 | - } elseif ($passwordgenmethod == 'g') { |
|
85 | - $newpassword = generate_password(8); |
|
86 | - } else { |
|
87 | - webAlertAndQuit("No password generation method specified!", 12); |
|
88 | - } |
|
89 | - |
|
90 | - // invoke OnBeforeUserFormSave event |
|
91 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
92 | - "mode" => "new", |
|
93 | - )); |
|
94 | - |
|
95 | - // create the user account |
|
96 | - $field = array(); |
|
97 | - $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
98 | - $field['username'] = $newusername; |
|
99 | - $managerUser= EvolutionCMS\Models\ManagerUser::create($field); |
|
100 | - $internalKey = $managerUser->getKey(); |
|
101 | - $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
102 | - $managerUser->attributes()->create($field); |
|
103 | - |
|
104 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', |
|
105 | - 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
106 | - $field = $modx->db->escape($field); |
|
107 | - $modx->db->insert($field, $tbl_user_attributes); |
|
108 | - |
|
109 | - // Save user settings |
|
110 | - saveManagerUserSettings($internalKey); |
|
111 | - |
|
112 | - // invoke OnManagerSaveUser event |
|
113 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
114 | - "mode" => "new", |
|
115 | - "userid" => $internalKey, |
|
116 | - "username" => $newusername, |
|
117 | - "userpassword" => $newpassword, |
|
118 | - "useremail" => $email, |
|
119 | - "userfullname" => $fullname, |
|
120 | - "userroleid" => $role |
|
121 | - )); |
|
122 | - |
|
123 | - // invoke OnUserFormSave event |
|
124 | - $modx->invokeEvent("OnUserFormSave", array( |
|
125 | - "mode" => "new", |
|
126 | - "id" => $internalKey |
|
127 | - )); |
|
128 | - |
|
129 | - // Set the item name for logger |
|
130 | - $_SESSION['itemname'] = $newusername; |
|
131 | - |
|
132 | - /*******************************************************************************/ |
|
133 | - // put the user in the user_groups he/ she should be in |
|
134 | - // first, check that up_perms are switched on! |
|
135 | - if($modx->getConfig('use_udperms') == 1) { |
|
136 | - if(!empty($user_groups)) { |
|
137 | - for($i = 0; $i < count($user_groups); $i++) { |
|
138 | - $field = array(); |
|
139 | - $field['user_group'] = (int)$user_groups[$i]; |
|
140 | - $field['member'] = $id; |
|
141 | - $managerUser->memberGroups()->create($field); |
|
142 | - } |
|
143 | - } |
|
144 | - } |
|
145 | - // end of user_groups stuff! |
|
146 | - |
|
147 | - if ($passwordnotifymethod == 'e') { |
|
148 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
149 | - if ($input['stay'] != '') { |
|
150 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | - header($header); |
|
153 | - } else { |
|
154 | - $header = "Location: index.php?a=75&r=2"; |
|
155 | - header($header); |
|
156 | - } |
|
157 | - } else { |
|
158 | - if ($input['stay'] != '') { |
|
159 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | - } else { |
|
162 | - $stayUrl = "index.php?a=75&r=2"; |
|
163 | - } |
|
164 | - |
|
165 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
166 | - ?> |
|
64 | + case '11' : // new user |
|
65 | + // check if this user name already exist |
|
66 | + if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->first()) { |
|
67 | + webAlertAndQuit("User name is already in use!", 12); |
|
68 | + } |
|
69 | + |
|
70 | + // check if the email address already exist |
|
71 | + if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
72 | + webAlertAndQuit("Email is already in use!", 12); |
|
73 | + } |
|
74 | + |
|
75 | + // generate a new password for this user |
|
76 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
77 | + if (strlen($specifiedpassword) < 6) { |
|
78 | + webAlertAndQuit("Password is too short!", 12); |
|
79 | + } else { |
|
80 | + $newpassword = $specifiedpassword; |
|
81 | + } |
|
82 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
83 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
84 | + } elseif ($passwordgenmethod == 'g') { |
|
85 | + $newpassword = generate_password(8); |
|
86 | + } else { |
|
87 | + webAlertAndQuit("No password generation method specified!", 12); |
|
88 | + } |
|
89 | + |
|
90 | + // invoke OnBeforeUserFormSave event |
|
91 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
92 | + "mode" => "new", |
|
93 | + )); |
|
94 | + |
|
95 | + // create the user account |
|
96 | + $field = array(); |
|
97 | + $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
98 | + $field['username'] = $newusername; |
|
99 | + $managerUser= EvolutionCMS\Models\ManagerUser::create($field); |
|
100 | + $internalKey = $managerUser->getKey(); |
|
101 | + $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
102 | + $managerUser->attributes()->create($field); |
|
103 | + |
|
104 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', |
|
105 | + 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
106 | + $field = $modx->db->escape($field); |
|
107 | + $modx->db->insert($field, $tbl_user_attributes); |
|
108 | + |
|
109 | + // Save user settings |
|
110 | + saveManagerUserSettings($internalKey); |
|
111 | + |
|
112 | + // invoke OnManagerSaveUser event |
|
113 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
114 | + "mode" => "new", |
|
115 | + "userid" => $internalKey, |
|
116 | + "username" => $newusername, |
|
117 | + "userpassword" => $newpassword, |
|
118 | + "useremail" => $email, |
|
119 | + "userfullname" => $fullname, |
|
120 | + "userroleid" => $role |
|
121 | + )); |
|
122 | + |
|
123 | + // invoke OnUserFormSave event |
|
124 | + $modx->invokeEvent("OnUserFormSave", array( |
|
125 | + "mode" => "new", |
|
126 | + "id" => $internalKey |
|
127 | + )); |
|
128 | + |
|
129 | + // Set the item name for logger |
|
130 | + $_SESSION['itemname'] = $newusername; |
|
131 | + |
|
132 | + /*******************************************************************************/ |
|
133 | + // put the user in the user_groups he/ she should be in |
|
134 | + // first, check that up_perms are switched on! |
|
135 | + if($modx->getConfig('use_udperms') == 1) { |
|
136 | + if(!empty($user_groups)) { |
|
137 | + for($i = 0; $i < count($user_groups); $i++) { |
|
138 | + $field = array(); |
|
139 | + $field['user_group'] = (int)$user_groups[$i]; |
|
140 | + $field['member'] = $id; |
|
141 | + $managerUser->memberGroups()->create($field); |
|
142 | + } |
|
143 | + } |
|
144 | + } |
|
145 | + // end of user_groups stuff! |
|
146 | + |
|
147 | + if ($passwordnotifymethod == 'e') { |
|
148 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
149 | + if ($input['stay'] != '') { |
|
150 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
151 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | + header($header); |
|
153 | + } else { |
|
154 | + $header = "Location: index.php?a=75&r=2"; |
|
155 | + header($header); |
|
156 | + } |
|
157 | + } else { |
|
158 | + if ($input['stay'] != '') { |
|
159 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
160 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | + } else { |
|
162 | + $stayUrl = "index.php?a=75&r=2"; |
|
163 | + } |
|
164 | + |
|
165 | + include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
166 | + ?> |
|
167 | 167 | |
168 | 168 | <h1><?php echo $_lang['user_title']; ?></h1> |
169 | 169 | |
@@ -185,130 +185,130 @@ discard block |
||
185 | 185 | </div> |
186 | 186 | <?php |
187 | 187 | |
188 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
189 | - } |
|
190 | - break; |
|
191 | - case '12' : // edit user |
|
192 | - // generate a new password for this user |
|
193 | - if ($genpassword == 1) { |
|
194 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | - if (strlen($specifiedpassword) < 6) { |
|
196 | - webAlertAndQuit("Password is too short!", 12); |
|
197 | - } else { |
|
198 | - $newpassword = $specifiedpassword; |
|
199 | - } |
|
200 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
202 | - } elseif ($passwordgenmethod == 'g') { |
|
203 | - $newpassword = generate_password(8); |
|
204 | - } else { |
|
205 | - webAlertAndQuit("No password generation method specified!", 12); |
|
206 | - } |
|
207 | - } |
|
208 | - if ($passwordnotifymethod == 'e') { |
|
209 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
210 | - } |
|
211 | - |
|
212 | - // check if the username already exist |
|
213 | - if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->where('id', '!=', $id)->first()) { |
|
214 | - webAlertAndQuit("User name is already in use!", 12); |
|
215 | - } |
|
216 | - |
|
217 | - // check if the email address already exists |
|
218 | - if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
219 | - webAlertAndQuit("Email is already in use!", 12); |
|
220 | - } |
|
221 | - |
|
222 | - // invoke OnBeforeUserFormSave event |
|
223 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
224 | - "mode" => "upd", |
|
225 | - "id" => $id |
|
226 | - )); |
|
227 | - |
|
228 | - // update user name and password |
|
229 | - $field = array(); |
|
230 | - $field['username'] = $newusername; |
|
231 | - if ($genpassword == 1) { |
|
232 | - $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
233 | - } |
|
234 | - $managerUser = EvolutionCMS\Models\ManagerUser::find($id); |
|
235 | - $managerUser->update($field); |
|
236 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', |
|
237 | - 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', |
|
238 | - 'blockedafter'); |
|
239 | - $managerUser->attributes->update($field); |
|
240 | - |
|
241 | - // Save user settings |
|
242 | - saveManagerUserSettings($id); |
|
243 | - |
|
244 | - // Set the item name for logger |
|
245 | - $_SESSION['itemname'] = $newusername; |
|
246 | - |
|
247 | - // invoke OnManagerSaveUser event |
|
248 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
249 | - "mode" => "upd", |
|
250 | - "userid" => $id, |
|
251 | - "username" => $newusername, |
|
252 | - "userpassword" => $newpassword, |
|
253 | - "useremail" => $email, |
|
254 | - "userfullname" => $fullname, |
|
255 | - "userroleid" => $role, |
|
256 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
257 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
258 | - )); |
|
259 | - |
|
260 | - // invoke OnManagerChangePassword event |
|
261 | - if ($genpassword == 1) { |
|
262 | - $modx->invokeEvent("OnManagerChangePassword", array( |
|
263 | - "userid" => $id, |
|
264 | - "username" => $newusername, |
|
265 | - "userpassword" => $newpassword |
|
266 | - )); |
|
267 | - } |
|
268 | - |
|
269 | - // invoke OnUserFormSave event |
|
270 | - $modx->invokeEvent("OnUserFormSave", array( |
|
271 | - "mode" => "upd", |
|
272 | - "id" => $id |
|
273 | - )); |
|
274 | - |
|
275 | - /*******************************************************************************/ |
|
276 | - // put the user in the user_groups he/ she should be in |
|
277 | - // first, check that up_perms are switched on! |
|
278 | - if($modx->getConfig('use_udperms') == 1) { |
|
279 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
280 | - $managerUser->memberGroups()->delete(); |
|
281 | - if (!empty($user_groups)) { |
|
282 | - for ($i = 0; $i < count($user_groups); $i++) { |
|
283 | - $field = array(); |
|
284 | - $field['user_group'] = (int)$user_groups[$i]; |
|
285 | - $field['member'] = $id; |
|
286 | - $managerUser->memberGroups()->create($field); |
|
287 | - } |
|
288 | - } |
|
289 | - } |
|
290 | - // end of user_groups stuff! |
|
291 | - /*******************************************************************************/ |
|
292 | - if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
293 | - $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
294 | - } |
|
295 | - if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
296 | - if ($input['stay'] != '') { |
|
297 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
298 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
299 | - } else { |
|
300 | - $stayUrl = "index.php?a=75&r=2"; |
|
301 | - } |
|
302 | - |
|
303 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
304 | - ?> |
|
188 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
189 | + } |
|
190 | + break; |
|
191 | + case '12' : // edit user |
|
192 | + // generate a new password for this user |
|
193 | + if ($genpassword == 1) { |
|
194 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | + if (strlen($specifiedpassword) < 6) { |
|
196 | + webAlertAndQuit("Password is too short!", 12); |
|
197 | + } else { |
|
198 | + $newpassword = $specifiedpassword; |
|
199 | + } |
|
200 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
202 | + } elseif ($passwordgenmethod == 'g') { |
|
203 | + $newpassword = generate_password(8); |
|
204 | + } else { |
|
205 | + webAlertAndQuit("No password generation method specified!", 12); |
|
206 | + } |
|
207 | + } |
|
208 | + if ($passwordnotifymethod == 'e') { |
|
209 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
210 | + } |
|
211 | + |
|
212 | + // check if the username already exist |
|
213 | + if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->where('id', '!=', $id)->first()) { |
|
214 | + webAlertAndQuit("User name is already in use!", 12); |
|
215 | + } |
|
216 | + |
|
217 | + // check if the email address already exists |
|
218 | + if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
219 | + webAlertAndQuit("Email is already in use!", 12); |
|
220 | + } |
|
221 | + |
|
222 | + // invoke OnBeforeUserFormSave event |
|
223 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
224 | + "mode" => "upd", |
|
225 | + "id" => $id |
|
226 | + )); |
|
227 | + |
|
228 | + // update user name and password |
|
229 | + $field = array(); |
|
230 | + $field['username'] = $newusername; |
|
231 | + if ($genpassword == 1) { |
|
232 | + $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
233 | + } |
|
234 | + $managerUser = EvolutionCMS\Models\ManagerUser::find($id); |
|
235 | + $managerUser->update($field); |
|
236 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', |
|
237 | + 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', |
|
238 | + 'blockedafter'); |
|
239 | + $managerUser->attributes->update($field); |
|
240 | + |
|
241 | + // Save user settings |
|
242 | + saveManagerUserSettings($id); |
|
243 | + |
|
244 | + // Set the item name for logger |
|
245 | + $_SESSION['itemname'] = $newusername; |
|
246 | + |
|
247 | + // invoke OnManagerSaveUser event |
|
248 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
249 | + "mode" => "upd", |
|
250 | + "userid" => $id, |
|
251 | + "username" => $newusername, |
|
252 | + "userpassword" => $newpassword, |
|
253 | + "useremail" => $email, |
|
254 | + "userfullname" => $fullname, |
|
255 | + "userroleid" => $role, |
|
256 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
257 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
258 | + )); |
|
259 | + |
|
260 | + // invoke OnManagerChangePassword event |
|
261 | + if ($genpassword == 1) { |
|
262 | + $modx->invokeEvent("OnManagerChangePassword", array( |
|
263 | + "userid" => $id, |
|
264 | + "username" => $newusername, |
|
265 | + "userpassword" => $newpassword |
|
266 | + )); |
|
267 | + } |
|
268 | + |
|
269 | + // invoke OnUserFormSave event |
|
270 | + $modx->invokeEvent("OnUserFormSave", array( |
|
271 | + "mode" => "upd", |
|
272 | + "id" => $id |
|
273 | + )); |
|
274 | + |
|
275 | + /*******************************************************************************/ |
|
276 | + // put the user in the user_groups he/ she should be in |
|
277 | + // first, check that up_perms are switched on! |
|
278 | + if($modx->getConfig('use_udperms') == 1) { |
|
279 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
280 | + $managerUser->memberGroups()->delete(); |
|
281 | + if (!empty($user_groups)) { |
|
282 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
283 | + $field = array(); |
|
284 | + $field['user_group'] = (int)$user_groups[$i]; |
|
285 | + $field['member'] = $id; |
|
286 | + $managerUser->memberGroups()->create($field); |
|
287 | + } |
|
288 | + } |
|
289 | + } |
|
290 | + // end of user_groups stuff! |
|
291 | + /*******************************************************************************/ |
|
292 | + if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
293 | + $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
294 | + } |
|
295 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
296 | + if ($input['stay'] != '') { |
|
297 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
298 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
299 | + } else { |
|
300 | + $stayUrl = "index.php?a=75&r=2"; |
|
301 | + } |
|
302 | + |
|
303 | + include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
304 | + ?> |
|
305 | 305 | |
306 | 306 | <h1><?php echo $_lang['user_title']; ?></h1> |
307 | 307 | |
308 | 308 | <div id="actions"> |
309 | 309 | <div class="btn-group"> |
310 | 310 | <a class="btn" href="<?php echo ($id == $modx->getLoginUserID()) ? 'index.php?a=8' : $stayUrl; |
311 | - ?>"><i |
|
311 | + ?>"><i |
|
312 | 312 | class="<?php echo $_style["actions_save"] ?>"></i> <?php echo ($id == $modx->getLoginUserID()) ? $_lang['logout'] : $_lang['edit']; ?> |
313 | 313 | </a> |
314 | 314 | </div> |
@@ -318,24 +318,24 @@ discard block |
||
318 | 318 | <div class="tab-page"> |
319 | 319 | <div class="container container-body" id="disp"> |
320 | 320 | <p><?php echo sprintf($_lang["password_msg"], $modx->getPhpCompat()->htmlspecialchars($newusername), |
321 | - $modx->getPhpCompat()->htmlspecialchars($newpassword)) . (($id == $modx->getLoginUserID()) ? ' ' . $_lang['user_changeddata'] : ''); ?></p> |
|
321 | + $modx->getPhpCompat()->htmlspecialchars($newpassword)) . (($id == $modx->getLoginUserID()) ? ' ' . $_lang['user_changeddata'] : ''); ?></p> |
|
322 | 322 | </div> |
323 | 323 | </div> |
324 | 324 | </div> |
325 | 325 | <?php |
326 | 326 | |
327 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
328 | - } else { |
|
329 | - if ($input['stay'] != '') { |
|
330 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
331 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
332 | - header($header); |
|
333 | - } else { |
|
334 | - $header = "Location: index.php?a=75&r=2"; |
|
335 | - header($header); |
|
336 | - } |
|
337 | - } |
|
338 | - break; |
|
339 | - default: |
|
340 | - webAlertAndQuit("No operation set in request.", 12); |
|
327 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
328 | + } else { |
|
329 | + if ($input['stay'] != '') { |
|
330 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
331 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
332 | + header($header); |
|
333 | + } else { |
|
334 | + $header = "Location: index.php?a=75&r=2"; |
|
335 | + header($header); |
|
336 | + } |
|
337 | + } |
|
338 | + break; |
|
339 | + default: |
|
340 | + webAlertAndQuit("No operation set in request.", 12); |
|
341 | 341 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | $input = $_POST; |
10 | 10 | |
11 | -$id = (int)$input['id']; |
|
11 | +$id = (int) $input['id']; |
|
12 | 12 | $oldusername = $input['oldusername']; |
13 | 13 | $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User"; |
14 | 14 | $fullname = $input['fullname']; |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | $field = array(); |
97 | 97 | $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
98 | 98 | $field['username'] = $newusername; |
99 | - $managerUser= EvolutionCMS\Models\ManagerUser::create($field); |
|
99 | + $managerUser = EvolutionCMS\Models\ManagerUser::create($field); |
|
100 | 100 | $internalKey = $managerUser->getKey(); |
101 | - $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
101 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
102 | 102 | $managerUser->attributes()->create($field); |
103 | 103 | |
104 | 104 | $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | /*******************************************************************************/ |
133 | 133 | // put the user in the user_groups he/ she should be in |
134 | 134 | // first, check that up_perms are switched on! |
135 | - if($modx->getConfig('use_udperms') == 1) { |
|
136 | - if(!empty($user_groups)) { |
|
137 | - for($i = 0; $i < count($user_groups); $i++) { |
|
135 | + if ($modx->getConfig('use_udperms') == 1) { |
|
136 | + if (!empty($user_groups)) { |
|
137 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
138 | 138 | $field = array(); |
139 | - $field['user_group'] = (int)$user_groups[$i]; |
|
139 | + $field['user_group'] = (int) $user_groups[$i]; |
|
140 | 140 | $field['member'] = $id; |
141 | 141 | $managerUser->memberGroups()->create($field); |
142 | 142 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
149 | 149 | if ($input['stay'] != '') { |
150 | 150 | $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
151 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
152 | 152 | header($header); |
153 | 153 | } else { |
154 | 154 | $header = "Location: index.php?a=75&r=2"; |
@@ -157,12 +157,12 @@ discard block |
||
157 | 157 | } else { |
158 | 158 | if ($input['stay'] != '') { |
159 | 159 | $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
160 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
161 | 161 | } else { |
162 | 162 | $stayUrl = "index.php?a=75&r=2"; |
163 | 163 | } |
164 | 164 | |
165 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
165 | + include_once MODX_MANAGER_PATH."includes/header.inc.php"; |
|
166 | 166 | ?> |
167 | 167 | |
168 | 168 | <h1><?php echo $_lang['user_title']; ?></h1> |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | </div> |
186 | 186 | <?php |
187 | 187 | |
188 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
188 | + include_once MODX_MANAGER_PATH."includes/footer.inc.php"; |
|
189 | 189 | } |
190 | 190 | break; |
191 | 191 | case '12' : // edit user |
@@ -275,13 +275,13 @@ discard block |
||
275 | 275 | /*******************************************************************************/ |
276 | 276 | // put the user in the user_groups he/ she should be in |
277 | 277 | // first, check that up_perms are switched on! |
278 | - if($modx->getConfig('use_udperms') == 1) { |
|
278 | + if ($modx->getConfig('use_udperms') == 1) { |
|
279 | 279 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
280 | 280 | $managerUser->memberGroups()->delete(); |
281 | 281 | if (!empty($user_groups)) { |
282 | 282 | for ($i = 0; $i < count($user_groups); $i++) { |
283 | 283 | $field = array(); |
284 | - $field['user_group'] = (int)$user_groups[$i]; |
|
284 | + $field['user_group'] = (int) $user_groups[$i]; |
|
285 | 285 | $field['member'] = $id; |
286 | 286 | $managerUser->memberGroups()->create($field); |
287 | 287 | } |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | if ($genpassword == 1 && $passwordnotifymethod == 's') { |
296 | 296 | if ($input['stay'] != '') { |
297 | 297 | $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
298 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
298 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
299 | 299 | } else { |
300 | 300 | $stayUrl = "index.php?a=75&r=2"; |
301 | 301 | } |
302 | 302 | |
303 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
303 | + include_once MODX_MANAGER_PATH."includes/header.inc.php"; |
|
304 | 304 | ?> |
305 | 305 | |
306 | 306 | <h1><?php echo $_lang['user_title']; ?></h1> |
@@ -318,17 +318,17 @@ discard block |
||
318 | 318 | <div class="tab-page"> |
319 | 319 | <div class="container container-body" id="disp"> |
320 | 320 | <p><?php echo sprintf($_lang["password_msg"], $modx->getPhpCompat()->htmlspecialchars($newusername), |
321 | - $modx->getPhpCompat()->htmlspecialchars($newpassword)) . (($id == $modx->getLoginUserID()) ? ' ' . $_lang['user_changeddata'] : ''); ?></p> |
|
321 | + $modx->getPhpCompat()->htmlspecialchars($newpassword)).(($id == $modx->getLoginUserID()) ? ' '.$_lang['user_changeddata'] : ''); ?></p> |
|
322 | 322 | </div> |
323 | 323 | </div> |
324 | 324 | </div> |
325 | 325 | <?php |
326 | 326 | |
327 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
327 | + include_once MODX_MANAGER_PATH."includes/footer.inc.php"; |
|
328 | 328 | } else { |
329 | 329 | if ($input['stay'] != '') { |
330 | 330 | $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
331 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
331 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
332 | 332 | header($header); |
333 | 333 | } else { |
334 | 334 | $header = "Location: index.php?a=75&r=2"; |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | -if (!$modx->hasPermission('save_user')) { |
|
5 | +if (!$modx->hasPermission('save_user')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -38,52 +38,52 @@ discard block |
||
38 | 38 | $user_groups = $input['user_groups']; |
39 | 39 | |
40 | 40 | // verify password |
41 | -if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
41 | +if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
42 | 42 | webAlertAndQuit("Password typed is mismatched", 12); |
43 | 43 | } |
44 | 44 | |
45 | 45 | // verify email |
46 | -if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
46 | +if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
47 | 47 | webAlertAndQuit("E-mail address doesn't seem to be valid!", 12); |
48 | 48 | } |
49 | 49 | |
50 | 50 | // verify admin security |
51 | -if ($_SESSION['mgrRole'] != 1) { |
|
51 | +if ($_SESSION['mgrRole'] != 1) { |
|
52 | 52 | // Check to see if user tried to spoof a "1" (admin) role |
53 | - if (!$modx->hasPermission('save_user')) { |
|
53 | + if (!$modx->hasPermission('save_user')) { |
|
54 | 54 | webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12); |
55 | 55 | } |
56 | 56 | // Verify that the user being edited wasn't an admin and the user ID got spoofed |
57 | - if (EvolutionCMS\Models\ManagerUser::where('role', '=', 1)->where('internalKey', '=', $id)->first()) { |
|
57 | + if (EvolutionCMS\Models\ManagerUser::where('role', '=', 1)->where('internalKey', '=', $id)->first()) { |
|
58 | 58 | webAlertAndQuit("You cannot alter an administrative user.", 12); |
59 | 59 | } |
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | -switch ($input['mode']) { |
|
63 | +switch ($input['mode']) { |
|
64 | 64 | case '11' : // new user |
65 | 65 | // check if this user name already exist |
66 | - if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->first()) { |
|
66 | + if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->first()) { |
|
67 | 67 | webAlertAndQuit("User name is already in use!", 12); |
68 | 68 | } |
69 | 69 | |
70 | 70 | // check if the email address already exist |
71 | - if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
71 | + if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
72 | 72 | webAlertAndQuit("Email is already in use!", 12); |
73 | 73 | } |
74 | 74 | |
75 | 75 | // generate a new password for this user |
76 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
77 | - if (strlen($specifiedpassword) < 6) { |
|
76 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
77 | + if (strlen($specifiedpassword) < 6) { |
|
78 | 78 | webAlertAndQuit("Password is too short!", 12); |
79 | - } else { |
|
79 | + } else { |
|
80 | 80 | $newpassword = $specifiedpassword; |
81 | 81 | } |
82 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
82 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
83 | 83 | webAlertAndQuit("You didn't specify a password for this user!", 12); |
84 | - } elseif ($passwordgenmethod == 'g') { |
|
84 | + } elseif ($passwordgenmethod == 'g') { |
|
85 | 85 | $newpassword = generate_password(8); |
86 | - } else { |
|
86 | + } else { |
|
87 | 87 | webAlertAndQuit("No password generation method specified!", 12); |
88 | 88 | } |
89 | 89 | |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | /*******************************************************************************/ |
133 | 133 | // put the user in the user_groups he/ she should be in |
134 | 134 | // first, check that up_perms are switched on! |
135 | - if($modx->getConfig('use_udperms') == 1) { |
|
136 | - if(!empty($user_groups)) { |
|
137 | - for($i = 0; $i < count($user_groups); $i++) { |
|
135 | + if($modx->getConfig('use_udperms') == 1) { |
|
136 | + if(!empty($user_groups)) { |
|
137 | + for($i = 0; $i < count($user_groups); $i++) { |
|
138 | 138 | $field = array(); |
139 | 139 | $field['user_group'] = (int)$user_groups[$i]; |
140 | 140 | $field['member'] = $id; |
@@ -144,21 +144,21 @@ discard block |
||
144 | 144 | } |
145 | 145 | // end of user_groups stuff! |
146 | 146 | |
147 | - if ($passwordnotifymethod == 'e') { |
|
147 | + if ($passwordnotifymethod == 'e') { |
|
148 | 148 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
149 | - if ($input['stay'] != '') { |
|
149 | + if ($input['stay'] != '') { |
|
150 | 150 | $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
151 | 151 | $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
152 | 152 | header($header); |
153 | - } else { |
|
153 | + } else { |
|
154 | 154 | $header = "Location: index.php?a=75&r=2"; |
155 | 155 | header($header); |
156 | 156 | } |
157 | - } else { |
|
158 | - if ($input['stay'] != '') { |
|
157 | + } else { |
|
158 | + if ($input['stay'] != '') { |
|
159 | 159 | $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
160 | 160 | $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
161 | - } else { |
|
161 | + } else { |
|
162 | 162 | $stayUrl = "index.php?a=75&r=2"; |
163 | 163 | } |
164 | 164 | |
@@ -190,32 +190,32 @@ discard block |
||
190 | 190 | break; |
191 | 191 | case '12' : // edit user |
192 | 192 | // generate a new password for this user |
193 | - if ($genpassword == 1) { |
|
194 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | - if (strlen($specifiedpassword) < 6) { |
|
193 | + if ($genpassword == 1) { |
|
194 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | + if (strlen($specifiedpassword) < 6) { |
|
196 | 196 | webAlertAndQuit("Password is too short!", 12); |
197 | - } else { |
|
197 | + } else { |
|
198 | 198 | $newpassword = $specifiedpassword; |
199 | 199 | } |
200 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
200 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | 201 | webAlertAndQuit("You didn't specify a password for this user!", 12); |
202 | - } elseif ($passwordgenmethod == 'g') { |
|
202 | + } elseif ($passwordgenmethod == 'g') { |
|
203 | 203 | $newpassword = generate_password(8); |
204 | - } else { |
|
204 | + } else { |
|
205 | 205 | webAlertAndQuit("No password generation method specified!", 12); |
206 | 206 | } |
207 | 207 | } |
208 | - if ($passwordnotifymethod == 'e') { |
|
208 | + if ($passwordnotifymethod == 'e') { |
|
209 | 209 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
210 | 210 | } |
211 | 211 | |
212 | 212 | // check if the username already exist |
213 | - if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->where('id', '!=', $id)->first()) { |
|
213 | + if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->where('id', '!=', $id)->first()) { |
|
214 | 214 | webAlertAndQuit("User name is already in use!", 12); |
215 | 215 | } |
216 | 216 | |
217 | 217 | // check if the email address already exists |
218 | - if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
218 | + if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
219 | 219 | webAlertAndQuit("Email is already in use!", 12); |
220 | 220 | } |
221 | 221 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | // update user name and password |
229 | 229 | $field = array(); |
230 | 230 | $field['username'] = $newusername; |
231 | - if ($genpassword == 1) { |
|
231 | + if ($genpassword == 1) { |
|
232 | 232 | $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
233 | 233 | } |
234 | 234 | $managerUser = EvolutionCMS\Models\ManagerUser::find($id); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | )); |
259 | 259 | |
260 | 260 | // invoke OnManagerChangePassword event |
261 | - if ($genpassword == 1) { |
|
261 | + if ($genpassword == 1) { |
|
262 | 262 | $modx->invokeEvent("OnManagerChangePassword", array( |
263 | 263 | "userid" => $id, |
264 | 264 | "username" => $newusername, |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | /*******************************************************************************/ |
276 | 276 | // put the user in the user_groups he/ she should be in |
277 | 277 | // first, check that up_perms are switched on! |
278 | - if($modx->getConfig('use_udperms') == 1) { |
|
278 | + if($modx->getConfig('use_udperms') == 1) { |
|
279 | 279 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
280 | 280 | $managerUser->memberGroups()->delete(); |
281 | - if (!empty($user_groups)) { |
|
282 | - for ($i = 0; $i < count($user_groups); $i++) { |
|
281 | + if (!empty($user_groups)) { |
|
282 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
283 | 283 | $field = array(); |
284 | 284 | $field['user_group'] = (int)$user_groups[$i]; |
285 | 285 | $field['member'] = $id; |
@@ -289,14 +289,14 @@ discard block |
||
289 | 289 | } |
290 | 290 | // end of user_groups stuff! |
291 | 291 | /*******************************************************************************/ |
292 | - if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
292 | + if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
293 | 293 | $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
294 | 294 | } |
295 | - if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
296 | - if ($input['stay'] != '') { |
|
295 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
296 | + if ($input['stay'] != '') { |
|
297 | 297 | $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
298 | 298 | $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
299 | - } else { |
|
299 | + } else { |
|
300 | 300 | $stayUrl = "index.php?a=75&r=2"; |
301 | 301 | } |
302 | 302 | |
@@ -325,12 +325,12 @@ discard block |
||
325 | 325 | <?php |
326 | 326 | |
327 | 327 | include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
328 | - } else { |
|
329 | - if ($input['stay'] != '') { |
|
328 | + } else { |
|
329 | + if ($input['stay'] != '') { |
|
330 | 330 | $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
331 | 331 | $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
332 | 332 | header($header); |
333 | - } else { |
|
333 | + } else { |
|
334 | 334 | $header = "Location: index.php?a=75&r=2"; |
335 | 335 | header($header); |
336 | 336 | } |
@@ -3,7 +3,7 @@ discard block |
||
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 | if(!$modx->hasPermission('settings')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | $data = $_POST; |
9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
@@ -11,41 +11,41 @@ discard block |
||
11 | 11 | |
12 | 12 | if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
13 | 13 | { |
14 | - $htaccess = MODX_BASE_PATH . '.htaccess'; |
|
15 | - $sample_htaccess = MODX_BASE_PATH . 'ht.access'; |
|
16 | - $dir = '/' . trim(MODX_BASE_URL,'/'); |
|
17 | - if(is_file($htaccess)) |
|
18 | - { |
|
19 | - $_ = file_get_contents($htaccess); |
|
20 | - if(strpos($_,'RewriteBase')===false) |
|
21 | - { |
|
22 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
23 | - } |
|
24 | - elseif(is_writable($htaccess)) |
|
25 | - { |
|
26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | - if(!@file_put_contents($htaccess,$_)) |
|
28 | - { |
|
29 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
30 | - } |
|
31 | - } |
|
32 | - } |
|
33 | - elseif(is_file($sample_htaccess)) |
|
34 | - { |
|
35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
14 | + $htaccess = MODX_BASE_PATH . '.htaccess'; |
|
15 | + $sample_htaccess = MODX_BASE_PATH . 'ht.access'; |
|
16 | + $dir = '/' . trim(MODX_BASE_URL,'/'); |
|
17 | + if(is_file($htaccess)) |
|
18 | + { |
|
19 | + $_ = file_get_contents($htaccess); |
|
20 | + if(strpos($_,'RewriteBase')===false) |
|
36 | 21 | { |
37 | - $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
38 | - } |
|
39 | - elseif(MODX_BASE_URL!=='/') |
|
40 | - { |
|
41 | - $_ = file_get_contents($htaccess); |
|
42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | - if(!@file_put_contents($htaccess,$_)) |
|
44 | - { |
|
45 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
46 | - } |
|
47 | - } |
|
48 | - } |
|
22 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
23 | + } |
|
24 | + elseif(is_writable($htaccess)) |
|
25 | + { |
|
26 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | + if(!@file_put_contents($htaccess,$_)) |
|
28 | + { |
|
29 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
30 | + } |
|
31 | + } |
|
32 | + } |
|
33 | + elseif(is_file($sample_htaccess)) |
|
34 | + { |
|
35 | + if(!@rename($sample_htaccess,$htaccess)) |
|
36 | + { |
|
37 | + $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
38 | + } |
|
39 | + elseif(MODX_BASE_URL!=='/') |
|
40 | + { |
|
41 | + $_ = file_get_contents($htaccess); |
|
42 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | + if(!@file_put_contents($htaccess,$_)) |
|
44 | + { |
|
45 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
46 | + } |
|
47 | + } |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
@@ -56,19 +56,19 @@ discard block |
||
56 | 56 | $data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
57 | 57 | |
58 | 58 | if (isset($data) && count($data) > 0) { |
59 | - if(isset($data['manager_language'])) { |
|
60 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
61 | - if(is_file($lang_path)) { |
|
62 | - include $lang_path; |
|
59 | + if(isset($data['manager_language'])) { |
|
60 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
61 | + if(is_file($lang_path)) { |
|
62 | + include $lang_path; |
|
63 | 63 | global $modx_lang_attribute; |
64 | 64 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
65 | - } |
|
66 | - } |
|
67 | - $savethese = array(); |
|
68 | - $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
|
69 | - $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
70 | - foreach ($data as $k => $v) { |
|
71 | - switch ($k) { |
|
65 | + } |
|
66 | + } |
|
67 | + $savethese = array(); |
|
68 | + $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
|
69 | + $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
70 | + foreach ($data as $k => $v) { |
|
71 | + switch ($k) { |
|
72 | 72 | case 'settings_version':{ |
73 | 73 | if($modx->getVersionData('version')!=$data['settings_version']){ |
74 | 74 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
@@ -76,24 +76,24 @@ discard block |
||
76 | 76 | } |
77 | 77 | break; |
78 | 78 | } |
79 | - case 'error_page': |
|
80 | - case 'unauthorized_page': |
|
81 | - if (trim($v) == '' || !is_numeric($v)) { |
|
82 | - $v = $data['site_start']; |
|
83 | - } |
|
84 | - break; |
|
79 | + case 'error_page': |
|
80 | + case 'unauthorized_page': |
|
81 | + if (trim($v) == '' || !is_numeric($v)) { |
|
82 | + $v = $data['site_start']; |
|
83 | + } |
|
84 | + break; |
|
85 | 85 | |
86 | - case 'lst_custom_contenttype': |
|
87 | - case 'txt_custom_contenttype': |
|
88 | - // Skip these |
|
89 | - $k = ''; |
|
90 | - break; |
|
91 | - case 'rb_base_dir': |
|
92 | - case 'rb_base_url': |
|
93 | - case 'filemanager_path': |
|
94 | - $v = trim($v); |
|
95 | - $v = rtrim($v,'/') . '/'; |
|
96 | - break; |
|
86 | + case 'lst_custom_contenttype': |
|
87 | + case 'txt_custom_contenttype': |
|
88 | + // Skip these |
|
89 | + $k = ''; |
|
90 | + break; |
|
91 | + case 'rb_base_dir': |
|
92 | + case 'rb_base_url': |
|
93 | + case 'filemanager_path': |
|
94 | + $v = trim($v); |
|
95 | + $v = rtrim($v,'/') . '/'; |
|
96 | + break; |
|
97 | 97 | case 'manager_language': |
98 | 98 | $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
99 | 99 | $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
@@ -101,47 +101,47 @@ discard block |
||
101 | 101 | if($langDir !== $langFileDir || !file_exists($langFile)) { |
102 | 102 | $v = 'english'; |
103 | 103 | } |
104 | - break; |
|
105 | - case 'smtppw': |
|
106 | - if ($v !== '********************' && $v !== '') { |
|
107 | - $v = trim($v); |
|
108 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
109 | - $v = str_replace('=','%',$v); |
|
110 | - } elseif ($v === '********************') { |
|
111 | - $k = ''; |
|
112 | - } |
|
113 | - break; |
|
114 | - case 'session_timeout': |
|
115 | - $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
116 | - $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
117 | - break; |
|
118 | - default: |
|
119 | - break; |
|
120 | - } |
|
121 | - $v = is_array($v) ? implode(",", $v) : $v; |
|
104 | + break; |
|
105 | + case 'smtppw': |
|
106 | + if ($v !== '********************' && $v !== '') { |
|
107 | + $v = trim($v); |
|
108 | + $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
109 | + $v = str_replace('=','%',$v); |
|
110 | + } elseif ($v === '********************') { |
|
111 | + $k = ''; |
|
112 | + } |
|
113 | + break; |
|
114 | + case 'session_timeout': |
|
115 | + $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
116 | + $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
117 | + break; |
|
118 | + default: |
|
119 | + break; |
|
120 | + } |
|
121 | + $v = is_array($v) ? implode(",", $v) : $v; |
|
122 | 122 | |
123 | - $modx->config[$k] = $v; |
|
123 | + $modx->config[$k] = $v; |
|
124 | 124 | |
125 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
126 | - } |
|
125 | + if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
126 | + } |
|
127 | 127 | |
128 | - // Run a single query to save all the values |
|
129 | - $sql = "REPLACE INTO ".$modx->getDatabase()->getFullTableName("system_settings")." (setting_name, setting_value) |
|
128 | + // Run a single query to save all the values |
|
129 | + $sql = "REPLACE INTO ".$modx->getDatabase()->getFullTableName("system_settings")." (setting_name, setting_value) |
|
130 | 130 | VALUES ".implode(', ', $savethese); |
131 | - $modx->getDatabase()->query($sql); |
|
131 | + $modx->getDatabase()->query($sql); |
|
132 | 132 | |
133 | - // Reset Template Pages |
|
134 | - if (isset($data['reset_template'])) { |
|
135 | - $newtemplate = (int)$data['default_template']; |
|
136 | - $oldtemplate = (int)$data['old_template']; |
|
137 | - $tbl = $modx->getDatabase()->getFullTableName('site_content'); |
|
138 | - $reset = $data['reset_template']; |
|
139 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
140 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
141 | - } |
|
133 | + // Reset Template Pages |
|
134 | + if (isset($data['reset_template'])) { |
|
135 | + $newtemplate = (int)$data['default_template']; |
|
136 | + $oldtemplate = (int)$data['old_template']; |
|
137 | + $tbl = $modx->getDatabase()->getFullTableName('site_content'); |
|
138 | + $reset = $data['reset_template']; |
|
139 | + if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
140 | + else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
141 | + } |
|
142 | 142 | |
143 | - // empty cache |
|
144 | - $modx->clearCache('full'); |
|
143 | + // empty cache |
|
144 | + $modx->clearCache('full'); |
|
145 | 145 | } |
146 | 146 | $header="Location: index.php?a=7&r=10"; |
147 | 147 | header($header); |
@@ -1,46 +1,46 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | -if(!$modx->hasPermission('settings')) { |
|
5 | +if (!$modx->hasPermission('settings')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | $data = $_POST; |
9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
10 | 10 | unset($_POST); |
11 | 11 | |
12 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
12 | +if ($data['friendly_urls'] === '1' && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') === false) |
|
13 | 13 | { |
14 | - $htaccess = MODX_BASE_PATH . '.htaccess'; |
|
15 | - $sample_htaccess = MODX_BASE_PATH . 'ht.access'; |
|
16 | - $dir = '/' . trim(MODX_BASE_URL,'/'); |
|
17 | - if(is_file($htaccess)) |
|
14 | + $htaccess = MODX_BASE_PATH.'.htaccess'; |
|
15 | + $sample_htaccess = MODX_BASE_PATH.'ht.access'; |
|
16 | + $dir = '/'.trim(MODX_BASE_URL, '/'); |
|
17 | + if (is_file($htaccess)) |
|
18 | 18 | { |
19 | 19 | $_ = file_get_contents($htaccess); |
20 | - if(strpos($_,'RewriteBase')===false) |
|
20 | + if (strpos($_, 'RewriteBase') === false) |
|
21 | 21 | { |
22 | 22 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
23 | 23 | } |
24 | - elseif(is_writable($htaccess)) |
|
24 | + elseif (is_writable($htaccess)) |
|
25 | 25 | { |
26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | - if(!@file_put_contents($htaccess,$_)) |
|
26 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
27 | + if (!@file_put_contents($htaccess, $_)) |
|
28 | 28 | { |
29 | 29 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
33 | - elseif(is_file($sample_htaccess)) |
|
33 | + elseif (is_file($sample_htaccess)) |
|
34 | 34 | { |
35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
35 | + if (!@rename($sample_htaccess, $htaccess)) |
|
36 | 36 | { |
37 | 37 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
38 | 38 | } |
39 | - elseif(MODX_BASE_URL!=='/') |
|
39 | + elseif (MODX_BASE_URL !== '/') |
|
40 | 40 | { |
41 | 41 | $_ = file_get_contents($htaccess); |
42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | - if(!@file_put_contents($htaccess,$_)) |
|
42 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
43 | + if (!@file_put_contents($htaccess, $_)) |
|
44 | 44 | { |
45 | 45 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
46 | 46 | } |
@@ -48,17 +48,17 @@ discard block |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | -if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
52 | - unlink(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css'); |
|
51 | +if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
52 | + unlink(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css'); |
|
53 | 53 | } |
54 | 54 | |
55 | -$data['filemanager_path'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['filemanager_path']); |
|
56 | -$data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
|
55 | +$data['filemanager_path'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['filemanager_path']); |
|
56 | +$data['rb_base_dir'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['rb_base_dir']); |
|
57 | 57 | |
58 | 58 | if (isset($data) && count($data) > 0) { |
59 | - if(isset($data['manager_language'])) { |
|
60 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
61 | - if(is_file($lang_path)) { |
|
59 | + if (isset($data['manager_language'])) { |
|
60 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'.$data['manager_language'].'.inc.php'; |
|
61 | + if (is_file($lang_path)) { |
|
62 | 62 | include $lang_path; |
63 | 63 | global $modx_lang_attribute; |
64 | 64 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | } |
67 | 67 | $savethese = array(); |
68 | 68 | $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
69 | - $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
69 | + $data['mail_check_timeperiod'] = (int) $data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
70 | 70 | foreach ($data as $k => $v) { |
71 | 71 | switch ($k) { |
72 | 72 | case 'settings_version':{ |
73 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
74 | - $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
|
73 | + if ($modx->getVersionData('version') != $data['settings_version']) { |
|
74 | + $modx->logEvent(17, 2, '<pre>'.var_export($data['settings_version'], true).'</pre>', 'fake settings_version'); |
|
75 | 75 | $v = $modx->getVersionData('version'); |
76 | 76 | } |
77 | 77 | break; |
@@ -92,28 +92,28 @@ discard block |
||
92 | 92 | case 'rb_base_url': |
93 | 93 | case 'filemanager_path': |
94 | 94 | $v = trim($v); |
95 | - $v = rtrim($v,'/') . '/'; |
|
95 | + $v = rtrim($v, '/').'/'; |
|
96 | 96 | break; |
97 | 97 | case 'manager_language': |
98 | - $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
|
99 | - $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
|
98 | + $langDir = realpath(MODX_MANAGER_PATH.'includes/lang'); |
|
99 | + $langFile = realpath(MODX_MANAGER_PATH.'includes/lang/'.$v.'.inc.php'); |
|
100 | 100 | $langFileDir = dirname($langFile); |
101 | - if($langDir !== $langFileDir || !file_exists($langFile)) { |
|
101 | + if ($langDir !== $langFileDir || !file_exists($langFile)) { |
|
102 | 102 | $v = 'english'; |
103 | 103 | } |
104 | 104 | break; |
105 | 105 | case 'smtppw': |
106 | 106 | if ($v !== '********************' && $v !== '') { |
107 | 107 | $v = trim($v); |
108 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
109 | - $v = str_replace('=','%',$v); |
|
108 | + $v = base64_encode($v).substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
109 | + $v = str_replace('=', '%', $v); |
|
110 | 110 | } elseif ($v === '********************') { |
111 | 111 | $k = ''; |
112 | 112 | } |
113 | 113 | break; |
114 | 114 | case 'session_timeout': |
115 | 115 | $mail_check_timeperiod = $data['mail_check_timeperiod']; |
116 | - $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
116 | + $v = (int) $v < ($data['mail_check_timeperiod'] / 60 + 1) ? ($data['mail_check_timeperiod'] / 60 + 1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
117 | 117 | break; |
118 | 118 | default: |
119 | 119 | break; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | $modx->config[$k] = $v; |
124 | 124 | |
125 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
125 | + if (!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | // Run a single query to save all the values |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | |
133 | 133 | // Reset Template Pages |
134 | 134 | if (isset($data['reset_template'])) { |
135 | - $newtemplate = (int)$data['default_template']; |
|
136 | - $oldtemplate = (int)$data['old_template']; |
|
135 | + $newtemplate = (int) $data['default_template']; |
|
136 | + $oldtemplate = (int) $data['old_template']; |
|
137 | 137 | $tbl = $modx->getDatabase()->getFullTableName('site_content'); |
138 | 138 | $reset = $data['reset_template']; |
139 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
140 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
139 | + if ($reset == 1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
140 | + else if ($reset == 2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | // empty cache |
144 | 144 | $modx->clearCache('full'); |
145 | 145 | } |
146 | -$header="Location: index.php?a=7&r=10"; |
|
146 | +$header = "Location: index.php?a=7&r=10"; |
|
147 | 147 | header($header); |
@@ -1,64 +1,52 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | -if(!$modx->hasPermission('settings')) { |
|
5 | +if(!$modx->hasPermission('settings')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | $data = $_POST; |
9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
10 | 10 | unset($_POST); |
11 | 11 | |
12 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
13 | -{ |
|
12 | +if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) { |
|
14 | 13 | $htaccess = MODX_BASE_PATH . '.htaccess'; |
15 | 14 | $sample_htaccess = MODX_BASE_PATH . 'ht.access'; |
16 | 15 | $dir = '/' . trim(MODX_BASE_URL,'/'); |
17 | - if(is_file($htaccess)) |
|
18 | - { |
|
16 | + if(is_file($htaccess)) { |
|
19 | 17 | $_ = file_get_contents($htaccess); |
20 | - if(strpos($_,'RewriteBase')===false) |
|
21 | - { |
|
18 | + if(strpos($_,'RewriteBase')===false) { |
|
22 | 19 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
23 | - } |
|
24 | - elseif(is_writable($htaccess)) |
|
25 | - { |
|
20 | + } elseif(is_writable($htaccess)) { |
|
26 | 21 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
27 | - if(!@file_put_contents($htaccess,$_)) |
|
28 | - { |
|
22 | + if(!@file_put_contents($htaccess,$_)) { |
|
29 | 23 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
30 | 24 | } |
31 | 25 | } |
32 | - } |
|
33 | - elseif(is_file($sample_htaccess)) |
|
34 | - { |
|
35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
36 | - { |
|
26 | + } elseif(is_file($sample_htaccess)) { |
|
27 | + if(!@rename($sample_htaccess,$htaccess)) { |
|
37 | 28 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
38 | - } |
|
39 | - elseif(MODX_BASE_URL!=='/') |
|
40 | - { |
|
29 | + } elseif(MODX_BASE_URL!=='/') { |
|
41 | 30 | $_ = file_get_contents($htaccess); |
42 | 31 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
43 | - if(!@file_put_contents($htaccess,$_)) |
|
44 | - { |
|
32 | + if(!@file_put_contents($htaccess,$_)) { |
|
45 | 33 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
46 | 34 | } |
47 | 35 | } |
48 | 36 | } |
49 | 37 | } |
50 | 38 | |
51 | -if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
39 | +if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
52 | 40 | unlink(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css'); |
53 | 41 | } |
54 | 42 | |
55 | 43 | $data['filemanager_path'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['filemanager_path']); |
56 | 44 | $data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
57 | 45 | |
58 | -if (isset($data) && count($data) > 0) { |
|
59 | - if(isset($data['manager_language'])) { |
|
46 | +if (isset($data) && count($data) > 0) { |
|
47 | + if(isset($data['manager_language'])) { |
|
60 | 48 | $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
61 | - if(is_file($lang_path)) { |
|
49 | + if(is_file($lang_path)) { |
|
62 | 50 | include $lang_path; |
63 | 51 | global $modx_lang_attribute; |
64 | 52 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
@@ -67,10 +55,10 @@ discard block |
||
67 | 55 | $savethese = array(); |
68 | 56 | $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
69 | 57 | $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
70 | - foreach ($data as $k => $v) { |
|
71 | - switch ($k) { |
|
58 | + foreach ($data as $k => $v) { |
|
59 | + switch ($k) { |
|
72 | 60 | case 'settings_version':{ |
73 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
61 | + if($modx->getVersionData('version')!=$data['settings_version']) { |
|
74 | 62 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
75 | 63 | $v = $modx->getVersionData('version'); |
76 | 64 | } |
@@ -78,7 +66,7 @@ discard block |
||
78 | 66 | } |
79 | 67 | case 'error_page': |
80 | 68 | case 'unauthorized_page': |
81 | - if (trim($v) == '' || !is_numeric($v)) { |
|
69 | + if (trim($v) == '' || !is_numeric($v)) { |
|
82 | 70 | $v = $data['site_start']; |
83 | 71 | } |
84 | 72 | break; |
@@ -98,16 +86,16 @@ discard block |
||
98 | 86 | $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
99 | 87 | $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
100 | 88 | $langFileDir = dirname($langFile); |
101 | - if($langDir !== $langFileDir || !file_exists($langFile)) { |
|
89 | + if($langDir !== $langFileDir || !file_exists($langFile)) { |
|
102 | 90 | $v = 'english'; |
103 | 91 | } |
104 | 92 | break; |
105 | 93 | case 'smtppw': |
106 | - if ($v !== '********************' && $v !== '') { |
|
94 | + if ($v !== '********************' && $v !== '') { |
|
107 | 95 | $v = trim($v); |
108 | 96 | $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
109 | 97 | $v = str_replace('=','%',$v); |
110 | - } elseif ($v === '********************') { |
|
98 | + } elseif ($v === '********************') { |
|
111 | 99 | $k = ''; |
112 | 100 | } |
113 | 101 | break; |
@@ -122,7 +110,9 @@ discard block |
||
122 | 110 | |
123 | 111 | $modx->config[$k] = $v; |
124 | 112 | |
125 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
113 | + if(!empty($k)) { |
|
114 | + $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
115 | + } |
|
126 | 116 | } |
127 | 117 | |
128 | 118 | // Run a single query to save all the values |
@@ -131,13 +121,16 @@ discard block |
||
131 | 121 | $modx->getDatabase()->query($sql); |
132 | 122 | |
133 | 123 | // Reset Template Pages |
134 | - if (isset($data['reset_template'])) { |
|
124 | + if (isset($data['reset_template'])) { |
|
135 | 125 | $newtemplate = (int)$data['default_template']; |
136 | 126 | $oldtemplate = (int)$data['old_template']; |
137 | 127 | $tbl = $modx->getDatabase()->getFullTableName('site_content'); |
138 | 128 | $reset = $data['reset_template']; |
139 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
140 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
129 | + if($reset==1) { |
|
130 | + $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
131 | + } else if($reset==2) { |
|
132 | + $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
133 | + } |
|
141 | 134 | } |
142 | 135 | |
143 | 136 | // empty cache |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } |
24 | 24 | elseif(is_writable($htaccess)) |
25 | 25 | { |
26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
26 | + $_ = preg_replace('@RewriteBase.+@',"rewritebase {$dir}", $_); |
|
27 | 27 | if(!@file_put_contents($htaccess,$_)) |
28 | 28 | { |
29 | 29 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | elseif(MODX_BASE_URL!=='/') |
40 | 40 | { |
41 | 41 | $_ = file_get_contents($htaccess); |
42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
42 | + $_ = preg_replace('@RewriteBase.+@',"rewritebase {$dir}", $_); |
|
43 | 43 | if(!@file_put_contents($htaccess,$_)) |
44 | 44 | { |
45 | 45 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | if (!$modx->hasPermission('save_template')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = (int)$_POST['id']; |
|
9 | +$id = (int) $_POST['id']; |
|
10 | 10 | $name = trim($_POST['name']); |
11 | 11 | $description = $_POST['description']; |
12 | 12 | $caption = $_POST['caption']; |
@@ -17,17 +17,17 @@ discard block |
||
17 | 17 | $display = $_POST['display']; |
18 | 18 | $params = $_POST['params']; |
19 | 19 | $locked = isset($_POST['locked']) && $_POST['locked'] == 'on' ? 1 : 0; |
20 | -$origin = isset($_REQUEST['or']) ? (int)$_REQUEST['or'] : 76; |
|
21 | -$originId = isset($_REQUEST['oid']) ? (int)$_REQUEST['oid'] : null; |
|
20 | +$origin = isset($_REQUEST['or']) ? (int) $_REQUEST['or'] : 76; |
|
21 | +$originId = isset($_REQUEST['oid']) ? (int) $_REQUEST['oid'] : null; |
|
22 | 22 | $currentdate = time() + $modx->config['server_offset_time']; |
23 | 23 | |
24 | 24 | //Kyle Jaebker - added category support |
25 | 25 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
26 | - $categoryid = (int)$_POST['categoryid']; |
|
26 | + $categoryid = (int) $_POST['categoryid']; |
|
27 | 27 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
28 | 28 | $categoryid = 0; |
29 | 29 | } else { |
30 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
30 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
31 | 31 | $categoryid = checkCategory($_POST['newcategory']); |
32 | 32 | if (!$categoryid) { |
33 | 33 | $categoryid = newCategory($_POST['newcategory']); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | 'createdon' => $currentdate, |
75 | 75 | 'editedon' => $currentdate |
76 | 76 | ); |
77 | - $tmplVar= EvolutionCMS\Models\SiteTmplvar::create($field); |
|
77 | + $tmplVar = EvolutionCMS\Models\SiteTmplvar::create($field); |
|
78 | 78 | $newid = $tmplVar->getKey(); |
79 | 79 | |
80 | 80 | // save access permissions |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // finished emptying cache - redirect |
97 | 97 | if ($_POST['stay'] != '') { |
98 | 98 | $a = ($_POST['stay'] == '2') ? "301&id=$newid" : "300"; |
99 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
99 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
100 | 100 | header($header); |
101 | 101 | } else { |
102 | 102 | $header = "Location: index.php?a=76&r=2"; |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | // finished emptying cache - redirect |
159 | 159 | if ($_POST['stay'] != '') { |
160 | 160 | $a = ($_POST['stay'] == '2') ? "301&id=$id" : "300"; |
161 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'] . "&or=" . $origin . "&oid=" . $originId; |
|
161 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']."&or=".$origin."&oid=".$originId; |
|
162 | 162 | header($header); |
163 | 163 | } else { |
164 | 164 | $modx->unlockElement(2, $id); |
165 | - $header = "Location: index.php?a=" . $origin . "&r=2" . (empty($originId) ? '' : '&id=' . $originId); |
|
165 | + $header = "Location: index.php?a=".$origin."&r=2".(empty($originId) ? '' : '&id='.$originId); |
|
166 | 166 | header($header); |
167 | 167 | } |
168 | 168 |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
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 | if(!$modx->hasPermission('delete_template')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
10 | 10 | if($id == 0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // delete the template, but first check it doesn't have any documents using it |
15 | 15 | $rs = $modx->getDatabase()->select('id, pagetitle,introtext', $modx->getDatabase()->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->getDatabase()->getRecordCount($rs); |
17 | 17 | if($limit > 0) { |
18 | - include MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
19 | - ?> |
|
18 | + include MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
19 | + ?> |
|
20 | 20 | |
21 | 21 | <h1><?php echo $_lang['manage_templates']; ?></h1> |
22 | 22 | |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | <p>Documents using this template:</p> |
29 | 29 | <ul> |
30 | 30 | <?php |
31 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
32 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
33 | - } |
|
34 | - ?> |
|
31 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
32 | + echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
33 | + } |
|
34 | + ?> |
|
35 | 35 | </ul> |
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | <?php |
39 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
40 | - exit; |
|
39 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
40 | + exit; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if($id == $default_template) { |
44 | - $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
|
44 | + $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set the item name for logger |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | |
51 | 51 | // invoke OnBeforeTempFormDelete event |
52 | 52 | $modx->invokeEvent("OnBeforeTempFormDelete", array( |
53 | - "id" => $id |
|
54 | - )); |
|
53 | + "id" => $id |
|
54 | + )); |
|
55 | 55 | |
56 | 56 | // delete the document. |
57 | 57 | $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'"); |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | // invoke OnTempFormDelete event |
62 | 62 | $modx->invokeEvent("OnTempFormDelete", array( |
63 | - "id" => $id |
|
64 | - )); |
|
63 | + "id" => $id |
|
64 | + )); |
|
65 | 65 | |
66 | 66 | // empty cache |
67 | 67 | $modx->clearCache('full'); |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | -if(!$modx->hasPermission('delete_template')) { |
|
5 | +if (!$modx->hasPermission('delete_template')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id']) ? (int)$_GET['id'] : 0; |
|
10 | -if($id == 0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // delete the template, but first check it doesn't have any documents using it |
15 | 15 | $rs = $modx->getDatabase()->select('id, pagetitle,introtext', $modx->getDatabase()->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->getDatabase()->getRecordCount($rs); |
17 | -if($limit > 0) { |
|
18 | - include MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
17 | +if ($limit > 0) { |
|
18 | + include MODX_MANAGER_PATH."includes/header.inc.php"; |
|
19 | 19 | ?> |
20 | 20 | |
21 | 21 | <h1><?php echo $_lang['manage_templates']; ?></h1> |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | <p>Documents using this template:</p> |
29 | 29 | <ul> |
30 | 30 | <?php |
31 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
32 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
31 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
32 | + echo '<li><span style="width: 200px"><a href="index.php?id='.$row['id'].'&a=27">'.$row['pagetitle'].'</a></span>'.($row['introtext'] != '' ? ' - '.$row['introtext'] : '').'</li>'; |
|
33 | 33 | } |
34 | 34 | ?> |
35 | 35 | </ul> |
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | <?php |
39 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
39 | + include_once MODX_MANAGER_PATH."includes/footer.inc.php"; |
|
40 | 40 | exit; |
41 | 41 | } |
42 | 42 | |
43 | -if($id == $default_template) { |
|
43 | +if ($id == $default_template) { |
|
44 | 44 | $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
45 | 45 | } |
46 | 46 |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
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 | if (!$modx->hasPermission('save_web_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $input = $_POST; |
10 | 10 | foreach ($input as $k => $v) { |
11 | 11 | if ($k !== 'comment' && $k !== 'user_groups') { |
12 | - $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES); |
|
13 | - } |
|
14 | - $input[$k] = $v; |
|
12 | + $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES); |
|
13 | + } |
|
14 | + $input[$k] = $v; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | $id = (int)$input['id']; |
@@ -45,81 +45,81 @@ discard block |
||
45 | 45 | |
46 | 46 | // verify password |
47 | 47 | if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
48 | - webAlertAndQuit("Password typed is mismatched", 88); |
|
48 | + webAlertAndQuit("Password typed is mismatched", 88); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // verify email |
52 | 52 | if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
53 | - webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
|
53 | + webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | switch ($input['mode']) { |
57 | - case '87' : // new user |
|
58 | - // check if this user name already exist |
|
59 | - if (EvolutionCMS\Models\WebUser::where('username', '=', $newusername)->first()) { |
|
60 | - webAlertAndQuit("User name is already in use!", 88); |
|
61 | - } |
|
62 | - |
|
63 | - // check if the email address already exist |
|
64 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
65 | - if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
66 | - webAlertAndQuit("Email is already in use!", 88); |
|
67 | - } |
|
68 | - } |
|
69 | - |
|
70 | - // generate a new password for this user |
|
57 | + case '87' : // new user |
|
58 | + // check if this user name already exist |
|
59 | + if (EvolutionCMS\Models\WebUser::where('username', '=', $newusername)->first()) { |
|
60 | + webAlertAndQuit("User name is already in use!", 88); |
|
61 | + } |
|
62 | + |
|
63 | + // check if the email address already exist |
|
64 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
65 | + if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
66 | + webAlertAndQuit("Email is already in use!", 88); |
|
67 | + } |
|
68 | + } |
|
69 | + |
|
70 | + // generate a new password for this user |
|
71 | 71 | if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
72 | 72 | if (strlen($specifiedpassword) < 6) { |
73 | - webAlertAndQuit("Password is too short!", 88); |
|
74 | - } else { |
|
75 | - $newpassword = $specifiedpassword; |
|
76 | - } |
|
73 | + webAlertAndQuit("Password is too short!", 88); |
|
74 | + } else { |
|
75 | + $newpassword = $specifiedpassword; |
|
76 | + } |
|
77 | 77 | } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
78 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
78 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
79 | 79 | } elseif ($passwordgenmethod == 'g') { |
80 | - $newpassword = generate_password(8); |
|
81 | - } else { |
|
82 | - webAlertAndQuit("No password generation method specified!", 88); |
|
83 | - } |
|
84 | - |
|
85 | - // invoke OnBeforeWUsrFormSave event |
|
86 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
87 | - "mode" => "new", |
|
88 | - )); |
|
89 | - |
|
90 | - // create the user account |
|
91 | - $field = array(); |
|
92 | - $field['username'] = $newusername; |
|
93 | - $field['password'] = md5($newpassword); |
|
94 | - $webUser= EvolutionCMS\Models\WebUser::create($field); |
|
95 | - $internalKey = $webUser->getKey(); |
|
96 | - $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
97 | - $webUser->attributes()->create($field); |
|
80 | + $newpassword = generate_password(8); |
|
81 | + } else { |
|
82 | + webAlertAndQuit("No password generation method specified!", 88); |
|
83 | + } |
|
84 | + |
|
85 | + // invoke OnBeforeWUsrFormSave event |
|
86 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
87 | + "mode" => "new", |
|
88 | + )); |
|
89 | + |
|
90 | + // create the user account |
|
91 | + $field = array(); |
|
92 | + $field['username'] = $newusername; |
|
93 | + $field['password'] = md5($newpassword); |
|
94 | + $webUser= EvolutionCMS\Models\WebUser::create($field); |
|
95 | + $internalKey = $webUser->getKey(); |
|
96 | + $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
97 | + $webUser->attributes()->create($field); |
|
98 | 98 | |
99 | 99 | $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', |
100 | 100 | 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
101 | 101 | $field = $modx->db->escape($field); |
102 | 102 | $modx->db->insert($field, $tbl_web_user_attributes); |
103 | 103 | |
104 | - // Save User Settings |
|
104 | + // Save User Settings |
|
105 | 105 | saveWebUserSettings($internalKey); |
106 | 106 | |
107 | - // Set the item name for logger |
|
108 | - $_SESSION['itemname'] = $newusername; |
|
109 | - |
|
110 | - /*******************************************************************************/ |
|
111 | - // put the user in the user_groups he/ she should be in |
|
112 | - // first, check that up_perms are switched on! |
|
113 | - if($modx->getConfig('use_udperms') == 1) { |
|
114 | - if(!empty($user_groups)) { |
|
115 | - for($i = 0; $i < count($user_groups); $i++) { |
|
116 | - $field = array(); |
|
117 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
118 | - $webUser->memberGroups()->create($field); |
|
119 | - } |
|
120 | - } |
|
121 | - } |
|
122 | - // end of user_groups stuff! |
|
107 | + // Set the item name for logger |
|
108 | + $_SESSION['itemname'] = $newusername; |
|
109 | + |
|
110 | + /*******************************************************************************/ |
|
111 | + // put the user in the user_groups he/ she should be in |
|
112 | + // first, check that up_perms are switched on! |
|
113 | + if($modx->getConfig('use_udperms') == 1) { |
|
114 | + if(!empty($user_groups)) { |
|
115 | + for($i = 0; $i < count($user_groups); $i++) { |
|
116 | + $field = array(); |
|
117 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
118 | + $webUser->memberGroups()->create($field); |
|
119 | + } |
|
120 | + } |
|
121 | + } |
|
122 | + // end of user_groups stuff! |
|
123 | 123 | |
124 | 124 | // invoke OnWebSaveUser event |
125 | 125 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -140,23 +140,23 @@ discard block |
||
140 | 140 | if ($passwordnotifymethod == 'e') { |
141 | 141 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
142 | 142 | if ($input['stay'] != '') { |
143 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
144 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
145 | - header($header); |
|
146 | - } else { |
|
147 | - $header = "Location: index.php?a=99&r=2"; |
|
148 | - header($header); |
|
149 | - } |
|
150 | - } else { |
|
143 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
144 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
145 | + header($header); |
|
146 | + } else { |
|
147 | + $header = "Location: index.php?a=99&r=2"; |
|
148 | + header($header); |
|
149 | + } |
|
150 | + } else { |
|
151 | 151 | if ($input['stay'] != '') { |
152 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
153 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
154 | - } else { |
|
155 | - $stayUrl = "index.php?a=99&r=2"; |
|
156 | - } |
|
152 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
153 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
154 | + } else { |
|
155 | + $stayUrl = "index.php?a=99&r=2"; |
|
156 | + } |
|
157 | 157 | |
158 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
159 | - ?> |
|
158 | + include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
159 | + ?> |
|
160 | 160 | |
161 | 161 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
162 | 162 | |
@@ -178,83 +178,83 @@ discard block |
||
178 | 178 | </div> |
179 | 179 | <?php |
180 | 180 | |
181 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
182 | - } |
|
183 | - break; |
|
184 | - case '88' : // edit user |
|
185 | - // generate a new password for this user |
|
181 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
182 | + } |
|
183 | + break; |
|
184 | + case '88' : // edit user |
|
185 | + // generate a new password for this user |
|
186 | 186 | if ($genpassword == 1) { |
187 | 187 | if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
188 | 188 | if (strlen($specifiedpassword) < 6) { |
189 | - webAlertAndQuit("Password is too short!", 88); |
|
190 | - } else { |
|
191 | - $newpassword = $specifiedpassword; |
|
192 | - } |
|
189 | + webAlertAndQuit("Password is too short!", 88); |
|
190 | + } else { |
|
191 | + $newpassword = $specifiedpassword; |
|
192 | + } |
|
193 | 193 | } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
194 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
194 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
195 | 195 | } elseif ($passwordgenmethod == 'g') { |
196 | - $newpassword = generate_password(8); |
|
197 | - } else { |
|
198 | - webAlertAndQuit("No password generation method specified!", 88); |
|
199 | - } |
|
200 | - } |
|
196 | + $newpassword = generate_password(8); |
|
197 | + } else { |
|
198 | + webAlertAndQuit("No password generation method specified!", 88); |
|
199 | + } |
|
200 | + } |
|
201 | 201 | if ($passwordnotifymethod == 'e') { |
202 | 202 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
203 | - } |
|
204 | - |
|
205 | - // check if the username already exist |
|
206 | - if (EvolutionCMS\Models\WebUser::where('id', '!=', $id)->where('username', '=', $newusername)->first()) { |
|
207 | - webAlertAndQuit("User name is already in use!", 88); |
|
208 | - } |
|
209 | - |
|
210 | - // check if the email address already exists |
|
211 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
212 | - if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
213 | - webAlertAndQuit("Email is already in use!", 88); |
|
214 | - } |
|
215 | - } |
|
216 | - |
|
217 | - // invoke OnBeforeWUsrFormSave event |
|
218 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
219 | - "mode" => "upd", |
|
220 | - "id" => $id |
|
221 | - )); |
|
222 | - |
|
223 | - // update user name and password |
|
224 | - $field = array(); |
|
225 | - $field['username'] = $newusername; |
|
203 | + } |
|
204 | + |
|
205 | + // check if the username already exist |
|
206 | + if (EvolutionCMS\Models\WebUser::where('id', '!=', $id)->where('username', '=', $newusername)->first()) { |
|
207 | + webAlertAndQuit("User name is already in use!", 88); |
|
208 | + } |
|
209 | + |
|
210 | + // check if the email address already exists |
|
211 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
212 | + if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
213 | + webAlertAndQuit("Email is already in use!", 88); |
|
214 | + } |
|
215 | + } |
|
216 | + |
|
217 | + // invoke OnBeforeWUsrFormSave event |
|
218 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
219 | + "mode" => "upd", |
|
220 | + "id" => $id |
|
221 | + )); |
|
222 | + |
|
223 | + // update user name and password |
|
224 | + $field = array(); |
|
225 | + $field['username'] = $newusername; |
|
226 | 226 | if ($genpassword == 1) { |
227 | - $field['password'] = md5($newpassword); |
|
228 | - } |
|
229 | - $webUser = EvolutionCMS\Models\WebUser::find($id); |
|
230 | - $webUser->update($field); |
|
227 | + $field['password'] = md5($newpassword); |
|
228 | + } |
|
229 | + $webUser = EvolutionCMS\Models\WebUser::find($id); |
|
230 | + $webUser->update($field); |
|
231 | 231 | $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', |
232 | 232 | 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', |
233 | 233 | 'blockedafter'); |
234 | - $webUser->attributes->update($field); |
|
234 | + $webUser->attributes->update($field); |
|
235 | 235 | |
236 | - // Save User Settings |
|
236 | + // Save User Settings |
|
237 | 237 | saveWebUserSettings($id); |
238 | 238 | |
239 | - // Set the item name for logger |
|
240 | - $_SESSION['itemname'] = $newusername; |
|
239 | + // Set the item name for logger |
|
240 | + $_SESSION['itemname'] = $newusername; |
|
241 | 241 | |
242 | - /*******************************************************************************/ |
|
243 | - // put the user in the user_groups he/ she should be in |
|
244 | - // first, check that up_perms are switched on! |
|
245 | - if($modx->getConfig('use_udperms') == 1) { |
|
246 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
247 | - $webUser->memberGroups()->delete(); |
|
242 | + /*******************************************************************************/ |
|
243 | + // put the user in the user_groups he/ she should be in |
|
244 | + // first, check that up_perms are switched on! |
|
245 | + if($modx->getConfig('use_udperms') == 1) { |
|
246 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
247 | + $webUser->memberGroups()->delete(); |
|
248 | 248 | if (!empty($user_groups)) { |
249 | 249 | for ($i = 0; $i < count($user_groups); $i++) { |
250 | - $field = array(); |
|
251 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
252 | - $webUser->memberGroups()->create($field); |
|
253 | - } |
|
254 | - } |
|
255 | - } |
|
256 | - // end of user_groups stuff! |
|
257 | - /*******************************************************************************/ |
|
250 | + $field = array(); |
|
251 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
252 | + $webUser->memberGroups()->create($field); |
|
253 | + } |
|
254 | + } |
|
255 | + } |
|
256 | + // end of user_groups stuff! |
|
257 | + /*******************************************************************************/ |
|
258 | 258 | |
259 | 259 | // invoke OnWebSaveUser event |
260 | 260 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | |
286 | 286 | if ($genpassword == 1 && $passwordnotifymethod == 's') { |
287 | 287 | if ($input['stay'] != '') { |
288 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
289 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
290 | - } else { |
|
291 | - $stayUrl = "index.php?a=99&r=2"; |
|
292 | - } |
|
288 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
289 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
290 | + } else { |
|
291 | + $stayUrl = "index.php?a=99&r=2"; |
|
292 | + } |
|
293 | 293 | |
294 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
295 | - ?> |
|
294 | + include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
295 | + ?> |
|
296 | 296 | |
297 | 297 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
298 | 298 | |
@@ -312,18 +312,18 @@ discard block |
||
312 | 312 | </div> |
313 | 313 | <?php |
314 | 314 | |
315 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
316 | - } else { |
|
315 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
316 | + } else { |
|
317 | 317 | if ($input['stay'] != '') { |
318 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
319 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
320 | - header($header); |
|
321 | - } else { |
|
322 | - $header = "Location: index.php?a=99&r=2"; |
|
323 | - header($header); |
|
324 | - } |
|
325 | - } |
|
326 | - break; |
|
327 | - default : |
|
328 | - webAlertAndQuit("No operation set in request.", 88); |
|
318 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
319 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
320 | + header($header); |
|
321 | + } else { |
|
322 | + $header = "Location: index.php?a=99&r=2"; |
|
323 | + header($header); |
|
324 | + } |
|
325 | + } |
|
326 | + break; |
|
327 | + default : |
|
328 | + webAlertAndQuit("No operation set in request.", 88); |
|
329 | 329 | } |
@@ -54,109 +54,109 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | switch ($input['mode']) { |
57 | - case '87' : // new user |
|
58 | - // check if this user name already exist |
|
59 | - if (EvolutionCMS\Models\WebUser::where('username', '=', $newusername)->first()) { |
|
60 | - webAlertAndQuit("User name is already in use!", 88); |
|
61 | - } |
|
62 | - |
|
63 | - // check if the email address already exist |
|
64 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
65 | - if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
66 | - webAlertAndQuit("Email is already in use!", 88); |
|
67 | - } |
|
68 | - } |
|
69 | - |
|
70 | - // generate a new password for this user |
|
71 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
72 | - if (strlen($specifiedpassword) < 6) { |
|
73 | - webAlertAndQuit("Password is too short!", 88); |
|
74 | - } else { |
|
75 | - $newpassword = $specifiedpassword; |
|
76 | - } |
|
77 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
78 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
79 | - } elseif ($passwordgenmethod == 'g') { |
|
80 | - $newpassword = generate_password(8); |
|
81 | - } else { |
|
82 | - webAlertAndQuit("No password generation method specified!", 88); |
|
83 | - } |
|
84 | - |
|
85 | - // invoke OnBeforeWUsrFormSave event |
|
86 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
87 | - "mode" => "new", |
|
88 | - )); |
|
89 | - |
|
90 | - // create the user account |
|
91 | - $field = array(); |
|
92 | - $field['username'] = $newusername; |
|
93 | - $field['password'] = md5($newpassword); |
|
94 | - $webUser= EvolutionCMS\Models\WebUser::create($field); |
|
95 | - $internalKey = $webUser->getKey(); |
|
96 | - $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
97 | - $webUser->attributes()->create($field); |
|
98 | - |
|
99 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', |
|
100 | - 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
101 | - $field = $modx->db->escape($field); |
|
102 | - $modx->db->insert($field, $tbl_web_user_attributes); |
|
103 | - |
|
104 | - // Save User Settings |
|
105 | - saveWebUserSettings($internalKey); |
|
106 | - |
|
107 | - // Set the item name for logger |
|
108 | - $_SESSION['itemname'] = $newusername; |
|
109 | - |
|
110 | - /*******************************************************************************/ |
|
111 | - // put the user in the user_groups he/ she should be in |
|
112 | - // first, check that up_perms are switched on! |
|
113 | - if($modx->getConfig('use_udperms') == 1) { |
|
114 | - if(!empty($user_groups)) { |
|
115 | - for($i = 0; $i < count($user_groups); $i++) { |
|
116 | - $field = array(); |
|
117 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
118 | - $webUser->memberGroups()->create($field); |
|
119 | - } |
|
120 | - } |
|
121 | - } |
|
122 | - // end of user_groups stuff! |
|
123 | - |
|
124 | - // invoke OnWebSaveUser event |
|
125 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
126 | - "mode" => "new", |
|
127 | - "userid" => $internalKey, |
|
128 | - "username" => $newusername, |
|
129 | - "userpassword" => $newpassword, |
|
130 | - "useremail" => $email, |
|
131 | - "userfullname" => $fullname |
|
132 | - )); |
|
133 | - |
|
134 | - // invoke OnWUsrFormSave event |
|
135 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
136 | - "mode" => "new", |
|
137 | - "id" => $internalKey |
|
138 | - )); |
|
139 | - |
|
140 | - if ($passwordnotifymethod == 'e') { |
|
141 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
|
142 | - if ($input['stay'] != '') { |
|
143 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
144 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
145 | - header($header); |
|
146 | - } else { |
|
147 | - $header = "Location: index.php?a=99&r=2"; |
|
148 | - header($header); |
|
149 | - } |
|
150 | - } else { |
|
151 | - if ($input['stay'] != '') { |
|
152 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
153 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
154 | - } else { |
|
155 | - $stayUrl = "index.php?a=99&r=2"; |
|
156 | - } |
|
157 | - |
|
158 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
159 | - ?> |
|
57 | + case '87' : // new user |
|
58 | + // check if this user name already exist |
|
59 | + if (EvolutionCMS\Models\WebUser::where('username', '=', $newusername)->first()) { |
|
60 | + webAlertAndQuit("User name is already in use!", 88); |
|
61 | + } |
|
62 | + |
|
63 | + // check if the email address already exist |
|
64 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
65 | + if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
66 | + webAlertAndQuit("Email is already in use!", 88); |
|
67 | + } |
|
68 | + } |
|
69 | + |
|
70 | + // generate a new password for this user |
|
71 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
72 | + if (strlen($specifiedpassword) < 6) { |
|
73 | + webAlertAndQuit("Password is too short!", 88); |
|
74 | + } else { |
|
75 | + $newpassword = $specifiedpassword; |
|
76 | + } |
|
77 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
78 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
79 | + } elseif ($passwordgenmethod == 'g') { |
|
80 | + $newpassword = generate_password(8); |
|
81 | + } else { |
|
82 | + webAlertAndQuit("No password generation method specified!", 88); |
|
83 | + } |
|
84 | + |
|
85 | + // invoke OnBeforeWUsrFormSave event |
|
86 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
87 | + "mode" => "new", |
|
88 | + )); |
|
89 | + |
|
90 | + // create the user account |
|
91 | + $field = array(); |
|
92 | + $field['username'] = $newusername; |
|
93 | + $field['password'] = md5($newpassword); |
|
94 | + $webUser= EvolutionCMS\Models\WebUser::create($field); |
|
95 | + $internalKey = $webUser->getKey(); |
|
96 | + $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
97 | + $webUser->attributes()->create($field); |
|
98 | + |
|
99 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', |
|
100 | + 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
101 | + $field = $modx->db->escape($field); |
|
102 | + $modx->db->insert($field, $tbl_web_user_attributes); |
|
103 | + |
|
104 | + // Save User Settings |
|
105 | + saveWebUserSettings($internalKey); |
|
106 | + |
|
107 | + // Set the item name for logger |
|
108 | + $_SESSION['itemname'] = $newusername; |
|
109 | + |
|
110 | + /*******************************************************************************/ |
|
111 | + // put the user in the user_groups he/ she should be in |
|
112 | + // first, check that up_perms are switched on! |
|
113 | + if($modx->getConfig('use_udperms') == 1) { |
|
114 | + if(!empty($user_groups)) { |
|
115 | + for($i = 0; $i < count($user_groups); $i++) { |
|
116 | + $field = array(); |
|
117 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
118 | + $webUser->memberGroups()->create($field); |
|
119 | + } |
|
120 | + } |
|
121 | + } |
|
122 | + // end of user_groups stuff! |
|
123 | + |
|
124 | + // invoke OnWebSaveUser event |
|
125 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
126 | + "mode" => "new", |
|
127 | + "userid" => $internalKey, |
|
128 | + "username" => $newusername, |
|
129 | + "userpassword" => $newpassword, |
|
130 | + "useremail" => $email, |
|
131 | + "userfullname" => $fullname |
|
132 | + )); |
|
133 | + |
|
134 | + // invoke OnWUsrFormSave event |
|
135 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
136 | + "mode" => "new", |
|
137 | + "id" => $internalKey |
|
138 | + )); |
|
139 | + |
|
140 | + if ($passwordnotifymethod == 'e') { |
|
141 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
|
142 | + if ($input['stay'] != '') { |
|
143 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
144 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
145 | + header($header); |
|
146 | + } else { |
|
147 | + $header = "Location: index.php?a=99&r=2"; |
|
148 | + header($header); |
|
149 | + } |
|
150 | + } else { |
|
151 | + if ($input['stay'] != '') { |
|
152 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
153 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
154 | + } else { |
|
155 | + $stayUrl = "index.php?a=99&r=2"; |
|
156 | + } |
|
157 | + |
|
158 | + include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
159 | + ?> |
|
160 | 160 | |
161 | 161 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
162 | 162 | |
@@ -178,121 +178,121 @@ discard block |
||
178 | 178 | </div> |
179 | 179 | <?php |
180 | 180 | |
181 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
182 | - } |
|
183 | - break; |
|
184 | - case '88' : // edit user |
|
185 | - // generate a new password for this user |
|
186 | - if ($genpassword == 1) { |
|
187 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
188 | - if (strlen($specifiedpassword) < 6) { |
|
189 | - webAlertAndQuit("Password is too short!", 88); |
|
190 | - } else { |
|
191 | - $newpassword = $specifiedpassword; |
|
192 | - } |
|
193 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
194 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
195 | - } elseif ($passwordgenmethod == 'g') { |
|
196 | - $newpassword = generate_password(8); |
|
197 | - } else { |
|
198 | - webAlertAndQuit("No password generation method specified!", 88); |
|
199 | - } |
|
200 | - } |
|
201 | - if ($passwordnotifymethod == 'e') { |
|
202 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
|
203 | - } |
|
204 | - |
|
205 | - // check if the username already exist |
|
206 | - if (EvolutionCMS\Models\WebUser::where('id', '!=', $id)->where('username', '=', $newusername)->first()) { |
|
207 | - webAlertAndQuit("User name is already in use!", 88); |
|
208 | - } |
|
209 | - |
|
210 | - // check if the email address already exists |
|
211 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
212 | - if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
213 | - webAlertAndQuit("Email is already in use!", 88); |
|
214 | - } |
|
215 | - } |
|
216 | - |
|
217 | - // invoke OnBeforeWUsrFormSave event |
|
218 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
219 | - "mode" => "upd", |
|
220 | - "id" => $id |
|
221 | - )); |
|
222 | - |
|
223 | - // update user name and password |
|
224 | - $field = array(); |
|
225 | - $field['username'] = $newusername; |
|
226 | - if ($genpassword == 1) { |
|
227 | - $field['password'] = md5($newpassword); |
|
228 | - } |
|
229 | - $webUser = EvolutionCMS\Models\WebUser::find($id); |
|
230 | - $webUser->update($field); |
|
231 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', |
|
232 | - 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', |
|
233 | - 'blockedafter'); |
|
234 | - $webUser->attributes->update($field); |
|
235 | - |
|
236 | - // Save User Settings |
|
237 | - saveWebUserSettings($id); |
|
238 | - |
|
239 | - // Set the item name for logger |
|
240 | - $_SESSION['itemname'] = $newusername; |
|
241 | - |
|
242 | - /*******************************************************************************/ |
|
243 | - // put the user in the user_groups he/ she should be in |
|
244 | - // first, check that up_perms are switched on! |
|
245 | - if($modx->getConfig('use_udperms') == 1) { |
|
246 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
247 | - $webUser->memberGroups()->delete(); |
|
248 | - if (!empty($user_groups)) { |
|
249 | - for ($i = 0; $i < count($user_groups); $i++) { |
|
250 | - $field = array(); |
|
251 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
252 | - $webUser->memberGroups()->create($field); |
|
253 | - } |
|
254 | - } |
|
255 | - } |
|
256 | - // end of user_groups stuff! |
|
257 | - /*******************************************************************************/ |
|
258 | - |
|
259 | - // invoke OnWebSaveUser event |
|
260 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
261 | - "mode" => "upd", |
|
262 | - "userid" => $id, |
|
263 | - "username" => $newusername, |
|
264 | - "userpassword" => $newpassword, |
|
265 | - "useremail" => $email, |
|
266 | - "userfullname" => $fullname, |
|
267 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
268 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
269 | - )); |
|
270 | - |
|
271 | - // invoke OnWebChangePassword event |
|
272 | - if ($genpassword == 1) { |
|
273 | - $modx->invokeEvent("OnWebChangePassword", array( |
|
181 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
182 | + } |
|
183 | + break; |
|
184 | + case '88' : // edit user |
|
185 | + // generate a new password for this user |
|
186 | + if ($genpassword == 1) { |
|
187 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
188 | + if (strlen($specifiedpassword) < 6) { |
|
189 | + webAlertAndQuit("Password is too short!", 88); |
|
190 | + } else { |
|
191 | + $newpassword = $specifiedpassword; |
|
192 | + } |
|
193 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
194 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
195 | + } elseif ($passwordgenmethod == 'g') { |
|
196 | + $newpassword = generate_password(8); |
|
197 | + } else { |
|
198 | + webAlertAndQuit("No password generation method specified!", 88); |
|
199 | + } |
|
200 | + } |
|
201 | + if ($passwordnotifymethod == 'e') { |
|
202 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
|
203 | + } |
|
204 | + |
|
205 | + // check if the username already exist |
|
206 | + if (EvolutionCMS\Models\WebUser::where('id', '!=', $id)->where('username', '=', $newusername)->first()) { |
|
207 | + webAlertAndQuit("User name is already in use!", 88); |
|
208 | + } |
|
209 | + |
|
210 | + // check if the email address already exists |
|
211 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
212 | + if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
213 | + webAlertAndQuit("Email is already in use!", 88); |
|
214 | + } |
|
215 | + } |
|
216 | + |
|
217 | + // invoke OnBeforeWUsrFormSave event |
|
218 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
219 | + "mode" => "upd", |
|
220 | + "id" => $id |
|
221 | + )); |
|
222 | + |
|
223 | + // update user name and password |
|
224 | + $field = array(); |
|
225 | + $field['username'] = $newusername; |
|
226 | + if ($genpassword == 1) { |
|
227 | + $field['password'] = md5($newpassword); |
|
228 | + } |
|
229 | + $webUser = EvolutionCMS\Models\WebUser::find($id); |
|
230 | + $webUser->update($field); |
|
231 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', |
|
232 | + 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', |
|
233 | + 'blockedafter'); |
|
234 | + $webUser->attributes->update($field); |
|
235 | + |
|
236 | + // Save User Settings |
|
237 | + saveWebUserSettings($id); |
|
238 | + |
|
239 | + // Set the item name for logger |
|
240 | + $_SESSION['itemname'] = $newusername; |
|
241 | + |
|
242 | + /*******************************************************************************/ |
|
243 | + // put the user in the user_groups he/ she should be in |
|
244 | + // first, check that up_perms are switched on! |
|
245 | + if($modx->getConfig('use_udperms') == 1) { |
|
246 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
247 | + $webUser->memberGroups()->delete(); |
|
248 | + if (!empty($user_groups)) { |
|
249 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
250 | + $field = array(); |
|
251 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
252 | + $webUser->memberGroups()->create($field); |
|
253 | + } |
|
254 | + } |
|
255 | + } |
|
256 | + // end of user_groups stuff! |
|
257 | + /*******************************************************************************/ |
|
258 | + |
|
259 | + // invoke OnWebSaveUser event |
|
260 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
261 | + "mode" => "upd", |
|
274 | 262 | "userid" => $id, |
275 | 263 | "username" => $newusername, |
276 | - "userpassword" => $newpassword |
|
264 | + "userpassword" => $newpassword, |
|
265 | + "useremail" => $email, |
|
266 | + "userfullname" => $fullname, |
|
267 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
268 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
277 | 269 | )); |
278 | - } |
|
279 | 270 | |
280 | - // invoke OnWUsrFormSave event |
|
281 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
282 | - "mode" => "upd", |
|
283 | - "id" => $id |
|
284 | - )); |
|
271 | + // invoke OnWebChangePassword event |
|
272 | + if ($genpassword == 1) { |
|
273 | + $modx->invokeEvent("OnWebChangePassword", array( |
|
274 | + "userid" => $id, |
|
275 | + "username" => $newusername, |
|
276 | + "userpassword" => $newpassword |
|
277 | + )); |
|
278 | + } |
|
279 | + |
|
280 | + // invoke OnWUsrFormSave event |
|
281 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
282 | + "mode" => "upd", |
|
283 | + "id" => $id |
|
284 | + )); |
|
285 | 285 | |
286 | - if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
287 | - if ($input['stay'] != '') { |
|
288 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
289 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
290 | - } else { |
|
291 | - $stayUrl = "index.php?a=99&r=2"; |
|
292 | - } |
|
286 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
287 | + if ($input['stay'] != '') { |
|
288 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
289 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
290 | + } else { |
|
291 | + $stayUrl = "index.php?a=99&r=2"; |
|
292 | + } |
|
293 | 293 | |
294 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
295 | - ?> |
|
294 | + include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
295 | + ?> |
|
296 | 296 | |
297 | 297 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
298 | 298 | |
@@ -312,18 +312,18 @@ discard block |
||
312 | 312 | </div> |
313 | 313 | <?php |
314 | 314 | |
315 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
316 | - } else { |
|
317 | - if ($input['stay'] != '') { |
|
318 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
319 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
320 | - header($header); |
|
321 | - } else { |
|
322 | - $header = "Location: index.php?a=99&r=2"; |
|
323 | - header($header); |
|
324 | - } |
|
325 | - } |
|
326 | - break; |
|
327 | - default : |
|
328 | - webAlertAndQuit("No operation set in request.", 88); |
|
315 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
316 | + } else { |
|
317 | + if ($input['stay'] != '') { |
|
318 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
319 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
320 | + header($header); |
|
321 | + } else { |
|
322 | + $header = "Location: index.php?a=99&r=2"; |
|
323 | + header($header); |
|
324 | + } |
|
325 | + } |
|
326 | + break; |
|
327 | + default : |
|
328 | + webAlertAndQuit("No operation set in request.", 88); |
|
329 | 329 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $input[$k] = $v; |
15 | 15 | } |
16 | 16 | |
17 | -$id = (int)$input['id']; |
|
17 | +$id = (int) $input['id']; |
|
18 | 18 | $oldusername = $input['oldusername']; |
19 | 19 | $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User"; |
20 | 20 | $fullname = $input['fullname']; |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | $field = array(); |
92 | 92 | $field['username'] = $newusername; |
93 | 93 | $field['password'] = md5($newpassword); |
94 | - $webUser= EvolutionCMS\Models\WebUser::create($field); |
|
94 | + $webUser = EvolutionCMS\Models\WebUser::create($field); |
|
95 | 95 | $internalKey = $webUser->getKey(); |
96 | - $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
96 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
97 | 97 | $webUser->attributes()->create($field); |
98 | 98 | |
99 | 99 | $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | /*******************************************************************************/ |
111 | 111 | // put the user in the user_groups he/ she should be in |
112 | 112 | // first, check that up_perms are switched on! |
113 | - if($modx->getConfig('use_udperms') == 1) { |
|
114 | - if(!empty($user_groups)) { |
|
115 | - for($i = 0; $i < count($user_groups); $i++) { |
|
113 | + if ($modx->getConfig('use_udperms') == 1) { |
|
114 | + if (!empty($user_groups)) { |
|
115 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
116 | 116 | $field = array(); |
117 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
117 | + $field['webgroup'] = (int) $user_groups[$i]; |
|
118 | 118 | $webUser->memberGroups()->create($field); |
119 | 119 | } |
120 | 120 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
142 | 142 | if ($input['stay'] != '') { |
143 | 143 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
144 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
144 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
145 | 145 | header($header); |
146 | 146 | } else { |
147 | 147 | $header = "Location: index.php?a=99&r=2"; |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | } else { |
151 | 151 | if ($input['stay'] != '') { |
152 | 152 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
153 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
153 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
154 | 154 | } else { |
155 | 155 | $stayUrl = "index.php?a=99&r=2"; |
156 | 156 | } |
157 | 157 | |
158 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
158 | + include_once MODX_MANAGER_PATH."includes/header.inc.php"; |
|
159 | 159 | ?> |
160 | 160 | |
161 | 161 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | </div> |
179 | 179 | <?php |
180 | 180 | |
181 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
181 | + include_once MODX_MANAGER_PATH."includes/footer.inc.php"; |
|
182 | 182 | } |
183 | 183 | break; |
184 | 184 | case '88' : // edit user |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | /*******************************************************************************/ |
243 | 243 | // put the user in the user_groups he/ she should be in |
244 | 244 | // first, check that up_perms are switched on! |
245 | - if($modx->getConfig('use_udperms') == 1) { |
|
245 | + if ($modx->getConfig('use_udperms') == 1) { |
|
246 | 246 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
247 | 247 | $webUser->memberGroups()->delete(); |
248 | 248 | if (!empty($user_groups)) { |
249 | 249 | for ($i = 0; $i < count($user_groups); $i++) { |
250 | 250 | $field = array(); |
251 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
251 | + $field['webgroup'] = (int) $user_groups[$i]; |
|
252 | 252 | $webUser->memberGroups()->create($field); |
253 | 253 | } |
254 | 254 | } |
@@ -286,12 +286,12 @@ discard block |
||
286 | 286 | if ($genpassword == 1 && $passwordnotifymethod == 's') { |
287 | 287 | if ($input['stay'] != '') { |
288 | 288 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
289 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
289 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
290 | 290 | } else { |
291 | 291 | $stayUrl = "index.php?a=99&r=2"; |
292 | 292 | } |
293 | 293 | |
294 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
294 | + include_once MODX_MANAGER_PATH."includes/header.inc.php"; |
|
295 | 295 | ?> |
296 | 296 | |
297 | 297 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
@@ -312,11 +312,11 @@ discard block |
||
312 | 312 | </div> |
313 | 313 | <?php |
314 | 314 | |
315 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
315 | + include_once MODX_MANAGER_PATH."includes/footer.inc.php"; |
|
316 | 316 | } else { |
317 | 317 | if ($input['stay'] != '') { |
318 | 318 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
319 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
319 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
320 | 320 | header($header); |
321 | 321 | } else { |
322 | 322 | $header = "Location: index.php?a=99&r=2"; |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | -if (!$modx->hasPermission('save_web_user')) { |
|
5 | +if (!$modx->hasPermission('save_web_user')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | 9 | $input = $_POST; |
10 | -foreach ($input as $k => $v) { |
|
11 | - if ($k !== 'comment' && $k !== 'user_groups') { |
|
10 | +foreach ($input as $k => $v) { |
|
11 | + if ($k !== 'comment' && $k !== 'user_groups') { |
|
12 | 12 | $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES); |
13 | 13 | } |
14 | 14 | $input[$k] = $v; |
@@ -44,41 +44,41 @@ discard block |
||
44 | 44 | $user_groups = $input['user_groups']; |
45 | 45 | |
46 | 46 | // verify password |
47 | -if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
47 | +if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
48 | 48 | webAlertAndQuit("Password typed is mismatched", 88); |
49 | 49 | } |
50 | 50 | |
51 | 51 | // verify email |
52 | -if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
52 | +if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
53 | 53 | webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
54 | 54 | } |
55 | 55 | |
56 | -switch ($input['mode']) { |
|
56 | +switch ($input['mode']) { |
|
57 | 57 | case '87' : // new user |
58 | 58 | // check if this user name already exist |
59 | - if (EvolutionCMS\Models\WebUser::where('username', '=', $newusername)->first()) { |
|
59 | + if (EvolutionCMS\Models\WebUser::where('username', '=', $newusername)->first()) { |
|
60 | 60 | webAlertAndQuit("User name is already in use!", 88); |
61 | 61 | } |
62 | 62 | |
63 | 63 | // check if the email address already exist |
64 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
65 | - if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
64 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
65 | + if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
66 | 66 | webAlertAndQuit("Email is already in use!", 88); |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | // generate a new password for this user |
71 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
72 | - if (strlen($specifiedpassword) < 6) { |
|
71 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
72 | + if (strlen($specifiedpassword) < 6) { |
|
73 | 73 | webAlertAndQuit("Password is too short!", 88); |
74 | - } else { |
|
74 | + } else { |
|
75 | 75 | $newpassword = $specifiedpassword; |
76 | 76 | } |
77 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
77 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
78 | 78 | webAlertAndQuit("You didn't specify a password for this user!", 88); |
79 | - } elseif ($passwordgenmethod == 'g') { |
|
79 | + } elseif ($passwordgenmethod == 'g') { |
|
80 | 80 | $newpassword = generate_password(8); |
81 | - } else { |
|
81 | + } else { |
|
82 | 82 | webAlertAndQuit("No password generation method specified!", 88); |
83 | 83 | } |
84 | 84 | |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | /*******************************************************************************/ |
111 | 111 | // put the user in the user_groups he/ she should be in |
112 | 112 | // first, check that up_perms are switched on! |
113 | - if($modx->getConfig('use_udperms') == 1) { |
|
114 | - if(!empty($user_groups)) { |
|
115 | - for($i = 0; $i < count($user_groups); $i++) { |
|
113 | + if($modx->getConfig('use_udperms') == 1) { |
|
114 | + if(!empty($user_groups)) { |
|
115 | + for($i = 0; $i < count($user_groups); $i++) { |
|
116 | 116 | $field = array(); |
117 | 117 | $field['webgroup'] = (int)$user_groups[$i]; |
118 | 118 | $webUser->memberGroups()->create($field); |
@@ -137,21 +137,21 @@ discard block |
||
137 | 137 | "id" => $internalKey |
138 | 138 | )); |
139 | 139 | |
140 | - if ($passwordnotifymethod == 'e') { |
|
140 | + if ($passwordnotifymethod == 'e') { |
|
141 | 141 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
142 | - if ($input['stay'] != '') { |
|
142 | + if ($input['stay'] != '') { |
|
143 | 143 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
144 | 144 | $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
145 | 145 | header($header); |
146 | - } else { |
|
146 | + } else { |
|
147 | 147 | $header = "Location: index.php?a=99&r=2"; |
148 | 148 | header($header); |
149 | 149 | } |
150 | - } else { |
|
151 | - if ($input['stay'] != '') { |
|
150 | + } else { |
|
151 | + if ($input['stay'] != '') { |
|
152 | 152 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
153 | 153 | $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
154 | - } else { |
|
154 | + } else { |
|
155 | 155 | $stayUrl = "index.php?a=99&r=2"; |
156 | 156 | } |
157 | 157 | |
@@ -183,33 +183,33 @@ discard block |
||
183 | 183 | break; |
184 | 184 | case '88' : // edit user |
185 | 185 | // generate a new password for this user |
186 | - if ($genpassword == 1) { |
|
187 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
188 | - if (strlen($specifiedpassword) < 6) { |
|
186 | + if ($genpassword == 1) { |
|
187 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
188 | + if (strlen($specifiedpassword) < 6) { |
|
189 | 189 | webAlertAndQuit("Password is too short!", 88); |
190 | - } else { |
|
190 | + } else { |
|
191 | 191 | $newpassword = $specifiedpassword; |
192 | 192 | } |
193 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
193 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
194 | 194 | webAlertAndQuit("You didn't specify a password for this user!", 88); |
195 | - } elseif ($passwordgenmethod == 'g') { |
|
195 | + } elseif ($passwordgenmethod == 'g') { |
|
196 | 196 | $newpassword = generate_password(8); |
197 | - } else { |
|
197 | + } else { |
|
198 | 198 | webAlertAndQuit("No password generation method specified!", 88); |
199 | 199 | } |
200 | 200 | } |
201 | - if ($passwordnotifymethod == 'e') { |
|
201 | + if ($passwordnotifymethod == 'e') { |
|
202 | 202 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // check if the username already exist |
206 | - if (EvolutionCMS\Models\WebUser::where('id', '!=', $id)->where('username', '=', $newusername)->first()) { |
|
206 | + if (EvolutionCMS\Models\WebUser::where('id', '!=', $id)->where('username', '=', $newusername)->first()) { |
|
207 | 207 | webAlertAndQuit("User name is already in use!", 88); |
208 | 208 | } |
209 | 209 | |
210 | 210 | // check if the email address already exists |
211 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
212 | - if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
211 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
212 | + if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
213 | 213 | webAlertAndQuit("Email is already in use!", 88); |
214 | 214 | } |
215 | 215 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | // update user name and password |
224 | 224 | $field = array(); |
225 | 225 | $field['username'] = $newusername; |
226 | - if ($genpassword == 1) { |
|
226 | + if ($genpassword == 1) { |
|
227 | 227 | $field['password'] = md5($newpassword); |
228 | 228 | } |
229 | 229 | $webUser = EvolutionCMS\Models\WebUser::find($id); |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | /*******************************************************************************/ |
243 | 243 | // put the user in the user_groups he/ she should be in |
244 | 244 | // first, check that up_perms are switched on! |
245 | - if($modx->getConfig('use_udperms') == 1) { |
|
245 | + if($modx->getConfig('use_udperms') == 1) { |
|
246 | 246 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
247 | 247 | $webUser->memberGroups()->delete(); |
248 | - if (!empty($user_groups)) { |
|
249 | - for ($i = 0; $i < count($user_groups); $i++) { |
|
248 | + if (!empty($user_groups)) { |
|
249 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
250 | 250 | $field = array(); |
251 | 251 | $field['webgroup'] = (int)$user_groups[$i]; |
252 | 252 | $webUser->memberGroups()->create($field); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | )); |
270 | 270 | |
271 | 271 | // invoke OnWebChangePassword event |
272 | - if ($genpassword == 1) { |
|
272 | + if ($genpassword == 1) { |
|
273 | 273 | $modx->invokeEvent("OnWebChangePassword", array( |
274 | 274 | "userid" => $id, |
275 | 275 | "username" => $newusername, |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | "id" => $id |
284 | 284 | )); |
285 | 285 | |
286 | - if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
287 | - if ($input['stay'] != '') { |
|
286 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
287 | + if ($input['stay'] != '') { |
|
288 | 288 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
289 | 289 | $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
290 | - } else { |
|
290 | + } else { |
|
291 | 291 | $stayUrl = "index.php?a=99&r=2"; |
292 | 292 | } |
293 | 293 | |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | <?php |
314 | 314 | |
315 | 315 | include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
316 | - } else { |
|
317 | - if ($input['stay'] != '') { |
|
316 | + } else { |
|
317 | + if ($input['stay'] != '') { |
|
318 | 318 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
319 | 319 | $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
320 | 320 | header($header); |
321 | - } else { |
|
321 | + } else { |
|
322 | 322 | $header = "Location: index.php?a=99&r=2"; |
323 | 323 | header($header); |
324 | 324 | } |