@@ -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('new_plugin')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -19,25 +19,25 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate Plugin |
21 | 21 | $newid = $modx->getDatabase()->insert( |
22 | - array( |
|
23 | - 'name'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'disabled'=>'', |
|
26 | - 'moduleguid'=>'', |
|
27 | - 'plugincode'=>'', |
|
28 | - 'properties'=>'', |
|
29 | - 'category'=>'', |
|
30 | - ), $modx->getFullTableName('site_plugins'), // Insert into |
|
31 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'name'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'disabled'=>'', |
|
26 | + 'moduleguid'=>'', |
|
27 | + 'plugincode'=>'', |
|
28 | + 'properties'=>'', |
|
29 | + 'category'=>'', |
|
30 | + ), $modx->getFullTableName('site_plugins'), // Insert into |
|
31 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from |
|
32 | 32 | |
33 | 33 | // duplicate Plugin Event Listeners |
34 | 34 | $modx->getDatabase()->insert( |
35 | - array( |
|
36 | - 'pluginid'=>'', |
|
37 | - 'evtid'=>'', |
|
38 | - 'priority'=>'', |
|
39 | - ), $modx->getFullTableName('site_plugin_events'), // Insert into |
|
40 | - "'{$newid}', evtid, priority", $modx->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from |
|
35 | + array( |
|
36 | + 'pluginid'=>'', |
|
37 | + 'evtid'=>'', |
|
38 | + 'priority'=>'', |
|
39 | + ), $modx->getFullTableName('site_plugin_events'), // Insert into |
|
40 | + "'{$newid}', evtid, priority", $modx->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from |
|
41 | 41 | |
42 | 42 | // Set the item name for logger |
43 | 43 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "id='{$newid}'")); |
@@ -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('new_plugin')) { |
|
5 | +if (!$modx->hasPermission('new_plugin')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
18 | 18 | else $count = ''; |
19 | 19 | |
20 | 20 | // duplicate Plugin |
@@ -44,5 +44,5 @@ discard block |
||
44 | 44 | $_SESSION['itemname'] = $name; |
45 | 45 | |
46 | 46 | // finish duplicating - redirect to new plugin |
47 | -$header="Location: index.php?r=2&a=102&id=$newid"; |
|
47 | +$header = "Location: index.php?r=2&a=102&id=$newid"; |
|
48 | 48 | header($header); |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
18 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
19 | 22 | |
20 | 23 | // duplicate Plugin |
21 | 24 | $newid = $modx->getDatabase()->insert( |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('save_chunk')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = (int)$_POST['id']; |
|
9 | +$id = (int) $_POST['id']; |
|
10 | 10 | $snippet = $modx->getDatabase()->escape($_POST['post']); |
11 | 11 | $name = $modx->getDatabase()->escape(trim($_POST['name'])); |
12 | 12 | $description = $modx->getDatabase()->escape($_POST['description']); |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | |
17 | 17 | //Kyle Jaebker - added category support |
18 | 18 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
19 | - $categoryid = (int)$_POST['categoryid']; |
|
19 | + $categoryid = (int) $_POST['categoryid']; |
|
20 | 20 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
21 | 21 | $categoryid = 0; |
22 | 22 | } else { |
23 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
23 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
24 | 24 | $categoryid = checkCategory($_POST['newcategory']); |
25 | 25 | if (!$categoryid) { |
26 | 26 | $categoryid = newCategory($_POST['newcategory']); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | // finished emptying cache - redirect |
81 | 81 | if ($_POST['stay'] != '') { |
82 | 82 | $a = ($_POST['stay'] == '2') ? "78&id=$newid" : "77"; |
83 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
83 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
84 | 84 | header($header); |
85 | 85 | } else { |
86 | 86 | $header = "Location: index.php?a=76&r=2"; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | // finished emptying cache - redirect |
130 | 130 | if ($_POST['stay'] != '') { |
131 | 131 | $a = ($_POST['stay'] == '2') ? "78&id=$id" : "77"; |
132 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
132 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
133 | 133 | header($header); |
134 | 134 | } else { |
135 | 135 | $modx->unlockElement(3, $id); |
@@ -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('new_snippet')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate Snippet |
21 | 21 | $newid = $modx->getDatabase()->insert( |
22 | - array( |
|
23 | - 'name'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'snippet'=>'', |
|
26 | - 'properties'=>'', |
|
27 | - 'category'=>'', |
|
28 | - ), $modx->getFullTableName('site_snippets'), // Insert into |
|
29 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'name'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'snippet'=>'', |
|
26 | + 'properties'=>'', |
|
27 | + 'category'=>'', |
|
28 | + ), $modx->getFullTableName('site_snippets'), // Insert into |
|
29 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from |
|
30 | 30 | |
31 | 31 | // Set the item name for logger |
32 | 32 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_snippets'), "id='{$newid}'")); |
@@ -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('new_snippet')) { |
|
5 | +if (!$modx->hasPermission('new_snippet')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_snippets'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_snippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
18 | 18 | else $count = ''; |
19 | 19 | |
20 | 20 | // duplicate Snippet |
@@ -33,5 +33,5 @@ discard block |
||
33 | 33 | $_SESSION['itemname'] = $name; |
34 | 34 | |
35 | 35 | // finish duplicating - redirect to new snippet |
36 | -$header="Location: index.php?r=2&a=22&id=$newid"; |
|
36 | +$header = "Location: index.php?r=2&a=22&id=$newid"; |
|
37 | 37 | header($header); |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_snippets'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_snippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
18 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
19 | 22 | |
20 | 23 | // duplicate Snippet |
21 | 24 | $newid = $modx->getDatabase()->insert( |
@@ -1,16 +1,16 @@ 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_eventlog')) { |
|
5 | +if (!$modx->hasPermission('delete_eventlog')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -if (isset($_GET['cls']) && $_GET['cls']==1) { |
|
9 | +if (isset($_GET['cls']) && $_GET['cls'] == 1) { |
|
10 | 10 | $where = ''; |
11 | 11 | } else { |
12 | - $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
13 | - if($id==0) { |
|
12 | + $id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
13 | + if ($id == 0) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
15 | 15 | } |
16 | 16 | $where = "id='{$id}'"; |
@@ -19,5 +19,5 @@ discard block |
||
19 | 19 | // delete event log |
20 | 20 | $modx->getDatabase()->delete($modx->getFullTableName('event_log'), $where); |
21 | 21 | |
22 | -$header="Location: index.php?a=114"; |
|
22 | +$header = "Location: index.php?a=114"; |
|
23 | 23 | header($header); |
@@ -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('new_template')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate template |
21 | 21 | $newid = $modx->getDatabase()->insert( |
22 | - array( |
|
23 | - 'templatename'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'content'=>'', |
|
26 | - 'category'=>'', |
|
27 | - ), $modx->getFullTableName('site_templates'), // Insert into |
|
28 | - "CONCAT(templatename, ' {$_lang['duplicated_el_suffix']}{$count}') AS templatename, description, content, category", $modx->getFullTableName('site_templates'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'templatename'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'content'=>'', |
|
26 | + 'category'=>'', |
|
27 | + ), $modx->getFullTableName('site_templates'), // Insert into |
|
28 | + "CONCAT(templatename, ' {$_lang['duplicated_el_suffix']}{$count}') AS templatename, description, content, category", $modx->getFullTableName('site_templates'), "id='{$id}'"); // Copy from |
|
29 | 29 | |
30 | 30 | // duplicate TV values |
31 | 31 | $modx->getDatabase()->insert( |
32 | - array( |
|
33 | - 'tmplvarid'=>'', |
|
34 | - 'templateid'=>'', |
|
35 | - 'rank'=>'', |
|
36 | - ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into |
|
37 | - "tmplvarid, '{$newid}', rank", $modx->getFullTableName('site_tmplvar_templates'), "templateid='{$id}'"); // Copy from |
|
32 | + array( |
|
33 | + 'tmplvarid'=>'', |
|
34 | + 'templateid'=>'', |
|
35 | + 'rank'=>'', |
|
36 | + ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into |
|
37 | + "tmplvarid, '{$newid}', rank", $modx->getFullTableName('site_tmplvar_templates'), "templateid='{$id}'"); // Copy from |
|
38 | 38 | |
39 | 39 | // Set the item name for logger |
40 | 40 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('templatename', $modx->getFullTableName('site_templates'), "id='{$newid}'")); |
@@ -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('new_template')) { |
|
5 | +if (!$modx->hasPermission('new_template')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('templatename', $modx->getFullTableName('site_templates'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('templatename', $modx->getFullTableName('site_templates'), "templatename LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
18 | 18 | else $count = ''; |
19 | 19 | |
20 | 20 | // duplicate template |
@@ -41,5 +41,5 @@ discard block |
||
41 | 41 | $_SESSION['itemname'] = $name; |
42 | 42 | |
43 | 43 | // finish duplicating - redirect to new template |
44 | -$header="Location: index.php?r=2&a=16&id=$newid"; |
|
44 | +$header = "Location: index.php?r=2&a=16&id=$newid"; |
|
45 | 45 | header($header); |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('templatename', $modx->getFullTableName('site_templates'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('templatename', $modx->getFullTableName('site_templates'), "templatename LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
18 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
19 | 22 | |
20 | 23 | // duplicate template |
21 | 24 | $newid = $modx->getDatabase()->insert( |
@@ -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_module')) { |
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 OnBeforeModFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeModFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the module. |
25 | 25 | $modx->getDatabase()->delete($modx->getFullTableName('site_modules'), "id='{$id}'"); |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | // invoke OnModFormDelete event |
34 | 34 | $modx->invokeEvent("OnModFormDelete", |
35 | - array( |
|
36 | - "id" => $id |
|
37 | - )); |
|
35 | + array( |
|
36 | + "id" => $id |
|
37 | + )); |
|
38 | 38 | |
39 | 39 | // empty cache |
40 | 40 | $modx->clearCache('full'); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
3 | - header('HTTP/1.0 404 Not Found'); |
|
4 | - exit('error'); |
|
3 | + header('HTTP/1.0 404 Not Found'); |
|
4 | + exit('error'); |
|
5 | 5 | } |
6 | 6 | define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
7 | 7 | define('MODX_API_MODE', true); |
@@ -16,12 +16,12 @@ discard block |
||
16 | 16 | include_once("{$core_path}lang/english.inc.php"); |
17 | 17 | |
18 | 18 | if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
19 | - include_once("{$core_path}lang/{$manager_language}.inc.php"); |
|
19 | + include_once("{$core_path}lang/{$manager_language}.inc.php"); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | // Initialize System Alert Message Queque |
23 | 23 | if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
24 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
24 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
25 | 25 | } |
26 | 26 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
27 | 27 | |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | |
37 | 37 | // invoke OnBeforeManagerLogin event |
38 | 38 | $modx->invokeEvent('OnBeforeManagerLogin', array( |
39 | - 'username' => $username, |
|
40 | - 'userpassword' => $givenPassword, |
|
41 | - 'rememberme' => $rememberme |
|
42 | - )); |
|
39 | + 'username' => $username, |
|
40 | + 'userpassword' => $givenPassword, |
|
41 | + 'rememberme' => $rememberme |
|
42 | + )); |
|
43 | 43 | $fields = 'mu.*, ua.*'; |
44 | 44 | $from = '[+prefix+]manager_users AS mu, [+prefix+]user_attributes AS ua'; |
45 | 45 | $where = "BINARY mu.username='{$username}' and ua.internalKey=mu.id"; |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | $limit = $modx->getDatabase()->getRecordCount($rs); |
48 | 48 | |
49 | 49 | if($limit == 0 || $limit > 1) { |
50 | - jsAlert($_lang['login_processor_unknown_user']); |
|
51 | - return; |
|
50 | + jsAlert($_lang['login_processor_unknown_user']); |
|
51 | + return; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $row = $modx->getDatabase()->getRow($rs); |
@@ -69,127 +69,127 @@ discard block |
||
69 | 69 | // get the user settings from the database |
70 | 70 | $rs = $modx->getDatabase()->select('setting_name, setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_value!=''"); |
71 | 71 | while($row = $modx->getDatabase()->getRow($rs)) { |
72 | - extract($row); |
|
73 | - ${$setting_name} = $setting_value; |
|
72 | + extract($row); |
|
73 | + ${$setting_name} = $setting_value; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // blocked due to number of login errors. |
77 | 77 | if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
78 | - @session_destroy(); |
|
79 | - session_unset(); |
|
80 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
81 | - $ip = $cip; |
|
82 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
83 | - $ip = $cip; |
|
84 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
85 | - $ip = $cip; |
|
86 | - } else { |
|
87 | - $ip = "UNKNOWN"; |
|
88 | - } |
|
89 | - $log = new EvolutionCMS\Legacy\LogHandler(); |
|
90 | - $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
91 | - jsAlert($_lang['login_processor_many_failed_logins']); |
|
92 | - return; |
|
78 | + @session_destroy(); |
|
79 | + session_unset(); |
|
80 | + if($cip = getenv("HTTP_CLIENT_IP")) { |
|
81 | + $ip = $cip; |
|
82 | + } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
83 | + $ip = $cip; |
|
84 | + } elseif($cip = getenv("REMOTE_ADDR")) { |
|
85 | + $ip = $cip; |
|
86 | + } else { |
|
87 | + $ip = "UNKNOWN"; |
|
88 | + } |
|
89 | + $log = new EvolutionCMS\Legacy\LogHandler(); |
|
90 | + $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
91 | + jsAlert($_lang['login_processor_many_failed_logins']); |
|
92 | + return; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // blocked due to number of login errors, but get to try again |
96 | 96 | if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
97 | - $fields = array(); |
|
98 | - $fields['failedlogincount'] = '0'; |
|
99 | - $fields['blockeduntil'] = time() - 1; |
|
100 | - $modx->getDatabase()->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
97 | + $fields = array(); |
|
98 | + $fields['failedlogincount'] = '0'; |
|
99 | + $fields['blockeduntil'] = time() - 1; |
|
100 | + $modx->getDatabase()->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // this user has been blocked by an admin, so no way he's loggin in! |
104 | 104 | if($blocked == '1') { |
105 | - @session_destroy(); |
|
106 | - session_unset(); |
|
107 | - jsAlert($_lang['login_processor_blocked1']); |
|
108 | - return; |
|
105 | + @session_destroy(); |
|
106 | + session_unset(); |
|
107 | + jsAlert($_lang['login_processor_blocked1']); |
|
108 | + return; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | // blockuntil: this user has a block until date |
112 | 112 | if($blockeduntildate > time()) { |
113 | - @session_destroy(); |
|
114 | - session_unset(); |
|
115 | - jsAlert($_lang['login_processor_blocked2']); |
|
116 | - return; |
|
113 | + @session_destroy(); |
|
114 | + session_unset(); |
|
115 | + jsAlert($_lang['login_processor_blocked2']); |
|
116 | + return; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // blockafter: this user has a block after date |
120 | 120 | if($blockedafterdate > 0 && $blockedafterdate < time()) { |
121 | - @session_destroy(); |
|
122 | - session_unset(); |
|
123 | - jsAlert($_lang['login_processor_blocked3']); |
|
124 | - return; |
|
121 | + @session_destroy(); |
|
122 | + session_unset(); |
|
123 | + jsAlert($_lang['login_processor_blocked3']); |
|
124 | + return; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | // allowed ip |
128 | 128 | if($allowed_ip) { |
129 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
130 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
131 | - jsAlert($_lang['login_processor_remotehost_ip']); |
|
132 | - return; |
|
133 | - } |
|
134 | - } |
|
135 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
136 | - jsAlert($_lang['login_processor_remote_ip']); |
|
137 | - return; |
|
138 | - } |
|
129 | + if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
130 | + if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
131 | + jsAlert($_lang['login_processor_remotehost_ip']); |
|
132 | + return; |
|
133 | + } |
|
134 | + } |
|
135 | + if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
136 | + jsAlert($_lang['login_processor_remote_ip']); |
|
137 | + return; |
|
138 | + } |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | // allowed days |
142 | 142 | if($allowed_days) { |
143 | - $date = getdate(); |
|
144 | - $day = $date['wday'] + 1; |
|
145 | - if(!in_array($day,explode(',',$allowed_days))) { |
|
146 | - jsAlert($_lang['login_processor_date']); |
|
147 | - return; |
|
148 | - } |
|
143 | + $date = getdate(); |
|
144 | + $day = $date['wday'] + 1; |
|
145 | + if(!in_array($day,explode(',',$allowed_days))) { |
|
146 | + jsAlert($_lang['login_processor_date']); |
|
147 | + return; |
|
148 | + } |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // invoke OnManagerAuthentication event |
152 | 152 | $rt = $modx->invokeEvent('OnManagerAuthentication', array( |
153 | - 'userid' => $internalKey, |
|
154 | - 'username' => $username, |
|
155 | - 'userpassword' => $givenPassword, |
|
156 | - 'savedpassword' => $dbasePassword, |
|
157 | - 'rememberme' => $rememberme |
|
158 | - )); |
|
153 | + 'userid' => $internalKey, |
|
154 | + 'username' => $username, |
|
155 | + 'userpassword' => $givenPassword, |
|
156 | + 'savedpassword' => $dbasePassword, |
|
157 | + 'rememberme' => $rememberme |
|
158 | + )); |
|
159 | 159 | |
160 | 160 | // check if plugin authenticated the user |
161 | 161 | $matchPassword = false; |
162 | 162 | if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
163 | - // check user password - local authentication |
|
164 | - $hashType = $modx->getManagerApi()->getHashType($dbasePassword); |
|
165 | - if($hashType == 'phpass') { |
|
166 | - $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
|
167 | - } elseif($hashType == 'md5') { |
|
168 | - $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
169 | - } elseif($hashType == 'v1') { |
|
170 | - $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
171 | - } else { |
|
172 | - $matchPassword = false; |
|
173 | - } |
|
163 | + // check user password - local authentication |
|
164 | + $hashType = $modx->getManagerApi()->getHashType($dbasePassword); |
|
165 | + if($hashType == 'phpass') { |
|
166 | + $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
|
167 | + } elseif($hashType == 'md5') { |
|
168 | + $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
169 | + } elseif($hashType == 'v1') { |
|
170 | + $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
171 | + } else { |
|
172 | + $matchPassword = false; |
|
173 | + } |
|
174 | 174 | } else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
175 | - $matchPassword = true; |
|
175 | + $matchPassword = true; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | if(!$matchPassword) { |
179 | - jsAlert($_lang['login_processor_wrong_password']); |
|
180 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
181 | - return; |
|
179 | + jsAlert($_lang['login_processor_wrong_password']); |
|
180 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
181 | + return; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | if($modx->config['use_captcha'] == 1) { |
185 | - if(!isset ($_SESSION['veriword'])) { |
|
186 | - jsAlert($_lang['login_processor_captcha_config']); |
|
187 | - return; |
|
188 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
189 | - jsAlert($_lang['login_processor_bad_code']); |
|
190 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
191 | - return; |
|
192 | - } |
|
185 | + if(!isset ($_SESSION['veriword'])) { |
|
186 | + jsAlert($_lang['login_processor_captcha_config']); |
|
187 | + return; |
|
188 | + } elseif($_SESSION['veriword'] != $captcha_code) { |
|
189 | + jsAlert($_lang['login_processor_bad_code']); |
|
190 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
191 | + return; |
|
192 | + } |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | $modx->cleanupExpiredLocks(); |
@@ -224,36 +224,36 @@ discard block |
||
224 | 224 | $_SESSION['mgrToken'] = md5($currentsessionid); |
225 | 225 | |
226 | 226 | if($rememberme == '1') { |
227 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
228 | - |
|
229 | - // Set a cookie separate from the session cookie with the username in it. |
|
230 | - // Are we using secure connection? If so, make sure the cookie is secure |
|
231 | - global $https_port; |
|
232 | - |
|
233 | - $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
234 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
235 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
236 | - } else { |
|
237 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
238 | - } |
|
227 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
228 | + |
|
229 | + // Set a cookie separate from the session cookie with the username in it. |
|
230 | + // Are we using secure connection? If so, make sure the cookie is secure |
|
231 | + global $https_port; |
|
232 | + |
|
233 | + $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
234 | + if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
235 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
236 | + } else { |
|
237 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
238 | + } |
|
239 | 239 | } else { |
240 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
240 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
241 | 241 | |
242 | - // Remove the Remember Me cookie |
|
243 | - setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
242 | + // Remove the Remember Me cookie |
|
243 | + setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | // Check if user already has an active session, if not check if user pressed logout end of last session |
247 | 247 | $rs = $modx->getDatabase()->select('lasthit', $modx->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
248 | 248 | $activeSession = $modx->getDatabase()->getValue($rs); |
249 | 249 | if(!$activeSession) { |
250 | - $rs = $modx->getDatabase()->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
251 | - if($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
252 | - $_SESSION['show_logout_reminder'] = array( |
|
253 | - 'type' => 'logout_reminder', |
|
254 | - 'lastHit' => $lastHit |
|
255 | - ); |
|
256 | - } |
|
250 | + $rs = $modx->getDatabase()->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
251 | + if($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
252 | + $_SESSION['show_logout_reminder'] = array( |
|
253 | + 'type' => 'logout_reminder', |
|
254 | + 'lastHit' => $lastHit |
|
255 | + ); |
|
256 | + } |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | $log = new EvolutionCMS\Legacy\LogHandler(); |
@@ -261,27 +261,27 @@ discard block |
||
261 | 261 | |
262 | 262 | // invoke OnManagerLogin event |
263 | 263 | $modx->invokeEvent('OnManagerLogin', array( |
264 | - 'userid' => $internalKey, |
|
265 | - 'username' => $username, |
|
266 | - 'userpassword' => $givenPassword, |
|
267 | - 'rememberme' => $rememberme |
|
268 | - )); |
|
264 | + 'userid' => $internalKey, |
|
265 | + 'username' => $username, |
|
266 | + 'userpassword' => $givenPassword, |
|
267 | + 'rememberme' => $rememberme |
|
268 | + )); |
|
269 | 269 | |
270 | 270 | // check if we should redirect user to a web page |
271 | 271 | $rs = $modx->getDatabase()->select('setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_name='manager_login_startup'"); |
272 | 272 | $id = (int)$modx->getDatabase()->getValue($rs); |
273 | 273 | if($id > 0) { |
274 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
275 | - if($_POST['ajax'] == 1) { |
|
276 | - echo $header; |
|
277 | - } else { |
|
278 | - header($header); |
|
279 | - } |
|
274 | + $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
275 | + if($_POST['ajax'] == 1) { |
|
276 | + echo $header; |
|
277 | + } else { |
|
278 | + header($header); |
|
279 | + } |
|
280 | 280 | } else { |
281 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
282 | - if($_POST['ajax'] == 1) { |
|
283 | - echo $header; |
|
284 | - } else { |
|
285 | - header($header); |
|
286 | - } |
|
281 | + $header = 'Location: ' . MODX_MANAGER_URL; |
|
282 | + if($_POST['ajax'] == 1) { |
|
283 | + echo $header; |
|
284 | + } else { |
|
285 | + header($header); |
|
286 | + } |
|
287 | 287 | } |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
2 | +if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
3 | 3 | header('HTTP/1.0 404 Not Found'); |
4 | 4 | exit('error'); |
5 | 5 | } |
6 | -define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
|
6 | +define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
|
7 | 7 | define('MODX_API_MODE', true); |
8 | -include_once(__DIR__ . '/../../index.php'); |
|
8 | +include_once(__DIR__.'/../../index.php'); |
|
9 | 9 | $modx->getDatabase()->connect(); |
10 | 10 | $modx->getSettings(); |
11 | 11 | $modx->invokeEvent('OnManagerPageInit'); |
12 | 12 | |
13 | -$core_path = MODX_MANAGER_PATH . 'includes/'; |
|
13 | +$core_path = MODX_MANAGER_PATH.'includes/'; |
|
14 | 14 | // include_once the language file |
15 | 15 | $_lang = array(); |
16 | 16 | include_once("{$core_path}lang/english.inc.php"); |
17 | 17 | |
18 | -if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
|
18 | +if ($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
|
19 | 19 | include_once("{$core_path}lang/{$manager_language}.inc.php"); |
20 | 20 | } |
21 | 21 | |
22 | 22 | // Initialize System Alert Message Queque |
23 | -if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
23 | +if (!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
24 | 24 | $_SESSION['SystemAlertMsgQueque'] = array(); |
25 | 25 | } |
26 | 26 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $rs = $modx->getDatabase()->select($fields, $from, $where); |
47 | 47 | $limit = $modx->getDatabase()->getRecordCount($rs); |
48 | 48 | |
49 | -if($limit == 0 || $limit > 1) { |
|
49 | +if ($limit == 0 || $limit > 1) { |
|
50 | 50 | jsAlert($_lang['login_processor_unknown_user']); |
51 | 51 | return; |
52 | 52 | } |
@@ -68,32 +68,32 @@ discard block |
||
68 | 68 | |
69 | 69 | // get the user settings from the database |
70 | 70 | $rs = $modx->getDatabase()->select('setting_name, setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_value!=''"); |
71 | -while($row = $modx->getDatabase()->getRow($rs)) { |
|
71 | +while ($row = $modx->getDatabase()->getRow($rs)) { |
|
72 | 72 | extract($row); |
73 | 73 | ${$setting_name} = $setting_value; |
74 | 74 | } |
75 | 75 | |
76 | 76 | // blocked due to number of login errors. |
77 | -if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
|
77 | +if ($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
|
78 | 78 | @session_destroy(); |
79 | 79 | session_unset(); |
80 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
80 | + if ($cip = getenv("HTTP_CLIENT_IP")) { |
|
81 | 81 | $ip = $cip; |
82 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
82 | + } elseif ($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
83 | 83 | $ip = $cip; |
84 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
84 | + } elseif ($cip = getenv("REMOTE_ADDR")) { |
|
85 | 85 | $ip = $cip; |
86 | 86 | } else { |
87 | 87 | $ip = "UNKNOWN"; |
88 | 88 | } |
89 | 89 | $log = new EvolutionCMS\Legacy\LogHandler(); |
90 | - $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
90 | + $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: ".$ip); |
|
91 | 91 | jsAlert($_lang['login_processor_many_failed_logins']); |
92 | 92 | return; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // blocked due to number of login errors, but get to try again |
96 | -if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
|
96 | +if ($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
|
97 | 97 | $fields = array(); |
98 | 98 | $fields['failedlogincount'] = '0'; |
99 | 99 | $fields['blockeduntil'] = time() - 1; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | // this user has been blocked by an admin, so no way he's loggin in! |
104 | -if($blocked == '1') { |
|
104 | +if ($blocked == '1') { |
|
105 | 105 | @session_destroy(); |
106 | 106 | session_unset(); |
107 | 107 | jsAlert($_lang['login_processor_blocked1']); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | // blockuntil: this user has a block until date |
112 | -if($blockeduntildate > time()) { |
|
112 | +if ($blockeduntildate > time()) { |
|
113 | 113 | @session_destroy(); |
114 | 114 | session_unset(); |
115 | 115 | jsAlert($_lang['login_processor_blocked2']); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | // blockafter: this user has a block after date |
120 | -if($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
120 | +if ($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
121 | 121 | @session_destroy(); |
122 | 122 | session_unset(); |
123 | 123 | jsAlert($_lang['login_processor_blocked3']); |
@@ -125,24 +125,24 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | // allowed ip |
128 | -if($allowed_ip) { |
|
129 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
130 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
128 | +if ($allowed_ip) { |
|
129 | + if (($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
130 | + if (gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
131 | 131 | jsAlert($_lang['login_processor_remotehost_ip']); |
132 | 132 | return; |
133 | 133 | } |
134 | 134 | } |
135 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
135 | + if (!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
136 | 136 | jsAlert($_lang['login_processor_remote_ip']); |
137 | 137 | return; |
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | 141 | // allowed days |
142 | -if($allowed_days) { |
|
142 | +if ($allowed_days) { |
|
143 | 143 | $date = getdate(); |
144 | 144 | $day = $date['wday'] + 1; |
145 | - if(!in_array($day,explode(',',$allowed_days))) { |
|
145 | + if (!in_array($day, explode(',', $allowed_days))) { |
|
146 | 146 | jsAlert($_lang['login_processor_date']); |
147 | 147 | return; |
148 | 148 | } |
@@ -159,33 +159,33 @@ discard block |
||
159 | 159 | |
160 | 160 | // check if plugin authenticated the user |
161 | 161 | $matchPassword = false; |
162 | -if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
162 | +if (!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
163 | 163 | // check user password - local authentication |
164 | 164 | $hashType = $modx->getManagerApi()->getHashType($dbasePassword); |
165 | - if($hashType == 'phpass') { |
|
165 | + if ($hashType == 'phpass') { |
|
166 | 166 | $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
167 | - } elseif($hashType == 'md5') { |
|
167 | + } elseif ($hashType == 'md5') { |
|
168 | 168 | $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
169 | - } elseif($hashType == 'v1') { |
|
169 | + } elseif ($hashType == 'v1') { |
|
170 | 170 | $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
171 | 171 | } else { |
172 | 172 | $matchPassword = false; |
173 | 173 | } |
174 | -} else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
174 | +} else if ($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
175 | 175 | $matchPassword = true; |
176 | 176 | } |
177 | 177 | |
178 | -if(!$matchPassword) { |
|
178 | +if (!$matchPassword) { |
|
179 | 179 | jsAlert($_lang['login_processor_wrong_password']); |
180 | 180 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
181 | 181 | return; |
182 | 182 | } |
183 | 183 | |
184 | -if($modx->config['use_captcha'] == 1) { |
|
185 | - if(!isset ($_SESSION['veriword'])) { |
|
184 | +if ($modx->config['use_captcha'] == 1) { |
|
185 | + if (!isset ($_SESSION['veriword'])) { |
|
186 | 186 | jsAlert($_lang['login_processor_captcha_config']); |
187 | 187 | return; |
188 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
188 | + } elseif ($_SESSION['veriword'] != $captcha_code) { |
|
189 | 189 | jsAlert($_lang['login_processor_bad_code']); |
190 | 190 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
191 | 191 | return; |
@@ -213,25 +213,25 @@ discard block |
||
213 | 213 | $_SESSION['mgrPermissions'] = $modx->getDatabase()->getRow($rs); |
214 | 214 | |
215 | 215 | // successful login so reset fail count and update key values |
216 | -$modx->getDatabase()->update('failedlogincount=0, ' . 'logincount=logincount+1, ' . 'lastlogin=thislogin, ' . 'thislogin=' . time() . ', ' . "sessionid='{$currentsessionid}'", '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
216 | +$modx->getDatabase()->update('failedlogincount=0, '.'logincount=logincount+1, '.'lastlogin=thislogin, '.'thislogin='.time().', '."sessionid='{$currentsessionid}'", '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
217 | 217 | |
218 | 218 | // get user's document groups |
219 | 219 | $i = 0; |
220 | -$rs = $modx->getDatabase()->select('uga.documentgroup', $modx->getFullTableName('member_groups') . ' ug |
|
221 | - INNER JOIN ' . $modx->getFullTableName('membergroup_access') . ' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'"); |
|
220 | +$rs = $modx->getDatabase()->select('uga.documentgroup', $modx->getFullTableName('member_groups').' ug |
|
221 | + INNER JOIN ' . $modx->getFullTableName('membergroup_access').' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'"); |
|
222 | 222 | $_SESSION['mgrDocgroups'] = $modx->getDatabase()->getColumn('documentgroup', $rs); |
223 | 223 | |
224 | 224 | $_SESSION['mgrToken'] = md5($currentsessionid); |
225 | 225 | |
226 | -if($rememberme == '1') { |
|
227 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
226 | +if ($rememberme == '1') { |
|
227 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = (int) $modx->config['session.cookie.lifetime']; |
|
228 | 228 | |
229 | 229 | // Set a cookie separate from the session cookie with the username in it. |
230 | 230 | // Are we using secure connection? If so, make sure the cookie is secure |
231 | 231 | global $https_port; |
232 | 232 | |
233 | 233 | $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
234 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
234 | + if (version_compare(PHP_VERSION, '5.2', '<')) { |
|
235 | 235 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
236 | 236 | } else { |
237 | 237 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | // Check if user already has an active session, if not check if user pressed logout end of last session |
247 | 247 | $rs = $modx->getDatabase()->select('lasthit', $modx->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
248 | 248 | $activeSession = $modx->getDatabase()->getValue($rs); |
249 | -if(!$activeSession) { |
|
249 | +if (!$activeSession) { |
|
250 | 250 | $rs = $modx->getDatabase()->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
251 | - if($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
251 | + if ($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
252 | 252 | $_SESSION['show_logout_reminder'] = array( |
253 | 253 | 'type' => 'logout_reminder', |
254 | 254 | 'lastHit' => $lastHit |
@@ -269,17 +269,17 @@ discard block |
||
269 | 269 | |
270 | 270 | // check if we should redirect user to a web page |
271 | 271 | $rs = $modx->getDatabase()->select('setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_name='manager_login_startup'"); |
272 | -$id = (int)$modx->getDatabase()->getValue($rs); |
|
273 | -if($id > 0) { |
|
274 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
275 | - if($_POST['ajax'] == 1) { |
|
272 | +$id = (int) $modx->getDatabase()->getValue($rs); |
|
273 | +if ($id > 0) { |
|
274 | + $header = 'Location: '.$modx->makeUrl($id, '', '', 'full'); |
|
275 | + if ($_POST['ajax'] == 1) { |
|
276 | 276 | echo $header; |
277 | 277 | } else { |
278 | 278 | header($header); |
279 | 279 | } |
280 | 280 | } else { |
281 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
282 | - if($_POST['ajax'] == 1) { |
|
281 | + $header = 'Location: '.MODX_MANAGER_URL; |
|
282 | + if ($_POST['ajax'] == 1) { |
|
283 | 283 | echo $header; |
284 | 284 | } else { |
285 | 285 | header($header); |
@@ -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_document')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_REQUEST['id'])? (int)$_REQUEST['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 | /************ webber ********/ |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
32 | 32 | |
33 | 33 | if(!$udperms->checkPermissions()) { |
34 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
34 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | // get the timestamp on which the document was deleted. |
38 | 38 | $rs = $modx->getDatabase()->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
39 | 39 | $deltime = $modx->getDatabase()->getValue($rs); |
40 | 40 | if(!$deltime) { |
41 | - $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
41 | + $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $children = array(); |
@@ -46,20 +46,20 @@ discard block |
||
46 | 46 | getChildrenForUnDelete($id); |
47 | 47 | |
48 | 48 | if(count($children)>0) { |
49 | - $modx->getDatabase()->update( |
|
50 | - array( |
|
51 | - 'deleted' => 0, |
|
52 | - 'deletedby' => 0, |
|
53 | - 'deletedon' => 0, |
|
54 | - ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
49 | + $modx->getDatabase()->update( |
|
50 | + array( |
|
51 | + 'deleted' => 0, |
|
52 | + 'deletedby' => 0, |
|
53 | + 'deletedon' => 0, |
|
54 | + ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
55 | 55 | } |
56 | 56 | //'undelete' the document. |
57 | 57 | $modx->getDatabase()->update( |
58 | - array( |
|
59 | - 'deleted' => 0, |
|
60 | - 'deletedby' => 0, |
|
61 | - 'deletedon' => 0, |
|
62 | - ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
58 | + array( |
|
59 | + 'deleted' => 0, |
|
60 | + 'deletedby' => 0, |
|
61 | + 'deletedon' => 0, |
|
62 | + ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
63 | 63 | |
64 | 64 | $modx->invokeEvent("OnDocFormUnDelete", |
65 | 65 | array( |
@@ -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 | -if(!$modx->hasPermission('delete_document')) { |
|
5 | +if (!$modx->hasPermission('delete_document')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | /************ webber ********/ |
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 | /************** webber *************/ |
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 | |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | $udperms->document = $id; |
31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
32 | 32 | |
33 | -if(!$udperms->checkPermissions()) { |
|
33 | +if (!$udperms->checkPermissions()) { |
|
34 | 34 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
35 | 35 | } |
36 | 36 | |
37 | 37 | // get the timestamp on which the document was deleted. |
38 | 38 | $rs = $modx->getDatabase()->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
39 | 39 | $deltime = $modx->getDatabase()->getValue($rs); |
40 | -if(!$deltime) { |
|
40 | +if (!$deltime) { |
|
41 | 41 | $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
42 | 42 | } |
43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | getChildrenForUnDelete($id); |
47 | 47 | |
48 | -if(count($children)>0) { |
|
48 | +if (count($children) > 0) { |
|
49 | 49 | $modx->getDatabase()->update( |
50 | 50 | array( |
51 | 51 | 'deleted' => 0, |
@@ -74,5 +74,5 @@ discard block |
||
74 | 74 | $modx->clearCache('full'); |
75 | 75 | |
76 | 76 | // finished emptying cache - redirect |
77 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
77 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
78 | 78 | header($header); |
@@ -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('edit_template')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -19,37 +19,37 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate TV |
21 | 21 | $newid = $modx->getDatabase()->insert( |
22 | - array( |
|
23 | - 'type'=>'', |
|
24 | - 'name'=>'', |
|
25 | - 'caption'=>'', |
|
26 | - 'description'=>'', |
|
27 | - 'default_text'=>'', |
|
28 | - 'elements'=>'', |
|
29 | - 'rank'=>'', |
|
30 | - 'display'=>'', |
|
31 | - 'display_params'=>'', |
|
32 | - 'category'=>'', |
|
33 | - ), $modx->getFullTableName('site_tmplvars'), // Insert into |
|
34 | - "type, CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, CONCAT(caption, ' Duplicate{$count}') AS caption, description, default_text, elements, rank, display, display_params, category", $modx->getFullTableName('site_tmplvars'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'type'=>'', |
|
24 | + 'name'=>'', |
|
25 | + 'caption'=>'', |
|
26 | + 'description'=>'', |
|
27 | + 'default_text'=>'', |
|
28 | + 'elements'=>'', |
|
29 | + 'rank'=>'', |
|
30 | + 'display'=>'', |
|
31 | + 'display_params'=>'', |
|
32 | + 'category'=>'', |
|
33 | + ), $modx->getFullTableName('site_tmplvars'), // Insert into |
|
34 | + "type, CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, CONCAT(caption, ' Duplicate{$count}') AS caption, description, default_text, elements, rank, display, display_params, category", $modx->getFullTableName('site_tmplvars'), "id='{$id}'"); // Copy from |
|
35 | 35 | |
36 | 36 | |
37 | 37 | // duplicate TV Template Access Permissions |
38 | 38 | $modx->getDatabase()->insert( |
39 | - array( |
|
40 | - 'tmplvarid'=>'', |
|
41 | - 'templateid'=>'', |
|
42 | - 'rank'=>'', |
|
43 | - ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into |
|
44 | - "'{$newid}', templateid, rank", $modx->getFullTableName('site_tmplvar_templates'), "tmplvarid='{$id}'"); // Copy from |
|
39 | + array( |
|
40 | + 'tmplvarid'=>'', |
|
41 | + 'templateid'=>'', |
|
42 | + 'rank'=>'', |
|
43 | + ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into |
|
44 | + "'{$newid}', templateid, rank", $modx->getFullTableName('site_tmplvar_templates'), "tmplvarid='{$id}'"); // Copy from |
|
45 | 45 | |
46 | 46 | // duplicate TV Access Permissions |
47 | 47 | $modx->getDatabase()->insert( |
48 | - array( |
|
49 | - 'tmplvarid'=>'', |
|
50 | - 'documentgroup'=>'', |
|
51 | - ), $modx->getFullTableName('site_tmplvar_access'), // Insert into |
|
52 | - "'{$newid}', documentgroup", $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); // Copy from |
|
48 | + array( |
|
49 | + 'tmplvarid'=>'', |
|
50 | + 'documentgroup'=>'', |
|
51 | + ), $modx->getFullTableName('site_tmplvar_access'), // Insert into |
|
52 | + "'{$newid}', documentgroup", $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); // Copy from |
|
53 | 53 | |
54 | 54 | // Set the item name for logger |
55 | 55 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$newid}'")); |
@@ -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_template')) { |
|
5 | +if (!$modx->hasPermission('edit_template')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_tmplvars'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
18 | 18 | else $count = ''; |
19 | 19 | |
20 | 20 | // duplicate TV |
@@ -56,5 +56,5 @@ discard block |
||
56 | 56 | $_SESSION['itemname'] = $name; |
57 | 57 | |
58 | 58 | // finish duplicating - redirect to new variable |
59 | -$header="Location: index.php?r=2&a=301&id=$newid"; |
|
59 | +$header = "Location: index.php?r=2&a=301&id=$newid"; |
|
60 | 60 | header($header); |
@@ -14,8 +14,11 @@ |
||
14 | 14 | // count duplicates |
15 | 15 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$id}'")); |
16 | 16 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_tmplvars'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
17 | -if($count>=1) $count = ' '.($count+1); |
|
18 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
19 | 22 | |
20 | 23 | // duplicate TV |
21 | 24 | $newid = $modx->getDatabase()->insert( |