@@ -82,7 +82,8 @@ discard block |
||
82 | 82 | * @return string |
83 | 83 | */ |
84 | 84 | public function getParents($id, $path = '') |
85 | - { // modx:returns child's parent |
|
85 | + { |
|
86 | +// modx:returns child's parent |
|
86 | 87 | $modx = evolutionCMS(); |
87 | 88 | if (empty($this->aliases)) { |
88 | 89 | $rs = $modx->getDatabase()->select( |
@@ -481,7 +482,8 @@ discard block |
||
481 | 482 | $_ = trim($_); |
482 | 483 | } |
483 | 484 | $lastChar = substr($_, -1); |
484 | - if (!in_array($lastChar, $chars)) {// ,320,327,288,284,289 |
|
485 | + if (!in_array($lastChar, $chars)) { |
|
486 | +// ,320,327,288,284,289 |
|
485 | 487 | if (!in_array($prev_token, |
486 | 488 | array(T_FOREACH, T_WHILE, T_FOR, T_BOOLEAN_AND, T_BOOLEAN_OR, T_DOUBLE_ARROW))) { |
487 | 489 | $_ .= ' '; |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php namespace EvolutionCMS\Legacy; |
2 | 2 | |
3 | -class mgrResources { |
|
3 | +class mgrResources |
|
4 | +{ |
|
4 | 5 | /** |
5 | 6 | * @var array |
6 | 7 | */ |
@@ -21,7 +22,8 @@ discard block |
||
21 | 22 | /** |
22 | 23 | * mgrResources constructor. |
23 | 24 | */ |
24 | - public function __construct() { |
|
25 | + public function __construct() |
|
26 | + { |
|
25 | 27 | $this->setTypes(); |
26 | 28 | $this->queryItemsFromDB(); |
27 | 29 | $this->prepareCategoryArrays(); |
@@ -30,7 +32,8 @@ discard block |
||
30 | 32 | /** |
31 | 33 | * @return void |
32 | 34 | */ |
33 | - public function setTypes() { |
|
35 | + public function setTypes() |
|
36 | + { |
|
34 | 37 | global $_lang; |
35 | 38 | $this->types['site_templates'] = array( |
36 | 39 | 'title'=>$_lang["manage_templates"], |
@@ -68,7 +71,8 @@ discard block |
||
68 | 71 | /** |
69 | 72 | * @return void |
70 | 73 | */ |
71 | - public function queryItemsFromDB() { |
|
74 | + public function queryItemsFromDB() |
|
75 | + { |
|
72 | 76 | foreach($this->types as $resourceTable=>$type) { |
73 | 77 | if($this->hasAnyPermissions($type['permissions'])) { |
74 | 78 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
@@ -81,11 +85,13 @@ discard block |
||
81 | 85 | * @param array $permissions |
82 | 86 | * @return bool |
83 | 87 | */ |
84 | - public function hasAnyPermissions($permissions) { |
|
88 | + public function hasAnyPermissions($permissions) |
|
89 | + { |
|
85 | 90 | $modx = evolutionCMS(); |
86 | 91 | |
87 | - foreach($permissions as $p) |
|
88 | - if($modx->hasPermission($p)) return true; |
|
92 | + foreach($permissions as $p) { |
|
93 | + if($modx->hasPermission($p)) return true; |
|
94 | + } |
|
89 | 95 | |
90 | 96 | return false; |
91 | 97 | } |
@@ -95,7 +101,8 @@ discard block |
||
95 | 101 | * @param string $nameField |
96 | 102 | * @return array|bool |
97 | 103 | */ |
98 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
104 | + public function queryResources($resourceTable, $nameField = 'name') |
|
105 | + { |
|
99 | 106 | $modx = evolutionCMS(); global $_lang; |
100 | 107 | |
101 | 108 | $allowed = array( |
@@ -112,8 +119,9 @@ discard block |
||
112 | 119 | $tvsql = 'site_tmplvars.caption, '; |
113 | 120 | $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getDatabase()->getFullTableName('site_tmplvar_templates')); |
114 | 121 | $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
122 | + } else { |
|
123 | + $sttfield = ''; |
|
115 | 124 | } |
116 | - else $sttfield = ''; |
|
117 | 125 | |
118 | 126 | $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
119 | 127 | |
@@ -126,7 +134,9 @@ discard block |
||
126 | 134 | ); |
127 | 135 | $limit = $modx->getDatabase()->getRecordCount($rs); |
128 | 136 | |
129 | - if($limit < 1) return false; |
|
137 | + if($limit < 1) { |
|
138 | + return false; |
|
139 | + } |
|
130 | 140 | |
131 | 141 | $result = array(); |
132 | 142 | while ($row = $modx->getDatabase()->getRow($rs)) { |
@@ -138,7 +148,8 @@ discard block |
||
138 | 148 | /** |
139 | 149 | * @return void |
140 | 150 | */ |
141 | - public function prepareCategoryArrays() { |
|
151 | + public function prepareCategoryArrays() |
|
152 | + { |
|
142 | 153 | foreach($this->items as $type=>$items) { |
143 | 154 | foreach((array)$items as $item) { |
144 | 155 | $catid = $item['catid'] ? $item['catid'] : 0; |
@@ -154,7 +165,7 @@ discard block |
||
154 | 165 | |
155 | 166 | // Now sort by name |
156 | 167 | foreach($this->itemsPerCategory as $catid=>$items) { |
157 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
168 | + usort($this->itemsPerCategory[$catid], function ($a, $b){ |
|
158 | 169 | return strcasecmp($a['name'], $b['name']); |
159 | 170 | }); |
160 | 171 | } |
@@ -384,10 +384,12 @@ |
||
384 | 384 | $failedlogins += 1; |
385 | 385 | |
386 | 386 | $fields = array('failedlogincount' => $failedlogins); |
387 | - if ($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
387 | + if ($failedlogins >= $failed_allowed) { |
|
388 | + //block user for too many fail attempts |
|
388 | 389 | { |
389 | 390 | $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
390 | 391 | } |
392 | + } |
|
391 | 393 | |
392 | 394 | $modx->getDatabase()->update( |
393 | 395 | $fields, |
@@ -5,11 +5,14 @@ discard block |
||
5 | 5 | $groupNames = ($this->strlen($opt) > 0 ) ? explode(',',$opt) : array(); |
6 | 6 | |
7 | 7 | // if $groupNames is not an array return false |
8 | -if(!is_array($groupNames)) return 0; |
|
8 | +if(!is_array($groupNames)) { |
|
9 | + return 0; |
|
10 | +} |
|
9 | 11 | |
10 | 12 | // Creates an array with all webgroups the user id is in |
11 | -if (isset($modx->getModifiers()->cache['mo'][$userID])) $grpNames = $modx->getModifiers()->cache['mo'][$userID]; |
|
12 | -else { |
|
13 | +if (isset($modx->getModifiers()->cache['mo'][$userID])) { |
|
14 | + $grpNames = $modx->getModifiers()->cache['mo'][$userID]; |
|
15 | +} else { |
|
13 | 16 | $from = sprintf( |
14 | 17 | $modx->getDatabase()->getFullTableName('webgroup_names') . |
15 | 18 | " wgn INNER JOIN " . |
@@ -24,8 +27,10 @@ discard block |
||
24 | 27 | |
25 | 28 | // Check if a supplied group matches a webgroup from the array we just created |
26 | 29 | foreach($groupNames as $k=>$v) { |
27 | - if(in_array(trim($v),$grpNames)) return 1; |
|
28 | -} |
|
30 | + if(in_array(trim($v),$grpNames)) { |
|
31 | + return 1; |
|
32 | + } |
|
33 | + } |
|
29 | 34 | |
30 | 35 | // If we get here the above logic did not find a match, so return false |
31 | 36 | return 0; |