Passed
Push — master ( 9c54c2...fc2135 )
by John
02:00
created
ManageUltimateMenu.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -333,7 +333,7 @@
 block discarded – undo
333 333
 		{
334 334
 			// I see you made it to the final stage, my young padawan.
335 335
 			if (!empty($id))
336
-				$smcFunc['db_query']('','
336
+				$smcFunc['db_query']('', '
337 337
 					UPDATE {db_prefix}um_menu
338 338
 					SET name = {string:name}, type = {string:type}, target = {string:target}, position = {string:position}, link = {string:link}, status = {string:status}, permissions = {string:permissions}, parent = {string:parent}
339 339
 					WHERE id_button = {int:id}',
Please login to merge, or discard this patch.
Braces   +39 added lines, -29 removed lines patch added patch discarded remove patch
@@ -8,8 +8,9 @@  discard block
 block discarded – undo
8 8
  * @license http://opensource.org/licenses/MIT MIT
9 9
  */
10 10
 
11
-if (!defined('SMF'))
11
+if (!defined('SMF')) {
12 12
 	die('Hacking attempt...');
13
+}
13 14
 
14 15
 function Menu()
15 16
 {
@@ -24,8 +25,9 @@  discard block
 block discarded – undo
24 25
 	);
25 26
 
26 27
 	// Default to sub action 'manmenu'
27
-	if (!isset($_GET['sa']) || !isset($subActions[$_GET['sa']]))
28
-		$_GET['sa'] = 'manmenu';
28
+	if (!isset($_GET['sa']) || !isset($subActions[$_GET['sa']])) {
29
+			$_GET['sa'] = 'manmenu';
30
+	}
29 31
 
30 32
 	// Have you got the proper permissions?
31 33
 	isAllowedTo('admin_forum');
@@ -73,8 +75,9 @@  discard block
 block discarded – undo
73 75
 		checkSession();
74 76
 
75 77
 		// Make sure every entry is a proper integer.
76
-		foreach ($_POST['remove'] as $index => $page_id)
77
-			$_POST['remove'][(int) $index] = (int) $page_id;
78
+		foreach ($_POST['remove'] as $index => $page_id) {
79
+					$_POST['remove'][(int) $index] = (int) $page_id;
80
+		}
78 81
 
79 82
 		// Delete the page!
80 83
 		$smcFunc['db_query']('', '
@@ -95,8 +98,8 @@  discard block
 block discarded – undo
95 98
 		foreach (total_getMenu() as $item)
96 99
 		{
97 100
 			$status = !empty($_POST['status'][$item['id_button']]) ? 'active' : 'inactive';
98
-			if ($status != $item['status'])
99
-				$smcFunc['db_query']('', '
101
+			if ($status != $item['status']) {
102
+							$smcFunc['db_query']('', '
100 103
 					UPDATE {db_prefix}um_menu
101 104
 					SET status = {string:status}
102 105
 					WHERE id_button = {int:item}',
@@ -105,14 +108,16 @@  discard block
 block discarded – undo
105 108
 						'item' => $item['id_button'],
106 109
 					)
107 110
 				);
111
+			}
108 112
 		}
109 113
 		rebuild_um_menu();
110 114
 		redirectexit('action=admin;area=umen');
111 115
 	}
112 116
 
113 117
 	// New item?
114
-	if (isset($_POST['new']))
115
-		redirectexit('action=admin;area=umen;sa=addbutton');
118
+	if (isset($_POST['new'])) {
119
+			redirectexit('action=admin;area=umen;sa=addbutton');
120
+	}
116 121
 
117 122
 	loadLanguage('ManageBoards');
118 123
 
@@ -302,13 +307,15 @@  discard block
 block discarded – undo
302 307
 		$target = isset($_REQUEST['target']) ? $_REQUEST['target'] : '_self';
303 308
 
304 309
 		// These fields are required!
305
-		foreach ($required_fields as $required_field)
306
-			if ($_POST[$required_field] == '')
310
+		foreach ($required_fields as $required_field) {
311
+					if ($_POST[$required_field] == '')
307 312
 				$post_errors[$required_field] = 'um_menu_empty_' . $required_field;
313
+		}
308 314
 
309 315
 		// Stop making numeric names!
310
-		if (is_numeric($name))
311
-			$post_errors['name'] = 'um_menu_numeric';
316
+		if (is_numeric($name)) {
317
+					$post_errors['name'] = 'um_menu_numeric';
318
+		}
312 319
 
313 320
 		// Let's make sure you're not trying to make a name that's already taken.
314 321
 		$request = $smcFunc['db_query']('', '
@@ -326,14 +333,15 @@  discard block
 block discarded – undo
326 333
 
327 334
 		$smcFunc['db_free_result']($request);
328 335
 
329
-		if ($check > 0)
330
-			$post_errors['name'] = 'um_menu_mysql';
336
+		if ($check > 0) {
337
+					$post_errors['name'] = 'um_menu_mysql';
338
+		}
331 339
 
332 340
 		if (empty($post_errors))
333 341
 		{
334 342
 			// I see you made it to the final stage, my young padawan.
335
-			if (!empty($id))
336
-				$smcFunc['db_query']('','
343
+			if (!empty($id)) {
344
+							$smcFunc['db_query']('','
337 345
 					UPDATE {db_prefix}um_menu
338 346
 					SET name = {string:name}, type = {string:type}, target = {string:target}, position = {string:position}, link = {string:link}, status = {string:status}, permissions = {string:permissions}, parent = {string:parent}
339 347
 					WHERE id_button = {int:id}',
@@ -349,8 +357,8 @@  discard block
 block discarded – undo
349 357
 						'parent' => $parent,
350 358
 					)
351 359
 				);
352
-			else
353
-				$smcFunc['db_insert']('insert',
360
+			} else {
361
+							$smcFunc['db_insert']('insert',
354 362
 					'{db_prefix}um_menu',
355 363
 						array(
356 364
 							'slug' => 'string', 'name' => 'string', 'type' => 'string', 'target' => 'string', 'position' => 'string', 'link' => 'string', 'status' => 'string', 'permissions' => 'string', 'parent' => 'string',
@@ -360,6 +368,7 @@  discard block
 block discarded – undo
360 368
 						),
361 369
 						array('id_button')
362 370
 					);
371
+			}
363 372
 
364 373
 			rebuild_um_menu();
365 374
 
@@ -368,8 +377,7 @@  discard block
 block discarded – undo
368 377
 			clean_cache('menu_buttons');
369 378
 
370 379
 			redirectexit('action=admin;area=umen');
371
-		}
372
-		else
380
+		} else
373 381
 		{
374 382
 			$context['post_error'] = $post_errors;
375 383
 			$context['error_title'] = empty($id) ? 'um_menu_errors_create' : 'um_menu_errors_modify';
@@ -430,8 +438,7 @@  discard block
 block discarded – undo
430 438
 			'status' => $row['status'],
431 439
 			'parent' => $row['parent'],
432 440
 		);
433
-	}
434
-	else
441
+	} else
435 442
 	{
436 443
 		$context['button_data'] = array(
437 444
 			'name' => '',
@@ -458,8 +465,9 @@  discard block
 block discarded – undo
458 465
 		FROM {db_prefix}um_menu');
459 466
 
460 467
 	$um_menu = array();
461
-	while ($row = $smcFunc['db_fetch_assoc']($request))
462
-		$um_menu[] = $row;
468
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
469
+			$um_menu[] = $row;
470
+	}
463 471
 
464 472
 	return $um_menu;
465 473
 }
@@ -481,8 +489,9 @@  discard block
 block discarded – undo
481 489
 	);
482 490
 
483 491
 	$um_menu = array();
484
-	while ($row = $smcFunc['db_fetch_assoc']($request))
485
-		$um_menu[] = $row;
492
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
493
+			$um_menu[] = $row;
494
+	}
486 495
 
487 496
 	return $um_menu;
488 497
 }
@@ -510,8 +519,9 @@  discard block
 block discarded – undo
510 519
 		FROM {db_prefix}um_menu');
511 520
 
512 521
 	$db_buttons = array();
513
-	while ($row = $smcFunc['db_fetch_assoc']($request))
514
-		$db_buttons[$row['id_button']] = $row;
522
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
523
+			$db_buttons[$row['id_button']] = $row;
524
+	}
515 525
 
516 526
 	$smcFunc['db_free_result']($request);
517 527
 	updateSettings(
Please login to merge, or discard this patch.