@@ -101,7 +101,8 @@ discard block |
||
101 | 101 | </div> |
102 | 102 | |
103 | 103 | <?php |
104 | -function run() { |
|
104 | +function run() |
|
105 | +{ |
|
105 | 106 | global $modx; |
106 | 107 | |
107 | 108 | $tbl_site_content = $modx->getFullTableName('site_content'); |
@@ -160,7 +161,8 @@ discard block |
||
160 | 161 | return $output; |
161 | 162 | } |
162 | 163 | |
163 | -function importFiles($parent, $filedir, $files, $mode) { |
|
164 | +function importFiles($parent, $filedir, $files, $mode) |
|
165 | +{ |
|
164 | 166 | global $modx; |
165 | 167 | global $_lang, $allowedfiles; |
166 | 168 | global $search_default, $cache_default, $publish_default; |
@@ -302,7 +304,8 @@ discard block |
||
302 | 304 | } |
303 | 305 | } |
304 | 306 | |
305 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
307 | +function getFiles($directory, $listing = array(), $count = 0) |
|
308 | +{ |
|
306 | 309 | global $_lang; |
307 | 310 | global $filesfound; |
308 | 311 | $dummy = $count; |
@@ -326,7 +329,8 @@ discard block |
||
326 | 329 | return ($listing); |
327 | 330 | } |
328 | 331 | |
329 | -function getFileContent($filepath) { |
|
332 | +function getFileContent($filepath) |
|
333 | +{ |
|
330 | 334 | global $_lang; |
331 | 335 | // get the file |
332 | 336 | if(!$buffer = file_get_contents($filepath)) { |
@@ -336,7 +340,8 @@ discard block |
||
336 | 340 | } |
337 | 341 | } |
338 | 342 | |
339 | -function pop_index($array) { |
|
343 | +function pop_index($array) |
|
344 | +{ |
|
340 | 345 | $new_array = array(); |
341 | 346 | foreach($array as $k => $v) { |
342 | 347 | if($v !== 'index.html' && $v !== 'index.htm') { |
@@ -353,7 +358,8 @@ discard block |
||
353 | 358 | return $new_array; |
354 | 359 | } |
355 | 360 | |
356 | -function treatContent($src, $filename, $alias) { |
|
361 | +function treatContent($src, $filename, $alias) |
|
362 | +{ |
|
357 | 363 | global $modx; |
358 | 364 | |
359 | 365 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
@@ -394,7 +400,8 @@ discard block |
||
394 | 400 | ); |
395 | 401 | } |
396 | 402 | |
397 | -function convertLink() { |
|
403 | +function convertLink() |
|
404 | +{ |
|
398 | 405 | global $modx; |
399 | 406 | $tbl_site_content = $modx->getFullTableName('site_content'); |
400 | 407 |
@@ -1,7 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | $MODX_SITE_HOSTNAMES = MODX_SITE_HOSTNAMES; // Fix for PHP 5.4 |
3 | - if(empty($valid_hostnames) && empty($MODX_SITE_HOSTNAMES)) $valid_hostnames = $_SERVER['HTTP_HOST']; |
|
4 | -?> |
|
3 | + if(empty($valid_hostnames) && empty($MODX_SITE_HOSTNAMES)) { |
|
4 | + $valid_hostnames = $_SERVER['HTTP_HOST']; |
|
5 | + } |
|
6 | + ?> |
|
5 | 7 | <!-- Interface & editor settings --> |
6 | 8 | <div class="tab-page" id="tabPageSecurity"> |
7 | 9 | <h2 class="tab"><?php echo $_lang['settings_security'] ?></h2> |
@@ -153,7 +155,9 @@ discard block |
||
153 | 155 | <th><?php echo $_lang['pwd_hash_algo_title'] ?><br><small>[(pwd_hash_algo)]</small></th> |
154 | 156 | <td> |
155 | 157 | <?php |
156 | -if(empty($pwd_hash_algo)) $phm['sel']['UNCRYPT'] = 1; |
|
158 | +if(empty($pwd_hash_algo)) { |
|
159 | + $phm['sel']['UNCRYPT'] = 1; |
|
160 | +} |
|
157 | 161 | $phm['e']['BLOWFISH_Y'] = $modx->manager->checkHashAlgorithm('BLOWFISH_Y') ? 0:1; |
158 | 162 | $phm['e']['BLOWFISH_A'] = $modx->manager->checkHashAlgorithm('BLOWFISH_A') ? 0:1; |
159 | 163 | $phm['e']['SHA512'] = $modx->manager->checkHashAlgorithm('SHA512') ? 0:1; |
@@ -182,7 +186,9 @@ discard block |
||
182 | 186 | ?> |
183 | 187 | <?php |
184 | 188 | $gdAvailable = extension_loaded('gd'); |
185 | -if(!$gdAvailable) $use_captcha = 0; |
|
189 | +if(!$gdAvailable) { |
|
190 | + $use_captcha = 0; |
|
191 | +} |
|
186 | 192 | ?> |
187 | 193 | <tr> |
188 | 194 | <td nowrap class="warning"><?php echo $_lang['captcha_title'] ?><br><small>[(use_captcha)]</small></td> |
@@ -127,7 +127,9 @@ |
||
127 | 127 | <?php |
128 | 128 | // invoke OnUserSettingsRender event |
129 | 129 | $evtOut = $modx->invokeEvent('OnUserSettingsRender'); |
130 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
130 | + if(is_array($evtOut)) { |
|
131 | + echo implode("",$evtOut); |
|
132 | + } |
|
131 | 133 | ?> |
132 | 134 | </td> |
133 | 135 | </tr> |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | <td> |
24 | 24 | <select name="which_browser" size="1" class="inputBox" onchange="documentDirty=true;"> |
25 | 25 | <?php |
26 | - foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
26 | + foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
27 | 27 | $dir = str_replace('\\', '/', $dir); |
28 | 28 | $browser_name = substr($dir, strrpos($dir, '/') + 1); |
29 | 29 | $selected = $browser_name == $which_browser ? ' selected="selected"' : ''; |
@@ -235,7 +235,9 @@ discard block |
||
235 | 235 | <?php |
236 | 236 | // invoke OnMiscSettingsRender event |
237 | 237 | $evtOut = $modx->invokeEvent('OnMiscSettingsRender'); |
238 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
238 | + if(is_array($evtOut)) { |
|
239 | + echo implode("",$evtOut); |
|
240 | + } |
|
239 | 241 | ?> |
240 | 242 | </td> |
241 | 243 | </tr> |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | <select name="manager_theme" size="1" class="inputBox" onChange="documentDirty=true; document.forms['settings'].theme_refresher.value = Date.parse(new Date());"> |
50 | 50 | <?php |
51 | 51 | $dir = dir("media/style/"); |
52 | - while ($file = $dir->read()) { |
|
53 | - if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
54 | - if ($file === 'common') { |
|
52 | + while ($file = $dir->read()) { |
|
53 | + if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
54 | + if ($file === 'common') { |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | $themename = $file; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $tpl = '<option value="[+value+]" [+selected+]>[+title+]</option>' . "\n"; |
210 | 210 | $option = explode(',', $_lang['settings_group_tv_options']); |
211 | 211 | $output = array(); |
212 | - foreach ($option as $k => $v) { |
|
212 | + foreach ($option as $k => $v) { |
|
213 | 213 | $selected = ($k == $group_tvs) ? 'selected' : ''; |
214 | 214 | $s = array('[+value+]', '[+selected+]', '[+title+]'); |
215 | 215 | $r = array($k, $selected, $v); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $tpl = '<option value="[+value+]" [+selected+]>[*[+value+]*]</option>' . "\n"; |
283 | 283 | $option = array('pagetitle', 'longtitle', 'menutitle', 'alias', 'createdon', 'editedon', 'publishedon'); |
284 | 284 | $output = array(); |
285 | - foreach ($option as $v) { |
|
285 | + foreach ($option as $v) { |
|
286 | 286 | $selected = ($v == $resource_tree_node_name) ? 'selected' : ''; |
287 | 287 | $s = array('[+value+]', '[+selected+]'); |
288 | 288 | $r = array($v, $selected); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | <?php |
364 | 364 | $datetime_format_list = array('dd-mm-YYYY', 'mm/dd/YYYY', 'YYYY/mm/dd'); |
365 | 365 | $str = ''; |
366 | - foreach ($datetime_format_list as $value) { |
|
366 | + foreach ($datetime_format_list as $value) { |
|
367 | 367 | $selectedtext = ($datetime_format == $value) ? ' selected' : ''; |
368 | 368 | $str .= '<option value="' . $value . '"' . $selectedtext . '>'; |
369 | 369 | $str .= $value . '</option>' . PHP_EOL; |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | <?php |
446 | 446 | // invoke OnRichTextEditorRegister event |
447 | 447 | $evtOut = $modx->invokeEvent('OnRichTextEditorRegister'); |
448 | - if (!is_array($evtOut)) { |
|
448 | + if (!is_array($evtOut)) { |
|
449 | 449 | $evtOut = array(); |
450 | 450 | $use_editor = 0; |
451 | 451 | } |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | <?php |
478 | 478 | // invoke OnRichTextEditorRegister event |
479 | 479 | echo "<option value='none'" . ($which_editor == 'none' ? " selected='selected'" : "") . ">" . $_lang['none'] . "</option>\n"; |
480 | - if (is_array($evtOut)) { |
|
481 | - foreach ($evtOut as $editor) { |
|
480 | + if (is_array($evtOut)) { |
|
481 | + foreach ($evtOut as $editor) { |
|
482 | 482 | echo "<option value='$editor'" . ($which_editor == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
483 | 483 | } |
484 | 484 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | <?php |
535 | 535 | // invoke OnInterfaceSettingsRender event |
536 | 536 | $evtOut = $modx->invokeEvent('OnInterfaceSettingsRender'); |
537 | - if (is_array($evtOut)) { |
|
537 | + if (is_array($evtOut)) { |
|
538 | 538 | echo implode("", $evtOut); |
539 | 539 | } |
540 | 540 | ?> |
@@ -82,23 +82,23 @@ discard block |
||
82 | 82 | <?php |
83 | 83 | |
84 | 84 | $currentCategory = ''; |
85 | - while ($row = $modx->db->getRow($rs)) { |
|
85 | + while ($row = $modx->db->getRow($rs)) { |
|
86 | 86 | $thisCategory = $row['category']; |
87 | - if($thisCategory == null) { |
|
87 | + if($thisCategory == null) { |
|
88 | 88 | $thisCategory = $_lang['no_category']; |
89 | 89 | } |
90 | - if($thisCategory != $currentCategory) { |
|
91 | - if($closeOptGroup) { |
|
90 | + if($thisCategory != $currentCategory) { |
|
91 | + if($closeOptGroup) { |
|
92 | 92 | echo "\t\t\t\t\t</optgroup>\n"; |
93 | 93 | } |
94 | 94 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
95 | 95 | $closeOptGroup = true; |
96 | - } else { |
|
96 | + } else { |
|
97 | 97 | $closeOptGroup = false; |
98 | 98 | } |
99 | 99 | |
100 | 100 | $selectedtext = $row['id'] == $default_template ? ' selected="selected"' : ''; |
101 | - if ($selectedtext) { |
|
101 | + if ($selectedtext) { |
|
102 | 102 | $oldTmpId = $row['id']; |
103 | 103 | $oldTmpName = $row['templatename']; |
104 | 104 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
107 | 107 | $currentCategory = $thisCategory; |
108 | 108 | } |
109 | - if($thisCategory != '') { |
|
109 | + if($thisCategory != '') { |
|
110 | 110 | echo "\t\t\t\t\t</optgroup>\n"; |
111 | 111 | } |
112 | 112 | ?> |
@@ -138,11 +138,12 @@ discard block |
||
138 | 138 | $modx->db->select('id', '[+prefix+]site_plugins', |
139 | 139 | "plugincode LIKE '%phx.parser.class.inc.php%OnParseDocument();%' AND disabled != 1") |
140 | 140 | ); |
141 | - if($count) { |
|
141 | + if($count) { |
|
142 | 142 | $disabledFilters = 1; |
143 | 143 | echo '<b>'.$_lang['enable_filter_phx_warning'].'</b><br/>'; |
144 | - } |
|
145 | - else $disabledFilters = false; |
|
144 | + } else { |
|
145 | + $disabledFilters = false; |
|
146 | + } |
|
146 | 147 | ?> |
147 | 148 | <?php echo wrap_label($_lang['yes'],form_radio('enable_filter', 1, '', $disabledFilters));?><br /> |
148 | 149 | <?php echo wrap_label($_lang['no'], form_radio('enable_filter', 0, '', $disabledFilters));?> |
@@ -204,7 +205,7 @@ discard block |
||
204 | 205 | <select name="lst_custom_contenttype" style="width:200px;height:100px;" size="5"> |
205 | 206 | <?php |
206 | 207 | $ct = explode(",",$custom_contenttype); |
207 | - for($i=0;$i<count($ct);$i++) { |
|
208 | + for($i=0;$i<count($ct);$i++) { |
|
208 | 209 | echo "<option value=\"".$ct[$i]."\">".$ct[$i]."</option>"; |
209 | 210 | } |
210 | 211 | ?> |
@@ -259,7 +260,7 @@ discard block |
||
259 | 260 | <th><?php echo $_lang['serveroffset_title'] ?><br><small>[(server_offset_time)]</small></th> |
260 | 261 | <td> <select name="server_offset_time" size="1" class="inputBox"> |
261 | 262 | <?php |
262 | - for($i=-24; $i<25; $i++) { |
|
263 | + for($i=-24; $i<25; $i++) { |
|
263 | 264 | $seconds = $i*60*60; |
264 | 265 | $selectedtext = $seconds==$server_offset_time ? "selected='selected'" : "" ; |
265 | 266 | ?> |
@@ -296,7 +297,9 @@ discard block |
||
296 | 297 | <?php |
297 | 298 | // invoke OnSiteSettingsRender event |
298 | 299 | $evtOut = $modx->invokeEvent('OnSiteSettingsRender'); |
299 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
300 | + if(is_array($evtOut)) { |
|
301 | + echo implode("",$evtOut); |
|
302 | + } |
|
300 | 303 | ?> |
301 | 304 | </td> |
302 | 305 | </tr> |
@@ -4,12 +4,13 @@ discard block |
||
4 | 4 | * |
5 | 5 | * @return array of keys from a language file |
6 | 6 | */ |
7 | -function get_lang_keys($filename) { |
|
7 | +function get_lang_keys($filename) |
|
8 | +{ |
|
8 | 9 | $file = MODX_MANAGER_PATH.'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
9 | - if(is_file($file) && is_readable($file)) { |
|
10 | + if(is_file($file) && is_readable($file)) { |
|
10 | 11 | include($file); |
11 | 12 | return array_keys($_lang); |
12 | - } else { |
|
13 | + } else { |
|
13 | 14 | return array(); |
14 | 15 | } |
15 | 16 | } |
@@ -18,11 +19,12 @@ discard block |
||
18 | 19 | * |
19 | 20 | * @return array of languages that define the key in their file |
20 | 21 | */ |
21 | -function get_langs_by_key($key) { |
|
22 | +function get_langs_by_key($key) |
|
23 | +{ |
|
22 | 24 | global $lang_keys; |
23 | 25 | $lang_return = array(); |
24 | - foreach($lang_keys as $lang=>$keys) { |
|
25 | - if(in_array($key, $keys)) { |
|
26 | + foreach($lang_keys as $lang=>$keys) { |
|
27 | + if(in_array($key, $keys)) { |
|
26 | 28 | $lang_return[] = $lang; |
27 | 29 | } |
28 | 30 | } |
@@ -38,23 +40,24 @@ discard block |
||
38 | 40 | * @param string $selected_lang specify language to select in option list, default none |
39 | 41 | * @return html option list |
40 | 42 | */ |
41 | -function get_lang_options($key=null, $selected_lang=null) { |
|
43 | +function get_lang_options($key=null, $selected_lang=null) |
|
44 | +{ |
|
42 | 45 | global $lang_keys, $_lang; |
43 | 46 | $lang_options = ''; |
44 | - if($key) { |
|
47 | + if($key) { |
|
45 | 48 | $languages = get_langs_by_key($key); |
46 | 49 | sort($languages); |
47 | 50 | $lang_options .= '<option value="">'.$_lang['language_title'].'</option>'; |
48 | 51 | |
49 | - foreach($languages as $language_name) { |
|
52 | + foreach($languages as $language_name) { |
|
50 | 53 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
51 | 54 | $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>'; |
52 | 55 | } |
53 | 56 | return $lang_options; |
54 | - } else { |
|
57 | + } else { |
|
55 | 58 | $languages = array_keys($lang_keys); |
56 | 59 | sort($languages); |
57 | - foreach($languages as $language_name) { |
|
60 | + foreach($languages as $language_name) { |
|
58 | 61 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
59 | 62 | $sel = $language_name == $selected_lang ? ' selected="selected"' : ''; |
60 | 63 | $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>'; |
@@ -63,31 +66,42 @@ discard block |
||
63 | 66 | } |
64 | 67 | } |
65 | 68 | |
66 | -function form_radio($name,$value,$add='',$disabled=false) { |
|
69 | +function form_radio($name,$value,$add='',$disabled=false) |
|
70 | +{ |
|
67 | 71 | global ${$name}; |
68 | 72 | $var = ${$name}; |
69 | 73 | $checked = ($var==$value) ? ' checked="checked"' : ''; |
70 | - if($disabled) $disabled = ' disabled'; else $disabled = ''; |
|
71 | - if($add) $add = ' ' . $add; |
|
74 | + if($disabled) { |
|
75 | + $disabled = ' disabled'; |
|
76 | + } else { |
|
77 | + $disabled = ''; |
|
78 | + } |
|
79 | + if($add) { |
|
80 | + $add = ' ' . $add; |
|
81 | + } |
|
72 | 82 | return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value, $checked, $disabled, $add); |
73 | 83 | } |
74 | 84 | |
75 | -function wrap_label($str='',$object) { |
|
85 | +function wrap_label($str='',$object) |
|
86 | +{ |
|
76 | 87 | return "<label>{$object}\n{$str}</label>"; |
77 | 88 | } |
78 | 89 | |
79 | -function parseText($tpl='', $ph=array()) { |
|
80 | - if(empty($ph) || empty($tpl)) return $tpl; |
|
90 | +function parseText($tpl='', $ph=array()) |
|
91 | +{ |
|
92 | + if(empty($ph) || empty($tpl)) { |
|
93 | + return $tpl; |
|
94 | + } |
|
81 | 95 | |
82 | - foreach($ph as $k=>$v) |
|
83 | - { |
|
96 | + foreach($ph as $k=>$v) { |
|
84 | 97 | $k = "[+{$k}+]"; |
85 | 98 | $tpl = str_replace($k, $v, $tpl); |
86 | 99 | } |
87 | 100 | return $tpl; |
88 | 101 | } |
89 | 102 | |
90 | -function showHide($cond=true) { |
|
103 | +function showHide($cond=true) |
|
104 | +{ |
|
91 | 105 | global $displayStyle; |
92 | 106 | $showHide = $cond ? $displayStyle : 'none'; |
93 | 107 | return sprintf('style="display:%s"', $showHide); |
@@ -15,8 +15,14 @@ |
||
15 | 15 | <td > |
16 | 16 | <select name="smtp_secure" size="1" class="inputBox"> |
17 | 17 | <option value="none" ><?php echo $_lang['no'] ?></option> |
18 | - <option value="ssl" <?php if($smtp_secure == 'ssl') echo "selected='selected'"; ?> >SSL</option> |
|
19 | - <option value="tls" <?php if($smtp_secure == 'tls') echo "selected='selected'"; ?> >TLS</option> |
|
18 | + <option value="ssl" <?php if($smtp_secure == 'ssl') { |
|
19 | + echo "selected='selected'"; |
|
20 | +} |
|
21 | +?> >SSL</option> |
|
22 | + <option value="tls" <?php if($smtp_secure == 'tls') { |
|
23 | + echo "selected='selected'"; |
|
24 | +} |
|
25 | +?> >TLS</option> |
|
20 | 26 | </select> |
21 | 27 | <br /> |
22 | 28 | </td> |
@@ -159,7 +159,9 @@ |
||
159 | 159 | <?php |
160 | 160 | // invoke OnFriendlyURLSettingsRender event |
161 | 161 | $evtOut = $modx->invokeEvent('OnFriendlyURLSettingsRender'); |
162 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
162 | + if(is_array($evtOut)) { |
|
163 | + echo implode("",$evtOut); |
|
164 | + } |
|
163 | 165 | ?> |
164 | 166 | </td> |
165 | 167 | </tr> |