@@ -1,135 +1,135 @@ |
||
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_role')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | extract($_POST); |
10 | 10 | |
11 | 11 | if($name == '' || !isset ($name)) { |
12 | - $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
12 | + $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | // setup fields |
16 | 16 | $fields = array( |
17 | - 'name' => $name, |
|
18 | - 'description' => $description, |
|
19 | - 'frames' => $frames, |
|
20 | - 'home' => $home, |
|
21 | - 'view_document' => $view_document, |
|
22 | - 'new_document' => $new_document, |
|
23 | - 'save_document' => $save_document, |
|
24 | - 'publish_document' => $publish_document, |
|
25 | - 'delete_document' => $delete_document, |
|
26 | - 'empty_trash' => $empty_trash, |
|
27 | - 'action_ok' => $action_ok, |
|
28 | - 'logout' => $logout, |
|
29 | - 'help' => $help, |
|
30 | - 'messages' => $messages, |
|
31 | - 'new_user' => $new_user, |
|
32 | - 'edit_user' => $edit_user, |
|
33 | - 'logs' => $logs, |
|
34 | - 'edit_parser' => (isset ($edit_parser)) ? $edit_parser : '0', |
|
35 | - 'save_parser' => (isset ($save_parser)) ? $save_parser : '0', |
|
36 | - 'edit_template' => $edit_template, |
|
37 | - 'settings' => $settings, |
|
38 | - 'credits' => $credits, |
|
39 | - 'new_template' => $new_template, |
|
40 | - 'save_template' => $save_template, |
|
41 | - 'delete_template' => $delete_template, |
|
42 | - 'edit_snippet' => $edit_snippet, |
|
43 | - 'new_snippet' => $new_snippet, |
|
44 | - 'save_snippet' => $save_snippet, |
|
45 | - 'delete_snippet' => $delete_snippet, |
|
46 | - 'edit_chunk' => $edit_chunk, |
|
47 | - 'new_chunk' => $new_chunk, |
|
48 | - 'save_chunk' => $save_chunk, |
|
49 | - 'delete_chunk' => $delete_chunk, |
|
50 | - 'empty_cache' => $empty_cache, |
|
51 | - 'edit_document' => $edit_document, |
|
52 | - 'change_password' => $change_password, |
|
53 | - 'error_dialog' => $error_dialog, |
|
54 | - 'about' => $about, |
|
55 | - 'file_manager' => $file_manager, |
|
56 | - 'assets_files' => $assets_files, |
|
57 | - 'assets_images' => $assets_images, |
|
58 | - 'save_user' => $save_user, |
|
59 | - 'delete_user' => $delete_user, |
|
60 | - 'save_password' => $save_password, |
|
61 | - 'edit_role' => $edit_role, |
|
62 | - 'save_role' => $save_role, |
|
63 | - 'delete_role' => $delete_role, |
|
64 | - 'new_role' => $new_role, |
|
65 | - 'access_permissions' => $access_permissions, |
|
66 | - 'bk_manager' => $bk_manager, |
|
67 | - 'new_plugin' => $new_plugin, |
|
68 | - 'edit_plugin' => $edit_plugin, |
|
69 | - 'save_plugin' => $save_plugin, |
|
70 | - 'delete_plugin' => $delete_plugin, |
|
71 | - 'new_module' => $new_module, |
|
72 | - 'edit_module' => $edit_module, |
|
73 | - 'save_module' => $save_module, |
|
74 | - 'delete_module' => $delete_module, |
|
75 | - 'exec_module' => $exec_module, |
|
76 | - 'view_eventlog' => $view_eventlog, |
|
77 | - 'delete_eventlog' => $delete_eventlog, |
|
78 | - 'new_web_user' => $new_web_user, |
|
79 | - 'edit_web_user' => $edit_web_user, |
|
80 | - 'save_web_user' => $save_web_user, |
|
81 | - 'delete_web_user' => $delete_web_user, |
|
82 | - 'web_access_permissions' => $web_access_permissions, |
|
83 | - 'view_unpublished' => $view_unpublished, |
|
84 | - 'import_static' => $import_static, |
|
85 | - 'export_static' => $export_static, |
|
86 | - 'remove_locks' => $remove_locks, |
|
87 | - 'display_locks' => $display_locks, |
|
88 | - 'change_resourcetype' => $change_resourcetype, |
|
89 | - 'category_manager' => $category_manager |
|
17 | + 'name' => $name, |
|
18 | + 'description' => $description, |
|
19 | + 'frames' => $frames, |
|
20 | + 'home' => $home, |
|
21 | + 'view_document' => $view_document, |
|
22 | + 'new_document' => $new_document, |
|
23 | + 'save_document' => $save_document, |
|
24 | + 'publish_document' => $publish_document, |
|
25 | + 'delete_document' => $delete_document, |
|
26 | + 'empty_trash' => $empty_trash, |
|
27 | + 'action_ok' => $action_ok, |
|
28 | + 'logout' => $logout, |
|
29 | + 'help' => $help, |
|
30 | + 'messages' => $messages, |
|
31 | + 'new_user' => $new_user, |
|
32 | + 'edit_user' => $edit_user, |
|
33 | + 'logs' => $logs, |
|
34 | + 'edit_parser' => (isset ($edit_parser)) ? $edit_parser : '0', |
|
35 | + 'save_parser' => (isset ($save_parser)) ? $save_parser : '0', |
|
36 | + 'edit_template' => $edit_template, |
|
37 | + 'settings' => $settings, |
|
38 | + 'credits' => $credits, |
|
39 | + 'new_template' => $new_template, |
|
40 | + 'save_template' => $save_template, |
|
41 | + 'delete_template' => $delete_template, |
|
42 | + 'edit_snippet' => $edit_snippet, |
|
43 | + 'new_snippet' => $new_snippet, |
|
44 | + 'save_snippet' => $save_snippet, |
|
45 | + 'delete_snippet' => $delete_snippet, |
|
46 | + 'edit_chunk' => $edit_chunk, |
|
47 | + 'new_chunk' => $new_chunk, |
|
48 | + 'save_chunk' => $save_chunk, |
|
49 | + 'delete_chunk' => $delete_chunk, |
|
50 | + 'empty_cache' => $empty_cache, |
|
51 | + 'edit_document' => $edit_document, |
|
52 | + 'change_password' => $change_password, |
|
53 | + 'error_dialog' => $error_dialog, |
|
54 | + 'about' => $about, |
|
55 | + 'file_manager' => $file_manager, |
|
56 | + 'assets_files' => $assets_files, |
|
57 | + 'assets_images' => $assets_images, |
|
58 | + 'save_user' => $save_user, |
|
59 | + 'delete_user' => $delete_user, |
|
60 | + 'save_password' => $save_password, |
|
61 | + 'edit_role' => $edit_role, |
|
62 | + 'save_role' => $save_role, |
|
63 | + 'delete_role' => $delete_role, |
|
64 | + 'new_role' => $new_role, |
|
65 | + 'access_permissions' => $access_permissions, |
|
66 | + 'bk_manager' => $bk_manager, |
|
67 | + 'new_plugin' => $new_plugin, |
|
68 | + 'edit_plugin' => $edit_plugin, |
|
69 | + 'save_plugin' => $save_plugin, |
|
70 | + 'delete_plugin' => $delete_plugin, |
|
71 | + 'new_module' => $new_module, |
|
72 | + 'edit_module' => $edit_module, |
|
73 | + 'save_module' => $save_module, |
|
74 | + 'delete_module' => $delete_module, |
|
75 | + 'exec_module' => $exec_module, |
|
76 | + 'view_eventlog' => $view_eventlog, |
|
77 | + 'delete_eventlog' => $delete_eventlog, |
|
78 | + 'new_web_user' => $new_web_user, |
|
79 | + 'edit_web_user' => $edit_web_user, |
|
80 | + 'save_web_user' => $save_web_user, |
|
81 | + 'delete_web_user' => $delete_web_user, |
|
82 | + 'web_access_permissions' => $web_access_permissions, |
|
83 | + 'view_unpublished' => $view_unpublished, |
|
84 | + 'import_static' => $import_static, |
|
85 | + 'export_static' => $export_static, |
|
86 | + 'remove_locks' => $remove_locks, |
|
87 | + 'display_locks' => $display_locks, |
|
88 | + 'change_resourcetype' => $change_resourcetype, |
|
89 | + 'category_manager' => $category_manager |
|
90 | 90 | ); |
91 | 91 | |
92 | 92 | $fields = $modx->getDatabase()->escape($fields); |
93 | 93 | |
94 | 94 | switch($_POST['mode']) { |
95 | - case '38' : |
|
96 | - $tbl = $modx->getFullTableName("user_roles"); |
|
95 | + case '38' : |
|
96 | + $tbl = $modx->getFullTableName("user_roles"); |
|
97 | 97 | |
98 | - // disallow duplicate names for role |
|
99 | - $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
|
100 | - if($modx->getDatabase()->getValue($rs) > 0) { |
|
101 | - $modx->getManagerApi()->saveFormValues(38); |
|
102 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
|
103 | - } |
|
98 | + // disallow duplicate names for role |
|
99 | + $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
|
100 | + if($modx->getDatabase()->getValue($rs) > 0) { |
|
101 | + $modx->getManagerApi()->saveFormValues(38); |
|
102 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
|
103 | + } |
|
104 | 104 | |
105 | - $modx->getDatabase()->insert($fields, $tbl); |
|
105 | + $modx->getDatabase()->insert($fields, $tbl); |
|
106 | 106 | |
107 | - // Set the item name for logger |
|
108 | - $_SESSION['itemname'] = $_POST['name']; |
|
107 | + // Set the item name for logger |
|
108 | + $_SESSION['itemname'] = $_POST['name']; |
|
109 | 109 | |
110 | - $header = "Location: index.php?a=86&r=2"; |
|
111 | - header($header); |
|
112 | - break; |
|
113 | - case '35' : |
|
114 | - $tbl = $modx->getFullTableName("user_roles"); |
|
110 | + $header = "Location: index.php?a=86&r=2"; |
|
111 | + header($header); |
|
112 | + break; |
|
113 | + case '35' : |
|
114 | + $tbl = $modx->getFullTableName("user_roles"); |
|
115 | 115 | |
116 | - // disallow duplicate names for role |
|
117 | - $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
|
118 | - if($modx->getDatabase()->getValue($rs) > 0) { |
|
119 | - $modx->getManagerApi()->saveFormValues(35); |
|
120 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
|
121 | - } |
|
116 | + // disallow duplicate names for role |
|
117 | + $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
|
118 | + if($modx->getDatabase()->getValue($rs) > 0) { |
|
119 | + $modx->getManagerApi()->saveFormValues(35); |
|
120 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
|
121 | + } |
|
122 | 122 | |
123 | - $modx->getDatabase()->update($fields, $tbl, "id='{$id}'"); |
|
123 | + $modx->getDatabase()->update($fields, $tbl, "id='{$id}'"); |
|
124 | 124 | |
125 | - // Set the item name for logger |
|
126 | - $_SESSION['itemname'] = $_POST['name']; |
|
125 | + // Set the item name for logger |
|
126 | + $_SESSION['itemname'] = $_POST['name']; |
|
127 | 127 | |
128 | - $header = "Location: index.php?a=86&r=2"; |
|
129 | - header($header); |
|
130 | - break; |
|
131 | - default : |
|
132 | - $modx->webAlertAndQuit("No operation set in request."); |
|
128 | + $header = "Location: index.php?a=86&r=2"; |
|
129 | + header($header); |
|
130 | + break; |
|
131 | + default : |
|
132 | + $modx->webAlertAndQuit("No operation set in request."); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | $modx->unlockElement(8, $id); |
@@ -1,15 +1,15 @@ 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_role')) { |
|
5 | +if (!$modx->hasPermission('save_role')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | 9 | extract($_POST); |
10 | 10 | |
11 | -if($name == '' || !isset ($name)) { |
|
12 | - $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
11 | +if ($name == '' || !isset ($name)) { |
|
12 | + $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}".($mode = 35 ? "&id={$id}" : "")); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | // setup fields |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | |
92 | 92 | $fields = $modx->getDatabase()->escape($fields); |
93 | 93 | |
94 | -switch($_POST['mode']) { |
|
94 | +switch ($_POST['mode']) { |
|
95 | 95 | case '38' : |
96 | 96 | $tbl = $modx->getFullTableName("user_roles"); |
97 | 97 | |
98 | 98 | // disallow duplicate names for role |
99 | 99 | $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
100 | - if($modx->getDatabase()->getValue($rs) > 0) { |
|
100 | + if ($modx->getDatabase()->getValue($rs) > 0) { |
|
101 | 101 | $modx->getManagerApi()->saveFormValues(38); |
102 | 102 | $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
103 | 103 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | // disallow duplicate names for role |
117 | 117 | $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
118 | - if($modx->getDatabase()->getValue($rs) > 0) { |
|
118 | + if ($modx->getDatabase()->getValue($rs) > 0) { |
|
119 | 119 | $modx->getManagerApi()->saveFormValues(35); |
120 | 120 | $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
121 | 121 | } |
@@ -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('edit_document')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
@@ -25,68 +25,68 @@ discard block |
||
25 | 25 | // check user has permission to move document to chosen location |
26 | 26 | |
27 | 27 | if ($use_udperms == 1) { |
28 | - if ($oldparent != $newParentID) { |
|
29 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
30 | - $udperms->user = $modx->getLoginUserID(); |
|
31 | - $udperms->document = $newParentID; |
|
32 | - $udperms->role = $_SESSION['mgrRole']; |
|
28 | + if ($oldparent != $newParentID) { |
|
29 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
30 | + $udperms->user = $modx->getLoginUserID(); |
|
31 | + $udperms->document = $newParentID; |
|
32 | + $udperms->role = $_SESSION['mgrRole']; |
|
33 | 33 | |
34 | - if (!$udperms->checkPermissions()) { |
|
35 | - $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
36 | - } |
|
37 | - } |
|
34 | + if (!$udperms->checkPermissions()) { |
|
35 | + $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
36 | + } |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
41 | - "id_document" => $documentID, |
|
42 | - "old_parent" => $oldparent, |
|
43 | - "new_parent" => $newParentID |
|
41 | + "id_document" => $documentID, |
|
42 | + "old_parent" => $oldparent, |
|
43 | + "new_parent" => $newParentID |
|
44 | 44 | )); |
45 | 45 | if (is_array($evtOut) && count($evtOut) > 0){ |
46 | - $newParent = array_pop($evtOut); |
|
47 | - if($newParent == $oldparent) { |
|
48 | - $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
49 | - }else{ |
|
50 | - $newParentID = $newParent; |
|
51 | - } |
|
46 | + $newParent = array_pop($evtOut); |
|
47 | + if($newParent == $oldparent) { |
|
48 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
49 | + }else{ |
|
50 | + $newParentID = $newParent; |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $children = allChildren($documentID); |
55 | 55 | if (!array_search($newParentID, $children)) { |
56 | - $modx->getDatabase()->update(array( |
|
57 | - 'isfolder' => 1, |
|
58 | - ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
56 | + $modx->getDatabase()->update(array( |
|
57 | + 'isfolder' => 1, |
|
58 | + ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
59 | 59 | |
60 | - $modx->getDatabase()->update(array( |
|
61 | - 'parent' => $newParentID, |
|
62 | - 'editedby' => $modx->getLoginUserID(), |
|
63 | - 'editedon' => time(), |
|
64 | - ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
60 | + $modx->getDatabase()->update(array( |
|
61 | + 'parent' => $newParentID, |
|
62 | + 'editedby' => $modx->getLoginUserID(), |
|
63 | + 'editedon' => time(), |
|
64 | + ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
65 | 65 | |
66 | - // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
67 | - $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
68 | - $limit = $modx->getDatabase()->getValue($rs); |
|
66 | + // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
67 | + $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
68 | + $limit = $modx->getDatabase()->getValue($rs); |
|
69 | 69 | |
70 | - if(!$limit>0) { |
|
71 | - $modx->getDatabase()->update(array( |
|
72 | - 'isfolder' => 0, |
|
73 | - ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
74 | - } |
|
75 | - // Set the item name for logger |
|
76 | - $pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
77 | - $_SESSION['itemname'] = $pagetitle; |
|
70 | + if(!$limit>0) { |
|
71 | + $modx->getDatabase()->update(array( |
|
72 | + 'isfolder' => 0, |
|
73 | + ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
74 | + } |
|
75 | + // Set the item name for logger |
|
76 | + $pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
77 | + $_SESSION['itemname'] = $pagetitle; |
|
78 | 78 | |
79 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
80 | - "id_document" => $documentID, |
|
81 | - "old_parent" => $oldparent, |
|
82 | - "new_parent" => $newParentID |
|
83 | - )); |
|
79 | + $modx->invokeEvent("onAfterMoveDocument", array ( |
|
80 | + "id_document" => $documentID, |
|
81 | + "old_parent" => $oldparent, |
|
82 | + "new_parent" => $newParentID |
|
83 | + )); |
|
84 | 84 | |
85 | - // empty cache & sync site |
|
86 | - $modx->clearCache('full'); |
|
85 | + // empty cache & sync site |
|
86 | + $modx->clearCache('full'); |
|
87 | 87 | |
88 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
89 | - header($header); |
|
88 | + $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
89 | + header($header); |
|
90 | 90 | } else { |
91 | - $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
91 | + $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
92 | 92 | } |
@@ -1,20 +1,20 @@ 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_document')) { |
|
5 | +if (!$modx->hasPermission('edit_document')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
|
10 | -$documentID = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
9 | +$newParentID = isset($_REQUEST['new_parent']) ? (int) $_REQUEST['new_parent'] : 0; |
|
10 | +$documentID = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
11 | 11 | |
12 | 12 | // ok, two things to check. |
13 | 13 | // first, document cannot be moved to itself |
14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
15 | +if ($documentID == $newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | +if ($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | +if ($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
18 | 18 | |
19 | 19 | $parents = $modx->getParentIds($newParentID); |
20 | 20 | if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | -$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
|
40 | +$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array( |
|
41 | 41 | "id_document" => $documentID, |
42 | 42 | "old_parent" => $oldparent, |
43 | 43 | "new_parent" => $newParentID |
44 | 44 | )); |
45 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
45 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
46 | 46 | $newParent = array_pop($evtOut); |
47 | - if($newParent == $oldparent) { |
|
47 | + if ($newParent == $oldparent) { |
|
48 | 48 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
49 | - }else{ |
|
49 | + } else { |
|
50 | 50 | $newParentID = $newParent; |
51 | 51 | } |
52 | 52 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
68 | 68 | $limit = $modx->getDatabase()->getValue($rs); |
69 | 69 | |
70 | - if(!$limit>0) { |
|
70 | + if (!$limit > 0) { |
|
71 | 71 | $modx->getDatabase()->update(array( |
72 | 72 | 'isfolder' => 0, |
73 | 73 | ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
77 | 77 | $_SESSION['itemname'] = $pagetitle; |
78 | 78 | |
79 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
79 | + $modx->invokeEvent("onAfterMoveDocument", array( |
|
80 | 80 | "id_document" => $documentID, |
81 | 81 | "old_parent" => $oldparent, |
82 | 82 | "new_parent" => $newParentID |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | // empty cache & sync site |
86 | 86 | $modx->clearCache('full'); |
87 | 87 | |
88 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
88 | + $header = "Location: index.php?a=3&id={$documentID}&r=9"; |
|
89 | 89 | header($header); |
90 | 90 | } else { |
91 | 91 | $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
@@ -12,12 +12,20 @@ discard block |
||
12 | 12 | // ok, two things to check. |
13 | 13 | // first, document cannot be moved to itself |
14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
15 | +if($documentID==$newParentID) { |
|
16 | + $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
17 | +} |
|
18 | +if($documentID <= 0) { |
|
19 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
20 | +} |
|
21 | +if($newParentID < 0) { |
|
22 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
23 | +} |
|
18 | 24 | |
19 | 25 | $parents = $modx->getParentIds($newParentID); |
20 | -if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
26 | +if (in_array($documentID, $parents)) { |
|
27 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
28 | +} |
|
21 | 29 | |
22 | 30 | $rs = $modx->getDatabase()->select('parent', $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
23 | 31 | $oldparent = $modx->getDatabase()->getValue($rs); |
@@ -42,11 +50,11 @@ discard block |
||
42 | 50 | "old_parent" => $oldparent, |
43 | 51 | "new_parent" => $newParentID |
44 | 52 | )); |
45 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
53 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
46 | 54 | $newParent = array_pop($evtOut); |
47 | 55 | if($newParent == $oldparent) { |
48 | 56 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
49 | - }else{ |
|
57 | + } else { |
|
50 | 58 | $newParentID = $newParent; |
51 | 59 | } |
52 | 60 | } |
@@ -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_web_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $tbl_web_users = $modx->getFullTableName('web_users'); |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | $input = $_POST; |
14 | 14 | foreach($input as $k => $v) { |
15 | - if($k !== 'comment') { |
|
16 | - $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES); |
|
17 | - } |
|
18 | - $input[$k] = $v; |
|
15 | + if($k !== 'comment') { |
|
16 | + $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES); |
|
17 | + } |
|
18 | + $input[$k] = $v; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = (int)$input['id']; |
@@ -51,82 +51,82 @@ discard block |
||
51 | 51 | |
52 | 52 | // verify password |
53 | 53 | if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
54 | - webAlertAndQuit("Password typed is mismatched", 88); |
|
54 | + webAlertAndQuit("Password typed is mismatched", 88); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // verify email |
58 | 58 | if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
59 | - webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
|
59 | + webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | switch($input['mode']) { |
63 | - case '87' : // new user |
|
64 | - // check if this user name already exist |
|
65 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
66 | - $limit = $modx->getDatabase()->getValue($rs); |
|
67 | - if($limit > 0) { |
|
68 | - webAlertAndQuit("User name is already in use!", 88); |
|
69 | - } |
|
70 | - |
|
71 | - // check if the email address already exist |
|
72 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
73 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
74 | - $limit = $modx->getDatabase()->getValue($rs); |
|
75 | - if($limit > 0) { |
|
76 | - webAlertAndQuit("Email is already in use!", 88); |
|
77 | - } |
|
78 | - } |
|
79 | - |
|
80 | - // generate a new password for this user |
|
81 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | - if(strlen($specifiedpassword) < 6) { |
|
83 | - webAlertAndQuit("Password is too short!", 88); |
|
84 | - } else { |
|
85 | - $newpassword = $specifiedpassword; |
|
86 | - } |
|
87 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
88 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
89 | - } elseif($passwordgenmethod == 'g') { |
|
90 | - $newpassword = generate_password(8); |
|
91 | - } else { |
|
92 | - webAlertAndQuit("No password generation method specified!", 88); |
|
93 | - } |
|
94 | - |
|
95 | - // invoke OnBeforeWUsrFormSave event |
|
96 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
97 | - "mode" => "new", |
|
98 | - )); |
|
99 | - |
|
100 | - // create the user account |
|
101 | - $field = array(); |
|
102 | - $field['username'] = $esc_newusername; |
|
103 | - $field['password'] = md5($newpassword); |
|
104 | - $internalKey = $modx->getDatabase()->insert($field, $tbl_web_users); |
|
105 | - |
|
106 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
107 | - $field = $modx->getDatabase()->escape($field); |
|
108 | - $modx->getDatabase()->insert($field, $tbl_web_user_attributes); |
|
109 | - |
|
110 | - // Save User Settings |
|
63 | + case '87' : // new user |
|
64 | + // check if this user name already exist |
|
65 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
66 | + $limit = $modx->getDatabase()->getValue($rs); |
|
67 | + if($limit > 0) { |
|
68 | + webAlertAndQuit("User name is already in use!", 88); |
|
69 | + } |
|
70 | + |
|
71 | + // check if the email address already exist |
|
72 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
73 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
74 | + $limit = $modx->getDatabase()->getValue($rs); |
|
75 | + if($limit > 0) { |
|
76 | + webAlertAndQuit("Email is already in use!", 88); |
|
77 | + } |
|
78 | + } |
|
79 | + |
|
80 | + // generate a new password for this user |
|
81 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | + if(strlen($specifiedpassword) < 6) { |
|
83 | + webAlertAndQuit("Password is too short!", 88); |
|
84 | + } else { |
|
85 | + $newpassword = $specifiedpassword; |
|
86 | + } |
|
87 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
88 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
89 | + } elseif($passwordgenmethod == 'g') { |
|
90 | + $newpassword = generate_password(8); |
|
91 | + } else { |
|
92 | + webAlertAndQuit("No password generation method specified!", 88); |
|
93 | + } |
|
94 | + |
|
95 | + // invoke OnBeforeWUsrFormSave event |
|
96 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
97 | + "mode" => "new", |
|
98 | + )); |
|
99 | + |
|
100 | + // create the user account |
|
101 | + $field = array(); |
|
102 | + $field['username'] = $esc_newusername; |
|
103 | + $field['password'] = md5($newpassword); |
|
104 | + $internalKey = $modx->getDatabase()->insert($field, $tbl_web_users); |
|
105 | + |
|
106 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
107 | + $field = $modx->getDatabase()->escape($field); |
|
108 | + $modx->getDatabase()->insert($field, $tbl_web_user_attributes); |
|
109 | + |
|
110 | + // Save User Settings |
|
111 | 111 | saveWebUserSettings($internalKey); |
112 | 112 | |
113 | - // Set the item name for logger |
|
114 | - $_SESSION['itemname'] = $newusername; |
|
115 | - |
|
116 | - /*******************************************************************************/ |
|
117 | - // put the user in the user_groups he/ she should be in |
|
118 | - // first, check that up_perms are switched on! |
|
119 | - if($use_udperms == 1) { |
|
120 | - if(!empty($user_groups)) { |
|
121 | - for($i = 0; $i < count($user_groups); $i++) { |
|
122 | - $f = array(); |
|
123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
124 | - $f['webuser'] = $internalKey; |
|
125 | - $modx->getDatabase()->insert($f, $tbl_web_groups); |
|
126 | - } |
|
127 | - } |
|
128 | - } |
|
129 | - // end of user_groups stuff! |
|
113 | + // Set the item name for logger |
|
114 | + $_SESSION['itemname'] = $newusername; |
|
115 | + |
|
116 | + /*******************************************************************************/ |
|
117 | + // put the user in the user_groups he/ she should be in |
|
118 | + // first, check that up_perms are switched on! |
|
119 | + if($use_udperms == 1) { |
|
120 | + if(!empty($user_groups)) { |
|
121 | + for($i = 0; $i < count($user_groups); $i++) { |
|
122 | + $f = array(); |
|
123 | + $f['webgroup'] = (int)$user_groups[$i]; |
|
124 | + $f['webuser'] = $internalKey; |
|
125 | + $modx->getDatabase()->insert($f, $tbl_web_groups); |
|
126 | + } |
|
127 | + } |
|
128 | + } |
|
129 | + // end of user_groups stuff! |
|
130 | 130 | |
131 | 131 | // invoke OnWebSaveUser event |
132 | 132 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -144,26 +144,26 @@ discard block |
||
144 | 144 | "id" => $internalKey |
145 | 145 | )); |
146 | 146 | |
147 | - if($passwordnotifymethod == 'e') { |
|
147 | + if($passwordnotifymethod == 'e') { |
|
148 | 148 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
149 | - if($input['stay'] != '') { |
|
150 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | - header($header); |
|
153 | - } else { |
|
154 | - $header = "Location: index.php?a=99&r=2"; |
|
155 | - header($header); |
|
156 | - } |
|
157 | - } else { |
|
158 | - if($input['stay'] != '') { |
|
159 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | - } else { |
|
162 | - $stayUrl = "index.php?a=99&r=2"; |
|
163 | - } |
|
164 | - |
|
165 | - include_once "header.inc.php"; |
|
166 | - ?> |
|
149 | + if($input['stay'] != '') { |
|
150 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
151 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | + header($header); |
|
153 | + } else { |
|
154 | + $header = "Location: index.php?a=99&r=2"; |
|
155 | + header($header); |
|
156 | + } |
|
157 | + } else { |
|
158 | + if($input['stay'] != '') { |
|
159 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
160 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | + } else { |
|
162 | + $stayUrl = "index.php?a=99&r=2"; |
|
163 | + } |
|
164 | + |
|
165 | + include_once "header.inc.php"; |
|
166 | + ?> |
|
167 | 167 | |
168 | 168 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
169 | 169 | |
@@ -185,86 +185,86 @@ discard block |
||
185 | 185 | </div> |
186 | 186 | <?php |
187 | 187 | |
188 | - include_once "footer.inc.php"; |
|
189 | - } |
|
190 | - break; |
|
191 | - case '88' : // 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!", 88); |
|
197 | - } else { |
|
198 | - $newpassword = $specifiedpassword; |
|
199 | - } |
|
200 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
202 | - } elseif($passwordgenmethod == 'g') { |
|
203 | - $newpassword = generate_password(8); |
|
204 | - } else { |
|
205 | - webAlertAndQuit("No password generation method specified!", 88); |
|
206 | - } |
|
207 | - } |
|
208 | - if($passwordnotifymethod == 'e') { |
|
188 | + include_once "footer.inc.php"; |
|
189 | + } |
|
190 | + break; |
|
191 | + case '88' : // 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!", 88); |
|
197 | + } else { |
|
198 | + $newpassword = $specifiedpassword; |
|
199 | + } |
|
200 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
202 | + } elseif($passwordgenmethod == 'g') { |
|
203 | + $newpassword = generate_password(8); |
|
204 | + } else { |
|
205 | + webAlertAndQuit("No password generation method specified!", 88); |
|
206 | + } |
|
207 | + } |
|
208 | + if($passwordnotifymethod == 'e') { |
|
209 | 209 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
210 | - } |
|
211 | - |
|
212 | - // check if the username already exist |
|
213 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
214 | - $limit = $modx->getDatabase()->getValue($rs); |
|
215 | - if($limit > 0) { |
|
216 | - webAlertAndQuit("User name is already in use!", 88); |
|
217 | - } |
|
218 | - |
|
219 | - // check if the email address already exists |
|
220 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
221 | - $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
222 | - $limit = $modx->getDatabase()->getValue($rs); |
|
223 | - if($limit > 0) { |
|
224 | - webAlertAndQuit("Email is already in use!", 88); |
|
225 | - } |
|
226 | - } |
|
227 | - |
|
228 | - // invoke OnBeforeWUsrFormSave event |
|
229 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
230 | - "mode" => "upd", |
|
231 | - "id" => $id |
|
232 | - )); |
|
233 | - |
|
234 | - // update user name and password |
|
235 | - $field = array(); |
|
236 | - $field['username'] = $esc_newusername; |
|
237 | - if($genpassword == 1) { |
|
238 | - $field['password'] = md5($newpassword); |
|
239 | - } |
|
240 | - $modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'"); |
|
241 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
242 | - $field = $modx->getDatabase()->escape($field); |
|
243 | - $modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
244 | - |
|
245 | - // Save User Settings |
|
210 | + } |
|
211 | + |
|
212 | + // check if the username already exist |
|
213 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
214 | + $limit = $modx->getDatabase()->getValue($rs); |
|
215 | + if($limit > 0) { |
|
216 | + webAlertAndQuit("User name is already in use!", 88); |
|
217 | + } |
|
218 | + |
|
219 | + // check if the email address already exists |
|
220 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
221 | + $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
222 | + $limit = $modx->getDatabase()->getValue($rs); |
|
223 | + if($limit > 0) { |
|
224 | + webAlertAndQuit("Email is already in use!", 88); |
|
225 | + } |
|
226 | + } |
|
227 | + |
|
228 | + // invoke OnBeforeWUsrFormSave event |
|
229 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
230 | + "mode" => "upd", |
|
231 | + "id" => $id |
|
232 | + )); |
|
233 | + |
|
234 | + // update user name and password |
|
235 | + $field = array(); |
|
236 | + $field['username'] = $esc_newusername; |
|
237 | + if($genpassword == 1) { |
|
238 | + $field['password'] = md5($newpassword); |
|
239 | + } |
|
240 | + $modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'"); |
|
241 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
242 | + $field = $modx->getDatabase()->escape($field); |
|
243 | + $modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
244 | + |
|
245 | + // Save User Settings |
|
246 | 246 | saveWebUserSettings($id); |
247 | 247 | |
248 | - // Set the item name for logger |
|
249 | - $_SESSION['itemname'] = $newusername; |
|
250 | - |
|
251 | - /*******************************************************************************/ |
|
252 | - // put the user in the user_groups he/ she should be in |
|
253 | - // first, check that up_perms are switched on! |
|
254 | - if($use_udperms == 1) { |
|
255 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
256 | - $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'"); |
|
257 | - if(!empty($user_groups)) { |
|
258 | - for($i = 0; $i < count($user_groups); $i++) { |
|
259 | - $field = array(); |
|
260 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
261 | - $field['webuser'] = $id; |
|
262 | - $modx->getDatabase()->insert($field, $tbl_web_groups); |
|
263 | - } |
|
264 | - } |
|
265 | - } |
|
266 | - // end of user_groups stuff! |
|
267 | - /*******************************************************************************/ |
|
248 | + // Set the item name for logger |
|
249 | + $_SESSION['itemname'] = $newusername; |
|
250 | + |
|
251 | + /*******************************************************************************/ |
|
252 | + // put the user in the user_groups he/ she should be in |
|
253 | + // first, check that up_perms are switched on! |
|
254 | + if($use_udperms == 1) { |
|
255 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
256 | + $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'"); |
|
257 | + if(!empty($user_groups)) { |
|
258 | + for($i = 0; $i < count($user_groups); $i++) { |
|
259 | + $field = array(); |
|
260 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
261 | + $field['webuser'] = $id; |
|
262 | + $modx->getDatabase()->insert($field, $tbl_web_groups); |
|
263 | + } |
|
264 | + } |
|
265 | + } |
|
266 | + // end of user_groups stuff! |
|
267 | + /*******************************************************************************/ |
|
268 | 268 | |
269 | 269 | // invoke OnWebSaveUser event |
270 | 270 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -293,16 +293,16 @@ discard block |
||
293 | 293 | "id" => $id |
294 | 294 | )); |
295 | 295 | |
296 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | - if($input['stay'] != '') { |
|
298 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
299 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
300 | - } else { |
|
301 | - $stayUrl = "index.php?a=99&r=2"; |
|
302 | - } |
|
296 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | + if($input['stay'] != '') { |
|
298 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
299 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
300 | + } else { |
|
301 | + $stayUrl = "index.php?a=99&r=2"; |
|
302 | + } |
|
303 | 303 | |
304 | - include_once "header.inc.php"; |
|
305 | - ?> |
|
304 | + include_once "header.inc.php"; |
|
305 | + ?> |
|
306 | 306 | |
307 | 307 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
308 | 308 | |
@@ -322,18 +322,18 @@ discard block |
||
322 | 322 | </div> |
323 | 323 | <?php |
324 | 324 | |
325 | - include_once "footer.inc.php"; |
|
326 | - } else { |
|
327 | - if($input['stay'] != '') { |
|
328 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
329 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
330 | - header($header); |
|
331 | - } else { |
|
332 | - $header = "Location: index.php?a=99&r=2"; |
|
333 | - header($header); |
|
334 | - } |
|
335 | - } |
|
336 | - break; |
|
337 | - default : |
|
338 | - webAlertAndQuit("No operation set in request.", 88); |
|
325 | + include_once "footer.inc.php"; |
|
326 | + } else { |
|
327 | + if($input['stay'] != '') { |
|
328 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
329 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
330 | + header($header); |
|
331 | + } else { |
|
332 | + $header = "Location: index.php?a=99&r=2"; |
|
333 | + header($header); |
|
334 | + } |
|
335 | + } |
|
336 | + break; |
|
337 | + default : |
|
338 | + webAlertAndQuit("No operation set in request.", 88); |
|
339 | 339 | } |
@@ -60,110 +60,110 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | switch($input['mode']) { |
63 | - case '87' : // new user |
|
64 | - // check if this user name already exist |
|
65 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
66 | - $limit = $modx->getDatabase()->getValue($rs); |
|
67 | - if($limit > 0) { |
|
68 | - webAlertAndQuit("User name is already in use!", 88); |
|
69 | - } |
|
70 | - |
|
71 | - // check if the email address already exist |
|
72 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
73 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
74 | - $limit = $modx->getDatabase()->getValue($rs); |
|
75 | - if($limit > 0) { |
|
76 | - webAlertAndQuit("Email is already in use!", 88); |
|
77 | - } |
|
78 | - } |
|
79 | - |
|
80 | - // generate a new password for this user |
|
81 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | - if(strlen($specifiedpassword) < 6) { |
|
83 | - webAlertAndQuit("Password is too short!", 88); |
|
84 | - } else { |
|
85 | - $newpassword = $specifiedpassword; |
|
86 | - } |
|
87 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
88 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
89 | - } elseif($passwordgenmethod == 'g') { |
|
90 | - $newpassword = generate_password(8); |
|
91 | - } else { |
|
92 | - webAlertAndQuit("No password generation method specified!", 88); |
|
93 | - } |
|
94 | - |
|
95 | - // invoke OnBeforeWUsrFormSave event |
|
96 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
97 | - "mode" => "new", |
|
98 | - )); |
|
99 | - |
|
100 | - // create the user account |
|
101 | - $field = array(); |
|
102 | - $field['username'] = $esc_newusername; |
|
103 | - $field['password'] = md5($newpassword); |
|
104 | - $internalKey = $modx->getDatabase()->insert($field, $tbl_web_users); |
|
105 | - |
|
106 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
107 | - $field = $modx->getDatabase()->escape($field); |
|
108 | - $modx->getDatabase()->insert($field, $tbl_web_user_attributes); |
|
109 | - |
|
110 | - // Save User Settings |
|
111 | - saveWebUserSettings($internalKey); |
|
112 | - |
|
113 | - // Set the item name for logger |
|
114 | - $_SESSION['itemname'] = $newusername; |
|
115 | - |
|
116 | - /*******************************************************************************/ |
|
117 | - // put the user in the user_groups he/ she should be in |
|
118 | - // first, check that up_perms are switched on! |
|
119 | - if($use_udperms == 1) { |
|
120 | - if(!empty($user_groups)) { |
|
121 | - for($i = 0; $i < count($user_groups); $i++) { |
|
122 | - $f = array(); |
|
123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
124 | - $f['webuser'] = $internalKey; |
|
125 | - $modx->getDatabase()->insert($f, $tbl_web_groups); |
|
126 | - } |
|
127 | - } |
|
128 | - } |
|
129 | - // end of user_groups stuff! |
|
130 | - |
|
131 | - // invoke OnWebSaveUser event |
|
132 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
133 | - "mode" => "new", |
|
134 | - "userid" => $internalKey, |
|
135 | - "username" => $newusername, |
|
136 | - "userpassword" => $newpassword, |
|
137 | - "useremail" => $email, |
|
138 | - "userfullname" => $fullname |
|
139 | - )); |
|
140 | - |
|
141 | - // invoke OnWUsrFormSave event |
|
142 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
143 | - "mode" => "new", |
|
144 | - "id" => $internalKey |
|
145 | - )); |
|
146 | - |
|
147 | - if($passwordnotifymethod == 'e') { |
|
148 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
|
149 | - if($input['stay'] != '') { |
|
150 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | - header($header); |
|
153 | - } else { |
|
154 | - $header = "Location: index.php?a=99&r=2"; |
|
155 | - header($header); |
|
156 | - } |
|
157 | - } else { |
|
158 | - if($input['stay'] != '') { |
|
159 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | - } else { |
|
162 | - $stayUrl = "index.php?a=99&r=2"; |
|
163 | - } |
|
164 | - |
|
165 | - include_once "header.inc.php"; |
|
166 | - ?> |
|
63 | + case '87' : // new user |
|
64 | + // check if this user name already exist |
|
65 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
66 | + $limit = $modx->getDatabase()->getValue($rs); |
|
67 | + if($limit > 0) { |
|
68 | + webAlertAndQuit("User name is already in use!", 88); |
|
69 | + } |
|
70 | + |
|
71 | + // check if the email address already exist |
|
72 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
73 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
74 | + $limit = $modx->getDatabase()->getValue($rs); |
|
75 | + if($limit > 0) { |
|
76 | + webAlertAndQuit("Email is already in use!", 88); |
|
77 | + } |
|
78 | + } |
|
79 | + |
|
80 | + // generate a new password for this user |
|
81 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | + if(strlen($specifiedpassword) < 6) { |
|
83 | + webAlertAndQuit("Password is too short!", 88); |
|
84 | + } else { |
|
85 | + $newpassword = $specifiedpassword; |
|
86 | + } |
|
87 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
88 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
89 | + } elseif($passwordgenmethod == 'g') { |
|
90 | + $newpassword = generate_password(8); |
|
91 | + } else { |
|
92 | + webAlertAndQuit("No password generation method specified!", 88); |
|
93 | + } |
|
94 | + |
|
95 | + // invoke OnBeforeWUsrFormSave event |
|
96 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
97 | + "mode" => "new", |
|
98 | + )); |
|
99 | + |
|
100 | + // create the user account |
|
101 | + $field = array(); |
|
102 | + $field['username'] = $esc_newusername; |
|
103 | + $field['password'] = md5($newpassword); |
|
104 | + $internalKey = $modx->getDatabase()->insert($field, $tbl_web_users); |
|
105 | + |
|
106 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
107 | + $field = $modx->getDatabase()->escape($field); |
|
108 | + $modx->getDatabase()->insert($field, $tbl_web_user_attributes); |
|
109 | + |
|
110 | + // Save User Settings |
|
111 | + saveWebUserSettings($internalKey); |
|
112 | + |
|
113 | + // Set the item name for logger |
|
114 | + $_SESSION['itemname'] = $newusername; |
|
115 | + |
|
116 | + /*******************************************************************************/ |
|
117 | + // put the user in the user_groups he/ she should be in |
|
118 | + // first, check that up_perms are switched on! |
|
119 | + if($use_udperms == 1) { |
|
120 | + if(!empty($user_groups)) { |
|
121 | + for($i = 0; $i < count($user_groups); $i++) { |
|
122 | + $f = array(); |
|
123 | + $f['webgroup'] = (int)$user_groups[$i]; |
|
124 | + $f['webuser'] = $internalKey; |
|
125 | + $modx->getDatabase()->insert($f, $tbl_web_groups); |
|
126 | + } |
|
127 | + } |
|
128 | + } |
|
129 | + // end of user_groups stuff! |
|
130 | + |
|
131 | + // invoke OnWebSaveUser event |
|
132 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
133 | + "mode" => "new", |
|
134 | + "userid" => $internalKey, |
|
135 | + "username" => $newusername, |
|
136 | + "userpassword" => $newpassword, |
|
137 | + "useremail" => $email, |
|
138 | + "userfullname" => $fullname |
|
139 | + )); |
|
140 | + |
|
141 | + // invoke OnWUsrFormSave event |
|
142 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
143 | + "mode" => "new", |
|
144 | + "id" => $internalKey |
|
145 | + )); |
|
146 | + |
|
147 | + if($passwordnotifymethod == 'e') { |
|
148 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
|
149 | + if($input['stay'] != '') { |
|
150 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
151 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | + header($header); |
|
153 | + } else { |
|
154 | + $header = "Location: index.php?a=99&r=2"; |
|
155 | + header($header); |
|
156 | + } |
|
157 | + } else { |
|
158 | + if($input['stay'] != '') { |
|
159 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
160 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | + } else { |
|
162 | + $stayUrl = "index.php?a=99&r=2"; |
|
163 | + } |
|
164 | + |
|
165 | + include_once "header.inc.php"; |
|
166 | + ?> |
|
167 | 167 | |
168 | 168 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
169 | 169 | |
@@ -185,124 +185,124 @@ discard block |
||
185 | 185 | </div> |
186 | 186 | <?php |
187 | 187 | |
188 | - include_once "footer.inc.php"; |
|
189 | - } |
|
190 | - break; |
|
191 | - case '88' : // 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!", 88); |
|
197 | - } else { |
|
198 | - $newpassword = $specifiedpassword; |
|
199 | - } |
|
200 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
202 | - } elseif($passwordgenmethod == 'g') { |
|
203 | - $newpassword = generate_password(8); |
|
204 | - } else { |
|
205 | - webAlertAndQuit("No password generation method specified!", 88); |
|
206 | - } |
|
207 | - } |
|
208 | - if($passwordnotifymethod == 'e') { |
|
209 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
|
210 | - } |
|
211 | - |
|
212 | - // check if the username already exist |
|
213 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
214 | - $limit = $modx->getDatabase()->getValue($rs); |
|
215 | - if($limit > 0) { |
|
216 | - webAlertAndQuit("User name is already in use!", 88); |
|
217 | - } |
|
218 | - |
|
219 | - // check if the email address already exists |
|
220 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
221 | - $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
222 | - $limit = $modx->getDatabase()->getValue($rs); |
|
223 | - if($limit > 0) { |
|
224 | - webAlertAndQuit("Email is already in use!", 88); |
|
225 | - } |
|
226 | - } |
|
227 | - |
|
228 | - // invoke OnBeforeWUsrFormSave event |
|
229 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
230 | - "mode" => "upd", |
|
231 | - "id" => $id |
|
232 | - )); |
|
233 | - |
|
234 | - // update user name and password |
|
235 | - $field = array(); |
|
236 | - $field['username'] = $esc_newusername; |
|
237 | - if($genpassword == 1) { |
|
238 | - $field['password'] = md5($newpassword); |
|
239 | - } |
|
240 | - $modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'"); |
|
241 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
242 | - $field = $modx->getDatabase()->escape($field); |
|
243 | - $modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
244 | - |
|
245 | - // Save User Settings |
|
246 | - saveWebUserSettings($id); |
|
247 | - |
|
248 | - // Set the item name for logger |
|
249 | - $_SESSION['itemname'] = $newusername; |
|
250 | - |
|
251 | - /*******************************************************************************/ |
|
252 | - // put the user in the user_groups he/ she should be in |
|
253 | - // first, check that up_perms are switched on! |
|
254 | - if($use_udperms == 1) { |
|
255 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
256 | - $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'"); |
|
257 | - if(!empty($user_groups)) { |
|
258 | - for($i = 0; $i < count($user_groups); $i++) { |
|
259 | - $field = array(); |
|
260 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
261 | - $field['webuser'] = $id; |
|
262 | - $modx->getDatabase()->insert($field, $tbl_web_groups); |
|
263 | - } |
|
264 | - } |
|
265 | - } |
|
266 | - // end of user_groups stuff! |
|
267 | - /*******************************************************************************/ |
|
268 | - |
|
269 | - // invoke OnWebSaveUser event |
|
270 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
271 | - "mode" => "upd", |
|
272 | - "userid" => $id, |
|
273 | - "username" => $newusername, |
|
274 | - "userpassword" => $newpassword, |
|
275 | - "useremail" => $email, |
|
276 | - "userfullname" => $fullname, |
|
277 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
278 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
279 | - )); |
|
280 | - |
|
281 | - // invoke OnWebChangePassword event |
|
282 | - if($genpassword == 1) { |
|
283 | - $modx->invokeEvent("OnWebChangePassword", array( |
|
188 | + include_once "footer.inc.php"; |
|
189 | + } |
|
190 | + break; |
|
191 | + case '88' : // 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!", 88); |
|
197 | + } else { |
|
198 | + $newpassword = $specifiedpassword; |
|
199 | + } |
|
200 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
202 | + } elseif($passwordgenmethod == 'g') { |
|
203 | + $newpassword = generate_password(8); |
|
204 | + } else { |
|
205 | + webAlertAndQuit("No password generation method specified!", 88); |
|
206 | + } |
|
207 | + } |
|
208 | + if($passwordnotifymethod == 'e') { |
|
209 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
|
210 | + } |
|
211 | + |
|
212 | + // check if the username already exist |
|
213 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
214 | + $limit = $modx->getDatabase()->getValue($rs); |
|
215 | + if($limit > 0) { |
|
216 | + webAlertAndQuit("User name is already in use!", 88); |
|
217 | + } |
|
218 | + |
|
219 | + // check if the email address already exists |
|
220 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
221 | + $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
222 | + $limit = $modx->getDatabase()->getValue($rs); |
|
223 | + if($limit > 0) { |
|
224 | + webAlertAndQuit("Email is already in use!", 88); |
|
225 | + } |
|
226 | + } |
|
227 | + |
|
228 | + // invoke OnBeforeWUsrFormSave event |
|
229 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
230 | + "mode" => "upd", |
|
231 | + "id" => $id |
|
232 | + )); |
|
233 | + |
|
234 | + // update user name and password |
|
235 | + $field = array(); |
|
236 | + $field['username'] = $esc_newusername; |
|
237 | + if($genpassword == 1) { |
|
238 | + $field['password'] = md5($newpassword); |
|
239 | + } |
|
240 | + $modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'"); |
|
241 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
242 | + $field = $modx->getDatabase()->escape($field); |
|
243 | + $modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
244 | + |
|
245 | + // Save User Settings |
|
246 | + saveWebUserSettings($id); |
|
247 | + |
|
248 | + // Set the item name for logger |
|
249 | + $_SESSION['itemname'] = $newusername; |
|
250 | + |
|
251 | + /*******************************************************************************/ |
|
252 | + // put the user in the user_groups he/ she should be in |
|
253 | + // first, check that up_perms are switched on! |
|
254 | + if($use_udperms == 1) { |
|
255 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
256 | + $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'"); |
|
257 | + if(!empty($user_groups)) { |
|
258 | + for($i = 0; $i < count($user_groups); $i++) { |
|
259 | + $field = array(); |
|
260 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
261 | + $field['webuser'] = $id; |
|
262 | + $modx->getDatabase()->insert($field, $tbl_web_groups); |
|
263 | + } |
|
264 | + } |
|
265 | + } |
|
266 | + // end of user_groups stuff! |
|
267 | + /*******************************************************************************/ |
|
268 | + |
|
269 | + // invoke OnWebSaveUser event |
|
270 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
271 | + "mode" => "upd", |
|
284 | 272 | "userid" => $id, |
285 | 273 | "username" => $newusername, |
286 | - "userpassword" => $newpassword |
|
274 | + "userpassword" => $newpassword, |
|
275 | + "useremail" => $email, |
|
276 | + "userfullname" => $fullname, |
|
277 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
278 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
287 | 279 | )); |
288 | - } |
|
289 | 280 | |
290 | - // invoke OnWUsrFormSave event |
|
291 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
292 | - "mode" => "upd", |
|
293 | - "id" => $id |
|
294 | - )); |
|
281 | + // invoke OnWebChangePassword event |
|
282 | + if($genpassword == 1) { |
|
283 | + $modx->invokeEvent("OnWebChangePassword", array( |
|
284 | + "userid" => $id, |
|
285 | + "username" => $newusername, |
|
286 | + "userpassword" => $newpassword |
|
287 | + )); |
|
288 | + } |
|
289 | + |
|
290 | + // invoke OnWUsrFormSave event |
|
291 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
292 | + "mode" => "upd", |
|
293 | + "id" => $id |
|
294 | + )); |
|
295 | 295 | |
296 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | - if($input['stay'] != '') { |
|
298 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
299 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
300 | - } else { |
|
301 | - $stayUrl = "index.php?a=99&r=2"; |
|
302 | - } |
|
296 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | + if($input['stay'] != '') { |
|
298 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
299 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
300 | + } else { |
|
301 | + $stayUrl = "index.php?a=99&r=2"; |
|
302 | + } |
|
303 | 303 | |
304 | - include_once "header.inc.php"; |
|
305 | - ?> |
|
304 | + include_once "header.inc.php"; |
|
305 | + ?> |
|
306 | 306 | |
307 | 307 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
308 | 308 | |
@@ -322,18 +322,18 @@ discard block |
||
322 | 322 | </div> |
323 | 323 | <?php |
324 | 324 | |
325 | - include_once "footer.inc.php"; |
|
326 | - } else { |
|
327 | - if($input['stay'] != '') { |
|
328 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
329 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
330 | - header($header); |
|
331 | - } else { |
|
332 | - $header = "Location: index.php?a=99&r=2"; |
|
333 | - header($header); |
|
334 | - } |
|
335 | - } |
|
336 | - break; |
|
337 | - default : |
|
338 | - webAlertAndQuit("No operation set in request.", 88); |
|
325 | + include_once "footer.inc.php"; |
|
326 | + } else { |
|
327 | + if($input['stay'] != '') { |
|
328 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
329 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
330 | + header($header); |
|
331 | + } else { |
|
332 | + $header = "Location: index.php?a=99&r=2"; |
|
333 | + header($header); |
|
334 | + } |
|
335 | + } |
|
336 | + break; |
|
337 | + default : |
|
338 | + webAlertAndQuit("No operation set in request.", 88); |
|
339 | 339 | } |
@@ -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_web_user')) { |
|
5 | +if (!$modx->hasPermission('save_web_user')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | $tbl_web_groups = $modx->getFullTableName('web_groups'); |
12 | 12 | |
13 | 13 | $input = $_POST; |
14 | -foreach($input as $k => $v) { |
|
15 | - if($k !== 'comment') { |
|
14 | +foreach ($input as $k => $v) { |
|
15 | + if ($k !== 'comment') { |
|
16 | 16 | $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES); |
17 | 17 | } |
18 | 18 | $input[$k] = $v; |
19 | 19 | } |
20 | 20 | |
21 | -$id = (int)$input['id']; |
|
21 | +$id = (int) $input['id']; |
|
22 | 22 | $oldusername = $input['oldusername']; |
23 | 23 | $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User"; |
24 | 24 | $esc_newusername = $modx->getDatabase()->escape($newusername); |
@@ -50,21 +50,21 @@ discard block |
||
50 | 50 | $user_groups = $input['user_groups']; |
51 | 51 | |
52 | 52 | // verify password |
53 | -if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
53 | +if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
54 | 54 | webAlertAndQuit("Password typed is mismatched", 88); |
55 | 55 | } |
56 | 56 | |
57 | 57 | // verify email |
58 | -if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
58 | +if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
59 | 59 | webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
60 | 60 | } |
61 | 61 | |
62 | -switch($input['mode']) { |
|
62 | +switch ($input['mode']) { |
|
63 | 63 | case '87' : // new user |
64 | 64 | // check if this user name already exist |
65 | 65 | $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
66 | 66 | $limit = $modx->getDatabase()->getValue($rs); |
67 | - if($limit > 0) { |
|
67 | + if ($limit > 0) { |
|
68 | 68 | webAlertAndQuit("User name is already in use!", 88); |
69 | 69 | } |
70 | 70 | |
@@ -72,21 +72,21 @@ discard block |
||
72 | 72 | if ($modx->config['allow_multiple_emails'] != 1) { |
73 | 73 | $rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
74 | 74 | $limit = $modx->getDatabase()->getValue($rs); |
75 | - if($limit > 0) { |
|
75 | + if ($limit > 0) { |
|
76 | 76 | webAlertAndQuit("Email is already in use!", 88); |
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
80 | 80 | // generate a new password for this user |
81 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | - if(strlen($specifiedpassword) < 6) { |
|
81 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | + if (strlen($specifiedpassword) < 6) { |
|
83 | 83 | webAlertAndQuit("Password is too short!", 88); |
84 | 84 | } else { |
85 | 85 | $newpassword = $specifiedpassword; |
86 | 86 | } |
87 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
87 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
88 | 88 | webAlertAndQuit("You didn't specify a password for this user!", 88); |
89 | - } elseif($passwordgenmethod == 'g') { |
|
89 | + } elseif ($passwordgenmethod == 'g') { |
|
90 | 90 | $newpassword = generate_password(8); |
91 | 91 | } else { |
92 | 92 | webAlertAndQuit("No password generation method specified!", 88); |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | /*******************************************************************************/ |
117 | 117 | // put the user in the user_groups he/ she should be in |
118 | 118 | // first, check that up_perms are switched on! |
119 | - if($use_udperms == 1) { |
|
120 | - if(!empty($user_groups)) { |
|
121 | - for($i = 0; $i < count($user_groups); $i++) { |
|
119 | + if ($use_udperms == 1) { |
|
120 | + if (!empty($user_groups)) { |
|
121 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
122 | 122 | $f = array(); |
123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
123 | + $f['webgroup'] = (int) $user_groups[$i]; |
|
124 | 124 | $f['webuser'] = $internalKey; |
125 | 125 | $modx->getDatabase()->insert($f, $tbl_web_groups); |
126 | 126 | } |
@@ -144,20 +144,20 @@ discard block |
||
144 | 144 | "id" => $internalKey |
145 | 145 | )); |
146 | 146 | |
147 | - if($passwordnotifymethod == 'e') { |
|
147 | + if ($passwordnotifymethod == 'e') { |
|
148 | 148 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
149 | - if($input['stay'] != '') { |
|
149 | + if ($input['stay'] != '') { |
|
150 | 150 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
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=99&r=2"; |
155 | 155 | header($header); |
156 | 156 | } |
157 | 157 | } else { |
158 | - if($input['stay'] != '') { |
|
158 | + if ($input['stay'] != '') { |
|
159 | 159 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
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=99&r=2"; |
163 | 163 | } |
@@ -190,29 +190,29 @@ discard block |
||
190 | 190 | break; |
191 | 191 | case '88' : // 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!", 88); |
197 | 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!", 88); |
202 | - } elseif($passwordgenmethod == 'g') { |
|
202 | + } elseif ($passwordgenmethod == 'g') { |
|
203 | 203 | $newpassword = generate_password(8); |
204 | 204 | } else { |
205 | 205 | webAlertAndQuit("No password generation method specified!", 88); |
206 | 206 | } |
207 | 207 | } |
208 | - if($passwordnotifymethod == 'e') { |
|
208 | + if ($passwordnotifymethod == 'e') { |
|
209 | 209 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
210 | 210 | } |
211 | 211 | |
212 | 212 | // check if the username already exist |
213 | 213 | $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
214 | 214 | $limit = $modx->getDatabase()->getValue($rs); |
215 | - if($limit > 0) { |
|
215 | + if ($limit > 0) { |
|
216 | 216 | webAlertAndQuit("User name is already in use!", 88); |
217 | 217 | } |
218 | 218 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | if ($modx->config['allow_multiple_emails'] != 1) { |
221 | 221 | $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
222 | 222 | $limit = $modx->getDatabase()->getValue($rs); |
223 | - if($limit > 0) { |
|
223 | + if ($limit > 0) { |
|
224 | 224 | webAlertAndQuit("Email is already in use!", 88); |
225 | 225 | } |
226 | 226 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | // update user name and password |
235 | 235 | $field = array(); |
236 | 236 | $field['username'] = $esc_newusername; |
237 | - if($genpassword == 1) { |
|
237 | + if ($genpassword == 1) { |
|
238 | 238 | $field['password'] = md5($newpassword); |
239 | 239 | } |
240 | 240 | $modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'"); |
@@ -251,13 +251,13 @@ discard block |
||
251 | 251 | /*******************************************************************************/ |
252 | 252 | // put the user in the user_groups he/ she should be in |
253 | 253 | // first, check that up_perms are switched on! |
254 | - if($use_udperms == 1) { |
|
254 | + if ($use_udperms == 1) { |
|
255 | 255 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
256 | 256 | $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'"); |
257 | - if(!empty($user_groups)) { |
|
258 | - for($i = 0; $i < count($user_groups); $i++) { |
|
257 | + if (!empty($user_groups)) { |
|
258 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
259 | 259 | $field = array(); |
260 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
260 | + $field['webgroup'] = (int) $user_groups[$i]; |
|
261 | 261 | $field['webuser'] = $id; |
262 | 262 | $modx->getDatabase()->insert($field, $tbl_web_groups); |
263 | 263 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | )); |
280 | 280 | |
281 | 281 | // invoke OnWebChangePassword event |
282 | - if($genpassword == 1) { |
|
282 | + if ($genpassword == 1) { |
|
283 | 283 | $modx->invokeEvent("OnWebChangePassword", array( |
284 | 284 | "userid" => $id, |
285 | 285 | "username" => $newusername, |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | "id" => $id |
294 | 294 | )); |
295 | 295 | |
296 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | - if($input['stay'] != '') { |
|
296 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | + if ($input['stay'] != '') { |
|
298 | 298 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
299 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
299 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
300 | 300 | } else { |
301 | 301 | $stayUrl = "index.php?a=99&r=2"; |
302 | 302 | } |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | |
325 | 325 | include_once "footer.inc.php"; |
326 | 326 | } else { |
327 | - if($input['stay'] != '') { |
|
327 | + if ($input['stay'] != '') { |
|
328 | 328 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
329 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
329 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
330 | 330 | header($header); |
331 | 331 | } else { |
332 | 332 | $header = "Location: index.php?a=99&r=2"; |
@@ -3,12 +3,12 @@ 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('delete_web_user')) { |
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 | // Set the item name for logger |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeWUsrFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeWUsrFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the user. |
25 | 25 | $modx->getDatabase()->delete($modx->getFullTableName('web_users'), "id='{$id}'"); |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | |
33 | 33 | // invoke OnWebDeleteUser event |
34 | 34 | $modx->invokeEvent("OnWebDeleteUser", |
35 | - array( |
|
36 | - "userid" => $id, |
|
37 | - "username" => $username |
|
38 | - )); |
|
35 | + array( |
|
36 | + "userid" => $id, |
|
37 | + "username" => $username |
|
38 | + )); |
|
39 | 39 | |
40 | 40 | // invoke OnWUsrFormDelete event |
41 | 41 | $modx->invokeEvent("OnWUsrFormDelete", |
42 | - array( |
|
43 | - "id" => $id |
|
44 | - )); |
|
42 | + array( |
|
43 | + "id" => $id |
|
44 | + )); |
|
45 | 45 | |
46 | 46 | $header="Location: index.php?a=99"; |
47 | 47 | header($header); |
@@ -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->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->getDatabase()->getRecordCount($rs); |
17 | 17 | if($limit > 0) { |
18 | - include "header.inc.php"; |
|
19 | - ?> |
|
18 | + include "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 "footer.inc.php"; |
|
40 | - exit; |
|
39 | + include_once "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->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,20 +1,20 @@ 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->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->getDatabase()->getRecordCount($rs); |
17 | -if($limit > 0) { |
|
17 | +if ($limit > 0) { |
|
18 | 18 | include "header.inc.php"; |
19 | 19 | ?> |
20 | 20 | |
@@ -28,8 +28,8 @@ 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> |
@@ -40,7 +40,7 @@ discard block |
||
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 |
@@ -66,111 +66,111 @@ |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | switch ($_POST['mode']) { |
69 | - case '23': // Save new snippet |
|
70 | - |
|
71 | - // invoke OnBeforeSnipFormSave event |
|
72 | - $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
73 | - "mode" => "new", |
|
74 | - "id" => $id |
|
75 | - )); |
|
76 | - |
|
77 | - // disallow duplicate names for new snippets |
|
78 | - $rs = $modx->getDatabase()->select('COUNT(id)', $modx->getFullTableName('site_snippets'), "name='{$name}'"); |
|
79 | - $count = $modx->getDatabase()->getValue($rs); |
|
80 | - if ($count > 0) { |
|
81 | - $modx->getManagerApi()->saveFormValues(23); |
|
82 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=23"); |
|
83 | - } |
|
84 | - |
|
85 | - //do stuff to save the new doc |
|
86 | - $newid = $modx->getDatabase()->insert(array( |
|
87 | - 'name' => $name, |
|
88 | - 'description' => $description, |
|
89 | - 'snippet' => $snippet, |
|
90 | - 'moduleguid' => $moduleguid, |
|
91 | - 'locked' => $locked, |
|
92 | - 'properties' => $properties, |
|
93 | - 'category' => $categoryid, |
|
94 | - 'disabled' => $disabled, |
|
95 | - 'createdon' => $currentdate, |
|
96 | - 'editedon' => $currentdate |
|
97 | - ), $modx->getFullTableName('site_snippets')); |
|
98 | - |
|
99 | - // invoke OnSnipFormSave event |
|
100 | - $modx->invokeEvent("OnSnipFormSave", array( |
|
101 | - "mode" => "new", |
|
102 | - "id" => $newid |
|
103 | - )); |
|
104 | - |
|
105 | - // Set the item name for logger |
|
106 | - $_SESSION['itemname'] = $name; |
|
107 | - |
|
108 | - // empty cache |
|
109 | - $modx->clearCache('full'); |
|
110 | - |
|
111 | - // finished emptying cache - redirect |
|
112 | - if ($_POST['stay'] != '') { |
|
113 | - $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23"; |
|
114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
115 | - header($header); |
|
116 | - } else { |
|
117 | - $header = "Location: index.php?a=76&r=2"; |
|
118 | - header($header); |
|
119 | - } |
|
120 | - break; |
|
121 | - case '22': // Save existing snippet |
|
122 | - // invoke OnBeforeSnipFormSave event |
|
123 | - $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
124 | - "mode" => "upd", |
|
125 | - "id" => $id |
|
126 | - )); |
|
127 | - |
|
128 | - // disallow duplicate names for snippets |
|
129 | - $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_snippets'), "name='{$name}' AND id!='{$id}'"); |
|
130 | - if ($modx->getDatabase()->getValue($rs) > 0) { |
|
131 | - $modx->getManagerApi()->saveFormValues(22); |
|
132 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=22&id={$id}"); |
|
133 | - } |
|
134 | - |
|
135 | - //do stuff to save the edited doc |
|
136 | - $modx->getDatabase()->update(array( |
|
137 | - 'name' => $name, |
|
138 | - 'description' => $description, |
|
139 | - 'snippet' => $snippet, |
|
140 | - 'moduleguid' => $moduleguid, |
|
141 | - 'locked' => $locked, |
|
142 | - 'properties' => $properties, |
|
143 | - 'category' => $categoryid, |
|
144 | - 'disabled' => $disabled, |
|
145 | - 'editedon' => $currentdate |
|
146 | - ), $modx->getFullTableName('site_snippets'), "id='{$id}'"); |
|
147 | - |
|
148 | - // invoke OnSnipFormSave event |
|
149 | - $modx->invokeEvent("OnSnipFormSave", array( |
|
150 | - "mode" => "upd", |
|
151 | - "id" => $id |
|
152 | - )); |
|
153 | - |
|
154 | - // Set the item name for logger |
|
155 | - $_SESSION['itemname'] = $name; |
|
156 | - |
|
157 | - // empty cache |
|
158 | - $modx->clearCache('full'); |
|
159 | - |
|
160 | - if ($_POST['runsnippet']) { |
|
161 | - run_snippet($snippet); |
|
162 | - } |
|
163 | - // finished emptying cache - redirect |
|
164 | - if ($_POST['stay'] != '') { |
|
165 | - $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23"; |
|
166 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
167 | - header($header); |
|
168 | - } else { |
|
169 | - $modx->unlockElement(4, $id); |
|
170 | - $header = "Location: index.php?a=76&r=2"; |
|
171 | - header($header); |
|
172 | - } |
|
173 | - break; |
|
174 | - default: |
|
175 | - $modx->webAlertAndQuit("No operation set in request."); |
|
69 | + case '23': // Save new snippet |
|
70 | + |
|
71 | + // invoke OnBeforeSnipFormSave event |
|
72 | + $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
73 | + "mode" => "new", |
|
74 | + "id" => $id |
|
75 | + )); |
|
76 | + |
|
77 | + // disallow duplicate names for new snippets |
|
78 | + $rs = $modx->getDatabase()->select('COUNT(id)', $modx->getFullTableName('site_snippets'), "name='{$name}'"); |
|
79 | + $count = $modx->getDatabase()->getValue($rs); |
|
80 | + if ($count > 0) { |
|
81 | + $modx->getManagerApi()->saveFormValues(23); |
|
82 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=23"); |
|
83 | + } |
|
84 | + |
|
85 | + //do stuff to save the new doc |
|
86 | + $newid = $modx->getDatabase()->insert(array( |
|
87 | + 'name' => $name, |
|
88 | + 'description' => $description, |
|
89 | + 'snippet' => $snippet, |
|
90 | + 'moduleguid' => $moduleguid, |
|
91 | + 'locked' => $locked, |
|
92 | + 'properties' => $properties, |
|
93 | + 'category' => $categoryid, |
|
94 | + 'disabled' => $disabled, |
|
95 | + 'createdon' => $currentdate, |
|
96 | + 'editedon' => $currentdate |
|
97 | + ), $modx->getFullTableName('site_snippets')); |
|
98 | + |
|
99 | + // invoke OnSnipFormSave event |
|
100 | + $modx->invokeEvent("OnSnipFormSave", array( |
|
101 | + "mode" => "new", |
|
102 | + "id" => $newid |
|
103 | + )); |
|
104 | + |
|
105 | + // Set the item name for logger |
|
106 | + $_SESSION['itemname'] = $name; |
|
107 | + |
|
108 | + // empty cache |
|
109 | + $modx->clearCache('full'); |
|
110 | + |
|
111 | + // finished emptying cache - redirect |
|
112 | + if ($_POST['stay'] != '') { |
|
113 | + $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23"; |
|
114 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
115 | + header($header); |
|
116 | + } else { |
|
117 | + $header = "Location: index.php?a=76&r=2"; |
|
118 | + header($header); |
|
119 | + } |
|
120 | + break; |
|
121 | + case '22': // Save existing snippet |
|
122 | + // invoke OnBeforeSnipFormSave event |
|
123 | + $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
124 | + "mode" => "upd", |
|
125 | + "id" => $id |
|
126 | + )); |
|
127 | + |
|
128 | + // disallow duplicate names for snippets |
|
129 | + $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_snippets'), "name='{$name}' AND id!='{$id}'"); |
|
130 | + if ($modx->getDatabase()->getValue($rs) > 0) { |
|
131 | + $modx->getManagerApi()->saveFormValues(22); |
|
132 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=22&id={$id}"); |
|
133 | + } |
|
134 | + |
|
135 | + //do stuff to save the edited doc |
|
136 | + $modx->getDatabase()->update(array( |
|
137 | + 'name' => $name, |
|
138 | + 'description' => $description, |
|
139 | + 'snippet' => $snippet, |
|
140 | + 'moduleguid' => $moduleguid, |
|
141 | + 'locked' => $locked, |
|
142 | + 'properties' => $properties, |
|
143 | + 'category' => $categoryid, |
|
144 | + 'disabled' => $disabled, |
|
145 | + 'editedon' => $currentdate |
|
146 | + ), $modx->getFullTableName('site_snippets'), "id='{$id}'"); |
|
147 | + |
|
148 | + // invoke OnSnipFormSave event |
|
149 | + $modx->invokeEvent("OnSnipFormSave", array( |
|
150 | + "mode" => "upd", |
|
151 | + "id" => $id |
|
152 | + )); |
|
153 | + |
|
154 | + // Set the item name for logger |
|
155 | + $_SESSION['itemname'] = $name; |
|
156 | + |
|
157 | + // empty cache |
|
158 | + $modx->clearCache('full'); |
|
159 | + |
|
160 | + if ($_POST['runsnippet']) { |
|
161 | + run_snippet($snippet); |
|
162 | + } |
|
163 | + // finished emptying cache - redirect |
|
164 | + if ($_POST['stay'] != '') { |
|
165 | + $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23"; |
|
166 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
167 | + header($header); |
|
168 | + } else { |
|
169 | + $modx->unlockElement(4, $id); |
|
170 | + $header = "Location: index.php?a=76&r=2"; |
|
171 | + header($header); |
|
172 | + } |
|
173 | + break; |
|
174 | + default: |
|
175 | + $modx->webAlertAndQuit("No operation set in request."); |
|
176 | 176 | } |
@@ -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_snippet')) { |
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 = trim($_POST['post']); |
11 | 11 | $name = $modx->getDatabase()->escape(trim($_POST['name'])); |
12 | 12 | $description = $modx->getDatabase()->escape($_POST['description']); |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | |
34 | 34 | //Kyle Jaebker - added category support |
35 | 35 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
36 | - $categoryid = (int)$_POST['categoryid']; |
|
36 | + $categoryid = (int) $_POST['categoryid']; |
|
37 | 37 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
38 | 38 | $categoryid = 0; |
39 | 39 | } else { |
40 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
40 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
41 | 41 | $categoryid = checkCategory($_POST['newcategory']); |
42 | 42 | if (!$categoryid) { |
43 | 43 | $categoryid = newCategory($_POST['newcategory']); |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid; |
56 | 56 | |
57 | 57 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
58 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
58 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
59 | 59 | if ($version) { |
60 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
60 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
61 | 61 | } |
62 | 62 | if (isset($parsed['modx_category'])) { |
63 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
63 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
64 | 64 | $categoryid = getCategory($parsed['modx_category']); |
65 | 65 | } |
66 | 66 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // finished emptying cache - redirect |
112 | 112 | if ($_POST['stay'] != '') { |
113 | 113 | $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23"; |
114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
114 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
115 | 115 | header($header); |
116 | 116 | } else { |
117 | 117 | $header = "Location: index.php?a=76&r=2"; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | // finished emptying cache - redirect |
164 | 164 | if ($_POST['stay'] != '') { |
165 | 165 | $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23"; |
166 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
166 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
167 | 167 | header($header); |
168 | 168 | } else { |
169 | 169 | $modx->unlockElement(4, $id); |
@@ -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->config['base_path'] . '.htaccess'; |
|
15 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
16 | - $dir = '/' . trim($modx->config['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->config['base_path'] . '.htaccess'; |
|
15 | + $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
16 | + $dir = '/' . trim($modx->config['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->config['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->config['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,22 +56,22 @@ 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) { |
|
72 | - case 'site_name': |
|
73 | - $v = htmlspecialchars($v); |
|
74 | - break; |
|
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 | + case 'site_name': |
|
73 | + $v = htmlspecialchars($v); |
|
74 | + break; |
|
75 | 75 | case 'settings_version':{ |
76 | 76 | if($modx->getVersionData('version')!=$data['settings_version']){ |
77 | 77 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
@@ -79,24 +79,24 @@ discard block |
||
79 | 79 | } |
80 | 80 | break; |
81 | 81 | } |
82 | - case 'error_page': |
|
83 | - case 'unauthorized_page': |
|
84 | - if (trim($v) == '' || !is_numeric($v)) { |
|
85 | - $v = $data['site_start']; |
|
86 | - } |
|
87 | - break; |
|
82 | + case 'error_page': |
|
83 | + case 'unauthorized_page': |
|
84 | + if (trim($v) == '' || !is_numeric($v)) { |
|
85 | + $v = $data['site_start']; |
|
86 | + } |
|
87 | + break; |
|
88 | 88 | |
89 | - case 'lst_custom_contenttype': |
|
90 | - case 'txt_custom_contenttype': |
|
91 | - // Skip these |
|
92 | - $k = ''; |
|
93 | - break; |
|
94 | - case 'rb_base_dir': |
|
95 | - case 'rb_base_url': |
|
96 | - case 'filemanager_path': |
|
97 | - $v = trim($v); |
|
98 | - $v = rtrim($v,'/') . '/'; |
|
99 | - break; |
|
89 | + case 'lst_custom_contenttype': |
|
90 | + case 'txt_custom_contenttype': |
|
91 | + // Skip these |
|
92 | + $k = ''; |
|
93 | + break; |
|
94 | + case 'rb_base_dir': |
|
95 | + case 'rb_base_url': |
|
96 | + case 'filemanager_path': |
|
97 | + $v = trim($v); |
|
98 | + $v = rtrim($v,'/') . '/'; |
|
99 | + break; |
|
100 | 100 | case 'manager_language': |
101 | 101 | $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
102 | 102 | $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
@@ -104,56 +104,56 @@ discard block |
||
104 | 104 | if($langDir !== $langFileDir || !file_exists($langFile)) { |
105 | 105 | $v = 'english'; |
106 | 106 | } |
107 | - break; |
|
108 | - case 'smtppw': |
|
109 | - if ($v !== '********************' && $v !== '') { |
|
110 | - $v = trim($v); |
|
111 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | - $v = str_replace('=','%',$v); |
|
113 | - } elseif ($v === '********************') { |
|
114 | - $k = ''; |
|
115 | - } |
|
116 | - break; |
|
107 | + break; |
|
108 | + case 'smtppw': |
|
109 | + if ($v !== '********************' && $v !== '') { |
|
110 | + $v = trim($v); |
|
111 | + $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | + $v = str_replace('=','%',$v); |
|
113 | + } elseif ($v === '********************') { |
|
114 | + $k = ''; |
|
115 | + } |
|
116 | + break; |
|
117 | 117 | case 'valid_hostnames': |
118 | - $v = str_replace(array(' ,', ', '), ',', $v); |
|
119 | - if ($v !== ',') { |
|
120 | - $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
121 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
122 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
123 | - } |
|
124 | - $k = ''; |
|
125 | - break; |
|
126 | - case 'session_timeout': |
|
127 | - $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
128 | - $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 |
|
129 | - break; |
|
130 | - default: |
|
131 | - break; |
|
132 | - } |
|
133 | - $v = is_array($v) ? implode(",", $v) : $v; |
|
118 | + $v = str_replace(array(' ,', ', '), ',', $v); |
|
119 | + if ($v !== ',') { |
|
120 | + $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
121 | + $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
122 | + @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
123 | + } |
|
124 | + $k = ''; |
|
125 | + break; |
|
126 | + case 'session_timeout': |
|
127 | + $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
128 | + $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 |
|
129 | + break; |
|
130 | + default: |
|
131 | + break; |
|
132 | + } |
|
133 | + $v = is_array($v) ? implode(",", $v) : $v; |
|
134 | 134 | |
135 | - $modx->config[$k] = $v; |
|
135 | + $modx->config[$k] = $v; |
|
136 | 136 | |
137 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
138 | - } |
|
137 | + if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
138 | + } |
|
139 | 139 | |
140 | - // Run a single query to save all the values |
|
141 | - $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
140 | + // Run a single query to save all the values |
|
141 | + $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
142 | 142 | VALUES ".implode(', ', $savethese); |
143 | - $modx->getDatabase()->query($sql); |
|
143 | + $modx->getDatabase()->query($sql); |
|
144 | 144 | |
145 | - // Reset Template Pages |
|
146 | - if (isset($data['reset_template'])) { |
|
147 | - $newtemplate = (int)$data['default_template']; |
|
148 | - $oldtemplate = (int)$data['old_template']; |
|
149 | - $tbl = $modx->getFullTableName('site_content'); |
|
150 | - $reset = $data['reset_template']; |
|
151 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
153 | - } |
|
145 | + // Reset Template Pages |
|
146 | + if (isset($data['reset_template'])) { |
|
147 | + $newtemplate = (int)$data['default_template']; |
|
148 | + $oldtemplate = (int)$data['old_template']; |
|
149 | + $tbl = $modx->getFullTableName('site_content'); |
|
150 | + $reset = $data['reset_template']; |
|
151 | + if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | + else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
153 | + } |
|
154 | 154 | |
155 | - // empty cache |
|
156 | - $modx->clearCache('full'); |
|
155 | + // empty cache |
|
156 | + $modx->clearCache('full'); |
|
157 | 157 | } |
158 | 158 | $header="Location: index.php?a=7&r=10"; |
159 | 159 | 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->config['base_path'] . '.htaccess'; |
|
15 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
16 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
17 | - if(is_file($htaccess)) |
|
14 | + $htaccess = $modx->config['base_path'].'.htaccess'; |
|
15 | + $sample_htaccess = $modx->config['base_path'].'ht.access'; |
|
16 | + $dir = '/'.trim($modx->config['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->config['base_url']!=='/') |
|
39 | + elseif ($modx->config['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,15 +66,15 @@ 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 'site_name': |
73 | 73 | $v = htmlspecialchars($v); |
74 | 74 | break; |
75 | 75 | case 'settings_version':{ |
76 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
77 | - $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
|
76 | + if ($modx->getVersionData('version') != $data['settings_version']) { |
|
77 | + $modx->logEvent(17, 2, '<pre>'.var_export($data['settings_version'], true).'</pre>', 'fake settings_version'); |
|
78 | 78 | $v = $modx->getVersionData('version'); |
79 | 79 | } |
80 | 80 | break; |
@@ -95,21 +95,21 @@ discard block |
||
95 | 95 | case 'rb_base_url': |
96 | 96 | case 'filemanager_path': |
97 | 97 | $v = trim($v); |
98 | - $v = rtrim($v,'/') . '/'; |
|
98 | + $v = rtrim($v, '/').'/'; |
|
99 | 99 | break; |
100 | 100 | case 'manager_language': |
101 | - $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
|
102 | - $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
|
101 | + $langDir = realpath(MODX_MANAGER_PATH.'includes/lang'); |
|
102 | + $langFile = realpath(MODX_MANAGER_PATH.'includes/lang/'.$v.'.inc.php'); |
|
103 | 103 | $langFileDir = dirname($langFile); |
104 | - if($langDir !== $langFileDir || !file_exists($langFile)) { |
|
104 | + if ($langDir !== $langFileDir || !file_exists($langFile)) { |
|
105 | 105 | $v = 'english'; |
106 | 106 | } |
107 | 107 | break; |
108 | 108 | case 'smtppw': |
109 | 109 | if ($v !== '********************' && $v !== '') { |
110 | 110 | $v = trim($v); |
111 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | - $v = str_replace('=','%',$v); |
|
111 | + $v = base64_encode($v).substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | + $v = str_replace('=', '%', $v); |
|
113 | 113 | } elseif ($v === '********************') { |
114 | 114 | $k = ''; |
115 | 115 | } |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | $v = str_replace(array(' ,', ', '), ',', $v); |
119 | 119 | if ($v !== ',') { |
120 | 120 | $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
121 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
122 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
121 | + $configString = '<?php'."\n".'define(\'MODX_SITE_HOSTNAMES\', \''.$v.'\');'."\n"; |
|
122 | + @file_put_contents(MODX_BASE_PATH.'assets/cache/siteHostnames.php', $configString); |
|
123 | 123 | } |
124 | 124 | $k = ''; |
125 | 125 | break; |
126 | 126 | case 'session_timeout': |
127 | 127 | $mail_check_timeperiod = $data['mail_check_timeperiod']; |
128 | - $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 |
|
128 | + $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 |
|
129 | 129 | break; |
130 | 130 | default: |
131 | 131 | break; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | $modx->config[$k] = $v; |
136 | 136 | |
137 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
137 | + if (!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | // Run a single query to save all the values |
@@ -144,16 +144,16 @@ discard block |
||
144 | 144 | |
145 | 145 | // Reset Template Pages |
146 | 146 | if (isset($data['reset_template'])) { |
147 | - $newtemplate = (int)$data['default_template']; |
|
148 | - $oldtemplate = (int)$data['old_template']; |
|
147 | + $newtemplate = (int) $data['default_template']; |
|
148 | + $oldtemplate = (int) $data['old_template']; |
|
149 | 149 | $tbl = $modx->getFullTableName('site_content'); |
150 | 150 | $reset = $data['reset_template']; |
151 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
151 | + if ($reset == 1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | + else if ($reset == 2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | // empty cache |
156 | 156 | $modx->clearCache('full'); |
157 | 157 | } |
158 | -$header="Location: index.php?a=7&r=10"; |
|
158 | +$header = "Location: index.php?a=7&r=10"; |
|
159 | 159 | header($header); |
@@ -9,39 +9,27 @@ discard block |
||
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->config['base_path'] . '.htaccess'; |
15 | 14 | $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
16 | 15 | $dir = '/' . trim($modx->config['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->config['base_url']!=='/') |
|
40 | - { |
|
29 | + } elseif($modx->config['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 | } |
@@ -73,7 +61,7 @@ discard block |
||
73 | 61 | $v = htmlspecialchars($v); |
74 | 62 | break; |
75 | 63 | case 'settings_version':{ |
76 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
64 | + if($modx->getVersionData('version')!=$data['settings_version']) { |
|
77 | 65 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
78 | 66 | $v = $modx->getVersionData('version'); |
79 | 67 | } |
@@ -134,7 +122,9 @@ discard block |
||
134 | 122 | |
135 | 123 | $modx->config[$k] = $v; |
136 | 124 | |
137 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
125 | + if(!empty($k)) { |
|
126 | + $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
127 | + } |
|
138 | 128 | } |
139 | 129 | |
140 | 130 | // Run a single query to save all the values |
@@ -148,8 +138,11 @@ discard block |
||
148 | 138 | $oldtemplate = (int)$data['old_template']; |
149 | 139 | $tbl = $modx->getFullTableName('site_content'); |
150 | 140 | $reset = $data['reset_template']; |
151 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
141 | + if($reset==1) { |
|
142 | + $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
143 | + } else if($reset==2) { |
|
144 | + $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
145 | + } |
|
153 | 146 | } |
154 | 147 | |
155 | 148 | // empty cache |
@@ -1,25 +1,25 @@ 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('delete_document')) { |
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 | /*******ищем родителя чтобы к нему вернуться********/ |
15 | -$content=$modx->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
15 | +$content = $modx->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
17 | 17 | |
18 | 18 | /************ а заодно и путь возврата (сам путь внизу файла) **********/ |
19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
22 | -$add_path=$sd.$sb.$pg; |
|
19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
22 | +$add_path = $sd.$sb.$pg; |
|
23 | 23 | |
24 | 24 | /*****************************/ |
25 | 25 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | "children"=>$children |
46 | 46 | )); |
47 | 47 | |
48 | -if (count($children)>0) { |
|
48 | +if (count($children) > 0) { |
|
49 | 49 | $modx->getDatabase()->update( |
50 | 50 | array( |
51 | 51 | 'deleted' => 1, |
@@ -54,19 +54,19 @@ discard block |
||
54 | 54 | ), $modx->getFullTableName('site_content'), "id IN (".implode(", ", $children).")"); |
55 | 55 | } |
56 | 56 | |
57 | -if ($site_start==$id) { |
|
57 | +if ($site_start == $id) { |
|
58 | 58 | $modx->webAlertAndQuit("Document is 'Site start' and cannot be deleted!"); |
59 | 59 | } |
60 | 60 | |
61 | -if ($site_unavailable_page==$id) { |
|
61 | +if ($site_unavailable_page == $id) { |
|
62 | 62 | $modx->webAlertAndQuit("Document is used as the 'Site unavailable page' and cannot be deleted!"); |
63 | 63 | } |
64 | 64 | |
65 | -if ($error_page==$id) { |
|
65 | +if ($error_page == $id) { |
|
66 | 66 | $modx->webAlertAndQuit("Document is used as the 'Site error page' and cannot be deleted!"); |
67 | 67 | } |
68 | 68 | |
69 | -if ($unauthorized_page==$id) { |
|
69 | +if ($unauthorized_page == $id) { |
|
70 | 70 | $modx->webAlertAndQuit("Document is used as the 'Site unauthorized page' and cannot be deleted!"); |
71 | 71 | } |
72 | 72 | |
@@ -92,5 +92,5 @@ discard block |
||
92 | 92 | $modx->clearCache('full'); |
93 | 93 | |
94 | 94 | // finished emptying cache - redirect |
95 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
95 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
96 | 96 | header($header); |
@@ -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 = $modx->getDatabase()->escape(trim($_POST['name'])); |
11 | 11 | $description = $modx->getDatabase()->escape($_POST['description']); |
12 | 12 | $caption = $modx->getDatabase()->escape($_POST['caption']); |
@@ -17,17 +17,17 @@ discard block |
||
17 | 17 | $display = $modx->getDatabase()->escape($_POST['display']); |
18 | 18 | $params = $modx->getDatabase()->escape($_POST['params']); |
19 | 19 | $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']); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // finished emptying cache - redirect |
100 | 100 | if ($_POST['stay'] != '') { |
101 | 101 | $a = ($_POST['stay'] == '2') ? "301&id=$newid" : "300"; |
102 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
102 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
103 | 103 | header($header); |
104 | 104 | } else { |
105 | 105 | $header = "Location: index.php?a=76&r=2"; |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | // finished emptying cache - redirect |
161 | 161 | if ($_POST['stay'] != '') { |
162 | 162 | $a = ($_POST['stay'] == '2') ? "301&id=$id" : "300"; |
163 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'] . "&or=" . $origin . "&oid=" . $originId; |
|
163 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']."&or=".$origin."&oid=".$originId; |
|
164 | 164 | header($header); |
165 | 165 | } else { |
166 | 166 | $modx->unlockElement(2, $id); |
167 | - $header = "Location: index.php?a=" . $origin . "&r=2" . (empty($originId) ? '' : '&id=' . $originId); |
|
167 | + $header = "Location: index.php?a=".$origin."&r=2".(empty($originId) ? '' : '&id='.$originId); |
|
168 | 168 | header($header); |
169 | 169 | } |
170 | 170 |