@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('save_template')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = (int)$_POST['id']; |
|
9 | +$id = (int) $_POST['id']; |
|
10 | 10 | $name = $modx->getDatabase()->escape(trim($_POST['name'])); |
11 | 11 | $description = $modx->getDatabase()->escape($_POST['description']); |
12 | 12 | $caption = $modx->getDatabase()->escape($_POST['caption']); |
@@ -17,17 +17,17 @@ discard block |
||
17 | 17 | $display = $modx->getDatabase()->escape($_POST['display']); |
18 | 18 | $params = $modx->getDatabase()->escape($_POST['params']); |
19 | 19 | $locked = $_POST['locked'] == 'on' ? 1 : 0; |
20 | -$origin = isset($_REQUEST['or']) ? (int)$_REQUEST['or'] : 76; |
|
21 | -$originId = isset($_REQUEST['oid']) ? (int)$_REQUEST['oid'] : null; |
|
20 | +$origin = isset($_REQUEST['or']) ? (int) $_REQUEST['or'] : 76; |
|
21 | +$originId = isset($_REQUEST['oid']) ? (int) $_REQUEST['oid'] : null; |
|
22 | 22 | $currentdate = time() + $modx->config['server_offset_time']; |
23 | 23 | |
24 | 24 | //Kyle Jaebker - added category support |
25 | 25 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
26 | - $categoryid = (int)$_POST['categoryid']; |
|
26 | + $categoryid = (int) $_POST['categoryid']; |
|
27 | 27 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
28 | 28 | $categoryid = 0; |
29 | 29 | } else { |
30 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
30 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
31 | 31 | $categoryid = checkCategory($_POST['newcategory']); |
32 | 32 | if (!$categoryid) { |
33 | 33 | $categoryid = newCategory($_POST['newcategory']); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // finished emptying cache - redirect |
100 | 100 | if ($_POST['stay'] != '') { |
101 | 101 | $a = ($_POST['stay'] == '2') ? "301&id=$newid" : "300"; |
102 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
102 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
103 | 103 | header($header); |
104 | 104 | } else { |
105 | 105 | $header = "Location: index.php?a=76&r=2"; |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | // finished emptying cache - redirect |
161 | 161 | if ($_POST['stay'] != '') { |
162 | 162 | $a = ($_POST['stay'] == '2') ? "301&id=$id" : "300"; |
163 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'] . "&or=" . $origin . "&oid=" . $originId; |
|
163 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']."&or=".$origin."&oid=".$originId; |
|
164 | 164 | header($header); |
165 | 165 | } else { |
166 | 166 | $modx->unlockElement(2, $id); |
167 | - $header = "Location: index.php?a=" . $origin . "&r=2" . (empty($originId) ? '' : '&id=' . $originId); |
|
167 | + $header = "Location: index.php?a=".$origin."&r=2".(empty($originId) ? '' : '&id='.$originId); |
|
168 | 168 | header($header); |
169 | 169 | } |
170 | 170 |
@@ -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( |
@@ -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_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( |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | * Initialize Document Parsing |
45 | 45 | * ----------------------------- |
46 | 46 | */ |
47 | -if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
|
47 | +if (!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
|
48 | 48 | |
49 | -$base_path = str_replace('\\','/',dirname(__FILE__)) . '/'; |
|
50 | -if(is_file($base_path . 'assets/cache/siteManager.php')) |
|
51 | - include_once($base_path . 'assets/cache/siteManager.php'); |
|
52 | -if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) |
|
49 | +$base_path = str_replace('\\', '/', dirname(__FILE__)).'/'; |
|
50 | +if (is_file($base_path.'assets/cache/siteManager.php')) |
|
51 | + include_once($base_path.'assets/cache/siteManager.php'); |
|
52 | +if (!defined('MGR_DIR') && is_dir("{$base_path}manager")) |
|
53 | 53 | define('MGR_DIR', 'manager'); |
54 | -if(is_file($base_path . 'assets/cache/siteHostnames.php')) |
|
55 | - include_once($base_path . 'assets/cache/siteHostnames.php'); |
|
56 | -if(!defined('MODX_SITE_HOSTNAMES')) |
|
54 | +if (is_file($base_path.'assets/cache/siteHostnames.php')) |
|
55 | + include_once($base_path.'assets/cache/siteHostnames.php'); |
|
56 | +if (!defined('MODX_SITE_HOSTNAMES')) |
|
57 | 57 | define('MODX_SITE_HOSTNAMES', ''); |
58 | 58 | |
59 | 59 | // get start time |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | // set some settings, and address some IE issues |
66 | 66 | @ini_set('url_rewriter.tags', ''); |
67 | 67 | @ini_set('session.use_trans_sid', 0); |
68 | -@ini_set('session.use_only_cookies',1); |
|
68 | +@ini_set('session.use_only_cookies', 1); |
|
69 | 69 | session_cache_limiter(''); |
70 | 70 | header('P3P: CP="NOI NID ADMa OUR IND UNI COM NAV"'); // header for weird cookie stuff. Blame IE. |
71 | 71 | header('Cache-Control: private, must-revalidate'); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | |
79 | 79 | define('IN_PARSER_MODE', true); |
80 | -if ( ! defined('IN_MANAGER_MODE')) { |
|
80 | +if (!defined('IN_MANAGER_MODE')) { |
|
81 | 81 | define('IN_MANAGER_MODE', false); |
82 | 82 | } |
83 | 83 | if (!defined('MODX_API_MODE')) { |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | // get the required includes |
88 | -if(! isset($database_user) || $database_user==="") { |
|
89 | - $rt = @include_once(__DIR__ . '/' . MGR_DIR . '/includes/config.inc.php'); |
|
88 | +if (!isset($database_user) || $database_user === "") { |
|
89 | + $rt = @include_once(__DIR__.'/'.MGR_DIR.'/includes/config.inc.php'); |
|
90 | 90 | $path = 'install/src/template/not_installed.tpl'; |
91 | 91 | // Be sure config.inc.php is there and that it contains some important values |
92 | 92 | if (!$rt || !$database_type || !$database_server || !$database_user || !$dbase) { |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | $modx->stopOnNotice = false; |
123 | 123 | |
124 | 124 | // Don't show PHP errors to the public |
125 | -if(!isset($_SESSION['mgrValidated']) || !$_SESSION['mgrValidated']) { |
|
126 | - @ini_set("display_errors","0"); |
|
125 | +if (!isset($_SESSION['mgrValidated']) || !$_SESSION['mgrValidated']) { |
|
126 | + @ini_set("display_errors", "0"); |
|
127 | 127 | } |
128 | 128 | |
129 | -if(MODX_CLI){ |
|
129 | +if (MODX_CLI) { |
|
130 | 130 | @set_time_limit(0); |
131 | - @ini_set('max_execution_time',0); |
|
131 | + @ini_set('max_execution_time', 0); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | // execute the parser if index.php was not included |
@@ -44,17 +44,23 @@ discard block |
||
44 | 44 | * Initialize Document Parsing |
45 | 45 | * ----------------------------- |
46 | 46 | */ |
47 | -if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
|
47 | +if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) { |
|
48 | + $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
|
49 | +} |
|
48 | 50 | |
49 | 51 | $base_path = str_replace('\\','/',dirname(__FILE__)) . '/'; |
50 | -if(is_file($base_path . 'assets/cache/siteManager.php')) |
|
52 | +if(is_file($base_path . 'assets/cache/siteManager.php')) { |
|
51 | 53 | include_once($base_path . 'assets/cache/siteManager.php'); |
52 | -if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) |
|
54 | +} |
|
55 | +if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
53 | 56 | define('MGR_DIR', 'manager'); |
54 | -if(is_file($base_path . 'assets/cache/siteHostnames.php')) |
|
57 | +} |
|
58 | +if(is_file($base_path . 'assets/cache/siteHostnames.php')) { |
|
55 | 59 | include_once($base_path . 'assets/cache/siteHostnames.php'); |
56 | -if(!defined('MODX_SITE_HOSTNAMES')) |
|
60 | +} |
|
61 | +if(!defined('MODX_SITE_HOSTNAMES')) { |
|
57 | 62 | define('MODX_SITE_HOSTNAMES', ''); |
63 | +} |
|
58 | 64 | |
59 | 65 | // get start time |
60 | 66 | $mstart = memory_get_usage(); |
@@ -126,7 +132,7 @@ discard block |
||
126 | 132 | @ini_set("display_errors","0"); |
127 | 133 | } |
128 | 134 | |
129 | -if(MODX_CLI){ |
|
135 | +if(MODX_CLI) { |
|
130 | 136 | @set_time_limit(0); |
131 | 137 | @ini_set('max_execution_time',0); |
132 | 138 | } |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | if(is_file($base_path . 'assets/cache/siteManager.php')) |
51 | 51 | include_once($base_path . 'assets/cache/siteManager.php'); |
52 | 52 | if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) |
53 | - define('MGR_DIR', 'manager'); |
|
53 | + define('MGR_DIR', 'manager'); |
|
54 | 54 | if(is_file($base_path . 'assets/cache/siteHostnames.php')) |
55 | 55 | include_once($base_path . 'assets/cache/siteHostnames.php'); |
56 | 56 | if(!defined('MODX_SITE_HOSTNAMES')) |
57 | - define('MODX_SITE_HOSTNAMES', ''); |
|
57 | + define('MODX_SITE_HOSTNAMES', ''); |
|
58 | 58 | |
59 | 59 | // get start time |
60 | 60 | $mstart = memory_get_usage(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | define('IN_PARSER_MODE', true); |
80 | 80 | if ( ! defined('IN_MANAGER_MODE')) { |
81 | - define('IN_MANAGER_MODE', false); |
|
81 | + define('IN_MANAGER_MODE', false); |
|
82 | 82 | } |
83 | 83 | if (!defined('MODX_API_MODE')) { |
84 | 84 | define('MODX_API_MODE', false); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * @param string $mode |
103 | 103 | * @param string $modifiers |
104 | - * @return bool|string |
|
104 | + * @return false|string |
|
105 | 105 | */ |
106 | 106 | public function _getDelim($mode, $modifiers) |
107 | 107 | { |
@@ -151,6 +151,13 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | + /** |
|
155 | + * @param string $mode |
|
156 | + * @param false|string $delim |
|
157 | + * @param string $modifiers |
|
158 | + * |
|
159 | + * @return string |
|
160 | + */ |
|
154 | 161 | public function _getRemainModifiers($mode, $delim, $modifiers) |
155 | 162 | { |
156 | 163 | if ($delim) { |
@@ -187,6 +194,9 @@ discard block |
||
187 | 194 | return substr($string, strpos($string, $delim) + $len); |
188 | 195 | } |
189 | 196 | |
197 | + /** |
|
198 | + * @param string $modifiers |
|
199 | + */ |
|
190 | 200 | public function splitEachModifiers($modifiers) |
191 | 201 | { |
192 | 202 | $modx = evolutionCMS(); |
@@ -259,6 +269,10 @@ discard block |
||
259 | 269 | return $result; |
260 | 270 | } |
261 | 271 | |
272 | + /** |
|
273 | + * @param string $key |
|
274 | + * @param string $value |
|
275 | + */ |
|
262 | 276 | public function parsePhx($key, $value, $modifiers) |
263 | 277 | { |
264 | 278 | $modx = evolutionCMS(); |
@@ -340,6 +354,10 @@ discard block |
||
340 | 354 | } |
341 | 355 | } |
342 | 356 | |
357 | + /** |
|
358 | + * @param string $cmd |
|
359 | + * @param string $opt |
|
360 | + */ |
|
343 | 361 | public function getValueFromPreset($key, $value, $cmd, $opt) |
344 | 362 | { |
345 | 363 | $modx = evolutionCMS(); |
@@ -1285,6 +1303,9 @@ discard block |
||
1285 | 1303 | return $value; |
1286 | 1304 | } |
1287 | 1305 | |
1306 | + /** |
|
1307 | + * @param string $cmd |
|
1308 | + */ |
|
1288 | 1309 | public function includeMdfFile($cmd) |
1289 | 1310 | { |
1290 | 1311 | $modx = evolutionCMS(); |
@@ -1477,6 +1498,10 @@ discard block |
||
1477 | 1498 | } |
1478 | 1499 | |
1479 | 1500 | // Sets a placeholder variable which can only be access by Modifiers |
1501 | + |
|
1502 | + /** |
|
1503 | + * @param string $value |
|
1504 | + */ |
|
1480 | 1505 | public function setModifiersVariable($key, $value) |
1481 | 1506 | { |
1482 | 1507 | if ($key != 'phx' && $key != 'dummy') { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | $this->srcValue = $value; |
84 | 84 | $modifiers = trim($modifiers); |
85 | - $modifiers = ':' . trim($modifiers, ':'); |
|
85 | + $modifiers = ':'.trim($modifiers, ':'); |
|
86 | 86 | $modifiers = str_replace(array("\r\n", "\r"), "\n", $modifiers); |
87 | 87 | $modifiers = $this->splitEachModifiers($modifiers); |
88 | 88 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | if ($delim) { |
131 | 131 | if ($mode == '(') { |
132 | - return substr($modifiers, 1, strpos($modifiers, $delim . ')') - 1); |
|
132 | + return substr($modifiers, 1, strpos($modifiers, $delim.')') - 1); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | return substr($modifiers, 1, strpos($modifiers, $delim, 1) - 1); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | if ($delim) { |
157 | 157 | if ($mode == '(') { |
158 | - return $this->_fetchContent($modifiers, $delim . ')'); |
|
158 | + return $this->_fetchContent($modifiers, $delim.')'); |
|
159 | 159 | } else { |
160 | 160 | $modifiers = trim($modifiers); |
161 | 161 | $modifiers = substr($modifiers, 1); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } elseif (in_array($c, array('+', '-', '*', '/')) && preg_match('@^[0-9]+@', $modifiers, |
218 | 218 | $match)) { // :+3, :-3, :*3 ... |
219 | 219 | $modifiers = substr($modifiers, strlen($match[0])); |
220 | - $result[] = array('cmd' => 'math', 'opt' => '%s' . $c . $match[0]); |
|
220 | + $result[] = array('cmd' => 'math', 'opt' => '%s'.$c.$match[0]); |
|
221 | 221 | $cmd = ''; |
222 | 222 | } elseif ($c === '(' || $c === '=') { |
223 | 223 | $modifiers = $m1 = trim($modifiers); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | } |
333 | 333 | |
334 | 334 | $_ = explode(',', |
335 | - $this->condModifiers . ',_default,default,if,input,or,and,show,this,select,switch,then,else,id,ifempty,smart_desc,smart_description,summary'); |
|
335 | + $this->condModifiers.',_default,default,if,input,or,and,show,this,select,switch,then,else,id,ifempty,smart_desc,smart_description,summary'); |
|
336 | 336 | if (in_array($cmd, $_)) { |
337 | 337 | return false; |
338 | 338 | } else { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | case 'eq': |
366 | 366 | case 'is': |
367 | 367 | case 'equals': |
368 | - $this->condition[] = (int)($value == $opt); |
|
368 | + $this->condition[] = (int) ($value == $opt); |
|
369 | 369 | break; |
370 | 370 | case 'neq': |
371 | 371 | case 'ne': |
@@ -373,59 +373,59 @@ discard block |
||
373 | 373 | case 'isnot': |
374 | 374 | case 'isnt': |
375 | 375 | case 'not': |
376 | - $this->condition[] = (int)($value != $opt); |
|
376 | + $this->condition[] = (int) ($value != $opt); |
|
377 | 377 | break; |
378 | 378 | case '%': |
379 | - $this->condition[] = (int)($value % $opt == 0); |
|
379 | + $this->condition[] = (int) ($value % $opt == 0); |
|
380 | 380 | break; |
381 | 381 | case 'isempty': |
382 | - $this->condition[] = (int)(empty($value)); |
|
382 | + $this->condition[] = (int) (empty($value)); |
|
383 | 383 | break; |
384 | 384 | case 'isntempty': |
385 | 385 | case 'isnotempty': |
386 | - $this->condition[] = (int)(!empty($value)); |
|
386 | + $this->condition[] = (int) (!empty($value)); |
|
387 | 387 | break; |
388 | 388 | case '>=': |
389 | 389 | case 'gte': |
390 | 390 | case 'eg': |
391 | 391 | case 'isgte': |
392 | - $this->condition[] = (int)($value >= $opt); |
|
392 | + $this->condition[] = (int) ($value >= $opt); |
|
393 | 393 | break; |
394 | 394 | case '<=': |
395 | 395 | case 'lte': |
396 | 396 | case 'el': |
397 | 397 | case 'islte': |
398 | - $this->condition[] = (int)($value <= $opt); |
|
398 | + $this->condition[] = (int) ($value <= $opt); |
|
399 | 399 | break; |
400 | 400 | case '>': |
401 | 401 | case 'gt': |
402 | 402 | case 'greaterthan': |
403 | 403 | case 'isgreaterthan': |
404 | 404 | case 'isgt': |
405 | - $this->condition[] = (int)($value > $opt); |
|
405 | + $this->condition[] = (int) ($value > $opt); |
|
406 | 406 | break; |
407 | 407 | case '<': |
408 | 408 | case 'lt': |
409 | 409 | case 'lowerthan': |
410 | 410 | case 'islowerthan': |
411 | 411 | case 'islt': |
412 | - $this->condition[] = (int)($value < $opt); |
|
412 | + $this->condition[] = (int) ($value < $opt); |
|
413 | 413 | break; |
414 | 414 | case 'find': |
415 | - $this->condition[] = (int)(strpos($value, $opt) !== false); |
|
415 | + $this->condition[] = (int) (strpos($value, $opt) !== false); |
|
416 | 416 | break; |
417 | 417 | case 'inarray': |
418 | 418 | case 'in_array': |
419 | 419 | case 'in': |
420 | 420 | $opt = explode(',', $opt); |
421 | - $this->condition[] = (int)(in_array($value, $opt) !== false); |
|
421 | + $this->condition[] = (int) (in_array($value, $opt) !== false); |
|
422 | 422 | break; |
423 | 423 | case 'wildcard_match': |
424 | 424 | case 'wcard_match': |
425 | 425 | case 'wildcard': |
426 | 426 | case 'wcard': |
427 | 427 | case 'fnmatch': |
428 | - $this->condition[] = (int)(fnmatch($opt, $value) !== false); |
|
428 | + $this->condition[] = (int) (fnmatch($opt, $value) !== false); |
|
429 | 429 | break; |
430 | 430 | case 'is_file': |
431 | 431 | case 'is_dir': |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | if (strpos($path, $modx->config['base_path']) === false) { |
444 | 444 | $path = ltrim($path, '/'); |
445 | 445 | } |
446 | - $this->condition[] = (int)($cmd($path) !== false); |
|
446 | + $this->condition[] = (int) ($cmd($path) !== false); |
|
447 | 447 | break; |
448 | 448 | case 'is_image': |
449 | 449 | if (!$opt) { |
@@ -456,13 +456,13 @@ discard block |
||
456 | 456 | break; |
457 | 457 | } |
458 | 458 | $_ = getimagesize($path); |
459 | - $this->condition[] = (int)($_[0]); |
|
459 | + $this->condition[] = (int) ($_[0]); |
|
460 | 460 | break; |
461 | 461 | case 'regex': |
462 | 462 | case 'preg': |
463 | 463 | case 'preg_match': |
464 | 464 | case 'isinrole': |
465 | - $this->condition[] = (int)(preg_match($opt, $value)); |
|
465 | + $this->condition[] = (int) (preg_match($opt, $value)); |
|
466 | 466 | break; |
467 | 467 | case 'ir': |
468 | 468 | case 'memberof': |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | case 'show': |
480 | 480 | case 'this': |
481 | 481 | $conditional = implode(' ', $this->condition); |
482 | - $isvalid = (int)(eval("return ({$conditional});")); |
|
482 | + $isvalid = (int) (eval("return ({$conditional});")); |
|
483 | 483 | if ($isvalid) { |
484 | 484 | return $this->srcValue; |
485 | 485 | } |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | return null; |
488 | 488 | case 'then': |
489 | 489 | $conditional = implode(' ', $this->condition); |
490 | - $isvalid = (int)eval("return ({$conditional});"); |
|
490 | + $isvalid = (int) eval("return ({$conditional});"); |
|
491 | 491 | if ($isvalid) { |
492 | 492 | return $opt; |
493 | 493 | } |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | return null; |
496 | 496 | case 'else': |
497 | 497 | $conditional = implode(' ', $this->condition); |
498 | - $isvalid = (int)eval("return ({$conditional});"); |
|
498 | + $isvalid = (int) eval("return ({$conditional});"); |
|
499 | 499 | if (!$isvalid) { |
500 | 500 | return $opt; |
501 | 501 | } |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | return $this->strpos($value, $opt); |
655 | 655 | case 'wordwrap': |
656 | 656 | // default: 70 |
657 | - $wrapat = (int)$opt > 0 ? (int)$opt : 70; |
|
657 | + $wrapat = (int) $opt > 0 ? (int) $opt : 70; |
|
658 | 658 | if (version_compare(PHP_VERSION, '5.3.0') >= 0) { |
659 | 659 | return $this->includeMdfFile('wordwrap'); |
660 | 660 | } else { |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | if (strpos($opt, ',') !== false) { |
687 | 687 | list($b, $e) = explode(',', $opt, 2); |
688 | 688 | |
689 | - return $this->substr($value, $b, (int)$e); |
|
689 | + return $this->substr($value, $b, (int) $e); |
|
690 | 690 | } else { |
691 | 691 | return $this->substr($value, $opt); |
692 | 692 | } |
@@ -705,9 +705,9 @@ discard block |
||
705 | 705 | $str = ''; |
706 | 706 | } |
707 | 707 | if (preg_match('/^[1-9][0-9]*$/', $len)) { |
708 | - return $this->substr($value, 0, $len) . $str; |
|
708 | + return $this->substr($value, 0, $len).$str; |
|
709 | 709 | } elseif (preg_match('/^\-[1-9][0-9]*$/', $len)) { |
710 | - return $str . $this->substr($value, $len); |
|
710 | + return $str.$this->substr($value, $len); |
|
711 | 711 | } |
712 | 712 | break; |
713 | 713 | case 'summary': |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | case 'concatenate': |
773 | 773 | case '.': |
774 | 774 | if ($value !== '') { |
775 | - return $value . $opt; |
|
775 | + return $value.$opt; |
|
776 | 776 | } |
777 | 777 | break; |
778 | 778 | case 'sprintf': |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | case 'money_format': |
791 | 791 | setlocale(LC_MONETARY, setlocale(LC_TIME, 0)); |
792 | 792 | if ($value !== '') { |
793 | - return money_format($opt, (double)$value); |
|
793 | + return money_format($opt, (double) $value); |
|
794 | 794 | } |
795 | 795 | break; |
796 | 796 | case 'tobool': |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | return strtotime($value); |
866 | 866 | ##### mathematical function |
867 | 867 | case 'toint': |
868 | - return (int)$value; |
|
868 | + return (int) $value; |
|
869 | 869 | case 'tofloat': |
870 | 870 | return floatval($value); |
871 | 871 | case 'round': |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | return $cmd($value); |
884 | 884 | case 'math': |
885 | 885 | case 'calc': |
886 | - $value = (int)$value; |
|
886 | + $value = (int) $value; |
|
887 | 887 | if (empty($value)) { |
888 | 888 | $value = '0'; |
889 | 889 | } |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | $where = implode(' AND ', $where); |
1027 | 1027 | $children = $modx->getDocumentChildren($value, $published, '0', 'id', $where); |
1028 | 1028 | $result = array(); |
1029 | - foreach ((array)$children as $child) { |
|
1029 | + foreach ((array) $children as $child) { |
|
1030 | 1030 | $result[] = $child['id']; |
1031 | 1031 | } |
1032 | 1032 | |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | $opt .= '/'; |
1131 | 1131 | } |
1132 | 1132 | |
1133 | - $filename = MODX_BASE_PATH . $opt . $filename; |
|
1133 | + $filename = MODX_BASE_PATH.$opt.$filename; |
|
1134 | 1134 | |
1135 | 1135 | if (is_file($filename)) { |
1136 | 1136 | clearstatcache(); |
@@ -1194,7 +1194,7 @@ discard block |
||
1194 | 1194 | } |
1195 | 1195 | break; |
1196 | 1196 | case 'datagrid': |
1197 | - include_once(MODX_MANAGER_PATH . 'includes/controls/datagrid.class.php'); |
|
1197 | + include_once(MODX_MANAGER_PATH.'includes/controls/datagrid.class.php'); |
|
1198 | 1198 | $grd = new DataGrid(null, trim($value)); |
1199 | 1199 | $grd->itemStyle = ''; |
1200 | 1200 | $grd->altItemStyle = ''; |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | $value = $this->value; |
1293 | 1293 | $opt = $this->opt; |
1294 | 1294 | |
1295 | - return include(MODX_MANAGER_PATH . "includes/extenders/modifiers/mdf_{$cmd}.inc.php"); |
|
1295 | + return include(MODX_MANAGER_PATH."includes/extenders/modifiers/mdf_{$cmd}.inc.php"); |
|
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | public function getValueFromElement($key, $value, $cmd, $opt) |
@@ -1308,13 +1308,13 @@ discard block |
||
1308 | 1308 | $row = $modx->getDatabase()->getRow($result); |
1309 | 1309 | $php = $row['snippet']; |
1310 | 1310 | } elseif ($total == 0) { |
1311 | - $assets_path = MODX_BASE_PATH . 'assets/'; |
|
1312 | - if (is_file($assets_path . "modifiers/mdf_{$cmd}.inc.php")) { |
|
1313 | - $modifiers_path = $assets_path . "modifiers/mdf_{$cmd}.inc.php"; |
|
1314 | - } elseif (is_file($assets_path . "plugins/phx/modifiers/{$cmd}.phx.php")) { |
|
1315 | - $modifiers_path = $assets_path . "plugins/phx/modifiers/{$cmd}.phx.php"; |
|
1316 | - } elseif (is_file(MODX_MANAGER_PATH . "includes/extenders/modifiers/mdf_{$cmd}.inc.php")) { |
|
1317 | - $modifiers_path = MODX_MANAGER_PATH . "includes/extenders/modifiers/mdf_{$cmd}.inc.php"; |
|
1311 | + $assets_path = MODX_BASE_PATH.'assets/'; |
|
1312 | + if (is_file($assets_path."modifiers/mdf_{$cmd}.inc.php")) { |
|
1313 | + $modifiers_path = $assets_path."modifiers/mdf_{$cmd}.inc.php"; |
|
1314 | + } elseif (is_file($assets_path."plugins/phx/modifiers/{$cmd}.phx.php")) { |
|
1315 | + $modifiers_path = $assets_path."plugins/phx/modifiers/{$cmd}.phx.php"; |
|
1316 | + } elseif (is_file(MODX_MANAGER_PATH."includes/extenders/modifiers/mdf_{$cmd}.inc.php")) { |
|
1317 | + $modifiers_path = MODX_MANAGER_PATH."includes/extenders/modifiers/mdf_{$cmd}.inc.php"; |
|
1318 | 1318 | } else { |
1319 | 1319 | $modifiers_path = false; |
1320 | 1320 | } |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | $php = substr($php, 0, -2); |
1333 | 1333 | } |
1334 | 1334 | if ($this->elmName !== '') { |
1335 | - $modx->snippetCache[$this->elmName . 'Props'] = ''; |
|
1335 | + $modx->snippetCache[$this->elmName.'Props'] = ''; |
|
1336 | 1336 | } |
1337 | 1337 | } else { |
1338 | 1338 | $php = false; |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | $custom = eval($php); |
1370 | 1370 | $msg = ob_get_contents(); |
1371 | 1371 | if ($value === $this->bt) { |
1372 | - $value = $msg . $custom; |
|
1372 | + $value = $msg.$custom; |
|
1373 | 1373 | } |
1374 | 1374 | ob_end_clean(); |
1375 | 1375 | } elseif ($html !== false && isset($value) && $value !== '') { |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | public function ucfirst($str) |
1544 | 1544 | { |
1545 | 1545 | if (function_exists('mb_strtoupper')) { |
1546 | - return mb_strtoupper($this->substr($str, 0, 1)) . $this->substr($str, 1, $this->strlen($str)); |
|
1546 | + return mb_strtoupper($this->substr($str, 0, 1)).$this->substr($str, 1, $this->strlen($str)); |
|
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | return ucfirst($str); |
@@ -1552,7 +1552,7 @@ discard block |
||
1552 | 1552 | public function lcfirst($str) |
1553 | 1553 | { |
1554 | 1554 | if (function_exists('mb_strtolower')) { |
1555 | - return mb_strtolower($this->substr($str, 0, 1)) . $this->substr($str, 1, $this->strlen($str)); |
|
1555 | + return mb_strtolower($this->substr($str, 0, 1)).$this->substr($str, 1, $this->strlen($str)); |
|
1556 | 1556 | } |
1557 | 1557 | |
1558 | 1558 | return lcfirst($str); |
@@ -199,7 +199,8 @@ discard block |
||
199 | 199 | $c = substr($modifiers, 0, 1); |
200 | 200 | $modifiers = substr($modifiers, 1); |
201 | 201 | |
202 | - if ($c === ':' && preg_match('@^(!?[<>=]{1,2})@', $modifiers, $match)) { // :=, :!=, :<=, :>=, :!<=, :!>= |
|
202 | + if ($c === ':' && preg_match('@^(!?[<>=]{1,2})@', $modifiers, $match)) { |
|
203 | +// :=, :!=, :<=, :>=, :!<=, :!>= |
|
203 | 204 | $c = substr($modifiers, strlen($match[1]), 1); |
204 | 205 | $debuginfo = "#i=0 #c=[{$c}] #m=[{$modifiers}]"; |
205 | 206 | if ($c === '(') { |
@@ -215,7 +216,8 @@ discard block |
||
215 | 216 | $result[] = array('cmd' => trim($match[1]), 'opt' => $opt, 'debuginfo' => $debuginfo); |
216 | 217 | $cmd = ''; |
217 | 218 | } elseif (in_array($c, array('+', '-', '*', '/')) && preg_match('@^[0-9]+@', $modifiers, |
218 | - $match)) { // :+3, :-3, :*3 ... |
|
219 | + $match)) { |
|
220 | +// :+3, :-3, :*3 ... |
|
219 | 221 | $modifiers = substr($modifiers, strlen($match[0])); |
220 | 222 | $result[] = array('cmd' => 'math', 'opt' => '%s' . $c . $match[0]); |
221 | 223 | $cmd = ''; |