Completed
Pull Request — develop (#518)
by Agel_Nash
05:24
created
manager/actions/category_mgr/inc/request_trigger.inc.php 1 patch
Braces   +32 added lines, -67 removed lines patch added patch discarded remove patch
@@ -6,26 +6,22 @@  discard block
 block discarded – undo
6 6
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
7 7
 }
8 8
 
9
-if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) )
10
-{
9
+if( isset( $_REQUEST[$cm->get('request_key')]['ajax'] ) ) {
11 10
     $_data  = $_REQUEST[$cm->get('request_key')];
12 11
     $output = '';
13 12
     $task   = $_data['task'];
14
-    switch( $task )
15
-    {
13
+    switch( $task ) {
16 14
         /**
17 15
          * get categories
18 16
          */
19 17
         case 'categorize_load_elements':
20 18
             $elements = $_data['elements'];
21 19
             
22
-            if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) )
23
-            { 
20
+            if( $uncategorized_elements = $cm->getAssignedElements( 0, $_data['elements'] ) ) {
24 21
                $output .= $cm->renderView('chunks/categorize/uncategorized_elements', $uncategorized_elements);
25 22
             }
26 23
             
27
-            foreach( $cm->getCategories() as $category )
28
-            {
24
+            foreach( $cm->getCategories() as $category ) {
29 25
                 $category['elements'] = $cm->getAssignedElements( $category['id'], $_data['elements'] );
30 26
                 $output .= $cm->renderView('chunks/categorize/category', $category);
31 27
             }            
@@ -41,8 +37,7 @@  discard block
 block discarded – undo
41 37
  * @see http://modxcms.com/forums/index.php/topic,40430.msg251476.html#msg251476 
42 38
  * 
43 39
  */
44
-if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) )
45
-{  
40
+if( isset( $_POST[$cm->get('request_key')]['categorize']['submit'] ) ) {
46 41
     $_data = $_POST[$cm->get('request_key')]['categorize'];
47 42
     $_changes = 0;
48 43
 
@@ -54,16 +49,13 @@  discard block
 block discarded – undo
54 49
         'categorize'
55 50
     );
56 51
     
57
-    if( !isset( $_data['elements'] ) )
58
-    {
52
+    if( !isset( $_data['elements'] ) ) {
59 53
         $cm->addMessage( $cm->txt('cm_unknown_error'), 'categorize' );
60 54
         return;
61 55
     }
62 56
 
63
-    foreach( $_data['elements'] as $element_id => $data )
64
-    {
65
-        if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) )
66
-        {
57
+    foreach( $_data['elements'] as $element_id => $data ) {
58
+        if( $cm->updateElement( $_data['elementsgroup'], $element_id, $data['category_id'] ) ) {
67 59
             $cm->addMessage(
68 60
                 sprintf( 
69 61
                     $cm->txt('cm_x_assigned_to_category_y'), 
@@ -78,13 +70,10 @@  discard block
 block discarded – undo
78 70
         }
79 71
     }
80 72
     
81
-    if( $_changes === 0 )
82
-    {
73
+    if( $_changes === 0 ) {
83 74
         $cm->addMessage( $cm->txt('cm_no_categorization'), 'categorize' );
84 75
         return;
85
-    }
86
-    else
87
-    {
76
+    } else {
88 77
         $cm->addMessage(
89 78
             sprintf( 
90 79
                 $cm->txt('cm_x_changes_made'), 
@@ -98,26 +87,22 @@  discard block
 block discarded – undo
98 87
 /**
99 88
  * Add a new category
100 89
  */
101
-if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) )
102
-{
90
+if( isset( $_POST[$cm->get('request_key')]['add']['submit'] ) ) {
103 91
     $_data    = $_POST[$cm->get('request_key')]['add']['data'];
104 92
     $category = trim( html_entity_decode($_data['name']) );
105 93
     $rank     = (int) $_data['rank'];
106 94
 
107
-    if( empty( $category ) )
108
-    {
95
+    if( empty( $category ) ) {
109 96
        $cm->addMessage( $cm->txt('cm_enter_name_for_category'), 'add' );
110 97
        return;
111 98
     }
112 99
 
113
-    if( $cm->isCategoryExists( $category ) )
114
-    {
100
+    if( $cm->isCategoryExists( $category ) ) {
115 101
        $cm->addMessage( sprintf( $cm->txt('cm_category_x_exists'), $category ), 'add' ); 
116 102
        return;
117 103
     }
118 104
     
119
-    if( $cm->addCategory( $category, $rank ) !== 0 )
120
-    {
105
+    if( $cm->addCategory( $category, $rank ) !== 0 ) {
121 106
         $cm->addMessage(
122 107
             sprintf( 
123 108
                 $cm->txt( 'cm_category_x_saved_at_position_y' ),
@@ -126,9 +111,7 @@  discard block
 block discarded – undo
126 111
             ),
127 112
             'add'
128 113
         );
129
-    }
130
-    else
131
-    {
114
+    } else {
132 115
         $cm->addMessage( $cm->txt('cm_unknown_error'), 'add' );
133 116
     }    
134 117
 }
@@ -136,20 +119,17 @@  discard block
 block discarded – undo
136 119
 /**
137 120
  * Sort categories
138 121
  */
139
-if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) )
140
-{
122
+if( isset( $_POST[$cm->get('request_key')]['sort']['submit'] ) ) {
141 123
     $categories = $_POST[$cm->get('request_key')]['sort']['data'];
142 124
     $_changes   = 0;
143 125
     
144
-    foreach( $categories as $category_id => $_data  ) 
145
-    {
126
+    foreach( $categories as $category_id => $_data  ) {
146 127
         $data = array(
147 128
             'category' => urldecode( $_data['category'] ),
148 129
             'rank'     => $_data['rank']
149 130
         );
150 131
         
151
-        if( $cm->updateCategory( $category_id, $data ) )
152
-        {
132
+        if( $cm->updateCategory( $category_id, $data ) ) {
153 133
             $cm->addMessage(
154 134
                 sprintf( 
155 135
                     $cm->txt('cm_category_x_moved_to_position_y'),
@@ -162,12 +142,9 @@  discard block
 block discarded – undo
162 142
         }
163 143
     }
164 144
         
165
-    if( $_changes === 0 )
166
-    {
145
+    if( $_changes === 0 ) {
167 146
         $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'sort');
168
-    }
169
-    else
170
-    {
147
+    } else {
171 148
         $cm->addMessage(
172 149
             sprintf( 
173 150
                 $cm->txt('cm_x_changes_made'), 
@@ -181,17 +158,13 @@  discard block
 block discarded – undo
181 158
 /**
182 159
  * Edit categories
183 160
  */
184
-if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) )
185
-{
161
+if( isset( $_POST[$cm->get('request_key')]['edit']['submit'] ) ) {
186 162
     $categories = $_POST[$cm->get('request_key')]['edit']['data'];
187 163
     $_changes   = 0;
188 164
 
189
-    foreach( $categories as $category_id => $_data  ) 
190
-    {
191
-        if( isset( $_data['delete'] ) )
192
-        {
193
-            if( $cm->deleteCategory( $category_id ) )
194
-            {
165
+    foreach( $categories as $category_id => $_data  ) {
166
+        if( isset( $_data['delete'] ) ) {
167
+            if( $cm->deleteCategory( $category_id ) ) {
195 168
                 $cm->addMessage(
196 169
                     sprintf(
197 170
                         $cm->txt('cm_category_x_deleted'),
@@ -209,8 +182,7 @@  discard block
 block discarded – undo
209 182
             'rank'     => $_data['rank']
210 183
         );
211 184
         
212
-        if( $cm->updateCategory( $category_id, $data ) )
213
-        {
185
+        if( $cm->updateCategory( $category_id, $data ) ) {
214 186
             $cm->addMessage(
215 187
                 sprintf( 
216 188
                     $cm->txt('cm_category_x_renamed_to_y'),
@@ -223,8 +195,7 @@  discard block
 block discarded – undo
223 195
         }
224 196
     }
225 197
 
226
-    if( $_changes === 0 )
227
-    {
198
+    if( $_changes === 0 ) {
228 199
         $cm->addMessage( $cm->txt( 'cm_no_changes' ), 'edit');
229 200
     }
230 201
 }
@@ -233,12 +204,10 @@  discard block
 block discarded – undo
233 204
  * Delete singel category by $_GET
234 205
  */
235 206
 if( isset( $_GET[$cm->get('request_key')]['delete'] ) 
236
-    && !empty( $_GET[$cm->get('request_key')]['delete'] ) )
237
-{
207
+    && !empty( $_GET[$cm->get('request_key')]['delete'] ) ) {
238 208
     $category_id = (int)$_GET[$cm->get('request_key')]['delete'];
239 209
     
240
-    if( $cm->deleteCategory( $category_id ) )
241
-    {
210
+    if( $cm->deleteCategory( $category_id ) ) {
242 211
         $cm->addMessage(
243 212
             sprintf(
244 213
                 $cm->txt('cm_category_x_deleted'), 
@@ -251,16 +220,13 @@  discard block
 block discarded – undo
251 220
 /**
252 221
  * Translate phrases
253 222
  */
254
-if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) )
255
-{ 
223
+if( isset( $_POST[$cm->get('request_key')]['translate']['submit'] ) ) {
256 224
     $translations = $_POST[$cm->get('request_key')]['translate']['data'];
257 225
 
258
-    foreach( $translations as $native_phrase => $translation )
259
-    {
226
+    foreach( $translations as $native_phrase => $translation ) {
260 227
         $native_phrase = urldecode( $native_phrase );
261 228
 
262
-        if( empty( $translation ) )
263
-        {
229
+        if( empty( $translation ) ) {
264 230
             $translation = $native_phrase;
265 231
             
266 232
             $cm->addMessage(
@@ -285,8 +251,7 @@  discard block
 block discarded – undo
285 251
         );
286 252
     }
287 253
 
288
-    if( empty( $cm->new_translations ) )
289
-    {   
254
+    if( empty( $cm->new_translations ) ) {
290 255
        //$_REQUEST['webfxtab_manage-categories-pane'] = 0;
291 256
        // unset( $_COOKIE['webfxtab_manage-categories-pane'] );
292 257
        // setcookie('webfxtab_manage-categories-pane', 0);
Please login to merge, or discard this patch.
manager/actions/eventlog.dynamic.php 1 patch
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(IN_MANAGER_MODE != "true") {
2
+if(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('view_eventlog')) {
5
+if(!$modx->hasPermission('view_eventlog')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 $modx->manager->initPageViewState();
16 16
 
17 17
 // get and save search string
18
-if($_REQUEST['op'] == 'reset') {
18
+if($_REQUEST['op'] == 'reset') {
19 19
 	$sqlQuery = $query = '';
20 20
 	$_PAGE['vs']['search'] = '';
21
-} else {
21
+} else {
22 22
 	$sqlQuery = $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search'];
23
-	if(!is_numeric($sqlQuery)) {
23
+	if(!is_numeric($sqlQuery)) {
24 24
 		$sqlQuery = $modx->db->escape($query);
25 25
 	}
26 26
 	$_PAGE['vs']['search'] = $query;
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 					$grd->colWidths = "1%,,1%,1%,1%";
144 144
 					$grd->colAligns = "center,,,center,center";
145 145
 					$grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang['click_to_context'] . "'><i class='[+icon+]'></i></a>||template:<a href='index.php?a=115&id=[+id+]' title='" . $_lang['click_to_view_details'] . "'>[+source+]</a>||date: " . $modx->toDateFormat(null, 'formatOnly') . ' %I:%M %p';
146
-					if($listmode == '1') {
146
+					if($listmode == '1') {
147 147
 						$grd->pageSize = 0;
148 148
 					}
149
-					if($_REQUEST['op'] == 'reset') {
149
+					if($_REQUEST['op'] == 'reset') {
150 150
 						$grd->pageNumber = 1;
151 151
 					}
152 152
 					// render grid
Please login to merge, or discard this patch.
manager/actions/import_site.static.php 1 patch
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -101,7 +101,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab5_security_settings.inc.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab3_user_settings.inc.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -127,7 +127,9 @@
 block discarded – undo
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>
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab7_filebrowser_settings.inc.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab4_manager_settings.inc.php 1 patch
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                 ?>
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab1_site_settings.inc.php 1 patch
Braces   +16 added lines, -13 removed lines patch added patch discarded remove patch
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
manager/actions/mutate_settings/functions.inc.php 1 patch
Braces   +34 added lines, -20 removed lines patch added patch discarded remove patch
@@ -4,12 +4,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.