@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('delete_snippet')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // Set the item name for logger |
@@ -15,18 +15,18 @@ discard block |
||
15 | 15 | |
16 | 16 | // invoke OnBeforeSnipFormDelete event |
17 | 17 | $modx->invokeEvent("OnBeforeSnipFormDelete", |
18 | - array( |
|
19 | - "id" => $id |
|
20 | - )); |
|
18 | + array( |
|
19 | + "id" => $id |
|
20 | + )); |
|
21 | 21 | |
22 | 22 | // delete the snippet. |
23 | 23 | $modx->db->delete($modx->getFullTableName('site_snippets'), "id='{$id}'"); |
24 | 24 | |
25 | 25 | // invoke OnSnipFormDelete event |
26 | 26 | $modx->invokeEvent("OnSnipFormDelete", |
27 | - array( |
|
28 | - "id" => $id |
|
29 | - )); |
|
27 | + array( |
|
28 | + "id" => $id |
|
29 | + )); |
|
30 | 30 | |
31 | 31 | // empty cache |
32 | 32 | $modx->clearCache('full'); |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_snippet')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('delete_snippet')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
@@ -32,5 +32,5 @@ discard block |
||
32 | 32 | $modx->clearCache('full'); |
33 | 33 | |
34 | 34 | // finished emptying cache - redirect |
35 | -$header="Location: index.php?a=76&r=2"; |
|
35 | +$header = "Location: index.php?a=76&r=2"; |
|
36 | 36 | header($header); |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('delete_snippet')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -1,51 +1,51 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('exec_module')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // check if user has access permission, except admins |
13 | 13 | if($_SESSION['mgrRole']!=1){ |
14 | - $rs = $modx->db->select( |
|
15 | - 'sma.usergroup,mg.member', |
|
16 | - $modx->getFullTableName("site_module_access")." sma |
|
14 | + $rs = $modx->db->select( |
|
15 | + 'sma.usergroup,mg.member', |
|
16 | + $modx->getFullTableName("site_module_access")." sma |
|
17 | 17 | LEFT JOIN ".$modx->getFullTableName("member_groups")." mg ON mg.user_group = sma.usergroup AND member='".$modx->getLoginUserID()."'", |
18 | - "sma.module = '{$id}'" |
|
19 | - ); |
|
20 | - //initialize permission to -1, if it stays -1 no permissions |
|
21 | - //attached so permission granted |
|
22 | - $permissionAccessInt = -1; |
|
18 | + "sma.module = '{$id}'" |
|
19 | + ); |
|
20 | + //initialize permission to -1, if it stays -1 no permissions |
|
21 | + //attached so permission granted |
|
22 | + $permissionAccessInt = -1; |
|
23 | 23 | |
24 | - while ($row = $modx->db->getRow($rs)) { |
|
25 | - if($row["usergroup"] && $row["member"]) { |
|
26 | - //if there are permissions and this member has permission, ofcourse |
|
27 | - //this is granted |
|
28 | - $permissionAccessInt = 1; |
|
29 | - } elseif ($permissionAccessInt==-1) { |
|
30 | - //if there are permissions but this member has no permission and the |
|
31 | - //variable was still in init state we set permission to 0; no permissions |
|
32 | - $permissionAccessInt = 0; |
|
33 | - } |
|
34 | - } |
|
24 | + while ($row = $modx->db->getRow($rs)) { |
|
25 | + if($row["usergroup"] && $row["member"]) { |
|
26 | + //if there are permissions and this member has permission, ofcourse |
|
27 | + //this is granted |
|
28 | + $permissionAccessInt = 1; |
|
29 | + } elseif ($permissionAccessInt==-1) { |
|
30 | + //if there are permissions but this member has no permission and the |
|
31 | + //variable was still in init state we set permission to 0; no permissions |
|
32 | + $permissionAccessInt = 0; |
|
33 | + } |
|
34 | + } |
|
35 | 35 | |
36 | - if($permissionAccessInt==0) { |
|
37 | - $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
|
38 | - } |
|
36 | + if($permissionAccessInt==0) { |
|
37 | + $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | // get module data |
42 | 42 | $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'"); |
43 | 43 | $content = $modx->db->getRow($rs); |
44 | 44 | if(!$content) { |
45 | - $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
|
45 | + $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
|
46 | 46 | } |
47 | 47 | if($content['disabled']) { |
48 | - $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
|
48 | + $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // Set the item name for logger |
@@ -63,38 +63,38 @@ discard block |
||
63 | 63 | |
64 | 64 | // evalModule |
65 | 65 | function evalModule($moduleCode,$params){ |
66 | - global $modx; |
|
67 | - $modx->event->params = &$params; // store params inside event object |
|
68 | - if(is_array($params)) { |
|
69 | - extract($params, EXTR_SKIP); |
|
70 | - } |
|
71 | - ob_start(); |
|
72 | - $mod = eval($moduleCode); |
|
73 | - $msg = ob_get_contents(); |
|
74 | - ob_end_clean(); |
|
75 | - if (isset($php_errormsg)) |
|
76 | - { |
|
77 | - $error_info = error_get_last(); |
|
66 | + global $modx; |
|
67 | + $modx->event->params = &$params; // store params inside event object |
|
68 | + if(is_array($params)) { |
|
69 | + extract($params, EXTR_SKIP); |
|
70 | + } |
|
71 | + ob_start(); |
|
72 | + $mod = eval($moduleCode); |
|
73 | + $msg = ob_get_contents(); |
|
74 | + ob_end_clean(); |
|
75 | + if (isset($php_errormsg)) |
|
76 | + { |
|
77 | + $error_info = error_get_last(); |
|
78 | 78 | switch($error_info['type']) |
79 | 79 | { |
80 | - case E_NOTICE : |
|
81 | - $error_level = 1; |
|
82 | - case E_USER_NOTICE : |
|
83 | - break; |
|
84 | - case E_DEPRECATED : |
|
85 | - case E_USER_DEPRECATED : |
|
86 | - case E_STRICT : |
|
87 | - $error_level = 2; |
|
88 | - break; |
|
89 | - default: |
|
90 | - $error_level = 99; |
|
80 | + case E_NOTICE : |
|
81 | + $error_level = 1; |
|
82 | + case E_USER_NOTICE : |
|
83 | + break; |
|
84 | + case E_DEPRECATED : |
|
85 | + case E_USER_DEPRECATED : |
|
86 | + case E_STRICT : |
|
87 | + $error_level = 2; |
|
88 | + break; |
|
89 | + default: |
|
90 | + $error_level = 99; |
|
91 | + } |
|
92 | + if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
93 | + { |
|
94 | + $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
95 | + $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
|
91 | 96 | } |
92 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
93 | - { |
|
94 | - $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
95 | - $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
|
96 | - } |
|
97 | - } |
|
98 | - unset($modx->event->params); |
|
99 | - return $mod.$msg; |
|
97 | + } |
|
98 | + unset($modx->event->params); |
|
99 | + return $mod.$msg; |
|
100 | 100 | } |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('exec_module')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('exec_module')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
12 | 12 | // check if user has access permission, except admins |
13 | -if($_SESSION['mgrRole']!=1){ |
|
13 | +if ($_SESSION['mgrRole'] != 1) { |
|
14 | 14 | $rs = $modx->db->select( |
15 | 15 | 'sma.usergroup,mg.member', |
16 | 16 | $modx->getFullTableName("site_module_access")." sma |
@@ -22,18 +22,18 @@ discard block |
||
22 | 22 | $permissionAccessInt = -1; |
23 | 23 | |
24 | 24 | while ($row = $modx->db->getRow($rs)) { |
25 | - if($row["usergroup"] && $row["member"]) { |
|
25 | + if ($row["usergroup"] && $row["member"]) { |
|
26 | 26 | //if there are permissions and this member has permission, ofcourse |
27 | 27 | //this is granted |
28 | 28 | $permissionAccessInt = 1; |
29 | - } elseif ($permissionAccessInt==-1) { |
|
29 | + } elseif ($permissionAccessInt == -1) { |
|
30 | 30 | //if there are permissions but this member has no permission and the |
31 | 31 | //variable was still in init state we set permission to 0; no permissions |
32 | 32 | $permissionAccessInt = 0; |
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | - if($permissionAccessInt==0) { |
|
36 | + if ($permissionAccessInt == 0) { |
|
37 | 37 | $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
38 | 38 | } |
39 | 39 | } |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | // get module data |
42 | 42 | $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'"); |
43 | 43 | $content = $modx->db->getRow($rs); |
44 | -if(!$content) { |
|
44 | +if (!$content) { |
|
45 | 45 | $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
46 | 46 | } |
47 | -if($content['disabled']) { |
|
47 | +if ($content['disabled']) { |
|
48 | 48 | $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
49 | 49 | } |
50 | 50 | |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | // Set the item name for logger |
58 | 58 | $_SESSION['itemname'] = $content['name']; |
59 | 59 | |
60 | -$output = evalModule($content["modulecode"],$parameter); |
|
60 | +$output = evalModule($content["modulecode"], $parameter); |
|
61 | 61 | echo $output; |
62 | 62 | include MODX_MANAGER_PATH."includes/sysalert.display.inc.php"; |
63 | 63 | |
64 | 64 | // evalModule |
65 | -function evalModule($moduleCode,$params){ |
|
65 | +function evalModule($moduleCode, $params){ |
|
66 | 66 | global $modx; |
67 | 67 | $modx->event->params = &$params; // store params inside event object |
68 | - if(is_array($params)) { |
|
68 | + if (is_array($params)) { |
|
69 | 69 | extract($params, EXTR_SKIP); |
70 | 70 | } |
71 | 71 | ob_start(); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | if (isset($php_errormsg)) |
76 | 76 | { |
77 | 77 | $error_info = error_get_last(); |
78 | - switch($error_info['type']) |
|
78 | + switch ($error_info['type']) |
|
79 | 79 | { |
80 | 80 | case E_NOTICE : |
81 | 81 | $error_level = 1; |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | default: |
90 | 90 | $error_level = 99; |
91 | 91 | } |
92 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
92 | + if ($modx->config['error_reporting'] === '99' || 2 < $error_level) |
|
93 | 93 | { |
94 | - $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
94 | + $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg); |
|
95 | 95 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
96 | 96 | } |
97 | 97 | } |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('exec_module')) { |
|
2 | +if(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."); |
|
4 | +} |
|
5 | +if(!$modx->hasPermission('exec_module')) { |
|
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
6 | 8 | |
@@ -10,7 +12,7 @@ discard block |
||
10 | 12 | } |
11 | 13 | |
12 | 14 | // check if user has access permission, except admins |
13 | -if($_SESSION['mgrRole']!=1){ |
|
15 | +if($_SESSION['mgrRole']!=1) { |
|
14 | 16 | $rs = $modx->db->select( |
15 | 17 | 'sma.usergroup,mg.member', |
16 | 18 | $modx->getFullTableName("site_module_access")." sma |
@@ -62,7 +64,8 @@ discard block |
||
62 | 64 | include MODX_MANAGER_PATH."includes/sysalert.display.inc.php"; |
63 | 65 | |
64 | 66 | // evalModule |
65 | -function evalModule($moduleCode,$params){ |
|
67 | +function evalModule($moduleCode,$params) |
|
68 | +{ |
|
66 | 69 | global $modx; |
67 | 70 | $modx->event->params = &$params; // store params inside event object |
68 | 71 | if(is_array($params)) { |
@@ -72,11 +75,9 @@ discard block |
||
72 | 75 | $mod = eval($moduleCode); |
73 | 76 | $msg = ob_get_contents(); |
74 | 77 | ob_end_clean(); |
75 | - if (isset($php_errormsg)) |
|
76 | - { |
|
78 | + if (isset($php_errormsg)) { |
|
77 | 79 | $error_info = error_get_last(); |
78 | - switch($error_info['type']) |
|
79 | - { |
|
80 | + switch($error_info['type']) { |
|
80 | 81 | case E_NOTICE : |
81 | 82 | $error_level = 1; |
82 | 83 | case E_USER_NOTICE : |
@@ -89,8 +90,7 @@ discard block |
||
89 | 90 | default: |
90 | 91 | $error_level = 99; |
91 | 92 | } |
92 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
93 | - { |
|
93 | + if($modx->config['error_reporting']==='99' || 2<$error_level) { |
|
94 | 94 | $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
95 | 95 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
96 | 96 | } |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(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']) ? intval($_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->db->select('id, pagetitle,introtext', $modx->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->db->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->db->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->db->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->db->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(IN_MANAGER_MODE != "true") { |
|
2 | +if (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 | 9 | $id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
10 | -if($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->db->select('id, pagetitle,introtext', $modx->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->db->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->db->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->db->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 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('web_access_permissions')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | // web access group processor. |
@@ -18,111 +18,111 @@ discard block |
||
18 | 18 | $operation = $_REQUEST['operation']; |
19 | 19 | |
20 | 20 | switch ($operation) { |
21 | - case "add_user_group" : |
|
22 | - $newgroup = $_REQUEST['newusergroup']; |
|
23 | - if(empty($newgroup)) { |
|
24 | - $modx->webAlertAndQuit("No group name specified."); |
|
25 | - } else { |
|
26 | - $id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_webgroup_names); |
|
21 | + case "add_user_group" : |
|
22 | + $newgroup = $_REQUEST['newusergroup']; |
|
23 | + if(empty($newgroup)) { |
|
24 | + $modx->webAlertAndQuit("No group name specified."); |
|
25 | + } else { |
|
26 | + $id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_webgroup_names); |
|
27 | 27 | |
28 | - // invoke OnWebCreateGroup event |
|
29 | - $modx->invokeEvent('OnWebCreateGroup', array( |
|
30 | - 'groupid' => $id, |
|
31 | - 'groupname' => $newgroup, |
|
32 | - )); |
|
33 | - } |
|
34 | - break; |
|
35 | - case "add_document_group" : |
|
36 | - $newgroup = $_REQUEST['newdocgroup']; |
|
37 | - if(empty($newgroup)) { |
|
38 | - $modx->webAlertAndQuit("No group name specified."); |
|
39 | - } else { |
|
40 | - $id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_documentgroup_names); |
|
28 | + // invoke OnWebCreateGroup event |
|
29 | + $modx->invokeEvent('OnWebCreateGroup', array( |
|
30 | + 'groupid' => $id, |
|
31 | + 'groupname' => $newgroup, |
|
32 | + )); |
|
33 | + } |
|
34 | + break; |
|
35 | + case "add_document_group" : |
|
36 | + $newgroup = $_REQUEST['newdocgroup']; |
|
37 | + if(empty($newgroup)) { |
|
38 | + $modx->webAlertAndQuit("No group name specified."); |
|
39 | + } else { |
|
40 | + $id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_documentgroup_names); |
|
41 | 41 | |
42 | - // invoke OnCreateDocGroup event |
|
43 | - $modx->invokeEvent('OnCreateDocGroup', array( |
|
44 | - 'groupid' => $id, |
|
45 | - 'groupname' => $newgroup, |
|
46 | - )); |
|
47 | - } |
|
48 | - break; |
|
49 | - case "delete_user_group" : |
|
50 | - $updategroupaccess = true; |
|
51 | - $usergroup = intval($_REQUEST['usergroup']); |
|
52 | - if(empty($usergroup)) { |
|
53 | - $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
54 | - } else { |
|
55 | - $modx->db->delete($tbl_webgroup_names, "id='{$usergroup}'"); |
|
42 | + // invoke OnCreateDocGroup event |
|
43 | + $modx->invokeEvent('OnCreateDocGroup', array( |
|
44 | + 'groupid' => $id, |
|
45 | + 'groupname' => $newgroup, |
|
46 | + )); |
|
47 | + } |
|
48 | + break; |
|
49 | + case "delete_user_group" : |
|
50 | + $updategroupaccess = true; |
|
51 | + $usergroup = intval($_REQUEST['usergroup']); |
|
52 | + if(empty($usergroup)) { |
|
53 | + $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
54 | + } else { |
|
55 | + $modx->db->delete($tbl_webgroup_names, "id='{$usergroup}'"); |
|
56 | 56 | |
57 | - $modx->db->delete($tbl_webgroup_access, "webgroup='{$usergroup}'"); |
|
57 | + $modx->db->delete($tbl_webgroup_access, "webgroup='{$usergroup}'"); |
|
58 | 58 | |
59 | - $modx->db->delete($tbl_web_groups, "webuser='{$usergroup}'"); |
|
60 | - } |
|
61 | - break; |
|
62 | - case "delete_document_group" : |
|
63 | - $group = intval($_REQUEST['documentgroup']); |
|
64 | - if(empty($group)) { |
|
65 | - $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
66 | - } else { |
|
67 | - $modx->db->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
59 | + $modx->db->delete($tbl_web_groups, "webuser='{$usergroup}'"); |
|
60 | + } |
|
61 | + break; |
|
62 | + case "delete_document_group" : |
|
63 | + $group = intval($_REQUEST['documentgroup']); |
|
64 | + if(empty($group)) { |
|
65 | + $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
66 | + } else { |
|
67 | + $modx->db->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
68 | 68 | |
69 | - $modx->db->delete($tbl_webgroup_access, "documentgroup='{$group}'"); |
|
69 | + $modx->db->delete($tbl_webgroup_access, "documentgroup='{$group}'"); |
|
70 | 70 | |
71 | - $modx->db->delete($tbl_document_groups, "document_group='{$group}'"); |
|
72 | - } |
|
73 | - break; |
|
74 | - case "rename_user_group" : |
|
75 | - $newgroupname = $_REQUEST['newgroupname']; |
|
76 | - if(empty($newgroupname)) { |
|
77 | - $modx->webAlertAndQuit("No group name specified."); |
|
78 | - } |
|
79 | - $groupid = intval($_REQUEST['groupid']); |
|
80 | - if(empty($groupid)) { |
|
81 | - $modx->webAlertAndQuit("No user group id specified for rename."); |
|
82 | - } |
|
83 | - $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'"); |
|
84 | - break; |
|
85 | - case "rename_document_group" : |
|
86 | - $newgroupname = $_REQUEST['newgroupname']; |
|
87 | - if(empty($newgroupname)) { |
|
88 | - $modx->webAlertAndQuit("No group name specified."); |
|
89 | - } |
|
90 | - $groupid = intval($_REQUEST['groupid']); |
|
91 | - if(empty($groupid)) { |
|
92 | - $modx->webAlertAndQuit("No document group id specified for rename."); |
|
93 | - } |
|
94 | - $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
95 | - break; |
|
96 | - case "add_document_group_to_user_group" : |
|
97 | - $updategroupaccess = true; |
|
98 | - $usergroup = intval($_REQUEST['usergroup']); |
|
99 | - $docgroup = intval($_REQUEST['docgroup']); |
|
100 | - $rs = $modx->db->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
101 | - $limit = $modx->db->getValue($rs); |
|
102 | - if($limit<=0) { |
|
103 | - $modx->db->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access); |
|
104 | - } else { |
|
105 | - //alert user that coupling already exists? |
|
106 | - } |
|
107 | - break; |
|
108 | - case "remove_document_group_from_user_group" : |
|
109 | - $updategroupaccess = true; |
|
110 | - $coupling = intval($_REQUEST['coupling']); |
|
111 | - $modx->db->delete($tbl_webgroup_access, "id='{$coupling}'"); |
|
112 | - break; |
|
113 | - default : |
|
114 | - $modx->webAlertAndQuit("No operation set in request."); |
|
71 | + $modx->db->delete($tbl_document_groups, "document_group='{$group}'"); |
|
72 | + } |
|
73 | + break; |
|
74 | + case "rename_user_group" : |
|
75 | + $newgroupname = $_REQUEST['newgroupname']; |
|
76 | + if(empty($newgroupname)) { |
|
77 | + $modx->webAlertAndQuit("No group name specified."); |
|
78 | + } |
|
79 | + $groupid = intval($_REQUEST['groupid']); |
|
80 | + if(empty($groupid)) { |
|
81 | + $modx->webAlertAndQuit("No user group id specified for rename."); |
|
82 | + } |
|
83 | + $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'"); |
|
84 | + break; |
|
85 | + case "rename_document_group" : |
|
86 | + $newgroupname = $_REQUEST['newgroupname']; |
|
87 | + if(empty($newgroupname)) { |
|
88 | + $modx->webAlertAndQuit("No group name specified."); |
|
89 | + } |
|
90 | + $groupid = intval($_REQUEST['groupid']); |
|
91 | + if(empty($groupid)) { |
|
92 | + $modx->webAlertAndQuit("No document group id specified for rename."); |
|
93 | + } |
|
94 | + $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
95 | + break; |
|
96 | + case "add_document_group_to_user_group" : |
|
97 | + $updategroupaccess = true; |
|
98 | + $usergroup = intval($_REQUEST['usergroup']); |
|
99 | + $docgroup = intval($_REQUEST['docgroup']); |
|
100 | + $rs = $modx->db->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
101 | + $limit = $modx->db->getValue($rs); |
|
102 | + if($limit<=0) { |
|
103 | + $modx->db->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access); |
|
104 | + } else { |
|
105 | + //alert user that coupling already exists? |
|
106 | + } |
|
107 | + break; |
|
108 | + case "remove_document_group_from_user_group" : |
|
109 | + $updategroupaccess = true; |
|
110 | + $coupling = intval($_REQUEST['coupling']); |
|
111 | + $modx->db->delete($tbl_webgroup_access, "id='{$coupling}'"); |
|
112 | + break; |
|
113 | + default : |
|
114 | + $modx->webAlertAndQuit("No operation set in request."); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | // secure web documents - flag as private |
118 | 118 | if($updategroupaccess==true){ |
119 | - include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
120 | - secureWebDocument(); |
|
119 | + include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
|
120 | + secureWebDocument(); |
|
121 | 121 | |
122 | - // Update the private group column |
|
123 | - $modx->db->update( |
|
124 | - 'dgn.private_webgroup = (wga.webgroup IS NOT NULL)', |
|
125 | - "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_webgroup_access} AS wga ON wga.documentgroup = dgn.id"); |
|
122 | + // Update the private group column |
|
123 | + $modx->db->update( |
|
124 | + 'dgn.private_webgroup = (wga.webgroup IS NOT NULL)', |
|
125 | + "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_webgroup_access} AS wga ON wga.documentgroup = dgn.id"); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | $header = "Location: index.php?a=91"; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('web_access_permissions')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('web_access_permissions')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | switch ($operation) { |
21 | 21 | case "add_user_group" : |
22 | 22 | $newgroup = $_REQUEST['newusergroup']; |
23 | - if(empty($newgroup)) { |
|
23 | + if (empty($newgroup)) { |
|
24 | 24 | $modx->webAlertAndQuit("No group name specified."); |
25 | 25 | } else { |
26 | 26 | $id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_webgroup_names); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | break; |
35 | 35 | case "add_document_group" : |
36 | 36 | $newgroup = $_REQUEST['newdocgroup']; |
37 | - if(empty($newgroup)) { |
|
37 | + if (empty($newgroup)) { |
|
38 | 38 | $modx->webAlertAndQuit("No group name specified."); |
39 | 39 | } else { |
40 | 40 | $id = $modx->db->insert(array('name'=>$modx->db->escape($newgroup)), $tbl_documentgroup_names); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | case "delete_user_group" : |
50 | 50 | $updategroupaccess = true; |
51 | 51 | $usergroup = intval($_REQUEST['usergroup']); |
52 | - if(empty($usergroup)) { |
|
52 | + if (empty($usergroup)) { |
|
53 | 53 | $modx->webAlertAndQuit("No user group id specified for deletion."); |
54 | 54 | } else { |
55 | 55 | $modx->db->delete($tbl_webgroup_names, "id='{$usergroup}'"); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | break; |
62 | 62 | case "delete_document_group" : |
63 | 63 | $group = intval($_REQUEST['documentgroup']); |
64 | - if(empty($group)) { |
|
64 | + if (empty($group)) { |
|
65 | 65 | $modx->webAlertAndQuit("No document group id specified for deletion."); |
66 | 66 | } else { |
67 | 67 | $modx->db->delete($tbl_documentgroup_names, "id='{$group}'"); |
@@ -73,22 +73,22 @@ discard block |
||
73 | 73 | break; |
74 | 74 | case "rename_user_group" : |
75 | 75 | $newgroupname = $_REQUEST['newgroupname']; |
76 | - if(empty($newgroupname)) { |
|
76 | + if (empty($newgroupname)) { |
|
77 | 77 | $modx->webAlertAndQuit("No group name specified."); |
78 | 78 | } |
79 | 79 | $groupid = intval($_REQUEST['groupid']); |
80 | - if(empty($groupid)) { |
|
80 | + if (empty($groupid)) { |
|
81 | 81 | $modx->webAlertAndQuit("No user group id specified for rename."); |
82 | 82 | } |
83 | 83 | $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_webgroup_names, "id='{$groupid}'"); |
84 | 84 | break; |
85 | 85 | case "rename_document_group" : |
86 | 86 | $newgroupname = $_REQUEST['newgroupname']; |
87 | - if(empty($newgroupname)) { |
|
87 | + if (empty($newgroupname)) { |
|
88 | 88 | $modx->webAlertAndQuit("No group name specified."); |
89 | 89 | } |
90 | 90 | $groupid = intval($_REQUEST['groupid']); |
91 | - if(empty($groupid)) { |
|
91 | + if (empty($groupid)) { |
|
92 | 92 | $modx->webAlertAndQuit("No document group id specified for rename."); |
93 | 93 | } |
94 | 94 | $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $docgroup = intval($_REQUEST['docgroup']); |
100 | 100 | $rs = $modx->db->select('COUNT(*)', $tbl_webgroup_access, "webgroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
101 | 101 | $limit = $modx->db->getValue($rs); |
102 | - if($limit<=0) { |
|
102 | + if ($limit <= 0) { |
|
103 | 103 | $modx->db->insert(array('webgroup'=>$usergroup, 'documentgroup'=>$docgroup), $tbl_webgroup_access); |
104 | 104 | } else { |
105 | 105 | //alert user that coupling already exists? |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | // secure web documents - flag as private |
118 | -if($updategroupaccess==true){ |
|
118 | +if ($updategroupaccess == true) { |
|
119 | 119 | include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
120 | 120 | secureWebDocument(); |
121 | 121 |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('web_access_permissions')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -115,7 +117,7 @@ discard block |
||
115 | 117 | } |
116 | 118 | |
117 | 119 | // secure web documents - flag as private |
118 | -if($updategroupaccess==true){ |
|
120 | +if($updategroupaccess==true) { |
|
119 | 121 | include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php"; |
120 | 122 | secureWebDocument(); |
121 | 123 |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('new_module')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // create globally unique identifiers (guid) |
13 | 13 | function createGUID(){ |
14 | - srand((double)microtime()*1000000); |
|
15 | - $r = rand() ; |
|
16 | - $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1); |
|
17 | - $m = md5 ($u); |
|
18 | - return $m; |
|
14 | + srand((double)microtime()*1000000); |
|
15 | + $r = rand() ; |
|
16 | + $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1); |
|
17 | + $m = md5 ($u); |
|
18 | + return $m; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | // count duplicates |
@@ -26,40 +26,40 @@ discard block |
||
26 | 26 | |
27 | 27 | // duplicate module |
28 | 28 | $newid = $modx->db->insert( |
29 | - array( |
|
30 | - 'name'=>'', |
|
31 | - 'description'=>'', |
|
32 | - 'disabled'=>'', |
|
33 | - 'category'=>'', |
|
34 | - 'wrap'=>'', |
|
35 | - 'icon'=>'', |
|
36 | - 'enable_resource'=>'', |
|
37 | - 'resourcefile'=>'', |
|
38 | - 'createdon'=>'', |
|
39 | - 'editedon'=>'', |
|
40 | - 'guid'=>'', |
|
41 | - 'enable_sharedparams'=>'', |
|
42 | - 'properties'=>'', |
|
43 | - 'modulecode'=>'', |
|
44 | - ), $modx->getFullTableName('site_modules'), // Insert into |
|
45 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getFullTableName('site_modules'), "id='{$id}'"); // Copy from |
|
29 | + array( |
|
30 | + 'name'=>'', |
|
31 | + 'description'=>'', |
|
32 | + 'disabled'=>'', |
|
33 | + 'category'=>'', |
|
34 | + 'wrap'=>'', |
|
35 | + 'icon'=>'', |
|
36 | + 'enable_resource'=>'', |
|
37 | + 'resourcefile'=>'', |
|
38 | + 'createdon'=>'', |
|
39 | + 'editedon'=>'', |
|
40 | + 'guid'=>'', |
|
41 | + 'enable_sharedparams'=>'', |
|
42 | + 'properties'=>'', |
|
43 | + 'modulecode'=>'', |
|
44 | + ), $modx->getFullTableName('site_modules'), // Insert into |
|
45 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getFullTableName('site_modules'), "id='{$id}'"); // Copy from |
|
46 | 46 | |
47 | 47 | // duplicate module dependencies |
48 | 48 | $modx->db->insert( |
49 | - array( |
|
50 | - 'module'=>'', |
|
51 | - 'resource'=>'', |
|
52 | - 'type'=>'', |
|
53 | - ), $modx->getFullTableName('site_module_depobj'), // Insert into |
|
54 | - "'{$newid}', resource, type", $modx->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from |
|
49 | + array( |
|
50 | + 'module'=>'', |
|
51 | + 'resource'=>'', |
|
52 | + 'type'=>'', |
|
53 | + ), $modx->getFullTableName('site_module_depobj'), // Insert into |
|
54 | + "'{$newid}', resource, type", $modx->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from |
|
55 | 55 | |
56 | 56 | // duplicate module user group access |
57 | 57 | $modx->db->insert( |
58 | - array( |
|
59 | - 'module'=>'', |
|
60 | - 'usergroup'=>'', |
|
61 | - ), $modx->getFullTableName('site_module_access'), // Insert into |
|
62 | - "'{$newid}', usergroup", $modx->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from |
|
58 | + array( |
|
59 | + 'module'=>'', |
|
60 | + 'usergroup'=>'', |
|
61 | + ), $modx->getFullTableName('site_module_access'), // Insert into |
|
62 | + "'{$newid}', usergroup", $modx->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from |
|
63 | 63 | |
64 | 64 | // Set the item name for logger |
65 | 65 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$newid}'")); |
@@ -1,27 +1,27 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('new_module')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('new_module')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
12 | 12 | // create globally unique identifiers (guid) |
13 | 13 | function createGUID(){ |
14 | - srand((double)microtime()*1000000); |
|
15 | - $r = rand() ; |
|
16 | - $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1); |
|
17 | - $m = md5 ($u); |
|
14 | + srand((double) microtime() * 1000000); |
|
15 | + $r = rand(); |
|
16 | + $u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1); |
|
17 | + $m = md5($u); |
|
18 | 18 | return $m; |
19 | 19 | } |
20 | 20 | |
21 | 21 | // count duplicates |
22 | 22 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
23 | 23 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
24 | -if($count>=1) $count = ' '.($count+1); |
|
24 | +if ($count >= 1) $count = ' '.($count + 1); |
|
25 | 25 | else $count = ''; |
26 | 26 | |
27 | 27 | // duplicate module |
@@ -66,5 +66,5 @@ discard block |
||
66 | 66 | $_SESSION['itemname'] = $name; |
67 | 67 | |
68 | 68 | // finish duplicating - redirect to new module |
69 | -$header="Location: index.php?r=2&a=108&id=$newid"; |
|
69 | +$header = "Location: index.php?r=2&a=108&id=$newid"; |
|
70 | 70 | header($header); |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('new_module')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -10,7 +12,8 @@ discard block |
||
10 | 12 | } |
11 | 13 | |
12 | 14 | // create globally unique identifiers (guid) |
13 | -function createGUID(){ |
|
15 | +function createGUID() |
|
16 | +{ |
|
14 | 17 | srand((double)microtime()*1000000); |
15 | 18 | $r = rand() ; |
16 | 19 | $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1); |
@@ -21,8 +24,11 @@ discard block |
||
21 | 24 | // count duplicates |
22 | 25 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
23 | 26 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
24 | -if($count>=1) $count = ' '.($count+1); |
|
25 | -else $count = ''; |
|
27 | +if($count>=1) { |
|
28 | + $count = ' '.($count+1); |
|
29 | +} else { |
|
30 | + $count = ''; |
|
31 | +} |
|
26 | 32 | |
27 | 33 | // duplicate module |
28 | 34 | $newid = $modx->db->insert( |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -if (IN_MANAGER_MODE!="true") { |
|
2 | +if (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_plugin') && !$modx->hasPermission('save_snippet') && !$modx->hasPermission('save_template') && !$modx->hasPermission('save_module')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['catId'])? intval($_GET['catId']) : 0; |
|
10 | -if ($id==0) { |
|
9 | +$id = isset($_GET['catId']) ? intval($_GET['catId']) : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -19,5 +19,5 @@ discard block |
||
19 | 19 | deleteCategory($id); |
20 | 20 | |
21 | 21 | // finished emptying cache - redirect |
22 | -$header="Location: index.php?a=76"; |
|
22 | +$header = "Location: index.php?a=76"; |
|
23 | 23 | header($header); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('delete_document')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | /************ webber ********/ |
@@ -30,50 +30,50 @@ discard block |
||
30 | 30 | $udperms->role = $_SESSION['mgrRole']; |
31 | 31 | |
32 | 32 | if(!$udperms->checkPermissions()) { |
33 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
33 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // get the timestamp on which the document was deleted. |
37 | 37 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
38 | 38 | $deltime = $modx->db->getValue($rs); |
39 | 39 | if(!$deltime) { |
40 | - $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
40 | + $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $children = array(); |
44 | 44 | |
45 | 45 | function getChildren($parent) { |
46 | 46 | |
47 | - global $modx; |
|
48 | - global $children; |
|
49 | - global $deltime; |
|
47 | + global $modx; |
|
48 | + global $children; |
|
49 | + global $deltime; |
|
50 | 50 | |
51 | - $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'"); |
|
52 | - // the document has children documents, we'll need to delete those too |
|
53 | - while ($row=$modx->db->getRow($rs)) { |
|
54 | - $children[] = $row['id']; |
|
55 | - getChildren($row['id']); |
|
56 | - //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
|
57 | - } |
|
51 | + $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'"); |
|
52 | + // the document has children documents, we'll need to delete those too |
|
53 | + while ($row=$modx->db->getRow($rs)) { |
|
54 | + $children[] = $row['id']; |
|
55 | + getChildren($row['id']); |
|
56 | + //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | getChildren($id); |
61 | 61 | |
62 | 62 | if(count($children)>0) { |
63 | - $modx->db->update( |
|
64 | - array( |
|
65 | - 'deleted' => 0, |
|
66 | - 'deletedby' => 0, |
|
67 | - 'deletedon' => 0, |
|
68 | - ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
63 | + $modx->db->update( |
|
64 | + array( |
|
65 | + 'deleted' => 0, |
|
66 | + 'deletedby' => 0, |
|
67 | + 'deletedon' => 0, |
|
68 | + ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
69 | 69 | } |
70 | 70 | //'undelete' the document. |
71 | 71 | $modx->db->update( |
72 | - array( |
|
73 | - 'deleted' => 0, |
|
74 | - 'deletedby' => 0, |
|
75 | - 'deletedon' => 0, |
|
76 | - ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
72 | + array( |
|
73 | + 'deleted' => 0, |
|
74 | + 'deletedby' => 0, |
|
75 | + 'deletedon' => 0, |
|
76 | + ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
77 | 77 | |
78 | 78 | $modx->invokeEvent("OnDocFormUnDelete", |
79 | 79 | array( |
@@ -1,48 +1,48 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_document')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('delete_document')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_REQUEST['id'])? intval($_REQUEST['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
12 | 12 | /************ webber ********/ |
13 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
14 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
13 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
14 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
15 | 15 | |
16 | 16 | /************** webber *************/ |
17 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
18 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
19 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
20 | -$add_path=$sd.$sb.$pg; |
|
17 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
18 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
19 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
20 | +$add_path = $sd.$sb.$pg; |
|
21 | 21 | |
22 | 22 | /***********************************/ |
23 | 23 | |
24 | 24 | |
25 | 25 | // check permissions on the document |
26 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
26 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
27 | 27 | $udperms = new udperms(); |
28 | 28 | $udperms->user = $modx->getLoginUserID(); |
29 | 29 | $udperms->document = $id; |
30 | 30 | $udperms->role = $_SESSION['mgrRole']; |
31 | 31 | |
32 | -if(!$udperms->checkPermissions()) { |
|
32 | +if (!$udperms->checkPermissions()) { |
|
33 | 33 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
34 | 34 | } |
35 | 35 | |
36 | 36 | // get the timestamp on which the document was deleted. |
37 | 37 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
38 | 38 | $deltime = $modx->db->getValue($rs); |
39 | -if(!$deltime) { |
|
39 | +if (!$deltime) { |
|
40 | 40 | $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
41 | 41 | } |
42 | 42 | |
43 | 43 | $children = array(); |
44 | 44 | |
45 | -function getChildren($parent) { |
|
45 | +function getChildren($parent){ |
|
46 | 46 | |
47 | 47 | global $modx; |
48 | 48 | global $children; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'"); |
52 | 52 | // the document has children documents, we'll need to delete those too |
53 | - while ($row=$modx->db->getRow($rs)) { |
|
53 | + while ($row = $modx->db->getRow($rs)) { |
|
54 | 54 | $children[] = $row['id']; |
55 | 55 | getChildren($row['id']); |
56 | 56 | //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | getChildren($id); |
61 | 61 | |
62 | -if(count($children)>0) { |
|
62 | +if (count($children) > 0) { |
|
63 | 63 | $modx->db->update( |
64 | 64 | array( |
65 | 65 | 'deleted' => 0, |
@@ -88,5 +88,5 @@ discard block |
||
88 | 88 | $modx->clearCache('full'); |
89 | 89 | |
90 | 90 | // finished emptying cache - redirect |
91 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
91 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
92 | 92 | header($header); |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_document')) { |
|
2 | +if(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."); |
|
4 | +} |
|
5 | +if(!$modx->hasPermission('delete_document')) { |
|
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
6 | 8 | |
@@ -42,7 +44,8 @@ discard block |
||
42 | 44 | |
43 | 45 | $children = array(); |
44 | 46 | |
45 | -function getChildren($parent) { |
|
47 | +function getChildren($parent) |
|
48 | +{ |
|
46 | 49 | |
47 | 50 | global $modx; |
48 | 51 | global $children; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('settings')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | $data = $_POST; |
7 | 7 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
@@ -9,41 +9,41 @@ discard block |
||
9 | 9 | |
10 | 10 | if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
11 | 11 | { |
12 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
13 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
14 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
15 | - if(is_file($htaccess)) |
|
16 | - { |
|
17 | - $_ = file_get_contents($htaccess); |
|
18 | - if(strpos($_,'RewriteBase')===false) |
|
19 | - { |
|
20 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
21 | - } |
|
22 | - elseif(is_writable($htaccess)) |
|
23 | - { |
|
24 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
25 | - if(!@file_put_contents($htaccess,$_)) |
|
26 | - { |
|
27 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
28 | - } |
|
29 | - } |
|
30 | - } |
|
31 | - elseif(is_file($sample_htaccess)) |
|
32 | - { |
|
33 | - if(!@rename($sample_htaccess,$htaccess)) |
|
12 | + $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
13 | + $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
14 | + $dir = '/' . trim($modx->config['base_url'],'/'); |
|
15 | + if(is_file($htaccess)) |
|
16 | + { |
|
17 | + $_ = file_get_contents($htaccess); |
|
18 | + if(strpos($_,'RewriteBase')===false) |
|
34 | 19 | { |
35 | - $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
36 | - } |
|
37 | - elseif($modx->config['base_url']!=='/') |
|
38 | - { |
|
39 | - $_ = file_get_contents($htaccess); |
|
40 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
41 | - if(!@file_put_contents($htaccess,$_)) |
|
42 | - { |
|
43 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
44 | - } |
|
45 | - } |
|
46 | - } |
|
20 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
21 | + } |
|
22 | + elseif(is_writable($htaccess)) |
|
23 | + { |
|
24 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
25 | + if(!@file_put_contents($htaccess,$_)) |
|
26 | + { |
|
27 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
28 | + } |
|
29 | + } |
|
30 | + } |
|
31 | + elseif(is_file($sample_htaccess)) |
|
32 | + { |
|
33 | + if(!@rename($sample_htaccess,$htaccess)) |
|
34 | + { |
|
35 | + $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
36 | + } |
|
37 | + elseif($modx->config['base_url']!=='/') |
|
38 | + { |
|
39 | + $_ = file_get_contents($htaccess); |
|
40 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
41 | + if(!@file_put_contents($htaccess,$_)) |
|
42 | + { |
|
43 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
44 | + } |
|
45 | + } |
|
46 | + } |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
@@ -54,19 +54,19 @@ discard block |
||
54 | 54 | $data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
55 | 55 | |
56 | 56 | if (isset($data) && count($data) > 0) { |
57 | - if(isset($data['manager_language'])) { |
|
58 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
59 | - if(is_file($lang_path)) { |
|
60 | - include($lang_path); |
|
57 | + if(isset($data['manager_language'])) { |
|
58 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
59 | + if(is_file($lang_path)) { |
|
60 | + include($lang_path); |
|
61 | 61 | global $modx_lang_attribute; |
62 | 62 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
63 | - } |
|
64 | - } |
|
65 | - $savethese = array(); |
|
66 | - $data['sys_files_checksum'] = $modx->manager->getSystemChecksum($data['check_files_onlogin']); |
|
67 | - $data['mail_check_timeperiod'] = intval($data['mail_check_timeperiod']) < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
68 | - foreach ($data as $k => $v) { |
|
69 | - switch ($k) { |
|
63 | + } |
|
64 | + } |
|
65 | + $savethese = array(); |
|
66 | + $data['sys_files_checksum'] = $modx->manager->getSystemChecksum($data['check_files_onlogin']); |
|
67 | + $data['mail_check_timeperiod'] = intval($data['mail_check_timeperiod']) < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
68 | + foreach ($data as $k => $v) { |
|
69 | + switch ($k) { |
|
70 | 70 | case 'settings_version':{ |
71 | 71 | if($modx->getVersionData('version')!=$data['settings_version']){ |
72 | 72 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
@@ -74,24 +74,24 @@ discard block |
||
74 | 74 | } |
75 | 75 | break; |
76 | 76 | } |
77 | - case 'error_page': |
|
78 | - case 'unauthorized_page': |
|
79 | - if (trim($v) == '' || !is_numeric($v)) { |
|
80 | - $v = $data['site_start']; |
|
81 | - } |
|
82 | - break; |
|
77 | + case 'error_page': |
|
78 | + case 'unauthorized_page': |
|
79 | + if (trim($v) == '' || !is_numeric($v)) { |
|
80 | + $v = $data['site_start']; |
|
81 | + } |
|
82 | + break; |
|
83 | 83 | |
84 | - case 'lst_custom_contenttype': |
|
85 | - case 'txt_custom_contenttype': |
|
86 | - // Skip these |
|
87 | - $k = ''; |
|
88 | - break; |
|
89 | - case 'rb_base_dir': |
|
90 | - case 'rb_base_url': |
|
91 | - case 'filemanager_path': |
|
92 | - $v = trim($v); |
|
93 | - $v = rtrim($v,'/') . '/'; |
|
94 | - break; |
|
84 | + case 'lst_custom_contenttype': |
|
85 | + case 'txt_custom_contenttype': |
|
86 | + // Skip these |
|
87 | + $k = ''; |
|
88 | + break; |
|
89 | + case 'rb_base_dir': |
|
90 | + case 'rb_base_url': |
|
91 | + case 'filemanager_path': |
|
92 | + $v = trim($v); |
|
93 | + $v = rtrim($v,'/') . '/'; |
|
94 | + break; |
|
95 | 95 | case 'manager_language': |
96 | 96 | $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
97 | 97 | $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
@@ -99,56 +99,56 @@ discard block |
||
99 | 99 | if($langDir !== $langFileDir || !file_exists($langFile)) { |
100 | 100 | $v = 'english'; |
101 | 101 | } |
102 | - break; |
|
103 | - case 'smtppw': |
|
104 | - if ($v !== '********************' && $v !== '') { |
|
105 | - $v = trim($v); |
|
106 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
107 | - $v = str_replace('=','%',$v); |
|
108 | - } elseif ($v === '********************') { |
|
109 | - $k = ''; |
|
110 | - } |
|
111 | - break; |
|
102 | + break; |
|
103 | + case 'smtppw': |
|
104 | + if ($v !== '********************' && $v !== '') { |
|
105 | + $v = trim($v); |
|
106 | + $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
107 | + $v = str_replace('=','%',$v); |
|
108 | + } elseif ($v === '********************') { |
|
109 | + $k = ''; |
|
110 | + } |
|
111 | + break; |
|
112 | 112 | case 'valid_hostnames': |
113 | - $v = str_replace(array(' ,', ', '), ',', $v); |
|
114 | - if ($v !== ',') { |
|
115 | - $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
116 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
117 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
118 | - } |
|
119 | - $k = ''; |
|
120 | - break; |
|
121 | - case 'session_timeout': |
|
122 | - $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
123 | - $v = intval($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 |
|
124 | - break; |
|
125 | - default: |
|
126 | - break; |
|
127 | - } |
|
128 | - $v = is_array($v) ? implode(",", $v) : $v; |
|
113 | + $v = str_replace(array(' ,', ', '), ',', $v); |
|
114 | + if ($v !== ',') { |
|
115 | + $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
116 | + $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
117 | + @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
118 | + } |
|
119 | + $k = ''; |
|
120 | + break; |
|
121 | + case 'session_timeout': |
|
122 | + $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
123 | + $v = intval($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 |
|
124 | + break; |
|
125 | + default: |
|
126 | + break; |
|
127 | + } |
|
128 | + $v = is_array($v) ? implode(",", $v) : $v; |
|
129 | 129 | |
130 | - $modx->config[$k] = $v; |
|
130 | + $modx->config[$k] = $v; |
|
131 | 131 | |
132 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
133 | - } |
|
132 | + if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
133 | + } |
|
134 | 134 | |
135 | - // Run a single query to save all the values |
|
136 | - $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
135 | + // Run a single query to save all the values |
|
136 | + $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
137 | 137 | VALUES ".implode(', ', $savethese); |
138 | - $modx->db->query($sql); |
|
138 | + $modx->db->query($sql); |
|
139 | 139 | |
140 | - // Reset Template Pages |
|
141 | - if (isset($data['reset_template'])) { |
|
142 | - $newtemplate = intval($data['default_template']); |
|
143 | - $oldtemplate = intval($data['old_template']); |
|
144 | - $tbl = $modx->getFullTableName('site_content'); |
|
145 | - $reset = $data['reset_template']; |
|
146 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
147 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
148 | - } |
|
140 | + // Reset Template Pages |
|
141 | + if (isset($data['reset_template'])) { |
|
142 | + $newtemplate = intval($data['default_template']); |
|
143 | + $oldtemplate = intval($data['old_template']); |
|
144 | + $tbl = $modx->getFullTableName('site_content'); |
|
145 | + $reset = $data['reset_template']; |
|
146 | + if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
147 | + else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
148 | + } |
|
149 | 149 | |
150 | - // empty cache |
|
151 | - $modx->clearCache('full'); |
|
150 | + // empty cache |
|
151 | + $modx->clearCache('full'); |
|
152 | 152 | } |
153 | 153 | $header="Location: index.php?a=7&r=10"; |
154 | 154 | header($header); |
@@ -1,44 +1,44 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('settings')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('settings')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | $data = $_POST; |
7 | 7 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
8 | 8 | unset($_POST); |
9 | 9 | |
10 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
10 | +if ($data['friendly_urls'] === '1' && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') === false) |
|
11 | 11 | { |
12 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
13 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
14 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
15 | - if(is_file($htaccess)) |
|
12 | + $htaccess = $modx->config['base_path'].'.htaccess'; |
|
13 | + $sample_htaccess = $modx->config['base_path'].'ht.access'; |
|
14 | + $dir = '/'.trim($modx->config['base_url'], '/'); |
|
15 | + if (is_file($htaccess)) |
|
16 | 16 | { |
17 | 17 | $_ = file_get_contents($htaccess); |
18 | - if(strpos($_,'RewriteBase')===false) |
|
18 | + if (strpos($_, 'RewriteBase') === false) |
|
19 | 19 | { |
20 | 20 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
21 | 21 | } |
22 | - elseif(is_writable($htaccess)) |
|
22 | + elseif (is_writable($htaccess)) |
|
23 | 23 | { |
24 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
25 | - if(!@file_put_contents($htaccess,$_)) |
|
24 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
25 | + if (!@file_put_contents($htaccess, $_)) |
|
26 | 26 | { |
27 | 27 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | } |
31 | - elseif(is_file($sample_htaccess)) |
|
31 | + elseif (is_file($sample_htaccess)) |
|
32 | 32 | { |
33 | - if(!@rename($sample_htaccess,$htaccess)) |
|
33 | + if (!@rename($sample_htaccess, $htaccess)) |
|
34 | 34 | { |
35 | 35 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
36 | 36 | } |
37 | - elseif($modx->config['base_url']!=='/') |
|
37 | + elseif ($modx->config['base_url'] !== '/') |
|
38 | 38 | { |
39 | 39 | $_ = file_get_contents($htaccess); |
40 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
41 | - if(!@file_put_contents($htaccess,$_)) |
|
40 | + $_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_); |
|
41 | + if (!@file_put_contents($htaccess, $_)) |
|
42 | 42 | { |
43 | 43 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
44 | 44 | } |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
50 | - unlink(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css'); |
|
49 | +if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
50 | + unlink(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css'); |
|
51 | 51 | } |
52 | 52 | |
53 | -$data['filemanager_path'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['filemanager_path']); |
|
54 | -$data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
|
53 | +$data['filemanager_path'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['filemanager_path']); |
|
54 | +$data['rb_base_dir'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['rb_base_dir']); |
|
55 | 55 | |
56 | 56 | if (isset($data) && count($data) > 0) { |
57 | - if(isset($data['manager_language'])) { |
|
58 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
59 | - if(is_file($lang_path)) { |
|
57 | + if (isset($data['manager_language'])) { |
|
58 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'.$data['manager_language'].'.inc.php'; |
|
59 | + if (is_file($lang_path)) { |
|
60 | 60 | include($lang_path); |
61 | 61 | global $modx_lang_attribute; |
62 | 62 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | foreach ($data as $k => $v) { |
69 | 69 | switch ($k) { |
70 | 70 | case 'settings_version':{ |
71 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
72 | - $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
|
71 | + if ($modx->getVersionData('version') != $data['settings_version']) { |
|
72 | + $modx->logEvent(17, 2, '<pre>'.var_export($data['settings_version'], true).'</pre>', 'fake settings_version'); |
|
73 | 73 | $v = $modx->getVersionData('version'); |
74 | 74 | } |
75 | 75 | break; |
@@ -90,21 +90,21 @@ discard block |
||
90 | 90 | case 'rb_base_url': |
91 | 91 | case 'filemanager_path': |
92 | 92 | $v = trim($v); |
93 | - $v = rtrim($v,'/') . '/'; |
|
93 | + $v = rtrim($v, '/').'/'; |
|
94 | 94 | break; |
95 | 95 | case 'manager_language': |
96 | - $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
|
97 | - $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
|
96 | + $langDir = realpath(MODX_MANAGER_PATH.'includes/lang'); |
|
97 | + $langFile = realpath(MODX_MANAGER_PATH.'includes/lang/'.$v.'.inc.php'); |
|
98 | 98 | $langFileDir = dirname($langFile); |
99 | - if($langDir !== $langFileDir || !file_exists($langFile)) { |
|
99 | + if ($langDir !== $langFileDir || !file_exists($langFile)) { |
|
100 | 100 | $v = 'english'; |
101 | 101 | } |
102 | 102 | break; |
103 | 103 | case 'smtppw': |
104 | 104 | if ($v !== '********************' && $v !== '') { |
105 | 105 | $v = trim($v); |
106 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
107 | - $v = str_replace('=','%',$v); |
|
106 | + $v = base64_encode($v).substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
107 | + $v = str_replace('=', '%', $v); |
|
108 | 108 | } elseif ($v === '********************') { |
109 | 109 | $k = ''; |
110 | 110 | } |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | $v = str_replace(array(' ,', ', '), ',', $v); |
114 | 114 | if ($v !== ',') { |
115 | 115 | $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
116 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
117 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
116 | + $configString = '<?php'."\n".'define(\'MODX_SITE_HOSTNAMES\', \''.$v.'\');'."\n"; |
|
117 | + @file_put_contents(MODX_BASE_PATH.'assets/cache/siteHostnames.php', $configString); |
|
118 | 118 | } |
119 | 119 | $k = ''; |
120 | 120 | break; |
121 | 121 | case 'session_timeout': |
122 | 122 | $mail_check_timeperiod = $data['mail_check_timeperiod']; |
123 | - $v = intval($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 |
|
123 | + $v = intval($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 |
|
124 | 124 | break; |
125 | 125 | default: |
126 | 126 | break; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $modx->config[$k] = $v; |
131 | 131 | |
132 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
132 | + if (!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | // Run a single query to save all the values |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | $oldtemplate = intval($data['old_template']); |
144 | 144 | $tbl = $modx->getFullTableName('site_content'); |
145 | 145 | $reset = $data['reset_template']; |
146 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
147 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
146 | + if ($reset == 1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
147 | + else if ($reset == 2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | // empty cache |
151 | 151 | $modx->clearCache('full'); |
152 | 152 | } |
153 | -$header="Location: index.php?a=7&r=10"; |
|
153 | +$header = "Location: index.php?a=7&r=10"; |
|
154 | 154 | header($header); |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('settings')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -7,39 +9,27 @@ discard block |
||
7 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
8 | 10 | unset($_POST); |
9 | 11 | |
10 | -if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
|
11 | -{ |
|
12 | +if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) { |
|
12 | 13 | $htaccess = $modx->config['base_path'] . '.htaccess'; |
13 | 14 | $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
14 | 15 | $dir = '/' . trim($modx->config['base_url'],'/'); |
15 | - if(is_file($htaccess)) |
|
16 | - { |
|
16 | + if(is_file($htaccess)) { |
|
17 | 17 | $_ = file_get_contents($htaccess); |
18 | - if(strpos($_,'RewriteBase')===false) |
|
19 | - { |
|
18 | + if(strpos($_,'RewriteBase')===false) { |
|
20 | 19 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
21 | - } |
|
22 | - elseif(is_writable($htaccess)) |
|
23 | - { |
|
20 | + } elseif(is_writable($htaccess)) { |
|
24 | 21 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
25 | - if(!@file_put_contents($htaccess,$_)) |
|
26 | - { |
|
22 | + if(!@file_put_contents($htaccess,$_)) { |
|
27 | 23 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
28 | 24 | } |
29 | 25 | } |
30 | - } |
|
31 | - elseif(is_file($sample_htaccess)) |
|
32 | - { |
|
33 | - if(!@rename($sample_htaccess,$htaccess)) |
|
34 | - { |
|
26 | + } elseif(is_file($sample_htaccess)) { |
|
27 | + if(!@rename($sample_htaccess,$htaccess)) { |
|
35 | 28 | $warnings[] = $_lang["settings_friendlyurls_alert"]; |
36 | - } |
|
37 | - elseif($modx->config['base_url']!=='/') |
|
38 | - { |
|
29 | + } elseif($modx->config['base_url']!=='/') { |
|
39 | 30 | $_ = file_get_contents($htaccess); |
40 | 31 | $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
41 | - if(!@file_put_contents($htaccess,$_)) |
|
42 | - { |
|
32 | + if(!@file_put_contents($htaccess,$_)) { |
|
43 | 33 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
44 | 34 | } |
45 | 35 | } |
@@ -68,7 +58,7 @@ discard block |
||
68 | 58 | foreach ($data as $k => $v) { |
69 | 59 | switch ($k) { |
70 | 60 | case 'settings_version':{ |
71 | - if($modx->getVersionData('version')!=$data['settings_version']){ |
|
61 | + if($modx->getVersionData('version')!=$data['settings_version']) { |
|
72 | 62 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
73 | 63 | $v = $modx->getVersionData('version'); |
74 | 64 | } |
@@ -129,7 +119,9 @@ discard block |
||
129 | 119 | |
130 | 120 | $modx->config[$k] = $v; |
131 | 121 | |
132 | - if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
122 | + if(!empty($k)) { |
|
123 | + $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')'; |
|
124 | + } |
|
133 | 125 | } |
134 | 126 | |
135 | 127 | // Run a single query to save all the values |
@@ -143,8 +135,11 @@ discard block |
||
143 | 135 | $oldtemplate = intval($data['old_template']); |
144 | 136 | $tbl = $modx->getFullTableName('site_content'); |
145 | 137 | $reset = $data['reset_template']; |
146 | - if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
147 | - else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
138 | + if($reset==1) { |
|
139 | + $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
140 | + } else if($reset==2) { |
|
141 | + $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
142 | + } |
|
148 | 143 | } |
149 | 144 | |
150 | 145 | // empty cache |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | } |
22 | 22 | elseif(is_writable($htaccess)) |
23 | 23 | { |
24 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
24 | + $_ = preg_replace('@RewriteBase.+@',"rewritebase {$dir}", $_); |
|
25 | 25 | if(!@file_put_contents($htaccess,$_)) |
26 | 26 | { |
27 | 27 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | elseif($modx->config['base_url']!=='/') |
38 | 38 | { |
39 | 39 | $_ = file_get_contents($htaccess); |
40 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
40 | + $_ = preg_replace('@RewriteBase.+@',"rewritebase {$dir}", $_); |
|
41 | 41 | if(!@file_put_contents($htaccess,$_)) |
42 | 42 | { |
43 | 43 | $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
@@ -16,24 +16,24 @@ |
||
16 | 16 | $pth = dirname(dirname(dirname(__FILE__)))."/install/"; |
17 | 17 | $pth = str_replace("\\","/",$pth); |
18 | 18 | if(isset($_GET["rminstall"])) { |
19 | - if(is_dir($pth)) { |
|
20 | - if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder"; |
|
21 | - } |
|
19 | + if(is_dir($pth)) { |
|
20 | + if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder"; |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | if($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
24 | 24 | echo "<script>window.location='../index.php?a=2';</script>"; |
25 | 25 | |
26 | 26 | // rmdirRecursive - detects symbollic links on unix |
27 | 27 | function rmdirRecursive($path,$followLinks=false) { |
28 | - $dir = opendir($path) ; |
|
29 | - while ($entry = readdir($dir)) { |
|
30 | - if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) { |
|
31 | - @unlink( "$path/$entry" ); |
|
32 | - } |
|
33 | - elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
34 | - rmdirRecursive("$path/$entry"); // recursive |
|
35 | - } |
|
36 | - } |
|
37 | - closedir($dir); |
|
38 | - return @rmdir($path); |
|
28 | + $dir = opendir($path) ; |
|
29 | + while ($entry = readdir($dir)) { |
|
30 | + if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) { |
|
31 | + @unlink( "$path/$entry" ); |
|
32 | + } |
|
33 | + elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
34 | + rmdirRecursive("$path/$entry"); // recursive |
|
35 | + } |
|
36 | + } |
|
37 | + closedir($dir); |
|
38 | + return @rmdir($path); |
|
39 | 39 | } |
@@ -12,25 +12,25 @@ |
||
12 | 12 | * |
13 | 13 | */ |
14 | 14 | |
15 | -$msg =''; |
|
15 | +$msg = ''; |
|
16 | 16 | $pth = dirname(dirname(dirname(__FILE__)))."/install/"; |
17 | -$pth = str_replace("\\","/",$pth); |
|
18 | -if(isset($_GET["rminstall"])) { |
|
19 | - if(is_dir($pth)) { |
|
20 | - if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder"; |
|
17 | +$pth = str_replace("\\", "/", $pth); |
|
18 | +if (isset($_GET["rminstall"])) { |
|
19 | + if (is_dir($pth)) { |
|
20 | + if (!rmdirRecursive($pth)) $msg = "An error occured while attempting to remove the install folder"; |
|
21 | 21 | } |
22 | 22 | } |
23 | -if($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
|
23 | +if ($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
|
24 | 24 | echo "<script>window.location='../index.php?a=2';</script>"; |
25 | 25 | |
26 | 26 | // rmdirRecursive - detects symbollic links on unix |
27 | -function rmdirRecursive($path,$followLinks=false) { |
|
28 | - $dir = opendir($path) ; |
|
27 | +function rmdirRecursive($path, $followLinks = false){ |
|
28 | + $dir = opendir($path); |
|
29 | 29 | while ($entry = readdir($dir)) { |
30 | 30 | if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) { |
31 | - @unlink( "$path/$entry" ); |
|
31 | + @unlink("$path/$entry"); |
|
32 | 32 | } |
33 | - elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
33 | + elseif (is_dir("$path/$entry") && $entry != '.' && $entry != '..') { |
|
34 | 34 | rmdirRecursive("$path/$entry"); // recursive |
35 | 35 | } |
36 | 36 | } |
@@ -17,20 +17,24 @@ |
||
17 | 17 | $pth = str_replace("\\","/",$pth); |
18 | 18 | if(isset($_GET["rminstall"])) { |
19 | 19 | if(is_dir($pth)) { |
20 | - if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder"; |
|
20 | + if(!rmdirRecursive($pth)) { |
|
21 | + $msg="An error occured while attempting to remove the install folder"; |
|
22 | + } |
|
21 | 23 | } |
22 | 24 | } |
23 | -if($msg) echo "<script>alert('".addslashes($msg)."');</script>"; |
|
25 | +if($msg) { |
|
26 | + echo "<script>alert('".addslashes($msg)."');</script>"; |
|
27 | +} |
|
24 | 28 | echo "<script>window.location='../index.php?a=2';</script>"; |
25 | 29 | |
26 | 30 | // rmdirRecursive - detects symbollic links on unix |
27 | -function rmdirRecursive($path,$followLinks=false) { |
|
31 | +function rmdirRecursive($path,$followLinks=false) |
|
32 | +{ |
|
28 | 33 | $dir = opendir($path) ; |
29 | - while ($entry = readdir($dir)) { |
|
34 | + while ($entry = readdir($dir)) { |
|
30 | 35 | if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) { |
31 | 36 | @unlink( "$path/$entry" ); |
32 | - } |
|
33 | - elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
37 | + } elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') { |
|
34 | 38 | rmdirRecursive("$path/$entry"); // recursive |
35 | 39 | } |
36 | 40 | } |