@@ -50,17 +50,23 @@ discard block |
||
50 | 50 | include_once($autoloader); |
51 | 51 | } |
52 | 52 | |
53 | -if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
|
53 | +if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) { |
|
54 | + $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
|
55 | +} |
|
54 | 56 | |
55 | 57 | $base_path = str_replace('\\','/',dirname(__FILE__)) . '/'; |
56 | -if(is_file($base_path . 'assets/cache/siteManager.php')) |
|
58 | +if(is_file($base_path . 'assets/cache/siteManager.php')) { |
|
57 | 59 | include_once($base_path . 'assets/cache/siteManager.php'); |
58 | -if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) |
|
60 | +} |
|
61 | +if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) { |
|
59 | 62 | define('MGR_DIR', 'manager'); |
60 | -if(is_file($base_path . 'assets/cache/siteHostnames.php')) |
|
63 | +} |
|
64 | +if(is_file($base_path . 'assets/cache/siteHostnames.php')) { |
|
61 | 65 | include_once($base_path . 'assets/cache/siteHostnames.php'); |
62 | -if(!defined('MODX_SITE_HOSTNAMES')) |
|
66 | +} |
|
67 | +if(!defined('MODX_SITE_HOSTNAMES')) { |
|
63 | 68 | define('MODX_SITE_HOSTNAMES', ''); |
69 | +} |
|
64 | 70 | |
65 | 71 | // get start time |
66 | 72 | $mstart = memory_get_usage(); |
@@ -129,7 +135,7 @@ discard block |
||
129 | 135 | @ini_set("display_errors","0"); |
130 | 136 | } |
131 | 137 | |
132 | -if(MODX_CLI){ |
|
138 | +if(MODX_CLI) { |
|
133 | 139 | @set_time_limit(0); |
134 | 140 | @ini_set('max_execution_time',0); |
135 | 141 | } |
@@ -104,7 +104,8 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @return string |
106 | 106 | */ |
107 | -function run() { |
|
107 | +function run() |
|
108 | +{ |
|
108 | 109 | $modx = evolutionCMS(); global $_lang; |
109 | 110 | |
110 | 111 | $tbl_site_content = $modx->getFullTableName('site_content'); |
@@ -171,7 +172,8 @@ discard block |
||
171 | 172 | * @param array $files |
172 | 173 | * @param string $mode |
173 | 174 | */ |
174 | -function importFiles($parent, $filedir, $files, $mode) { |
|
175 | +function importFiles($parent, $filedir, $files, $mode) |
|
176 | +{ |
|
175 | 177 | $modx = evolutionCMS(); |
176 | 178 | global $_lang, $allowedfiles; |
177 | 179 | global $search_default, $cache_default, $publish_default; |
@@ -318,7 +320,8 @@ discard block |
||
318 | 320 | * @param int $count |
319 | 321 | * @return array |
320 | 322 | */ |
321 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
323 | +function getFiles($directory, $listing = array(), $count = 0) |
|
324 | +{ |
|
322 | 325 | global $_lang; |
323 | 326 | global $filesfound; |
324 | 327 | $dummy = $count; |
@@ -346,7 +349,8 @@ discard block |
||
346 | 349 | * @param string $filepath |
347 | 350 | * @return bool|string |
348 | 351 | */ |
349 | -function getFileContent($filepath) { |
|
352 | +function getFileContent($filepath) |
|
353 | +{ |
|
350 | 354 | global $_lang; |
351 | 355 | // get the file |
352 | 356 | if(!$buffer = file_get_contents($filepath)) { |
@@ -360,7 +364,8 @@ discard block |
||
360 | 364 | * @param array $array |
361 | 365 | * @return array |
362 | 366 | */ |
363 | -function pop_index($array) { |
|
367 | +function pop_index($array) |
|
368 | +{ |
|
364 | 369 | $new_array = array(); |
365 | 370 | foreach($array as $k => $v) { |
366 | 371 | if($v !== 'index.html' && $v !== 'index.htm') { |
@@ -383,7 +388,8 @@ discard block |
||
383 | 388 | * @param string $alias |
384 | 389 | * @return array |
385 | 390 | */ |
386 | -function treatContent($src, $filename, $alias) { |
|
391 | +function treatContent($src, $filename, $alias) |
|
392 | +{ |
|
387 | 393 | $modx = evolutionCMS(); |
388 | 394 | |
389 | 395 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
@@ -427,7 +433,8 @@ discard block |
||
427 | 433 | /** |
428 | 434 | * @return void |
429 | 435 | */ |
430 | -function convertLink() { |
|
436 | +function convertLink() |
|
437 | +{ |
|
431 | 438 | $modx = evolutionCMS(); |
432 | 439 | $tbl_site_content = $modx->getFullTableName('site_content'); |
433 | 440 |
@@ -478,7 +478,8 @@ discard block |
||
478 | 478 | return s; |
479 | 479 | } |
480 | 480 | |
481 | - <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
481 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
482 | +// Web Link specific ?> |
|
482 | 483 | var lastImageCtrl; |
483 | 484 | var lastFileCtrl; |
484 | 485 | |
@@ -694,7 +695,8 @@ discard block |
||
694 | 695 | </td> |
695 | 696 | </tr> |
696 | 697 | |
697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
698 | + <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
699 | +// Web Link specific ?> |
|
698 | 700 | |
699 | 701 | <tr> |
700 | 702 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -1353,7 +1355,9 @@ discard block |
||
1353 | 1355 | if($documentId > 0) { |
1354 | 1356 | // Load up, the permissions from the parent (if new document) or existing document |
1355 | 1357 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1358 | + while($currentgroup = $modx->db->getRow($rs)) { |
|
1359 | + $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1360 | + } |
|
1357 | 1361 | |
1358 | 1362 | // Load up the current permissions and names |
1359 | 1363 | $vs = array( |
@@ -1415,7 +1419,9 @@ discard block |
||
1415 | 1419 | |
1416 | 1420 | // Create attribute string list |
1417 | 1421 | $inputString = array(); |
1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1422 | + foreach($inputAttributes as $k => $v) { |
|
1423 | + $inputString[] = $k . '="' . $v . '"'; |
|
1424 | + } |
|
1419 | 1425 | |
1420 | 1426 | // Make the <input> HTML |
1421 | 1427 | $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
@@ -1535,7 +1541,8 @@ discard block |
||
1535 | 1541 | /** |
1536 | 1542 | * @return string |
1537 | 1543 | */ |
1538 | -function getDefaultTemplate() { |
|
1544 | +function getDefaultTemplate() |
|
1545 | +{ |
|
1539 | 1546 | $modx = evolutionCMS(); |
1540 | 1547 | |
1541 | 1548 | $default_template = ''; |
@@ -1,5 +1,5 @@ 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 | |
@@ -16,7 +16,8 @@ discard block |
||
16 | 16 | * @param array $ph |
17 | 17 | * @return string |
18 | 18 | */ |
19 | -function parsePh($tpl, $ph) { |
|
19 | +function parsePh($tpl, $ph) |
|
20 | +{ |
|
20 | 21 | $modx = evolutionCMS(); global $_lang; |
21 | 22 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
22 | 23 | return $modx->parseText($tpl, $ph); |
@@ -26,7 +27,8 @@ discard block |
||
26 | 27 | * @param string|int $cssId |
27 | 28 | * @return string |
28 | 29 | */ |
29 | -function renderViewSwitchButtons($cssId) { |
|
30 | +function renderViewSwitchButtons($cssId) |
|
31 | +{ |
|
30 | 32 | $modx = evolutionCMS(); global $_lang, $tpl; |
31 | 33 | |
32 | 34 | return parsePh($tpl['viewForm'], array( |
@@ -39,19 +41,20 @@ discard block |
||
39 | 41 | * @param mgrResources $resources |
40 | 42 | * @return string |
41 | 43 | */ |
42 | -function createResourceList($resourceTable, $resources) { |
|
44 | +function createResourceList($resourceTable, $resources) |
|
45 | +{ |
|
43 | 46 | $modx = evolutionCMS(); global $_lang, $_style, $modx_textdir, $tpl; |
44 | 47 | |
45 | 48 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
46 | 49 | |
47 | - if( ! is_array($items) || empty($items)) { |
|
50 | + if( ! is_array($items) || empty($items)) { |
|
48 | 51 | return $_lang['no_results']; |
49 | 52 | } |
50 | 53 | |
51 | 54 | // Prepare elements- and categories-list |
52 | 55 | $elements = array(); |
53 | 56 | $categories = array(); |
54 | - foreach($items as $row) { |
|
57 | + foreach($items as $row) { |
|
55 | 58 | $catid = $row['catid'] ? $row['catid'] : 0; |
56 | 59 | $categories[$catid] = array('name' => stripslashes($row['category'])); |
57 | 60 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -59,7 +62,7 @@ discard block |
||
59 | 62 | |
60 | 63 | // Now render categories / panel-collapse |
61 | 64 | $panelGroup = ''; |
62 | - foreach($elements as $catid => $elList) { |
|
65 | + foreach($elements as $catid => $elList) { |
|
63 | 66 | // Add panel-heading / category-collapse to output |
64 | 67 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
65 | 68 | 'tab' => $resourceTable, |
@@ -70,7 +73,7 @@ discard block |
||
70 | 73 | |
71 | 74 | // Prepare content for panel-collapse |
72 | 75 | $panelCollapse = ''; |
73 | - foreach($elList as $el) { |
|
76 | + foreach($elList as $el) { |
|
74 | 77 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
75 | 78 | } |
76 | 79 | |
@@ -92,14 +95,15 @@ discard block |
||
92 | 95 | * @param mgrResources $resources |
93 | 96 | * @return string |
94 | 97 | */ |
95 | -function createCombinedView($resources) { |
|
98 | +function createCombinedView($resources) |
|
99 | +{ |
|
96 | 100 | $modx = evolutionCMS(); global $_lang, $_style, $modx_textdir; |
97 | 101 | |
98 | 102 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
99 | 103 | $types = isset($resources->types) ? $resources->types : false; |
100 | 104 | $categories = isset($resources->categories) ? $resources->categories : false; |
101 | 105 | |
102 | - if(!$itemsPerCategory) { |
|
106 | + if(!$itemsPerCategory) { |
|
103 | 107 | return $_lang['no_results']; |
104 | 108 | } |
105 | 109 | |
@@ -112,10 +116,10 @@ discard block |
||
112 | 116 | |
113 | 117 | // Easily loop through $itemsPerCategory-Array |
114 | 118 | $panelGroup = ''; |
115 | - foreach($categories as $catid => $category) { |
|
119 | + foreach($categories as $catid => $category) { |
|
116 | 120 | // Prepare collapse content / elements-list |
117 | 121 | $panelCollapse = ''; |
118 | - foreach($itemsPerCategory[$catid] as $el) { |
|
122 | + foreach($itemsPerCategory[$catid] as $el) { |
|
119 | 123 | $resourceTable = $el['type']; |
120 | 124 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
121 | 125 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -149,14 +153,15 @@ discard block |
||
149 | 153 | * @param mgrResources $resources |
150 | 154 | * @return array |
151 | 155 | */ |
152 | -function prepareElementRowPh($row, $resourceTable, $resources) { |
|
156 | +function prepareElementRowPh($row, $resourceTable, $resources) |
|
157 | +{ |
|
153 | 158 | $modx = evolutionCMS(); global $modx_textdir, $_style, $_lang; |
154 | 159 | |
155 | 160 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
156 | 161 | |
157 | 162 | $_lang["confirm_delete"] = $_lang["delete"]; |
158 | 163 | |
159 | - switch($resourceTable){ |
|
164 | + switch($resourceTable) { |
|
160 | 165 | case 'site_templates': |
161 | 166 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
162 | 167 | $lockElementType = 1; |
@@ -193,56 +198,56 @@ discard block |
||
193 | 198 | // Prepare displaying user-locks |
194 | 199 | $lockedByUser = ''; |
195 | 200 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
196 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
197 | - if($rowLock['sid'] == $modx->sid) { |
|
201 | + if($rowLock && $modx->hasPermission('display_locks')) { |
|
202 | + if($rowLock['sid'] == $modx->sid) { |
|
198 | 203 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
199 | 204 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
200 | 205 | 'lasthit_df' => $rowLock['lasthit_df'] |
201 | 206 | )); |
202 | 207 | $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
203 | - } else { |
|
208 | + } else { |
|
204 | 209 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
205 | 210 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
206 | 211 | 'username' => $rowLock['username'], |
207 | 212 | 'lasthit_df' => $rowLock['lasthit_df'] |
208 | 213 | )); |
209 | - if($modx->hasPermission('remove_locks')) { |
|
214 | + if($modx->hasPermission('remove_locks')) { |
|
210 | 215 | $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
211 | - } else { |
|
216 | + } else { |
|
212 | 217 | $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
213 | 218 | } |
214 | 219 | } |
215 | 220 | } |
216 | - if($lockedByUser) { |
|
221 | + if($lockedByUser) { |
|
217 | 222 | $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
218 | 223 | } |
219 | 224 | |
220 | 225 | // Caption |
221 | - if($resourceTable == 'site_tmplvars') { |
|
226 | + if($resourceTable == 'site_tmplvars') { |
|
222 | 227 | $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
223 | - } else { |
|
228 | + } else { |
|
224 | 229 | $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
225 | 230 | } |
226 | 231 | |
227 | 232 | // Special marks |
228 | 233 | $tplInfo = array(); |
229 | - if($row['locked']) { |
|
234 | + if($row['locked']) { |
|
230 | 235 | $tplInfo[] = $_lang['locked']; |
231 | 236 | } |
232 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
237 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
233 | 238 | $tplInfo[] = $_lang['defaulttemplate_title']; |
234 | 239 | } |
235 | 240 | $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
236 | 241 | |
237 | 242 | /* row buttons */ |
238 | 243 | $buttons = ''; |
239 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
244 | + if($modx->hasPermission($types['actions']['edit'][1])) { |
|
240 | 245 | $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
241 | 246 | } |
242 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
247 | + if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
243 | 248 | $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
244 | 249 | } |
245 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
250 | + if($modx->hasPermission($types['actions']['remove'][1])) { |
|
246 | 251 | $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
247 | 252 | } |
248 | 253 | $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
@@ -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 | } |
@@ -299,7 +299,8 @@ |
||
299 | 299 | * @param string $status |
300 | 300 | * @return string |
301 | 301 | */ |
302 | -function render_form($name, $label, $status = '') { |
|
302 | +function render_form($name, $label, $status = '') |
|
303 | +{ |
|
303 | 304 | $modx = evolutionCMS(); global $roledata; |
304 | 305 | |
305 | 306 | $tpl = '<label class="d-block" for="[+name+]check"> |
@@ -893,7 +893,9 @@ |
||
893 | 893 | $modx = evolutionCMS(); global $_lang, $startpath, $filemanager_path, $uploadablefiles, $new_file_permissions; |
894 | 894 | $msg = ''; |
895 | 895 | foreach ($_FILES['userfile']['name'] as $i => $name) { |
896 | - if (empty($_FILES['userfile']['tmp_name'][$i])) continue; |
|
896 | + if (empty($_FILES['userfile']['tmp_name'][$i])) { |
|
897 | + continue; |
|
898 | + } |
|
897 | 899 | $userfile= array(); |
898 | 900 | |
899 | 901 | $userfile['tmp_name'] = $_FILES['userfile']['tmp_name'][$i]; |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | * @param array $tvsArray |
13 | 13 | * @return string |
14 | 14 | */ |
15 | -function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
|
15 | +function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) |
|
16 | +{ |
|
16 | 17 | $modx = evolutionCMS(); |
17 | 18 | global $_style; |
18 | 19 | global $_lang; |
@@ -384,13 +385,16 @@ discard block |
||
384 | 385 | * @param string|array|mysqli_result $v |
385 | 386 | * @return array |
386 | 387 | */ |
387 | -function ParseIntputOptions($v) { |
|
388 | +function ParseIntputOptions($v) |
|
389 | +{ |
|
388 | 390 | $modx = evolutionCMS(); |
389 | 391 | $a = array(); |
390 | 392 | if(is_array($v)) { |
391 | 393 | return $v; |
392 | 394 | } else if($modx->db->isResult($v)) { |
393 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
395 | + while($cols = $modx->db->getRow($v, 'num')) { |
|
396 | + $a[] = $cols; |
|
397 | + } |
|
394 | 398 | } else { |
395 | 399 | $a = explode("||", $v); |
396 | 400 | } |
@@ -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 |