@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
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 | global $SystemAlertMsgQueque; |
6 | 6 | // display system alert window if messages are available |
7 | 7 | if(count($SystemAlertMsgQueque) > 0) { |
8 | - include "sysalert.display.inc.php"; |
|
8 | + include "sysalert.display.inc.php"; |
|
9 | 9 | } |
10 | 10 | ?> |
11 | 11 | <script type='text/javascript'> |
@@ -19,17 +19,17 @@ discard block |
||
19 | 19 | </script> |
20 | 20 | <?php |
21 | 21 | if(in_array($modx->getManagerApi()->action, array( |
22 | - 85, |
|
23 | - 27, |
|
24 | - 4, |
|
25 | - 72, |
|
26 | - 13, |
|
27 | - 11, |
|
28 | - 12, |
|
29 | - 87, |
|
30 | - 88 |
|
22 | + 85, |
|
23 | + 27, |
|
24 | + 4, |
|
25 | + 72, |
|
26 | + 13, |
|
27 | + 11, |
|
28 | + 12, |
|
29 | + 87, |
|
30 | + 88 |
|
31 | 31 | ))) { |
32 | - echo $modx->getManagerApi()->loadDatePicker($modx->config['mgr_date_picker_path']); |
|
32 | + echo $modx->getManagerApi()->loadDatePicker($modx->config['mgr_date_picker_path']); |
|
33 | 33 | } |
34 | 34 | ?> |
35 | 35 | </body> |
@@ -1,10 +1,10 @@ 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 | global $SystemAlertMsgQueque; |
6 | 6 | // display system alert window if messages are available |
7 | -if(count($SystemAlertMsgQueque) > 0) { |
|
7 | +if (count($SystemAlertMsgQueque) > 0) { |
|
8 | 8 | include "sysalert.display.inc.php"; |
9 | 9 | } |
10 | 10 | ?> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | }); |
19 | 19 | </script> |
20 | 20 | <?php |
21 | -if(in_array($modx->getManagerApi()->action, array( |
|
21 | +if (in_array($modx->getManagerApi()->action, array( |
|
22 | 22 | 85, |
23 | 23 | 27, |
24 | 24 | 4, |
@@ -1,30 +1,30 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | - /** |
|
4 | - * System Alert Message Queue Display file |
|
5 | - * Written By Raymond Irving, April, 2005 |
|
6 | - * |
|
7 | - * Used to display system alert messages inside the browser |
|
8 | - * |
|
9 | - */ |
|
3 | + /** |
|
4 | + * System Alert Message Queue Display file |
|
5 | + * Written By Raymond Irving, April, 2005 |
|
6 | + * |
|
7 | + * Used to display system alert messages inside the browser |
|
8 | + * |
|
9 | + */ |
|
10 | 10 | |
11 | - require_once(dirname(__FILE__).'/protect.inc.php'); |
|
11 | + require_once(dirname(__FILE__).'/protect.inc.php'); |
|
12 | 12 | |
13 | - $sysMsgs = ""; |
|
14 | - $limit = count($SystemAlertMsgQueque); |
|
15 | - for($i=0;$i<$limit;$i++) { |
|
16 | - $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
17 | - } |
|
18 | - // reset message queque |
|
19 | - unset($_SESSION['SystemAlertMsgQueque']); |
|
20 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
21 | - $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
13 | + $sysMsgs = ""; |
|
14 | + $limit = count($SystemAlertMsgQueque); |
|
15 | + for($i=0;$i<$limit;$i++) { |
|
16 | + $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
17 | + } |
|
18 | + // reset message queque |
|
19 | + unset($_SESSION['SystemAlertMsgQueque']); |
|
20 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
21 | + $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
22 | 22 | |
23 | - if($sysMsgs!="") { |
|
23 | + if($sysMsgs!="") { |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <?php // fetch the styles |
27 | - echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
27 | + echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
28 | 28 | ?> |
29 | 29 | <script type="text/javascript"> |
30 | 30 | // <![CDATA[ |
@@ -42,5 +42,5 @@ discard block |
||
42 | 42 | // ]]> |
43 | 43 | </script> |
44 | 44 | <?php |
45 | - } |
|
45 | + } |
|
46 | 46 | ?> |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $sysMsgs = ""; |
14 | 14 | $limit = count($SystemAlertMsgQueque); |
15 | - for($i=0;$i<$limit;$i++) { |
|
15 | + for ($i = 0; $i < $limit; $i++) { |
|
16 | 16 | $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
17 | 17 | } |
18 | 18 | // reset message queque |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $_SESSION['SystemAlertMsgQueque'] = array(); |
21 | 21 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
22 | 22 | |
23 | - if($sysMsgs!="") { |
|
23 | + if ($sysMsgs != "") { |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <?php // fetch the styles |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | var sysAlert = new Element('div').setProperties({ |
33 | 33 | 'class': 'sysAlert' |
34 | 34 | }); |
35 | - sysAlert.innerHTML = '<?php echo $modx->getDatabase()->escape($sysMsgs);?>'; |
|
35 | + sysAlert.innerHTML = '<?php echo $modx->getDatabase()->escape($sysMsgs); ?>'; |
|
36 | 36 | var boxHtml = new MooPrompt('<?php echo $_lang['sys_alert']; ?>', sysAlert, { |
37 | 37 | buttons: 1, |
38 | 38 | button1: 'Ok', |
@@ -146,33 +146,33 @@ discard block |
||
146 | 146 | $algorithm = 'UNCRYPT'; |
147 | 147 | } |
148 | 148 | |
149 | - $salt = md5($password . $seed); |
|
149 | + $salt = md5($password.$seed); |
|
150 | 150 | |
151 | 151 | switch ($algorithm) { |
152 | 152 | case 'BLOWFISH_Y': |
153 | - $salt = '$2y$07$' . substr($salt, 0, 22); |
|
153 | + $salt = '$2y$07$'.substr($salt, 0, 22); |
|
154 | 154 | break; |
155 | 155 | case 'BLOWFISH_A': |
156 | - $salt = '$2a$07$' . substr($salt, 0, 22); |
|
156 | + $salt = '$2a$07$'.substr($salt, 0, 22); |
|
157 | 157 | break; |
158 | 158 | case 'SHA512': |
159 | - $salt = '$6$' . substr($salt, 0, 16); |
|
159 | + $salt = '$6$'.substr($salt, 0, 16); |
|
160 | 160 | break; |
161 | 161 | case 'SHA256': |
162 | - $salt = '$5$' . substr($salt, 0, 16); |
|
162 | + $salt = '$5$'.substr($salt, 0, 16); |
|
163 | 163 | break; |
164 | 164 | case 'MD5': |
165 | - $salt = '$1$' . substr($salt, 0, 8); |
|
165 | + $salt = '$1$'.substr($salt, 0, 8); |
|
166 | 166 | break; |
167 | 167 | } |
168 | 168 | |
169 | 169 | if ($algorithm !== 'UNCRYPT') { |
170 | - $password = sha1($password) . crypt($password, $salt); |
|
170 | + $password = sha1($password).crypt($password, $salt); |
|
171 | 171 | } else { |
172 | - $password = sha1($salt . $password); |
|
172 | + $password = sha1($salt.$password); |
|
173 | 173 | } |
174 | 174 | |
175 | - $result = strtolower($algorithm) . '>' . md5($salt . $password) . substr(md5($salt), 0, 8); |
|
175 | + $result = strtolower($algorithm).'>'.md5($salt.$password).substr(md5($salt), 0, 8); |
|
176 | 176 | |
177 | 177 | return $result; |
178 | 178 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $check_files = explode("\n", $check_files); |
255 | 255 | foreach ($check_files as $file) { |
256 | 256 | $file = trim($file); |
257 | - $file = MODX_BASE_PATH . $file; |
|
257 | + $file = MODX_BASE_PATH.$file; |
|
258 | 258 | if (!is_file($file)) { |
259 | 259 | continue; |
260 | 260 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $checksum = unserialize($checksum); |
278 | 278 | foreach ($check_files as $file) { |
279 | 279 | $file = trim($file); |
280 | - $filePath = MODX_BASE_PATH . $file; |
|
280 | + $filePath = MODX_BASE_PATH.$file; |
|
281 | 281 | if (!is_file($filePath)) { |
282 | 282 | continue; |
283 | 283 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | { |
297 | 297 | $modx = evolutionCMS(); |
298 | 298 | $tbl_system_settings = $modx->getFullTableName('system_settings'); |
299 | - $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','" . $modx->getDatabase()->escape($checksum) . "')"; |
|
299 | + $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','".$modx->getDatabase()->escape($checksum)."')"; |
|
300 | 300 | $modx->getDatabase()->query($sql); |
301 | 301 | } |
302 | 302 | |
@@ -373,10 +373,10 @@ discard block |
||
373 | 373 | foreach ($settings as $key => $val) { |
374 | 374 | $f = array(); |
375 | 375 | $f['user'] = $_SESSION['mgrInternalKey']; |
376 | - $f['setting_name'] = '_LAST_' . $key; |
|
376 | + $f['setting_name'] = '_LAST_'.$key; |
|
377 | 377 | $f['setting_value'] = $val; |
378 | 378 | $f = $modx->getDatabase()->escape($f); |
379 | - $f = "(`" . implode("`, `", array_keys($f)) . "`) VALUES('" . implode("', '", array_values($f)) . "')"; |
|
379 | + $f = "(`".implode("`, `", array_keys($f))."`) VALUES('".implode("', '", array_values($f))."')"; |
|
380 | 380 | $f .= " ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)"; |
381 | 381 | $modx->getDatabase()->insert($f, $modx->getFullTableName('user_settings')); |
382 | 382 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $this->count = 0; |
60 | 60 | $this->setUrlMode(); |
61 | 61 | $this->generate_mode = 'crawl'; |
62 | - $this->targetDir = $modx->config['base_path'] . 'temp/export'; |
|
62 | + $this->targetDir = $modx->config['base_path'].'temp/export'; |
|
63 | 63 | if (!isset($this->total)) { |
64 | 64 | $this->getTotal(); |
65 | 65 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $ignore_ids = array_filter(array_map('intval', explode(',', $ignore_ids))); |
116 | 116 | if (count($ignore_ids) > 0) { |
117 | - $ignore_ids = "AND NOT id IN ('" . implode("','", $ignore_ids) . "')"; |
|
117 | + $ignore_ids = "AND NOT id IN ('".implode("','", $ignore_ids)."')"; |
|
118 | 118 | } else { |
119 | 119 | $ignore_ids = ''; |
120 | 120 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $noncache = ($noncache == 1) ? '' : 'AND cacheable=1'; |
125 | 125 | $where = "deleted=0 AND ((published=1 AND type='document') OR (isfolder=1)) {$noncache} {$ignore_ids}"; |
126 | 126 | $rs = $modx->getDatabase()->select('count(id)', $tbl_site_content, $where); |
127 | - $this->total = (int)$modx->getDatabase()->getValue($rs); |
|
127 | + $this->total = (int) $modx->getDatabase()->getValue($rs); |
|
128 | 128 | |
129 | 129 | return $this->total; |
130 | 130 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } elseif (!is_readable($directory)) { |
154 | 154 | return $rs; |
155 | 155 | } else { |
156 | - $files = glob($directory . '/*'); |
|
156 | + $files = glob($directory.'/*'); |
|
157 | 157 | if (!empty($files)) { |
158 | 158 | foreach ($files as $path) { |
159 | 159 | $rs = is_dir($path) ? $this->removeDirectoryAll($path) : unlink($path); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | $_lang = $back_lang; |
184 | 184 | } else { |
185 | - $src = $this->curl_get_contents(MODX_SITE_URL . "index.php?id={$docid}"); |
|
185 | + $src = $this->curl_get_contents(MODX_SITE_URL."index.php?id={$docid}"); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | $modx = evolutionCMS(); |
218 | 218 | |
219 | 219 | if ($alias === '') { |
220 | - $filename = $prefix . $docid . $suffix; |
|
220 | + $filename = $prefix.$docid.$suffix; |
|
221 | 221 | } else { |
222 | 222 | if ($modx->config['suffix_mode'] === '1' && strpos($alias, '.') !== false) { |
223 | 223 | $suffix = ''; |
224 | 224 | } |
225 | - $filename = $prefix . $alias . $suffix; |
|
225 | + $filename = $prefix.$alias.$suffix; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | return $filename; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $tbl_site_content = $modx->getFullTableName('site_content'); |
241 | 241 | |
242 | 242 | $ignore_ids = $this->ignore_ids; |
243 | - $dirpath = $this->targetDir . '/'; |
|
243 | + $dirpath = $this->targetDir.'/'; |
|
244 | 244 | |
245 | 245 | $prefix = $modx->config['friendly_url_prefix']; |
246 | 246 | $suffix = $modx->config['friendly_url_suffix']; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | $ph['status'] = 'fail'; |
252 | 252 | $ph['msg1'] = $_lang['export_site_failed']; |
253 | - $ph['msg2'] = $_lang["export_site_failed_no_write"] . ' - ' . $dirpath; |
|
253 | + $ph['msg2'] = $_lang["export_site_failed_no_write"].' - '.$dirpath; |
|
254 | 254 | $msg_failed_no_write = $this->parsePlaceholder($tpl, $ph); |
255 | 255 | |
256 | 256 | $ph['msg2'] = $_lang["export_site_failed_no_retrieve"]; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | if (!$row['wasNull']) { // needs writing a document |
285 | 285 | $docname = $this->getFileName($row['id'], $row['alias'], $prefix, $suffix); |
286 | - $filename = $dirpath . $docname; |
|
286 | + $filename = $dirpath.$docname; |
|
287 | 287 | if (!is_file($filename)) { |
288 | 288 | if ($row['published'] === '1') { |
289 | 289 | $status = $this->makeFile($row['id'], $filename); |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | if ($row['isfolder'] === '1' && ($modx->config['suffix_mode'] !== '1' || strpos($row['alias'], |
312 | 312 | '.') === false)) { // needs making a folder |
313 | 313 | $end_dir = ($row['alias'] !== '') ? $row['alias'] : $row['id']; |
314 | - $dir_path = $dirpath . $end_dir; |
|
314 | + $dir_path = $dirpath.$end_dir; |
|
315 | 315 | if (strpos($dir_path, MODX_BASE_PATH) === false) { |
316 | 316 | return false; |
317 | 317 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | if ($modx->config['make_folders'] === '1' && $row['published'] === '1') { |
329 | 329 | if (!empty($filename) && is_file($filename)) { |
330 | - rename($filename, $dir_path . '/index.html'); |
|
330 | + rename($filename, $dir_path.'/index.html'); |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | $this->targetDir = $dir_path; |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | |
352 | 352 | $ch = curl_init(); |
353 | 353 | curl_setopt($ch, CURLOPT_URL, $url); |
354 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 0 = DO NOT VERIFY AUTHENTICITY OF SSL-CERT |
|
355 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 2 = CERT MUST INDICATE BEING CONNECTED TO RIGHT SERVER |
|
354 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 0 = DO NOT VERIFY AUTHENTICITY OF SSL-CERT |
|
355 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 2 = CERT MUST INDICATE BEING CONNECTED TO RIGHT SERVER |
|
356 | 356 | curl_setopt($ch, CURLOPT_HEADER, false); |
357 | 357 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
358 | 358 | curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $role = $this->role; |
40 | 40 | |
41 | 41 | if ($role == 1) { |
42 | - return true; // administrator - grant all document permissions |
|
42 | + return true; // administrator - grant all document permissions |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | if ($modx->config['use_udperms'] == 0 || $modx->config['use_udperms'] == "" || !isset($modx->config['use_udperms'])) { |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | are private to the manager users will not be private to web users if the |
67 | 67 | document group is not assigned to a web user group and visa versa. |
68 | 68 | */ |
69 | - $permissionsok = false; // set permissions to false |
|
69 | + $permissionsok = false; // set permissions to false |
|
70 | 70 | |
71 | 71 | $rs = $modx->getDatabase()->select( |
72 | 72 | 'count(DISTINCT sc.id)', |
73 | 73 | "{$tblsc} AS sc |
74 | 74 | LEFT JOIN {$tbldg} AS dg on dg.document = sc.id |
75 | 75 | LEFT JOIN {$tbldgn} dgn ON dgn.id = dg.document_group", |
76 | - "sc.id='{$this->document}' AND (" . (empty($docgrp) ? '' : "dg.document_group = " . $docgrp . " ||") . " sc.privatemgr = 0)" |
|
76 | + "sc.id='{$this->document}' AND (".(empty($docgrp) ? '' : "dg.document_group = ".$docgrp." ||")." sc.privatemgr = 0)" |
|
77 | 77 | ); |
78 | 78 | $limit = $modx->getDatabase()->getValue($rs); |
79 | 79 | if ($limit == 1) { |
@@ -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->getManagerApi()->action : $action; // writes the action to the object |
|
42 | + $this->entry['action'] = empty($action) ? $modx->getManagerApi()->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 |
@@ -96,20 +96,20 @@ discard block |
||
96 | 96 | |
97 | 97 | $insert_id = $modx->getDatabase()->insert($fields, $tbl_manager_log); |
98 | 98 | if (!$insert_id) { |
99 | - $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->getDatabase()->getLastError()); |
|
99 | + $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->getDatabase()->getLastError()); |
|
100 | 100 | } else { |
101 | - $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000; |
|
102 | - $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100; |
|
101 | + $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000; |
|
102 | + $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100; |
|
103 | 103 | if (($insert_id % $trim) === 0) { |
104 | 104 | $modx->rotate_log('manager_log', $limit, $trim); |
105 | 105 | } |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - private function getUserIP() { |
|
110 | - if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) { |
|
111 | - if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) { |
|
112 | - $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
109 | + private function getUserIP(){ |
|
110 | + if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
111 | + if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') > 0) { |
|
112 | + $addr = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
113 | 113 | return trim($addr[0]); |
114 | 114 | } else { |
115 | 115 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php namespace EvolutionCMS\Legacy; |
2 | 2 | |
3 | -class mgrResources { |
|
3 | +class mgrResources{ |
|
4 | 4 | /** |
5 | 5 | * @var array |
6 | 6 | */ |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * mgrResources constructor. |
23 | 23 | */ |
24 | - public function __construct() { |
|
24 | + public function __construct(){ |
|
25 | 25 | $this->setTypes(); |
26 | 26 | $this->queryItemsFromDB(); |
27 | 27 | $this->prepareCategoryArrays(); |
@@ -30,47 +30,47 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @return void |
32 | 32 | */ |
33 | - public function setTypes() { |
|
33 | + public function setTypes(){ |
|
34 | 34 | global $_lang; |
35 | - $this->types['site_templates'] = array( |
|
35 | + $this->types['site_templates'] = array( |
|
36 | 36 | 'title'=>$_lang["manage_templates"], |
37 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
38 | - 'permissions'=>array('new_template','edit_template'), |
|
37 | + 'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')), |
|
38 | + 'permissions'=>array('new_template', 'edit_template'), |
|
39 | 39 | 'name'=>'templatename' |
40 | 40 | ); |
41 | - $this->types['site_tmplvars'] = array( |
|
41 | + $this->types['site_tmplvars'] = array( |
|
42 | 42 | 'title'=>$_lang["tmplvars"], |
43 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
44 | - 'permissions'=>array('new_template','edit_template'), |
|
43 | + 'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')), |
|
44 | + 'permissions'=>array('new_template', 'edit_template'), |
|
45 | 45 | ); |
46 | 46 | $this->types['site_htmlsnippets'] = array( |
47 | 47 | 'title'=>$_lang["manage_htmlsnippets"], |
48 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
49 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
48 | + 'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')), |
|
49 | + 'permissions'=>array('new_chunk', 'edit_chunk'), |
|
50 | 50 | ); |
51 | - $this->types['site_snippets'] = array( |
|
51 | + $this->types['site_snippets'] = array( |
|
52 | 52 | 'title'=>$_lang["manage_snippets"], |
53 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
54 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
53 | + 'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')), |
|
54 | + 'permissions'=>array('new_snippet', 'edit_snippet'), |
|
55 | 55 | ); |
56 | - $this->types['site_plugins'] = array( |
|
56 | + $this->types['site_plugins'] = array( |
|
57 | 57 | 'title'=>$_lang["manage_plugins"], |
58 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
59 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
58 | + 'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')), |
|
59 | + 'permissions'=>array('new_plugin', 'edit_plugin'), |
|
60 | 60 | ); |
61 | - $this->types['site_modules'] = array( |
|
61 | + $this->types['site_modules'] = array( |
|
62 | 62 | 'title'=>$_lang["manage_modules"], |
63 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
64 | - 'permissions'=>array('new_module','edit_module'), |
|
63 | + 'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')), |
|
64 | + 'permissions'=>array('new_module', 'edit_module'), |
|
65 | 65 | ); |
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function queryItemsFromDB() { |
|
72 | - foreach($this->types as $resourceTable=>$type) { |
|
73 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
71 | + public function queryItemsFromDB(){ |
|
72 | + foreach ($this->types as $resourceTable=>$type) { |
|
73 | + if ($this->hasAnyPermissions($type['permissions'])) { |
|
74 | 74 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
75 | 75 | $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
76 | 76 | } |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @param array $permissions |
82 | 82 | * @return bool |
83 | 83 | */ |
84 | - public function hasAnyPermissions($permissions) { |
|
84 | + public function hasAnyPermissions($permissions){ |
|
85 | 85 | $modx = evolutionCMS(); |
86 | 86 | |
87 | - foreach($permissions as $p) |
|
88 | - if($modx->hasPermission($p)) return true; |
|
87 | + foreach ($permissions as $p) |
|
88 | + if ($modx->hasPermission($p)) return true; |
|
89 | 89 | |
90 | 90 | return false; |
91 | 91 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param string $nameField |
96 | 96 | * @return array|bool |
97 | 97 | */ |
98 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
98 | + public function queryResources($resourceTable, $nameField = 'name'){ |
|
99 | 99 | $modx = evolutionCMS(); global $_lang; |
100 | 100 | |
101 | 101 | $allowed = array( |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | 'site_plugins', |
105 | 105 | 'site_modules' |
106 | 106 | ); |
107 | - $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
107 | + $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable.'.disabled, ' : ''; |
|
108 | 108 | |
109 | 109 | $tvsql = ''; |
110 | 110 | $tvjoin = ''; |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | |
120 | 120 | $rs = $modx->getDatabase()->select( |
121 | 121 | "{$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", |
122 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
123 | - LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
122 | + $modx->getFullTableName($resourceTable)." AS {$resourceTable} |
|
123 | + LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
124 | 124 | "", |
125 | 125 | "category,name" |
126 | 126 | ); |
127 | 127 | $limit = $modx->getDatabase()->getRecordCount($rs); |
128 | 128 | |
129 | - if($limit < 1) return false; |
|
129 | + if ($limit < 1) return false; |
|
130 | 130 | |
131 | 131 | $result = array(); |
132 | 132 | while ($row = $modx->getDatabase()->getRow($rs)) { |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | /** |
139 | 139 | * @return void |
140 | 140 | */ |
141 | - public function prepareCategoryArrays() { |
|
142 | - foreach($this->items as $type=>$items) { |
|
143 | - foreach((array)$items as $item) { |
|
141 | + public function prepareCategoryArrays(){ |
|
142 | + foreach ($this->items as $type=>$items) { |
|
143 | + foreach ((array) $items as $item) { |
|
144 | 144 | $catid = $item['catid'] ? $item['catid'] : 0; |
145 | 145 | $this->categories[$catid] = $item['category']; |
146 | 146 | |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | natcasesort($this->categories); |
154 | 154 | |
155 | 155 | // Now sort by name |
156 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
157 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
156 | + foreach ($this->itemsPerCategory as $catid=>$items) { |
|
157 | + usort($this->itemsPerCategory[$catid], function($a, $b){ |
|
158 | 158 | return strcasecmp($a['name'], $b['name']); |
159 | 159 | }); |
160 | 160 | } |
@@ -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->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 | } |
@@ -5,10 +5,10 @@ |
||
5 | 5 | class DeprecatedCore implements DeprecatedCoreInterface |
6 | 6 | { |
7 | 7 | /** |
8 | - * @deprecated |
|
9 | - * |
|
10 | - * return @void |
|
11 | - */ |
|
8 | + * @deprecated |
|
9 | + * |
|
10 | + * return @void |
|
11 | + */ |
|
12 | 12 | public function dbConnect() |
13 | 13 | { |
14 | 14 | $modx = evolutionCMS(); |
@@ -119,16 +119,16 @@ discard block |
||
119 | 119 | for ($i = 0; $i < $tablevel; $i++) { |
120 | 120 | $tabs .= "\t"; |
121 | 121 | } |
122 | - $listhtml = $ordered == true ? $tabs . "<ol class='$ulroot'$typestr>\n" : $tabs . "<ul class='$ulroot'$typestr>\n"; |
|
122 | + $listhtml = $ordered == true ? $tabs."<ol class='$ulroot'$typestr>\n" : $tabs."<ul class='$ulroot'$typestr>\n"; |
|
123 | 123 | foreach ($array as $key => $value) { |
124 | 124 | if (is_array($value)) { |
125 | - $listhtml .= $tabs . "\t<li>" . $key . "\n" . $this->makeList($value, $ulprefix . $ulroot, $ulprefix, |
|
126 | - $type, $ordered, $tablevel + 2) . $tabs . "\t</li>\n"; |
|
125 | + $listhtml .= $tabs."\t<li>".$key."\n".$this->makeList($value, $ulprefix.$ulroot, $ulprefix, |
|
126 | + $type, $ordered, $tablevel + 2).$tabs."\t</li>\n"; |
|
127 | 127 | } else { |
128 | - $listhtml .= $tabs . "\t<li>" . $value . "</li>\n"; |
|
128 | + $listhtml .= $tabs."\t<li>".$value."</li>\n"; |
|
129 | 129 | } |
130 | 130 | } |
131 | - $listhtml .= $ordered == true ? $tabs . "</ol>\n" : $tabs . "</ul>\n"; |
|
131 | + $listhtml .= $ordered == true ? $tabs."</ol>\n" : $tabs."</ul>\n"; |
|
132 | 132 | |
133 | 133 | return $listhtml; |
134 | 134 | } |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | $msg = addslashes($modx->getDatabase()->escape($msg)); |
300 | 300 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
301 | 301 | $act = "__WebAlert();"; |
302 | - $fnc = "function __WebAlert(){" . substr($url, 11) . "};"; |
|
302 | + $fnc = "function __WebAlert(){".substr($url, 11)."};"; |
|
303 | 303 | } else { |
304 | - $act = ($url ? "window.location.href='" . addslashes($url) . "';" : ""); |
|
304 | + $act = ($url ? "window.location.href='".addslashes($url)."';" : ""); |
|
305 | 305 | } |
306 | 306 | $html = "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>"; |
307 | 307 | if ($modx->isFrontend()) { |
@@ -8,46 +8,46 @@ discard block |
||
8 | 8 | * @param array $data |
9 | 9 | * @return string |
10 | 10 | */ |
11 | - public function output($config = array(), $data = array()) { |
|
11 | + public function output($config = array(), $data = array()){ |
|
12 | 12 | $modx = evolutionCMS(); |
13 | 13 | |
14 | 14 | $output = ''; |
15 | 15 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
16 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
16 | + $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : ''; |
|
17 | 17 | |
18 | - if($action) { |
|
18 | + if ($action) { |
|
19 | 19 | $sql = $modx->getDatabase()->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
20 | - FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
|
21 | - INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
|
22 | - WHERE t1.action IN(' . $action . ') ' . $tab . ' |
|
20 | + FROM ' . $modx->getFullTableName('system_templates').' AS t1 |
|
21 | + INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category |
|
22 | + WHERE t1.action IN(' . $action.') '.$tab.' |
|
23 | 23 | ORDER BY t1.tab ASC, t1.rank ASC'); |
24 | 24 | |
25 | - if($modx->getDatabase()->getRecordCount($sql)) { |
|
25 | + if ($modx->getDatabase()->getRecordCount($sql)) { |
|
26 | 26 | $tabs = array(); |
27 | - while($row = $modx->getDatabase()->getRow($sql)) { |
|
28 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
27 | + while ($row = $modx->getDatabase()->getRow($sql)) { |
|
28 | + if (!$row['value'] && !empty($data[$row['name']])) { |
|
29 | 29 | $row['value'] = $data[$row['name']]; |
30 | 30 | } |
31 | 31 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
32 | 32 | $tabs[$row['tab']][$row['name']] = $this->render($row); |
33 | 33 | } |
34 | 34 | |
35 | - if(!empty($config['toArray'])) { |
|
35 | + if (!empty($config['toArray'])) { |
|
36 | 36 | $output = $tabs; |
37 | 37 | } else { |
38 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
38 | + $output .= '<div class="tab-pane" id="pane_'.$action.'">'; |
|
39 | 39 | $output .= ' |
40 | 40 | <script type="text/javascript"> |
41 | - var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
41 | + var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
42 | 42 | </script>'; |
43 | 43 | |
44 | - foreach($tabs as $idTab => $tab) { |
|
45 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
44 | + foreach ($tabs as $idTab => $tab) { |
|
45 | + $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">'; |
|
46 | 46 | $output .= ' |
47 | - <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
|
48 | - <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
|
47 | + <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2> |
|
48 | + <script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>'; |
|
49 | 49 | unset($tab['category_name']); |
50 | - foreach($tab as $item) { |
|
50 | + foreach ($tab as $item) { |
|
51 | 51 | $output .= $item; |
52 | 52 | } |
53 | 53 | $output .= '</div>'; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param array $data |
65 | 65 | * @return string |
66 | 66 | */ |
67 | - private function render($data) { |
|
67 | + private function render($data){ |
|
68 | 68 | $modx = evolutionCMS(); global $_lang, $_country_lang; |
69 | 69 | |
70 | 70 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $output = ''; |
75 | 75 | $output .= '<div class="form-group row">'; |
76 | 76 | |
77 | - switch($data['type']) { |
|
77 | + switch ($data['type']) { |
|
78 | 78 | |
79 | 79 | case 'text': |
80 | 80 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
109 | 109 | $output .= '<div class="col-sm-7">'; |
110 | 110 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
111 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
111 | + if ($data['name'] == 'country' && isset($_country_lang)) { |
|
112 | 112 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
113 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
114 | - foreach($_country_lang as $key => $value) { |
|
115 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
113 | + $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'> </option>'; |
|
114 | + foreach ($_country_lang as $key => $value) { |
|
115 | + $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>'; |
|
116 | 116 | } |
117 | 117 | } else { |
118 | - if($data['elements']) { |
|
118 | + if ($data['elements']) { |
|
119 | 119 | $elements = explode('||', $data['elements']); |
120 | - foreach($elements as $key => $value) { |
|
120 | + foreach ($elements as $key => $value) { |
|
121 | 121 | $value = explode('==', $value); |
122 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
122 | + $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>'; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
134 | 134 | $output .= '<div class="col-sm-7">'; |
135 | 135 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
136 | - if($data['elements']) { |
|
136 | + if ($data['elements']) { |
|
137 | 137 | $elements = explode('||', $data['elements']); |
138 | - foreach($elements as $key => $value) { |
|
138 | + foreach ($elements as $key => $value) { |
|
139 | 139 | $value = explode('==', $value); |
140 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
140 | + $output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | $output .= $data['content']; |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
150 | 150 | $output .= '<div class="col-sm-7">'; |
151 | 151 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
152 | - if($data['elements']) { |
|
152 | + if ($data['elements']) { |
|
153 | 153 | $elements = explode('||', $data['elements']); |
154 | - foreach($elements as $key => $value) { |
|
154 | + foreach ($elements as $key => $value) { |
|
155 | 155 | $value = explode('==', $value); |
156 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
156 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | $output .= $data['content']; |