@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * @var array |
9 | 9 | */ |
10 | - public $types = array(); |
|
10 | + public $types = array(); |
|
11 | 11 | /** |
12 | 12 | * @var array |
13 | 13 | */ |
@@ -25,73 +25,73 @@ discard block |
||
25 | 25 | * mgrResources constructor. |
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | - $this->setTypes(); |
|
29 | - $this->queryItemsFromDB(); |
|
30 | - $this->prepareCategoryArrays(); |
|
31 | - } |
|
28 | + $this->setTypes(); |
|
29 | + $this->queryItemsFromDB(); |
|
30 | + $this->prepareCategoryArrays(); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @return void |
35 | 35 | */ |
36 | 36 | public function setTypes() { |
37 | - global $_lang; |
|
38 | - $this->types['site_templates'] = array( |
|
39 | - 'title'=>$_lang["manage_templates"], |
|
40 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
41 | - 'permissions'=>array('new_template','edit_template'), |
|
42 | - 'name'=>'templatename' |
|
43 | - ); |
|
44 | - $this->types['site_tmplvars'] = array( |
|
45 | - 'title'=>$_lang["tmplvars"], |
|
46 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
47 | - 'permissions'=>array('new_template','edit_template'), |
|
48 | - ); |
|
49 | - $this->types['site_htmlsnippets'] = array( |
|
50 | - 'title'=>$_lang["manage_htmlsnippets"], |
|
51 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
52 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
53 | - ); |
|
54 | - $this->types['site_snippets'] = array( |
|
55 | - 'title'=>$_lang["manage_snippets"], |
|
56 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
57 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
58 | - ); |
|
59 | - $this->types['site_plugins'] = array( |
|
60 | - 'title'=>$_lang["manage_plugins"], |
|
61 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
62 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
63 | - ); |
|
64 | - $this->types['site_modules'] = array( |
|
65 | - 'title'=>$_lang["manage_modules"], |
|
66 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
67 | - 'permissions'=>array('new_module','edit_module'), |
|
68 | - ); |
|
69 | - } |
|
37 | + global $_lang; |
|
38 | + $this->types['site_templates'] = array( |
|
39 | + 'title'=>$_lang["manage_templates"], |
|
40 | + 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
41 | + 'permissions'=>array('new_template','edit_template'), |
|
42 | + 'name'=>'templatename' |
|
43 | + ); |
|
44 | + $this->types['site_tmplvars'] = array( |
|
45 | + 'title'=>$_lang["tmplvars"], |
|
46 | + 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
47 | + 'permissions'=>array('new_template','edit_template'), |
|
48 | + ); |
|
49 | + $this->types['site_htmlsnippets'] = array( |
|
50 | + 'title'=>$_lang["manage_htmlsnippets"], |
|
51 | + 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
52 | + 'permissions'=>array('new_chunk','edit_chunk'), |
|
53 | + ); |
|
54 | + $this->types['site_snippets'] = array( |
|
55 | + 'title'=>$_lang["manage_snippets"], |
|
56 | + 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
57 | + 'permissions'=>array('new_snippet','edit_snippet'), |
|
58 | + ); |
|
59 | + $this->types['site_plugins'] = array( |
|
60 | + 'title'=>$_lang["manage_plugins"], |
|
61 | + 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
62 | + 'permissions'=>array('new_plugin','edit_plugin'), |
|
63 | + ); |
|
64 | + $this->types['site_modules'] = array( |
|
65 | + 'title'=>$_lang["manage_modules"], |
|
66 | + 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
67 | + 'permissions'=>array('new_module','edit_module'), |
|
68 | + ); |
|
69 | + } |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | public function queryItemsFromDB() { |
75 | - foreach($this->types as $resourceTable=>$type) { |
|
76 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
77 | - $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
78 | - $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
79 | - } |
|
80 | - } |
|
81 | - } |
|
75 | + foreach($this->types as $resourceTable=>$type) { |
|
76 | + if($this->hasAnyPermissions($type['permissions'])) { |
|
77 | + $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
78 | + $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
79 | + } |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | 83 | /** |
84 | 84 | * @param array $permissions |
85 | 85 | * @return bool |
86 | 86 | */ |
87 | 87 | public function hasAnyPermissions($permissions) { |
88 | - $modx = evolutionCMS(); |
|
88 | + $modx = evolutionCMS(); |
|
89 | 89 | |
90 | - foreach($permissions as $p) |
|
91 | - if($modx->hasPermission($p)) return true; |
|
90 | + foreach($permissions as $p) |
|
91 | + if($modx->hasPermission($p)) return true; |
|
92 | 92 | |
93 | - return false; |
|
94 | - } |
|
93 | + return false; |
|
94 | + } |
|
95 | 95 | |
96 | 96 | /** |
97 | 97 | * @param string $resourceTable |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return array|bool |
100 | 100 | */ |
101 | 101 | public function queryResources($resourceTable, $nameField = 'name') { |
102 | - $modx = evolutionCMS(); global $_lang; |
|
102 | + $modx = evolutionCMS(); global $_lang; |
|
103 | 103 | |
104 | 104 | $allowed = array( |
105 | 105 | 'site_htmlsnippets', |
@@ -107,59 +107,59 @@ discard block |
||
107 | 107 | 'site_plugins', |
108 | 108 | 'site_modules' |
109 | 109 | ); |
110 | - $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
111 | - |
|
112 | - $tvsql = ''; |
|
113 | - $tvjoin = ''; |
|
114 | - if ($resourceTable === 'site_tmplvars') { |
|
115 | - $tvsql = 'site_tmplvars.caption, '; |
|
116 | - $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
117 | - $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
118 | - } |
|
119 | - else $sttfield = ''; |
|
120 | - |
|
121 | - $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
122 | - |
|
123 | - $rs = $modx->db->select( |
|
124 | - "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
|
125 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
110 | + $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
111 | + |
|
112 | + $tvsql = ''; |
|
113 | + $tvjoin = ''; |
|
114 | + if ($resourceTable === 'site_tmplvars') { |
|
115 | + $tvsql = 'site_tmplvars.caption, '; |
|
116 | + $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
117 | + $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
118 | + } |
|
119 | + else $sttfield = ''; |
|
120 | + |
|
121 | + $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
122 | + |
|
123 | + $rs = $modx->db->select( |
|
124 | + "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
|
125 | + $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
126 | 126 | LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
127 | - "", |
|
128 | - "category,name" |
|
129 | - ); |
|
130 | - $limit = $modx->db->getRecordCount($rs); |
|
127 | + "", |
|
128 | + "category,name" |
|
129 | + ); |
|
130 | + $limit = $modx->db->getRecordCount($rs); |
|
131 | 131 | |
132 | - if($limit < 1) return false; |
|
132 | + if($limit < 1) return false; |
|
133 | 133 | |
134 | - $result = array(); |
|
135 | - while ($row = $modx->db->getRow($rs)) { |
|
136 | - $result[] = $row; |
|
137 | - } |
|
138 | - return $result; |
|
139 | - } |
|
134 | + $result = array(); |
|
135 | + while ($row = $modx->db->getRow($rs)) { |
|
136 | + $result[] = $row; |
|
137 | + } |
|
138 | + return $result; |
|
139 | + } |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * @return void |
143 | 143 | */ |
144 | 144 | public function prepareCategoryArrays() { |
145 | - foreach($this->items as $type=>$items) { |
|
146 | - foreach((array)$items as $item) { |
|
147 | - $catid = $item['catid'] ? $item['catid'] : 0; |
|
148 | - $this->categories[$catid] = $item['category']; |
|
149 | - |
|
150 | - $item['type'] = $type; |
|
151 | - $this->itemsPerCategory[$catid][] = $item; |
|
152 | - } |
|
153 | - } |
|
154 | - |
|
155 | - // Sort categories by name |
|
156 | - natcasesort($this->categories); |
|
157 | - |
|
158 | - // Now sort by name |
|
159 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
161 | - return strcasecmp($a['name'], $b['name']); |
|
162 | - }); |
|
163 | - } |
|
164 | - } |
|
145 | + foreach($this->items as $type=>$items) { |
|
146 | + foreach((array)$items as $item) { |
|
147 | + $catid = $item['catid'] ? $item['catid'] : 0; |
|
148 | + $this->categories[$catid] = $item['category']; |
|
149 | + |
|
150 | + $item['type'] = $type; |
|
151 | + $this->itemsPerCategory[$catid][] = $item; |
|
152 | + } |
|
153 | + } |
|
154 | + |
|
155 | + // Sort categories by name |
|
156 | + natcasesort($this->categories); |
|
157 | + |
|
158 | + // Now sort by name |
|
159 | + foreach($this->itemsPerCategory as $catid=>$items) { |
|
160 | + usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
161 | + return strcasecmp($a['name'], $b['name']); |
|
162 | + }); |
|
163 | + } |
|
164 | + } |
|
165 | 165 | } |
@@ -1,9 +1,9 @@ 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 | |
6 | -class mgrResources { |
|
6 | +class mgrResources{ |
|
7 | 7 | /** |
8 | 8 | * @var array |
9 | 9 | */ |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * mgrResources constructor. |
26 | 26 | */ |
27 | - public function __construct() { |
|
27 | + public function __construct(){ |
|
28 | 28 | $this->setTypes(); |
29 | 29 | $this->queryItemsFromDB(); |
30 | 30 | $this->prepareCategoryArrays(); |
@@ -33,47 +33,47 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @return void |
35 | 35 | */ |
36 | - public function setTypes() { |
|
36 | + public function setTypes(){ |
|
37 | 37 | global $_lang; |
38 | - $this->types['site_templates'] = array( |
|
38 | + $this->types['site_templates'] = array( |
|
39 | 39 | 'title'=>$_lang["manage_templates"], |
40 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
41 | - 'permissions'=>array('new_template','edit_template'), |
|
40 | + 'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')), |
|
41 | + 'permissions'=>array('new_template', 'edit_template'), |
|
42 | 42 | 'name'=>'templatename' |
43 | 43 | ); |
44 | - $this->types['site_tmplvars'] = array( |
|
44 | + $this->types['site_tmplvars'] = array( |
|
45 | 45 | 'title'=>$_lang["tmplvars"], |
46 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
47 | - 'permissions'=>array('new_template','edit_template'), |
|
46 | + 'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')), |
|
47 | + 'permissions'=>array('new_template', 'edit_template'), |
|
48 | 48 | ); |
49 | 49 | $this->types['site_htmlsnippets'] = array( |
50 | 50 | 'title'=>$_lang["manage_htmlsnippets"], |
51 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
52 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
51 | + 'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')), |
|
52 | + 'permissions'=>array('new_chunk', 'edit_chunk'), |
|
53 | 53 | ); |
54 | - $this->types['site_snippets'] = array( |
|
54 | + $this->types['site_snippets'] = array( |
|
55 | 55 | 'title'=>$_lang["manage_snippets"], |
56 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
57 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
56 | + 'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')), |
|
57 | + 'permissions'=>array('new_snippet', 'edit_snippet'), |
|
58 | 58 | ); |
59 | - $this->types['site_plugins'] = array( |
|
59 | + $this->types['site_plugins'] = array( |
|
60 | 60 | 'title'=>$_lang["manage_plugins"], |
61 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
62 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
61 | + 'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')), |
|
62 | + 'permissions'=>array('new_plugin', 'edit_plugin'), |
|
63 | 63 | ); |
64 | - $this->types['site_modules'] = array( |
|
64 | + $this->types['site_modules'] = array( |
|
65 | 65 | 'title'=>$_lang["manage_modules"], |
66 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
67 | - 'permissions'=>array('new_module','edit_module'), |
|
66 | + 'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')), |
|
67 | + 'permissions'=>array('new_module', 'edit_module'), |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @return void |
73 | 73 | */ |
74 | - public function queryItemsFromDB() { |
|
75 | - foreach($this->types as $resourceTable=>$type) { |
|
76 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
74 | + public function queryItemsFromDB(){ |
|
75 | + foreach ($this->types as $resourceTable=>$type) { |
|
76 | + if ($this->hasAnyPermissions($type['permissions'])) { |
|
77 | 77 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
78 | 78 | $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
79 | 79 | } |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | * @param array $permissions |
85 | 85 | * @return bool |
86 | 86 | */ |
87 | - public function hasAnyPermissions($permissions) { |
|
87 | + public function hasAnyPermissions($permissions){ |
|
88 | 88 | $modx = evolutionCMS(); |
89 | 89 | |
90 | - foreach($permissions as $p) |
|
91 | - if($modx->hasPermission($p)) return true; |
|
90 | + foreach ($permissions as $p) |
|
91 | + if ($modx->hasPermission($p)) return true; |
|
92 | 92 | |
93 | 93 | return false; |
94 | 94 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $nameField |
99 | 99 | * @return array|bool |
100 | 100 | */ |
101 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
101 | + public function queryResources($resourceTable, $nameField = 'name'){ |
|
102 | 102 | $modx = evolutionCMS(); global $_lang; |
103 | 103 | |
104 | 104 | $allowed = array( |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | 'site_plugins', |
108 | 108 | 'site_modules' |
109 | 109 | ); |
110 | - $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
110 | + $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable.'.disabled, ' : ''; |
|
111 | 111 | |
112 | 112 | $tvsql = ''; |
113 | 113 | $tvjoin = ''; |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | |
123 | 123 | $rs = $modx->db->select( |
124 | 124 | "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
125 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
126 | - LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
125 | + $modx->getFullTableName($resourceTable)." AS {$resourceTable} |
|
126 | + LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
127 | 127 | "", |
128 | 128 | "category,name" |
129 | 129 | ); |
130 | 130 | $limit = $modx->db->getRecordCount($rs); |
131 | 131 | |
132 | - if($limit < 1) return false; |
|
132 | + if ($limit < 1) return false; |
|
133 | 133 | |
134 | 134 | $result = array(); |
135 | 135 | while ($row = $modx->db->getRow($rs)) { |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | /** |
142 | 142 | * @return void |
143 | 143 | */ |
144 | - public function prepareCategoryArrays() { |
|
145 | - foreach($this->items as $type=>$items) { |
|
146 | - foreach((array)$items as $item) { |
|
144 | + public function prepareCategoryArrays(){ |
|
145 | + foreach ($this->items as $type=>$items) { |
|
146 | + foreach ((array) $items as $item) { |
|
147 | 147 | $catid = $item['catid'] ? $item['catid'] : 0; |
148 | 148 | $this->categories[$catid] = $item['category']; |
149 | 149 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | natcasesort($this->categories); |
157 | 157 | |
158 | 158 | // Now sort by name |
159 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
159 | + foreach ($this->itemsPerCategory as $catid=>$items) { |
|
160 | + usort($this->itemsPerCategory[$catid], function($a, $b){ |
|
161 | 161 | return strcasecmp($a['name'], $b['name']); |
162 | 162 | }); |
163 | 163 | } |
@@ -3,7 +3,8 @@ 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 | |
6 | -class mgrResources { |
|
6 | +class mgrResources |
|
7 | +{ |
|
7 | 8 | /** |
8 | 9 | * @var array |
9 | 10 | */ |
@@ -24,7 +25,8 @@ discard block |
||
24 | 25 | /** |
25 | 26 | * mgrResources constructor. |
26 | 27 | */ |
27 | - public function __construct() { |
|
28 | + public function __construct() |
|
29 | + { |
|
28 | 30 | $this->setTypes(); |
29 | 31 | $this->queryItemsFromDB(); |
30 | 32 | $this->prepareCategoryArrays(); |
@@ -33,7 +35,8 @@ discard block |
||
33 | 35 | /** |
34 | 36 | * @return void |
35 | 37 | */ |
36 | - public function setTypes() { |
|
38 | + public function setTypes() |
|
39 | + { |
|
37 | 40 | global $_lang; |
38 | 41 | $this->types['site_templates'] = array( |
39 | 42 | 'title'=>$_lang["manage_templates"], |
@@ -71,7 +74,8 @@ discard block |
||
71 | 74 | /** |
72 | 75 | * @return void |
73 | 76 | */ |
74 | - public function queryItemsFromDB() { |
|
77 | + public function queryItemsFromDB() |
|
78 | + { |
|
75 | 79 | foreach($this->types as $resourceTable=>$type) { |
76 | 80 | if($this->hasAnyPermissions($type['permissions'])) { |
77 | 81 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
@@ -84,11 +88,13 @@ discard block |
||
84 | 88 | * @param array $permissions |
85 | 89 | * @return bool |
86 | 90 | */ |
87 | - public function hasAnyPermissions($permissions) { |
|
91 | + public function hasAnyPermissions($permissions) |
|
92 | + { |
|
88 | 93 | $modx = evolutionCMS(); |
89 | 94 | |
90 | - foreach($permissions as $p) |
|
91 | - if($modx->hasPermission($p)) return true; |
|
95 | + foreach($permissions as $p) { |
|
96 | + if($modx->hasPermission($p)) return true; |
|
97 | + } |
|
92 | 98 | |
93 | 99 | return false; |
94 | 100 | } |
@@ -98,7 +104,8 @@ discard block |
||
98 | 104 | * @param string $nameField |
99 | 105 | * @return array|bool |
100 | 106 | */ |
101 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
107 | + public function queryResources($resourceTable, $nameField = 'name') |
|
108 | + { |
|
102 | 109 | $modx = evolutionCMS(); global $_lang; |
103 | 110 | |
104 | 111 | $allowed = array( |
@@ -115,8 +122,9 @@ discard block |
||
115 | 122 | $tvsql = 'site_tmplvars.caption, '; |
116 | 123 | $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
117 | 124 | $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
125 | + } else { |
|
126 | + $sttfield = ''; |
|
118 | 127 | } |
119 | - else $sttfield = ''; |
|
120 | 128 | |
121 | 129 | $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
122 | 130 | |
@@ -129,7 +137,9 @@ discard block |
||
129 | 137 | ); |
130 | 138 | $limit = $modx->db->getRecordCount($rs); |
131 | 139 | |
132 | - if($limit < 1) return false; |
|
140 | + if($limit < 1) { |
|
141 | + return false; |
|
142 | + } |
|
133 | 143 | |
134 | 144 | $result = array(); |
135 | 145 | while ($row = $modx->db->getRow($rs)) { |
@@ -141,7 +151,8 @@ discard block |
||
141 | 151 | /** |
142 | 152 | * @return void |
143 | 153 | */ |
144 | - public function prepareCategoryArrays() { |
|
154 | + public function prepareCategoryArrays() |
|
155 | + { |
|
145 | 156 | foreach($this->items as $type=>$items) { |
146 | 157 | foreach((array)$items as $item) { |
147 | 158 | $catid = $item['catid'] ? $item['catid'] : 0; |
@@ -157,7 +168,7 @@ discard block |
||
157 | 168 | |
158 | 169 | // Now sort by name |
159 | 170 | foreach($this->itemsPerCategory as $catid=>$items) { |
160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
171 | + usort($this->itemsPerCategory[$catid], function ($a, $b){ |
|
161 | 172 | return strcasecmp($a['name'], $b['name']); |
162 | 173 | }); |
163 | 174 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | $modx->getSettings(); |
6 | 6 | $modx->invokeEvent('OnWebPageInit'); |
7 | 7 | |
8 | -$vword = new VeriWord(148,60); |
|
8 | +$vword = new VeriWord(148, 60); |
|
9 | 9 | $vword->output_image(); |
10 | 10 | $vword->destroy_image(); |
11 | 11 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ## see sample.php for test and usage |
42 | 42 | ## sample URL: http://www.program-ruti.org/veriword/ |
43 | 43 | #### |
44 | -class VeriWord { |
|
44 | +class VeriWord{ |
|
45 | 45 | |
46 | 46 | /* path to font directory*/ |
47 | 47 | public $dir_font = "ttf/"; |
@@ -52,44 +52,44 @@ discard block |
||
52 | 52 | public $im_height = 0; |
53 | 53 | public $im; |
54 | 54 | |
55 | - public function __construct($w=200, $h=80) { |
|
55 | + public function __construct($w = 200, $h = 80){ |
|
56 | 56 | /* create session to set word for verification */ |
57 | 57 | $this->set_veriword(); |
58 | - $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font; |
|
58 | + $this->dir_font = dirname(__FILE__).'/'.$this->dir_font; |
|
59 | 59 | $this->im_width = $w; |
60 | 60 | $this->im_height = $h; |
61 | 61 | } |
62 | 62 | |
63 | - public function set_veriword() { |
|
63 | + public function set_veriword(){ |
|
64 | 64 | /* create session variable for verification, |
65 | 65 | you may change the session variable name */ |
66 | 66 | $this->word = $this->pick_word(); |
67 | 67 | $_SESSION['veriword'] = $this->word; |
68 | 68 | } |
69 | 69 | |
70 | - public function output_image() { |
|
70 | + public function output_image(){ |
|
71 | 71 | /* output the image as jpeg */ |
72 | 72 | $this->draw_image(); |
73 | 73 | header("Content-type: image/jpeg"); |
74 | 74 | imagejpeg($this->im); |
75 | 75 | } |
76 | 76 | |
77 | - public function pick_word() { |
|
77 | + public function pick_word(){ |
|
78 | 78 | $modx = evolutionCMS(); |
79 | 79 | // set default words |
80 | - $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
|
80 | + $words = "MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
|
81 | 81 | $words = $modx->config['captcha_words'] ? $modx->config['captcha_words'] : $words; |
82 | 82 | $arr_words = array_filter(array_map('trim', explode(',', $words))); |
83 | 83 | |
84 | 84 | /* pick one randomly for text verification */ |
85 | - return (string) $arr_words[array_rand($arr_words)].rand(10,999); |
|
85 | + return (string) $arr_words[array_rand($arr_words)].rand(10, 999); |
|
86 | 86 | } |
87 | 87 | |
88 | - public function draw_text() { |
|
88 | + public function draw_text(){ |
|
89 | 89 | $dir = dir($this->dir_font); |
90 | 90 | $fontstmp = array(); |
91 | 91 | while (false !== ($file = $dir->read())) { |
92 | - if(substr($file, -4) == '.ttf') { |
|
92 | + if (substr($file, -4) == '.ttf') { |
|
93 | 93 | $fontstmp[] = $this->dir_font.$file; |
94 | 94 | } |
95 | 95 | } |
@@ -97,35 +97,35 @@ discard block |
||
97 | 97 | $text_font = (string) $fontstmp[array_rand($fontstmp)]; |
98 | 98 | |
99 | 99 | /* angle for text inclination */ |
100 | - $text_angle = rand(-9,9); |
|
100 | + $text_angle = rand(-9, 9); |
|
101 | 101 | /* initial text size */ |
102 | 102 | $text_size = 30; |
103 | 103 | /* calculate text width and height */ |
104 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
105 | - $text_width = $box[2]-$box[0]; //text width |
|
106 | - $text_height= $box[5]-$box[3]; //text height |
|
104 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
105 | + $text_width = $box[2] - $box[0]; //text width |
|
106 | + $text_height = $box[5] - $box[3]; //text height |
|
107 | 107 | |
108 | 108 | /* adjust text size */ |
109 | - $text_size = round((20 * $this->im_width)/$text_width); |
|
109 | + $text_size = round((20 * $this->im_width) / $text_width); |
|
110 | 110 | |
111 | 111 | /* recalculate text width and height */ |
112 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
113 | - $text_width = $box[2]-$box[0]; //text width |
|
114 | - $text_height= $box[5]-$box[3]; //text height |
|
112 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
113 | + $text_width = $box[2] - $box[0]; //text width |
|
114 | + $text_height = $box[5] - $box[3]; //text height |
|
115 | 115 | |
116 | 116 | /* calculate center position of text */ |
117 | - $text_x = ($this->im_width - $text_width)/2; |
|
118 | - $text_y = ($this->im_height - $text_height)/2; |
|
117 | + $text_x = ($this->im_width - $text_width) / 2; |
|
118 | + $text_y = ($this->im_height - $text_height) / 2; |
|
119 | 119 | |
120 | 120 | /* create canvas for text drawing */ |
121 | - $im_text = imagecreate ($this->im_width, $this->im_height); |
|
122 | - $bg_color = imagecolorallocate ($im_text, 255, 255, 255); |
|
121 | + $im_text = imagecreate($this->im_width, $this->im_height); |
|
122 | + $bg_color = imagecolorallocate($im_text, 255, 255, 255); |
|
123 | 123 | |
124 | 124 | /* pick color for text */ |
125 | - $text_color = imagecolorallocate ($im_text, 0, 51, 153); |
|
125 | + $text_color = imagecolorallocate($im_text, 0, 51, 153); |
|
126 | 126 | |
127 | 127 | /* draw text into canvas */ |
128 | - imagettftext ( $im_text, |
|
128 | + imagettftext($im_text, |
|
129 | 129 | $text_size, |
130 | 130 | $text_angle, |
131 | 131 | $text_x, |
@@ -140,19 +140,19 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - public function draw_image() { |
|
143 | + public function draw_image(){ |
|
144 | 144 | |
145 | 145 | /* pick one background image randomly from image directory */ |
146 | - $img_file = $this->dir_noise."noise".rand(1,4).".jpg"; |
|
146 | + $img_file = $this->dir_noise."noise".rand(1, 4).".jpg"; |
|
147 | 147 | |
148 | 148 | /* create "noise" background image from your image stock*/ |
149 | - $noise_img = @imagecreatefromjpeg ($img_file); |
|
149 | + $noise_img = @imagecreatefromjpeg($img_file); |
|
150 | 150 | $noise_width = imagesx($noise_img); |
151 | 151 | $noise_height = imagesy($noise_img); |
152 | 152 | |
153 | 153 | /* resize the background image to fit the size of image output */ |
154 | - $this->im = imagecreatetruecolor($this->im_width,$this->im_height); |
|
155 | - imagecopyresampled ($this->im, |
|
154 | + $this->im = imagecreatetruecolor($this->im_width, $this->im_height); |
|
155 | + imagecopyresampled($this->im, |
|
156 | 156 | $noise_img, |
157 | 157 | 0, 0, 0, 0, |
158 | 158 | $this->im_width, |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | $noise_height); |
162 | 162 | |
163 | 163 | /* put text image into background image */ |
164 | - imagecopymerge ( $this->im, |
|
164 | + imagecopymerge($this->im, |
|
165 | 165 | $this->draw_text(), |
166 | 166 | 0, 0, 0, 0, |
167 | 167 | $this->im_width, |
168 | 168 | $this->im_height, |
169 | - 70 ); |
|
169 | + 70); |
|
170 | 170 | |
171 | 171 | return $this->im; |
172 | 172 | } |
173 | 173 | |
174 | - public function destroy_image() { |
|
174 | + public function destroy_image(){ |
|
175 | 175 | |
176 | 176 | imagedestroy($this->im); |
177 | 177 |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | ## see sample.php for test and usage |
42 | 42 | ## sample URL: http://www.program-ruti.org/veriword/ |
43 | 43 | #### |
44 | -class VeriWord { |
|
44 | +class VeriWord |
|
45 | +{ |
|
45 | 46 | |
46 | 47 | /* path to font directory*/ |
47 | 48 | public $dir_font = "ttf/"; |
@@ -52,7 +53,8 @@ discard block |
||
52 | 53 | public $im_height = 0; |
53 | 54 | public $im; |
54 | 55 | |
55 | - public function __construct($w=200, $h=80) { |
|
56 | + public function __construct($w=200, $h=80) |
|
57 | + { |
|
56 | 58 | /* create session to set word for verification */ |
57 | 59 | $this->set_veriword(); |
58 | 60 | $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font; |
@@ -60,21 +62,24 @@ discard block |
||
60 | 62 | $this->im_height = $h; |
61 | 63 | } |
62 | 64 | |
63 | - public function set_veriword() { |
|
65 | + public function set_veriword() |
|
66 | + { |
|
64 | 67 | /* create session variable for verification, |
65 | 68 | you may change the session variable name */ |
66 | 69 | $this->word = $this->pick_word(); |
67 | 70 | $_SESSION['veriword'] = $this->word; |
68 | 71 | } |
69 | 72 | |
70 | - public function output_image() { |
|
73 | + public function output_image() |
|
74 | + { |
|
71 | 75 | /* output the image as jpeg */ |
72 | 76 | $this->draw_image(); |
73 | 77 | header("Content-type: image/jpeg"); |
74 | 78 | imagejpeg($this->im); |
75 | 79 | } |
76 | 80 | |
77 | - public function pick_word() { |
|
81 | + public function pick_word() |
|
82 | + { |
|
78 | 83 | $modx = evolutionCMS(); |
79 | 84 | // set default words |
80 | 85 | $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
@@ -85,7 +90,8 @@ discard block |
||
85 | 90 | return (string) $arr_words[array_rand($arr_words)].rand(10,999); |
86 | 91 | } |
87 | 92 | |
88 | - public function draw_text() { |
|
93 | + public function draw_text() |
|
94 | + { |
|
89 | 95 | $dir = dir($this->dir_font); |
90 | 96 | $fontstmp = array(); |
91 | 97 | while (false !== ($file = $dir->read())) { |
@@ -140,7 +146,8 @@ discard block |
||
140 | 146 | } |
141 | 147 | |
142 | 148 | |
143 | - public function draw_image() { |
|
149 | + public function draw_image() |
|
150 | + { |
|
144 | 151 | |
145 | 152 | /* pick one background image randomly from image directory */ |
146 | 153 | $img_file = $this->dir_noise."noise".rand(1,4).".jpg"; |
@@ -171,7 +178,8 @@ discard block |
||
171 | 178 | return $this->im; |
172 | 179 | } |
173 | 180 | |
174 | - public function destroy_image() { |
|
181 | + public function destroy_image() |
|
182 | + { |
|
175 | 183 | |
176 | 184 | imagedestroy($this->im); |
177 | 185 |
@@ -144,33 +144,33 @@ discard block |
||
144 | 144 | $algorithm = 'UNCRYPT'; |
145 | 145 | } |
146 | 146 | |
147 | - $salt = md5($password . $seed); |
|
147 | + $salt = md5($password.$seed); |
|
148 | 148 | |
149 | 149 | switch ($algorithm) { |
150 | 150 | case 'BLOWFISH_Y': |
151 | - $salt = '$2y$07$' . substr($salt, 0, 22); |
|
151 | + $salt = '$2y$07$'.substr($salt, 0, 22); |
|
152 | 152 | break; |
153 | 153 | case 'BLOWFISH_A': |
154 | - $salt = '$2a$07$' . substr($salt, 0, 22); |
|
154 | + $salt = '$2a$07$'.substr($salt, 0, 22); |
|
155 | 155 | break; |
156 | 156 | case 'SHA512': |
157 | - $salt = '$6$' . substr($salt, 0, 16); |
|
157 | + $salt = '$6$'.substr($salt, 0, 16); |
|
158 | 158 | break; |
159 | 159 | case 'SHA256': |
160 | - $salt = '$5$' . substr($salt, 0, 16); |
|
160 | + $salt = '$5$'.substr($salt, 0, 16); |
|
161 | 161 | break; |
162 | 162 | case 'MD5': |
163 | - $salt = '$1$' . substr($salt, 0, 8); |
|
163 | + $salt = '$1$'.substr($salt, 0, 8); |
|
164 | 164 | break; |
165 | 165 | } |
166 | 166 | |
167 | 167 | if ($algorithm !== 'UNCRYPT') { |
168 | - $password = sha1($password) . crypt($password, $salt); |
|
168 | + $password = sha1($password).crypt($password, $salt); |
|
169 | 169 | } else { |
170 | - $password = sha1($salt . $password); |
|
170 | + $password = sha1($salt.$password); |
|
171 | 171 | } |
172 | 172 | |
173 | - $result = strtolower($algorithm) . '>' . md5($salt . $password) . substr(md5($salt), 0, 8); |
|
173 | + $result = strtolower($algorithm).'>'.md5($salt.$password).substr(md5($salt), 0, 8); |
|
174 | 174 | |
175 | 175 | return $result; |
176 | 176 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $check_files = explode("\n", $check_files); |
253 | 253 | foreach ($check_files as $file) { |
254 | 254 | $file = trim($file); |
255 | - $file = MODX_BASE_PATH . $file; |
|
255 | + $file = MODX_BASE_PATH.$file; |
|
256 | 256 | if (!is_file($file)) { |
257 | 257 | continue; |
258 | 258 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $checksum = unserialize($checksum); |
276 | 276 | foreach ($check_files as $file) { |
277 | 277 | $file = trim($file); |
278 | - $filePath = MODX_BASE_PATH . $file; |
|
278 | + $filePath = MODX_BASE_PATH.$file; |
|
279 | 279 | if (!is_file($filePath)) { |
280 | 280 | continue; |
281 | 281 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | { |
295 | 295 | $modx = evolutionCMS(); |
296 | 296 | $tbl_system_settings = $modx->getFullTableName('system_settings'); |
297 | - $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','" . $modx->db->escape($checksum) . "')"; |
|
297 | + $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','".$modx->db->escape($checksum)."')"; |
|
298 | 298 | $modx->db->query($sql); |
299 | 299 | } |
300 | 300 | |
@@ -371,10 +371,10 @@ discard block |
||
371 | 371 | foreach ($settings as $key => $val) { |
372 | 372 | $f = array(); |
373 | 373 | $f['user'] = $_SESSION['mgrInternalKey']; |
374 | - $f['setting_name'] = '_LAST_' . $key; |
|
374 | + $f['setting_name'] = '_LAST_'.$key; |
|
375 | 375 | $f['setting_value'] = $val; |
376 | 376 | $f = $modx->db->escape($f); |
377 | - $f = "(`" . implode("`, `", array_keys($f)) . "`) VALUES('" . implode("', '", array_values($f)) . "')"; |
|
377 | + $f = "(`".implode("`, `", array_keys($f))."`) VALUES('".implode("', '", array_values($f))."')"; |
|
378 | 378 | $f .= " ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)"; |
379 | 379 | $modx->db->insert($f, $modx->getFullTableName('user_settings')); |
380 | 380 | } |
@@ -116,7 +116,8 @@ discard block |
||
116 | 116 | * @return string |
117 | 117 | */ |
118 | 118 | public function getHashType($db_value = '') |
119 | - { // md5 | v1 | phpass |
|
119 | + { |
|
120 | +// md5 | v1 | phpass |
|
120 | 121 | $c = substr($db_value, 0, 1); |
121 | 122 | if ($c === '$') { |
122 | 123 | return 'phpass'; |
@@ -135,7 +136,8 @@ discard block |
||
135 | 136 | * @return string |
136 | 137 | */ |
137 | 138 | public function genV1Hash($password, $seed = '1') |
138 | - { // $seed is user_id basically |
|
139 | + { |
|
140 | +// $seed is user_id basically |
|
139 | 141 | $modx = evolutionCMS(); |
140 | 142 | |
141 | 143 | if (isset($modx->config['pwd_hash_algo']) && !empty($modx->config['pwd_hash_algo'])) { |
@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | $action = "", |
37 | 37 | $itemid = "", |
38 | 38 | $itemname = "" |
39 | - ) { |
|
39 | + ){ |
|
40 | 40 | $modx = evolutionCMS(); |
41 | 41 | $this->entry['msg'] = $msg; // writes testmessage to the object |
42 | - $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
42 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
43 | 43 | |
44 | 44 | // User Credentials |
45 | 45 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
46 | 46 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
47 | 47 | |
48 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
48 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
49 | 49 | if ($this->entry['itemId'] == 0) { |
50 | 50 | $this->entry['itemId'] = "-"; |
51 | 51 | } // to stop items having id 0 |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | $fields['message'] = $modx->db->escape($this->entry['msg']); |
94 | 94 | $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
95 | 95 | if (!$insert_id) { |
96 | - $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->db->getLastError()); |
|
96 | + $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
|
97 | 97 | } else { |
98 | - $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000; |
|
99 | - $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100; |
|
98 | + $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000; |
|
99 | + $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100; |
|
100 | 100 | if (($insert_id % $trim) === 0) { |
101 | 101 | $modx->rotate_log('manager_log', $limit, $trim); |
102 | 102 | } |
@@ -729,7 +729,8 @@ discard block |
||
729 | 729 | } |
730 | 730 | |
731 | 731 | if (preg_match('@^[1-9][0-9]*$@', |
732 | - $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
|
732 | + $q) && !isset($this->documentListing[$q])) { |
|
733 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
733 | 734 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
734 | 735 | if ($this->config['use_alias_path'] == 1) { |
735 | 736 | if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, |
@@ -738,7 +739,8 @@ discard block |
||
738 | 739 | $this->documentMethod = 'id'; |
739 | 740 | |
740 | 741 | return $q; |
741 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
742 | + } else { |
|
743 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
742 | 744 | $this->documentMethod = 'alias'; |
743 | 745 | |
744 | 746 | return $q; |
@@ -748,7 +750,8 @@ discard block |
||
748 | 750 | |
749 | 751 | return $q; |
750 | 752 | } |
751 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
753 | + } else { |
|
754 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
752 | 755 | if ($this->config['friendly_alias_urls'] != 1) { |
753 | 756 | $q = $qOrig; |
754 | 757 | } |
@@ -1278,7 +1281,8 @@ discard block |
||
1278 | 1281 | } |
1279 | 1282 | } |
1280 | 1283 | |
1281 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
1284 | + if (!in_array($fetch, $tags)) { |
|
1285 | +// Avoid double Matches |
|
1282 | 1286 | $tags[] = $fetch; // Fetch |
1283 | 1287 | }; |
1284 | 1288 | $fetch = ''; // and reset |
@@ -2089,7 +2093,8 @@ discard block |
||
2089 | 2093 | * @return mixed|string |
2090 | 2094 | */ |
2091 | 2095 | public function _getSGVar($value) |
2092 | - { // Get super globals |
|
2096 | + { |
|
2097 | +// Get super globals |
|
2093 | 2098 | $key = $value; |
2094 | 2099 | $_ = $this->config['enable_filter']; |
2095 | 2100 | $this->config['enable_filter'] = 1; |
@@ -2510,7 +2515,8 @@ discard block |
||
2510 | 2515 | if ($this->config['friendly_urls'] == 1) { |
2511 | 2516 | $aliases = array(); |
2512 | 2517 | if (is_array($this->documentListing)) { |
2513 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
2518 | + foreach ($this->documentListing as $path => $docid) { |
|
2519 | +// This is big Loop on large site! |
|
2514 | 2520 | $aliases[$docid] = $path; |
2515 | 2521 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
2516 | 2522 | } |
@@ -2545,7 +2551,7 @@ discard block |
||
2545 | 2551 | $pref = $this->config['friendly_url_prefix']; |
2546 | 2552 | $suff = $this->config['friendly_url_suffix']; |
2547 | 2553 | $documentSource = preg_replace_callback($in, |
2548 | - function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2554 | + function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
2549 | 2555 | $modx = evolutionCMS(); |
2550 | 2556 | $thealias = $aliases[$m[1]]; |
2551 | 2557 | $thefolder = $isfolder[$m[1]]; |
@@ -4387,7 +4393,8 @@ discard block |
||
4387 | 4393 | if (isset ($this->snippetCache[$snippetName])) { |
4388 | 4394 | $snippet = $this->snippetCache[$snippetName]; |
4389 | 4395 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
4390 | - } else { // not in cache so let's check the db |
|
4396 | + } else { |
|
4397 | +// not in cache so let's check the db |
|
4391 | 4398 | $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
4392 | 4399 | $result = $this->db->query($sql); |
4393 | 4400 | if ($this->db->getRecordCount($result) == 1) { |
@@ -5426,12 +5433,16 @@ discard block |
||
5426 | 5433 | return ''; |
5427 | 5434 | } // nothing to register |
5428 | 5435 | if (!is_array($options)) { |
5429 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
5436 | + if (is_bool($options)) { |
|
5437 | + // backward compatibility with old plaintext parameter |
|
5430 | 5438 | { |
5431 | 5439 | $options = array('plaintext' => $options); |
5432 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
5440 | + } |
|
5441 | + } elseif (is_string($options)) { |
|
5442 | + // Also allow script name as 2nd param |
|
5433 | 5443 | { |
5434 | 5444 | $options = array('name' => $options); |
5445 | + } |
|
5435 | 5446 | } else { |
5436 | 5447 | $options = array(); |
5437 | 5448 | } |
@@ -5443,7 +5454,8 @@ discard block |
||
5443 | 5454 | unset($overwritepos); // probably unnecessary--just making sure |
5444 | 5455 | |
5445 | 5456 | $useThisVer = true; |
5446 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
5457 | + if (isset($this->loadedjscripts[$key])) { |
|
5458 | +// a matching script was found |
|
5447 | 5459 | // if existing script is a startup script, make sure the candidate is also a startup script |
5448 | 5460 | if ($this->loadedjscripts[$key]['startup']) { |
5449 | 5461 | $startup = true; |
@@ -5463,7 +5475,8 @@ discard block |
||
5463 | 5475 | // overwrite the old script (the position may be important for dependent scripts) |
5464 | 5476 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
5465 | 5477 | } |
5466 | - } else { // Use the original version |
|
5478 | + } else { |
|
5479 | +// Use the original version |
|
5467 | 5480 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
5468 | 5481 | // need to move the exisiting script to the head |
5469 | 5482 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5591,7 +5604,8 @@ discard block |
||
5591 | 5604 | } |
5592 | 5605 | |
5593 | 5606 | $results = null; |
5594 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
5607 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
5608 | +// start for loop |
|
5595 | 5609 | if ($this->dumpPlugins) { |
5596 | 5610 | $eventtime = $this->getMicroTime(); |
5597 | 5611 | } |
@@ -6161,7 +6175,8 @@ discard block |
||
6161 | 6175 | * @return bool |
6162 | 6176 | */ |
6163 | 6177 | public function isSafeCode($phpcode = '', $safe_functions = '') |
6164 | - { // return true or false |
|
6178 | + { |
|
6179 | +// return true or false |
|
6165 | 6180 | if ($safe_functions == '') { |
6166 | 6181 | return false; |
6167 | 6182 | } |
@@ -6599,7 +6614,7 @@ discard block |
||
6599 | 6614 | $args = array_pad(array(), $_, '$var'); |
6600 | 6615 | $args = implode(", ", $args); |
6601 | 6616 | $modx = &$this; |
6602 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6617 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
6603 | 6618 | $arg = $val['args'][$tmp - 1]; |
6604 | 6619 | switch (true) { |
6605 | 6620 | case is_null($arg): { |
@@ -2399,11 +2399,11 @@ discard block |
||
2399 | 2399 | if (isset($this->snippetCache[$snip_name])) { |
2400 | 2400 | $snippetObject['name'] = $snip_name; |
2401 | 2401 | $snippetObject['content'] = $this->snippetCache[$snip_name]; |
2402 | - if (isset($this->snippetCache["{$snip_name}Props"])) { |
|
2403 | - if (!isset($this->snippetCache["{$snip_name}Props"])) { |
|
2404 | - $this->snippetCache["{$snip_name}Props"] = ''; |
|
2402 | + if (isset($this->snippetCache["{$snip_name}props"])) { |
|
2403 | + if (!isset($this->snippetCache["{$snip_name}props"])) { |
|
2404 | + $this->snippetCache["{$snip_name}props"] = ''; |
|
2405 | 2405 | } |
2406 | - $snippetObject['properties'] = $this->snippetCache["{$snip_name}Props"]; |
|
2406 | + $snippetObject['properties'] = $this->snippetCache["{$snip_name}props"]; |
|
2407 | 2407 | } |
2408 | 2408 | } elseif (substr($snip_name, 0, 1) === '@' && isset($this->pluginEvent[trim($snip_name, '@')])) { |
2409 | 2409 | $snippetObject['name'] = trim($snip_name, '@'); |
@@ -2429,7 +2429,7 @@ discard block |
||
2429 | 2429 | $snippetObject['content'] = $snip_content; |
2430 | 2430 | $snippetObject['properties'] = $snip_prop; |
2431 | 2431 | $this->snippetCache[$snip_name] = $snip_content; |
2432 | - $this->snippetCache["{$snip_name}Props"] = $snip_prop; |
|
2432 | + $this->snippetCache["{$snip_name}props"] = $snip_prop; |
|
2433 | 2433 | } |
2434 | 2434 | |
2435 | 2435 | return $snippetObject; |
@@ -3774,7 +3774,7 @@ discard block |
||
3774 | 3774 | } |
3775 | 3775 | // build query |
3776 | 3776 | $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
3777 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3777 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3778 | 3778 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", |
3779 | 3779 | "{$sort} {$dir}"); |
3780 | 3780 | $resourceArray = $this->db->makeArray($result); |
@@ -3817,7 +3817,7 @@ discard block |
||
3817 | 3817 | } |
3818 | 3818 | // build query |
3819 | 3819 | $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
3820 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3820 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3821 | 3821 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", |
3822 | 3822 | "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3823 | 3823 | $resourceArray = $this->db->makeArray($result); |
@@ -3882,7 +3882,7 @@ discard block |
||
3882 | 3882 | $tblsc = $this->getFullTableName('site_content'); |
3883 | 3883 | $tbldg = $this->getFullTableName('document_groups'); |
3884 | 3884 | |
3885 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3885 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3886 | 3886 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", |
3887 | 3887 | "sc.parent = '{$parentid}' {$published} {$deleted} {$where} AND ({$access}) GROUP BY sc.id", |
3888 | 3888 | ($sort ? "{$sort} {$dir}" : ""), $limit); |
@@ -3959,7 +3959,7 @@ discard block |
||
3959 | 3959 | $tblsc = $this->getFullTableName('site_content'); |
3960 | 3960 | $tbldg = $this->getFullTableName('document_groups'); |
3961 | 3961 | |
3962 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3962 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3963 | 3963 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', |
3964 | 3964 | $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", |
3965 | 3965 | ($sort ? "{$sort} {$dir}" : ""), $limit); |
@@ -4561,7 +4561,7 @@ discard block |
||
4561 | 4561 | $template = $doc['content']; |
4562 | 4562 | break; |
4563 | 4563 | case 'SELECT': |
4564 | - $this->db->getValue($this->db->query("SELECT {$template}")); |
|
4564 | + $this->db->getValue($this->db->query("select {$template}")); |
|
4565 | 4565 | break; |
4566 | 4566 | default: |
4567 | 4567 | if (!($template = $this->getChunk($tpl))) { |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php" |
281 | 281 | * $extname - extension name in lowercase |
282 | 282 | * |
283 | - * @param $extname |
|
283 | + * @param string $extname |
|
284 | 284 | * @param bool $reload |
285 | 285 | * @return bool |
286 | 286 | */ |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * @param int $count_attempts |
326 | 326 | * @param string $type $type |
327 | 327 | * @param string $responseCode |
328 | - * @return bool|null |
|
328 | + * @return false|null |
|
329 | 329 | * @global string $base_url |
330 | 330 | * @global string $site_url |
331 | 331 | */ |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | /** |
1045 | - * @param $contents |
|
1045 | + * @param string $contents |
|
1046 | 1046 | * @return mixed |
1047 | 1047 | */ |
1048 | 1048 | public function RecoveryEscapedTags($contents) |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | /** |
1071 | - * @param $tstart |
|
1071 | + * @param double $tstart |
|
1072 | 1072 | * @return array |
1073 | 1073 | */ |
1074 | 1074 | public function getTimerStats($tstart) |
@@ -1851,7 +1851,7 @@ discard block |
||
1851 | 1851 | |
1852 | 1852 | /** |
1853 | 1853 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
1854 | - * @param $content |
|
1854 | + * @param string $content |
|
1855 | 1855 | * @param string $left |
1856 | 1856 | * @param string $right |
1857 | 1857 | * @return mixed |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | /** |
2030 | 2030 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
2031 | 2031 | * |
2032 | - * @param $content |
|
2032 | + * @param string $content |
|
2033 | 2033 | * @return string |
2034 | 2034 | * @internal param string $documentSource |
2035 | 2035 | */ |
@@ -3098,7 +3098,7 @@ discard block |
||
3098 | 3098 | |
3099 | 3099 | /** |
3100 | 3100 | * @param $templateID |
3101 | - * @return mixed |
|
3101 | + * @return string |
|
3102 | 3102 | */ |
3103 | 3103 | public function _getTemplateCodeFromDB($templateID) |
3104 | 3104 | { |
@@ -3142,7 +3142,7 @@ discard block |
||
3142 | 3142 | /** |
3143 | 3143 | * @param $id |
3144 | 3144 | * @param int $top |
3145 | - * @return mixed |
|
3145 | + * @return string |
|
3146 | 3146 | */ |
3147 | 3147 | public function getUltimateParentId($id, $top = 0) |
3148 | 3148 | { |
@@ -3482,7 +3482,7 @@ discard block |
||
3482 | 3482 | * |
3483 | 3483 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3484 | 3484 | * @param int $id Element- / Resource-id |
3485 | - * @return bool |
|
3485 | + * @return false|null |
|
3486 | 3486 | */ |
3487 | 3487 | public function lockElement($type, $id) |
3488 | 3488 | { |
@@ -3505,7 +3505,7 @@ discard block |
||
3505 | 3505 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3506 | 3506 | * @param int $id Element- / Resource-id |
3507 | 3507 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
3508 | - * @return bool |
|
3508 | + * @return false|null |
|
3509 | 3509 | */ |
3510 | 3510 | public function unlockElement($type, $id, $includeAllUsers = false) |
3511 | 3511 | { |
@@ -3616,7 +3616,7 @@ discard block |
||
3616 | 3616 | * @param array $params |
3617 | 3617 | * @param string $msg |
3618 | 3618 | * @param array $files |
3619 | - * @return mixed |
|
3619 | + * @return boolean |
|
3620 | 3620 | */ |
3621 | 3621 | public function sendmail($params = array(), $msg = '', $files = array()) |
3622 | 3622 | { |
@@ -4053,7 +4053,7 @@ discard block |
||
4053 | 4053 | * Default: 1 |
4054 | 4054 | * @param string $fields List of fields |
4055 | 4055 | * Default: id, pagetitle, description, alias |
4056 | - * @return boolean|array |
|
4056 | + * @return string |
|
4057 | 4057 | */ |
4058 | 4058 | public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias') |
4059 | 4059 | { |
@@ -4151,7 +4151,7 @@ discard block |
||
4151 | 4151 | * |
4152 | 4152 | * @param string $type |
4153 | 4153 | * @param bool $report |
4154 | - * @return bool |
|
4154 | + * @return boolean|null |
|
4155 | 4155 | */ |
4156 | 4156 | public function clearCache($type = '', $report = false) |
4157 | 4157 | { |
@@ -4524,7 +4524,7 @@ discard block |
||
4524 | 4524 | * - Placeholders prefix. Default: '{'. |
4525 | 4525 | * @param string $suffix {string} |
4526 | 4526 | * - Placeholders suffix. Default: '}'. |
4527 | - * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4527 | + * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array. |
|
4528 | 4528 | * - Parsed chunk or false if $chunkArr is not array. |
4529 | 4529 | */ |
4530 | 4530 | public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}') |
@@ -5558,7 +5558,7 @@ discard block |
||
5558 | 5558 | * Remove event listener - only for use within the current execution cycle |
5559 | 5559 | * |
5560 | 5560 | * @param string $evtName |
5561 | - * @return boolean |
|
5561 | + * @return false|null |
|
5562 | 5562 | */ |
5563 | 5563 | public function removeEventListener($evtName) |
5564 | 5564 | { |
@@ -5582,7 +5582,7 @@ discard block |
||
5582 | 5582 | * |
5583 | 5583 | * @param string $evtName |
5584 | 5584 | * @param array $extParams Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value. |
5585 | - * @return boolean|array |
|
5585 | + * @return false|null |
|
5586 | 5586 | */ |
5587 | 5587 | public function invokeEvent($evtName, $extParams = array()) |
5588 | 5588 | { |
@@ -6204,7 +6204,7 @@ discard block |
||
6204 | 6204 | |
6205 | 6205 | /** |
6206 | 6206 | * @param string $str |
6207 | - * @return bool|mixed|string |
|
6207 | + * @return string |
|
6208 | 6208 | */ |
6209 | 6209 | public function atBindFileContent($str = '') |
6210 | 6210 | { |
@@ -6261,8 +6261,8 @@ discard block |
||
6261 | 6261 | } |
6262 | 6262 | |
6263 | 6263 | /** |
6264 | - * @param $str |
|
6265 | - * @return bool|string |
|
6264 | + * @param string $str |
|
6265 | + * @return false|string |
|
6266 | 6266 | */ |
6267 | 6267 | public function getExtFromFilename($str) |
6268 | 6268 | { |
@@ -6290,7 +6290,7 @@ discard block |
||
6290 | 6290 | * @param string $text Error message |
6291 | 6291 | * @param string $file File where the error was detected |
6292 | 6292 | * @param string $line Line number within $file |
6293 | - * @return boolean |
|
6293 | + * @return boolean|null |
|
6294 | 6294 | */ |
6295 | 6295 | public function phpError($nr, $text, $file, $line) |
6296 | 6296 | { |
@@ -6342,7 +6342,7 @@ discard block |
||
6342 | 6342 | * @param string $text |
6343 | 6343 | * @param string $line |
6344 | 6344 | * @param string $output |
6345 | - * @return bool |
|
6345 | + * @return null|boolean |
|
6346 | 6346 | */ |
6347 | 6347 | public function messageQuit( |
6348 | 6348 | $msg = 'unspecified error', |
@@ -6785,7 +6785,7 @@ discard block |
||
6785 | 6785 | |
6786 | 6786 | /** |
6787 | 6787 | * @param string $str |
6788 | - * @return bool|mixed|string |
|
6788 | + * @return string |
|
6789 | 6789 | */ |
6790 | 6790 | public function atBindInclude($str = '') |
6791 | 6791 | { |
@@ -6837,7 +6837,7 @@ discard block |
||
6837 | 6837 | * @param $str |
6838 | 6838 | * @param int $flags |
6839 | 6839 | * @param string $encode |
6840 | - * @return mixed |
|
6840 | + * @return string |
|
6841 | 6841 | */ |
6842 | 6842 | public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '') |
6843 | 6843 | { |
@@ -6847,7 +6847,7 @@ discard block |
||
6847 | 6847 | } |
6848 | 6848 | |
6849 | 6849 | /** |
6850 | - * @param $string |
|
6850 | + * @param string $string |
|
6851 | 6851 | * @param bool $returnData |
6852 | 6852 | * @return bool|mixed |
6853 | 6853 | */ |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | function __call($method_name, $arguments) |
230 | 230 | { |
231 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
231 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
232 | 232 | if (method_exists($this->old, $method_name)) { |
233 | 233 | $error_type = 1; |
234 | 234 | } else { |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | $info = debug_backtrace(); |
247 | 247 | $m[] = $msg; |
248 | 248 | if (!empty($this->currentSnippet)) { |
249 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
249 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
250 | 250 | } elseif (!empty($this->event->activePlugin)) { |
251 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
251 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
252 | 252 | } |
253 | 253 | $m[] = $this->decoded_request_uri; |
254 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
254 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
255 | 255 | $msg = implode('<br />', $m); |
256 | 256 | $this->logEvent(0, $error_type, $msg, $title); |
257 | 257 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | { |
269 | 269 | $flag = false; |
270 | 270 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
271 | - $flag = (bool)$this->{$connector}->conn; |
|
271 | + $flag = (bool) $this->{$connector}->conn; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | return $flag; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | } |
297 | 297 | if (!$out && $flag) { |
298 | 298 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
299 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
299 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
300 | 300 | $out = is_file($filename) ? include $filename : false; |
301 | 301 | } |
302 | 302 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | { |
316 | 316 | list ($usec, $sec) = explode(' ', microtime()); |
317 | 317 | |
318 | - return ((float)$usec + (float)$sec); |
|
318 | + return ((float) $usec + (float) $sec); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | // append the redirect count string to the url |
340 | 340 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
341 | 341 | if ($currentNumberOfRedirects > 3) { |
342 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
342 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
343 | 343 | } else { |
344 | 344 | $currentNumberOfRedirects += 1; |
345 | 345 | if (strpos($url, "?") > 0) { |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | } |
351 | 351 | } |
352 | 352 | if ($type == 'REDIRECT_REFRESH') { |
353 | - $header = 'Refresh: 0;URL=' . $url; |
|
353 | + $header = 'Refresh: 0;URL='.$url; |
|
354 | 354 | } elseif ($type == 'REDIRECT_META') { |
355 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
355 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
356 | 356 | echo $header; |
357 | 357 | exit; |
358 | 358 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | global $base_url, $site_url; |
361 | 361 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
362 | 362 | // append $site_url to make it work with Location: |
363 | - $url = $site_url . substr($url, strlen($base_url)); |
|
363 | + $url = $site_url.substr($url, strlen($base_url)); |
|
364 | 364 | } |
365 | 365 | if (strpos($url, "\n") === false) { |
366 | - $header = 'Location: ' . $url; |
|
366 | + $header = 'Location: '.$url; |
|
367 | 367 | } else { |
368 | 368 | $this->messageQuit('No newline allowed in redirect url.'); |
369 | 369 | } |
@@ -478,8 +478,8 @@ discard block |
||
478 | 478 | |
479 | 479 | private function recoverySiteCache() |
480 | 480 | { |
481 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
482 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
481 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
482 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
483 | 483 | |
484 | 484 | if (is_file($site_cache_path)) { |
485 | 485 | include($site_cache_path); |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | return; |
489 | 489 | } |
490 | 490 | |
491 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
491 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
492 | 492 | $cache = new synccache(); |
493 | 493 | $cache->setCachepath($site_cache_dir); |
494 | 494 | $cache->setReport(false); |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | $this->invokeEvent("OnBeforeManagerPageInit"); |
541 | 541 | } |
542 | 542 | |
543 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
544 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
543 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
544 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
545 | 545 | } else { |
546 | 546 | if ($usrType == 'web') { |
547 | 547 | $from = $tbl_web_user_settings; |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
562 | 562 | } |
563 | 563 | if (isset ($usrType)) { |
564 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
564 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
565 | 565 | } // store user settings in session |
566 | 566 | } |
567 | 567 | } |
@@ -707,10 +707,10 @@ discard block |
||
707 | 707 | $suf = $this->config['friendly_url_suffix']; |
708 | 708 | $pre = preg_quote($pre, '/'); |
709 | 709 | $suf = preg_quote($suf, '/'); |
710 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
710 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
711 | 711 | $q = $_[1]; |
712 | 712 | } |
713 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
713 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
714 | 714 | $q = $_[1]; |
715 | 715 | } |
716 | 716 | |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
734 | 734 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
735 | 735 | if ($this->config['use_alias_path'] == 1) { |
736 | - if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, |
|
736 | + if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, |
|
737 | 737 | $this->getChildIds($this->documentListing[$this->virtualDir], |
738 | 738 | 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
739 | 739 | $this->documentMethod = 'id'; |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | */ |
774 | 774 | public function getHashFile($key) |
775 | 775 | { |
776 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
776 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
777 | 777 | } |
778 | 778 | |
779 | 779 | /** |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
793 | 793 | $params = $_GET; |
794 | 794 | ksort($params); |
795 | - $hash .= '_' . md5(http_build_query($params)); |
|
795 | + $hash .= '_'.md5(http_build_query($params)); |
|
796 | 796 | } |
797 | 797 | } |
798 | 798 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
@@ -941,12 +941,12 @@ discard block |
||
941 | 941 | if ($js = $this->getRegisteredClientStartupScripts()) { |
942 | 942 | // change to just before closing </head> |
943 | 943 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
944 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
944 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
945 | 945 | } |
946 | 946 | |
947 | 947 | // Insert jscripts & html block into template - template must have a </body> tag |
948 | 948 | if ($js = $this->getRegisteredClientScripts()) { |
949 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
949 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
950 | 950 | } |
951 | 951 | // End fix by sirlancelot |
952 | 952 | |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | // send out content-type and content-disposition headers |
958 | 958 | if (IN_PARSER_MODE == "true") { |
959 | 959 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
960 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
960 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
961 | 961 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
962 | 962 | // header('HTTP/1.0 404 Not Found'); |
963 | 963 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | $name = preg_replace('|-+|', '-', $name); |
976 | 976 | $name = trim($name, '-'); |
977 | 977 | } |
978 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
978 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
979 | 979 | header($header); |
980 | 980 | } |
981 | 981 | } |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | |
984 | 984 | $stats = $this->getTimerStats($this->tstart); |
985 | 985 | |
986 | - $out =& $this->documentOutput; |
|
986 | + $out = & $this->documentOutput; |
|
987 | 987 | $out = str_replace("[^q^]", $stats['queries'], $out); |
988 | 988 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
989 | 989 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -1022,19 +1022,19 @@ discard block |
||
1022 | 1022 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
1023 | 1023 | $tt += $t; |
1024 | 1024 | } |
1025 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", |
|
1026 | - $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
1025 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", |
|
1026 | + $tt).")</legend>{$sc}</fieldset><br />"; |
|
1027 | 1027 | echo $this->snippetsCode; |
1028 | 1028 | } |
1029 | 1029 | if ($this->dumpPlugins) { |
1030 | 1030 | $ps = ""; |
1031 | 1031 | $tt = 0; |
1032 | 1032 | foreach ($this->pluginsTime as $s => $t) { |
1033 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
1033 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
1034 | 1034 | $tt += $t; |
1035 | 1035 | } |
1036 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", |
|
1037 | - $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
1036 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", |
|
1037 | + $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
1038 | 1038 | echo $this->pluginsCode; |
1039 | 1039 | } |
1040 | 1040 | |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | $srcTags = explode(',', $tags); |
1062 | 1062 | $repTags = array(); |
1063 | 1063 | foreach ($srcTags as $tag) { |
1064 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
1064 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | return array($srcTags, $repTags); |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
1085 | 1085 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
1086 | 1086 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
1087 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
1087 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
1088 | 1088 | |
1089 | 1089 | return $stats; |
1090 | 1090 | } |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | { |
1118 | 1118 | $cacheRefreshTime = 0; |
1119 | 1119 | $recent_update = 0; |
1120 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
1120 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
1121 | 1121 | $this->recentUpdate = $recent_update; |
1122 | 1122 | |
1123 | 1123 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1171,8 +1171,8 @@ discard block |
||
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | $docObjSerial = serialize($this->documentObject); |
1174 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
1175 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
1174 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
1175 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
1176 | 1176 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
1177 | 1177 | } |
1178 | 1178 | } |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | $pos[']]>'] = strpos($content, ']]>'); |
1233 | 1233 | |
1234 | 1234 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1235 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1235 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1236 | 1236 | } |
1237 | 1237 | |
1238 | 1238 | $lp = explode($left, $content); |
@@ -1362,8 +1362,8 @@ discard block |
||
1362 | 1362 | } |
1363 | 1363 | |
1364 | 1364 | if (is_array($value)) { |
1365 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
1366 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
1365 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
1366 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
1367 | 1367 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
1368 | 1368 | } |
1369 | 1369 | |
@@ -1375,7 +1375,7 @@ discard block |
||
1375 | 1375 | if (strpos($content, $s) !== false) { |
1376 | 1376 | $content = str_replace($s, $value, $content); |
1377 | 1377 | } elseif ($this->debug) { |
1378 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1378 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1379 | 1379 | } |
1380 | 1380 | } |
1381 | 1381 | |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | if (strpos($content, $s) !== false) { |
1545 | 1545 | $content = str_replace($s, $value, $content); |
1546 | 1546 | } elseif ($this->debug) { |
1547 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1547 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1548 | 1548 | } |
1549 | 1549 | } |
1550 | 1550 | |
@@ -1598,7 +1598,7 @@ discard block |
||
1598 | 1598 | } |
1599 | 1599 | |
1600 | 1600 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1601 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1601 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1602 | 1602 | if ($this->config['enable_at_syntax']) { |
1603 | 1603 | $value = $this->mergeConditionalTagsContent($value); |
1604 | 1604 | } |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | if (strpos($content, $s) !== false) { |
1615 | 1615 | $content = str_replace($s, $value, $content); |
1616 | 1616 | } elseif ($this->debug) { |
1617 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1617 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1618 | 1618 | } |
1619 | 1619 | } |
1620 | 1620 | |
@@ -1674,7 +1674,7 @@ discard block |
||
1674 | 1674 | if (strpos($content, $s) !== false) { |
1675 | 1675 | $content = str_replace($s, $value, $content); |
1676 | 1676 | } elseif ($this->debug) { |
1677 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1677 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1678 | 1678 | } |
1679 | 1679 | } |
1680 | 1680 | |
@@ -1695,7 +1695,7 @@ discard block |
||
1695 | 1695 | $elseiftag = '<@ELSEIF:', |
1696 | 1696 | $elsetag = '<@ELSE>', |
1697 | 1697 | $endiftag = '<@ENDIF>' |
1698 | - ) { |
|
1698 | + ){ |
|
1699 | 1699 | if (strpos($content, '@IF') !== false) { |
1700 | 1700 | $content = $this->_prepareCTag($content, $iftag, $elseiftag, $elsetag, $endiftag); |
1701 | 1701 | } |
@@ -1704,7 +1704,7 @@ discard block |
||
1704 | 1704 | return $content; |
1705 | 1705 | } |
1706 | 1706 | |
1707 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1707 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1708 | 1708 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), |
1709 | 1709 | $content); |
1710 | 1710 | |
@@ -1716,7 +1716,7 @@ discard block |
||
1716 | 1716 | } |
1717 | 1717 | list($cmd, $text) = explode('>', $split, 2); |
1718 | 1718 | $cmd = str_replace("'", "\'", $cmd); |
1719 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1719 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1720 | 1720 | $content .= $text; |
1721 | 1721 | } |
1722 | 1722 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1727,13 +1727,13 @@ discard block |
||
1727 | 1727 | } |
1728 | 1728 | list($cmd, $text) = explode('>', $split, 2); |
1729 | 1729 | $cmd = str_replace("'", "\'", $cmd); |
1730 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1730 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1731 | 1731 | $content .= $text; |
1732 | 1732 | } |
1733 | 1733 | |
1734 | 1734 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1735 | 1735 | ob_start(); |
1736 | - $content = eval('?>' . $content); |
|
1736 | + $content = eval('?>'.$content); |
|
1737 | 1737 | $content = ob_get_clean(); |
1738 | 1738 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), |
1739 | 1739 | $content); |
@@ -1755,7 +1755,7 @@ discard block |
||
1755 | 1755 | $elseiftag = '<@ELSEIF:', |
1756 | 1756 | $elsetag = '<@ELSE>', |
1757 | 1757 | $endiftag = '<@ENDIF>' |
1758 | - ) { |
|
1758 | + ){ |
|
1759 | 1759 | if (strpos($content, '<!--@IF ') !== false) { |
1760 | 1760 | $content = str_replace('<!--@IF ', $iftag, $content); |
1761 | 1761 | } // for jp |
@@ -1865,7 +1865,7 @@ discard block |
||
1865 | 1865 | $matches = $this->getTagsFromContent($content, $left, $right); |
1866 | 1866 | if (!empty($matches)) { |
1867 | 1867 | foreach ($matches[0] as $i => $v) { |
1868 | - $addBreakMatches[$i] = $v . "\n"; |
|
1868 | + $addBreakMatches[$i] = $v."\n"; |
|
1869 | 1869 | } |
1870 | 1870 | $content = str_replace($addBreakMatches, '', $content); |
1871 | 1871 | if (strpos($content, $left) !== false) { |
@@ -1900,7 +1900,7 @@ discard block |
||
1900 | 1900 | if (strpos($content, $s) !== false) { |
1901 | 1901 | $content = str_replace($s, $v, $content); |
1902 | 1902 | } elseif ($this->debug) { |
1903 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1903 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1904 | 1904 | } |
1905 | 1905 | } |
1906 | 1906 | |
@@ -1967,7 +1967,7 @@ discard block |
||
1967 | 1967 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', |
1968 | 1968 | $error_info['message'], $error_info['line'], $msg); |
1969 | 1969 | if ($this->isBackend()) { |
1970 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
1970 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
1971 | 1971 | } |
1972 | 1972 | } |
1973 | 1973 | } else { |
@@ -2014,7 +2014,7 @@ discard block |
||
2014 | 2014 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', |
2015 | 2015 | $error_info['message'], $error_info['line'], $echo); |
2016 | 2016 | if ($this->isBackend()) { |
2017 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
2017 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
2018 | 2018 | } |
2019 | 2019 | } |
2020 | 2020 | } |
@@ -2022,7 +2022,7 @@ discard block |
||
2022 | 2022 | if (is_array($return) || is_object($return)) { |
2023 | 2023 | return $return; |
2024 | 2024 | } else { |
2025 | - return $echo . $return; |
|
2025 | + return $echo.$return; |
|
2026 | 2026 | } |
2027 | 2027 | } |
2028 | 2028 | |
@@ -2062,7 +2062,7 @@ discard block |
||
2062 | 2062 | if (strpos($content, $s) !== false) { |
2063 | 2063 | $content = str_replace($s, $value, $content); |
2064 | 2064 | } elseif ($this->debug) { |
2065 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
2065 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
2066 | 2066 | } |
2067 | 2067 | continue; |
2068 | 2068 | } |
@@ -2074,7 +2074,7 @@ discard block |
||
2074 | 2074 | if (strpos($content, $s) !== false) { |
2075 | 2075 | $content = str_replace($s, $value, $content); |
2076 | 2076 | } elseif ($this->debug) { |
2077 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
2077 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
2078 | 2078 | } |
2079 | 2079 | } |
2080 | 2080 | |
@@ -2167,7 +2167,7 @@ discard block |
||
2167 | 2167 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
2168 | 2168 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
2169 | 2169 | $print_r_params = str_replace("\t", ' ', |
2170 | - $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
2170 | + $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
2171 | 2171 | $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', |
2172 | 2172 | $snippetObject['name'], $eventtime, $piece, $print_r_params, $code); |
2173 | 2173 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
@@ -2416,7 +2416,7 @@ discard block |
||
2416 | 2416 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
2417 | 2417 | $count = $this->db->getRecordCount($rs); |
2418 | 2418 | if (1 < $count) { |
2419 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2419 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2420 | 2420 | } |
2421 | 2421 | if ($count) { |
2422 | 2422 | $row = $this->db->getRow($rs); |
@@ -2445,13 +2445,13 @@ discard block |
||
2445 | 2445 | $suff = $this->config['friendly_url_suffix']; |
2446 | 2446 | |
2447 | 2447 | return str_replace(array( |
2448 | - '.xml' . $suff, |
|
2449 | - '.rss' . $suff, |
|
2450 | - '.js' . $suff, |
|
2451 | - '.css' . $suff, |
|
2452 | - '.txt' . $suff, |
|
2453 | - '.json' . $suff, |
|
2454 | - '.pdf' . $suff |
|
2448 | + '.xml'.$suff, |
|
2449 | + '.rss'.$suff, |
|
2450 | + '.js'.$suff, |
|
2451 | + '.css'.$suff, |
|
2452 | + '.txt'.$suff, |
|
2453 | + '.json'.$suff, |
|
2454 | + '.pdf'.$suff |
|
2455 | 2455 | ), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text); |
2456 | 2456 | } |
2457 | 2457 | |
@@ -2484,7 +2484,7 @@ discard block |
||
2484 | 2484 | $suff = '/'; |
2485 | 2485 | } |
2486 | 2486 | |
2487 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
2487 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
2488 | 2488 | } |
2489 | 2489 | |
2490 | 2490 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2522,7 +2522,7 @@ discard block |
||
2522 | 2522 | $ids = implode(',', array_unique($match['1'])); |
2523 | 2523 | if ($ids) { |
2524 | 2524 | $res = $this->db->select("id,alias,isfolder,parent,alias_visible", |
2525 | - $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
2525 | + $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
2526 | 2526 | while ($row = $this->db->getRow($res)) { |
2527 | 2527 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
2528 | 2528 | $parent = $row['parent']; |
@@ -2533,7 +2533,7 @@ discard block |
||
2533 | 2533 | $parent = $this->aliasListing[$parent]['parent']; |
2534 | 2534 | } |
2535 | 2535 | |
2536 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
2536 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
2537 | 2537 | } else { |
2538 | 2538 | $aliases[$row['id']] = $row['alias']; |
2539 | 2539 | } |
@@ -2546,7 +2546,7 @@ discard block |
||
2546 | 2546 | $pref = $this->config['friendly_url_prefix']; |
2547 | 2547 | $suff = $this->config['friendly_url_suffix']; |
2548 | 2548 | $documentSource = preg_replace_callback($in, |
2549 | - function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2549 | + function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2550 | 2550 | $modx = evolutionCMS(); |
2551 | 2551 | $thealias = $aliases[$m[1]]; |
2552 | 2552 | $thefolder = $isfolder[$m[1]]; |
@@ -2565,7 +2565,7 @@ discard block |
||
2565 | 2565 | |
2566 | 2566 | } else { |
2567 | 2567 | $in = '!\[\~([0-9]+)\~\]!is'; |
2568 | - $out = "index.php?id=" . '\1'; |
|
2568 | + $out = "index.php?id=".'\1'; |
|
2569 | 2569 | $documentSource = preg_replace($in, $out, $documentSource); |
2570 | 2570 | } |
2571 | 2571 | |
@@ -2586,7 +2586,7 @@ discard block |
||
2586 | 2586 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
2587 | 2587 | $len_base_url = strlen($this->config['base_url']); |
2588 | 2588 | |
2589 | - $url_path = $q;//LANG |
|
2589 | + $url_path = $q; //LANG |
|
2590 | 2590 | |
2591 | 2591 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
2592 | 2592 | $url_path = substr($url_path, $len_base_url); |
@@ -2598,7 +2598,7 @@ discard block |
||
2598 | 2598 | $strictURL = substr($strictURL, $len_base_url); |
2599 | 2599 | } |
2600 | 2600 | $http_host = $_SERVER['HTTP_HOST']; |
2601 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
2601 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
2602 | 2602 | |
2603 | 2603 | $site_url = $this->config['site_url']; |
2604 | 2604 | |
@@ -2615,7 +2615,7 @@ discard block |
||
2615 | 2615 | } |
2616 | 2616 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
2617 | 2617 | if (empty($_POST)) { |
2618 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
2618 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
2619 | 2619 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2620 | 2620 | exit(0); |
2621 | 2621 | } |
@@ -2680,7 +2680,7 @@ discard block |
||
2680 | 2680 | $docgrp = implode(",", $docgrp); |
2681 | 2681 | } |
2682 | 2682 | // get document |
2683 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2683 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2684 | 2684 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
2685 | 2685 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2686 | 2686 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2718,9 +2718,9 @@ discard block |
||
2718 | 2718 | if ($documentObject['template']) { |
2719 | 2719 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2720 | 2720 | $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", |
2721 | - $this->getFullTableName("site_tmplvars") . " tv |
|
2722 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2723 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", |
|
2721 | + $this->getFullTableName("site_tmplvars")." tv |
|
2722 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2723 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", |
|
2724 | 2724 | "tvtpl.templateid = '{$documentObject['template']}'"); |
2725 | 2725 | $tmplvars = array(); |
2726 | 2726 | while ($row = $this->db->getRow($rs)) { |
@@ -2767,7 +2767,7 @@ discard block |
||
2767 | 2767 | $st = md5($source); |
2768 | 2768 | } |
2769 | 2769 | if ($this->dumpSnippets == 1) { |
2770 | - $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2770 | + $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2771 | 2771 | } |
2772 | 2772 | |
2773 | 2773 | // invoke OnParseDocument event |
@@ -2810,7 +2810,7 @@ discard block |
||
2810 | 2810 | */ |
2811 | 2811 | public function executeParser() |
2812 | 2812 | { |
2813 | - if(MODX_CLI) { |
|
2813 | + if (MODX_CLI) { |
|
2814 | 2814 | throw new RuntimeException('Call DocumentParser::executeParser on CLI mode'); |
2815 | 2815 | } |
2816 | 2816 | |
@@ -2856,7 +2856,7 @@ discard block |
||
2856 | 2856 | |
2857 | 2857 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2858 | 2858 | if ($this->config['use_alias_path'] == 1) { |
2859 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
2859 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
2860 | 2860 | if (isset($this->documentListing[$alias])) { |
2861 | 2861 | $this->documentIdentifier = $this->documentListing[$alias]; |
2862 | 2862 | } else { |
@@ -2919,7 +2919,7 @@ discard block |
||
2919 | 2919 | $docAlias = $this->db->escape($this->documentIdentifier); |
2920 | 2920 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), |
2921 | 2921 | "deleted=0 and alias='{$docAlias}'"); |
2922 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
2922 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
2923 | 2923 | } |
2924 | 2924 | } |
2925 | 2925 | $this->documentMethod = 'id'; |
@@ -2973,7 +2973,7 @@ discard block |
||
2973 | 2973 | $_REQUEST[$n] = $_GET[$n] = $v; |
2974 | 2974 | } |
2975 | 2975 | } |
2976 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
2976 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
2977 | 2977 | $this->q = $qp['path']; |
2978 | 2978 | |
2979 | 2979 | return $qp['path']; |
@@ -3069,7 +3069,7 @@ discard block |
||
3069 | 3069 | $this->sendErrorPage(); |
3070 | 3070 | } else { |
3071 | 3071 | // Inculde the necessary files to check document permissions |
3072 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
3072 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
3073 | 3073 | $udperms = new udperms(); |
3074 | 3074 | $udperms->user = $this->getLoginUserID(); |
3075 | 3075 | $udperms->document = $this->documentIdentifier; |
@@ -3123,7 +3123,7 @@ discard block |
||
3123 | 3123 | while ($id && $height--) { |
3124 | 3124 | $thisid = $id; |
3125 | 3125 | if ($this->config['aliaslistingfolder'] == 1) { |
3126 | - $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3126 | + $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3127 | 3127 | if (!$id || $id == '0') { |
3128 | 3128 | break; |
3129 | 3129 | } |
@@ -3177,15 +3177,15 @@ discard block |
||
3177 | 3177 | if ($this->config['aliaslistingfolder'] == 1) { |
3178 | 3178 | |
3179 | 3179 | $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), |
3180 | - "parent IN (" . $id . ") AND deleted = '0'"); |
|
3180 | + "parent IN (".$id.") AND deleted = '0'"); |
|
3181 | 3181 | $idx = array(); |
3182 | 3182 | while ($row = $this->db->getRow($res)) { |
3183 | 3183 | $pAlias = ''; |
3184 | 3184 | if (isset($this->aliasListing[$row['parent']])) { |
3185 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
3186 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
3185 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
3186 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
3187 | 3187 | }; |
3188 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
3188 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
3189 | 3189 | if ($row['isfolder'] == 1) { |
3190 | 3190 | $idx[] = $row['id']; |
3191 | 3191 | } |
@@ -3218,7 +3218,7 @@ discard block |
||
3218 | 3218 | $depth--; |
3219 | 3219 | |
3220 | 3220 | foreach ($documentMap_cache[$id] as $childId) { |
3221 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
3221 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
3222 | 3222 | if (!strlen($pkey)) { |
3223 | 3223 | $pkey = "{$childId}"; |
3224 | 3224 | } |
@@ -3248,7 +3248,7 @@ discard block |
||
3248 | 3248 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
3249 | 3249 | $fnc = substr($url, 11); |
3250 | 3250 | } elseif ($url) { |
3251 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
3251 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
3252 | 3252 | } else { |
3253 | 3253 | $fnc = "history.back(-1);"; |
3254 | 3254 | } |
@@ -3257,7 +3257,7 @@ discard block |
||
3257 | 3257 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
3258 | 3258 | <script> |
3259 | 3259 | function __alertQuit() { |
3260 | - alert('" . addslashes($msg) . "'); |
|
3260 | + alert('".addslashes($msg)."'); |
|
3261 | 3261 | {$fnc} |
3262 | 3262 | } |
3263 | 3263 | window.setTimeout('__alertQuit();',100); |
@@ -3279,10 +3279,10 @@ discard block |
||
3279 | 3279 | $state = 0; |
3280 | 3280 | $pms = $_SESSION['mgrPermissions']; |
3281 | 3281 | if ($pms) { |
3282 | - $state = ((bool)$pms[$pm] === true); |
|
3282 | + $state = ((bool) $pms[$pm] === true); |
|
3283 | 3283 | } |
3284 | 3284 | |
3285 | - return (int)$state; |
|
3285 | + return (int) $state; |
|
3286 | 3286 | } |
3287 | 3287 | |
3288 | 3288 | /** |
@@ -3295,8 +3295,8 @@ discard block |
||
3295 | 3295 | */ |
3296 | 3296 | public function elementIsLocked($type, $id, $includeThisUser = false) |
3297 | 3297 | { |
3298 | - $id = (int)$id; |
|
3299 | - $type = (int)$type; |
|
3298 | + $id = (int) $id; |
|
3299 | + $type = (int) $type; |
|
3300 | 3300 | if (!$type || !$id) { |
3301 | 3301 | return null; |
3302 | 3302 | } |
@@ -3346,7 +3346,7 @@ discard block |
||
3346 | 3346 | return $lockedElements; |
3347 | 3347 | } |
3348 | 3348 | |
3349 | - $type = (int)$type; |
|
3349 | + $type = (int) $type; |
|
3350 | 3350 | if (isset($lockedElements[$type])) { |
3351 | 3351 | return $lockedElements[$type]; |
3352 | 3352 | } else { |
@@ -3364,7 +3364,7 @@ discard block |
||
3364 | 3364 | $this->cleanupExpiredLocks(); |
3365 | 3365 | |
3366 | 3366 | $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', |
3367 | - $this->getFullTableName('active_user_locks') . " ul |
|
3367 | + $this->getFullTableName('active_user_locks')." ul |
|
3368 | 3368 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3369 | 3369 | while ($row = $this->db->getRow($rs)) { |
3370 | 3370 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3387,7 +3387,7 @@ discard block |
||
3387 | 3387 | public function cleanupExpiredLocks() |
3388 | 3388 | { |
3389 | 3389 | // Clean-up active_user_sessions first |
3390 | - $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3390 | + $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3391 | 3391 | $validSessionTimeLimit = $this->time - $timeout; |
3392 | 3392 | $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}"); |
3393 | 3393 | |
@@ -3400,7 +3400,7 @@ discard block |
||
3400 | 3400 | foreach ($rs as $row) { |
3401 | 3401 | $userSids[] = $row['sid']; |
3402 | 3402 | } |
3403 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3403 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3404 | 3404 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
3405 | 3405 | } else { |
3406 | 3406 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3487,8 +3487,8 @@ discard block |
||
3487 | 3487 | public function lockElement($type, $id) |
3488 | 3488 | { |
3489 | 3489 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3490 | - $type = (int)$type; |
|
3491 | - $id = (int)$id; |
|
3490 | + $type = (int) $type; |
|
3491 | + $id = (int) $id; |
|
3492 | 3492 | if (!$type || !$id || !$userId) { |
3493 | 3493 | return false; |
3494 | 3494 | } |
@@ -3510,8 +3510,8 @@ discard block |
||
3510 | 3510 | public function unlockElement($type, $id, $includeAllUsers = false) |
3511 | 3511 | { |
3512 | 3512 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3513 | - $type = (int)$type; |
|
3514 | - $id = (int)$id; |
|
3513 | + $type = (int) $type; |
|
3514 | + $id = (int) $id; |
|
3515 | 3515 | if (!$type || !$id) { |
3516 | 3516 | return false; |
3517 | 3517 | } |
@@ -3581,8 +3581,8 @@ discard block |
||
3581 | 3581 | } |
3582 | 3582 | |
3583 | 3583 | $usertype = $this->isFrontend() ? 1 : 0; |
3584 | - $evtid = (int)$evtid; |
|
3585 | - $type = (int)$type; |
|
3584 | + $evtid = (int) $evtid; |
|
3585 | + $type = (int) $type; |
|
3586 | 3586 | |
3587 | 3587 | // Types: 1 = information, 2 = warning, 3 = error |
3588 | 3588 | if ($type < 1) { |
@@ -3604,8 +3604,8 @@ discard block |
||
3604 | 3604 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
3605 | 3605 | if ($this->config['send_errormail'] <= $type) { |
3606 | 3606 | $this->sendmail(array( |
3607 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
3608 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
3607 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
3608 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
3609 | 3609 | 'type' => 'text' |
3610 | 3610 | )); |
3611 | 3611 | } |
@@ -3653,7 +3653,7 @@ discard block |
||
3653 | 3653 | $p['fromname'] = $userinfo['username']; |
3654 | 3654 | } |
3655 | 3655 | if ($msg === '' && !isset($p['body'])) { |
3656 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3656 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3657 | 3657 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3658 | 3658 | $p['body'] = $msg; |
3659 | 3659 | } |
@@ -3693,8 +3693,8 @@ discard block |
||
3693 | 3693 | $files = array(); |
3694 | 3694 | } |
3695 | 3695 | foreach ($files as $f) { |
3696 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3697 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
3696 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3697 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
3698 | 3698 | } |
3699 | 3699 | } |
3700 | 3700 | $rs = $this->mail->send(); |
@@ -3759,7 +3759,7 @@ discard block |
||
3759 | 3759 | $sort = 'menuindex', |
3760 | 3760 | $dir = 'ASC', |
3761 | 3761 | $fields = 'id, pagetitle, description, parent, alias, menutitle' |
3762 | - ) { |
|
3762 | + ){ |
|
3763 | 3763 | |
3764 | 3764 | $cacheKey = md5(print_r(func_get_args(), true)); |
3765 | 3765 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
@@ -3769,14 +3769,14 @@ discard block |
||
3769 | 3769 | $tblsc = $this->getFullTableName("site_content"); |
3770 | 3770 | $tbldg = $this->getFullTableName("document_groups"); |
3771 | 3771 | // modify field names to use sc. table reference |
3772 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3773 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3772 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3773 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3774 | 3774 | // get document groups for current user |
3775 | 3775 | if ($docgrp = $this->getUserDocGroups()) { |
3776 | 3776 | $docgrp = implode(",", $docgrp); |
3777 | 3777 | } |
3778 | 3778 | // build query |
3779 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3779 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3780 | 3780 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3781 | 3781 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", |
3782 | 3782 | "{$sort} {$dir}"); |
@@ -3802,7 +3802,7 @@ discard block |
||
3802 | 3802 | $sort = 'menuindex', |
3803 | 3803 | $dir = 'ASC', |
3804 | 3804 | $fields = 'id, pagetitle, description, parent, alias, menutitle' |
3805 | - ) { |
|
3805 | + ){ |
|
3806 | 3806 | $cacheKey = md5(print_r(func_get_args(), true)); |
3807 | 3807 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
3808 | 3808 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
@@ -3812,14 +3812,14 @@ discard block |
||
3812 | 3812 | $tbldg = $this->getFullTableName("document_groups"); |
3813 | 3813 | |
3814 | 3814 | // modify field names to use sc. table reference |
3815 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3816 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3815 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3816 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3817 | 3817 | // get document groups for current user |
3818 | 3818 | if ($docgrp = $this->getUserDocGroups()) { |
3819 | 3819 | $docgrp = implode(",", $docgrp); |
3820 | 3820 | } |
3821 | 3821 | // build query |
3822 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3822 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3823 | 3823 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3824 | 3824 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", |
3825 | 3825 | "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
@@ -3856,23 +3856,23 @@ discard block |
||
3856 | 3856 | $sort = 'menuindex', |
3857 | 3857 | $dir = 'ASC', |
3858 | 3858 | $limit = '' |
3859 | - ) { |
|
3859 | + ){ |
|
3860 | 3860 | |
3861 | 3861 | $cacheKey = md5(print_r(func_get_args(), true)); |
3862 | 3862 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
3863 | 3863 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3864 | 3864 | } |
3865 | 3865 | |
3866 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3867 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3866 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3867 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3868 | 3868 | |
3869 | 3869 | if ($where != '') { |
3870 | - $where = 'AND ' . $where; |
|
3870 | + $where = 'AND '.$where; |
|
3871 | 3871 | } |
3872 | 3872 | |
3873 | 3873 | // modify field names to use sc. table reference |
3874 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3875 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3874 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3875 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3876 | 3876 | |
3877 | 3877 | // get document groups for current user |
3878 | 3878 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3880,7 +3880,7 @@ discard block |
||
3880 | 3880 | } |
3881 | 3881 | |
3882 | 3882 | // build query |
3883 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3883 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3884 | 3884 | |
3885 | 3885 | $tblsc = $this->getFullTableName('site_content'); |
3886 | 3886 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3923,7 +3923,7 @@ discard block |
||
3923 | 3923 | $sort = 'menuindex', |
3924 | 3924 | $dir = 'ASC', |
3925 | 3925 | $limit = '' |
3926 | - ) { |
|
3926 | + ){ |
|
3927 | 3927 | |
3928 | 3928 | $cacheKey = md5(print_r(func_get_args(), true)); |
3929 | 3929 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
@@ -3943,10 +3943,10 @@ discard block |
||
3943 | 3943 | return false; |
3944 | 3944 | } else { |
3945 | 3945 | // modify field names to use sc. table reference |
3946 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3947 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3946 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3947 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3948 | 3948 | if ($where != '') { |
3949 | - $where = 'AND ' . $where; |
|
3949 | + $where = 'AND '.$where; |
|
3950 | 3950 | } |
3951 | 3951 | |
3952 | 3952 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3957,14 +3957,14 @@ discard block |
||
3957 | 3957 | $docgrp = implode(',', $docgrp); |
3958 | 3958 | } |
3959 | 3959 | |
3960 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3960 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3961 | 3961 | |
3962 | 3962 | $tblsc = $this->getFullTableName('site_content'); |
3963 | 3963 | $tbldg = $this->getFullTableName('document_groups'); |
3964 | 3964 | |
3965 | 3965 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3966 | - LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', |
|
3967 | - $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", |
|
3966 | + LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', |
|
3967 | + $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", |
|
3968 | 3968 | ($sort ? "{$sort} {$dir}" : ""), $limit); |
3969 | 3969 | |
3970 | 3970 | $resourceArray = $this->db->makeArray($result); |
@@ -4070,12 +4070,12 @@ discard block |
||
4070 | 4070 | $tbldg = $this->getFullTableName("document_groups"); |
4071 | 4071 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
4072 | 4072 | // modify field names to use sc. table reference |
4073 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4073 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4074 | 4074 | // get document groups for current user |
4075 | 4075 | if ($docgrp = $this->getUserDocGroups()) { |
4076 | 4076 | $docgrp = implode(",", $docgrp); |
4077 | 4077 | } |
4078 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
4078 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
4079 | 4079 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", |
4080 | 4080 | "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
4081 | 4081 | $pageInfo = $this->db->getRow($result); |
@@ -4127,7 +4127,7 @@ discard block |
||
4127 | 4127 | { |
4128 | 4128 | if ($this->currentSnippet) { |
4129 | 4129 | $tbl = $this->getFullTableName("site_snippets"); |
4130 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
4130 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
4131 | 4131 | if ($snippetId = $this->db->getValue($rs)) { |
4132 | 4132 | return $snippetId; |
4133 | 4133 | } |
@@ -4155,23 +4155,23 @@ discard block |
||
4155 | 4155 | */ |
4156 | 4156 | public function clearCache($type = '', $report = false) |
4157 | 4157 | { |
4158 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
4158 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
4159 | 4159 | if (is_array($type)) { |
4160 | 4160 | foreach ($type as $_) { |
4161 | 4161 | $this->clearCache($_, $report); |
4162 | 4162 | } |
4163 | 4163 | } elseif ($type == 'full') { |
4164 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
4164 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
4165 | 4165 | $sync = new synccache(); |
4166 | 4166 | $sync->setCachepath($cache_dir); |
4167 | 4167 | $sync->setReport($report); |
4168 | 4168 | $sync->emptyCache(); |
4169 | 4169 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
4170 | 4170 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
4171 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
4172 | - $cache_path = $cache_dir . $file_name; |
|
4171 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
4172 | + $cache_path = $cache_dir.$file_name; |
|
4173 | 4173 | $files = glob($cache_path); |
4174 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
4174 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
4175 | 4175 | foreach ($files as $file) { |
4176 | 4176 | if (!is_file($file)) { |
4177 | 4177 | continue; |
@@ -4179,7 +4179,7 @@ discard block |
||
4179 | 4179 | unlink($file); |
4180 | 4180 | } |
4181 | 4181 | } else { |
4182 | - $files = glob($cache_dir . '*'); |
|
4182 | + $files = glob($cache_dir.'*'); |
|
4183 | 4183 | foreach ($files as $file) { |
4184 | 4184 | $name = basename($file); |
4185 | 4185 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4248,7 +4248,7 @@ discard block |
||
4248 | 4248 | $f_url_suffix = '/'; |
4249 | 4249 | } |
4250 | 4250 | |
4251 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
4251 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
4252 | 4252 | |
4253 | 4253 | if ($al && $al['alias']) { |
4254 | 4254 | $alias = $al['alias']; |
@@ -4256,7 +4256,7 @@ discard block |
||
4256 | 4256 | |
4257 | 4257 | } |
4258 | 4258 | |
4259 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
4259 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
4260 | 4260 | $url = "{$alias}{$args}"; |
4261 | 4261 | } else { |
4262 | 4262 | $url = "index.php?id={$id}{$args}"; |
@@ -4275,7 +4275,7 @@ discard block |
||
4275 | 4275 | } |
4276 | 4276 | |
4277 | 4277 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
4278 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
4278 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
4279 | 4279 | } |
4280 | 4280 | |
4281 | 4281 | //fix strictUrl by Bumkaka |
@@ -4284,9 +4284,9 @@ discard block |
||
4284 | 4284 | } |
4285 | 4285 | |
4286 | 4286 | if ($this->config['xhtml_urls']) { |
4287 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
4287 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
4288 | 4288 | } else { |
4289 | - $url = $host . $virtualDir . $url; |
|
4289 | + $url = $host.$virtualDir.$url; |
|
4290 | 4290 | } |
4291 | 4291 | |
4292 | 4292 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4310,21 +4310,21 @@ discard block |
||
4310 | 4310 | if (isset($this->aliasListing[$id])) { |
4311 | 4311 | $out = $this->aliasListing[$id]; |
4312 | 4312 | } else { |
4313 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
4313 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
4314 | 4314 | if ($this->db->getRecordCount($q) == '1') { |
4315 | 4315 | $q = $this->db->getRow($q); |
4316 | 4316 | $this->aliasListing[$id] = array( |
4317 | - 'id' => (int)$q['id'], |
|
4317 | + 'id' => (int) $q['id'], |
|
4318 | 4318 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
4319 | - 'parent' => (int)$q['parent'], |
|
4320 | - 'isfolder' => (int)$q['isfolder'], |
|
4319 | + 'parent' => (int) $q['parent'], |
|
4320 | + 'isfolder' => (int) $q['isfolder'], |
|
4321 | 4321 | ); |
4322 | 4322 | if ($this->aliasListing[$id]['parent'] > 0) { |
4323 | 4323 | //fix alias_path_usage |
4324 | 4324 | if ($this->config['use_alias_path'] == '1') { |
4325 | 4325 | //&& $tmp['path'] != '' - fix error slash with epty path |
4326 | 4326 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
4327 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
4327 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
4328 | 4328 | } else { |
4329 | 4329 | $this->aliasListing[$id]['path'] = ''; |
4330 | 4330 | } |
@@ -4366,7 +4366,7 @@ discard block |
||
4366 | 4366 | $out = array(); |
4367 | 4367 | if (empty($this->version) || !is_array($this->version)) { |
4368 | 4368 | //include for compatibility modx version < 1.0.10 |
4369 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
4369 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
4370 | 4370 | $this->version = array(); |
4371 | 4371 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
4372 | 4372 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4389,19 +4389,19 @@ discard block |
||
4389 | 4389 | { |
4390 | 4390 | if (isset ($this->snippetCache[$snippetName])) { |
4391 | 4391 | $snippet = $this->snippetCache[$snippetName]; |
4392 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
4392 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
4393 | 4393 | } else { // not in cache so let's check the db |
4394 | - $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
|
4394 | + $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."' AND ss.disabled=0;"; |
|
4395 | 4395 | $result = $this->db->query($sql); |
4396 | 4396 | if ($this->db->getRecordCount($result) == 1) { |
4397 | 4397 | $row = $this->db->getRow($result); |
4398 | 4398 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
4399 | 4399 | $mergedProperties = array_merge($this->parseProperties($row['properties']), |
4400 | 4400 | $this->parseProperties($row['sharedproperties'])); |
4401 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
4401 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
4402 | 4402 | } else { |
4403 | 4403 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
4404 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
4404 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
4405 | 4405 | } |
4406 | 4406 | } |
4407 | 4407 | // load default params/properties |
@@ -4505,7 +4505,7 @@ discard block |
||
4505 | 4505 | if (strpos($tpl, $s) !== false) { |
4506 | 4506 | $tpl = str_replace($s, $value, $tpl); |
4507 | 4507 | } elseif ($this->debug) { |
4508 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4508 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4509 | 4509 | } |
4510 | 4510 | } |
4511 | 4511 | |
@@ -4554,7 +4554,7 @@ discard block |
||
4554 | 4554 | case 'CODE': |
4555 | 4555 | break; |
4556 | 4556 | case 'FILE': |
4557 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4557 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4558 | 4558 | break; |
4559 | 4559 | case 'CHUNK': |
4560 | 4560 | $template = $this->getChunk($template); |
@@ -4588,7 +4588,7 @@ discard block |
||
4588 | 4588 | if ($mode !== 'formatOnly' && empty($timestamp)) { |
4589 | 4589 | return '-'; |
4590 | 4590 | } |
4591 | - $timestamp = (int)$timestamp; |
|
4591 | + $timestamp = (int) $timestamp; |
|
4592 | 4592 | |
4593 | 4593 | switch ($this->config['datetime_format']) { |
4594 | 4594 | case 'YYYY/mm/dd': |
@@ -4608,7 +4608,7 @@ discard block |
||
4608 | 4608 | } |
4609 | 4609 | |
4610 | 4610 | if (empty($mode)) { |
4611 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4611 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4612 | 4612 | } elseif ($mode == 'dateOnly') { |
4613 | 4613 | $strTime = strftime($dateFormat, $timestamp); |
4614 | 4614 | } elseif ($mode == 'formatOnly') { |
@@ -4663,7 +4663,7 @@ discard block |
||
4663 | 4663 | $S = 0; |
4664 | 4664 | } |
4665 | 4665 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y); |
4666 | - $timeStamp = (int)$timeStamp; |
|
4666 | + $timeStamp = (int) $timeStamp; |
|
4667 | 4667 | |
4668 | 4668 | return $timeStamp; |
4669 | 4669 | } |
@@ -4701,7 +4701,7 @@ discard block |
||
4701 | 4701 | $tvfields = "*", |
4702 | 4702 | $tvsort = "rank", |
4703 | 4703 | $tvsortdir = "ASC" |
4704 | - ) { |
|
4704 | + ){ |
|
4705 | 4705 | $docs = $this->getDocumentChildren($parentid, $published, 0, '*', '', $docsort, $docsortdir); |
4706 | 4706 | if (!$docs) { |
4707 | 4707 | return false; |
@@ -4714,7 +4714,7 @@ discard block |
||
4714 | 4714 | if ($v === 'value') { |
4715 | 4715 | unset($_[$i]); |
4716 | 4716 | } else { |
4717 | - $_[$i] = 'tv.' . $v; |
|
4717 | + $_[$i] = 'tv.'.$v; |
|
4718 | 4718 | } |
4719 | 4719 | } |
4720 | 4720 | $fields = implode(',', $_); |
@@ -4723,13 +4723,13 @@ discard block |
||
4723 | 4723 | } |
4724 | 4724 | |
4725 | 4725 | if ($tvsort != '') { |
4726 | - $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4726 | + $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4727 | 4727 | } |
4728 | 4728 | if ($tvidnames == "*") { |
4729 | 4729 | $query = "tv.id<>0"; |
4730 | 4730 | } else { |
4731 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", |
|
4732 | - $tvidnames) . "')"; |
|
4731 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", |
|
4732 | + $tvidnames)."')"; |
|
4733 | 4733 | } |
4734 | 4734 | |
4735 | 4735 | $this->getUserDocGroups(); |
@@ -4791,7 +4791,7 @@ discard block |
||
4791 | 4791 | $sortDir = 'ASC', |
4792 | 4792 | $where = '', |
4793 | 4793 | $resultKey = 'id' |
4794 | - ) { |
|
4794 | + ){ |
|
4795 | 4795 | $docs = $this->getDocumentChildren($parentid, $published, 0, 'id', $where, $sortBy, $sortDir); |
4796 | 4796 | |
4797 | 4797 | if (!$docs) { |
@@ -4886,7 +4886,7 @@ discard block |
||
4886 | 4886 | $published = 1, |
4887 | 4887 | $sort = 'rank', |
4888 | 4888 | $dir = 'ASC' |
4889 | - ) { |
|
4889 | + ){ |
|
4890 | 4890 | $cacheKey = md5(print_r(func_get_args(), true)); |
4891 | 4891 | if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) { |
4892 | 4892 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
@@ -4911,20 +4911,20 @@ discard block |
||
4911 | 4911 | } |
4912 | 4912 | |
4913 | 4913 | // get user defined template variables |
4914 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', |
|
4914 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', |
|
4915 | 4915 | array_filter(array_map('trim', explode(',', $fields)))); |
4916 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4916 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4917 | 4917 | |
4918 | 4918 | if ($idnames == '*') { |
4919 | 4919 | $query = 'tv.id<>0'; |
4920 | 4920 | } else { |
4921 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4921 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4922 | 4922 | } |
4923 | 4923 | |
4924 | 4924 | $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", |
4925 | - $this->getFullTableName('site_tmplvars') . " tv |
|
4926 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
4927 | - LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", |
|
4925 | + $this->getFullTableName('site_tmplvars')." tv |
|
4926 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
4927 | + LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", |
|
4928 | 4928 | "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
4929 | 4929 | |
4930 | 4930 | $result = $this->db->makeArray($rs); |
@@ -4974,16 +4974,16 @@ discard block |
||
4974 | 4974 | $output = array(); |
4975 | 4975 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames); |
4976 | 4976 | |
4977 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier; |
|
4977 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier; |
|
4978 | 4978 | // remove sort for speed |
4979 | 4979 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', ''); |
4980 | 4980 | |
4981 | 4981 | if ($result == false) { |
4982 | 4982 | return false; |
4983 | 4983 | } else { |
4984 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
4985 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
4986 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
4984 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
4985 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
4986 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
4987 | 4987 | |
4988 | 4988 | for ($i = 0; $i < count($result); $i++) { |
4989 | 4989 | $row = $result[$i]; |
@@ -5009,7 +5009,7 @@ discard block |
||
5009 | 5009 | */ |
5010 | 5010 | public function getFullTableName($tbl) |
5011 | 5011 | { |
5012 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
5012 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
5013 | 5013 | } |
5014 | 5014 | |
5015 | 5015 | /** |
@@ -5088,7 +5088,7 @@ discard block |
||
5088 | 5088 | public function getCachePath() |
5089 | 5089 | { |
5090 | 5090 | global $base_url; |
5091 | - $pth = $base_url . $this->getCacheFolder(); |
|
5091 | + $pth = $base_url.$this->getCacheFolder(); |
|
5092 | 5092 | |
5093 | 5093 | return $pth; |
5094 | 5094 | } |
@@ -5141,8 +5141,8 @@ discard block |
||
5141 | 5141 | $out = false; |
5142 | 5142 | |
5143 | 5143 | if (!empty($context)) { |
5144 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
5145 | - $out = $_SESSION[$context . 'InternalKey']; |
|
5144 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
5145 | + $out = $_SESSION[$context.'InternalKey']; |
|
5146 | 5146 | } |
5147 | 5147 | } else { |
5148 | 5148 | switch (true) { |
@@ -5171,8 +5171,8 @@ discard block |
||
5171 | 5171 | $out = false; |
5172 | 5172 | |
5173 | 5173 | if (!empty($context)) { |
5174 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
5175 | - $out = $_SESSION[$context . 'Shortname']; |
|
5174 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
5175 | + $out = $_SESSION[$context.'Shortname']; |
|
5176 | 5176 | } |
5177 | 5177 | } else { |
5178 | 5178 | switch (true) { |
@@ -5244,8 +5244,8 @@ discard block |
||
5244 | 5244 | */ |
5245 | 5245 | public function getWebUserInfo($uid) |
5246 | 5246 | { |
5247 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
5248 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", |
|
5247 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
5248 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", |
|
5249 | 5249 | "wu.id='{$uid}'"); |
5250 | 5250 | if ($row = $this->db->getRow($rs)) { |
5251 | 5251 | if (!isset($row['usertype']) or !$row["usertype"]) { |
@@ -5288,7 +5288,7 @@ discard block |
||
5288 | 5288 | // resolve ids to names |
5289 | 5289 | $dgn = array(); |
5290 | 5290 | $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), |
5291 | - "id IN (" . implode(",", $dg) . ")"); |
|
5291 | + "id IN (".implode(",", $dg).")"); |
|
5292 | 5292 | while ($row = $this->db->getRow($ds)) { |
5293 | 5293 | $dgn[] = $row['name']; |
5294 | 5294 | } |
@@ -5319,7 +5319,7 @@ discard block |
||
5319 | 5319 | $rt = false; |
5320 | 5320 | if ($_SESSION["webValidated"] == 1) { |
5321 | 5321 | $tbl = $this->getFullTableName("web_users"); |
5322 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5322 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
5323 | 5323 | if ($row = $this->db->getRow($ds)) { |
5324 | 5324 | if ($row["password"] == md5($oldPwd)) { |
5325 | 5325 | if (strlen($newPwd) < 6) { |
@@ -5329,7 +5329,7 @@ discard block |
||
5329 | 5329 | } else { |
5330 | 5330 | $this->db->update(array( |
5331 | 5331 | 'password' => $this->db->escape($newPwd), |
5332 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5332 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
5333 | 5333 | // invoke OnWebChangePassword event |
5334 | 5334 | $this->invokeEvent("OnWebChangePassword", array( |
5335 | 5335 | "userid" => $row["id"], |
@@ -5362,8 +5362,8 @@ discard block |
||
5362 | 5362 | // check cache |
5363 | 5363 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
5364 | 5364 | if (!is_array($grpNames)) { |
5365 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
5366 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
5365 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
5366 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
5367 | 5367 | $grpNames = $this->db->getColumn("name", $rs); |
5368 | 5368 | // save to cache |
5369 | 5369 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5397,7 +5397,7 @@ discard block |
||
5397 | 5397 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
5398 | 5398 | $this->sjscripts[$nextpos] = $src; |
5399 | 5399 | } else { |
5400 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
5400 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
5401 | 5401 | } |
5402 | 5402 | } |
5403 | 5403 | |
@@ -5424,7 +5424,7 @@ discard block |
||
5424 | 5424 | $src, |
5425 | 5425 | $options = array('name' => '', 'version' => '0', 'plaintext' => false), |
5426 | 5426 | $startup = false |
5427 | - ) { |
|
5427 | + ){ |
|
5428 | 5428 | if (empty($src)) { |
5429 | 5429 | return ''; |
5430 | 5430 | } // nothing to register |
@@ -5479,7 +5479,7 @@ discard block |
||
5479 | 5479 | } |
5480 | 5480 | |
5481 | 5481 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5482 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5482 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5483 | 5483 | } |
5484 | 5484 | if ($startup) { |
5485 | 5485 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5630,7 +5630,7 @@ discard block |
||
5630 | 5630 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, |
5631 | 5631 | $pluginName, $eventtime * 1000); |
5632 | 5632 | foreach ($parameter as $k => $v) { |
5633 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5633 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5634 | 5634 | } |
5635 | 5635 | $this->pluginsCode .= '</fieldset><br />'; |
5636 | 5636 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5659,14 +5659,14 @@ discard block |
||
5659 | 5659 | $plugin = array(); |
5660 | 5660 | if (isset ($this->pluginCache[$pluginName])) { |
5661 | 5661 | $pluginCode = $this->pluginCache[$pluginName]; |
5662 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5662 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5663 | 5663 | } else { |
5664 | 5664 | $pluginName = $this->db->escape($pluginName); |
5665 | 5665 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), |
5666 | 5666 | "name='{$pluginName}' AND disabled=0"); |
5667 | 5667 | if ($row = $this->db->getRow($result)) { |
5668 | 5668 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5669 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5669 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5670 | 5670 | } else { |
5671 | 5671 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5672 | 5672 | $pluginProperties = ''; |
@@ -5776,7 +5776,7 @@ discard block |
||
5776 | 5776 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
5777 | 5777 | { |
5778 | 5778 | $params = array(); |
5779 | - $fullpath = $element_dir . '/' . $filename; |
|
5779 | + $fullpath = $element_dir.'/'.$filename; |
|
5780 | 5780 | if (is_readable($fullpath)) { |
5781 | 5781 | $tpl = @fopen($fullpath, "r"); |
5782 | 5782 | if ($tpl) { |
@@ -5888,7 +5888,7 @@ discard block |
||
5888 | 5888 | $name_found, |
5889 | 5889 | $description_found, |
5890 | 5890 | $docblock_end_found |
5891 | - ) { |
|
5891 | + ){ |
|
5892 | 5892 | $param = ''; |
5893 | 5893 | $val = ''; |
5894 | 5894 | $ma = null; |
@@ -5953,8 +5953,8 @@ discard block |
||
5953 | 5953 | $ph = array('site_url' => MODX_SITE_URL); |
5954 | 5954 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
5955 | 5955 | $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i'; |
5956 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
5957 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
5956 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
5957 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
5958 | 5958 | foreach ($parsed as $key => $val) { |
5959 | 5959 | if (is_array($val)) { |
5960 | 5960 | foreach ($val as $key2 => $val2) { |
@@ -5964,7 +5964,7 @@ discard block |
||
5964 | 5964 | $val2); |
5965 | 5965 | } |
5966 | 5966 | if (preg_match($regexEmail, $val2, $url)) { |
5967 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
5967 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
5968 | 5968 | } |
5969 | 5969 | $parsed[$key][$key2] = $val2; |
5970 | 5970 | } |
@@ -5974,7 +5974,7 @@ discard block |
||
5974 | 5974 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
5975 | 5975 | } |
5976 | 5976 | if (preg_match($regexEmail, $val, $url)) { |
5977 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
5977 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
5978 | 5978 | } |
5979 | 5979 | $parsed[$key] = $val; |
5980 | 5980 | } |
@@ -5988,33 +5988,33 @@ discard block |
||
5988 | 5988 | ); |
5989 | 5989 | |
5990 | 5990 | $nl = "\n"; |
5991 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], |
|
5992 | - "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
5993 | - $list .= '<p>' . $nl; |
|
5994 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
5995 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
5996 | - $list .= '</p><br/>' . $nl; |
|
5997 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
5998 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
5999 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
6000 | - $list .= '<br/>' . $nl; |
|
5991 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], |
|
5992 | + "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
5993 | + $list .= '<p>'.$nl; |
|
5994 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
5995 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
5996 | + $list .= '</p><br/>'.$nl; |
|
5997 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
5998 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
5999 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
6000 | + $list .= '<br/>'.$nl; |
|
6001 | 6001 | $first = true; |
6002 | 6002 | foreach ($arrayParams as $param => $label) { |
6003 | 6003 | if (isset($parsed[$param])) { |
6004 | 6004 | if ($first) { |
6005 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
6006 | - $list .= '<ul class="docBlockList">' . $nl; |
|
6005 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
6006 | + $list .= '<ul class="docBlockList">'.$nl; |
|
6007 | 6007 | $first = false; |
6008 | 6008 | } |
6009 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
6010 | - $list .= ' <ul>' . $nl; |
|
6009 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
6010 | + $list .= ' <ul>'.$nl; |
|
6011 | 6011 | foreach ($parsed[$param] as $val) { |
6012 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
6012 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
6013 | 6013 | } |
6014 | - $list .= ' </ul></li>' . $nl; |
|
6014 | + $list .= ' </ul></li>'.$nl; |
|
6015 | 6015 | } |
6016 | 6016 | } |
6017 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
6017 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
6018 | 6018 | |
6019 | 6019 | return $list; |
6020 | 6020 | } |
@@ -6092,7 +6092,7 @@ discard block |
||
6092 | 6092 | */ |
6093 | 6093 | public function addSnippet($name, $phpCode) |
6094 | 6094 | { |
6095 | - $this->snippetCache['#' . $name] = $phpCode; |
|
6095 | + $this->snippetCache['#'.$name] = $phpCode; |
|
6096 | 6096 | } |
6097 | 6097 | |
6098 | 6098 | /** |
@@ -6101,7 +6101,7 @@ discard block |
||
6101 | 6101 | */ |
6102 | 6102 | public function addChunk($name, $text) |
6103 | 6103 | { |
6104 | - $this->chunkCache['#' . $name] = $text; |
|
6104 | + $this->chunkCache['#'.$name] = $text; |
|
6105 | 6105 | } |
6106 | 6106 | |
6107 | 6107 | /** |
@@ -6137,7 +6137,7 @@ discard block |
||
6137 | 6137 | } |
6138 | 6138 | |
6139 | 6139 | if (!$isSafe) { |
6140 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
6140 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
6141 | 6141 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
6142 | 6142 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
6143 | 6143 | |
@@ -6152,7 +6152,7 @@ discard block |
||
6152 | 6152 | return 'array()'; |
6153 | 6153 | } |
6154 | 6154 | |
6155 | - $output = $echo . $return; |
|
6155 | + $output = $echo.$return; |
|
6156 | 6156 | modx_sanitize_gpc($output); |
6157 | 6157 | |
6158 | 6158 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
@@ -6171,8 +6171,8 @@ discard block |
||
6171 | 6171 | |
6172 | 6172 | $safe = explode(',', $safe_functions); |
6173 | 6173 | |
6174 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
6175 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
6174 | + $phpcode = rtrim($phpcode, ';').';'; |
|
6175 | + $tokens = token_get_all('<?php '.$phpcode); |
|
6176 | 6176 | foreach ($tokens as $i => $token) { |
6177 | 6177 | if (!is_array($token)) { |
6178 | 6178 | continue; |
@@ -6213,7 +6213,7 @@ discard block |
||
6213 | 6213 | 'assets/tvs/', |
6214 | 6214 | 'assets/chunks/', |
6215 | 6215 | 'assets/templates/', |
6216 | - $this->config['rb_base_url'] . 'files/', |
|
6216 | + $this->config['rb_base_url'].'files/', |
|
6217 | 6217 | '' |
6218 | 6218 | ); |
6219 | 6219 | |
@@ -6238,7 +6238,7 @@ discard block |
||
6238 | 6238 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
6239 | 6239 | |
6240 | 6240 | foreach ($search_path as $path) { |
6241 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
6241 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
6242 | 6242 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
6243 | 6243 | return $errorMsg; |
6244 | 6244 | } elseif (is_file($file_path)) { |
@@ -6252,7 +6252,7 @@ discard block |
||
6252 | 6252 | return $errorMsg; |
6253 | 6253 | } |
6254 | 6254 | |
6255 | - $content = (string)file_get_contents($file_path); |
|
6255 | + $content = (string) file_get_contents($file_path); |
|
6256 | 6256 | if ($content === false) { |
6257 | 6257 | return $errorMsg; |
6258 | 6258 | } |
@@ -6354,7 +6354,7 @@ discard block |
||
6354 | 6354 | $text = '', |
6355 | 6355 | $line = '', |
6356 | 6356 | $output = '' |
6357 | - ) { |
|
6357 | + ){ |
|
6358 | 6358 | |
6359 | 6359 | if (0 < $this->messageQuitCount) { |
6360 | 6360 | return; |
@@ -6374,22 +6374,22 @@ discard block |
||
6374 | 6374 | |
6375 | 6375 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
6376 | 6376 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
6377 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
6377 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
6378 | 6378 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
6379 | 6379 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
6380 | 6380 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
6381 | 6381 | if ($is_error) { |
6382 | 6382 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
6383 | 6383 | if ($msg != 'PHP Parse Error') { |
6384 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
6384 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
6385 | 6385 | } |
6386 | 6386 | } else { |
6387 | 6387 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
6388 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
6388 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
6389 | 6389 | } |
6390 | 6390 | |
6391 | 6391 | if (!empty ($query)) { |
6392 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">' . $query . '</span></div>'; |
|
6392 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">'.$query.'</span></div>'; |
|
6393 | 6393 | } |
6394 | 6394 | |
6395 | 6395 | $errortype = array( |
@@ -6412,13 +6412,13 @@ discard block |
||
6412 | 6412 | |
6413 | 6413 | if (!empty($nr) || !empty($file)) { |
6414 | 6414 | if ($text != '') { |
6415 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
6415 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
6416 | 6416 | } |
6417 | 6417 | if ($output != '') { |
6418 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
6418 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
6419 | 6419 | } |
6420 | 6420 | if ($nr !== '') { |
6421 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
6421 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
6422 | 6422 | } |
6423 | 6423 | if ($file) { |
6424 | 6424 | $table[] = array('File', $file); |
@@ -6438,7 +6438,7 @@ discard block |
||
6438 | 6438 | } |
6439 | 6439 | |
6440 | 6440 | if (!empty($this->event->activePlugin)) { |
6441 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
6441 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
6442 | 6442 | } |
6443 | 6443 | |
6444 | 6444 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6448,11 +6448,11 @@ discard block |
||
6448 | 6448 | $table[] = array('REQUEST_URI', $request_uri); |
6449 | 6449 | |
6450 | 6450 | if ($this->manager->action) { |
6451 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
6451 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
6452 | 6452 | global $action_list; |
6453 | 6453 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
6454 | 6454 | |
6455 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
6455 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
6456 | 6456 | } |
6457 | 6457 | |
6458 | 6458 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
@@ -6460,7 +6460,7 @@ discard block |
||
6460 | 6460 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
6461 | 6461 | $table[] = array( |
6462 | 6462 | 'Resource', |
6463 | - '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>' |
|
6463 | + '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>' |
|
6464 | 6464 | ); |
6465 | 6465 | } |
6466 | 6466 | $table[] = array('Referer', $referer); |
@@ -6485,7 +6485,7 @@ discard block |
||
6485 | 6485 | |
6486 | 6486 | $mem = memory_get_peak_usage(true); |
6487 | 6487 | $total_mem = $mem - $this->mstart; |
6488 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
6488 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
6489 | 6489 | |
6490 | 6490 | $queryTime = $this->queryTime; |
6491 | 6491 | $phpTime = $totalTime - $queryTime; |
@@ -6506,18 +6506,18 @@ discard block |
||
6506 | 6506 | $str .= $this->get_backtrace(debug_backtrace()); |
6507 | 6507 | // Log error |
6508 | 6508 | if (!empty($this->currentSnippet)) { |
6509 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
6509 | + $source = 'Snippet - '.$this->currentSnippet; |
|
6510 | 6510 | } elseif (!empty($this->event->activePlugin)) { |
6511 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
6511 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
6512 | 6512 | } elseif ($source !== '') { |
6513 | - $source = 'Parser - ' . $source; |
|
6513 | + $source = 'Parser - '.$source; |
|
6514 | 6514 | } elseif ($query !== '') { |
6515 | 6515 | $source = 'SQL Query'; |
6516 | 6516 | } else { |
6517 | 6517 | $source = 'Parser'; |
6518 | 6518 | } |
6519 | 6519 | if ($msg) { |
6520 | - $source .= ' / ' . $msg; |
|
6520 | + $source .= ' / '.$msg; |
|
6521 | 6521 | } |
6522 | 6522 | if (isset($actionName) && !empty($actionName)) { |
6523 | 6523 | $source .= $actionName; |
@@ -6549,12 +6549,12 @@ discard block |
||
6549 | 6549 | |
6550 | 6550 | // Display error |
6551 | 6551 | if (isset($_SESSION['mgrValidated'])) { |
6552 | - echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' » ' . $release_date . '</title> |
|
6552 | + echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' » '.$release_date.'</title> |
|
6553 | 6553 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6554 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
6554 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
6555 | 6555 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
6556 | 6556 | </head><body> |
6557 | - ' . $str . '</body></html>'; |
|
6557 | + ' . $str.'</body></html>'; |
|
6558 | 6558 | |
6559 | 6559 | } else { |
6560 | 6560 | echo 'Error'; |
@@ -6592,7 +6592,7 @@ discard block |
||
6592 | 6592 | switch ($val['type']) { |
6593 | 6593 | case '->': |
6594 | 6594 | case '::': |
6595 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
6595 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
6596 | 6596 | break; |
6597 | 6597 | default: |
6598 | 6598 | $functionName = $val['function']; |
@@ -6602,7 +6602,7 @@ discard block |
||
6602 | 6602 | $args = array_pad(array(), $_, '$var'); |
6603 | 6603 | $args = implode(", ", $args); |
6604 | 6604 | $modx = &$this; |
6605 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6605 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
6606 | 6606 | $arg = $val['args'][$tmp - 1]; |
6607 | 6607 | switch (true) { |
6608 | 6608 | case is_null($arg): { |
@@ -6614,8 +6614,8 @@ discard block |
||
6614 | 6614 | break; |
6615 | 6615 | } |
6616 | 6616 | case is_scalar($arg): { |
6617 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", |
|
6618 | - "\\'", $arg)) . "'"); |
|
6617 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", |
|
6618 | + "\\'", $arg))."'"); |
|
6619 | 6619 | break; |
6620 | 6620 | } |
6621 | 6621 | case is_bool($arg): { |
@@ -6623,15 +6623,15 @@ discard block |
||
6623 | 6623 | break; |
6624 | 6624 | } |
6625 | 6625 | case is_array($arg): { |
6626 | - $out = 'array $var' . $tmp; |
|
6626 | + $out = 'array $var'.$tmp; |
|
6627 | 6627 | break; |
6628 | 6628 | } |
6629 | 6629 | case is_object($arg): { |
6630 | - $out = get_class($arg) . ' $var' . $tmp; |
|
6630 | + $out = get_class($arg).' $var'.$tmp; |
|
6631 | 6631 | break; |
6632 | 6632 | } |
6633 | 6633 | default: { |
6634 | - $out = '$var' . $tmp; |
|
6634 | + $out = '$var'.$tmp; |
|
6635 | 6635 | } |
6636 | 6636 | } |
6637 | 6637 | $tmp++; |
@@ -6639,8 +6639,8 @@ discard block |
||
6639 | 6639 | return $out; |
6640 | 6640 | }, $args); |
6641 | 6641 | $line = array( |
6642 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
6643 | - $path . " on line " . $val['line'] |
|
6642 | + "<strong>".$functionName."</strong>(".$args.")", |
|
6643 | + $path." on line ".$val['line'] |
|
6644 | 6644 | ); |
6645 | 6645 | $table[] = array(implode("<br />", $line)); |
6646 | 6646 | } |
@@ -6682,7 +6682,7 @@ discard block |
||
6682 | 6682 | $alias = strip_tags($alias); // strip HTML |
6683 | 6683 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
6684 | 6684 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
6685 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6685 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6686 | 6686 | $alias = trim($alias, '-'); // trim excess |
6687 | 6687 | |
6688 | 6688 | return $alias; |
@@ -6699,7 +6699,7 @@ discard block |
||
6699 | 6699 | $precisions = count($sizes) - 1; |
6700 | 6700 | foreach ($sizes as $unit => $bytes) { |
6701 | 6701 | if ($size >= $bytes) { |
6702 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
6702 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
6703 | 6703 | } |
6704 | 6704 | $precisions--; |
6705 | 6705 | } |
@@ -6805,10 +6805,10 @@ discard block |
||
6805 | 6805 | |
6806 | 6806 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
6807 | 6807 | return false; |
6808 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
6809 | - $file_path = MODX_BASE_PATH . $str; |
|
6810 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
6811 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
6808 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
6809 | + $file_path = MODX_BASE_PATH.$str; |
|
6810 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
6811 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
6812 | 6812 | } else { |
6813 | 6813 | return false; |
6814 | 6814 | } |
@@ -6938,7 +6938,7 @@ discard block |
||
6938 | 6938 | $title = 'no title'; |
6939 | 6939 | } |
6940 | 6940 | if (is_array($msg)) { |
6941 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6941 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6942 | 6942 | } elseif ($msg === '') { |
6943 | 6943 | $msg = $_SERVER['REQUEST_URI']; |
6944 | 6944 | } |
@@ -6983,7 +6983,7 @@ discard block |
||
6983 | 6983 | if (is_array($SystemAlertMsgQueque)) { |
6984 | 6984 | $title = ''; |
6985 | 6985 | if ($this->name && $this->activePlugin) { |
6986 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
6986 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
6987 | 6987 | } |
6988 | 6988 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
6989 | 6989 | } |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | class DATEPICKER { |
4 | - function __construct() { |
|
5 | - } |
|
4 | + function __construct() { |
|
5 | + } |
|
6 | 6 | |
7 | - function getDP() { |
|
8 | - $modx = evolutionCMS(); global $_lang; |
|
7 | + function getDP() { |
|
8 | + $modx = evolutionCMS(); global $_lang; |
|
9 | 9 | |
10 | - $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
11 | - return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
12 | - } |
|
10 | + $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
11 | + return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
12 | + } |
|
13 | 13 | } |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class DATEPICKER { |
|
4 | - function __construct() { |
|
3 | +class DATEPICKER{ |
|
4 | + function __construct(){ |
|
5 | 5 | } |
6 | 6 | |
7 | - function getDP() { |
|
7 | + function getDP(){ |
|
8 | 8 | $modx = evolutionCMS(); global $_lang; |
9 | 9 | |
10 | - $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
10 | + $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
|
11 | 11 | return $modx->parseText($tpl, $_lang, '[%', '%]'); |
12 | 12 | } |
13 | 13 | } |
@@ -1,10 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class DATEPICKER { |
|
4 | - function __construct() { |
|
3 | +class DATEPICKER |
|
4 | +{ |
|
5 | + function __construct() |
|
6 | + { |
|
5 | 7 | } |
6 | 8 | |
7 | - function getDP() { |
|
9 | + function getDP() |
|
10 | + { |
|
8 | 11 | $modx = evolutionCMS(); global $_lang; |
9 | 12 | |
10 | 13 | $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
3 | - function __construct() { |
|
2 | +class DATEPICKER{ |
|
3 | + function __construct(){ |
|
4 | 4 | } |
5 | - function getDP() { |
|
5 | + function getDP(){ |
|
6 | 6 | $modx = evolutionCMS(); global$_lang; |
7 | 7 | |
8 | 8 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
9 | - return $modx->parseText($tpl,$_lang,'[%','%]'); |
|
9 | + return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
10 | 10 | } |
11 | 11 | } |
@@ -1,8 +1,11 @@ |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
3 | - function __construct() { |
|
2 | +class DATEPICKER |
|
3 | +{ |
|
4 | + function __construct() |
|
5 | + { |
|
4 | 6 | } |
5 | - function getDP() { |
|
7 | + function getDP() |
|
8 | + { |
|
6 | 9 | $modx = evolutionCMS(); global$_lang; |
7 | 10 | |
8 | 11 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
@@ -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 ********/ |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | $udperms->role = $_SESSION['mgrRole']; |
33 | 33 | |
34 | 34 | if(!$udperms->checkPermissions()) { |
35 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
35 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // get the timestamp on which the document was deleted. |
39 | 39 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
40 | 40 | $deltime = $modx->db->getValue($rs); |
41 | 41 | if(!$deltime) { |
42 | - $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
42 | + $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $children = array(); |
@@ -49,36 +49,36 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function getChildren($parent) { |
51 | 51 | |
52 | - $modx = evolutionCMS(); |
|
53 | - global $children; |
|
54 | - global $deltime; |
|
55 | - |
|
56 | - $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='".(int)$parent."' AND deleted=1 AND deletedon='".(int)$deltime."'"); |
|
57 | - // the document has children documents, we'll need to delete those too |
|
58 | - while ($row=$modx->db->getRow($rs)) { |
|
59 | - $children[] = $row['id']; |
|
60 | - getChildren($row['id']); |
|
61 | - //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
|
62 | - } |
|
52 | + $modx = evolutionCMS(); |
|
53 | + global $children; |
|
54 | + global $deltime; |
|
55 | + |
|
56 | + $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='".(int)$parent."' AND deleted=1 AND deletedon='".(int)$deltime."'"); |
|
57 | + // the document has children documents, we'll need to delete those too |
|
58 | + while ($row=$modx->db->getRow($rs)) { |
|
59 | + $children[] = $row['id']; |
|
60 | + getChildren($row['id']); |
|
61 | + //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
|
62 | + } |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | getChildren($id); |
66 | 66 | |
67 | 67 | if(count($children)>0) { |
68 | - $modx->db->update( |
|
69 | - array( |
|
70 | - 'deleted' => 0, |
|
71 | - 'deletedby' => 0, |
|
72 | - 'deletedon' => 0, |
|
73 | - ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
68 | + $modx->db->update( |
|
69 | + array( |
|
70 | + 'deleted' => 0, |
|
71 | + 'deletedby' => 0, |
|
72 | + 'deletedon' => 0, |
|
73 | + ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
74 | 74 | } |
75 | 75 | //'undelete' the document. |
76 | 76 | $modx->db->update( |
77 | - array( |
|
78 | - 'deleted' => 0, |
|
79 | - 'deletedby' => 0, |
|
80 | - 'deletedon' => 0, |
|
81 | - ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
77 | + array( |
|
78 | + 'deleted' => 0, |
|
79 | + 'deletedby' => 0, |
|
80 | + 'deletedon' => 0, |
|
81 | + ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
82 | 82 | |
83 | 83 | $modx->invokeEvent("OnDocFormUnDelete", |
84 | 84 | array( |
@@ -1,44 +1,44 @@ 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->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
15 | +$content = $modx->db->getRow($modx->db->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 | |
26 | 26 | |
27 | 27 | // check permissions on the document |
28 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
28 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
29 | 29 | $udperms = new udperms(); |
30 | 30 | $udperms->user = $modx->getLoginUserID(); |
31 | 31 | $udperms->document = $id; |
32 | 32 | $udperms->role = $_SESSION['mgrRole']; |
33 | 33 | |
34 | -if(!$udperms->checkPermissions()) { |
|
34 | +if (!$udperms->checkPermissions()) { |
|
35 | 35 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
36 | 36 | } |
37 | 37 | |
38 | 38 | // get the timestamp on which the document was deleted. |
39 | 39 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
40 | 40 | $deltime = $modx->db->getValue($rs); |
41 | -if(!$deltime) { |
|
41 | +if (!$deltime) { |
|
42 | 42 | $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
43 | 43 | } |
44 | 44 | |
@@ -47,15 +47,15 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * @param int $parent |
49 | 49 | */ |
50 | -function getChildren($parent) { |
|
50 | +function getChildren($parent){ |
|
51 | 51 | |
52 | 52 | $modx = evolutionCMS(); |
53 | 53 | global $children; |
54 | 54 | global $deltime; |
55 | 55 | |
56 | - $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='".(int)$parent."' AND deleted=1 AND deletedon='".(int)$deltime."'"); |
|
56 | + $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='".(int) $parent."' AND deleted=1 AND deletedon='".(int) $deltime."'"); |
|
57 | 57 | // the document has children documents, we'll need to delete those too |
58 | - while ($row=$modx->db->getRow($rs)) { |
|
58 | + while ($row = $modx->db->getRow($rs)) { |
|
59 | 59 | $children[] = $row['id']; |
60 | 60 | getChildren($row['id']); |
61 | 61 | //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | getChildren($id); |
66 | 66 | |
67 | -if(count($children)>0) { |
|
67 | +if (count($children) > 0) { |
|
68 | 68 | $modx->db->update( |
69 | 69 | array( |
70 | 70 | 'deleted' => 0, |
@@ -93,5 +93,5 @@ discard block |
||
93 | 93 | $modx->clearCache('full'); |
94 | 94 | |
95 | 95 | // finished emptying cache - redirect |
96 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
96 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
97 | 97 | header($header); |
@@ -47,7 +47,8 @@ |
||
47 | 47 | /** |
48 | 48 | * @param int $parent |
49 | 49 | */ |
50 | -function getChildren($parent) { |
|
50 | +function getChildren($parent) |
|
51 | +{ |
|
51 | 52 | |
52 | 53 | $modx = evolutionCMS(); |
53 | 54 | global $children; |
@@ -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_plugin')) { |
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->db->escape(trim($_POST['name'])); |
11 | 11 | $description = $modx->db->escape($_POST['description']); |
12 | 12 | $locked = $_POST['locked'] == 'on' ? '1' : '0'; |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | |
21 | 21 | //Kyle Jaebker - added category support |
22 | 22 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
23 | - $categoryid = (int)$_POST['categoryid']; |
|
23 | + $categoryid = (int) $_POST['categoryid']; |
|
24 | 24 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
25 | 25 | $categoryid = 0; |
26 | 26 | } else { |
27 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
27 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
28 | 28 | $categoryid = getCategory($_POST['newcategory']); |
29 | 29 | } |
30 | 30 | |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid; |
41 | 41 | |
42 | 42 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
43 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
43 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
44 | 44 | if ($version) { |
45 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
45 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
46 | 46 | } |
47 | 47 | if (isset($parsed['modx_category'])) { |
48 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
48 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
49 | 49 | $categoryid = getCategory($parsed['modx_category']); |
50 | 50 | } |
51 | 51 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | // finished emptying cache - redirect |
104 | 104 | if ($_POST['stay'] != '') { |
105 | 105 | $a = ($_POST['stay'] == '2') ? "102&id=$newid" : '101'; |
106 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
106 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
107 | 107 | header($header); |
108 | 108 | } else { |
109 | 109 | $header = 'Location: index.php?a=76&r=2'; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | // finished emptying cache - redirect |
159 | 159 | if ($_POST['stay'] != '') { |
160 | 160 | $a = ($_POST['stay'] == '2') ? "102&id=$id" : '101'; |
161 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
161 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
162 | 162 | header($header); |
163 | 163 | } else { |
164 | 164 | $modx->unlockElement(5, $id); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | // save selected system events |
178 | 178 | $formEventList = array(); |
179 | 179 | foreach ($sysevents as $evtId) { |
180 | - if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId); |
|
180 | + if (!preg_match('@^[1-9][0-9]*$@', $evtId)) $evtId = getEventIdByName($evtId); |
|
181 | 181 | if ($mode == '101') { |
182 | 182 | $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'"); |
183 | 183 | } else { |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | $rs = $modx->db->select('*', '[+prefix+]site_plugin_events', sprintf("pluginid='%s'", $id)); |
203 | 203 | $dbEventList = array(); |
204 | 204 | $del = array(); |
205 | - while($row = $modx->db->getRow($rs)) { |
|
206 | - if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
205 | + while ($row = $modx->db->getRow($rs)) { |
|
206 | + if (!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
207 | 207 | } |
208 | 208 | |
209 | - if(empty($del)) return; |
|
209 | + if (empty($del)) return; |
|
210 | 210 | |
211 | - foreach($del as $delid) { |
|
211 | + foreach ($del as $delid) { |
|
212 | 212 | $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id)); |
213 | 213 | } |
214 | 214 | } |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | function getEventIdByName($name) |
221 | 221 | { |
222 | 222 | $modx = evolutionCMS(); |
223 | - static $eventIds=array(); |
|
223 | + static $eventIds = array(); |
|
224 | 224 | |
225 | - if(isset($eventIds[$name])) return $eventIds[$name]; |
|
225 | + if (isset($eventIds[$name])) return $eventIds[$name]; |
|
226 | 226 | |
227 | 227 | $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames'); |
228 | 228 | while ($row = $modx->db->getRow($rs)) { |
@@ -177,7 +177,9 @@ discard block |
||
177 | 177 | // save selected system events |
178 | 178 | $formEventList = array(); |
179 | 179 | foreach ($sysevents as $evtId) { |
180 | - if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId); |
|
180 | + if(!preg_match('@^[1-9][0-9]*$@',$evtId)) { |
|
181 | + $evtId = getEventIdByName($evtId); |
|
182 | + } |
|
181 | 183 | if ($mode == '101') { |
182 | 184 | $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'"); |
183 | 185 | } else { |
@@ -203,10 +205,14 @@ discard block |
||
203 | 205 | $dbEventList = array(); |
204 | 206 | $del = array(); |
205 | 207 | while($row = $modx->db->getRow($rs)) { |
206 | - if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
208 | + if(!in_array($row['evtid'], $evtids)) { |
|
209 | + $del[] = $row['evtid']; |
|
210 | + } |
|
207 | 211 | } |
208 | 212 | |
209 | - if(empty($del)) return; |
|
213 | + if(empty($del)) { |
|
214 | + return; |
|
215 | + } |
|
210 | 216 | |
211 | 217 | foreach($del as $delid) { |
212 | 218 | $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id)); |
@@ -222,7 +228,9 @@ discard block |
||
222 | 228 | $modx = evolutionCMS(); |
223 | 229 | static $eventIds=array(); |
224 | 230 | |
225 | - if(isset($eventIds[$name])) return $eventIds[$name]; |
|
231 | + if(isset($eventIds[$name])) { |
|
232 | + return $eventIds[$name]; |
|
233 | + } |
|
226 | 234 | |
227 | 235 | $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames'); |
228 | 236 | while ($row = $modx->db->getRow($rs)) { |