Index: trunk/extensions/WikiForum/WikiForum.php |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
28 | 28 | */ |
29 | 29 | |
30 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 30 | +if ( !defined( 'MEDIAWIKI' ) ) { |
31 | 31 | die( "This is an extension to the MediaWiki package and cannot be run standalone.\n" ); |
32 | 32 | } |
33 | 33 | |
— | — | @@ -37,7 +37,6 @@ |
38 | 38 | 'author' => array( 'Michael Chlebek', 'Jack Phoenix' ), |
39 | 39 | 'version' => '1.2-SW', |
40 | 40 | 'url' => 'http://www.mediawiki.org/wiki/Extension:WikiForum', |
41 | | - 'description' => '[[Special:WikiForum|Forum]] extension for MediaWiki', |
42 | 41 | 'descriptionmsg' => 'wikiforum-desc' |
43 | 42 | ); |
44 | 43 | |
— | — | @@ -86,6 +85,8 @@ |
87 | 86 | $wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'wfSpecialWikiForumNav'; |
88 | 87 | $wgHooks['SkinTemplateToolboxEnd'][] = 'wfSpecialWikiForumToolbox'; |
89 | 88 | |
| 89 | +// @todo FIXME: Move hook methods to a hook class. |
| 90 | + |
90 | 91 | /** |
91 | 92 | * Set up the two new parser hooks: <WikiForumList> and <WikiForumThread> |
92 | 93 | * |
— | — | @@ -126,8 +127,8 @@ |
127 | 128 | * @return Boolean: true |
128 | 129 | */ |
129 | 130 | function wfSpecialWikiForumToolbox( &$skinTemplate ) { |
130 | | - if( isset( $skinTemplate->data['nav_urls']['wikiforum'] ) ) { |
131 | | - if( $skinTemplate->data['nav_urls']['wikiforum']['href'] == '' ) { |
| 131 | + if ( isset( $skinTemplate->data['nav_urls']['wikiforum'] ) ) { |
| 132 | + if ( $skinTemplate->data['nav_urls']['wikiforum']['href'] == '' ) { |
132 | 133 | echo '<li id="t-iswikiforum">' . wfMsg( 'wikiforum' ) . '</li>'; |
133 | 134 | } else { |
134 | 135 | $url = $skinTemplate->data['nav_urls']['wikiforum']['href']; |
— | — | @@ -146,7 +147,7 @@ |
147 | 148 | function renderWikiForumList( $input, $args, $parser, $frame ) { |
148 | 149 | global $wgUser, $wgLang, $wgScriptPath; |
149 | 150 | |
150 | | - if( !isset( $args['num'] ) ) { |
| 151 | + if ( !isset( $args['num'] ) ) { |
151 | 152 | $args['num'] = 5; |
152 | 153 | } |
153 | 154 | |
— | — | @@ -184,7 +185,7 @@ |
185 | 186 | wfMsg( 'wikiforum-latest-reply' ) |
186 | 187 | ); |
187 | 188 | |
188 | | - foreach( $sqlThreads as $thread ) { |
| 189 | + foreach ( $sqlThreads as $thread ) { |
189 | 190 | $icon = WikiForumClass::getThreadIcon( |
190 | 191 | $thread->wft_posted_timestamp, |
191 | 192 | $thread->wft_closed, |
— | — | @@ -194,7 +195,7 @@ |
195 | 196 | $lastpost = ''; |
196 | 197 | // If there are some replies, then we can obviously figure out who was |
197 | 198 | // the last user who posted something on the topic... |
198 | | - if( $thread->wft_reply_count > 0 ) { |
| 199 | + if ( $thread->wft_reply_count > 0 ) { |
199 | 200 | $lastpost = wfMsg( |
200 | 201 | 'wikiforum-by', |
201 | 202 | $wgLang->timeanddate( $thread->wft_last_post_timestamp ), |
— | — | @@ -213,7 +214,7 @@ |
214 | 215 | ); |
215 | 216 | $forumLink = $sk->link( |
216 | 217 | $specialPageObj, |
217 | | - $thread->wff_forum_name, |
| 218 | + $thread->wff_forum_name, |
218 | 219 | array(), |
219 | 220 | array( 'forum' => $thread->wff_forum ) |
220 | 221 | ); |
— | — | @@ -254,7 +255,7 @@ |
255 | 256 | function renderWikiForumThread( $input, $args, $parser, $frame ) { |
256 | 257 | global $wgOut, $wgLang, $wgScriptPath; |
257 | 258 | |
258 | | - if( isset( $args['id'] ) && $args['id'] > 0 ) { |
| 259 | + if ( isset( $args['id'] ) && $args['id'] > 0 ) { |
259 | 260 | $dbr = wfGetDB( DB_SLAVE ); |
260 | 261 | $sqlThreads = $dbr->select( |
261 | 262 | array( 'wikiforum_forums', 'wikiforum_category', 'wikiforum_threads', 'user' ), |
— | — | @@ -279,13 +280,13 @@ |
280 | 281 | ); |
281 | 282 | $overview = $dbr->fetchObject( $sqlThreads ); |
282 | 283 | |
283 | | - if( $overview ) { |
| 284 | + if ( $overview ) { |
284 | 285 | $posted = wfMsg( |
285 | 286 | 'wikiforum-posted', |
286 | 287 | $wgLang->timeanddate( $overview->wft_posted_timestamp ), |
287 | 288 | WikiForumClass::getUserLink( $overview->user_name ) |
288 | 289 | ); |
289 | | - if( $overview->wft_edit_timestamp > 0 ) { |
| 290 | + if ( $overview->wft_edit_timestamp > 0 ) { |
290 | 291 | $posted .= '<br /><i>' . |
291 | 292 | wfMsg( |
292 | 293 | 'wikiforum-edited', |
— | — | @@ -324,13 +325,13 @@ |
325 | 326 | array( 'user' => array( 'LEFT JOIN', 'user_id = wfr_user' ) ) |
326 | 327 | ); |
327 | 328 | |
328 | | - foreach( $replies as $reply ) { |
| 329 | + foreach ( $replies as $reply ) { |
329 | 330 | $posted = wfMsg( |
330 | 331 | 'wikiforum-posted', |
331 | 332 | $wgLang->timeanddate( $reply->wfr_posted_timestamp ), |
332 | 333 | WikiForumClass::getUserLink( $reply->user_name ) |
333 | 334 | ); |
334 | | - if( $reply->wfr_edit > 0 ) { |
| 335 | + if ( $reply->wfr_edit > 0 ) { |
335 | 336 | $posted .= '<br /><i>' . |
336 | 337 | wfMsg( |
337 | 338 | 'wikiforum-edited', |
Index: trunk/extensions/WikiForum/SpecialWikiForum.php |
— | — | @@ -7,7 +7,6 @@ |
8 | 8 | */ |
9 | 9 | |
10 | 10 | class WikiForum extends SpecialPage { |
11 | | - |
12 | 11 | /** |
13 | 12 | * Constructor -- set up the new special page |
14 | 13 | */ |
— | — | @@ -47,6 +46,7 @@ |
48 | 47 | if ( $par ) { |
49 | 48 | // Let search spiders index our content |
50 | 49 | $wgOut->setRobotPolicy( 'index,follow' ); |
| 50 | + |
51 | 51 | if ( is_numeric( $par ) ) { |
52 | 52 | $wgOut->addHTML( $forum->showForum( $par ) ); |
53 | 53 | } else { |
— | — | @@ -56,25 +56,25 @@ |
57 | 57 | } else { |
58 | 58 | // That's...a lot of variables. No kidding. |
59 | 59 | $mod_category = $wgRequest->getInt( 'category' ); |
60 | | - $mod_forum = $wgRequest->getInt( 'forum' ); |
61 | | - $mod_thread = $wgRequest->getInt( 'thread' ); |
62 | | - $mod_writethread = $wgRequest->getInt( 'writethread' ); |
63 | | - $mod_addcomment = $wgRequest->getInt( 'addcomment' ); |
64 | | - $mod_addthread = $wgRequest->getInt( 'addthread' ); |
65 | | - $mod_editcomment = $wgRequest->getInt( 'editcomment' ); |
66 | | - $mod_editthread = $wgRequest->getInt( 'editthread' ); |
67 | | - $mod_deletecomment = $wgRequest->getInt( 'deletecomment' ); |
68 | | - $mod_deletethread = $wgRequest->getInt( 'deletethread' ); |
69 | | - $mod_closethread = $wgRequest->getInt( 'closethread' ); |
70 | | - $mod_reopenthread = $wgRequest->getInt( 'reopenthread' ); |
71 | | - $mod_addcategory = $wgRequest->getBool( 'addcategory' ); |
72 | | - $mod_addforum = $wgRequest->getInt( 'addforum' ); |
73 | | - $mod_editcategory = $wgRequest->getInt( 'editcategory' ); |
74 | | - $mod_editforum = $wgRequest->getInt( 'editforum' ); |
| 60 | + $mod_forum = $wgRequest->getInt( 'forum' ); |
| 61 | + $mod_thread = $wgRequest->getInt( 'thread' ); |
| 62 | + $mod_writethread = $wgRequest->getInt( 'writethread' ); |
| 63 | + $mod_addcomment = $wgRequest->getInt( 'addcomment' ); |
| 64 | + $mod_addthread = $wgRequest->getInt( 'addthread' ); |
| 65 | + $mod_editcomment = $wgRequest->getInt( 'editcomment' ); |
| 66 | + $mod_editthread = $wgRequest->getInt( 'editthread' ); |
| 67 | + $mod_deletecomment = $wgRequest->getInt( 'deletecomment' ); |
| 68 | + $mod_deletethread = $wgRequest->getInt( 'deletethread' ); |
| 69 | + $mod_closethread = $wgRequest->getInt( 'closethread' ); |
| 70 | + $mod_reopenthread = $wgRequest->getInt( 'reopenthread' ); |
| 71 | + $mod_addcategory = $wgRequest->getBool( 'addcategory' ); |
| 72 | + $mod_addforum = $wgRequest->getInt( 'addforum' ); |
| 73 | + $mod_editcategory = $wgRequest->getInt( 'editcategory' ); |
| 74 | + $mod_editforum = $wgRequest->getInt( 'editforum' ); |
75 | 75 | $mod_deletecategory = $wgRequest->getInt( 'deletecategory' ); |
76 | | - $mod_deleteforum = $wgRequest->getInt( 'deleteforum' ); |
| 76 | + $mod_deleteforum = $wgRequest->getInt( 'deleteforum' ); |
77 | 77 | $mod_makesticky = $wgRequest->getInt( 'makesticky' ); |
78 | | - $mod_removesticky = $wgRequest->getInt( 'removesticky' ); |
| 78 | + $mod_removesticky = $wgRequest->getInt( 'removesticky' ); |
79 | 79 | $mod_categoryup = $wgRequest->getInt( 'categoryup' ); |
80 | 80 | $mod_categorydown = $wgRequest->getInt( 'categorydown' ); |
81 | 81 | $mod_forumup = $wgRequest->getInt( 'forumup' ); |
— | — | @@ -88,14 +88,14 @@ |
89 | 89 | |
90 | 90 | // Figure out what we're going to do here...post a reply, a new thread, |
91 | 91 | // edit a reply, edit a thread...and so on. |
92 | | - if( isset( $mod_addcomment ) && $mod_addcomment > 0 ) { |
| 92 | + if ( isset( $mod_addcomment ) && $mod_addcomment > 0 ) { |
93 | 93 | $data_text = $wgRequest->getVal( 'frmText' ); |
94 | 94 | $data_preview = $wgRequest->getBool( 'butPreview' ); |
95 | 95 | $data_save = $wgRequest->getBool( 'butSave' ); |
96 | | - if( $data_save == true ) { |
| 96 | + if ( $data_save == true ) { |
97 | 97 | $result = $forum->addReply( $mod_addcomment, $data_text ); |
98 | 98 | $mod_thread = $mod_addcomment; |
99 | | - } elseif( $data_preview == true ) { |
| 99 | + } elseif ( $data_preview == true ) { |
100 | 100 | $result = $wgOut->addHTML( |
101 | 101 | $forum->previewIssue( |
102 | 102 | 'addcomment', |
— | — | @@ -106,19 +106,20 @@ |
107 | 107 | ); |
108 | 108 | $mod_none = true; |
109 | 109 | } |
110 | | - } elseif( isset( $mod_addthread ) && $mod_addthread > 0 ) { |
| 110 | + } elseif ( isset( $mod_addthread ) && $mod_addthread > 0 ) { |
111 | 111 | $data_title = $wgRequest->getVal( 'frmTitle' ); |
112 | 112 | $data_text = $wgRequest->getVal( 'frmText' ); |
113 | 113 | $data_preview = $wgRequest->getBool( 'butPreview' ); |
114 | 114 | $data_save = $wgRequest->getBool( 'butSave' ); |
115 | | - if( $data_save == true ) { |
| 115 | + |
| 116 | + if ( $data_save == true ) { |
116 | 117 | $result = $forum->addThread( |
117 | 118 | $mod_addthread, |
118 | 119 | $data_title, |
119 | 120 | $data_text |
120 | 121 | ); |
121 | 122 | $mod_forum = $mod_addthread; |
122 | | - } elseif( $data_preview == true ) { |
| 123 | + } elseif ( $data_preview == true ) { |
123 | 124 | $result = $wgOut->addHTML( |
124 | 125 | $forum->previewIssue( |
125 | 126 | 'addthread', |
— | — | @@ -131,17 +132,18 @@ |
132 | 133 | } else { |
133 | 134 | $mod_writethread = $mod_addthread; |
134 | 135 | } |
135 | | - } elseif( isset( $mod_editcomment ) && $mod_editcomment > 0 ) { |
| 136 | + } elseif ( isset( $mod_editcomment ) && $mod_editcomment > 0 ) { |
136 | 137 | $data_text = $wgRequest->getVal( 'frmText' ); |
137 | 138 | $data_preview = $wgRequest->getBool( 'butPreview' ); |
138 | 139 | $data_save = $wgRequest->getBool( 'butSave' ); |
139 | | - if( $data_save == true ) { |
| 140 | + |
| 141 | + if ( $data_save == true ) { |
140 | 142 | $result = $forum->editReply( |
141 | 143 | $mod_editcomment, |
142 | 144 | $data_text |
143 | 145 | ); |
144 | 146 | $mod_thread = $mod_thread; |
145 | | - } elseif( $data_preview == true ) { |
| 147 | + } elseif ( $data_preview == true ) { |
146 | 148 | $result = $wgOut->addHTML( |
147 | 149 | $forum->previewIssue( |
148 | 150 | 'editcomment', |
— | — | @@ -152,19 +154,20 @@ |
153 | 155 | ); |
154 | 156 | $mod_none = true; |
155 | 157 | } |
156 | | - } elseif( isset( $mod_editthread ) && $mod_editthread > 0 ) { |
| 158 | + } elseif ( isset( $mod_editthread ) && $mod_editthread > 0 ) { |
157 | 159 | $data_title = $wgRequest->getVal( 'frmTitle' ); |
158 | 160 | $data_text = $wgRequest->getVal( 'frmText' ); |
159 | 161 | $data_preview = $wgRequest->getBool( 'butPreview' ); |
160 | 162 | $data_save = $wgRequest->getBool( 'butSave' ); |
161 | | - if( $data_save == true ) { |
| 163 | + |
| 164 | + if ( $data_save == true ) { |
162 | 165 | $result = $forum->editThread( |
163 | 166 | $mod_editthread, |
164 | 167 | $data_title, |
165 | 168 | $data_text |
166 | 169 | ); |
167 | 170 | $mod_thread = $mod_editthread; |
168 | | - } elseif( $data_preview == true ) { |
| 171 | + } elseif ( $data_preview == true ) { |
169 | 172 | $result = $wgOut->addHTML( |
170 | 173 | $forum->previewIssue( |
171 | 174 | 'editthread', |
— | — | @@ -177,59 +180,59 @@ |
178 | 181 | } else { |
179 | 182 | $mod_writethread = $mod_editthread; |
180 | 183 | } |
181 | | - } elseif( isset( $mod_deletecomment ) && $mod_deletecomment > 0 ) { |
| 184 | + } elseif ( isset( $mod_deletecomment ) && $mod_deletecomment > 0 ) { |
182 | 185 | $result = $forum->deleteReply( $mod_deletecomment ); |
183 | | - } elseif( isset( $mod_deletethread ) && $mod_deletethread > 0 ) { |
| 186 | + } elseif ( isset( $mod_deletethread ) && $mod_deletethread > 0 ) { |
184 | 187 | $result = $forum->deleteThread( $mod_deletethread ); |
185 | | - } elseif( isset( $mod_deletecategory ) && $mod_deletecategory > 0 ) { |
| 188 | + } elseif ( isset( $mod_deletecategory ) && $mod_deletecategory > 0 ) { |
186 | 189 | $result = $forum->deleteCategory( $mod_deletecategory ); |
187 | | - } elseif( isset( $mod_deleteforum ) && $mod_deleteforum > 0 ) { |
| 190 | + } elseif ( isset( $mod_deleteforum ) && $mod_deleteforum > 0 ) { |
188 | 191 | $result = $forum->deleteForum( $mod_deleteforum ); |
189 | | - } elseif( isset( $mod_categoryup ) && $mod_categoryup > 0 ) { |
| 192 | + } elseif ( isset( $mod_categoryup ) && $mod_categoryup > 0 ) { |
190 | 193 | $result = $forum->sortKeys( $mod_categoryup, 'category', true ); |
191 | | - } elseif( isset( $mod_categorydown ) && $mod_categorydown > 0 ) { |
| 194 | + } elseif ( isset( $mod_categorydown ) && $mod_categorydown > 0 ) { |
192 | 195 | $result = $forum->sortKeys( $mod_categorydown, 'category', false ); |
193 | | - } elseif( isset( $mod_forumup ) && $mod_forumup > 0 ) { |
| 196 | + } elseif ( isset( $mod_forumup ) && $mod_forumup > 0 ) { |
194 | 197 | $result = $forum->sortKeys( $mod_forumup, 'forum', true ); |
195 | | - } elseif( isset( $mod_forumdown ) && $mod_forumdown > 0 ) { |
| 198 | + } elseif ( isset( $mod_forumdown ) && $mod_forumdown > 0 ) { |
196 | 199 | $result = $forum->sortKeys( $mod_forumdown, 'forum', false ); |
197 | | - } elseif( isset( $mod_closethread ) && $mod_closethread > 0 ) { |
| 200 | + } elseif ( isset( $mod_closethread ) && $mod_closethread > 0 ) { |
198 | 201 | $result = $forum->closeThread( $mod_closethread ); |
199 | 202 | $mod_thread = $mod_closethread; |
200 | | - } elseif( isset( $mod_reopenthread ) && $mod_reopenthread > 0 ) { |
| 203 | + } elseif ( isset( $mod_reopenthread ) && $mod_reopenthread > 0 ) { |
201 | 204 | $result = $forum->reopenThread( $mod_reopenthread ); |
202 | 205 | $mod_thread = $mod_reopenthread; |
203 | | - } elseif( isset( $mod_makesticky ) && $mod_makesticky > 0 ) { |
| 206 | + } elseif ( isset( $mod_makesticky ) && $mod_makesticky > 0 ) { |
204 | 207 | $result = $forum->makeSticky( $mod_makesticky, true ); |
205 | 208 | $mod_thread = $mod_makesticky; |
206 | | - } elseif( isset( $mod_removesticky ) && $mod_removesticky > 0 ) { |
| 209 | + } elseif ( isset( $mod_removesticky ) && $mod_removesticky > 0 ) { |
207 | 210 | $result = $forum->makeSticky( $mod_removesticky, false ); |
208 | 211 | $mod_thread = $mod_removesticky; |
209 | | - } elseif( isset( $mod_pastethread ) && $mod_pastethread > 0 ) { |
| 212 | + } elseif ( isset( $mod_pastethread ) && $mod_pastethread > 0 ) { |
210 | 213 | $result = $forum->pasteThread( $mod_pastethread, $mod_forum ); |
211 | | - } elseif( |
| 214 | + } elseif ( |
212 | 215 | isset( $mod_addcategory ) && $mod_addcategory == true && |
213 | 216 | $wgUser->isAllowed( 'wikiforum-admin' ) |
214 | | - ) |
215 | | - { |
216 | | - if( $mod_submit == true ) { |
| 217 | + ) { |
| 218 | + if ( $mod_submit == true ) { |
217 | 219 | $values['title'] = $wgRequest->getVal( 'frmTitle' ); |
218 | 220 | $mod_submit = $forum->addCategory( $values['title'] ); |
219 | 221 | } |
220 | | - if( $mod_submit == false ) { |
| 222 | + |
| 223 | + if ( $mod_submit == false ) { |
221 | 224 | $mod_showform = true; |
222 | 225 | $type = 'addcategory'; |
223 | 226 | $id = $mod_addcategory; |
224 | 227 | } |
225 | | - } elseif( |
| 228 | + } elseif ( |
226 | 229 | isset( $mod_addforum ) && $mod_addforum > 0 && |
227 | 230 | $wgUser->isAllowed( 'wikiforum-admin' ) |
228 | | - ) |
229 | | - { |
230 | | - if( $mod_submit == true ) { |
| 231 | + ) { |
| 232 | + if ( $mod_submit == true ) { |
231 | 233 | $values['title'] = $wgRequest->getVal( 'frmTitle' ); |
232 | 234 | $values['text'] = $wgRequest->getVal( 'frmText' ); |
233 | | - if( $wgRequest->getBool( 'chkAnnouncement' ) == true ) { |
| 235 | + |
| 236 | + if ( $wgRequest->getBool( 'chkAnnouncement' ) == true ) { |
234 | 237 | $values['announce'] = '1'; |
235 | 238 | } else { |
236 | 239 | $values['announce'] = '0'; |
— | — | @@ -241,37 +244,38 @@ |
242 | 245 | $values['announce'] |
243 | 246 | ); |
244 | 247 | } |
245 | | - if( $mod_submit == false ) { |
| 248 | + |
| 249 | + if ( $mod_submit == false ) { |
246 | 250 | $mod_showform = true; |
247 | 251 | $type = 'addforum'; |
248 | 252 | $id = $mod_addforum; |
249 | 253 | } |
250 | | - } elseif( |
| 254 | + } elseif ( |
251 | 255 | isset( $mod_editcategory ) && $mod_editcategory > 0 && |
252 | 256 | $wgUser->isAllowed( 'wikiforum-admin' ) |
253 | | - ) |
254 | | - { |
255 | | - if( $mod_submit == true ) { |
| 257 | + ) { |
| 258 | + if ( $mod_submit == true ) { |
256 | 259 | $values['title'] = $wgRequest->getVal( 'frmTitle' ); |
257 | 260 | $mod_submit = $forum->editCategory( |
258 | 261 | $mod_editcategory, |
259 | 262 | $values['title'] |
260 | 263 | ); |
261 | 264 | } |
262 | | - if( $mod_submit == false ) { |
| 265 | + |
| 266 | + if ( $mod_submit == false ) { |
263 | 267 | $mod_showform = true; |
264 | 268 | $type = 'editcategory'; |
265 | 269 | $id = $mod_editcategory; |
266 | 270 | } |
267 | | - } elseif( |
| 271 | + } elseif ( |
268 | 272 | isset( $mod_editforum ) && $mod_editforum > 0 && |
269 | 273 | $wgUser->isAllowed( 'wikiforum-admin' ) |
270 | | - ) |
271 | | - { |
272 | | - if( $mod_submit == true ) { |
| 274 | + ) { |
| 275 | + if ( $mod_submit == true ) { |
273 | 276 | $values['title'] = $wgRequest->getVal( 'frmTitle' ); |
274 | 277 | $values['text'] = $wgRequest->getVal( 'frmText' ); |
275 | | - if( $wgRequest->getBool( 'chkAnnouncement' ) == true ) { |
| 278 | + |
| 279 | + if ( $wgRequest->getBool( 'chkAnnouncement' ) == true ) { |
276 | 280 | $values['announce'] = '1'; |
277 | 281 | } else { |
278 | 282 | $values['announce'] = '0'; |
— | — | @@ -283,7 +287,8 @@ |
284 | 288 | $values['announce'] |
285 | 289 | ); |
286 | 290 | } |
287 | | - if( $mod_submit == false ) { |
| 291 | + |
| 292 | + if ( $mod_submit == false ) { |
288 | 293 | $mod_showform = true; |
289 | 294 | $type = 'editforum'; |
290 | 295 | $id = $mod_editforum; |
— | — | @@ -293,25 +298,25 @@ |
294 | 299 | // Only in certain cases we want search spiders to index our content |
295 | 300 | // and follow links. These are overview (Special:WikiForum), individual |
296 | 301 | // threads, forums and categories. |
297 | | - if( isset( $mod_search ) && $mod_search == true ) { |
| 302 | + if ( isset( $mod_search ) && $mod_search == true ) { |
298 | 303 | $wgOut->addHTML( $forum->showSearchResults( $mod_search ) ); |
299 | | - } elseif( $mod_none == true ) { |
| 304 | + } elseif ( $mod_none == true ) { |
300 | 305 | // no data |
301 | | - } elseif( isset( $mod_category ) && $mod_category > 0 ) { |
| 306 | + } elseif ( isset( $mod_category ) && $mod_category > 0 ) { |
302 | 307 | // Let search spiders index our content |
303 | 308 | $wgOut->setRobotPolicy( 'index,follow' ); |
304 | 309 | $wgOut->addHTML( $forum->showCategory( $mod_category ) ); |
305 | | - } elseif( isset( $mod_forum ) && $mod_forum > 0 ) { |
| 310 | + } elseif ( isset( $mod_forum ) && $mod_forum > 0 ) { |
306 | 311 | // Let search spiders index our content |
307 | 312 | $wgOut->setRobotPolicy( 'index,follow' ); |
308 | 313 | $wgOut->addHTML( $forum->showForum( $mod_forum ) ); |
309 | | - } elseif( isset( $mod_thread ) && $mod_thread > 0 ) { |
| 314 | + } elseif ( isset( $mod_thread ) && $mod_thread > 0 ) { |
310 | 315 | // Let search spiders index our content |
311 | 316 | $wgOut->setRobotPolicy( 'index,follow' ); |
312 | 317 | $wgOut->addHTML( $forum->showThread( $mod_thread ) ); |
313 | | - } elseif( isset( $mod_writethread ) && $mod_writethread > 0 ) { |
| 318 | + } elseif ( isset( $mod_writethread ) && $mod_writethread > 0 ) { |
314 | 319 | $wgOut->addHTML( $forum->writeThread( $mod_writethread ) ); |
315 | | - } elseif( isset( $mod_showform ) && $mod_showform ) { |
| 320 | + } elseif ( isset( $mod_showform ) && $mod_showform ) { |
316 | 321 | $wgOut->addHTML( |
317 | 322 | $forum->showEditorCatForum( $id, $type, $values ) |
318 | 323 | ); |
— | — | @@ -321,7 +326,5 @@ |
322 | 327 | $wgOut->addHTML( $forum->showOverview() ); |
323 | 328 | } |
324 | 329 | } // else from line 55 (the if $par is not specified one) |
325 | | - |
326 | 330 | } // execute() |
327 | | - |
328 | | -} |
\ No newline at end of file |
| 331 | +} |
Index: trunk/extensions/WikiForum/WikiForumGui.php |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | global $wgUser, $wgWikiForumAllowAnonymous; |
44 | 44 | |
45 | 45 | $output = '<table class="mw-wikiforum-headerrow"><tr><td class="mw-wikiforum-leftside">'; |
46 | | - if( |
| 46 | + if ( |
47 | 47 | strlen( $additionalLinks ) == 0 || |
48 | 48 | $catId > 0 && strlen( $catName ) > 0 |
49 | 49 | ) |
— | — | @@ -50,16 +50,16 @@ |
51 | 51 | $specialPageObj = SpecialPage::getTitleFor( 'WikiForum' ); |
52 | 52 | $output .= '<a href="' . $specialPageObj->escapeFullURL() . '">' . |
53 | 53 | wfMsg( 'wikiforum-overview' ) . '</a>'; |
54 | | - if( $catId > 0 && strlen( $catName ) > 0 ) { |
| 54 | + if ( $catId > 0 && strlen( $catName ) > 0 ) { |
55 | 55 | $output .= ' > <a href="' . |
56 | 56 | $specialPageObj->escapeFullURL( 'category=' . $catId ) . '">' . |
57 | 57 | $catName . '</a>'; |
58 | 58 | } |
59 | | - if( $forumId > 0 && strlen( $forumName ) > 0 ) { |
| 59 | + if ( $forumId > 0 && strlen( $forumName ) > 0 ) { |
60 | 60 | $output .= ' > <a href="' . $specialPageObj->escapeFullURL( 'forum=' . $forumId ) . '">' . $forumName . '</a>'; |
61 | 61 | } |
62 | 62 | } |
63 | | - if( |
| 63 | + if ( |
64 | 64 | strlen( $additionalLinks ) > 0 && |
65 | 65 | ( $wgWikiForumAllowAnonymous || $wgUser->getId() > 0 ) |
66 | 66 | ) |
— | — | @@ -85,10 +85,10 @@ |
86 | 86 | $output = ''; |
87 | 87 | $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
88 | 88 | |
89 | | - if( $maxissues / $limit > 1 ) { |
| 89 | + if ( $maxissues / $limit > 1 ) { |
90 | 90 | $output = '<table class="mw-wikiforum-footerrow"><tr><td class="mw-wikiforum-leftside">' . |
91 | 91 | wfMsg( 'wikiforum-pages' ) . wfMsg( 'word-separator' ); |
92 | | - for( $i = 1; $i < ( $maxissues / $limit ) + 1; $i++ ) { |
| 92 | + for ( $i = 1; $i < ( $maxissues / $limit ) + 1; $i++ ) { |
93 | 93 | // URL query parameters |
94 | 94 | $urlParams = array( |
95 | 95 | 'lp' => $i |
— | — | @@ -96,24 +96,24 @@ |
97 | 97 | // Thread ID is optional, but if it was given, we need to get |
98 | 98 | // rid of the forum parameter for the thread parameter to take |
99 | 99 | // precedence. Stupid, I know. |
100 | | - if( $threadId ) { |
| 100 | + if ( $threadId ) { |
101 | 101 | $urlParams['thread'] = $threadId; |
102 | 102 | } else { |
103 | 103 | $urlParams['forum'] = $forumId; |
104 | 104 | } |
105 | | - if( $i != $page + 1 ) { |
| 105 | + if ( $i != $page + 1 ) { |
106 | 106 | $output .= '<a href="' . $specialPage->escapeFullURL( $urlParams ) . '">'; |
107 | 107 | } else { |
108 | 108 | $output .= '['; |
109 | 109 | } |
110 | 110 | |
111 | | - if( $i <= 9 ) { |
| 111 | + if ( $i <= 9 ) { |
112 | 112 | $output .= '0' . $i; |
113 | 113 | } else { |
114 | 114 | $output .= $i; |
115 | 115 | } |
116 | 116 | |
117 | | - if( $i != $page + 1 ) { |
| 117 | + if ( $i != $page + 1 ) { |
118 | 118 | $output .= '</a>'; |
119 | 119 | } else { |
120 | 120 | $output .= ']'; |
— | — | @@ -146,7 +146,7 @@ |
147 | 147 | public static function getMainHeaderRow( $title1, $title2, $title3, $title4, $title5 ) { |
148 | 148 | $output = '<tr class="mw-wikiforum-title"> |
149 | 149 | <th class="mw-wikiforum-title">' . $title1 . '</th>'; |
150 | | - if( $title5 ) { |
| 150 | + if ( $title5 ) { |
151 | 151 | $output .= '<th class="mw-wikiforum-admin"><p class="mw-wikiforum-valuetitle">' . |
152 | 152 | $title5 . '</p></th>'; |
153 | 153 | } |
— | — | @@ -159,13 +159,13 @@ |
160 | 160 | |
161 | 161 | public static function getMainBody( $col_value1, $col_value2, $col_value3, $col_value4, $col_title5, $marked ) { |
162 | 162 | $output = '<tr class="mw-wikiforum-'; |
163 | | - if( $marked ) { |
| 163 | + if ( $marked ) { |
164 | 164 | $output .= $marked; |
165 | 165 | } else { |
166 | 166 | $output .= 'normal'; |
167 | 167 | } |
168 | 168 | $output .= '"><td class="mw-wikiforum-title">' . $col_value1 . '</td>'; |
169 | | - if( $col_title5 ) { |
| 169 | + if ( $col_title5 ) { |
170 | 170 | $output .= '<td class="mw-wikiforum-admin">' . $col_title5 . '</td>'; |
171 | 171 | } |
172 | 172 | $output .= ' |
— | — | @@ -247,7 +247,7 @@ |
248 | 248 | $output = '<table cellspacing="0" cellpadding="0" class="mw-wikiforum-posted">' . |
249 | 249 | '<tr><td class="mw-wikiforum-leftside">' . $posted . '</td>'; |
250 | 250 | |
251 | | - if( $wgUser->isLoggedIn() ) { |
| 251 | + if ( $wgUser->isLoggedIn() ) { |
252 | 252 | $output .= '<td class="mw-wikiforum-rightside">' . $buttons . '</td>'; |
253 | 253 | } |
254 | 254 | |
— | — | @@ -266,7 +266,7 @@ |
267 | 267 | |
268 | 268 | $output = ''; |
269 | 269 | |
270 | | - if( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) { |
| 270 | + if ( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) { |
271 | 271 | // Required for the edit buttons to display |
272 | 272 | $wgOut->addScriptFile( 'edit.js' ); |
273 | 273 | $toolbar = EditPage::getEditToolbar(); |
— | — | @@ -284,7 +284,7 @@ |
285 | 285 | <td> |
286 | 286 | <input name="butSave" type="submit" value="' . $saveButton . '" accesskey="s" title="' . $saveButton . ' [s]" /> |
287 | 287 | <input name="butPreview" type="submit" value="' . wfMsg( 'wikiforum-button-preview' ) . '" accesskey="p" title="' . wfMsg( 'wikiforum-button-preview' ) . ' [p]" />'; |
288 | | - if( $type == 'addthread' ) { |
| 288 | + if ( $type == 'addthread' ) { |
289 | 289 | $output .= ' <input name="butCancel" type="button" value="' . wfMsg( 'cancel' ) . '" accesskey="c" onclick="javascript:history.back();" title="' . wfMsg( 'cancel' ) . ' [c]" />'; |
290 | 290 | } |
291 | 291 | $output .= '</td> |
— | — | @@ -309,7 +309,7 @@ |
310 | 310 | public static function getFormCatForum( $type, $categoryName, $action, $title_prev, $text_prev, $saveButton, $overviewObj ) { |
311 | 311 | global $wgUser; |
312 | 312 | |
313 | | - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 313 | + if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
314 | 314 | $title_prev = str_replace( '"', '"', $title_prev ); |
315 | 315 | $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
316 | 316 | $output = ' |
— | — | @@ -324,7 +324,7 @@ |
325 | 325 | <input type="text" name="frmTitle" style="width: 100%" value="' . $title_prev . '" /> |
326 | 326 | </td> |
327 | 327 | </tr>'; |
328 | | - if( $type == 'addforum' || $type == 'editforum' ) { |
| 328 | + if ( $type == 'addforum' || $type == 'editforum' ) { |
329 | 329 | $check = ''; |
330 | 330 | if ( is_object( $overviewObj ) && $overviewObj->wff_announcement == true ) { |
331 | 331 | $check = 'checked="checked"'; |
Index: trunk/extensions/WikiForum/WikiForumClass.php |
— | — | @@ -59,9 +59,9 @@ |
60 | 60 | array( 'wfr_reply_id', 'wfr_user' ), |
61 | 61 | array( 'wfr_deleted' => 0, 'wfr_reply_id' => intval( $replyId ) ), |
62 | 62 | __METHOD__ |
63 | | - )); |
| 63 | + ) ); |
64 | 64 | |
65 | | - if( |
| 65 | + if ( |
66 | 66 | $reply->wfr_reply_id > 0 && $wgUser->getId() > 0 && |
67 | 67 | ( |
68 | 68 | $wgUser->getId() == $reply->wfr_user || |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | $result = false; |
88 | 88 | } |
89 | 89 | |
90 | | - if( $result == false ) { |
| 90 | + if ( $result == false ) { |
91 | 91 | $this->errorTitle = wfMsg( 'wikiforum-error-delete' ); |
92 | 92 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
93 | 93 | } |
— | — | @@ -109,9 +109,9 @@ |
110 | 110 | array( 'wft_thread', 'wft_user', 'wft_forum' ), |
111 | 111 | array( 'wft_deleted' => 0, 'wft_thread' => intval( $threadId ) ), |
112 | 112 | __METHOD__ |
113 | | - )); |
| 113 | + ) ); |
114 | 114 | |
115 | | - if( |
| 115 | + if ( |
116 | 116 | $thread->wft_thread > 0 && $wgUser->getId() > 0 && |
117 | 117 | ( $wgUser->getId() == $thread->wft_user || $wgUser->isAllowed( 'wikiforum-moderator' ) ) && |
118 | 118 | !wfReadOnly() |
— | — | @@ -170,7 +170,7 @@ |
171 | 171 | $result = false; |
172 | 172 | } |
173 | 173 | |
174 | | - if( $result == false ) { |
| 174 | + if ( $result == false ) { |
175 | 175 | $this->errorTitle = wfMsg( 'wikiforum-error-delete' ); |
176 | 176 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
177 | 177 | } |
— | — | @@ -186,7 +186,7 @@ |
187 | 187 | function deleteCategory( $categoryId ) { |
188 | 188 | global $wgUser; |
189 | 189 | |
190 | | - if( |
| 190 | + if ( |
191 | 191 | $wgUser->isAllowed( 'wikiforum-admin' ) && |
192 | 192 | !wfReadOnly() |
193 | 193 | ) |
— | — | @@ -207,7 +207,7 @@ |
208 | 208 | $result = false; |
209 | 209 | } |
210 | 210 | |
211 | | - if( $result == false ) { |
| 211 | + if ( $result == false ) { |
212 | 212 | $this->errorTitle = wfMsg( 'wikiforum-error-delete' ); |
213 | 213 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
214 | 214 | } |
— | — | @@ -223,7 +223,7 @@ |
224 | 224 | function deleteForum( $forumId ) { |
225 | 225 | global $wgUser; |
226 | 226 | |
227 | | - if( |
| 227 | + if ( |
228 | 228 | $wgUser->isAllowed( 'wikiforum-admin' ) && |
229 | 229 | !wfReadOnly() |
230 | 230 | ) |
— | — | @@ -244,7 +244,7 @@ |
245 | 245 | $result = false; |
246 | 246 | } |
247 | 247 | |
248 | | - if( $result == false ) { |
| 248 | + if ( $result == false ) { |
249 | 249 | $this->errorTitle = wfMsg( 'wikiforum-error-delete' ); |
250 | 250 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
251 | 251 | } |
— | — | @@ -273,7 +273,7 @@ |
274 | 274 | __METHOD__ |
275 | 275 | ); |
276 | 276 | |
277 | | - if( |
| 277 | + if ( |
278 | 278 | $thread->wft_thread > 0 && |
279 | 279 | $wgUser->isAllowed( 'wikiforum-moderator' ) && |
280 | 280 | !wfReadOnly() |
— | — | @@ -293,7 +293,7 @@ |
294 | 294 | $result = false; |
295 | 295 | } |
296 | 296 | |
297 | | - if( $result == false ) { |
| 297 | + if ( $result == false ) { |
298 | 298 | $this->errorTitle = wfMsg( 'wikiforum-error-thread-reopen' ); |
299 | 299 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
300 | 300 | } |
— | — | @@ -322,7 +322,7 @@ |
323 | 323 | __METHOD__ |
324 | 324 | ); |
325 | 325 | |
326 | | - if( |
| 326 | + if ( |
327 | 327 | $thread->wft_thread > 0 && |
328 | 328 | $wgUser->isAllowed( 'wikiforum-moderator' ) && |
329 | 329 | !wfReadOnly() |
— | — | @@ -342,7 +342,7 @@ |
343 | 343 | $result = false; |
344 | 344 | } |
345 | 345 | |
346 | | - if( $result == false ) { |
| 346 | + if ( $result == false ) { |
347 | 347 | $this->errorTitle = wfMsg( 'wikiforum-error-thread-close' ); |
348 | 348 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
349 | 349 | } |
— | — | @@ -366,15 +366,15 @@ |
367 | 367 | 'wft_thread', |
368 | 368 | array( 'wft_deleted' => 0, 'wft_thread' => $threadId ), |
369 | 369 | __METHOD__ |
370 | | - )); |
| 370 | + ) ); |
371 | 371 | |
372 | | - if( |
| 372 | + if ( |
373 | 373 | $thread->wft_thread > 0 && |
374 | 374 | $wgUser->isAllowed( 'wikiforum-admin' ) && |
375 | 375 | !wfReadOnly() |
376 | 376 | ) |
377 | 377 | { |
378 | | - if( $value == false ) { |
| 378 | + if ( $value == false ) { |
379 | 379 | $value = 0; |
380 | 380 | } |
381 | 381 | $dbw = wfGetDB( DB_MASTER ); |
— | — | @@ -388,7 +388,7 @@ |
389 | 389 | $result = false; |
390 | 390 | } |
391 | 391 | |
392 | | - if( $result == false ) { |
| 392 | + if ( $result == false ) { |
393 | 393 | $this->errorTitle = wfMsg( 'wikiforum-error-sticky' ); |
394 | 394 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
395 | 395 | } |
— | — | @@ -413,8 +413,8 @@ |
414 | 414 | __METHOD__ |
415 | 415 | ); |
416 | 416 | |
417 | | - if( $thread->wft_thread > 0 && $forum->wff_forum > 0 && $wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
418 | | - if( $thread->wft_forum != $forum->wff_forum ) { |
| 417 | + if ( $thread->wft_thread > 0 && $forum->wff_forum > 0 && $wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
| 418 | + if ( $thread->wft_forum != $forum->wff_forum ) { |
419 | 419 | $dbw = wfGetDB( DB_MASTER ); |
420 | 420 | $result = $dbw->update( |
421 | 421 | 'wikiforum_threads', |
— | — | @@ -429,7 +429,7 @@ |
430 | 430 | $result = false; |
431 | 431 | } |
432 | 432 | |
433 | | - if( $result == false ) { |
| 433 | + if ( $result == false ) { |
434 | 434 | $this->errorTitle = wfMsg( 'wikiforum-error-move-thread' ); |
435 | 435 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
436 | 436 | } |
— | — | @@ -439,7 +439,7 @@ |
440 | 440 | function editThread( $threadId, $title, $text ) { |
441 | 441 | global $wgUser; |
442 | 442 | |
443 | | - if( |
| 443 | + if ( |
444 | 444 | $text && $title && strlen( $text ) > 1 && |
445 | 445 | strlen( $title ) > 1 |
446 | 446 | ) |
— | — | @@ -451,15 +451,15 @@ |
452 | 452 | array( 'wft_thread', 'wft_thread_name', 'wft_text', 'wft_user' ), |
453 | 453 | array( 'wft_deleted' => 0, 'wft_thread' => $threadId ), |
454 | 454 | __METHOD__ |
455 | | - )); |
| 455 | + ) ); |
456 | 456 | |
457 | | - if( $thread->wft_thread > 0 ) { |
458 | | - if( |
| 457 | + if ( $thread->wft_thread > 0 ) { |
| 458 | + if ( |
459 | 459 | $thread->wft_thread_name != $title || |
460 | 460 | $thread->wft_text != $text |
461 | 461 | ) |
462 | 462 | { |
463 | | - if( |
| 463 | + if ( |
464 | 464 | $wgUser->getId() > 0 && |
465 | 465 | ( |
466 | 466 | $wgUser->getId() == $thread->wft_user || |
— | — | @@ -492,14 +492,14 @@ |
493 | 493 | $result = false; |
494 | 494 | } |
495 | 495 | |
496 | | - if( $result == false ) { |
| 496 | + if ( $result == false ) { |
497 | 497 | $this->errorTitle = wfMsg( 'wikiforum-error-edit' ); |
498 | | - if( $this->errorMessage == '' ) { |
| 498 | + if ( $this->errorMessage == '' ) { |
499 | 499 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
500 | 500 | } |
501 | 501 | } |
502 | 502 | } else { |
503 | | - if( |
| 503 | + if ( |
504 | 504 | !$text && !$title || |
505 | 505 | strlen( $text ) == 0 && strlen( $title ) == 0 |
506 | 506 | ) |
— | — | @@ -516,8 +516,8 @@ |
517 | 517 | function addThread( $forumId, $title, $text ) { |
518 | 518 | global $wgUser, $wgWikiForumAllowAnonymous; |
519 | 519 | |
520 | | - if( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) { |
521 | | - if( |
| 520 | + if ( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) { |
| 521 | + if ( |
522 | 522 | $forumId > 0 && strlen( $text ) > 1 && |
523 | 523 | // @todo FIXME/CHECKME: use wfMsgForContent()? |
524 | 524 | strlen( $title ) > 1 && $title != wfMsg( 'wikiforum-thread-title' ) |
— | — | @@ -535,12 +535,12 @@ |
536 | 536 | 'wff_forum' => intval( $forumId ) |
537 | 537 | ), |
538 | 538 | __METHOD__ |
539 | | - )); |
| 539 | + ) ); |
540 | 540 | |
541 | | - if( $overview->wff_forum > 0 && !wfReadOnly() ) { |
| 541 | + if ( $overview->wff_forum > 0 && !wfReadOnly() ) { |
542 | 542 | $dbw = wfGetDB( DB_MASTER ); |
543 | 543 | $timestamp = wfTimestampNow(); |
544 | | - if( $overview->wff_announcement == false || $wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
| 544 | + if ( $overview->wff_announcement == false || $wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
545 | 545 | $doublepost = $dbr->selectRow( |
546 | 546 | 'wikiforum_threads', |
547 | 547 | 'wft_thread AS id', |
— | — | @@ -555,7 +555,7 @@ |
556 | 556 | __METHOD__ |
557 | 557 | ); |
558 | 558 | |
559 | | - if( $doublepost === false ) { |
| 559 | + if ( $doublepost === false ) { |
560 | 560 | $result = $dbw->insert( |
561 | 561 | 'wikiforum_threads', |
562 | 562 | array( |
— | — | @@ -568,7 +568,7 @@ |
569 | 569 | ), |
570 | 570 | __METHOD__ |
571 | 571 | ); |
572 | | - if( $result == true ) { |
| 572 | + if ( $result == true ) { |
573 | 573 | $dbw->update( |
574 | 574 | 'wikiforum_forums', |
575 | 575 | array( |
— | — | @@ -603,9 +603,9 @@ |
604 | 604 | $this->result = false; |
605 | 605 | } |
606 | 606 | |
607 | | - if( $this->result == false ) { |
| 607 | + if ( $this->result == false ) { |
608 | 608 | $this->errorTitle = wfMsg( 'wikiforum-error-add' ); |
609 | | - if( $this->errorMessage == '' ) { |
| 609 | + if ( $this->errorMessage == '' ) { |
610 | 610 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
611 | 611 | } |
612 | 612 | } |
— | — | @@ -622,7 +622,7 @@ |
623 | 623 | function editReply( $replyId, $text ) { |
624 | 624 | global $wgUser, $wgRequest; |
625 | 625 | |
626 | | - if( $text && strlen( $text ) > 1 ) { |
| 626 | + if ( $text && strlen( $text ) > 1 ) { |
627 | 627 | $dbr = wfGetDB( DB_SLAVE ); |
628 | 628 | |
629 | 629 | $reply = $dbr->fetchObject( $dbr->select( |
— | — | @@ -630,17 +630,17 @@ |
631 | 631 | array( 'wfr_thread', 'wfr_reply_id', 'wfr_reply_text', 'wfr_user' ), |
632 | 632 | array( 'wfr_reply_id' => intval( $replyId ) ), |
633 | 633 | __METHOD__ |
634 | | - )); |
| 634 | + ) ); |
635 | 635 | $thread = $dbr->fetchObject( $dbr->select( |
636 | 636 | 'wikiforum_threads', |
637 | 637 | array( 'wft_thread', 'wft_closed' ), |
638 | 638 | array( 'wft_deleted' => 0, 'wft_thread' => $reply->wfr_thread ), |
639 | 639 | __METHOD__ |
640 | | - )); |
| 640 | + ) ); |
641 | 641 | |
642 | | - if( $reply->wfr_reply_id > 0 && $thread->wft_thread > 0 ) { |
643 | | - if( $reply->wfr_reply_text != $text ) { |
644 | | - if( |
| 642 | + if ( $reply->wfr_reply_id > 0 && $thread->wft_thread > 0 ) { |
| 643 | + if ( $reply->wfr_reply_text != $text ) { |
| 644 | + if ( |
645 | 645 | $wgUser->getId() > 0 && |
646 | 646 | ( ( $wgUser->getId() == $reply->wfr_user && |
647 | 647 | $thread->wft_closed == 0 ) || |
— | — | @@ -672,7 +672,7 @@ |
673 | 673 | } |
674 | 674 | } else { |
675 | 675 | $form = $wgRequest->getBool( 'form' ); |
676 | | - if( isset( $form ) && $form == true ) { |
| 676 | + if ( isset( $form ) && $form == true ) { |
677 | 677 | $this->errorMessage = wfMsg( 'wikiforum-error-no-reply' ); |
678 | 678 | $result = false; |
679 | 679 | } else { |
— | — | @@ -680,9 +680,9 @@ |
681 | 681 | } |
682 | 682 | } |
683 | 683 | |
684 | | - if( $result == false ) { |
| 684 | + if ( $result == false ) { |
685 | 685 | $this->errorTitle = wfMsg( 'wikiforum-error-edit' ); |
686 | | - if( $this->errorMessage == '' ) { |
| 686 | + if ( $this->errorMessage == '' ) { |
687 | 687 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
688 | 688 | } |
689 | 689 | } |
— | — | @@ -700,9 +700,9 @@ |
701 | 701 | |
702 | 702 | $timestamp = wfTimestampNow(); |
703 | 703 | |
704 | | - if( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) { |
705 | | - if( $threadId > 0 ) { |
706 | | - if( strlen( $text ) > 1 ) { |
| 704 | + if ( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) { |
| 705 | + if ( $threadId > 0 ) { |
| 706 | + if ( strlen( $text ) > 1 ) { |
707 | 707 | $dbr = wfGetDB( DB_SLAVE ); |
708 | 708 | |
709 | 709 | $thread = $dbr->selectRow( |
— | — | @@ -716,7 +716,7 @@ |
717 | 717 | __METHOD__ |
718 | 718 | ); |
719 | 719 | |
720 | | - if( $thread->wft_thread > 0 && !wfReadOnly() ) { |
| 720 | + if ( $thread->wft_thread > 0 && !wfReadOnly() ) { |
721 | 721 | $dbw = wfGetDB( DB_MASTER ); |
722 | 722 | $doublepost = $dbr->selectRow( |
723 | 723 | 'wikiforum_replies', |
— | — | @@ -731,7 +731,7 @@ |
732 | 732 | __METHOD__ |
733 | 733 | ); |
734 | 734 | |
735 | | - if( $doublepost === false ) { |
| 735 | + if ( $doublepost === false ) { |
736 | 736 | $result = $dbw->insert( |
737 | 737 | 'wikiforum_replies', |
738 | 738 | array( |
— | — | @@ -743,7 +743,7 @@ |
744 | 744 | __METHOD__ |
745 | 745 | ); |
746 | 746 | |
747 | | - if( $result == true ) { |
| 747 | + if ( $result == true ) { |
748 | 748 | $dbw->update( |
749 | 749 | 'wikiforum_threads', |
750 | 750 | array( |
— | — | @@ -793,9 +793,9 @@ |
794 | 794 | $this->result = false; |
795 | 795 | } |
796 | 796 | |
797 | | - if( $this->result == false ) { |
| 797 | + if ( $this->result == false ) { |
798 | 798 | $this->errorTitle = wfMsg( 'wikiforum-error-add' ); |
799 | | - if( $this->errorMessage == '' ) { |
| 799 | + if ( $this->errorMessage == '' ) { |
800 | 800 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
801 | 801 | } |
802 | 802 | } |
— | — | @@ -805,12 +805,12 @@ |
806 | 806 | function addCategory( $categoryName ) { |
807 | 807 | global $wgUser; |
808 | 808 | |
809 | | - if( |
| 809 | + if ( |
810 | 810 | $wgUser->isAllowed( 'wikiforum-admin' ) && |
811 | 811 | !wfReadOnly() |
812 | 812 | ) |
813 | 813 | { |
814 | | - if( strlen( $categoryName ) > 0 ) { |
| 814 | + if ( strlen( $categoryName ) > 0 ) { |
815 | 815 | $dbr = wfGetDB( DB_SLAVE ); |
816 | 816 | $sortkey = $dbr->selectRow( |
817 | 817 | 'wikiforum_category', |
— | — | @@ -839,9 +839,9 @@ |
840 | 840 | $this->result = false; |
841 | 841 | } |
842 | 842 | |
843 | | - if( $this->result == false ) { |
| 843 | + if ( $this->result == false ) { |
844 | 844 | $this->errorTitle = wfMsg( 'wikiforum-error-add' ); |
845 | | - if( $this->errorMessage == '' ) { |
| 845 | + if ( $this->errorMessage == '' ) { |
846 | 846 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
847 | 847 | } |
848 | 848 | } |
— | — | @@ -851,8 +851,8 @@ |
852 | 852 | function editCategory( $id, $categoryName ) { |
853 | 853 | global $wgUser; |
854 | 854 | |
855 | | - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
856 | | - if( strlen( $categoryName ) > 0 ) { |
| 855 | + if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 856 | + if ( strlen( $categoryName ) > 0 ) { |
857 | 857 | $dbr = wfGetDB( DB_SLAVE ); |
858 | 858 | |
859 | 859 | $category = $dbr->fetchObject( $dbr->select( |
— | — | @@ -860,9 +860,9 @@ |
861 | 861 | array( 'wfc_category', 'wfc_category_name' ), |
862 | 862 | array( 'wfc_deleted' => 0, 'wfc_category' => intval( $id ) ), |
863 | 863 | __METHOD__ |
864 | | - )); |
| 864 | + ) ); |
865 | 865 | |
866 | | - if( |
| 866 | + if ( |
867 | 867 | $category->wfc_category > 0 && |
868 | 868 | $category->wfc_category_name != $categoryName && |
869 | 869 | !wfReadOnly() |
— | — | @@ -889,9 +889,9 @@ |
890 | 890 | $this->result = false; |
891 | 891 | } |
892 | 892 | |
893 | | - if( $this->result == false ) { |
| 893 | + if ( $this->result == false ) { |
894 | 894 | $this->errorTitle = wfMsg( 'wikiforum-error-edit' ); |
895 | | - if( $this->errorMessage == '' ) { |
| 895 | + if ( $this->errorMessage == '' ) { |
896 | 896 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
897 | 897 | } |
898 | 898 | } |
— | — | @@ -901,8 +901,8 @@ |
902 | 902 | function addForum( $categoryId, $forumName, $description, $announcement ) { |
903 | 903 | global $wgUser; |
904 | 904 | |
905 | | - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
906 | | - if( strlen( $forumName ) > 0 ) { |
| 905 | + if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 906 | + if ( strlen( $forumName ) > 0 ) { |
907 | 907 | $dbr = wfGetDB( DB_SLAVE ); |
908 | 908 | |
909 | 909 | $sortkey = $dbr->selectRow( |
— | — | @@ -925,7 +925,7 @@ |
926 | 926 | __METHOD__ |
927 | 927 | ); |
928 | 928 | |
929 | | - if( $category->wfc_category > 0 && !wfReadOnly() ) { |
| 929 | + if ( $category->wfc_category > 0 && !wfReadOnly() ) { |
930 | 930 | $dbw = wfGetDB( DB_MASTER ); |
931 | 931 | $this->result = $dbw->insert( |
932 | 932 | 'wikiforum_forums', |
— | — | @@ -953,9 +953,9 @@ |
954 | 954 | $this->result = false; |
955 | 955 | } |
956 | 956 | |
957 | | - if( $this->result == false ) { |
| 957 | + if ( $this->result == false ) { |
958 | 958 | $this->errorTitle = wfMsg( 'wikiforum-error-add' ); |
959 | | - if( $this->errorMessage == '' ) { |
| 959 | + if ( $this->errorMessage == '' ) { |
960 | 960 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
961 | 961 | } |
962 | 962 | } |
— | — | @@ -974,8 +974,8 @@ |
975 | 975 | function editForum( $id, $forumName, $description, $announcement ) { |
976 | 976 | global $wgUser; |
977 | 977 | |
978 | | - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
979 | | - if( strlen( $forumName ) > 0 ) { |
| 978 | + if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 979 | + if ( strlen( $forumName ) > 0 ) { |
980 | 980 | $dbr = wfGetDB( DB_SLAVE ); |
981 | 981 | $forum = $dbr->fetchObject( $dbr->select( |
982 | 982 | 'wikiforum_forums', |
— | — | @@ -985,9 +985,9 @@ |
986 | 986 | ), |
987 | 987 | array( 'wff_deleted' => 0, 'wff_forum' => intval( $id ) ), |
988 | 988 | __METHOD__ |
989 | | - )); |
| 989 | + ) ); |
990 | 990 | |
991 | | - if( |
| 991 | + if ( |
992 | 992 | $forum->wff_forum > 0 && |
993 | 993 | ( |
994 | 994 | $forum->wff_forum_name != $forumName || |
— | — | @@ -1019,9 +1019,9 @@ |
1020 | 1020 | $this->result = false; |
1021 | 1021 | } |
1022 | 1022 | |
1023 | | - if( $this->result == false ) { |
| 1023 | + if ( $this->result == false ) { |
1024 | 1024 | $this->errorTitle = wfMsg( 'wikiforum-error-add' ); |
1025 | | - if( $this->errorMessage == '' ) { |
| 1025 | + if ( $this->errorMessage == '' ) { |
1026 | 1026 | $this->errorMessage = wfMsg( 'wikiforum-error-general' ); |
1027 | 1027 | } |
1028 | 1028 | } |
— | — | @@ -1031,10 +1031,10 @@ |
1032 | 1032 | function sortKeys( $id, $type, $direction_up ) { |
1033 | 1033 | global $wgUser; |
1034 | 1034 | |
1035 | | - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 1035 | + if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
1036 | 1036 | $dbr = wfGetDB( DB_SLAVE ); |
1037 | 1037 | |
1038 | | - if( $type == 'category' ) { |
| 1038 | + if ( $type == 'category' ) { |
1039 | 1039 | // in the past, both tables had a SortKey column |
1040 | 1040 | // nowadays the columns are prefixed with an abbreviation |
1041 | 1041 | // of the table name, which is the standard MW convention |
— | — | @@ -1083,12 +1083,12 @@ |
1084 | 1084 | array_push( $new_array, $entry ); |
1085 | 1085 | $i++; |
1086 | 1086 | } |
1087 | | - for( $i = 0; $i < sizeof( $new_array ); $i++ ) { |
1088 | | - if( $new_array[$i]->$fieldname == $id ) { |
1089 | | - if( $direction_up == true && $i > 0 ) { |
| 1087 | + for ( $i = 0; $i < sizeof( $new_array ); $i++ ) { |
| 1088 | + if ( $new_array[$i]->$fieldname == $id ) { |
| 1089 | + if ( $direction_up == true && $i > 0 ) { |
1090 | 1090 | $new_array[$i]->$name--; |
1091 | 1091 | $new_array[$i - 1]->$name++; |
1092 | | - } elseif( $direction_up == false && $i + 1 < sizeof( $new_array ) ) { |
| 1092 | + } elseif ( $direction_up == false && $i + 1 < sizeof( $new_array ) ) { |
1093 | 1093 | $new_array[$i]->$name++; |
1094 | 1094 | $new_array[$i + 1]->$name--; |
1095 | 1095 | } |
— | — | @@ -1146,7 +1146,7 @@ |
1147 | 1147 | $sqlForums = $dbr->select( |
1148 | 1148 | array( 'wikiforum_forums', 'user' ), |
1149 | 1149 | array( '*', 'user_name' ), |
1150 | | - array( 'wff_deleted' => 0,' wff_category' => $cat->wfc_category ), |
| 1150 | + array( 'wff_deleted' => 0, ' wff_category' => $cat->wfc_category ), |
1151 | 1151 | __METHOD__, |
1152 | 1152 | array( 'ORDER BY' => 'wff_sortkey ASC, wff_forum ASC' ), |
1153 | 1153 | array( 'user' => array( 'LEFT JOIN', 'user_id = wff_last_post_user' ) ) |
— | — | @@ -1155,7 +1155,7 @@ |
1156 | 1156 | $menuLink = ''; |
1157 | 1157 | $categoryLink = ''; |
1158 | 1158 | |
1159 | | - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 1159 | + if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
1160 | 1160 | $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/folder_add.png" title="' . wfMsg( 'wikiforum-add-forum' ) . '" /> '; |
1161 | 1161 | $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'addforum' => $cat->wfc_category ) ) . '">' . |
1162 | 1162 | wfMsg( 'wikiforum-add-forum' ) . '</a>'; |
— | — | @@ -1181,7 +1181,7 @@ |
1182 | 1182 | wfMsg( 'wikiforum-forum-name', $forum->wff_forum_name ) . '" /> '; |
1183 | 1183 | |
1184 | 1184 | $last_post = ''; |
1185 | | - if( $forum->wff_last_post_timestamp > 0 ) { |
| 1185 | + if ( $forum->wff_last_post_timestamp > 0 ) { |
1186 | 1186 | $last_post = wfMsg( |
1187 | 1187 | 'wikiforum-by', |
1188 | 1188 | $wgLang->timeanddate( $forum->wff_last_post_timestamp ), |
— | — | @@ -1205,7 +1205,7 @@ |
1206 | 1206 | } |
1207 | 1207 | |
1208 | 1208 | // Forum admins are allowed to add new categories |
1209 | | - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 1209 | + if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
1210 | 1210 | $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/database_add.png" title="' . wfMsg( 'wikiforum-add-category' ) . '" /> '; |
1211 | 1211 | $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'addcategory' => true ) ) . '">' . |
1212 | 1212 | wfMsg( 'wikiforum-add-category' ) . '</a>'; |
— | — | @@ -1229,7 +1229,7 @@ |
1230 | 1230 | ); |
1231 | 1231 | $data_overview = $dbr->fetchObject( $sqlData ); |
1232 | 1232 | |
1233 | | - if( $data_overview ) { |
| 1233 | + if ( $data_overview ) { |
1234 | 1234 | $sqlForums = $dbr->select( |
1235 | 1235 | array( 'wikiforum_forums', 'user' ), |
1236 | 1236 | array( '*', 'user_name' ), |
— | — | @@ -1247,7 +1247,7 @@ |
1248 | 1248 | $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
1249 | 1249 | |
1250 | 1250 | // Forum admins are allowed to add new forums |
1251 | | - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 1251 | + if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
1252 | 1252 | $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/folder_add.png" title="' . wfMsg( 'wikiforum-add-forum' ) . '" /> '; |
1253 | 1253 | $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'addforum' => $data_overview->wfc_category ) ) . '">' . |
1254 | 1254 | wfMsg( 'wikiforum-add-forum' ) . '</a>'; |
— | — | @@ -1272,7 +1272,7 @@ |
1273 | 1273 | $categoryLink |
1274 | 1274 | ); |
1275 | 1275 | |
1276 | | - foreach( $sqlForums as $forum ) { |
| 1276 | + foreach ( $sqlForums as $forum ) { |
1277 | 1277 | $forum_link = $this->showAdminIcons( |
1278 | 1278 | 'forum', $forum->wff_forum, true, true |
1279 | 1279 | ); |
— | — | @@ -1284,7 +1284,7 @@ |
1285 | 1285 | // If there are replies, indicate that somehow... |
1286 | 1286 | // This message will be shown only when there is one reply or |
1287 | 1287 | // more |
1288 | | - if( $forum->wff_last_post_timestamp > 0 ) { |
| 1288 | + if ( $forum->wff_last_post_timestamp > 0 ) { |
1289 | 1289 | $last_post = wfMsg( |
1290 | 1290 | 'wikiforum-by', |
1291 | 1291 | $wgLang->timeanddate( $forum->wff_last_post_timestamp ), |
— | — | @@ -1315,7 +1315,7 @@ |
1316 | 1316 | } |
1317 | 1317 | // Jack: unnecessary duplication of the "Overview" link on the bottom |
1318 | 1318 | // of the page, thus removed |
1319 | | - //$output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' ); |
| 1319 | + // $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' ); |
1320 | 1320 | $output .= $this->showFailure(); |
1321 | 1321 | return $output; |
1322 | 1322 | } |
— | — | @@ -1329,17 +1329,17 @@ |
1330 | 1330 | $f_movethread = $wgRequest->getInt( 'movethread' ); |
1331 | 1331 | |
1332 | 1332 | // sorting |
1333 | | - if( $wgRequest->getVal( 'sd' ) == 'up' ) { |
| 1333 | + if ( $wgRequest->getVal( 'sd' ) == 'up' ) { |
1334 | 1334 | $sort_direction = 'ASC'; |
1335 | 1335 | } else { |
1336 | 1336 | $sort_direction = 'DESC'; |
1337 | 1337 | } |
1338 | 1338 | |
1339 | | - if( $wgRequest->getVal( 'st' ) == 'answers' ) { |
| 1339 | + if ( $wgRequest->getVal( 'st' ) == 'answers' ) { |
1340 | 1340 | $sort_type = 'wft_reply_count'; |
1341 | | - } elseif( $wgRequest->getVal( 'st' ) == 'calls' ) { |
| 1341 | + } elseif ( $wgRequest->getVal( 'st' ) == 'calls' ) { |
1342 | 1342 | $sort_type = 'wft_view_count'; |
1343 | | - } elseif( $wgRequest->getVal( 'st' ) == 'thread' ) { |
| 1343 | + } elseif ( $wgRequest->getVal( 'st' ) == 'thread' ) { |
1344 | 1344 | $sort_type = 'wft_thread_name'; |
1345 | 1345 | } else { |
1346 | 1346 | $sort_type = 'wft_last_post_timestamp'; |
— | — | @@ -1349,13 +1349,13 @@ |
1350 | 1350 | $maxThreadsPerPage = intval( wfMsgForContent( 'wikiforum-max-threads-per-page' ) ); |
1351 | 1351 | |
1352 | 1352 | // limiting |
1353 | | - if( $maxThreadsPerPage && $wgRequest->getVal( 'lc' ) > 0 ) { |
| 1353 | + if ( $maxThreadsPerPage && $wgRequest->getVal( 'lc' ) > 0 ) { |
1354 | 1354 | $limit_count = $wgRequest->getVal( 'lc' ); |
1355 | | - } elseif( $maxThreadsPerPage > 0 ) { |
| 1355 | + } elseif ( $maxThreadsPerPage > 0 ) { |
1356 | 1356 | $limit_count = $maxThreadsPerPage; |
1357 | 1357 | } |
1358 | 1358 | |
1359 | | - if( is_numeric( $wgRequest->getVal( 'lp' ) ) ) { |
| 1359 | + if ( is_numeric( $wgRequest->getVal( 'lp' ) ) ) { |
1360 | 1360 | $limit_page = $wgRequest->getVal( 'lp' ) - 1; |
1361 | 1361 | } else { |
1362 | 1362 | $limit_page = 0; |
— | — | @@ -1380,9 +1380,9 @@ |
1381 | 1381 | |
1382 | 1382 | $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
1383 | 1383 | |
1384 | | - if( $data_overview ) { |
| 1384 | + if ( $data_overview ) { |
1385 | 1385 | $options['ORDER BY'] = 'wft_sticky DESC, ' . $sort_type . ' ' . $sort_direction; |
1386 | | - if( $limit_count > 0 ) { |
| 1386 | + if ( $limit_count > 0 ) { |
1387 | 1387 | $options['LIMIT'] = $limit_count; |
1388 | 1388 | $options['OFFSET'] = $limit_page * $limit_count; |
1389 | 1389 | } |
— | — | @@ -1400,7 +1400,7 @@ |
1401 | 1401 | $button['down'] = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/bullet_arrow_down.png" alt="" />'; |
1402 | 1402 | |
1403 | 1403 | // Non-moderators cannot post in an announcement-only forum |
1404 | | - if( $data_overview->wff_announcement == true && !$wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
| 1404 | + if ( $data_overview->wff_announcement == true && !$wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
1405 | 1405 | $write_thread = ''; |
1406 | 1406 | } else { |
1407 | 1407 | $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/note_add.png" title="' . wfMsg( 'wikiforum-write-thread' ) . '" /> '; |
— | — | @@ -1446,7 +1446,7 @@ |
1447 | 1447 | ); |
1448 | 1448 | |
1449 | 1449 | $last_post = ''; |
1450 | | - if( $thread->wft_reply_count > 0 ) { |
| 1450 | + if ( $thread->wft_reply_count > 0 ) { |
1451 | 1451 | $last_post = wfMsg( |
1452 | 1452 | 'wikiforum-by', |
1453 | 1453 | $wgLang->timeanddate( $thread->wft_last_post_timestamp ), |
— | — | @@ -1454,7 +1454,7 @@ |
1455 | 1455 | ); |
1456 | 1456 | } |
1457 | 1457 | |
1458 | | - if( $thread->wft_sticky == true ) { |
| 1458 | + if ( $thread->wft_sticky == true ) { |
1459 | 1459 | $sticky = 'sticky'; |
1460 | 1460 | } else { |
1461 | 1461 | $sticky = false; |
— | — | @@ -1478,14 +1478,14 @@ |
1479 | 1479 | ); |
1480 | 1480 | |
1481 | 1481 | } |
1482 | | - if( $threads_exist == false ) { |
| 1482 | + if ( $threads_exist == false ) { |
1483 | 1483 | $output .= WikiForumGui::getSingleLine( wfMsg( 'wikiforum-no-threads' ), 4 ); |
1484 | 1484 | } |
1485 | 1485 | $output .= WikiForumGui::getMainFooter(); |
1486 | 1486 | |
1487 | 1487 | $countReplies = ''; |
1488 | 1488 | |
1489 | | - if( $limit_count > 0 ) { |
| 1489 | + if ( $limit_count > 0 ) { |
1490 | 1490 | $countReplies = $dbr->selectRow( |
1491 | 1491 | 'wikiforum_threads', |
1492 | 1492 | array( 'COUNT(*) AS count' ), |
— | — | @@ -1512,9 +1512,9 @@ |
1513 | 1513 | } |
1514 | 1514 | |
1515 | 1515 | $pastethread_link = ''; |
1516 | | - if( $f_movethread > 0 ) { |
1517 | | - $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/paste_plain.png" title="' . wfMsg( 'wikiforum-paste-thread' ) .'" /> '; |
1518 | | - $pastethread_link = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'pastethread' => $f_movethread ) ) . '">' . wfMsg('wikiforum-paste-thread' ) . '</a> '; |
| 1516 | + if ( $f_movethread > 0 ) { |
| 1517 | + $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/paste_plain.png" title="' . wfMsg( 'wikiforum-paste-thread' ) . '" /> '; |
| 1518 | + $pastethread_link = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'pastethread' => $f_movethread ) ) . '">' . wfMsg( 'wikiforum-paste-thread' ) . '</a> '; |
1519 | 1519 | $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', $pastethread_link ); |
1520 | 1520 | } |
1521 | 1521 | |
— | — | @@ -1555,13 +1555,13 @@ |
1556 | 1556 | $maxRepliesPerPage = intval( wfMsgForContent( 'wikiforum-max-replies-per-page' ) ); |
1557 | 1557 | |
1558 | 1558 | // limiting |
1559 | | - if( $maxRepliesPerPage && $wgRequest->getVal( 'lc' ) > 0 ) { |
| 1559 | + if ( $maxRepliesPerPage && $wgRequest->getVal( 'lc' ) > 0 ) { |
1560 | 1560 | $limit_count = $wgRequest->getVal( 'lc' ); |
1561 | | - } elseif( $maxRepliesPerPage > 0 ) { |
| 1561 | + } elseif ( $maxRepliesPerPage > 0 ) { |
1562 | 1562 | $limit_count = $maxRepliesPerPage; |
1563 | 1563 | } |
1564 | 1564 | |
1565 | | - if( is_numeric( $wgRequest->getVal( 'lp' ) ) ) { |
| 1565 | + if ( is_numeric( $wgRequest->getVal( 'lp' ) ) ) { |
1566 | 1566 | $limit_page = $wgRequest->getVal( 'lp' ) - 1; |
1567 | 1567 | } else { |
1568 | 1568 | $limit_page = 0; |
— | — | @@ -1570,7 +1570,7 @@ |
1571 | 1571 | |
1572 | 1572 | $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
1573 | 1573 | |
1574 | | - if( $data_overview ) { |
| 1574 | + if ( $data_overview ) { |
1575 | 1575 | $queryOptions['ORDER BY'] = 'wfr_posted_timestamp ASC'; |
1576 | 1576 | if ( $limit_count > 0 ) { |
1577 | 1577 | $queryOptions['LIMIT'] = $limit_count; |
— | — | @@ -1607,8 +1607,8 @@ |
1608 | 1608 | |
1609 | 1609 | $menuLink = ''; |
1610 | 1610 | |
1611 | | - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
1612 | | - if( $data_overview->wft_sticky == 1 ) { |
| 1611 | + if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 1612 | + if ( $data_overview->wft_sticky == 1 ) { |
1613 | 1613 | $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/tag_blue_delete.png" title="' . wfMsg( 'wikiforum-remove-sticky' ) . '" /> '; |
1614 | 1614 | $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'removesticky' => $data_overview->wft_thread ) ) . '">' . |
1615 | 1615 | wfMsg( 'wikiforum-remove-sticky' ) . '</a> '; |
— | — | @@ -1621,7 +1621,7 @@ |
1622 | 1622 | |
1623 | 1623 | $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/comment_add.png" title="' . wfMsg( 'wikiforum-write-reply' ) . '" /> '; |
1624 | 1624 | // Replying is only possible to open threads |
1625 | | - if( $data_overview->wft_closed == 0 ) { |
| 1625 | + if ( $data_overview->wft_closed == 0 ) { |
1626 | 1626 | $menuLink .= $icon . '<a href="#writereply">' . |
1627 | 1627 | wfMsg( 'wikiforum-write-reply' ) . '</a>'; |
1628 | 1628 | } |
— | — | @@ -1631,7 +1631,7 @@ |
1632 | 1632 | $wgLang->timeanddate( $data_overview->wft_posted_timestamp ), |
1633 | 1633 | WikiForumClass::getUserLink( $data_overview->user_name ) |
1634 | 1634 | ); |
1635 | | - if( $data_overview->wft_edit_timestamp > 0 ) { |
| 1635 | + if ( $data_overview->wft_edit_timestamp > 0 ) { |
1636 | 1636 | $posted .= '<br /><i>' . |
1637 | 1637 | wfMsg( |
1638 | 1638 | 'wikiforum-edited', |
— | — | @@ -1655,7 +1655,7 @@ |
1656 | 1656 | |
1657 | 1657 | $output .= WikiForumGui::getThreadHeader( |
1658 | 1658 | htmlspecialchars( $data_overview->wft_thread_name ), |
1659 | | - $this->parseIt( $data_overview->wft_text ),//$wgOut->parse( $data_overview->wft_text ), |
| 1659 | + $this->parseIt( $data_overview->wft_text ),// $wgOut->parse( $data_overview->wft_text ), |
1660 | 1660 | $posted, |
1661 | 1661 | $editButtons, |
1662 | 1662 | $data_overview->wft_thread, |
— | — | @@ -1675,7 +1675,7 @@ |
1676 | 1676 | $wgLang->timeanddate( $reply->wfr_posted_timestamp ), |
1677 | 1677 | WikiForumClass::getUserLink( $reply->user_name ) |
1678 | 1678 | ); |
1679 | | - if( $reply->wfr_edit_timestamp > 0 ) { |
| 1679 | + if ( $reply->wfr_edit_timestamp > 0 ) { |
1680 | 1680 | $posted .= '<br /><i>' . |
1681 | 1681 | wfMsg( |
1682 | 1682 | 'wikiforum-edited', |
— | — | @@ -1685,7 +1685,7 @@ |
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | $output .= WikiForumGui::getReply( |
1689 | | - $this->parseIt( $reply->wfr_reply_text ),//$wgOut->parse( $reply->wfr_reply_text ), |
| 1689 | + $this->parseIt( $reply->wfr_reply_text ),// $wgOut->parse( $reply->wfr_reply_text ), |
1690 | 1690 | $posted, |
1691 | 1691 | $editButtons, |
1692 | 1692 | $reply->wfr_reply_id, |
— | — | @@ -1695,7 +1695,7 @@ |
1696 | 1696 | |
1697 | 1697 | $output .= WikiForumGui::getThreadFooter(); |
1698 | 1698 | |
1699 | | - if( $limit_count > 0 ) { |
| 1699 | + if ( $limit_count > 0 ) { |
1700 | 1700 | $countReplies = $dbr->selectRow( |
1701 | 1701 | 'wikiforum_replies', |
1702 | 1702 | 'COUNT(*) AS count', |
— | — | @@ -1716,7 +1716,7 @@ |
1717 | 1717 | |
1718 | 1718 | $mod_editcomment = $wgRequest->getInt( 'editcomment' ); |
1719 | 1719 | $mod_form = $wgRequest->getBool( 'form' ); |
1720 | | - if( |
| 1720 | + if ( |
1721 | 1721 | $data_overview->wft_closed == 0 || |
1722 | 1722 | ( isset( $mod_editcomment ) && $mod_editcomment > 0 && |
1723 | 1723 | $mod_form != true && |
— | — | @@ -1728,7 +1728,7 @@ |
1729 | 1729 | } else { |
1730 | 1730 | $this->errorTitle = wfMsg( 'wikiforum-thread-closed' ); |
1731 | 1731 | $this->errorMessage = wfMsg( 'wikiforum-error-thread-closed' ); |
1732 | | - $this->errorIcon = 'lock.png';//'icon_thread_closed'; |
| 1732 | + $this->errorIcon = 'lock.png';// 'icon_thread_closed'; |
1733 | 1733 | } |
1734 | 1734 | } else { |
1735 | 1735 | $this->errorTitle = wfMsg( 'wikiforum-thread-not-found' ); |
— | — | @@ -1740,7 +1740,7 @@ |
1741 | 1741 | } |
1742 | 1742 | |
1743 | 1743 | $movethread_link = ''; |
1744 | | - if( $wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
| 1744 | + if ( $wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
1745 | 1745 | $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/note_go.png" title="' . wfMsg( 'wikiforum-move-thread' ) . '" /> '; |
1746 | 1746 | $movethread_link = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'movethread' => $data_overview->wft_thread ) ) . '">' . wfMsg( 'wikiforum-move-thread' ) . '</a> '; |
1747 | 1747 | $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', $movethread_link ); |
— | — | @@ -1765,7 +1765,7 @@ |
1766 | 1766 | $output .= WikiForumGui::getSearchbox(); |
1767 | 1767 | $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' ); |
1768 | 1768 | |
1769 | | - if( strlen( $what ) > 1 ) { |
| 1769 | + if ( strlen( $what ) > 1 ) { |
1770 | 1770 | $i = 0; |
1771 | 1771 | |
1772 | 1772 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -1792,9 +1792,9 @@ |
1793 | 1793 | $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
1794 | 1794 | $output_temp = ''; |
1795 | 1795 | |
1796 | | - foreach( $sqlData as $result ) { |
| 1796 | + foreach ( $sqlData as $result ) { |
1797 | 1797 | $anchor = ''; |
1798 | | - if( $result->wfr_reply_id > 0 ) { |
| 1798 | + if ( $result->wfr_reply_id > 0 ) { |
1799 | 1799 | $anchor = '#reply_' . $result->wfr_reply_id; |
1800 | 1800 | } |
1801 | 1801 | |
— | — | @@ -1842,7 +1842,7 @@ |
1843 | 1843 | $output = $this->showFailure(); |
1844 | 1844 | |
1845 | 1845 | $title = wfMsg( 'wikiforum-preview' ); |
1846 | | - if( $previewTitle ) { |
| 1846 | + if ( $previewTitle ) { |
1847 | 1847 | $title = wfMsg( 'wikiforum-preview-with-title', $previewTitle ); |
1848 | 1848 | } |
1849 | 1849 | $posted = wfMsg( |
— | — | @@ -1850,7 +1850,7 @@ |
1851 | 1851 | $wgLang->timeanddate( wfTimestampNow() ), |
1852 | 1852 | $this->getUserLinkById( $wgUser->getId() ) |
1853 | 1853 | ); |
1854 | | - if( $type == 'addcomment' || $type == 'editcomment' ) { |
| 1854 | + if ( $type == 'addcomment' || $type == 'editcomment' ) { |
1855 | 1855 | $output .= WikiForumGui::getReplyHeader( $title ); |
1856 | 1856 | $output .= WikiForumGui::getReply( |
1857 | 1857 | $this->parseIt( $previewText ), |
— | — | @@ -1878,7 +1878,7 @@ |
1879 | 1879 | // Jack this adds an useless "Overview" link to the bottom of the page |
1880 | 1880 | // (below the save reply/cancel buttons) so I took the liberty of |
1881 | 1881 | // removing it |
1882 | | - #$output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' ); |
| 1882 | + # $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' ); |
1883 | 1883 | $output .= $this->showFailure(); |
1884 | 1884 | return $output; |
1885 | 1885 | } |
— | — | @@ -1890,7 +1890,7 @@ |
1891 | 1891 | $dbr = wfGetDB( DB_SLAVE ); |
1892 | 1892 | |
1893 | 1893 | $mod_editthread = $wgRequest->getInt( 'editthread' ); |
1894 | | - if( $mod_editthread ) { // are we editing an existing thread? |
| 1894 | + if ( $mod_editthread ) { // are we editing an existing thread? |
1895 | 1895 | $sqlData = $dbr->select( |
1896 | 1896 | array( |
1897 | 1897 | 'wikiforum_forums', 'wikiforum_category', |
— | — | @@ -1930,7 +1930,7 @@ |
1931 | 1931 | |
1932 | 1932 | // Everyone (privileged) can post to non-announcement forums and mods |
1933 | 1933 | // can post even to announcement-only forums |
1934 | | - if( |
| 1934 | + if ( |
1935 | 1935 | $overview->wff_announcement == false || |
1936 | 1936 | $wgUser->isAllowed( 'wikiforum-moderator' ) |
1937 | 1937 | ) |
— | — | @@ -1956,7 +1956,7 @@ |
1957 | 1957 | $dbr = wfGetDB( DB_SLAVE ); |
1958 | 1958 | $save_button = wfMsg( 'wikiforum-save' ); |
1959 | 1959 | |
1960 | | - if( isset( $values['text'] ) && strlen( $values['text'] ) > 0 ) { |
| 1960 | + if ( isset( $values['text'] ) && strlen( $values['text'] ) > 0 ) { |
1961 | 1961 | $text_prev = $values['text']; |
1962 | 1962 | } |
1963 | 1963 | |
— | — | @@ -1964,21 +1964,21 @@ |
1965 | 1965 | // is checked in WikiForumGui::getFormCatForum() |
1966 | 1966 | $overview = ''; |
1967 | 1967 | |
1968 | | - if( $type == 'addcategory' ) { |
| 1968 | + if ( $type == 'addcategory' ) { |
1969 | 1969 | $categoryName = wfMsg( 'wikiforum-add-category' ); |
1970 | | - } elseif( $type == 'editcategory' ) { |
| 1970 | + } elseif ( $type == 'editcategory' ) { |
1971 | 1971 | $overview = $dbr->fetchObject( $dbr->select( |
1972 | 1972 | 'wikiforum_category', |
1973 | 1973 | array( 'wfc_category', 'wfc_category_name' ), |
1974 | 1974 | array( 'wfc_deleted' => 0, 'wfc_category' => intval( $id ) ), |
1975 | 1975 | __METHOD__ |
1976 | | - )); |
| 1976 | + ) ); |
1977 | 1977 | $id = $overview->wfc_category; |
1978 | 1978 | $title_prev = $overview->wfc_category_name; |
1979 | 1979 | $categoryName = wfMsg( 'wikiforum-edit-category' ); |
1980 | | - } elseif( $type == 'addforum' ) { |
| 1980 | + } elseif ( $type == 'addforum' ) { |
1981 | 1981 | $categoryName = wfMsg( 'wikiforum-add-forum' ); |
1982 | | - } elseif( $type == 'editforum' ) { |
| 1982 | + } elseif ( $type == 'editforum' ) { |
1983 | 1983 | $overview = $dbr->fetchObject( $dbr->select( |
1984 | 1984 | 'wikiforum_forums', |
1985 | 1985 | array( |
— | — | @@ -1987,10 +1987,10 @@ |
1988 | 1988 | ), |
1989 | 1989 | array( 'wff_deleted' => 0, 'wff_forum' => intval( $id ) ), |
1990 | 1990 | __METHOD__ |
1991 | | - )); |
| 1991 | + ) ); |
1992 | 1992 | $id = $overview->wff_forum; |
1993 | 1993 | $title_prev = $overview->wff_forum_name; |
1994 | | - if( strlen( $text_prev ) == 0 ) { |
| 1994 | + if ( strlen( $text_prev ) == 0 ) { |
1995 | 1995 | $text_prev = $overview->wff_description; |
1996 | 1996 | } |
1997 | 1997 | $categoryName = wfMsg( 'wikiforum-edit-forum' ); |
— | — | @@ -2012,18 +2012,18 @@ |
2013 | 2013 | |
2014 | 2014 | $dbr = wfGetDB( DB_SLAVE ); |
2015 | 2015 | |
2016 | | - if( $this->result == false ) { |
| 2016 | + if ( $this->result == false ) { |
2017 | 2017 | $text_prev = $wgRequest->getVal( 'frmText' ); |
2018 | 2018 | $title_prev = $wgRequest->getVal( 'frmTitle' ); |
2019 | 2019 | } else { |
2020 | 2020 | $title_prev = wfMsg( 'wikiforum-thread-title' ); |
2021 | 2021 | } |
2022 | 2022 | |
2023 | | - if( $type == 'addthread' || $type == 'editthread' ) { |
| 2023 | + if ( $type == 'addthread' || $type == 'editthread' ) { |
2024 | 2024 | $mod_editthread = $wgRequest->getInt( 'editthread' ); |
2025 | 2025 | $mod_preview = $wgRequest->getBool( 'butPreview' ); |
2026 | | - if( $mod_editthread && $mod_editthread > 0 ) { |
2027 | | - if( !$text_prev || !$title_prev || $mod_preview == true ) { |
| 2026 | + if ( $mod_editthread && $mod_editthread > 0 ) { |
| 2027 | + if ( !$text_prev || !$title_prev || $mod_preview == true ) { |
2028 | 2028 | $data_thread = $dbr->fetchObject( $dbr->select( |
2029 | 2029 | 'wikiforum_threads', |
2030 | 2030 | array( 'wft_thread', 'wft_thread_name', 'wft_text' ), |
— | — | @@ -2032,14 +2032,14 @@ |
2033 | 2033 | 'wft_thread' => intval( $mod_editthread ) |
2034 | 2034 | ), |
2035 | 2035 | __METHOD__ |
2036 | | - )); |
| 2036 | + ) ); |
2037 | 2037 | $action = array( |
2038 | 2038 | 'editthread' => $data_thread->wft_thread |
2039 | 2039 | ); |
2040 | | - if( !$text_prev ) { |
| 2040 | + if ( !$text_prev ) { |
2041 | 2041 | $text_prev = $data_thread->wft_text; |
2042 | 2042 | } |
2043 | | - if( $title_prev == wfMsg( 'wikiforum-thread-title' ) ) { |
| 2043 | + if ( $title_prev == wfMsg( 'wikiforum-thread-title' ) ) { |
2044 | 2044 | $title_prev = $data_thread->wft_thread_name; |
2045 | 2045 | } |
2046 | 2046 | } |
— | — | @@ -2057,7 +2057,7 @@ |
2058 | 2058 | $mod_quotet = $wgRequest->getInt( 'quotethread' ); |
2059 | 2059 | |
2060 | 2060 | // quote |
2061 | | - if( isset( $mod_quotec ) && $mod_quotec > 0 ) { |
| 2061 | + if ( isset( $mod_quotec ) && $mod_quotec > 0 ) { |
2062 | 2062 | $reply = $dbr->fetchObject( $dbr->select( |
2063 | 2063 | array( 'wikiforum_replies', 'user' ), |
2064 | 2064 | array( 'wfr_reply_text', 'wfr_posted_timestamp', 'user_name' ), |
— | — | @@ -2065,8 +2065,8 @@ |
2066 | 2066 | __METHOD__, |
2067 | 2067 | array(), |
2068 | 2068 | array( 'user' => array( 'LEFT JOIN', 'user_id = wfr_user' ) ) |
2069 | | - )); |
2070 | | - if( $reply ) { |
| 2069 | + ) ); |
| 2070 | + if ( $reply ) { |
2071 | 2071 | $posted = wfMsg( |
2072 | 2072 | 'wikiforum-posted', |
2073 | 2073 | $wgLang->timeanddate( $reply->wfr_posted_timestamp ), |
— | — | @@ -2081,7 +2081,7 @@ |
2082 | 2082 | $text_prev = '[quote=' . $posted . ']' . |
2083 | 2083 | $reply->wfr_reply_text . '[/quote]'; |
2084 | 2084 | } |
2085 | | - } elseif( isset( $mod_quotet ) && $mod_quotet > 0 ) { |
| 2085 | + } elseif ( isset( $mod_quotet ) && $mod_quotet > 0 ) { |
2086 | 2086 | $thread = $dbr->selectRow( |
2087 | 2087 | array( 'wikiforum_threads', 'user' ), |
2088 | 2088 | array( 'wft_text', 'wft_posted_timestamp', 'user_name' ), |
— | — | @@ -2090,7 +2090,7 @@ |
2091 | 2091 | array(), |
2092 | 2092 | array( 'user' => array( 'LEFT JOIN', 'user_id = wft_user' ) ) |
2093 | 2093 | ); |
2094 | | - if( $thread ) { |
| 2094 | + if ( $thread ) { |
2095 | 2095 | $posted = wfMsg( |
2096 | 2096 | 'wikiforum-posted', |
2097 | 2097 | $wgLang->timeanddate( $thread->wft_posted_timestamp ), |
— | — | @@ -2103,12 +2103,12 @@ |
2104 | 2104 | } |
2105 | 2105 | // end quote |
2106 | 2106 | |
2107 | | - if( |
| 2107 | + if ( |
2108 | 2108 | isset( $mod_comment ) && $mod_comment > 0 && |
2109 | 2109 | ( $mod_form != true || $mod_preview == true ) |
2110 | 2110 | ) |
2111 | 2111 | { |
2112 | | - if( $mod_preview == true ) { |
| 2112 | + if ( $mod_preview == true ) { |
2113 | 2113 | $id = $wgRequest->getInt( 'thread' ); |
2114 | 2114 | } |
2115 | 2115 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -2117,13 +2117,13 @@ |
2118 | 2118 | array( 'wfr_reply_id', 'wfr_reply_text' ), |
2119 | 2119 | array( 'wfr_deleted' => 0, 'wfr_reply_id' => $mod_comment ), |
2120 | 2120 | __METHOD__ |
2121 | | - )); |
| 2121 | + ) ); |
2122 | 2122 | $action = array( |
2123 | 2123 | 'thread' => $id, |
2124 | 2124 | 'form' => true, |
2125 | 2125 | 'editcomment' => $reply->wfr_reply_id |
2126 | 2126 | ); |
2127 | | - if( $mod_preview != true ) { |
| 2127 | + if ( $mod_preview != true ) { |
2128 | 2128 | $text_prev = $reply->wfr_reply_text; |
2129 | 2129 | } |
2130 | 2130 | } else { |
— | — | @@ -2157,7 +2157,7 @@ |
2158 | 2158 | ) ) . '#writereply">'; |
2159 | 2159 | $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/comments_add.png" title="' . wfMsg( 'wikiforum-quote' ) . '" />'; |
2160 | 2160 | |
2161 | | - if( |
| 2161 | + if ( |
2162 | 2162 | ( $wgUser->getId() == $postedBy && $closed == 0 ) || |
2163 | 2163 | $wgUser->isAllowed( 'wikiforum-moderator' ) |
2164 | 2164 | ) |
— | — | @@ -2194,7 +2194,7 @@ |
2195 | 2195 | $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/comments_add.png" title="' . wfMsg( 'wikiforum-quote' ) . '" />'; |
2196 | 2196 | $editButtons .= '</a>'; |
2197 | 2197 | |
2198 | | - if( |
| 2198 | + if ( |
2199 | 2199 | $wgUser->getId() == $postedBy || |
2200 | 2200 | $wgUser->isAllowed( 'wikiforum-moderator' ) |
2201 | 2201 | ) |
— | — | @@ -2206,8 +2206,8 @@ |
2207 | 2207 | $editButtons .= '</a> '; |
2208 | 2208 | |
2209 | 2209 | // Only moderators can lock and reopen threads |
2210 | | - if( $wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
2211 | | - if( $closed == 0 ) { |
| 2210 | + if ( $wgUser->isAllowed( 'wikiforum-moderator' ) ) { |
| 2211 | + if ( $closed == 0 ) { |
2212 | 2212 | $editButtons .= ' <a href="' . $specialPage->escapeFullURL( array( 'closethread' => $threadID ) ) . '">'; |
2213 | 2213 | $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/lock_add.png" title="' . wfMsg( 'wikiforum-close-thread' ) . '" />'; |
2214 | 2214 | $editButtons .= '</a>'; |
— | — | @@ -2236,7 +2236,7 @@ |
2237 | 2237 | |
2238 | 2238 | $link = ''; |
2239 | 2239 | |
2240 | | - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
| 2240 | + if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) { |
2241 | 2241 | // Quick hack for fetching the correct icon |
2242 | 2242 | if ( $type == 'category' ) { |
2243 | 2243 | $iconName = 'database'; |
— | — | @@ -2254,12 +2254,12 @@ |
2255 | 2255 | $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/' . $iconName . '_delete.png" title="' . wfMsg( 'wikiforum-delete-' . $type ) . '" />'; |
2256 | 2256 | $link .= ' <a href="' . $specialPage->escapeFullURL( array( 'delete' . $type => $id ) ) . '">' . $icon . '</a>'; |
2257 | 2257 | |
2258 | | - if( $sortup == true ) { |
| 2258 | + if ( $sortup == true ) { |
2259 | 2259 | $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/arrow_up.png" title="' . wfMsg( 'wikiforum-sort-up' ) . '" />'; |
2260 | 2260 | $link .= ' <a href="' . $specialPage->escapeFullURL( array( $type . 'up' => $id ) ) . '">' . $icon . '</a>'; |
2261 | 2261 | } |
2262 | 2262 | |
2263 | | - if( $sortdown == true ) { |
| 2263 | + if ( $sortdown == true ) { |
2264 | 2264 | $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/arrow_down.png" title="' . wfMsg( 'wikiforum-sort-down' ) . '" />'; |
2265 | 2265 | $link .= ' <a href="' . $specialPage->escapeFullURL( array( $type . 'down' => $id ) ) . '">' . $icon . '</a>'; |
2266 | 2266 | } |
— | — | @@ -2289,11 +2289,11 @@ |
2290 | 2290 | $olderTimestamp = wfTimestamp( TS_MW, strtotime( '-' . $dayDefinitionNew . ' days' ) ); |
2291 | 2291 | |
2292 | 2292 | $imagePath = $wgScriptPath . '/extensions/WikiForum/icons'; |
2293 | | - if( $sticky == 1 ) { |
| 2293 | + if ( $sticky == 1 ) { |
2294 | 2294 | return '<img src="' . $imagePath . '/tag_blue.png" title="' . wfMsg( 'wikiforum-sticky' ) . '" /> '; |
2295 | | - } elseif( $closed > 0 ) { |
| 2295 | + } elseif ( $closed > 0 ) { |
2296 | 2296 | return '<img src="' . $imagePath . '/lock.png" title="' . wfMsg( 'wikiforum-thread-closed' ) . '" /> '; |
2297 | | - } elseif( $posted > $olderTimestamp ) { |
| 2297 | + } elseif ( $posted > $olderTimestamp ) { |
2298 | 2298 | return '<img src="' . $imagePath . '/new.png" title="' . wfMsg( 'wikiforum-new-thread' ) . '" /> '; |
2299 | 2299 | } else { |
2300 | 2300 | return '<img src="' . $imagePath . '/note.png" title="' . wfMsg( 'wikiforum-thread' ) . '" /> '; |
— | — | @@ -2311,8 +2311,8 @@ |
2312 | 2312 | |
2313 | 2313 | $output = ''; |
2314 | 2314 | |
2315 | | - if( strlen( $this->errorTitle ) > 0 ) { |
2316 | | - if( strlen( $this->errorIcon ) > 0 ) { |
| 2315 | + if ( strlen( $this->errorTitle ) > 0 ) { |
| 2316 | + if ( strlen( $this->errorIcon ) > 0 ) { |
2317 | 2317 | $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/' . $this->errorIcon . '" /> '; |
2318 | 2318 | } else { |
2319 | 2319 | $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/exclamation.png" title="' . wfMsg( 'wikiforum-thread-closed' ) . '" /> '; |
— | — | @@ -2339,7 +2339,7 @@ |
2340 | 2340 | public static function getUserLink( $username ) { |
2341 | 2341 | global $wgContLang, $wgUser; |
2342 | 2342 | |
2343 | | - if( $username ) { |
| 2343 | + if ( $username ) { |
2344 | 2344 | $sk = $wgUser->getSkin(); |
2345 | 2345 | $retVal = $sk->makeLinkObj( |
2346 | 2346 | Title::newFromText( $wgContLang->getNsText( NS_USER ) . ':' . $username ), |
— | — | @@ -2361,11 +2361,11 @@ |
2362 | 2362 | // copied from extensions/Comments/CommentClass.php |
2363 | 2363 | // really bad hack because we want to parse=firstline, but |
2364 | 2364 | // don't want wrapping <p> tags |
2365 | | - if( substr( $staffSig, 0 , 3 ) == '<p>' ) { |
| 2365 | + if ( substr( $staffSig, 0 , 3 ) == '<p>' ) { |
2366 | 2366 | $staffSig = substr( $staffSig, 3 ); |
2367 | 2367 | } |
2368 | 2368 | |
2369 | | - if( substr( $staffSig, strlen( $staffSig ) - 4, 4 ) == '</p>' ) { |
| 2369 | + if ( substr( $staffSig, strlen( $staffSig ) - 4, 4 ) == '</p>' ) { |
2370 | 2370 | $staffSig = substr( $staffSig, 0, strlen( $staffSig ) - 4 ); |
2371 | 2371 | } |
2372 | 2372 | // end copied bad hack |
— | — | @@ -2400,7 +2400,7 @@ |
2401 | 2401 | * UID = 0, HTML (link) for others |
2402 | 2402 | */ |
2403 | 2403 | public static function getUserLinkById( $userId ) { |
2404 | | - if( $userId == 0 ) { |
| 2404 | + if ( $userId == 0 ) { |
2405 | 2405 | return wfMsg( 'wikiforum-anonymous' ); |
2406 | 2406 | } else { |
2407 | 2407 | return self::getUserLink( User::whoIs( $userId ) ); |
— | — | @@ -2416,8 +2416,8 @@ |
2417 | 2417 | function prepareSmilies( $text ) { |
2418 | 2418 | global $wgWikiForumSmilies; |
2419 | 2419 | |
2420 | | - if( is_array( $wgWikiForumSmilies ) ) { |
2421 | | - foreach( $wgWikiForumSmilies as $key => $icon ) { |
| 2420 | + if ( is_array( $wgWikiForumSmilies ) ) { |
| 2421 | + foreach ( $wgWikiForumSmilies as $key => $icon ) { |
2422 | 2422 | $text = str_replace( |
2423 | 2423 | $key, |
2424 | 2424 | '<nowiki>' . $key . '</nowiki>', |
— | — | @@ -2433,9 +2433,9 @@ |
2434 | 2434 | global $wgWikiForumSmilies; |
2435 | 2435 | |
2436 | 2436 | // damn unclear code => need a better preg_replace patter to simplify |
2437 | | - if( is_array( $wgWikiForumSmilies ) && !empty( $wgWikiForumSmilies ) ) { |
| 2437 | + if ( is_array( $wgWikiForumSmilies ) && !empty( $wgWikiForumSmilies ) ) { |
2438 | 2438 | $path = $wgScriptPath . '/extensions/WikiForum'; |
2439 | | - foreach( $wgWikiForumSmilies as $key => $icon ) { |
| 2439 | + foreach ( $wgWikiForumSmilies as $key => $icon ) { |
2440 | 2440 | $text = str_replace( |
2441 | 2441 | $key, |
2442 | 2442 | '<img src="' . $path . '/' . $icon . '" title="' . $key . '"/>', |
— | — | @@ -2518,7 +2518,7 @@ |
2519 | 2519 | * @return String: thread title |
2520 | 2520 | */ |
2521 | 2521 | function getThreadTitle( $id ) { |
2522 | | - if( is_numeric( $id[1] ) && $id[1] > 0 ) { |
| 2522 | + if ( is_numeric( $id[1] ) && $id[1] > 0 ) { |
2523 | 2523 | $dbr = wfGetDB( DB_SLAVE ); |
2524 | 2524 | $overview = $dbr->select( |
2525 | 2525 | 'wikiforum_threads', |
— | — | @@ -2531,7 +2531,7 @@ |
2532 | 2532 | ); |
2533 | 2533 | |
2534 | 2534 | $specialPage = SpecialPage::getTitleFor( 'WikiForum' ); |
2535 | | - if( $overview ) { |
| 2535 | + if ( $overview ) { |
2536 | 2536 | return '<i><a href="' . $specialPage->escapeFullURL( array( 'thread' => $id[1] ) ) . '">' . |
2537 | 2537 | $overview->wft_thread_name . '</a></i>'; |
2538 | 2538 | } else { |