Completed
Push — release-2.1 ( b6dcfd...06dc7c )
by Jeremy
15s
created
Sources/Notify.php 1 patch
Braces   +20 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
  * @version 2.1 Beta 4
15 15
  */
16 16
 
17
-if (!defined('SMF'))
17
+if (!defined('SMF')) {
18 18
 	die('No direct access...');
19
+}
19 20
 
20 21
 /**
21 22
  * Turn off/on notification for a particular board.
@@ -34,8 +35,9 @@  discard block
 block discarded – undo
34 35
 	is_not_guest();
35 36
 
36 37
 	// You have to specify a board to turn notifications on!
37
-	if (empty($board))
38
-		fatal_lang_error('no_board', false);
38
+	if (empty($board)) {
39
+			fatal_lang_error('no_board', false);
40
+	}
39 41
 
40 42
 	// No subaction: find out what to do.
41 43
 	if (isset($_GET['mode']))
@@ -48,16 +50,16 @@  discard block
 block discarded – undo
48 50
 		require_once($sourcedir . '/Subs-Notify.php');
49 51
 		setNotifyPrefs($user_info['id'], array('board_notify_' . $board => $alertPref));
50 52
 
51
-		if ($mode > 1)
52
-			// Turn notification on.  (note this just blows smoke if it's already on.)
53
+		if ($mode > 1) {
54
+					// Turn notification on.  (note this just blows smoke if it's already on.)
53 55
 			$smcFunc['db_insert']('ignore',
54 56
 				'{db_prefix}log_notify',
55 57
 				array('id_member' => 'int', 'id_board' => 'int'),
56 58
 				array($user_info['id'], $board),
57 59
 				array('id_member', 'id_board')
58 60
 			);
59
-		else
60
-			$smcFunc['db_query']('', '
61
+		} else {
62
+					$smcFunc['db_query']('', '
61 63
 				DELETE FROM {db_prefix}log_notify
62 64
 				WHERE id_member = {int:current_member}
63 65
 				AND id_board = {int:current_board}',
@@ -66,6 +68,7 @@  discard block
 block discarded – undo
66 68
 					'current_member' => $user_info['id'],
67 69
 				)
68 70
 			);
71
+		}
69 72
 	}
70 73
 
71 74
 	// Back to the board!
@@ -80,10 +83,10 @@  discard block
 block discarded – undo
80 83
 			),
81 84
 		);
82 85
 		$context['sub_template'] = 'generic_xml';
86
+	} else {
87
+			redirectexit('board=' . $board . '.' . $_REQUEST['start']);
88
+	}
83 89
 	}
84
-	else
85
-		redirectexit('board=' . $board . '.' . $_REQUEST['start']);
86
-}
87 90
 
88 91
 /**
89 92
  * Turn off/on unread replies subscription for a topic as well as sets individual topic's alert preferences
@@ -128,8 +131,7 @@  discard block
 block discarded – undo
128 131
 					'id_msg' => 0,
129 132
 					'unwatched' => empty($mode) ? 1 : 0,
130 133
 				);
131
-			}
132
-			else
134
+			} else
133 135
 			{
134 136
 				$insert = false;
135 137
 				$log['unwatched'] = empty($mode) ? 1 : 0;
@@ -156,9 +158,8 @@  discard block
 block discarded – undo
156 158
 					array($user_info['id'], $log['id_topic']),
157 159
 					array('id_member', 'id_board')
158 160
 				);
159
-			}
160
-			else
161
-				$smcFunc['db_query']('', '
161
+			} else {
162
+							$smcFunc['db_query']('', '
162 163
 					DELETE FROM {db_prefix}log_notify
163 164
 					WHERE id_topic = {int:topic}
164 165
 						AND id_member = {int:member}',
@@ -166,6 +167,7 @@  discard block
 block discarded – undo
166 167
 						'topic' => $log['id_topic'],
167 168
 						'member' => $user_info['id'],
168 169
 					));
170
+			}
169 171
 		}
170 172
 	}
171 173
 
@@ -181,9 +183,9 @@  discard block
 block discarded – undo
181 183
 			),
182 184
 		);
183 185
 		$context['sub_template'] = 'generic_xml';
186
+	} else {
187
+			redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
188
+	}
184 189
 	}
185
-	else
186
-		redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
187
-}
188 190
 
189 191
 ?>
190 192
\ No newline at end of file
Please login to merge, or discard this patch.