r96351 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96350‎ | r96351 | r96352 >
Date:16:54, 6 September 2011
Author:siebrand
Status:deferred
Tags:
Comment:
Remove obsolete description message.
Update whitespace, formatting and indentation.
Add a FIXME for hook functions that needs to be moved into a hooks class.
Run stylize.php.
Modified paths:
  • /trunk/extensions/WikiForum/SpecialWikiForum.php (modified) (history)
  • /trunk/extensions/WikiForum/WikiForum.php (modified) (history)
  • /trunk/extensions/WikiForum/WikiForumClass.php (modified) (history)
  • /trunk/extensions/WikiForum/WikiForumGui.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiForum/WikiForum.php
@@ -26,7 +26,7 @@
2727 * along with this program. If not, see <http://www.gnu.org/licenses/>.
2828 */
2929
30 -if( !defined( 'MEDIAWIKI' ) ) {
 30+if ( !defined( 'MEDIAWIKI' ) ) {
3131 die( "This is an extension to the MediaWiki package and cannot be run standalone.\n" );
3232 }
3333
@@ -37,7 +37,6 @@
3838 'author' => array( 'Michael Chlebek', 'Jack Phoenix' ),
3939 'version' => '1.2-SW',
4040 'url' => 'http://www.mediawiki.org/wiki/Extension:WikiForum',
41 - 'description' => '[[Special:WikiForum|Forum]] extension for MediaWiki',
4241 'descriptionmsg' => 'wikiforum-desc'
4342 );
4443
@@ -86,6 +85,8 @@
8786 $wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'wfSpecialWikiForumNav';
8887 $wgHooks['SkinTemplateToolboxEnd'][] = 'wfSpecialWikiForumToolbox';
8988
 89+// @todo FIXME: Move hook methods to a hook class.
 90+
9091 /**
9192 * Set up the two new parser hooks: <WikiForumList> and <WikiForumThread>
9293 *
@@ -126,8 +127,8 @@
127128 * @return Boolean: true
128129 */
129130 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'] == '' ) {
132133 echo '<li id="t-iswikiforum">' . wfMsg( 'wikiforum' ) . '</li>';
133134 } else {
134135 $url = $skinTemplate->data['nav_urls']['wikiforum']['href'];
@@ -146,7 +147,7 @@
147148 function renderWikiForumList( $input, $args, $parser, $frame ) {
148149 global $wgUser, $wgLang, $wgScriptPath;
149150
150 - if( !isset( $args['num'] ) ) {
 151+ if ( !isset( $args['num'] ) ) {
151152 $args['num'] = 5;
152153 }
153154
@@ -184,7 +185,7 @@
185186 wfMsg( 'wikiforum-latest-reply' )
186187 );
187188
188 - foreach( $sqlThreads as $thread ) {
 189+ foreach ( $sqlThreads as $thread ) {
189190 $icon = WikiForumClass::getThreadIcon(
190191 $thread->wft_posted_timestamp,
191192 $thread->wft_closed,
@@ -194,7 +195,7 @@
195196 $lastpost = '';
196197 // If there are some replies, then we can obviously figure out who was
197198 // the last user who posted something on the topic...
198 - if( $thread->wft_reply_count > 0 ) {
 199+ if ( $thread->wft_reply_count > 0 ) {
199200 $lastpost = wfMsg(
200201 'wikiforum-by',
201202 $wgLang->timeanddate( $thread->wft_last_post_timestamp ),
@@ -213,7 +214,7 @@
214215 );
215216 $forumLink = $sk->link(
216217 $specialPageObj,
217 - $thread->wff_forum_name,
 218+ $thread->wff_forum_name,
218219 array(),
219220 array( 'forum' => $thread->wff_forum )
220221 );
@@ -254,7 +255,7 @@
255256 function renderWikiForumThread( $input, $args, $parser, $frame ) {
256257 global $wgOut, $wgLang, $wgScriptPath;
257258
258 - if( isset( $args['id'] ) && $args['id'] > 0 ) {
 259+ if ( isset( $args['id'] ) && $args['id'] > 0 ) {
259260 $dbr = wfGetDB( DB_SLAVE );
260261 $sqlThreads = $dbr->select(
261262 array( 'wikiforum_forums', 'wikiforum_category', 'wikiforum_threads', 'user' ),
@@ -279,13 +280,13 @@
280281 );
281282 $overview = $dbr->fetchObject( $sqlThreads );
282283
283 - if( $overview ) {
 284+ if ( $overview ) {
284285 $posted = wfMsg(
285286 'wikiforum-posted',
286287 $wgLang->timeanddate( $overview->wft_posted_timestamp ),
287288 WikiForumClass::getUserLink( $overview->user_name )
288289 );
289 - if( $overview->wft_edit_timestamp > 0 ) {
 290+ if ( $overview->wft_edit_timestamp > 0 ) {
290291 $posted .= '<br /><i>' .
291292 wfMsg(
292293 'wikiforum-edited',
@@ -324,13 +325,13 @@
325326 array( 'user' => array( 'LEFT JOIN', 'user_id = wfr_user' ) )
326327 );
327328
328 - foreach( $replies as $reply ) {
 329+ foreach ( $replies as $reply ) {
329330 $posted = wfMsg(
330331 'wikiforum-posted',
331332 $wgLang->timeanddate( $reply->wfr_posted_timestamp ),
332333 WikiForumClass::getUserLink( $reply->user_name )
333334 );
334 - if( $reply->wfr_edit > 0 ) {
 335+ if ( $reply->wfr_edit > 0 ) {
335336 $posted .= '<br /><i>' .
336337 wfMsg(
337338 'wikiforum-edited',
Index: trunk/extensions/WikiForum/SpecialWikiForum.php
@@ -7,7 +7,6 @@
88 */
99
1010 class WikiForum extends SpecialPage {
11 -
1211 /**
1312 * Constructor -- set up the new special page
1413 */
@@ -47,6 +46,7 @@
4847 if ( $par ) {
4948 // Let search spiders index our content
5049 $wgOut->setRobotPolicy( 'index,follow' );
 50+
5151 if ( is_numeric( $par ) ) {
5252 $wgOut->addHTML( $forum->showForum( $par ) );
5353 } else {
@@ -56,25 +56,25 @@
5757 } else {
5858 // That's...a lot of variables. No kidding.
5959 $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' );
7575 $mod_deletecategory = $wgRequest->getInt( 'deletecategory' );
76 - $mod_deleteforum = $wgRequest->getInt( 'deleteforum' );
 76+ $mod_deleteforum = $wgRequest->getInt( 'deleteforum' );
7777 $mod_makesticky = $wgRequest->getInt( 'makesticky' );
78 - $mod_removesticky = $wgRequest->getInt( 'removesticky' );
 78+ $mod_removesticky = $wgRequest->getInt( 'removesticky' );
7979 $mod_categoryup = $wgRequest->getInt( 'categoryup' );
8080 $mod_categorydown = $wgRequest->getInt( 'categorydown' );
8181 $mod_forumup = $wgRequest->getInt( 'forumup' );
@@ -88,14 +88,14 @@
8989
9090 // Figure out what we're going to do here...post a reply, a new thread,
9191 // 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 ) {
9393 $data_text = $wgRequest->getVal( 'frmText' );
9494 $data_preview = $wgRequest->getBool( 'butPreview' );
9595 $data_save = $wgRequest->getBool( 'butSave' );
96 - if( $data_save == true ) {
 96+ if ( $data_save == true ) {
9797 $result = $forum->addReply( $mod_addcomment, $data_text );
9898 $mod_thread = $mod_addcomment;
99 - } elseif( $data_preview == true ) {
 99+ } elseif ( $data_preview == true ) {
100100 $result = $wgOut->addHTML(
101101 $forum->previewIssue(
102102 'addcomment',
@@ -106,19 +106,20 @@
107107 );
108108 $mod_none = true;
109109 }
110 - } elseif( isset( $mod_addthread ) && $mod_addthread > 0 ) {
 110+ } elseif ( isset( $mod_addthread ) && $mod_addthread > 0 ) {
111111 $data_title = $wgRequest->getVal( 'frmTitle' );
112112 $data_text = $wgRequest->getVal( 'frmText' );
113113 $data_preview = $wgRequest->getBool( 'butPreview' );
114114 $data_save = $wgRequest->getBool( 'butSave' );
115 - if( $data_save == true ) {
 115+
 116+ if ( $data_save == true ) {
116117 $result = $forum->addThread(
117118 $mod_addthread,
118119 $data_title,
119120 $data_text
120121 );
121122 $mod_forum = $mod_addthread;
122 - } elseif( $data_preview == true ) {
 123+ } elseif ( $data_preview == true ) {
123124 $result = $wgOut->addHTML(
124125 $forum->previewIssue(
125126 'addthread',
@@ -131,17 +132,18 @@
132133 } else {
133134 $mod_writethread = $mod_addthread;
134135 }
135 - } elseif( isset( $mod_editcomment ) && $mod_editcomment > 0 ) {
 136+ } elseif ( isset( $mod_editcomment ) && $mod_editcomment > 0 ) {
136137 $data_text = $wgRequest->getVal( 'frmText' );
137138 $data_preview = $wgRequest->getBool( 'butPreview' );
138139 $data_save = $wgRequest->getBool( 'butSave' );
139 - if( $data_save == true ) {
 140+
 141+ if ( $data_save == true ) {
140142 $result = $forum->editReply(
141143 $mod_editcomment,
142144 $data_text
143145 );
144146 $mod_thread = $mod_thread;
145 - } elseif( $data_preview == true ) {
 147+ } elseif ( $data_preview == true ) {
146148 $result = $wgOut->addHTML(
147149 $forum->previewIssue(
148150 'editcomment',
@@ -152,19 +154,20 @@
153155 );
154156 $mod_none = true;
155157 }
156 - } elseif( isset( $mod_editthread ) && $mod_editthread > 0 ) {
 158+ } elseif ( isset( $mod_editthread ) && $mod_editthread > 0 ) {
157159 $data_title = $wgRequest->getVal( 'frmTitle' );
158160 $data_text = $wgRequest->getVal( 'frmText' );
159161 $data_preview = $wgRequest->getBool( 'butPreview' );
160162 $data_save = $wgRequest->getBool( 'butSave' );
161 - if( $data_save == true ) {
 163+
 164+ if ( $data_save == true ) {
162165 $result = $forum->editThread(
163166 $mod_editthread,
164167 $data_title,
165168 $data_text
166169 );
167170 $mod_thread = $mod_editthread;
168 - } elseif( $data_preview == true ) {
 171+ } elseif ( $data_preview == true ) {
169172 $result = $wgOut->addHTML(
170173 $forum->previewIssue(
171174 'editthread',
@@ -177,59 +180,59 @@
178181 } else {
179182 $mod_writethread = $mod_editthread;
180183 }
181 - } elseif( isset( $mod_deletecomment ) && $mod_deletecomment > 0 ) {
 184+ } elseif ( isset( $mod_deletecomment ) && $mod_deletecomment > 0 ) {
182185 $result = $forum->deleteReply( $mod_deletecomment );
183 - } elseif( isset( $mod_deletethread ) && $mod_deletethread > 0 ) {
 186+ } elseif ( isset( $mod_deletethread ) && $mod_deletethread > 0 ) {
184187 $result = $forum->deleteThread( $mod_deletethread );
185 - } elseif( isset( $mod_deletecategory ) && $mod_deletecategory > 0 ) {
 188+ } elseif ( isset( $mod_deletecategory ) && $mod_deletecategory > 0 ) {
186189 $result = $forum->deleteCategory( $mod_deletecategory );
187 - } elseif( isset( $mod_deleteforum ) && $mod_deleteforum > 0 ) {
 190+ } elseif ( isset( $mod_deleteforum ) && $mod_deleteforum > 0 ) {
188191 $result = $forum->deleteForum( $mod_deleteforum );
189 - } elseif( isset( $mod_categoryup ) && $mod_categoryup > 0 ) {
 192+ } elseif ( isset( $mod_categoryup ) && $mod_categoryup > 0 ) {
190193 $result = $forum->sortKeys( $mod_categoryup, 'category', true );
191 - } elseif( isset( $mod_categorydown ) && $mod_categorydown > 0 ) {
 194+ } elseif ( isset( $mod_categorydown ) && $mod_categorydown > 0 ) {
192195 $result = $forum->sortKeys( $mod_categorydown, 'category', false );
193 - } elseif( isset( $mod_forumup ) && $mod_forumup > 0 ) {
 196+ } elseif ( isset( $mod_forumup ) && $mod_forumup > 0 ) {
194197 $result = $forum->sortKeys( $mod_forumup, 'forum', true );
195 - } elseif( isset( $mod_forumdown ) && $mod_forumdown > 0 ) {
 198+ } elseif ( isset( $mod_forumdown ) && $mod_forumdown > 0 ) {
196199 $result = $forum->sortKeys( $mod_forumdown, 'forum', false );
197 - } elseif( isset( $mod_closethread ) && $mod_closethread > 0 ) {
 200+ } elseif ( isset( $mod_closethread ) && $mod_closethread > 0 ) {
198201 $result = $forum->closeThread( $mod_closethread );
199202 $mod_thread = $mod_closethread;
200 - } elseif( isset( $mod_reopenthread ) && $mod_reopenthread > 0 ) {
 203+ } elseif ( isset( $mod_reopenthread ) && $mod_reopenthread > 0 ) {
201204 $result = $forum->reopenThread( $mod_reopenthread );
202205 $mod_thread = $mod_reopenthread;
203 - } elseif( isset( $mod_makesticky ) && $mod_makesticky > 0 ) {
 206+ } elseif ( isset( $mod_makesticky ) && $mod_makesticky > 0 ) {
204207 $result = $forum->makeSticky( $mod_makesticky, true );
205208 $mod_thread = $mod_makesticky;
206 - } elseif( isset( $mod_removesticky ) && $mod_removesticky > 0 ) {
 209+ } elseif ( isset( $mod_removesticky ) && $mod_removesticky > 0 ) {
207210 $result = $forum->makeSticky( $mod_removesticky, false );
208211 $mod_thread = $mod_removesticky;
209 - } elseif( isset( $mod_pastethread ) && $mod_pastethread > 0 ) {
 212+ } elseif ( isset( $mod_pastethread ) && $mod_pastethread > 0 ) {
210213 $result = $forum->pasteThread( $mod_pastethread, $mod_forum );
211 - } elseif(
 214+ } elseif (
212215 isset( $mod_addcategory ) && $mod_addcategory == true &&
213216 $wgUser->isAllowed( 'wikiforum-admin' )
214 - )
215 - {
216 - if( $mod_submit == true ) {
 217+ ) {
 218+ if ( $mod_submit == true ) {
217219 $values['title'] = $wgRequest->getVal( 'frmTitle' );
218220 $mod_submit = $forum->addCategory( $values['title'] );
219221 }
220 - if( $mod_submit == false ) {
 222+
 223+ if ( $mod_submit == false ) {
221224 $mod_showform = true;
222225 $type = 'addcategory';
223226 $id = $mod_addcategory;
224227 }
225 - } elseif(
 228+ } elseif (
226229 isset( $mod_addforum ) && $mod_addforum > 0 &&
227230 $wgUser->isAllowed( 'wikiforum-admin' )
228 - )
229 - {
230 - if( $mod_submit == true ) {
 231+ ) {
 232+ if ( $mod_submit == true ) {
231233 $values['title'] = $wgRequest->getVal( 'frmTitle' );
232234 $values['text'] = $wgRequest->getVal( 'frmText' );
233 - if( $wgRequest->getBool( 'chkAnnouncement' ) == true ) {
 235+
 236+ if ( $wgRequest->getBool( 'chkAnnouncement' ) == true ) {
234237 $values['announce'] = '1';
235238 } else {
236239 $values['announce'] = '0';
@@ -241,37 +244,38 @@
242245 $values['announce']
243246 );
244247 }
245 - if( $mod_submit == false ) {
 248+
 249+ if ( $mod_submit == false ) {
246250 $mod_showform = true;
247251 $type = 'addforum';
248252 $id = $mod_addforum;
249253 }
250 - } elseif(
 254+ } elseif (
251255 isset( $mod_editcategory ) && $mod_editcategory > 0 &&
252256 $wgUser->isAllowed( 'wikiforum-admin' )
253 - )
254 - {
255 - if( $mod_submit == true ) {
 257+ ) {
 258+ if ( $mod_submit == true ) {
256259 $values['title'] = $wgRequest->getVal( 'frmTitle' );
257260 $mod_submit = $forum->editCategory(
258261 $mod_editcategory,
259262 $values['title']
260263 );
261264 }
262 - if( $mod_submit == false ) {
 265+
 266+ if ( $mod_submit == false ) {
263267 $mod_showform = true;
264268 $type = 'editcategory';
265269 $id = $mod_editcategory;
266270 }
267 - } elseif(
 271+ } elseif (
268272 isset( $mod_editforum ) && $mod_editforum > 0 &&
269273 $wgUser->isAllowed( 'wikiforum-admin' )
270 - )
271 - {
272 - if( $mod_submit == true ) {
 274+ ) {
 275+ if ( $mod_submit == true ) {
273276 $values['title'] = $wgRequest->getVal( 'frmTitle' );
274277 $values['text'] = $wgRequest->getVal( 'frmText' );
275 - if( $wgRequest->getBool( 'chkAnnouncement' ) == true ) {
 278+
 279+ if ( $wgRequest->getBool( 'chkAnnouncement' ) == true ) {
276280 $values['announce'] = '1';
277281 } else {
278282 $values['announce'] = '0';
@@ -283,7 +287,8 @@
284288 $values['announce']
285289 );
286290 }
287 - if( $mod_submit == false ) {
 291+
 292+ if ( $mod_submit == false ) {
288293 $mod_showform = true;
289294 $type = 'editforum';
290295 $id = $mod_editforum;
@@ -293,25 +298,25 @@
294299 // Only in certain cases we want search spiders to index our content
295300 // and follow links. These are overview (Special:WikiForum), individual
296301 // threads, forums and categories.
297 - if( isset( $mod_search ) && $mod_search == true ) {
 302+ if ( isset( $mod_search ) && $mod_search == true ) {
298303 $wgOut->addHTML( $forum->showSearchResults( $mod_search ) );
299 - } elseif( $mod_none == true ) {
 304+ } elseif ( $mod_none == true ) {
300305 // no data
301 - } elseif( isset( $mod_category ) && $mod_category > 0 ) {
 306+ } elseif ( isset( $mod_category ) && $mod_category > 0 ) {
302307 // Let search spiders index our content
303308 $wgOut->setRobotPolicy( 'index,follow' );
304309 $wgOut->addHTML( $forum->showCategory( $mod_category ) );
305 - } elseif( isset( $mod_forum ) && $mod_forum > 0 ) {
 310+ } elseif ( isset( $mod_forum ) && $mod_forum > 0 ) {
306311 // Let search spiders index our content
307312 $wgOut->setRobotPolicy( 'index,follow' );
308313 $wgOut->addHTML( $forum->showForum( $mod_forum ) );
309 - } elseif( isset( $mod_thread ) && $mod_thread > 0 ) {
 314+ } elseif ( isset( $mod_thread ) && $mod_thread > 0 ) {
310315 // Let search spiders index our content
311316 $wgOut->setRobotPolicy( 'index,follow' );
312317 $wgOut->addHTML( $forum->showThread( $mod_thread ) );
313 - } elseif( isset( $mod_writethread ) && $mod_writethread > 0 ) {
 318+ } elseif ( isset( $mod_writethread ) && $mod_writethread > 0 ) {
314319 $wgOut->addHTML( $forum->writeThread( $mod_writethread ) );
315 - } elseif( isset( $mod_showform ) && $mod_showform ) {
 320+ } elseif ( isset( $mod_showform ) && $mod_showform ) {
316321 $wgOut->addHTML(
317322 $forum->showEditorCatForum( $id, $type, $values )
318323 );
@@ -321,7 +326,5 @@
322327 $wgOut->addHTML( $forum->showOverview() );
323328 }
324329 } // else from line 55 (the if $par is not specified one)
325 -
326330 } // execute()
327 -
328 -}
\ No newline at end of file
 331+}
Index: trunk/extensions/WikiForum/WikiForumGui.php
@@ -42,7 +42,7 @@
4343 global $wgUser, $wgWikiForumAllowAnonymous;
4444
4545 $output = '<table class="mw-wikiforum-headerrow"><tr><td class="mw-wikiforum-leftside">';
46 - if(
 46+ if (
4747 strlen( $additionalLinks ) == 0 ||
4848 $catId > 0 && strlen( $catName ) > 0
4949 )
@@ -50,16 +50,16 @@
5151 $specialPageObj = SpecialPage::getTitleFor( 'WikiForum' );
5252 $output .= '<a href="' . $specialPageObj->escapeFullURL() . '">' .
5353 wfMsg( 'wikiforum-overview' ) . '</a>';
54 - if( $catId > 0 && strlen( $catName ) > 0 ) {
 54+ if ( $catId > 0 && strlen( $catName ) > 0 ) {
5555 $output .= ' &gt; <a href="' .
5656 $specialPageObj->escapeFullURL( 'category=' . $catId ) . '">' .
5757 $catName . '</a>';
5858 }
59 - if( $forumId > 0 && strlen( $forumName ) > 0 ) {
 59+ if ( $forumId > 0 && strlen( $forumName ) > 0 ) {
6060 $output .= ' &gt; <a href="' . $specialPageObj->escapeFullURL( 'forum=' . $forumId ) . '">' . $forumName . '</a>';
6161 }
6262 }
63 - if(
 63+ if (
6464 strlen( $additionalLinks ) > 0 &&
6565 ( $wgWikiForumAllowAnonymous || $wgUser->getId() > 0 )
6666 )
@@ -85,10 +85,10 @@
8686 $output = '';
8787 $specialPage = SpecialPage::getTitleFor( 'WikiForum' );
8888
89 - if( $maxissues / $limit > 1 ) {
 89+ if ( $maxissues / $limit > 1 ) {
9090 $output = '<table class="mw-wikiforum-footerrow"><tr><td class="mw-wikiforum-leftside">' .
9191 wfMsg( 'wikiforum-pages' ) . wfMsg( 'word-separator' );
92 - for( $i = 1; $i < ( $maxissues / $limit ) + 1; $i++ ) {
 92+ for ( $i = 1; $i < ( $maxissues / $limit ) + 1; $i++ ) {
9393 // URL query parameters
9494 $urlParams = array(
9595 'lp' => $i
@@ -96,24 +96,24 @@
9797 // Thread ID is optional, but if it was given, we need to get
9898 // rid of the forum parameter for the thread parameter to take
9999 // precedence. Stupid, I know.
100 - if( $threadId ) {
 100+ if ( $threadId ) {
101101 $urlParams['thread'] = $threadId;
102102 } else {
103103 $urlParams['forum'] = $forumId;
104104 }
105 - if( $i != $page + 1 ) {
 105+ if ( $i != $page + 1 ) {
106106 $output .= '<a href="' . $specialPage->escapeFullURL( $urlParams ) . '">';
107107 } else {
108108 $output .= '[';
109109 }
110110
111 - if( $i <= 9 ) {
 111+ if ( $i <= 9 ) {
112112 $output .= '0' . $i;
113113 } else {
114114 $output .= $i;
115115 }
116116
117 - if( $i != $page + 1 ) {
 117+ if ( $i != $page + 1 ) {
118118 $output .= '</a>';
119119 } else {
120120 $output .= ']';
@@ -146,7 +146,7 @@
147147 public static function getMainHeaderRow( $title1, $title2, $title3, $title4, $title5 ) {
148148 $output = '<tr class="mw-wikiforum-title">
149149 <th class="mw-wikiforum-title">' . $title1 . '</th>';
150 - if( $title5 ) {
 150+ if ( $title5 ) {
151151 $output .= '<th class="mw-wikiforum-admin"><p class="mw-wikiforum-valuetitle">' .
152152 $title5 . '</p></th>';
153153 }
@@ -159,13 +159,13 @@
160160
161161 public static function getMainBody( $col_value1, $col_value2, $col_value3, $col_value4, $col_title5, $marked ) {
162162 $output = '<tr class="mw-wikiforum-';
163 - if( $marked ) {
 163+ if ( $marked ) {
164164 $output .= $marked;
165165 } else {
166166 $output .= 'normal';
167167 }
168168 $output .= '"><td class="mw-wikiforum-title">' . $col_value1 . '</td>';
169 - if( $col_title5 ) {
 169+ if ( $col_title5 ) {
170170 $output .= '<td class="mw-wikiforum-admin">' . $col_title5 . '</td>';
171171 }
172172 $output .= '
@@ -247,7 +247,7 @@
248248 $output = '<table cellspacing="0" cellpadding="0" class="mw-wikiforum-posted">' .
249249 '<tr><td class="mw-wikiforum-leftside">' . $posted . '</td>';
250250
251 - if( $wgUser->isLoggedIn() ) {
 251+ if ( $wgUser->isLoggedIn() ) {
252252 $output .= '<td class="mw-wikiforum-rightside">' . $buttons . '</td>';
253253 }
254254
@@ -266,7 +266,7 @@
267267
268268 $output = '';
269269
270 - if( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) {
 270+ if ( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) {
271271 // Required for the edit buttons to display
272272 $wgOut->addScriptFile( 'edit.js' );
273273 $toolbar = EditPage::getEditToolbar();
@@ -284,7 +284,7 @@
285285 <td>
286286 <input name="butSave" type="submit" value="' . $saveButton . '" accesskey="s" title="' . $saveButton . ' [s]" />
287287 <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' ) {
289289 $output .= ' <input name="butCancel" type="button" value="' . wfMsg( 'cancel' ) . '" accesskey="c" onclick="javascript:history.back();" title="' . wfMsg( 'cancel' ) . ' [c]" />';
290290 }
291291 $output .= '</td>
@@ -309,7 +309,7 @@
310310 public static function getFormCatForum( $type, $categoryName, $action, $title_prev, $text_prev, $saveButton, $overviewObj ) {
311311 global $wgUser;
312312
313 - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
 313+ if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
314314 $title_prev = str_replace( '"', '&quot;', $title_prev );
315315 $specialPage = SpecialPage::getTitleFor( 'WikiForum' );
316316 $output = '
@@ -324,7 +324,7 @@
325325 <input type="text" name="frmTitle" style="width: 100%" value="' . $title_prev . '" />
326326 </td>
327327 </tr>';
328 - if( $type == 'addforum' || $type == 'editforum' ) {
 328+ if ( $type == 'addforum' || $type == 'editforum' ) {
329329 $check = '';
330330 if ( is_object( $overviewObj ) && $overviewObj->wff_announcement == true ) {
331331 $check = 'checked="checked"';
Index: trunk/extensions/WikiForum/WikiForumClass.php
@@ -59,9 +59,9 @@
6060 array( 'wfr_reply_id', 'wfr_user' ),
6161 array( 'wfr_deleted' => 0, 'wfr_reply_id' => intval( $replyId ) ),
6262 __METHOD__
63 - ));
 63+ ) );
6464
65 - if(
 65+ if (
6666 $reply->wfr_reply_id > 0 && $wgUser->getId() > 0 &&
6767 (
6868 $wgUser->getId() == $reply->wfr_user ||
@@ -86,7 +86,7 @@
8787 $result = false;
8888 }
8989
90 - if( $result == false ) {
 90+ if ( $result == false ) {
9191 $this->errorTitle = wfMsg( 'wikiforum-error-delete' );
9292 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
9393 }
@@ -109,9 +109,9 @@
110110 array( 'wft_thread', 'wft_user', 'wft_forum' ),
111111 array( 'wft_deleted' => 0, 'wft_thread' => intval( $threadId ) ),
112112 __METHOD__
113 - ));
 113+ ) );
114114
115 - if(
 115+ if (
116116 $thread->wft_thread > 0 && $wgUser->getId() > 0 &&
117117 ( $wgUser->getId() == $thread->wft_user || $wgUser->isAllowed( 'wikiforum-moderator' ) ) &&
118118 !wfReadOnly()
@@ -170,7 +170,7 @@
171171 $result = false;
172172 }
173173
174 - if( $result == false ) {
 174+ if ( $result == false ) {
175175 $this->errorTitle = wfMsg( 'wikiforum-error-delete' );
176176 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
177177 }
@@ -186,7 +186,7 @@
187187 function deleteCategory( $categoryId ) {
188188 global $wgUser;
189189
190 - if(
 190+ if (
191191 $wgUser->isAllowed( 'wikiforum-admin' ) &&
192192 !wfReadOnly()
193193 )
@@ -207,7 +207,7 @@
208208 $result = false;
209209 }
210210
211 - if( $result == false ) {
 211+ if ( $result == false ) {
212212 $this->errorTitle = wfMsg( 'wikiforum-error-delete' );
213213 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
214214 }
@@ -223,7 +223,7 @@
224224 function deleteForum( $forumId ) {
225225 global $wgUser;
226226
227 - if(
 227+ if (
228228 $wgUser->isAllowed( 'wikiforum-admin' ) &&
229229 !wfReadOnly()
230230 )
@@ -244,7 +244,7 @@
245245 $result = false;
246246 }
247247
248 - if( $result == false ) {
 248+ if ( $result == false ) {
249249 $this->errorTitle = wfMsg( 'wikiforum-error-delete' );
250250 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
251251 }
@@ -273,7 +273,7 @@
274274 __METHOD__
275275 );
276276
277 - if(
 277+ if (
278278 $thread->wft_thread > 0 &&
279279 $wgUser->isAllowed( 'wikiforum-moderator' ) &&
280280 !wfReadOnly()
@@ -293,7 +293,7 @@
294294 $result = false;
295295 }
296296
297 - if( $result == false ) {
 297+ if ( $result == false ) {
298298 $this->errorTitle = wfMsg( 'wikiforum-error-thread-reopen' );
299299 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
300300 }
@@ -322,7 +322,7 @@
323323 __METHOD__
324324 );
325325
326 - if(
 326+ if (
327327 $thread->wft_thread > 0 &&
328328 $wgUser->isAllowed( 'wikiforum-moderator' ) &&
329329 !wfReadOnly()
@@ -342,7 +342,7 @@
343343 $result = false;
344344 }
345345
346 - if( $result == false ) {
 346+ if ( $result == false ) {
347347 $this->errorTitle = wfMsg( 'wikiforum-error-thread-close' );
348348 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
349349 }
@@ -366,15 +366,15 @@
367367 'wft_thread',
368368 array( 'wft_deleted' => 0, 'wft_thread' => $threadId ),
369369 __METHOD__
370 - ));
 370+ ) );
371371
372 - if(
 372+ if (
373373 $thread->wft_thread > 0 &&
374374 $wgUser->isAllowed( 'wikiforum-admin' ) &&
375375 !wfReadOnly()
376376 )
377377 {
378 - if( $value == false ) {
 378+ if ( $value == false ) {
379379 $value = 0;
380380 }
381381 $dbw = wfGetDB( DB_MASTER );
@@ -388,7 +388,7 @@
389389 $result = false;
390390 }
391391
392 - if( $result == false ) {
 392+ if ( $result == false ) {
393393 $this->errorTitle = wfMsg( 'wikiforum-error-sticky' );
394394 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
395395 }
@@ -413,8 +413,8 @@
414414 __METHOD__
415415 );
416416
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 ) {
419419 $dbw = wfGetDB( DB_MASTER );
420420 $result = $dbw->update(
421421 'wikiforum_threads',
@@ -429,7 +429,7 @@
430430 $result = false;
431431 }
432432
433 - if( $result == false ) {
 433+ if ( $result == false ) {
434434 $this->errorTitle = wfMsg( 'wikiforum-error-move-thread' );
435435 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
436436 }
@@ -439,7 +439,7 @@
440440 function editThread( $threadId, $title, $text ) {
441441 global $wgUser;
442442
443 - if(
 443+ if (
444444 $text && $title && strlen( $text ) > 1 &&
445445 strlen( $title ) > 1
446446 )
@@ -451,15 +451,15 @@
452452 array( 'wft_thread', 'wft_thread_name', 'wft_text', 'wft_user' ),
453453 array( 'wft_deleted' => 0, 'wft_thread' => $threadId ),
454454 __METHOD__
455 - ));
 455+ ) );
456456
457 - if( $thread->wft_thread > 0 ) {
458 - if(
 457+ if ( $thread->wft_thread > 0 ) {
 458+ if (
459459 $thread->wft_thread_name != $title ||
460460 $thread->wft_text != $text
461461 )
462462 {
463 - if(
 463+ if (
464464 $wgUser->getId() > 0 &&
465465 (
466466 $wgUser->getId() == $thread->wft_user ||
@@ -492,14 +492,14 @@
493493 $result = false;
494494 }
495495
496 - if( $result == false ) {
 496+ if ( $result == false ) {
497497 $this->errorTitle = wfMsg( 'wikiforum-error-edit' );
498 - if( $this->errorMessage == '' ) {
 498+ if ( $this->errorMessage == '' ) {
499499 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
500500 }
501501 }
502502 } else {
503 - if(
 503+ if (
504504 !$text && !$title ||
505505 strlen( $text ) == 0 && strlen( $title ) == 0
506506 )
@@ -516,8 +516,8 @@
517517 function addThread( $forumId, $title, $text ) {
518518 global $wgUser, $wgWikiForumAllowAnonymous;
519519
520 - if( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) {
521 - if(
 520+ if ( $wgWikiForumAllowAnonymous || $wgUser->isLoggedIn() ) {
 521+ if (
522522 $forumId > 0 && strlen( $text ) > 1 &&
523523 // @todo FIXME/CHECKME: use wfMsgForContent()?
524524 strlen( $title ) > 1 && $title != wfMsg( 'wikiforum-thread-title' )
@@ -535,12 +535,12 @@
536536 'wff_forum' => intval( $forumId )
537537 ),
538538 __METHOD__
539 - ));
 539+ ) );
540540
541 - if( $overview->wff_forum > 0 && !wfReadOnly() ) {
 541+ if ( $overview->wff_forum > 0 && !wfReadOnly() ) {
542542 $dbw = wfGetDB( DB_MASTER );
543543 $timestamp = wfTimestampNow();
544 - if( $overview->wff_announcement == false || $wgUser->isAllowed( 'wikiforum-moderator' ) ) {
 544+ if ( $overview->wff_announcement == false || $wgUser->isAllowed( 'wikiforum-moderator' ) ) {
545545 $doublepost = $dbr->selectRow(
546546 'wikiforum_threads',
547547 'wft_thread AS id',
@@ -555,7 +555,7 @@
556556 __METHOD__
557557 );
558558
559 - if( $doublepost === false ) {
 559+ if ( $doublepost === false ) {
560560 $result = $dbw->insert(
561561 'wikiforum_threads',
562562 array(
@@ -568,7 +568,7 @@
569569 ),
570570 __METHOD__
571571 );
572 - if( $result == true ) {
 572+ if ( $result == true ) {
573573 $dbw->update(
574574 'wikiforum_forums',
575575 array(
@@ -603,9 +603,9 @@
604604 $this->result = false;
605605 }
606606
607 - if( $this->result == false ) {
 607+ if ( $this->result == false ) {
608608 $this->errorTitle = wfMsg( 'wikiforum-error-add' );
609 - if( $this->errorMessage == '' ) {
 609+ if ( $this->errorMessage == '' ) {
610610 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
611611 }
612612 }
@@ -622,7 +622,7 @@
623623 function editReply( $replyId, $text ) {
624624 global $wgUser, $wgRequest;
625625
626 - if( $text && strlen( $text ) > 1 ) {
 626+ if ( $text && strlen( $text ) > 1 ) {
627627 $dbr = wfGetDB( DB_SLAVE );
628628
629629 $reply = $dbr->fetchObject( $dbr->select(
@@ -630,17 +630,17 @@
631631 array( 'wfr_thread', 'wfr_reply_id', 'wfr_reply_text', 'wfr_user' ),
632632 array( 'wfr_reply_id' => intval( $replyId ) ),
633633 __METHOD__
634 - ));
 634+ ) );
635635 $thread = $dbr->fetchObject( $dbr->select(
636636 'wikiforum_threads',
637637 array( 'wft_thread', 'wft_closed' ),
638638 array( 'wft_deleted' => 0, 'wft_thread' => $reply->wfr_thread ),
639639 __METHOD__
640 - ));
 640+ ) );
641641
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 (
645645 $wgUser->getId() > 0 &&
646646 ( ( $wgUser->getId() == $reply->wfr_user &&
647647 $thread->wft_closed == 0 ) ||
@@ -672,7 +672,7 @@
673673 }
674674 } else {
675675 $form = $wgRequest->getBool( 'form' );
676 - if( isset( $form ) && $form == true ) {
 676+ if ( isset( $form ) && $form == true ) {
677677 $this->errorMessage = wfMsg( 'wikiforum-error-no-reply' );
678678 $result = false;
679679 } else {
@@ -680,9 +680,9 @@
681681 }
682682 }
683683
684 - if( $result == false ) {
 684+ if ( $result == false ) {
685685 $this->errorTitle = wfMsg( 'wikiforum-error-edit' );
686 - if( $this->errorMessage == '' ) {
 686+ if ( $this->errorMessage == '' ) {
687687 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
688688 }
689689 }
@@ -700,9 +700,9 @@
701701
702702 $timestamp = wfTimestampNow();
703703
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 ) {
707707 $dbr = wfGetDB( DB_SLAVE );
708708
709709 $thread = $dbr->selectRow(
@@ -716,7 +716,7 @@
717717 __METHOD__
718718 );
719719
720 - if( $thread->wft_thread > 0 && !wfReadOnly() ) {
 720+ if ( $thread->wft_thread > 0 && !wfReadOnly() ) {
721721 $dbw = wfGetDB( DB_MASTER );
722722 $doublepost = $dbr->selectRow(
723723 'wikiforum_replies',
@@ -731,7 +731,7 @@
732732 __METHOD__
733733 );
734734
735 - if( $doublepost === false ) {
 735+ if ( $doublepost === false ) {
736736 $result = $dbw->insert(
737737 'wikiforum_replies',
738738 array(
@@ -743,7 +743,7 @@
744744 __METHOD__
745745 );
746746
747 - if( $result == true ) {
 747+ if ( $result == true ) {
748748 $dbw->update(
749749 'wikiforum_threads',
750750 array(
@@ -793,9 +793,9 @@
794794 $this->result = false;
795795 }
796796
797 - if( $this->result == false ) {
 797+ if ( $this->result == false ) {
798798 $this->errorTitle = wfMsg( 'wikiforum-error-add' );
799 - if( $this->errorMessage == '' ) {
 799+ if ( $this->errorMessage == '' ) {
800800 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
801801 }
802802 }
@@ -805,12 +805,12 @@
806806 function addCategory( $categoryName ) {
807807 global $wgUser;
808808
809 - if(
 809+ if (
810810 $wgUser->isAllowed( 'wikiforum-admin' ) &&
811811 !wfReadOnly()
812812 )
813813 {
814 - if( strlen( $categoryName ) > 0 ) {
 814+ if ( strlen( $categoryName ) > 0 ) {
815815 $dbr = wfGetDB( DB_SLAVE );
816816 $sortkey = $dbr->selectRow(
817817 'wikiforum_category',
@@ -839,9 +839,9 @@
840840 $this->result = false;
841841 }
842842
843 - if( $this->result == false ) {
 843+ if ( $this->result == false ) {
844844 $this->errorTitle = wfMsg( 'wikiforum-error-add' );
845 - if( $this->errorMessage == '' ) {
 845+ if ( $this->errorMessage == '' ) {
846846 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
847847 }
848848 }
@@ -851,8 +851,8 @@
852852 function editCategory( $id, $categoryName ) {
853853 global $wgUser;
854854
855 - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
856 - if( strlen( $categoryName ) > 0 ) {
 855+ if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
 856+ if ( strlen( $categoryName ) > 0 ) {
857857 $dbr = wfGetDB( DB_SLAVE );
858858
859859 $category = $dbr->fetchObject( $dbr->select(
@@ -860,9 +860,9 @@
861861 array( 'wfc_category', 'wfc_category_name' ),
862862 array( 'wfc_deleted' => 0, 'wfc_category' => intval( $id ) ),
863863 __METHOD__
864 - ));
 864+ ) );
865865
866 - if(
 866+ if (
867867 $category->wfc_category > 0 &&
868868 $category->wfc_category_name != $categoryName &&
869869 !wfReadOnly()
@@ -889,9 +889,9 @@
890890 $this->result = false;
891891 }
892892
893 - if( $this->result == false ) {
 893+ if ( $this->result == false ) {
894894 $this->errorTitle = wfMsg( 'wikiforum-error-edit' );
895 - if( $this->errorMessage == '' ) {
 895+ if ( $this->errorMessage == '' ) {
896896 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
897897 }
898898 }
@@ -901,8 +901,8 @@
902902 function addForum( $categoryId, $forumName, $description, $announcement ) {
903903 global $wgUser;
904904
905 - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
906 - if( strlen( $forumName ) > 0 ) {
 905+ if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
 906+ if ( strlen( $forumName ) > 0 ) {
907907 $dbr = wfGetDB( DB_SLAVE );
908908
909909 $sortkey = $dbr->selectRow(
@@ -925,7 +925,7 @@
926926 __METHOD__
927927 );
928928
929 - if( $category->wfc_category > 0 && !wfReadOnly() ) {
 929+ if ( $category->wfc_category > 0 && !wfReadOnly() ) {
930930 $dbw = wfGetDB( DB_MASTER );
931931 $this->result = $dbw->insert(
932932 'wikiforum_forums',
@@ -953,9 +953,9 @@
954954 $this->result = false;
955955 }
956956
957 - if( $this->result == false ) {
 957+ if ( $this->result == false ) {
958958 $this->errorTitle = wfMsg( 'wikiforum-error-add' );
959 - if( $this->errorMessage == '' ) {
 959+ if ( $this->errorMessage == '' ) {
960960 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
961961 }
962962 }
@@ -974,8 +974,8 @@
975975 function editForum( $id, $forumName, $description, $announcement ) {
976976 global $wgUser;
977977
978 - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
979 - if( strlen( $forumName ) > 0 ) {
 978+ if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
 979+ if ( strlen( $forumName ) > 0 ) {
980980 $dbr = wfGetDB( DB_SLAVE );
981981 $forum = $dbr->fetchObject( $dbr->select(
982982 'wikiforum_forums',
@@ -985,9 +985,9 @@
986986 ),
987987 array( 'wff_deleted' => 0, 'wff_forum' => intval( $id ) ),
988988 __METHOD__
989 - ));
 989+ ) );
990990
991 - if(
 991+ if (
992992 $forum->wff_forum > 0 &&
993993 (
994994 $forum->wff_forum_name != $forumName ||
@@ -1019,9 +1019,9 @@
10201020 $this->result = false;
10211021 }
10221022
1023 - if( $this->result == false ) {
 1023+ if ( $this->result == false ) {
10241024 $this->errorTitle = wfMsg( 'wikiforum-error-add' );
1025 - if( $this->errorMessage == '' ) {
 1025+ if ( $this->errorMessage == '' ) {
10261026 $this->errorMessage = wfMsg( 'wikiforum-error-general' );
10271027 }
10281028 }
@@ -1031,10 +1031,10 @@
10321032 function sortKeys( $id, $type, $direction_up ) {
10331033 global $wgUser;
10341034
1035 - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
 1035+ if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
10361036 $dbr = wfGetDB( DB_SLAVE );
10371037
1038 - if( $type == 'category' ) {
 1038+ if ( $type == 'category' ) {
10391039 // in the past, both tables had a SortKey column
10401040 // nowadays the columns are prefixed with an abbreviation
10411041 // of the table name, which is the standard MW convention
@@ -1083,12 +1083,12 @@
10841084 array_push( $new_array, $entry );
10851085 $i++;
10861086 }
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 ) {
10901090 $new_array[$i]->$name--;
10911091 $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 ) ) {
10931093 $new_array[$i]->$name++;
10941094 $new_array[$i + 1]->$name--;
10951095 }
@@ -1146,7 +1146,7 @@
11471147 $sqlForums = $dbr->select(
11481148 array( 'wikiforum_forums', 'user' ),
11491149 array( '*', 'user_name' ),
1150 - array( 'wff_deleted' => 0,' wff_category' => $cat->wfc_category ),
 1150+ array( 'wff_deleted' => 0, ' wff_category' => $cat->wfc_category ),
11511151 __METHOD__,
11521152 array( 'ORDER BY' => 'wff_sortkey ASC, wff_forum ASC' ),
11531153 array( 'user' => array( 'LEFT JOIN', 'user_id = wff_last_post_user' ) )
@@ -1155,7 +1155,7 @@
11561156 $menuLink = '';
11571157 $categoryLink = '';
11581158
1159 - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
 1159+ if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
11601160 $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/folder_add.png" title="' . wfMsg( 'wikiforum-add-forum' ) . '" /> ';
11611161 $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'addforum' => $cat->wfc_category ) ) . '">' .
11621162 wfMsg( 'wikiforum-add-forum' ) . '</a>';
@@ -1181,7 +1181,7 @@
11821182 wfMsg( 'wikiforum-forum-name', $forum->wff_forum_name ) . '" /> ';
11831183
11841184 $last_post = '';
1185 - if( $forum->wff_last_post_timestamp > 0 ) {
 1185+ if ( $forum->wff_last_post_timestamp > 0 ) {
11861186 $last_post = wfMsg(
11871187 'wikiforum-by',
11881188 $wgLang->timeanddate( $forum->wff_last_post_timestamp ),
@@ -1205,7 +1205,7 @@
12061206 }
12071207
12081208 // Forum admins are allowed to add new categories
1209 - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
 1209+ if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
12101210 $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/database_add.png" title="' . wfMsg( 'wikiforum-add-category' ) . '" /> ';
12111211 $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'addcategory' => true ) ) . '">' .
12121212 wfMsg( 'wikiforum-add-category' ) . '</a>';
@@ -1229,7 +1229,7 @@
12301230 );
12311231 $data_overview = $dbr->fetchObject( $sqlData );
12321232
1233 - if( $data_overview ) {
 1233+ if ( $data_overview ) {
12341234 $sqlForums = $dbr->select(
12351235 array( 'wikiforum_forums', 'user' ),
12361236 array( '*', 'user_name' ),
@@ -1247,7 +1247,7 @@
12481248 $specialPage = SpecialPage::getTitleFor( 'WikiForum' );
12491249
12501250 // Forum admins are allowed to add new forums
1251 - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
 1251+ if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
12521252 $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/folder_add.png" title="' . wfMsg( 'wikiforum-add-forum' ) . '" /> ';
12531253 $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'addforum' => $data_overview->wfc_category ) ) . '">' .
12541254 wfMsg( 'wikiforum-add-forum' ) . '</a>';
@@ -1272,7 +1272,7 @@
12731273 $categoryLink
12741274 );
12751275
1276 - foreach( $sqlForums as $forum ) {
 1276+ foreach ( $sqlForums as $forum ) {
12771277 $forum_link = $this->showAdminIcons(
12781278 'forum', $forum->wff_forum, true, true
12791279 );
@@ -1284,7 +1284,7 @@
12851285 // If there are replies, indicate that somehow...
12861286 // This message will be shown only when there is one reply or
12871287 // more
1288 - if( $forum->wff_last_post_timestamp > 0 ) {
 1288+ if ( $forum->wff_last_post_timestamp > 0 ) {
12891289 $last_post = wfMsg(
12901290 'wikiforum-by',
12911291 $wgLang->timeanddate( $forum->wff_last_post_timestamp ),
@@ -1315,7 +1315,7 @@
13161316 }
13171317 // Jack: unnecessary duplication of the "Overview" link on the bottom
13181318 // of the page, thus removed
1319 - //$output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' );
 1319+ // $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' );
13201320 $output .= $this->showFailure();
13211321 return $output;
13221322 }
@@ -1329,17 +1329,17 @@
13301330 $f_movethread = $wgRequest->getInt( 'movethread' );
13311331
13321332 // sorting
1333 - if( $wgRequest->getVal( 'sd' ) == 'up' ) {
 1333+ if ( $wgRequest->getVal( 'sd' ) == 'up' ) {
13341334 $sort_direction = 'ASC';
13351335 } else {
13361336 $sort_direction = 'DESC';
13371337 }
13381338
1339 - if( $wgRequest->getVal( 'st' ) == 'answers' ) {
 1339+ if ( $wgRequest->getVal( 'st' ) == 'answers' ) {
13401340 $sort_type = 'wft_reply_count';
1341 - } elseif( $wgRequest->getVal( 'st' ) == 'calls' ) {
 1341+ } elseif ( $wgRequest->getVal( 'st' ) == 'calls' ) {
13421342 $sort_type = 'wft_view_count';
1343 - } elseif( $wgRequest->getVal( 'st' ) == 'thread' ) {
 1343+ } elseif ( $wgRequest->getVal( 'st' ) == 'thread' ) {
13441344 $sort_type = 'wft_thread_name';
13451345 } else {
13461346 $sort_type = 'wft_last_post_timestamp';
@@ -1349,13 +1349,13 @@
13501350 $maxThreadsPerPage = intval( wfMsgForContent( 'wikiforum-max-threads-per-page' ) );
13511351
13521352 // limiting
1353 - if( $maxThreadsPerPage && $wgRequest->getVal( 'lc' ) > 0 ) {
 1353+ if ( $maxThreadsPerPage && $wgRequest->getVal( 'lc' ) > 0 ) {
13541354 $limit_count = $wgRequest->getVal( 'lc' );
1355 - } elseif( $maxThreadsPerPage > 0 ) {
 1355+ } elseif ( $maxThreadsPerPage > 0 ) {
13561356 $limit_count = $maxThreadsPerPage;
13571357 }
13581358
1359 - if( is_numeric( $wgRequest->getVal( 'lp' ) ) ) {
 1359+ if ( is_numeric( $wgRequest->getVal( 'lp' ) ) ) {
13601360 $limit_page = $wgRequest->getVal( 'lp' ) - 1;
13611361 } else {
13621362 $limit_page = 0;
@@ -1380,9 +1380,9 @@
13811381
13821382 $specialPage = SpecialPage::getTitleFor( 'WikiForum' );
13831383
1384 - if( $data_overview ) {
 1384+ if ( $data_overview ) {
13851385 $options['ORDER BY'] = 'wft_sticky DESC, ' . $sort_type . ' ' . $sort_direction;
1386 - if( $limit_count > 0 ) {
 1386+ if ( $limit_count > 0 ) {
13871387 $options['LIMIT'] = $limit_count;
13881388 $options['OFFSET'] = $limit_page * $limit_count;
13891389 }
@@ -1400,7 +1400,7 @@
14011401 $button['down'] = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/bullet_arrow_down.png" alt="" />';
14021402
14031403 // 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' ) ) {
14051405 $write_thread = '';
14061406 } else {
14071407 $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/note_add.png" title="' . wfMsg( 'wikiforum-write-thread' ) . '" /> ';
@@ -1446,7 +1446,7 @@
14471447 );
14481448
14491449 $last_post = '';
1450 - if( $thread->wft_reply_count > 0 ) {
 1450+ if ( $thread->wft_reply_count > 0 ) {
14511451 $last_post = wfMsg(
14521452 'wikiforum-by',
14531453 $wgLang->timeanddate( $thread->wft_last_post_timestamp ),
@@ -1454,7 +1454,7 @@
14551455 );
14561456 }
14571457
1458 - if( $thread->wft_sticky == true ) {
 1458+ if ( $thread->wft_sticky == true ) {
14591459 $sticky = 'sticky';
14601460 } else {
14611461 $sticky = false;
@@ -1478,14 +1478,14 @@
14791479 );
14801480
14811481 }
1482 - if( $threads_exist == false ) {
 1482+ if ( $threads_exist == false ) {
14831483 $output .= WikiForumGui::getSingleLine( wfMsg( 'wikiforum-no-threads' ), 4 );
14841484 }
14851485 $output .= WikiForumGui::getMainFooter();
14861486
14871487 $countReplies = '';
14881488
1489 - if( $limit_count > 0 ) {
 1489+ if ( $limit_count > 0 ) {
14901490 $countReplies = $dbr->selectRow(
14911491 'wikiforum_threads',
14921492 array( 'COUNT(*) AS count' ),
@@ -1512,9 +1512,9 @@
15131513 }
15141514
15151515 $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> ';
15191519 $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', $pastethread_link );
15201520 }
15211521
@@ -1555,13 +1555,13 @@
15561556 $maxRepliesPerPage = intval( wfMsgForContent( 'wikiforum-max-replies-per-page' ) );
15571557
15581558 // limiting
1559 - if( $maxRepliesPerPage && $wgRequest->getVal( 'lc' ) > 0 ) {
 1559+ if ( $maxRepliesPerPage && $wgRequest->getVal( 'lc' ) > 0 ) {
15601560 $limit_count = $wgRequest->getVal( 'lc' );
1561 - } elseif( $maxRepliesPerPage > 0 ) {
 1561+ } elseif ( $maxRepliesPerPage > 0 ) {
15621562 $limit_count = $maxRepliesPerPage;
15631563 }
15641564
1565 - if( is_numeric( $wgRequest->getVal( 'lp' ) ) ) {
 1565+ if ( is_numeric( $wgRequest->getVal( 'lp' ) ) ) {
15661566 $limit_page = $wgRequest->getVal( 'lp' ) - 1;
15671567 } else {
15681568 $limit_page = 0;
@@ -1570,7 +1570,7 @@
15711571
15721572 $specialPage = SpecialPage::getTitleFor( 'WikiForum' );
15731573
1574 - if( $data_overview ) {
 1574+ if ( $data_overview ) {
15751575 $queryOptions['ORDER BY'] = 'wfr_posted_timestamp ASC';
15761576 if ( $limit_count > 0 ) {
15771577 $queryOptions['LIMIT'] = $limit_count;
@@ -1607,8 +1607,8 @@
16081608
16091609 $menuLink = '';
16101610
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 ) {
16131613 $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/tag_blue_delete.png" title="' . wfMsg( 'wikiforum-remove-sticky' ) . '" /> ';
16141614 $menuLink = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'removesticky' => $data_overview->wft_thread ) ) . '">' .
16151615 wfMsg( 'wikiforum-remove-sticky' ) . '</a> ';
@@ -1621,7 +1621,7 @@
16221622
16231623 $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/comment_add.png" title="' . wfMsg( 'wikiforum-write-reply' ) . '" /> ';
16241624 // Replying is only possible to open threads
1625 - if( $data_overview->wft_closed == 0 ) {
 1625+ if ( $data_overview->wft_closed == 0 ) {
16261626 $menuLink .= $icon . '<a href="#writereply">' .
16271627 wfMsg( 'wikiforum-write-reply' ) . '</a>';
16281628 }
@@ -1631,7 +1631,7 @@
16321632 $wgLang->timeanddate( $data_overview->wft_posted_timestamp ),
16331633 WikiForumClass::getUserLink( $data_overview->user_name )
16341634 );
1635 - if( $data_overview->wft_edit_timestamp > 0 ) {
 1635+ if ( $data_overview->wft_edit_timestamp > 0 ) {
16361636 $posted .= '<br /><i>' .
16371637 wfMsg(
16381638 'wikiforum-edited',
@@ -1655,7 +1655,7 @@
16561656
16571657 $output .= WikiForumGui::getThreadHeader(
16581658 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 ),
16601660 $posted,
16611661 $editButtons,
16621662 $data_overview->wft_thread,
@@ -1675,7 +1675,7 @@
16761676 $wgLang->timeanddate( $reply->wfr_posted_timestamp ),
16771677 WikiForumClass::getUserLink( $reply->user_name )
16781678 );
1679 - if( $reply->wfr_edit_timestamp > 0 ) {
 1679+ if ( $reply->wfr_edit_timestamp > 0 ) {
16801680 $posted .= '<br /><i>' .
16811681 wfMsg(
16821682 'wikiforum-edited',
@@ -1685,7 +1685,7 @@
16861686 }
16871687
16881688 $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 ),
16901690 $posted,
16911691 $editButtons,
16921692 $reply->wfr_reply_id,
@@ -1695,7 +1695,7 @@
16961696
16971697 $output .= WikiForumGui::getThreadFooter();
16981698
1699 - if( $limit_count > 0 ) {
 1699+ if ( $limit_count > 0 ) {
17001700 $countReplies = $dbr->selectRow(
17011701 'wikiforum_replies',
17021702 'COUNT(*) AS count',
@@ -1716,7 +1716,7 @@
17171717
17181718 $mod_editcomment = $wgRequest->getInt( 'editcomment' );
17191719 $mod_form = $wgRequest->getBool( 'form' );
1720 - if(
 1720+ if (
17211721 $data_overview->wft_closed == 0 ||
17221722 ( isset( $mod_editcomment ) && $mod_editcomment > 0 &&
17231723 $mod_form != true &&
@@ -1728,7 +1728,7 @@
17291729 } else {
17301730 $this->errorTitle = wfMsg( 'wikiforum-thread-closed' );
17311731 $this->errorMessage = wfMsg( 'wikiforum-error-thread-closed' );
1732 - $this->errorIcon = 'lock.png';//'icon_thread_closed';
 1732+ $this->errorIcon = 'lock.png';// 'icon_thread_closed';
17331733 }
17341734 } else {
17351735 $this->errorTitle = wfMsg( 'wikiforum-thread-not-found' );
@@ -1740,7 +1740,7 @@
17411741 }
17421742
17431743 $movethread_link = '';
1744 - if( $wgUser->isAllowed( 'wikiforum-moderator' ) ) {
 1744+ if ( $wgUser->isAllowed( 'wikiforum-moderator' ) ) {
17451745 $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/note_go.png" title="' . wfMsg( 'wikiforum-move-thread' ) . '" /> ';
17461746 $movethread_link = $icon . '<a href="' . $specialPage->escapeFullURL( array( 'movethread' => $data_overview->wft_thread ) ) . '">' . wfMsg( 'wikiforum-move-thread' ) . '</a> ';
17471747 $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', $movethread_link );
@@ -1765,7 +1765,7 @@
17661766 $output .= WikiForumGui::getSearchbox();
17671767 $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' );
17681768
1769 - if( strlen( $what ) > 1 ) {
 1769+ if ( strlen( $what ) > 1 ) {
17701770 $i = 0;
17711771
17721772 $dbr = wfGetDB( DB_SLAVE );
@@ -1792,9 +1792,9 @@
17931793 $specialPage = SpecialPage::getTitleFor( 'WikiForum' );
17941794 $output_temp = '';
17951795
1796 - foreach( $sqlData as $result ) {
 1796+ foreach ( $sqlData as $result ) {
17971797 $anchor = '';
1798 - if( $result->wfr_reply_id > 0 ) {
 1798+ if ( $result->wfr_reply_id > 0 ) {
17991799 $anchor = '#reply_' . $result->wfr_reply_id;
18001800 }
18011801
@@ -1842,7 +1842,7 @@
18431843 $output = $this->showFailure();
18441844
18451845 $title = wfMsg( 'wikiforum-preview' );
1846 - if( $previewTitle ) {
 1846+ if ( $previewTitle ) {
18471847 $title = wfMsg( 'wikiforum-preview-with-title', $previewTitle );
18481848 }
18491849 $posted = wfMsg(
@@ -1850,7 +1850,7 @@
18511851 $wgLang->timeanddate( wfTimestampNow() ),
18521852 $this->getUserLinkById( $wgUser->getId() )
18531853 );
1854 - if( $type == 'addcomment' || $type == 'editcomment' ) {
 1854+ if ( $type == 'addcomment' || $type == 'editcomment' ) {
18551855 $output .= WikiForumGui::getReplyHeader( $title );
18561856 $output .= WikiForumGui::getReply(
18571857 $this->parseIt( $previewText ),
@@ -1878,7 +1878,7 @@
18791879 // Jack this adds an useless "Overview" link to the bottom of the page
18801880 // (below the save reply/cancel buttons) so I took the liberty of
18811881 // removing it
1882 - #$output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' );
 1882+ # $output .= WikiForumGui::getHeaderRow( 0, '', 0, '', '' );
18831883 $output .= $this->showFailure();
18841884 return $output;
18851885 }
@@ -1890,7 +1890,7 @@
18911891 $dbr = wfGetDB( DB_SLAVE );
18921892
18931893 $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?
18951895 $sqlData = $dbr->select(
18961896 array(
18971897 'wikiforum_forums', 'wikiforum_category',
@@ -1930,7 +1930,7 @@
19311931
19321932 // Everyone (privileged) can post to non-announcement forums and mods
19331933 // can post even to announcement-only forums
1934 - if(
 1934+ if (
19351935 $overview->wff_announcement == false ||
19361936 $wgUser->isAllowed( 'wikiforum-moderator' )
19371937 )
@@ -1956,7 +1956,7 @@
19571957 $dbr = wfGetDB( DB_SLAVE );
19581958 $save_button = wfMsg( 'wikiforum-save' );
19591959
1960 - if( isset( $values['text'] ) && strlen( $values['text'] ) > 0 ) {
 1960+ if ( isset( $values['text'] ) && strlen( $values['text'] ) > 0 ) {
19611961 $text_prev = $values['text'];
19621962 }
19631963
@@ -1964,21 +1964,21 @@
19651965 // is checked in WikiForumGui::getFormCatForum()
19661966 $overview = '';
19671967
1968 - if( $type == 'addcategory' ) {
 1968+ if ( $type == 'addcategory' ) {
19691969 $categoryName = wfMsg( 'wikiforum-add-category' );
1970 - } elseif( $type == 'editcategory' ) {
 1970+ } elseif ( $type == 'editcategory' ) {
19711971 $overview = $dbr->fetchObject( $dbr->select(
19721972 'wikiforum_category',
19731973 array( 'wfc_category', 'wfc_category_name' ),
19741974 array( 'wfc_deleted' => 0, 'wfc_category' => intval( $id ) ),
19751975 __METHOD__
1976 - ));
 1976+ ) );
19771977 $id = $overview->wfc_category;
19781978 $title_prev = $overview->wfc_category_name;
19791979 $categoryName = wfMsg( 'wikiforum-edit-category' );
1980 - } elseif( $type == 'addforum' ) {
 1980+ } elseif ( $type == 'addforum' ) {
19811981 $categoryName = wfMsg( 'wikiforum-add-forum' );
1982 - } elseif( $type == 'editforum' ) {
 1982+ } elseif ( $type == 'editforum' ) {
19831983 $overview = $dbr->fetchObject( $dbr->select(
19841984 'wikiforum_forums',
19851985 array(
@@ -1987,10 +1987,10 @@
19881988 ),
19891989 array( 'wff_deleted' => 0, 'wff_forum' => intval( $id ) ),
19901990 __METHOD__
1991 - ));
 1991+ ) );
19921992 $id = $overview->wff_forum;
19931993 $title_prev = $overview->wff_forum_name;
1994 - if( strlen( $text_prev ) == 0 ) {
 1994+ if ( strlen( $text_prev ) == 0 ) {
19951995 $text_prev = $overview->wff_description;
19961996 }
19971997 $categoryName = wfMsg( 'wikiforum-edit-forum' );
@@ -2012,18 +2012,18 @@
20132013
20142014 $dbr = wfGetDB( DB_SLAVE );
20152015
2016 - if( $this->result == false ) {
 2016+ if ( $this->result == false ) {
20172017 $text_prev = $wgRequest->getVal( 'frmText' );
20182018 $title_prev = $wgRequest->getVal( 'frmTitle' );
20192019 } else {
20202020 $title_prev = wfMsg( 'wikiforum-thread-title' );
20212021 }
20222022
2023 - if( $type == 'addthread' || $type == 'editthread' ) {
 2023+ if ( $type == 'addthread' || $type == 'editthread' ) {
20242024 $mod_editthread = $wgRequest->getInt( 'editthread' );
20252025 $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 ) {
20282028 $data_thread = $dbr->fetchObject( $dbr->select(
20292029 'wikiforum_threads',
20302030 array( 'wft_thread', 'wft_thread_name', 'wft_text' ),
@@ -2032,14 +2032,14 @@
20332033 'wft_thread' => intval( $mod_editthread )
20342034 ),
20352035 __METHOD__
2036 - ));
 2036+ ) );
20372037 $action = array(
20382038 'editthread' => $data_thread->wft_thread
20392039 );
2040 - if( !$text_prev ) {
 2040+ if ( !$text_prev ) {
20412041 $text_prev = $data_thread->wft_text;
20422042 }
2043 - if( $title_prev == wfMsg( 'wikiforum-thread-title' ) ) {
 2043+ if ( $title_prev == wfMsg( 'wikiforum-thread-title' ) ) {
20442044 $title_prev = $data_thread->wft_thread_name;
20452045 }
20462046 }
@@ -2057,7 +2057,7 @@
20582058 $mod_quotet = $wgRequest->getInt( 'quotethread' );
20592059
20602060 // quote
2061 - if( isset( $mod_quotec ) && $mod_quotec > 0 ) {
 2061+ if ( isset( $mod_quotec ) && $mod_quotec > 0 ) {
20622062 $reply = $dbr->fetchObject( $dbr->select(
20632063 array( 'wikiforum_replies', 'user' ),
20642064 array( 'wfr_reply_text', 'wfr_posted_timestamp', 'user_name' ),
@@ -2065,8 +2065,8 @@
20662066 __METHOD__,
20672067 array(),
20682068 array( 'user' => array( 'LEFT JOIN', 'user_id = wfr_user' ) )
2069 - ));
2070 - if( $reply ) {
 2069+ ) );
 2070+ if ( $reply ) {
20712071 $posted = wfMsg(
20722072 'wikiforum-posted',
20732073 $wgLang->timeanddate( $reply->wfr_posted_timestamp ),
@@ -2081,7 +2081,7 @@
20822082 $text_prev = '[quote=' . $posted . ']' .
20832083 $reply->wfr_reply_text . '[/quote]';
20842084 }
2085 - } elseif( isset( $mod_quotet ) && $mod_quotet > 0 ) {
 2085+ } elseif ( isset( $mod_quotet ) && $mod_quotet > 0 ) {
20862086 $thread = $dbr->selectRow(
20872087 array( 'wikiforum_threads', 'user' ),
20882088 array( 'wft_text', 'wft_posted_timestamp', 'user_name' ),
@@ -2090,7 +2090,7 @@
20912091 array(),
20922092 array( 'user' => array( 'LEFT JOIN', 'user_id = wft_user' ) )
20932093 );
2094 - if( $thread ) {
 2094+ if ( $thread ) {
20952095 $posted = wfMsg(
20962096 'wikiforum-posted',
20972097 $wgLang->timeanddate( $thread->wft_posted_timestamp ),
@@ -2103,12 +2103,12 @@
21042104 }
21052105 // end quote
21062106
2107 - if(
 2107+ if (
21082108 isset( $mod_comment ) && $mod_comment > 0 &&
21092109 ( $mod_form != true || $mod_preview == true )
21102110 )
21112111 {
2112 - if( $mod_preview == true ) {
 2112+ if ( $mod_preview == true ) {
21132113 $id = $wgRequest->getInt( 'thread' );
21142114 }
21152115 $dbr = wfGetDB( DB_SLAVE );
@@ -2117,13 +2117,13 @@
21182118 array( 'wfr_reply_id', 'wfr_reply_text' ),
21192119 array( 'wfr_deleted' => 0, 'wfr_reply_id' => $mod_comment ),
21202120 __METHOD__
2121 - ));
 2121+ ) );
21222122 $action = array(
21232123 'thread' => $id,
21242124 'form' => true,
21252125 'editcomment' => $reply->wfr_reply_id
21262126 );
2127 - if( $mod_preview != true ) {
 2127+ if ( $mod_preview != true ) {
21282128 $text_prev = $reply->wfr_reply_text;
21292129 }
21302130 } else {
@@ -2157,7 +2157,7 @@
21582158 ) ) . '#writereply">';
21592159 $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/comments_add.png" title="' . wfMsg( 'wikiforum-quote' ) . '" />';
21602160
2161 - if(
 2161+ if (
21622162 ( $wgUser->getId() == $postedBy && $closed == 0 ) ||
21632163 $wgUser->isAllowed( 'wikiforum-moderator' )
21642164 )
@@ -2194,7 +2194,7 @@
21952195 $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/comments_add.png" title="' . wfMsg( 'wikiforum-quote' ) . '" />';
21962196 $editButtons .= '</a>';
21972197
2198 - if(
 2198+ if (
21992199 $wgUser->getId() == $postedBy ||
22002200 $wgUser->isAllowed( 'wikiforum-moderator' )
22012201 )
@@ -2206,8 +2206,8 @@
22072207 $editButtons .= '</a> ';
22082208
22092209 // 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 ) {
22122212 $editButtons .= ' <a href="' . $specialPage->escapeFullURL( array( 'closethread' => $threadID ) ) . '">';
22132213 $editButtons .= '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/lock_add.png" title="' . wfMsg( 'wikiforum-close-thread' ) . '" />';
22142214 $editButtons .= '</a>';
@@ -2236,7 +2236,7 @@
22372237
22382238 $link = '';
22392239
2240 - if( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
 2240+ if ( $wgUser->isAllowed( 'wikiforum-admin' ) ) {
22412241 // Quick hack for fetching the correct icon
22422242 if ( $type == 'category' ) {
22432243 $iconName = 'database';
@@ -2254,12 +2254,12 @@
22552255 $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/' . $iconName . '_delete.png" title="' . wfMsg( 'wikiforum-delete-' . $type ) . '" />';
22562256 $link .= ' <a href="' . $specialPage->escapeFullURL( array( 'delete' . $type => $id ) ) . '">' . $icon . '</a>';
22572257
2258 - if( $sortup == true ) {
 2258+ if ( $sortup == true ) {
22592259 $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/arrow_up.png" title="' . wfMsg( 'wikiforum-sort-up' ) . '" />';
22602260 $link .= ' <a href="' . $specialPage->escapeFullURL( array( $type . 'up' => $id ) ) . '">' . $icon . '</a>';
22612261 }
22622262
2263 - if( $sortdown == true ) {
 2263+ if ( $sortdown == true ) {
22642264 $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/arrow_down.png" title="' . wfMsg( 'wikiforum-sort-down' ) . '" />';
22652265 $link .= ' <a href="' . $specialPage->escapeFullURL( array( $type . 'down' => $id ) ) . '">' . $icon . '</a>';
22662266 }
@@ -2289,11 +2289,11 @@
22902290 $olderTimestamp = wfTimestamp( TS_MW, strtotime( '-' . $dayDefinitionNew . ' days' ) );
22912291
22922292 $imagePath = $wgScriptPath . '/extensions/WikiForum/icons';
2293 - if( $sticky == 1 ) {
 2293+ if ( $sticky == 1 ) {
22942294 return '<img src="' . $imagePath . '/tag_blue.png" title="' . wfMsg( 'wikiforum-sticky' ) . '" /> ';
2295 - } elseif( $closed > 0 ) {
 2295+ } elseif ( $closed > 0 ) {
22962296 return '<img src="' . $imagePath . '/lock.png" title="' . wfMsg( 'wikiforum-thread-closed' ) . '" /> ';
2297 - } elseif( $posted > $olderTimestamp ) {
 2297+ } elseif ( $posted > $olderTimestamp ) {
22982298 return '<img src="' . $imagePath . '/new.png" title="' . wfMsg( 'wikiforum-new-thread' ) . '" /> ';
22992299 } else {
23002300 return '<img src="' . $imagePath . '/note.png" title="' . wfMsg( 'wikiforum-thread' ) . '" /> ';
@@ -2311,8 +2311,8 @@
23122312
23132313 $output = '';
23142314
2315 - if( strlen( $this->errorTitle ) > 0 ) {
2316 - if( strlen( $this->errorIcon ) > 0 ) {
 2315+ if ( strlen( $this->errorTitle ) > 0 ) {
 2316+ if ( strlen( $this->errorIcon ) > 0 ) {
23172317 $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/' . $this->errorIcon . '" /> ';
23182318 } else {
23192319 $icon = '<img src="' . $wgScriptPath . '/extensions/WikiForum/icons/exclamation.png" title="' . wfMsg( 'wikiforum-thread-closed' ) . '" /> ';
@@ -2339,7 +2339,7 @@
23402340 public static function getUserLink( $username ) {
23412341 global $wgContLang, $wgUser;
23422342
2343 - if( $username ) {
 2343+ if ( $username ) {
23442344 $sk = $wgUser->getSkin();
23452345 $retVal = $sk->makeLinkObj(
23462346 Title::newFromText( $wgContLang->getNsText( NS_USER ) . ':' . $username ),
@@ -2361,11 +2361,11 @@
23622362 // copied from extensions/Comments/CommentClass.php
23632363 // really bad hack because we want to parse=firstline, but
23642364 // don't want wrapping <p> tags
2365 - if( substr( $staffSig, 0 , 3 ) == '<p>' ) {
 2365+ if ( substr( $staffSig, 0 , 3 ) == '<p>' ) {
23662366 $staffSig = substr( $staffSig, 3 );
23672367 }
23682368
2369 - if( substr( $staffSig, strlen( $staffSig ) - 4, 4 ) == '</p>' ) {
 2369+ if ( substr( $staffSig, strlen( $staffSig ) - 4, 4 ) == '</p>' ) {
23702370 $staffSig = substr( $staffSig, 0, strlen( $staffSig ) - 4 );
23712371 }
23722372 // end copied bad hack
@@ -2400,7 +2400,7 @@
24012401 * UID = 0, HTML (link) for others
24022402 */
24032403 public static function getUserLinkById( $userId ) {
2404 - if( $userId == 0 ) {
 2404+ if ( $userId == 0 ) {
24052405 return wfMsg( 'wikiforum-anonymous' );
24062406 } else {
24072407 return self::getUserLink( User::whoIs( $userId ) );
@@ -2416,8 +2416,8 @@
24172417 function prepareSmilies( $text ) {
24182418 global $wgWikiForumSmilies;
24192419
2420 - if( is_array( $wgWikiForumSmilies ) ) {
2421 - foreach( $wgWikiForumSmilies as $key => $icon ) {
 2420+ if ( is_array( $wgWikiForumSmilies ) ) {
 2421+ foreach ( $wgWikiForumSmilies as $key => $icon ) {
24222422 $text = str_replace(
24232423 $key,
24242424 '<nowiki>' . $key . '</nowiki>',
@@ -2433,9 +2433,9 @@
24342434 global $wgWikiForumSmilies;
24352435
24362436 // 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 ) ) {
24382438 $path = $wgScriptPath . '/extensions/WikiForum';
2439 - foreach( $wgWikiForumSmilies as $key => $icon ) {
 2439+ foreach ( $wgWikiForumSmilies as $key => $icon ) {
24402440 $text = str_replace(
24412441 $key,
24422442 '<img src="' . $path . '/' . $icon . '" title="' . $key . '"/>',
@@ -2518,7 +2518,7 @@
25192519 * @return String: thread title
25202520 */
25212521 function getThreadTitle( $id ) {
2522 - if( is_numeric( $id[1] ) && $id[1] > 0 ) {
 2522+ if ( is_numeric( $id[1] ) && $id[1] > 0 ) {
25232523 $dbr = wfGetDB( DB_SLAVE );
25242524 $overview = $dbr->select(
25252525 'wikiforum_threads',
@@ -2531,7 +2531,7 @@
25322532 );
25332533
25342534 $specialPage = SpecialPage::getTitleFor( 'WikiForum' );
2535 - if( $overview ) {
 2535+ if ( $overview ) {
25362536 return '<i><a href="' . $specialPage->escapeFullURL( array( 'thread' => $id[1] ) ) . '">' .
25372537 $overview->wft_thread_name . '</a></i>';
25382538 } else {

Follow-up revisions

RevisionCommit summaryAuthorDate
r99134WikiForum: address fixme comment added in r96351 -- moved hooked methods into...ashley20:04, 6 October 2011

Status & tagging log