Passed
Branch master (1778f3)
by John
01:51
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.
ManageUltimateMenu.template.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,9 +30,10 @@  discard block
 block discarded – undo
30 30
 						<strong>', $txt[$context['error_title']], '</strong>
31 31
 						<ul>';
32 32
 
33
-		foreach ($context['post_error'] as $error)
34
-			echo '
33
+		foreach ($context['post_error'] as $error) {
34
+					echo '
35 35
 							<li>', $txt[$error], '</li>';
36
+		}
36 37
 
37 38
 		echo '
38 39
 						</ul>
@@ -65,14 +66,16 @@  discard block
 block discarded – undo
65 66
 
66 67
 		if (!empty($buttonData['sub_buttons']))
67 68
 		{
68
-			foreach ($buttonData['sub_buttons'] as $childButton => $childButtonData)
69
-				echo '
69
+			foreach ($buttonData['sub_buttons'] as $childButton => $childButtonData) {
70
+							echo '
70 71
 									<option value="', $childButton, '"', $context['button_data']['parent'] == $childButton ? ' selected="selected"' : '', '>-- ', $childButtonData['title'], '</option>';
72
+			}
71 73
 
72
-			if (!empty($childButtonData['sub_buttons']))
73
-				foreach ($childButtonData['sub_buttons'] as $grandChildButton => $grandChildButtonData)
74
+			if (!empty($childButtonData['sub_buttons'])) {
75
+							foreach ($childButtonData['sub_buttons'] as $grandChildButton => $grandChildButtonData)
74 76
 					echo '
75 77
 									<option value="', $grandChildButton, '"', $context['button_data']['parent'] == $grandChildButton ? ' selected="selected"' : '', '>---- ', $grandChildButtonData['title'], '</option>';
78
+			}
76 79
 		}
77 80
 	}
78 81
 
@@ -120,8 +123,9 @@  discard block
 block discarded – undo
120 123
 									</label>
121 124
 								</div>';
122 125
 
123
-		if (!$permission['checked'])
124
-			$all_checked = false;
126
+		if (!$permission['checked']) {
127
+					$all_checked = false;
128
+		}
125 129
 	}
126 130
 
127 131
 	echo '
Please login to merge, or discard this patch.
install.php 1 patch
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,12 +9,14 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // If SSI.php is in the same place as this file, and SMF isn't defined...
12
-if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
12
+if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) {
13 13
 	require_once(dirname(__FILE__) . '/SSI.php');
14
+}
14 15
 
15 16
 // Hmm... no SSI.php and no SMF?
16
-elseif (!defined('SMF'))
17
+elseif (!defined('SMF')) {
17 18
 	die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');
19
+}
18 20
 
19 21
 $tables = array(
20 22
 	array(
@@ -88,9 +90,10 @@  discard block
 block discarded – undo
88 90
 {
89 91
 	$smcFunc['db_create_table']('{db_prefix}' . $table['name'], $table['columns'], $table['indexes'], array(), 'update');
90 92
 
91
-	if (isset($table['default']))
92
-		$smcFunc['db_insert']('ignore', '{db_prefix}' . $table['name'], $table['default']['columns'], $table['default']['values'], $table['default']['keys']);
93
-}
93
+	if (isset($table['default'])) {
94
+			$smcFunc['db_insert']('ignore', '{db_prefix}' . $table['name'], $table['default']['columns'], $table['default']['values'], $table['default']['keys']);
95
+	}
96
+	}
94 97
 
95 98
 // Now presenting... *drumroll*
96 99
 add_integration_function('integrate_pre_include', '$sourcedir/Subs-UltimateMenu.php');
Please login to merge, or discard this patch.
Subs-UltimateMenu.php 1 patch
Braces   +32 added lines, -22 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 um_load_menu(&$menu_buttons)
15 16
 {
@@ -26,8 +27,9 @@  discard block
 block discarded – undo
26 27
 
27 28
 	$db_buttons = @unserialize($modSettings['um_menu']);
28 29
 
29
-	if (empty($db_buttons))
30
-		return $menu_buttons;
30
+	if (empty($db_buttons)) {
31
+			return $menu_buttons;
32
+	}
31 33
 
32 34
 	foreach ($db_buttons as $key => $row)
33 35
 	{
@@ -89,8 +91,9 @@  discard block
 block discarded – undo
89 91
 	global $context, $modSettings, $smcFunc, $sourcedir, $txt;
90 92
 
91 93
 	// We'll need this for loading up the names of each group.
92
-	if (!loadLanguage('ManageBoards'))
93
-		loadLanguage('ManageBoards');
94
+	if (!loadLanguage('ManageBoards')) {
95
+			loadLanguage('ManageBoards');
96
+	}
94 97
 
95 98
 	$checked = explode(',', $checked);
96 99
 	$disallowed = explode(',', $disallowed);
@@ -105,23 +108,25 @@  discard block
 block discarded – undo
105 108
 
106 109
 	$groups = array();
107 110
 
108
-	if (!in_array(-1, $disallowed))
109
-		// Guests
111
+	if (!in_array(-1, $disallowed)) {
112
+			// Guests
110 113
 		$groups[-1] = array(
111 114
 			'id' => -1,
112 115
 			'name' => $txt['parent_guests_only'],
113 116
 			'checked' => in_array(-1, $checked) || in_array(-3, $checked),
114 117
 			'is_post_group' => false,
115 118
 		);
119
+	}
116 120
 
117
-	if (!in_array(0, $disallowed))
118
-		// Regular Members
121
+	if (!in_array(0, $disallowed)) {
122
+			// Regular Members
119 123
 		$groups[0] = array(
120 124
 			'id' => 0,
121 125
 			'name' => $txt['parent_members_only'],
122 126
 			'checked' => in_array(0, $checked) || in_array(-3, $checked),
123 127
 			'is_post_group' => false,
124 128
 		);
129
+	}
125 130
 
126 131
 	// Load membergroups.
127 132
 	$request = $smcFunc['db_query']('', '
@@ -136,14 +141,15 @@  discard block
 block discarded – undo
136 141
 			'min_posts' => -1,
137 142
 		)
138 143
 	);
139
-	while ($row = $smcFunc['db_fetch_assoc']($request))
140
-		if (!in_array($row['id_group'], $disallowed))
144
+	while ($row = $smcFunc['db_fetch_assoc']($request)) {
145
+			if (!in_array($row['id_group'], $disallowed))
141 146
 			$groups[(int) $row['id_group']] = array(
142 147
 				'id' => $row['id_group'],
143 148
 				'name' => trim($row['group_name']),
144 149
 				'checked' => in_array($row['id_group'], $checked) || in_array(-3, $checked),
145 150
 				'is_post_group' => $row['min_posts'] != -1,
146 151
 			);
152
+	}
147 153
 	$smcFunc['db_free_result']($request);
148 154
 
149 155
 	asort($groups);
@@ -157,27 +163,31 @@  discard block
 block discarded – undo
157 163
 	{
158 164
 		$offset = 0;
159 165
 
160
-		foreach ($haystack as $area => $dummy)
161
-			if (++$offset && $area == $insertion_point)
166
+		foreach ($haystack as $area => $dummy) {
167
+					if (++$offset && $area == $insertion_point)
162 168
 				break;
169
+		}
163 170
 
164
-		if ($where == 'before')
165
-			$offset--;
171
+		if ($where == 'before') {
172
+					$offset--;
173
+		}
166 174
 
167 175
 		$haystack = array_slice($haystack, 0, $offset, true) + $needle + array_slice($haystack, $offset, null, true);
168
-	}
169
-	else
170
-		foreach ($haystack as $stack)
176
+	} else {
177
+			foreach ($haystack as $stack)
171 178
 			if (array_key_exists($insertion_point, $haystack[$stack]))
172 179
 			{
173 180
 				$offset = 0;
181
+	}
174 182
 
175
-				foreach ($haystack[$stack] as $area => $dummy)
176
-					if (++$offset && $area == $insertion_point)
183
+				foreach ($haystack[$stack] as $area => $dummy) {
184
+									if (++$offset && $area == $insertion_point)
177 185
 						break;
186
+				}
178 187
 
179
-				if ($where == 'before')
180
-					$offset--;
188
+				if ($where == 'before') {
189
+									$offset--;
190
+				}
181 191
 
182 192
 				$haystack[$stack] = array_slice($haystack[$stack], 0, $offset, true) + $needle + array_slice($haystack[$stack], $offset, null, true);
183 193
 				break;
Please login to merge, or discard this patch.
uninstall-optional.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,15 +9,18 @@
 block discarded – undo
9 9
  */
10 10
 
11 11
 // If SSI.php is in the same place as this file, and SMF isn't defined...
12
-if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
12
+if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) {
13 13
 	require_once(dirname(__FILE__) . '/SSI.php');
14
+}
14 15
 
15 16
 // Hmm... no SSI.php and no SMF?
16
-elseif (!defined('SMF'))
17
+elseif (!defined('SMF')) {
17 18
 	die('<b>Error:</b> Cannot uninstall - please verify you put this in the same place as SMF\'s index.php.');
19
+}
18 20
 
19
-if (isset($modSettings['um_menu']))
21
+if (isset($modSettings['um_menu'])) {
20 22
 	unset($modSettings['um_menu']);
23
+}
21 24
 
22 25
 $smcFunc['db_query']('', '
23 26
 	DELETE FROM {db_prefix}settings
Please login to merge, or discard this patch.
uninstall-required.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,12 +9,14 @@
 block discarded – undo
9 9
  */
10 10
 
11 11
 // If SSI.php is in the same place as this file, and SMF isn't defined...
12
-if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
12
+if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) {
13 13
 	require_once(dirname(__FILE__) . '/SSI.php');
14
+}
14 15
 
15 16
 // Hmm... no SSI.php and no SMF?
16
-elseif (!defined('SMF'))
17
+elseif (!defined('SMF')) {
17 18
 	die('<b>Error:</b> Cannot uninstall - please verify you put this in the same place as SMF\'s index.php.');
19
+}
18 20
 
19 21
 remove_integration_function('integrate_pre_include', '$sourcedir/Subs-UltimateMenu.php');
20 22
 remove_integration_function('integrate_menu_buttons', 'um_load_menu');
Please login to merge, or discard this patch.