r47253 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47252‎ | r47253 | r47254 >
Date:09:21, 14 February 2009
Author:siebrand
Status:deferred
Tags:
Comment:
* fix some indentation
* remove some commented out code
* remove trailing whitespace
* run stylize.php for all php files
* eol-style:native where missing
Modified paths:
  • /trunk/extensions/LiquidThreads/LICENSE (modified) (history)
  • /trunk/extensions/LiquidThreads/LiquidThreads.php (modified) (history)
  • /trunk/extensions/LiquidThreads/Lqt.i18n.php (modified) (history)
  • /trunk/extensions/LiquidThreads/LqtBaseView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/LqtFunctions.php (modified) (history)
  • /trunk/extensions/LiquidThreads/README (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtDate.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtHistoricalThread.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtNewMessages.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtPost.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtQueryGroup.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtThread.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtThreadHistoryIterator.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/LqtThreads.php (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.css (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/IndividualThreadHistoryView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/SpecialDeleteThread.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/SpecialMoveThread.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/SpecialNewMessages.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/SummaryPageView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/TalkpageArchiveView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/TalkpageHeaderView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/TalkpageView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/ThreadDiffView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/ThreadHistoricalRevisionView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/ThreadHistoryListingView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/ThreadPermalinkView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/ThreadProtectionFormView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/ThreadWatchView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/Lqt.i18n.php
@@ -117,7 +117,7 @@
118118 'lqt-newer' => 'newer',
119119 'lqt-searching' => 'Searching for threads',
120120 'lqt-read-message' => 'Read',
121 - 'lqt-read-message-tooltip'=> 'Remove this thread from new messages.
 121+ 'lqt-read-message-tooltip' => 'Remove this thread from new messages.
122122 It will still be visible on its original talk page.',
123123 'lqt-read-all' => 'Mark all as read',
124124 'lqt-read-all-tooltip' => 'Remove all threads from new messages.
@@ -2910,7 +2910,7 @@
29112911 'lqt_new_thread' => 'Start ein ny diskusjon',
29122912 'lqt_in_response_to' => 'Som svar til $1 av $2, over:',
29132913 'lqt_edited_notice' => 'Endra',
2914 - 'lqt_move_placeholder' => 'Denne tråden finst berre for å syna at tråden $1 vart flytt frå denne sida til ei anna diskusjonssida.
 2914+ 'lqt_move_placeholder' => 'Denne tråden finst berre for å syna at tråden $1 vart flytt frå denne sida til ei anna diskusjonssida.
29152915 Flyttinga vart gjort av $2 $3.',
29162916 'lqt_reply' => 'Svar',
29172917 'lqt_delete' => 'Slett',
Index: trunk/extensions/LiquidThreads/LqtBaseView.php
@@ -7,9 +7,9 @@
88 * @licence GPL2
99 */
1010
11 -if( !defined( 'MEDIAWIKI' ) ) {
 11+if ( !defined( 'MEDIAWIKI' ) ) {
1212 echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
13 - die( -1 );
 13+ die( - 1 );
1414 }
1515
1616 class LqtDispatch {
@@ -27,29 +27,29 @@
2828 'SummaryPageView' => 'SummaryPageView'
2929 );
3030
31 - static function talkpageMain(&$output, &$talk_article, &$title, &$user, &$request) {
 31+ static function talkpageMain( &$output, &$talk_article, &$title, &$user, &$request ) {
3232 // We are given a talkpage article and title. Find the associated
3333 // non-talk article and pass that to the view.
34 - $article = new Article($title->getSubjectPage());
 34+ $article = new Article( $title->getSubjectPage() );
3535
36 - if( $title->getSubjectPage()->getNamespace() == NS_LQT_THREAD ) {
 36+ if ( $title->getSubjectPage()->getNamespace() == NS_LQT_THREAD ) {
3737 // Threads don't have talk pages; redirect to the thread page.
38 - $output->redirect($title->getSubjectPage()->getFullUrl());
 38+ $output->redirect( $title->getSubjectPage()->getFullUrl() );
3939 }
4040
4141 /* Certain actions apply to the "header", which is stored in the actual talkpage
4242 in the database. Drop everything and behave like a normal page if those
4343 actions come up, to avoid hacking the various history, editing, etc. code. */
44 - $action = $request->getVal('action');
45 - $header_actions = array('history', 'edit', 'submit');
 44+ $action = $request->getVal( 'action' );
 45+ $header_actions = array( 'history', 'edit', 'submit' );
4646 global $wgRequest;
47 - if ($request->getVal('lqt_method', null) === null &&
 47+ if ( $request->getVal( 'lqt_method', null ) === null &&
4848 ( in_array( $action, $header_actions ) ||
49 - $request->getVal('diff', null) !== null ) ) {
 49+ $request->getVal( 'diff', null ) !== null ) ) {
5050 $viewname = self::$views['TalkpageHeaderView'];
5151 } else if ( $action == 'protect' || $action == 'unprotect' ) {
5252 $viewname = self::$views['ThreadProtectionFormView'];
53 - } else if ( $request->getVal('lqt_method') == 'talkpage_archive' ) {
 53+ } else if ( $request->getVal( 'lqt_method' ) == 'talkpage_archive' ) {
5454 $viewname = self::$views['TalkpageArchiveView'];
5555 } else {
5656 $viewname = self::$views['TalkpageView'];
@@ -58,29 +58,29 @@
5959 return $view->show();
6060 }
6161
62 - static function threadPermalinkMain(&$output, &$article, &$title, &$user, &$request) {
 62+ static function threadPermalinkMain( &$output, &$article, &$title, &$user, &$request ) {
6363
64 - $action = $request->getVal('action');
65 - $lqt_method = $request->getVal('lqt_method');
 64+ $action = $request->getVal( 'action' );
 65+ $lqt_method = $request->getVal( 'lqt_method' );
6666
67 - if( $lqt_method == 'thread_history' ) {
 67+ if ( $lqt_method == 'thread_history' ) {
6868 $viewname = self::$views['ThreadHistoryListingView'];
6969 }
7070 else if ( $lqt_method == 'diff' ) { // this clause and the next must be in this order.
7171 $viewname = self::$views['ThreadDiffView'];
7272 }
7373 else if ( $action == 'history'
74 - || $request->getVal('diff', null) !== null
75 - || $request->getVal('oldid', null) !== null ) {
 74+ || $request->getVal( 'diff', null ) !== null
 75+ || $request->getVal( 'oldid', null ) !== null ) {
7676 $viewname = self::$views['IndividualThreadHistoryView'];
7777 }
7878 else if ( $action == 'protect' || $action == 'unprotect' ) {
7979 $viewname = self::$views['ThreadProtectionFormView'];
8080 }
81 - else if ( $request->getVal('lqt_oldid', null) !== null ) {
 81+ else if ( $request->getVal( 'lqt_oldid', null ) !== null ) {
8282 $viewname = self::$views['ThreadHistoricalRevisionView'];
8383 }
84 - else if( $action == 'watch' || $action == 'unwatch' ){
 84+ else if ( $action == 'watch' || $action == 'unwatch' ) {
8585 $viewname = self::$views['ThreadWatchView'];
8686 }
8787 else {
@@ -90,7 +90,7 @@
9191 return $view->show();
9292 }
9393
94 - static function threadSummaryMain(&$output, &$article, &$title, &$user, &$request) {
 94+ static function threadSummaryMain( &$output, &$article, &$title, &$user, &$request ) {
9595 $viewname = self::$views['SummaryPageView'];
9696 $view = new $viewname( $output, $article, $title, $user, $request );
9797 return $view->show();
@@ -102,11 +102,11 @@
103103 */
104104 static function tryPage( $output, $article, $title, $user, $request ) {
105105 if ( $title->isTalkPage() ) {
106 - return self::talkpageMain ($output, $article, $title, $user, $request);
 106+ return self::talkpageMain ( $output, $article, $title, $user, $request );
107107 } else if ( $title->getNamespace() == NS_LQT_THREAD ) {
108 - return self::threadPermalinkMain($output, $article, $title, $user, $request);
 108+ return self::threadPermalinkMain( $output, $article, $title, $user, $request );
109109 } else if ( $title->getNamespace() == NS_LQT_SUMMARY ) {
110 - return self::threadSummaryMain($output, $article, $title, $user, $request);
 110+ return self::threadSummaryMain( $output, $article, $title, $user, $request );
111111 }
112112 return true;
113113 }
@@ -114,10 +114,10 @@
115115 static function onPageMove( $movepage, $ot, $nt ) {
116116 // We are being invoked on the subject page, not the talk page.
117117
118 - $threads = Threads::where( array( Threads::articleClause(new Article($ot)),
119 - Threads::topLevelClause() ));
 118+ $threads = Threads::where( array( Threads::articleClause( new Article( $ot ) ),
 119+ Threads::topLevelClause() ) );
120120
121 - foreach ($threads as $t) {
 121+ foreach ( $threads as $t ) {
122122 $t->moveToSubjectPage( $nt, false );
123123 }
124124
@@ -125,17 +125,17 @@
126126 }
127127
128128 static function makeLinkObj( &$returnValue, &$linker, $nt, $text, $query, $trail, $prefix ) {
129 - if( ! $nt->isTalkPage() )
 129+ if ( ! $nt->isTalkPage() )
130130 return true;
131131
132132 // Talkpages with headers.
133 - if( $nt->getArticleID() != 0 )
 133+ if ( $nt->getArticleID() != 0 )
134134 return true;
135135
136136 // Talkpages without headers -- check existance of threads.
137 - $article = new Article($nt->getSubjectPage());
138 - $threads = Threads::where(Threads::articleClause($article), "LIMIT 1");
139 - if( count($threads) == 0 ) {
 137+ $article = new Article( $nt->getSubjectPage() );
 138+ $threads = Threads::where( Threads::articleClause( $article ), "LIMIT 1" );
 139+ if ( count( $threads ) == 0 ) {
140140 // We want it to look like a broken link, but not have action=edit, since that
141141 // will edit the header, so we can't use makeBrokenLinkObj. This code is copied
142142 // from the body of that method.
@@ -153,45 +153,45 @@
154154 }
155155
156156 // One major place that doesn't use makeLinkObj is the tabs. So override known/unknown there too.
157 - static function tabAction(&$skintemplate, $title, $message, $selected, $checkEdit,
158 - &$classes, &$query, &$text, &$result) {
159 - if( ! $title->isTalkPage() )
 157+ static function tabAction( &$skintemplate, $title, $message, $selected, $checkEdit,
 158+ &$classes, &$query, &$text, &$result ) {
 159+ if ( ! $title->isTalkPage() )
160160 return true;
161 - if( $title->getArticleID() != 0 ) {
 161+ if ( $title->getArticleID() != 0 ) {
162162 $query = "";
163163 return true;
164164 }
165165 // It's a talkpage without a header. Get rid of action=edit always,
166166 // color as apropriate.
167167 $query = "";
168 - $article = new Article($title->getSubjectPage());
169 - $threads = Threads::where(Threads::articleClause($article), "LIMIT 1");
170 - if( count($threads) != 0 ) {
171 - $i = array_search('new', $classes); if( $i !== false ) {
172 - array_splice($classes, $i, 1);
 168+ $article = new Article( $title->getSubjectPage() );
 169+ $threads = Threads::where( Threads::articleClause( $article ), "LIMIT 1" );
 170+ if ( count( $threads ) != 0 ) {
 171+ $i = array_search( 'new', $classes ); if ( $i !== false ) {
 172+ array_splice( $classes, $i, 1 );
173173 }
174174 }
175175 return true;
176176 }
177177
178 - static function customizeOldChangesList(&$changeslist, &$s, &$rc) {
179 - if( $rc->getTitle()->getNamespace() == NS_LQT_THREAD ) {
180 - $thread = Threads::withRoot(new Post( $rc->getTitle() ));
181 - if( !$thread ) return true;
 178+ static function customizeOldChangesList( &$changeslist, &$s, &$rc ) {
 179+ if ( $rc->getTitle()->getNamespace() == NS_LQT_THREAD ) {
 180+ $thread = Threads::withRoot( new Post( $rc->getTitle() ) );
 181+ if ( !$thread ) return true;
182182
183183 LqtView::addJSandCSS(); // TODO only do this once.
184184 wfLoadExtensionMessages( 'LiquidThreads' );
185185
186 - if( $rc->mAttribs['rc_type'] != RC_NEW ) {
 186+ if ( $rc->mAttribs['rc_type'] != RC_NEW ) {
187187 // Add whether it was original author.
188188 // TODO: this only asks whether ANY edit has been by another, not this edit.
189189 // But maybe that's what we want.
190 - if( $thread->editedness() == Threads::EDITED_BY_OTHERS )
191 - $appendix = ' <span class="lqt_rc_author_notice lqt_rc_author_notice_others">'.
192 - wfMsg('lqt_rc_author_others').'</span>';
 190+ if ( $thread->editedness() == Threads::EDITED_BY_OTHERS )
 191+ $appendix = ' <span class="lqt_rc_author_notice lqt_rc_author_notice_others">' .
 192+ wfMsg( 'lqt_rc_author_others' ) . '</span>';
193193 else
194 - $appendix = ' <span class="lqt_rc_author_notice lqt_rc_author_notice_original">'.
195 - wfMsg('lqt_rc_author_original').'</span>';
 194+ $appendix = ' <span class="lqt_rc_author_notice lqt_rc_author_notice_original">' .
 195+ wfMsg( 'lqt_rc_author_original' ) . '</span>';
196196 $s = preg_replace( '/\<\/li\>$/', $appendix . '</li>', $s );
197197 }
198198 else {
@@ -199,15 +199,15 @@
200200 $changeslist->insertUserRelatedLinks( $sig, $rc );
201201
202202 // This should be stored in RC.
203 - $quote = Revision::newFromId($rc->mAttribs['rc_this_oldid'])->getText();
204 - if( strlen($quote) > 230 ) {
205 - $quote = substr($quote, 0, 200) .
206 - $changeslist->skin->link($thread->title(), wfMsg('lqt_rc_ellipsis'),
207 - array('class'=>'lqt_rc_ellipsis'), array(), array('known'));
 203+ $quote = Revision::newFromId( $rc->mAttribs['rc_this_oldid'] )->getText();
 204+ if ( strlen( $quote ) > 230 ) {
 205+ $quote = substr( $quote, 0, 200 ) .
 206+ $changeslist->skin->link( $thread->title(), wfMsg( 'lqt_rc_ellipsis' ),
 207+ array( 'class' => 'lqt_rc_ellipsis' ), array(), array( 'known' ) );
208208 }
209209 // TODO we must parse or sanitize the quote.
210210
211 - if( $thread->isTopmostThread() ) {
 211+ if ( $thread->isTopmostThread() ) {
212212 $message_name = 'lqt_rc_new_discussion';
213213 $tmp_title = $thread->title();
214214 } else {
@@ -219,36 +219,36 @@
220220 $thread_link = $changeslist->skin->link(
221221 $tmp_title,
222222 $thread->subjectWithoutIncrement(),
223 - array(), array(), array('known'));
 223+ array(), array(), array( 'known' ) );
224224
225225 $talkpage_link = $changeslist->skin->link(
226226 $thread->article()->getTitle()->getTalkPage(),
227227 null,
228 - array(), array(), array('known'));
 228+ array(), array(), array( 'known' ) );
229229
230 - $s = wfMsg($message_name, $thread_link, $talkpage_link, $sig)
 230+ $s = wfMsg( $message_name, $thread_link, $talkpage_link, $sig )
231231 . "<blockquote class=\"lqt_rc_blockquote\">$quote</blockquote>";
232232 }
233233 }
234234 return true;
235235 }
236236
237 - static function setNewtalkHTML($skintemplate, $tpl) {
 237+ static function setNewtalkHTML( $skintemplate, $tpl ) {
238238 global $wgUser, $wgTitle, $wgOut;
239239 wfLoadExtensionMessages( 'LiquidThreads' );
240240 $newmsg_t = SpecialPage::getTitleFor( 'NewMessages' );
241241 $watchlist_t = SpecialPage::getTitleFor( 'Watchlist' );
242242 $usertalk_t = $wgUser->getTalkPage();
243 - if( $wgUser->getNewtalk()
244 - &&! $newmsg_t->equals($wgTitle)
245 - &&! $watchlist_t->equals($wgTitle)
246 - &&! $usertalk_t->equals($wgTitle)
 243+ if ( $wgUser->getNewtalk()
 244+ && ! $newmsg_t->equals( $wgTitle )
 245+ && ! $watchlist_t->equals( $wgTitle )
 246+ && ! $usertalk_t->equals( $wgTitle )
247247 ) {
248 - $s = wfMsgExt('lqt_youhavenewmessages', array( 'parseinline' ), $newmsg_t->getFullURL());
249 - $tpl->set("newtalk", $s);
250 - $wgOut->setSquidMaxage(0);
 248+ $s = wfMsgExt( 'lqt_youhavenewmessages', array( 'parseinline' ), $newmsg_t->getFullURL() );
 249+ $tpl->set( "newtalk", $s );
 250+ $wgOut->setSquidMaxage( 0 );
251251 } else {
252 - $tpl->set("newtalk", '');
 252+ $tpl->set( "newtalk", '' );
253253 }
254254
255255 return true;
@@ -276,9 +276,9 @@
277277 public $archive_start_days = 14;
278278 public $archive_recent_days = 5;
279279
280 - protected $sort_order=LQT_NEWEST_CHANGES;
 280+ protected $sort_order = LQT_NEWEST_CHANGES;
281281
282 - function __construct(&$output, &$article, &$title, &$user, &$request) {
 282+ function __construct( &$output, &$article, &$title, &$user, &$request ) {
283283 $this->article = $article;
284284 $this->output = $output;
285285 $this->user = $user;
@@ -289,67 +289,67 @@
290290 $this->queries = $this->initializeQueries();
291291 }
292292
293 - function setHeaderLevel($int) {
 293+ function setHeaderLevel( $int ) {
294294 $this->headerLevel = $int;
295295 }
296296
297297 function initializeQueries() {
298298
299 - if( $this->methodApplies('talkpage_sort_order') ) {
 299+ if ( $this->methodApplies( 'talkpage_sort_order' ) ) {
300300 // Sort order is explicitly specified through UI
301301 global $wgRequest;
302 - $lqt_order=$wgRequest->getVal('lqt_order');
303 - switch($lqt_order) {
 302+ $lqt_order = $wgRequest->getVal( 'lqt_order' );
 303+ switch( $lqt_order ) {
304304 case 'nc':
305 - $this->sort_order=LQT_NEWEST_CHANGES;
 305+ $this->sort_order = LQT_NEWEST_CHANGES;
306306 break;
307307 case 'nt':
308 - $this->sort_order=LQT_NEWEST_THREADS;
 308+ $this->sort_order = LQT_NEWEST_THREADS;
309309 break;
310310 case 'ot':
311 - $this->sort_order=LQT_OLDEST_THREADS;
 311+ $this->sort_order = LQT_OLDEST_THREADS;
312312 break;
313313 }
314314 } else {
315315 // Sort order set in user preferences overrides default
316316 global $wgUser;
317 - $user_order = $wgUser->getOption('lqt_sort_order') ;
318 - if( $user_order ) {
319 - $this->sort_order=$user_order;
 317+ $user_order = $wgUser->getOption( 'lqt_sort_order' ) ;
 318+ if ( $user_order ) {
 319+ $this->sort_order = $user_order;
320320 }
321321 }
322322 global $wgOut;
323323 $g = new QueryGroup();
324 - $startdate = Date::now()->nDaysAgo($this->archive_start_days)->midnight();
325 - $recentstartdate = $startdate->nDaysAgo($this->archive_recent_days);
326 - $article_clause = Threads::articleClause($this->article);
327 - if($this->sort_order==LQT_NEWEST_CHANGES) {
328 - $sort_clause='ORDER BY thread.thread_modified DESC';
329 - } elseif($this->sort_order==LQT_NEWEST_THREADS) {
330 - $sort_clause='ORDER BY thread.thread_created DESC';
331 - } elseif($this->sort_order==LQT_OLDEST_THREADS) {
332 - $sort_clause='ORDER BY thread.thread_created ASC';
 324+ $startdate = Date::now()->nDaysAgo( $this->archive_start_days )->midnight();
 325+ $recentstartdate = $startdate->nDaysAgo( $this->archive_recent_days );
 326+ $article_clause = Threads::articleClause( $this->article );
 327+ if ( $this->sort_order == LQT_NEWEST_CHANGES ) {
 328+ $sort_clause = 'ORDER BY thread.thread_modified DESC';
 329+ } elseif ( $this->sort_order == LQT_NEWEST_THREADS ) {
 330+ $sort_clause = 'ORDER BY thread.thread_created DESC';
 331+ } elseif ( $this->sort_order == LQT_OLDEST_THREADS ) {
 332+ $sort_clause = 'ORDER BY thread.thread_created ASC';
333333 }
334 - $g->addQuery('fresh',
335 - array($article_clause,
 334+ $g->addQuery( 'fresh',
 335+ array( $article_clause,
336336 'thread.thread_parent is null',
337337 '(thread.thread_modified >= ' . $startdate->text() .
338338 ' OR (thread.thread_summary_page is NULL' .
339 - ' AND thread.thread_type='.Threads::TYPE_NORMAL.'))'),
340 - array($sort_clause));
341 - $g->addQuery('archived',
342 - array($article_clause,
 339+ ' AND thread.thread_type=' . Threads::TYPE_NORMAL . '))' ),
 340+ array( $sort_clause ) );
 341+ $g->addQuery( 'archived',
 342+ array( $article_clause,
343343 'thread.thread_parent is null',
344344 '(thread.thread_summary_page is not null' .
345 - ' OR thread.thread_type='.Threads::TYPE_NORMAL.')',
346 - 'thread.thread_modified < ' . $startdate->text()),
347 - array($sort_clause));
348 - $g->extendQuery('archived', 'recently-archived',
349 - array('( thread.thread_modified >=' . $recentstartdate->text() .
 345+ ' OR thread.thread_type=' . Threads::TYPE_NORMAL . ')',
 346+ 'thread.thread_modified < ' . $startdate->text() ),
 347+ array( $sort_clause ) );
 348+ $g->extendQuery( 'archived', 'recently-archived',
 349+ array( '( thread.thread_modified >=' . $recentstartdate->text() .
350350 ' OR rev_timestamp >= ' . $recentstartdate->text() . ')',
351 - 'summary_page.page_id = thread.thread_summary_page', 'summary_page.page_latest = rev_id'),
 351+ 'summary_page.page_id = thread.thread_summary_page', 'summary_page.page_latest = rev_id' ),
352352 array(),
353 - array('page summary_page', 'revision'));
 353+ array( 'page summary_page', 'revision' ) );
354354 return $g;
355355 }
356356
@@ -363,31 +363,31 @@
364364 static function queryStringFromArray( $vars ) {
365365 $q = '';
366366 if ( $vars && count( $vars ) != 0 ) {
367 - foreach( $vars as $name => $value )
 367+ foreach ( $vars as $name => $value )
368368 $q .= "$name=$value&";
369369 }
370370 return $q;
371371 }
372372
373373 function methodAppliesToThread( $method, $thread ) {
374 - return $this->request->getVal('lqt_method') == $method &&
375 - $this->request->getVal('lqt_operand') == $thread->id();
 374+ return $this->request->getVal( 'lqt_method' ) == $method &&
 375+ $this->request->getVal( 'lqt_operand' ) == $thread->id();
376376 }
377377 function methodApplies( $method ) {
378 - return $this->request->getVal('lqt_method') == $method;
 378+ return $this->request->getVal( 'lqt_method' ) == $method;
379379 }
380380
381381 static function permalinkUrl( $thread, $method = null, $operand = null ) {
382382 $query = $method ? "lqt_method=$method" : "";
383383 $query = $operand ? "$query&lqt_operand={$operand->id()}" : $query;
384 - return $thread->root()->getTitle()->getFullUrl($query);
 384+ return $thread->root()->getTitle()->getFullUrl( $query );
385385 }
386386
387387 /* This is used for action=history so that the history tab works, which is
388388 why we break the lqt_method paradigm. */
389389 static function permalinkUrlWithQuery( $thread, $query ) {
390 - if ( is_array($query) ) $query = self::queryStringFromArray($query);
391 - return $thread->root()->getTitle()->getFullUrl($query);
 390+ if ( is_array( $query ) ) $query = self::queryStringFromArray( $query );
 391+ return $thread->root()->getTitle()->getFullUrl( $query );
392392 }
393393
394394 static function permalinkUrlWithDiff( $thread ) {
@@ -396,18 +396,18 @@
397397 $curr_rev = Revision::newFromTitle( $changed_thread->root()->getTitle(), $curr_rev_id );
398398 $prev_rev = $curr_rev->getPrevious();
399399 $oldid = $prev_rev ? $prev_rev->getId() : "";
400 - return self::permalinkUrlWithQuery( $changed_thread, array('lqt_method'=>'diff', 'diff'=>$curr_rev_id, 'oldid'=>$oldid) );
 400+ return self::permalinkUrlWithQuery( $changed_thread, array( 'lqt_method' => 'diff', 'diff' => $curr_rev_id, 'oldid' => $oldid ) );
401401 }
402402
403403 static function talkpageUrl( $title, $method = null, $operand = null, $includeFragment = true ) {
404404 global $wgRequest; // TODO global + ugly hack.
405405 $query = $method ? "lqt_method=$method" : "";
406406 $query = $operand ? "$query&lqt_operand={$operand->id()}" : $query;
407 - $oldid = $wgRequest->getVal('oldid', null); if( $oldid !== null ) {
 407+ $oldid = $wgRequest->getVal( 'oldid', null ); if ( $oldid !== null ) {
408408 // this is an immensely ugly hack to make editing old revisions work.
409409 $query = "$query&oldid=$oldid";
410410 }
411 - return $title->getFullURL( $query ) . ($operand && $includeFragment ? "#lqt_thread_{$operand->id()}" : "");
 411+ return $title->getFullURL( $query ) . ( $operand && $includeFragment ? "#lqt_thread_{$operand->id()}" : "" );
412412 }
413413
414414
@@ -430,7 +430,7 @@
431431 foreach ( $repls as $k => $v ) {
432432 $vs[$k] = $v;
433433 }
434 - return $this->title->getFullURL(self::queryStringFromArray($vs));
 434+ return $this->title->getFullURL( self::queryStringFromArray( $vs ) );
435435 }
436436
437437 /*************************************************************
@@ -444,7 +444,7 @@
445445 * TODO: figure out a clean way to expand this to other forms.
446446 */
447447 function perpetuate( $name, $as ) {
448 - $value = $this->request->getVal($name, '');
 448+ $value = $this->request->getVal( $name, '' );
449449 if ( $as == 'hidden' ) {
450450 return <<<HTML
451451 <input type="hidden" name="$name" id="$name" value="$value">
@@ -452,12 +452,12 @@
453453 }
454454 }
455455
456 - function showReplyProtectedNotice($thread) {
 456+ function showReplyProtectedNotice( $thread ) {
457457 wfLoadExtensionMessages( 'LiquidThreads' );
458 - $log_url = SpecialPage::getTitleFor('Log')->getFullURL(
459 - "type=protect&user=&page={$thread->title()->getPrefixedURL()}");
460 - $this->output->addHTML('<p>' . wfMsg('lqt_protectedfromreply',
461 - '<a href="'.$log_url.'">'.wfMsg('lqt_protectedfromreply_link').'</a>'));
 458+ $log_url = SpecialPage::getTitleFor( 'Log' )->getFullURL(
 459+ "type=protect&user=&page={$thread->title()->getPrefixedURL()}" );
 460+ $this->output->addHTML( '<p>' . wfMsg( 'lqt_protectedfromreply',
 461+ '<a href="' . $log_url . '">' . wfMsg( 'lqt_protectedfromreply_link' ) . '</a>' ) );
462462 }
463463
464464 function showNewThreadForm() {
@@ -469,10 +469,10 @@
470470 }
471471
472472 function showReplyForm( $thread ) {
473 - if( $thread->root()->getTitle()->userCan( 'edit' ) ) {
 473+ if ( $thread->root()->getTitle()->userCan( 'edit' ) ) {
474474 $this->showEditingFormInGeneral( null, 'reply', $thread );
475475 } else {
476 - $this->showReplyProtectedNotice($thread);
 476+ $this->showReplyProtectedNotice( $thread );
477477 }
478478 }
479479
@@ -488,36 +488,36 @@
489489 can temporarily use a random scratch title. It's fine if the title changes
490490 throughout the edit cycle, since the article doesn't exist yet anyways.
491491 */
492 - if ($edit_type == 'summarize' && $edit_applies_to->summary() ) {
 492+ if ( $edit_type == 'summarize' && $edit_applies_to->summary() ) {
493493 $article = $edit_applies_to->summary();
494 - } else if ($edit_type == 'summarize') {
495 - $t = $this->newSummaryTitle($edit_applies_to);
496 - $article = new Article($t);
 494+ } else if ( $edit_type == 'summarize' ) {
 495+ $t = $this->newSummaryTitle( $edit_applies_to );
 496+ $article = new Article( $t );
497497 } else if ( $thread == null ) {
498 - $subject = $this->request->getVal('lqt_subject_field', '');
499 - if ($edit_type == 'new') {
500 - $t = $this->newScratchTitle($subject);
501 - } else if ($edit_type == 'reply') {
502 - $t = $this->newReplyTitle($subject, $edit_applies_to);
 498+ $subject = $this->request->getVal( 'lqt_subject_field', '' );
 499+ if ( $edit_type == 'new' ) {
 500+ $t = $this->newScratchTitle( $subject );
 501+ } else if ( $edit_type == 'reply' ) {
 502+ $t = $this->newReplyTitle( $subject, $edit_applies_to );
503503 }
504 - $article = new Article($t);
 504+ $article = new Article( $t );
505505 } else {
506506 $article = $thread->root();
507507 }
508508
509 - $e = new EditPage($article);
 509+ $e = new EditPage( $article );
510510
511511 $e->suppressIntro = true;
512512 $e->editFormTextBeforeContent .=
513 - $this->perpetuate('lqt_method', 'hidden') .
514 - $this->perpetuate('lqt_operand', 'hidden');
 513+ $this->perpetuate( 'lqt_method', 'hidden' ) .
 514+ $this->perpetuate( 'lqt_operand', 'hidden' );
515515
516 - if ( $edit_type=='new' || ($thread && !$thread->hasSuperthread()) ) {
 516+ if ( $edit_type == 'new' || ( $thread && !$thread->hasSuperthread() ) ) {
517517 wfLoadExtensionMessages( 'LiquidThreads' );
518518 // This is a top-level post; show the subject line.
519519 $db_subject = $thread ? $thread->subjectWithoutIncrement() : '';
520 - $subject = $this->request->getVal('lqt_subject_field', $db_subject);
521 - $subject_label = wfMsg('lqt_subject');
 520+ $subject = $this->request->getVal( 'lqt_subject_field', $db_subject );
 521+ $subject_label = wfMsg( 'lqt_subject' );
522522 $e->editFormTextBeforeContent .= <<<HTML
523523 <label for="lqt_subject_field">$subject_label</label>
524524 <input type="text" size="60" name="lqt_subject_field" id="lqt_subject_field" value="$subject" tabindex="1"><br />
@@ -527,33 +527,33 @@
528528 $e->edit();
529529
530530 // Override what happens in EditPage::showEditForm, called from $e->edit():
531 -// $wgOut->setArticleRelated( false );
 531+
532532 $this->output->setArticleFlag( false );
533533
534534 // For replies and new posts, insert the associated thread object into the DB.
535 - if ($edit_type != 'editExisting' && $edit_type != 'summarize' && $e->didSave) {
 535+ if ( $edit_type != 'editExisting' && $edit_type != 'summarize' && $e->didSave ) {
536536 if ( $edit_type == 'reply' ) {
537537 $thread = Threads::newThread( $article, $this->article, $edit_applies_to, $e->summary );
538 - $edit_applies_to->commitRevision(Threads::CHANGE_REPLY_CREATED, $thread, $e->summary);
 538+ $edit_applies_to->commitRevision( Threads::CHANGE_REPLY_CREATED, $thread, $e->summary );
539539 } else {
540540 $thread = Threads::newThread( $article, $this->article, null, $e->summary );
541541 }
542542 }
543543
544 - if ($edit_type == 'summarize' && $e->didSave) {
 544+ if ( $edit_type == 'summarize' && $e->didSave ) {
545545 $edit_applies_to->setSummary( $article );
546 - $edit_applies_to->commitRevision(Threads::CHANGE_EDITED_SUMMARY, $edit_applies_to, $e->summary);
 546+ $edit_applies_to->commitRevision( Threads::CHANGE_EDITED_SUMMARY, $edit_applies_to, $e->summary );
547547 }
548548
549549 // Move the thread and replies if subject changed.
550 - if( $edit_type == 'editExisting' && $e->didSave ) {
551 - $subject = $this->request->getVal('lqt_subject_field', '');
 550+ if ( $edit_type == 'editExisting' && $e->didSave ) {
 551+ $subject = $this->request->getVal( 'lqt_subject_field', '' );
552552 if ( $subject && $subject != $thread->subjectWithoutIncrement() ) {
553 -// $reason = $this->request->getVal("wpSummary", "");
554 - $this->renameThread($thread, $subject, $e->summary);
 553+
 554+ $this->renameThread( $thread, $subject, $e->summary );
555555 }
556556 // this is unrelated to the subject change and is for all edits:
557 - $thread->setRootRevision( Revision::newFromTitle($thread->root()->getTitle()) );
 557+ $thread->setRootRevision( Revision::newFromTitle( $thread->root()->getTitle() ) );
558558 $thread->commitRevision( Threads::CHANGE_EDITED_ROOT, $thread, $e->summary );
559559 }
560560
@@ -568,34 +568,34 @@
569569 }
570570 }
571571
572 - function renameThread($t,$s,$reason) {
573 - $this->simplePageMove($t->root()->getTitle(),$s, $reason);
 572+ function renameThread( $t, $s, $reason ) {
 573+ $this->simplePageMove( $t->root()->getTitle(), $s, $reason );
574574 // TODO here create a redirect from old page to new.
575 - foreach( $t->subthreads() as $st ) {
576 - $this->renameThread($st, $s, $reason);
 575+ foreach ( $t->subthreads() as $st ) {
 576+ $this->renameThread( $st, $s, $reason );
577577 }
578578 }
579579
580580 function scratchTitle() {
581 - $token = md5(uniqid(rand(), true));
 581+ $token = md5( uniqid( rand(), true ) );
582582 return Title::newFromText( "Thread:$token" );
583583 }
584 - function newScratchTitle($subject) {
 584+ function newScratchTitle( $subject ) {
585585 wfLoadExtensionMessages( 'LiquidThreads' );
586 - return $this->incrementedTitle( $subject?$subject:wfMsg('lqt_nosubject'), NS_LQT_THREAD );
 586+ return $this->incrementedTitle( $subject ? $subject:wfMsg( 'lqt_nosubject' ), NS_LQT_THREAD );
587587 }
588 - function newSummaryTitle($t) {
 588+ function newSummaryTitle( $t ) {
589589 return $this->incrementedTitle( $t->subject(), NS_LQT_SUMMARY );
590590 }
591 - function newReplyTitle($s, $t) {
 591+ function newReplyTitle( $s, $t ) {
592592 return $this->incrementedTitle( $t->subjectWithoutIncrement(), NS_LQT_THREAD );
593593 }
594594 /** Keep trying titles starting with $basename until one is unoccupied. */
595 - public static function incrementedTitle($basename, $namespace) {
 595+ public static function incrementedTitle( $basename, $namespace ) {
596596 $i = 1; do {
597 - $t = Title::newFromText( $basename.'_('.$i.')', $namespace );
 597+ $t = Title::newFromText( $basename . '_(' . $i . ')', $namespace );
598598 $i++;
599 - } while ( $t->exists() || in_array($t->getPrefixedDBkey(), self::$occupied_titles) );
 599+ } while ( $t->exists() || in_array( $t->getPrefixedDBkey(), self::$occupied_titles ) );
600600 return $t;
601601 }
602602
@@ -609,7 +609,7 @@
610610 # Variables beginning with 'o' for old article 'n' for new article
611611
612612 $ot = $old_title;
613 - $nt = $this->incrementedTitle($new_subject, $old_title->getNamespace());
 613+ $nt = $this->incrementedTitle( $new_subject, $old_title->getNamespace() );
614614
615615 self::$occupied_titles[] = $nt->getPrefixedDBkey();
616616
@@ -621,7 +621,7 @@
622622
623623 $error = $ot->moveTo( $nt, true, "Changed thread subject: $reason" );
624624 if ( $error !== true ) {
625 - var_dump($error);
 625+ var_dump( $error );
626626 echo "something bad happened trying to rename the thread."; // TODO
627627 return false;
628628 }
@@ -644,61 +644,61 @@
645645 * 'enabled' => true )
646646 * )
647647 */
648 - function threadFooterCommands($thread) {
 648+ function threadFooterCommands( $thread ) {
649649 wfLoadExtensionMessages( 'LiquidThreads' );
650650 $commands = array();
651651
652652 $user_can_edit = $thread->root()->getTitle()->quickUserCan( 'edit' );
653653
654 - $commands[] = array( 'label' => $user_can_edit ? wfMsg('edit') : wfMsg('viewsource'),
 654+ $commands[] = array( 'label' => $user_can_edit ? wfMsg( 'edit' ) : wfMsg( 'viewsource' ),
655655 'href' => $this->talkpageUrl( $this->title, 'edit', $thread ),
656656 'enabled' => true );
657657
658 - $commands[] = array( 'label' => wfMsg('history_short'),
659 - 'href' => $this->permalinkUrlWithQuery($thread, 'action=history'),
 658+ $commands[] = array( 'label' => wfMsg( 'history_short' ),
 659+ 'href' => $this->permalinkUrlWithQuery( $thread, 'action=history' ),
660660 'enabled' => true );
661661
662 - $commands[] = array( 'label' => wfMsg('lqt_permalink'),
 662+ $commands[] = array( 'label' => wfMsg( 'lqt_permalink' ),
663663 'href' => $this->permalinkUrl( $thread ),
664664 'enabled' => true );
665665
666 - if ( in_array('delete', $this->user->getRights()) ) {
667 - $delete_url = SpecialPage::getTitleFor('DeleteThread')->getFullURL()
 666+ if ( in_array( 'delete', $this->user->getRights() ) ) {
 667+ $delete_url = SpecialPage::getTitleFor( 'DeleteThread' )->getFullURL()
668668 . '/' . $thread->title()->getPrefixedURL();
669 - $commands[] = array( 'label' => $thread->type() == Threads::TYPE_DELETED ? wfMsg('lqt_undelete') : wfMsg('delete'),
 669+ $commands[] = array( 'label' => $thread->type() == Threads::TYPE_DELETED ? wfMsg( 'lqt_undelete' ) : wfMsg( 'delete' ),
670670 'href' => $delete_url,
671671 'enabled' => true );
672672 }
673673
674 - $commands[] = array( 'label' => '<b class="lqt_reply_link">' . wfMsg('lqt_reply') . '</b>',
 674+ $commands[] = array( 'label' => '<b class="lqt_reply_link">' . wfMsg( 'lqt_reply' ) . '</b>',
675675 'href' => $this->talkpageUrl( $this->title, 'reply', $thread ),
676676 'enabled' => $user_can_edit );
677677
678678 return $commands;
679679 }
680680
681 - function topLevelThreadCommands($thread) {
 681+ function topLevelThreadCommands( $thread ) {
682682 wfLoadExtensionMessages( 'LiquidThreads' );
683683 $commands = array();
684684
685 - $commands[] = array( 'label' => wfMsg('history_short'),
686 - 'href' => $this->permalinkUrl($thread, 'thread_history'),
 685+ $commands[] = array( 'label' => wfMsg( 'history_short' ),
 686+ 'href' => $this->permalinkUrl( $thread, 'thread_history' ),
687687 'enabled' => true );
688688
689 - if( in_array('move', $this->user->getRights()) ) {
690 - $move_href = SpecialPage::getTitleFor('MoveThread')->getFullURL()
 689+ if ( in_array( 'move', $this->user->getRights() ) ) {
 690+ $move_href = SpecialPage::getTitleFor( 'MoveThread' )->getFullURL()
691691 . '/' . $thread->title()->getPrefixedURL();
692 - $commands[] = array( 'label' => wfMsg('move'),
 692+ $commands[] = array( 'label' => wfMsg( 'move' ),
693693 'href' => $move_href,
694694 'enabled' => true );
695695 }
696 - if( !$this->user->isAnon() && !$thread->title()->userIsWatching() ) {
697 - $commands[] = array( 'label' => wfMsg('watch'),
698 - 'href' => $this->permalinkUrlWithQuery($thread, 'action=watch'),
 696+ if ( !$this->user->isAnon() && !$thread->title()->userIsWatching() ) {
 697+ $commands[] = array( 'label' => wfMsg( 'watch' ),
 698+ 'href' => $this->permalinkUrlWithQuery( $thread, 'action=watch' ),
699699 'enabled' => true );
700 - } else if( !$this->user->isAnon() ) {
701 - $commands[] = array( 'label' => wfMsg('unwatch'),
702 - 'href' => $this->permalinkUrlWithQuery($thread, 'action=unwatch'),
 700+ } else if ( !$this->user->isAnon() ) {
 701+ $commands[] = array( 'label' => wfMsg( 'unwatch' ),
 702+ 'href' => $this->permalinkUrlWithQuery( $thread, 'action=unwatch' ),
703703 'enabled' => true );
704704 }
705705
@@ -721,7 +721,7 @@
722722 /*]]>*/</style>
723723
724724 HTML;
725 - $wgOut->addScript($s);
 725+ $wgOut->addScript( $s );
726726 }
727727
728728 /* @return False if the article and revision do not exist and we didn't show it, true if we did. */
@@ -734,7 +734,7 @@
735735 intval( $this->user->getOption( 'stubthreshold' ) ) == 0 &&
736736 $post->exists() &&
737737 $oldid === null;
738 - wfDebug( 'LqtView::showPostBody using parser cache: ' . ($pcache ? 'yes' : 'no' ) . "\n" );
 738+ wfDebug( 'LqtView::showPostBody using parser cache: ' . ( $pcache ? 'yes' : 'no' ) . "\n" );
739739 if ( $this->user->getOption( 'stubthreshold' ) ) {
740740 wfIncrStats( 'pcache_miss_stub' );
741741 }
@@ -744,15 +744,15 @@
745745 $outputDone = $this->output->tryParserCache( $post, $this->user );
746746 }
747747
748 - if (!$outputDone) {
 748+ if ( !$outputDone ) {
749749 // Cache miss; parse and output it.
750750 $rev = Revision::newFromTitle( $post->getTitle(), $oldid );
751 - if ($rev && $oldid) {
 751+ if ( $rev && $oldid ) {
752752 // don't save oldids in the parser cache.
753753 $this->output->addWikiText( $rev->getText() );
754754 return true;
755755 }
756 - else if ($rev) {
 756+ else if ( $rev ) {
757757 $post->outputWikiText( $rev->getText(), true );
758758 return true;
759759 } else {
@@ -765,68 +765,68 @@
766766
767767 function colorTest() {
768768 $this->output->addHTML( '<div class="lqt_footer"><li class="lqt_footer_sig">' );
769 - for( $i = 1; $i <= self::number_of_user_colors; $i++ ) {
770 - $this->output->addHTML("<span class=\"lqt_post_color_{$i}\"><a href=\"foo\">DavidMcCabe</a></span>");
 769+ for ( $i = 1; $i <= self::number_of_user_colors; $i++ ) {
 770+ $this->output->addHTML( "<span class=\"lqt_post_color_{$i}\"><a href=\"foo\">DavidMcCabe</a></span>" );
771771 }
772 - $this->output->addHTML('</li></div>');
 772+ $this->output->addHTML( '</li></div>' );
773773 }
774774
775775 function showThreadFooter( $thread ) {
776776 global $wgLang; // TODO global.
777777
778778 $author = $thread->root()->originalAuthor();
779 - $color_number = $this->selectNewUserColor($author);
 779+ $color_number = $this->selectNewUserColor( $author );
780780
781781 $sig = $this->user->getSkin()->userLink( $author->getID(), $author->getName() ) .
782782 $this->user->getSkin()->userToolLinks( $author->getID(), $author->getName() );
783783
784 - $timestamp = $wgLang->timeanddate($thread->created());
 784+ $timestamp = $wgLang->timeanddate( $thread->created() );
785785
786 - $this->output->addHTML(<<<HTML
 786+ $this->output->addHTML( <<<HTML
787787 <ul class="lqt_footer">
788788 <span class="lqt_footer_sig">
789789 <li class="lqt_author_sig lqt_post_color_{$color_number}">$sig</li>
790790 HTML
791791 );
792792
793 - if( $thread->editedness() == Threads::EDITED_BY_AUTHOR || $thread->editedness() == Threads::EDITED_BY_OTHERS ) {
 793+ if ( $thread->editedness() == Threads::EDITED_BY_AUTHOR || $thread->editedness() == Threads::EDITED_BY_OTHERS ) {
794794 wfLoadExtensionMessages( 'LiquidThreads' );
795 - $editedness_url = $this->permalinkUrlWithQuery($thread, 'action=history');
 795+ $editedness_url = $this->permalinkUrlWithQuery( $thread, 'action=history' );
796796 $editedness_color_number = $thread->editedness() == Threads::EDITED_BY_AUTHOR ?
797 - $color_number : ($color_number == self::number_of_user_colors ? 1 : $color_number + 1);
798 - $this->output->addHTML("<li class=\"lqt_edited_notice lqt_post_color_{$editedness_color_number}\">".
799 - '<a href="'.$editedness_url.'">'.wfMsg('lqt_edited_notice').'</a>'.'</li>');
 797+ $color_number : ( $color_number == self::number_of_user_colors ? 1 : $color_number + 1 );
 798+ $this->output->addHTML( "<li class=\"lqt_edited_notice lqt_post_color_{$editedness_color_number}\">" .
 799+ '<a href="' . $editedness_url . '">' . wfMsg( 'lqt_edited_notice' ) . '</a>' . '</li>' );
800800 }
801801
802 - $this->output->addHTML("</span><li>$timestamp</li>");
 802+ $this->output->addHTML( "</span><li>$timestamp</li>" );
803803
804 - $this->output->addHTML('<span class="lqt_footer_commands">' .
805 - $this->listItemsForCommands($this->threadFooterCommands($thread)) .
806 - '</span>');
 804+ $this->output->addHTML( '<span class="lqt_footer_commands">' .
 805+ $this->listItemsForCommands( $this->threadFooterCommands( $thread ) ) .
 806+ '</span>' );
807807
808 - $this->output->addHTML('</ul>');
 808+ $this->output->addHTML( '</ul>' );
809809 }
810810
811 - function listItemsForCommands($commands) {
 811+ function listItemsForCommands( $commands ) {
812812 $result = array();
813 - foreach( $commands as $command ) {
 813+ foreach ( $commands as $command ) {
814814 $label = $command['label'];
815815 $href = $command['href'];
816816 $enabled = $command['enabled'];
817817
818 - if( $enabled ) {
 818+ if ( $enabled ) {
819819 $result[] = "<li><a href=\"$href\">$label</a></li>";
820820 } else {
821821 $result[] = "<li><span class=\"lqt_command_disabled\">$label</span></li>";
822822 }
823823 }
824 - return join("", $result);
 824+ return join( "", $result );
825825 }
826826
827827 function selectNewUserColor( $user ) {
828828 $userkey = $user->isAnon() ? "anon:" . $user->getName() : "user:" . $user->getId();
829829
830 - if( !array_key_exists( $userkey, $this->user_colors ) ) {
 830+ if ( !array_key_exists( $userkey, $this->user_colors ) ) {
831831 $this->user_colors[$userkey] = $this->user_color_index;
832832 $this->user_color_index += 1;
833833 if ( $this->user_color_index > self::number_of_user_colors ) {
@@ -839,8 +839,8 @@
840840 function showRootPost( $thread ) {
841841 $popts = $this->output->parserOptions();
842842 $previous_editsection = $popts->getEditSection();
843 - $popts->setEditSection(false);
844 - $this->output->parserOptions($popts);
 843+ $popts->setEditSection( false );
 844+ $this->output->parserOptions( $popts );
845845
846846 $post = $thread->root();
847847
@@ -849,40 +849,40 @@
850850 // or from oldid (which is a page rev). But oldid only applies to the
851851 // thread being requested, not any replies. TODO: eliminate the need
852852 // for article-level histories.
853 - $page_rev = $this->request->getVal('oldid', null);
854 - if( $page_rev !== null && $this->title->equals($thread->root()->getTitle()) ) {
 853+ $page_rev = $this->request->getVal( 'oldid', null );
 854+ if ( $page_rev !== null && $this->title->equals( $thread->root()->getTitle() ) ) {
855855 $oldid = $page_rev;
856856 } else {
857857 $oldid = $thread->isHistorical() ? $thread->rootRevision() : null;
858858 }
859859
860 - $this->openDiv( $this->postDivClass($thread) );
 860+ $this->openDiv( $this->postDivClass( $thread ) );
861861
862 - if( $this->methodAppliesToThread( 'edit', $thread ) ) {
 862+ if ( $this->methodAppliesToThread( 'edit', $thread ) ) {
863863 $this->showPostEditingForm( $thread );
864 - } else{
 864+ } else {
865865 $this->showPostBody( $post, $oldid );
866866 $this->showThreadFooter( $thread );
867867 }
868868
869869 $this->closeDiv();
870870
871 - if( $this->methodAppliesToThread( 'reply', $thread ) ) {
872 - $this->indent($thread);
 871+ if ( $this->methodAppliesToThread( 'reply', $thread ) ) {
 872+ $this->indent( $thread );
873873 $this->showReplyForm( $thread );
874 - $this->unindent($thread);
 874+ $this->unindent( $thread );
875875 }
876876
877 - $popts->setEditSection($previous_editsection);
878 - $this->output->parserOptions($popts);
 877+ $popts->setEditSection( $previous_editsection );
 878+ $this->output->parserOptions( $popts );
879879 }
880880
881881 function showThreadHeading( $thread ) {
882882 if ( $thread->hasDistinctSubject() ) {
883 - if( $thread->hasSuperthread() ) {
 883+ if ( $thread->hasSuperthread() ) {
884884 $commands_html = "";
885885 } else {
886 - $lis = $this->listItemsForCommands($this->topLevelThreadCommands($thread));
 886+ $lis = $this->listItemsForCommands( $this->topLevelThreadCommands( $thread ) );
887887 $commands_html = "<ul class=\"lqt_threadlevel_commands\">$lis</ul>";
888888 }
889889
@@ -898,7 +898,7 @@
899899 return 'lqt_post';
900900 }
901901
902 - static function anchorName($thread) {
 902+ static function anchorName( $thread ) {
903903 return "lqt_thread_{$thread->id()}";
904904 }
905905
@@ -906,16 +906,16 @@
907907 global $wgLang; # TODO global.
908908
909909 if ( $thread->type() == Threads::TYPE_DELETED
910 - && ! $this->request->getBool('lqt_show_deleted_threads') )
 910+ && ! $this->request->getBool( 'lqt_show_deleted_threads' ) )
911911 return;
912912
913 - if( $this->lastUnindentedSuperthread ) {
 913+ if ( $this->lastUnindentedSuperthread ) {
914914 wfLoadExtensionMessages( 'LiquidThreads' );
915915 $tmp = $this->lastUnindentedSuperthread;
916 - $msg = wfMsg('lqt_in_response_to',
917 - '<a href="#lqt_thread_'.$tmp->id().'">'.$tmp->title()->getText().'</a>',
918 - $tmp->root()->originalAuthor()->getName());
919 - $this->output->addHTML('<span class="lqt_nonindent_message">&larr;'.$msg.'</span>');
 916+ $msg = wfMsg( 'lqt_in_response_to',
 917+ '<a href="#lqt_thread_' . $tmp->id() . '">' . $tmp->title()->getText() . '</a>',
 918+ $tmp->root()->originalAuthor()->getName() );
 919+ $this->output->addHTML( '<span class="lqt_nonindent_message">&larr;' . $msg . '</span>' );
920920 }
921921
922922
@@ -923,7 +923,7 @@
924924
925925 $this->output->addHTML( "<a name=\"{$this->anchorName($thread)}\" ></a>" );
926926
927 - if ($thread->type() == Threads::TYPE_MOVED) {
 927+ if ( $thread->type() == Threads::TYPE_MOVED ) {
928928 wfLoadExtensionMessages( 'LiquidThreads' );
929929 $revision = Revision::newFromTitle( $thread->title() );
930930 $target = Title::newFromRedirect( $revision->getText() );
@@ -931,90 +931,90 @@
932932 $author = $thread->root()->originalAuthor();
933933 $sig = $this->user->getSkin()->userLink( $author->getID(), $author->getName() ) .
934934 $this->user->getSkin()->userToolLinks( $author->getID(), $author->getName() );
935 - $this->output->addHTML( wfMsg('lqt_move_placeholder',
936 - '<a href="'.$target->getFullURL().'">'.$target->getText().'</a>',
 935+ $this->output->addHTML( wfMsg( 'lqt_move_placeholder',
 936+ '<a href="' . $target->getFullURL() . '">' . $target->getText() . '</a>',
937937 $sig,
938 - $wgLang->timeanddate($thread->modified())
939 - ));
 938+ $wgLang->timeanddate( $thread->modified() )
 939+ ) );
940940 return;
941941 }
942942
943943 if ( $thread->type() == Threads::TYPE_DELETED ) {
944944 wfLoadExtensionMessages( 'LiquidThreads' );
945 - if ( in_array('deletedhistory', $this->user->getRights()) ) {
946 - $this->output->addHTML('<p>'. wfMsg('lqt_thread_deleted_for_sysops',
947 - '<b>'.wfMsg('lqt_thread_deleted_for_sysops_deleted').'</b>') .'</p>');
 945+ if ( in_array( 'deletedhistory', $this->user->getRights() ) ) {
 946+ $this->output->addHTML( '<p>' . wfMsg( 'lqt_thread_deleted_for_sysops',
 947+ '<b>' . wfMsg( 'lqt_thread_deleted_for_sysops_deleted' ) . '</b>' ) . '</p>' );
948948 }
949949 else {
950 - $this->output->addHTML('<p><em>'.wfMsg('lqt_thread_deleted').'</em></p>');
 950+ $this->output->addHTML( '<p><em>' . wfMsg( 'lqt_thread_deleted' ) . '</em></p>' );
951951 return;
952952 }
953953 }
954954
955 - $timestamp = new Date($thread->modified());
956 - if( $thread->summary() ) {
957 - $this->showSummary($thread);
958 - } else if ( $timestamp->isBefore(Date::now()->nDaysAgo($this->archive_start_days))
 955+ $timestamp = new Date( $thread->modified() );
 956+ if ( $thread->summary() ) {
 957+ $this->showSummary( $thread );
 958+ } else if ( $timestamp->isBefore( Date::now()->nDaysAgo( $this->archive_start_days ) )
959959 && !$thread->summary() && !$thread->hasSuperthread() && !$thread->isHistorical() )
960960 {
961961 wfLoadExtensionMessages( 'LiquidThreads' );
962 - $this->output->addHTML('<p class="lqt_summary_notice">'. wfMsg('lqt_summary_notice',
963 - '<a href="'.$this->permalinkUrl($thread, 'summarize').'">'.wfMsg('lqt_summary_notice_link').'</a>',
 962+ $this->output->addHTML( '<p class="lqt_summary_notice">' . wfMsg( 'lqt_summary_notice',
 963+ '<a href="' . $this->permalinkUrl( $thread, 'summarize' ) . '">' . wfMsg( 'lqt_summary_notice_link' ) . '</a>',
964964 $this->archive_start_days
965 - ) .'</p>');
 965+ ) . '</p>' );
966966 }
967967
968968
969969
970 - $this->openDiv('lqt_thread', "lqt_thread_id_{$thread->id()}");
 970+ $this->openDiv( 'lqt_thread', "lqt_thread_id_{$thread->id()}" );
971971
972972 $this->showRootPost( $thread );
973973
974 - if( $thread->hasSubthreads() ) $this->indent($thread);
975 - foreach( $thread->subthreads() as $st ) {
976 - $this->showThread($st);
 974+ if ( $thread->hasSubthreads() ) $this->indent( $thread );
 975+ foreach ( $thread->subthreads() as $st ) {
 976+ $this->showThread( $st );
977977 }
978 - if( $thread->hasSubthreads() ) $this->unindent($thread);
 978+ if ( $thread->hasSubthreads() ) $this->unindent( $thread );
979979
980980 $this->closeDiv();
981981
982982 }
983983
984 - function indent($thread) {
985 - if( $this->headerLevel <= $this->maxIndentationLevel ) {
986 - $this->output->addHTML('<dl class="lqt_replies"><dd>');
 984+ function indent( $thread ) {
 985+ if ( $this->headerLevel <= $this->maxIndentationLevel ) {
 986+ $this->output->addHTML( '<dl class="lqt_replies"><dd>' );
987987 } else {
988 - $this->output->addHTML('<div class="lqt_replies_without_indent">');
 988+ $this->output->addHTML( '<div class="lqt_replies_without_indent">' );
989989 }
990990 $this->lastUnindentedSuperthread = null;
991991 $this->headerLevel += 1;
992992 }
993 - function unindent($thread) {
994 - if( $this->headerLevel <= $this->maxIndentationLevel + 1 ) {
995 - $this->output->addHTML('</dd></dl>');
 993+ function unindent( $thread ) {
 994+ if ( $this->headerLevel <= $this->maxIndentationLevel + 1 ) {
 995+ $this->output->addHTML( '</dd></dl>' );
996996 } else {
997 - $this->output->addHTML('</div>');
 997+ $this->output->addHTML( '</div>' );
998998 }
999999 // See the beginning of showThread().
10001000 $this->lastUnindentedSuperthread = $thread->superthread();
10011001 $this->headerLevel -= 1;
10021002 }
10031003
1004 - function openDiv( $class='', $id='' ) {
1005 - $this->output->addHTML( Xml::openElement( 'div', array('class'=>$class, 'id'=>$id) ) );
 1004+ function openDiv( $class = '', $id = '' ) {
 1005+ $this->output->addHTML( Xml::openElement( 'div', array( 'class' => $class, 'id' => $id ) ) );
10061006 }
10071007
10081008 function closeDiv() {
10091009 $this->output->addHTML( Xml::closeElement( 'div' ) );
10101010 }
10111011
1012 - function showSummary($t) {
 1012+ function showSummary( $t ) {
10131013 if ( !$t->summary() ) return;
10141014 wfLoadExtensionMessages( 'LiquidThreads' );
1015 - $label = wfMsg('lqt_summary_label');
1016 - $edit = strtolower(wfMsg('edit'));
1017 - $link = strtolower(wfMsg('lqt_permalink'));
1018 - $this->output->addHTML(<<<HTML
 1015+ $label = wfMsg( 'lqt_summary_label' );
 1016+ $edit = strtolower( wfMsg( 'edit' ) );
 1017+ $link = strtolower( wfMsg( 'lqt_permalink' ) );
 1018+ $this->output->addHTML( <<<HTML
10191019 <div class='lqt_thread_permalink_summary'>
10201020 <span class="lqt_thread_permalink_summary_title">
10211021 $label
@@ -1024,8 +1024,8 @@
10251025 </span>
10261026 HTML
10271027 );
1028 - $this->openDiv('lqt_thread_permalink_summary_body');
1029 - $this->showPostBody($t->summary());
 1028+ $this->openDiv( 'lqt_thread_permalink_summary_body' );
 1029+ $this->showPostBody( $t->summary() );
10301030 $this->closeDiv();
10311031 $this->closeDiv();
10321032 }
Index: trunk/extensions/LiquidThreads/LqtFunctions.php
@@ -1,10 +1,10 @@
22 <?php
3 -if (!defined('MEDIAWIKI'))
 3+if ( !defined( 'MEDIAWIKI' ) )
44 die();
55
6 -function efArrayDefault($name, $key, $default) {
 6+function efArrayDefault( $name, $key, $default ) {
77 global $$name;
8 - if( isset($$name) && is_array($$name) && array_key_exists($key, $$name) ) {
 8+ if ( isset( $$name ) && is_array( $$name ) && array_key_exists( $key, $$name ) ) {
99 $foo = $$name;
1010 return $foo[$key];
1111 }
@@ -21,13 +21,13 @@
2222 function efInsertIntoAssoc( $new_key, $new_value, $before, &$original_array ) {
2323 $ordered = array();
2424 $i = 0;
25 - foreach($original_array as $key=>$value) {
26 - $ordered[$i] = array($key, $value);
 25+ foreach ( $original_array as $key => $value ) {
 26+ $ordered[$i] = array( $key, $value );
2727 $i += 1;
2828 }
2929 $new_assoc = array();
30 - foreach($ordered as $pair) {
31 - if( $pair[0] == $before ) {
 30+ foreach ( $ordered as $pair ) {
 31+ if ( $pair[0] == $before ) {
3232 $new_assoc[$new_key] = $new_value;
3333 }
3434 $new_assoc[$pair[0]] = $pair[1];
@@ -35,32 +35,32 @@
3636 $original_array = $new_assoc;
3737 }
3838
39 -function efVarDump($value) {
 39+function efVarDump( $value ) {
4040 global $wgOut;
4141 ob_start();
42 - var_dump($value);
43 - $tmp=ob_get_contents();
 42+ var_dump( $value );
 43+ $tmp = ob_get_contents();
4444 ob_end_clean();
45 - $wgOut->addHTML(/*'<pre>' . htmlspecialchars($tmp,ENT_QUOTES) . '</pre>'*/ $tmp);
 45+ $wgOut->addHTML( /*'<pre>' . htmlspecialchars($tmp,ENT_QUOTES) . '</pre>'*/ $tmp );
4646 }
4747
48 -function efThreadTable($ts) {
 48+function efThreadTable( $ts ) {
4949 global $wgOut;
50 - $wgOut->addHTML('<table>');
51 - foreach($ts as $t)
52 - efThreadTableHelper($t, 0);
53 - $wgOut->addHTML('</table>');
 50+ $wgOut->addHTML( '<table>' );
 51+ foreach ( $ts as $t )
 52+ efThreadTableHelper( $t, 0 );
 53+ $wgOut->addHTML( '</table>' );
5454 }
5555
56 -function efThreadTableHelper($t, $indent) {
 56+function efThreadTableHelper( $t, $indent ) {
5757 global $wgOut;
58 - $wgOut->addHTML('<tr>');
59 - $wgOut->addHTML('<td>' . $indent);
60 - $wgOut->addHTML('<td>' . $t->id());
61 - $wgOut->addHTML('<td>' . $t->title()->getPrefixedText());
62 - $wgOut->addHTML('</tr>');
63 - foreach($t->subthreads() as $st)
64 - efThreadTableHelper($st, $indent + 1);
 58+ $wgOut->addHTML( '<tr>' );
 59+ $wgOut->addHTML( '<td>' . $indent );
 60+ $wgOut->addHTML( '<td>' . $t->id() );
 61+ $wgOut->addHTML( '<td>' . $t->title()->getPrefixedText() );
 62+ $wgOut->addHTML( '</tr>' );
 63+ foreach ( $t->subthreads() as $st )
 64+ efThreadTableHelper( $st, $indent + 1 );
6565 }
6666
6767 function wfLqtBeforeWatchlistHook( &$conds, &$tables, &$join_conds, &$fields ) {
@@ -68,24 +68,24 @@
6969
7070 if ( !in_array( 'page', $tables ) ) {
7171 $tables[] = 'page';
72 - $join_conds['page'] = array('LEFT JOIN','rc_cur_id=page_id');
 72+ $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
7373 }
7474 $conds[] = "page_namespace != " . NS_LQT_THREAD;
7575
76 - $talkpage_messages = NewMessages::newUserMessages($wgUser);
77 - $tn = count($talkpage_messages);
 76+ $talkpage_messages = NewMessages::newUserMessages( $wgUser );
 77+ $tn = count( $talkpage_messages );
7878
79 - $watch_messages = NewMessages::watchedThreadsForUser($wgUser);
80 - $wn = count($watch_messages);
 79+ $watch_messages = NewMessages::watchedThreadsForUser( $wgUser );
 80+ $wn = count( $watch_messages );
8181
82 - if( $tn == 0 && $wn == 0 )
 82+ if ( $tn == 0 && $wn == 0 )
8383 return true;
8484
8585 LqtView::addJSandCSS();
8686 wfLoadExtensionMessages( 'LiquidThreads' );
87 - $messages_url = SpecialPage::getPage('NewMessages')->getTitle()->getFullURL();
 87+ $messages_url = SpecialPage::getPage( 'NewMessages' )->getTitle()->getFullURL();
8888 $new_messages = wfMsg ( 'lqt-new-messages' );
89 - $wgOut->addHTML(<<< HTML
 89+ $wgOut->addHTML( <<< HTML
9090 <a href="$messages_url" class="lqt_watchlist_messages_notice">
9191 &#x2712; {$new_messages}
9292 </a>
Index: trunk/extensions/LiquidThreads/LICENSE
@@ -336,4 +336,4 @@
337337 proprietary programs. If your program is a subroutine library, you may
338338 consider it more useful to permit linking proprietary applications with the
339339 library. If this is what you want to do, use the GNU Lesser General
340 -Public License instead of this License.
\ No newline at end of file
 340+Public License instead of this License.
Index: trunk/extensions/LiquidThreads/lqt.css
@@ -467,4 +467,3 @@
468468 .lqt_rc_author_notice_others {
469469 color: #cd9800;
470470 }
471 -
Index: trunk/extensions/LiquidThreads/LiquidThreads.php
@@ -1,6 +1,6 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI'))
 4+if ( !defined( 'MEDIAWIKI' ) )
55 die();
66
77 $wgExtensionCredits['other'][] = array(
@@ -12,15 +12,15 @@
1313 'descriptionmsg' => 'lqt-desc',
1414 );
1515
16 -require( 'LqtFunctions.php');
 16+require( 'LqtFunctions.php' );
1717
18 -define('NS_LQT_THREAD', efArrayDefault('egLqtNamespaceNumbers', 'Thread', 90));
19 -define('NS_LQT_THREAD_TALK', efArrayDefault('egLqtNamespaceNumbers', 'Thread_talk', 91));
20 -define('NS_LQT_SUMMARY', efArrayDefault('egLqtNamespaceNumbers', 'Summary', 92));
21 -define('NS_LQT_SUMMARY_TALK', efArrayDefault('egLqtNamespaceNumbers', 'Summary_talk', 93));
22 -define('LQT_NEWEST_CHANGES',1);
23 -define('LQT_NEWEST_THREADS',2);
24 -define('LQT_OLDEST_THREADS',3);
 18+define( 'NS_LQT_THREAD', efArrayDefault( 'egLqtNamespaceNumbers', 'Thread', 90 ) );
 19+define( 'NS_LQT_THREAD_TALK', efArrayDefault( 'egLqtNamespaceNumbers', 'Thread_talk', 91 ) );
 20+define( 'NS_LQT_SUMMARY', efArrayDefault( 'egLqtNamespaceNumbers', 'Summary', 92 ) );
 21+define( 'NS_LQT_SUMMARY_TALK', efArrayDefault( 'egLqtNamespaceNumbers', 'Summary_talk', 93 ) );
 22+define( 'LQT_NEWEST_CHANGES', 1 );
 23+define( 'LQT_NEWEST_THREADS', 2 );
 24+define( 'LQT_OLDEST_THREADS', 3 );
2525
2626 $wgCanonicalNamespaceNames[NS_LQT_THREAD] = 'Thread';
2727 $wgCanonicalNamespaceNames[NS_LQT_THREAD_TALK] = 'Thread_talk';
@@ -32,7 +32,7 @@
3333 $wgExtraNamespaces[NS_LQT_SUMMARY] = 'Summary';
3434 $wgExtraNamespaces[NS_LQT_SUMMARY_TALK] = 'Summary_talk';
3535
36 -$dir = dirname(__FILE__) . '/';
 36+$dir = dirname( __FILE__ ) . '/';
3737 $wgExtensionMessagesFiles['LiquidThreads'] = $dir . 'Lqt.i18n.php';
3838 $wgExtensionAliasesFiles['LiquidThreads'] = $dir . 'Lqt.alias.php';
3939
@@ -49,28 +49,28 @@
5050 $wgSpecialPages['MoveThread'] = 'SpecialMoveThread';
5151 $wgSpecialPages['NewMessages'] = 'SpecialNewMessages';
5252
53 -$wgAutoloadClasses['LqtDispatch'] = $dir.'LqtBaseView.php';
54 -$wgAutoloadClasses['LqtView'] = $dir.'LqtBaseView.php';
55 -$wgAutoloadClasses['Date'] = $dir.'classes/LqtDate.php';
56 -$wgAutoloadClasses['Post'] = $dir.'classes/LqtPost.php';
57 -$wgAutoloadClasses['ThreadHistoryIterator'] = $dir.'classes/LqtThreadHistoryIterator.php';
58 -$wgAutoloadClasses['HistoricalThread'] = $dir.'classes/LqtHistoricalThread.php';
59 -$wgAutoloadClasses['Thread'] = $dir.'classes/LqtThread.php';
60 -$wgAutoloadClasses['Threads'] = $dir.'classes/LqtThreads.php';
61 -$wgAutoloadClasses['QueryGroup'] = $dir.'classes/LqtQueryGroup.php';
62 -$wgAutoloadClasses['NewMessages'] = $dir.'classes/LqtNewMessages.php';
63 -$wgAutoloadClasses['TalkpageView'] = $dir.'pages/TalkpageView.php';
64 -$wgAutoloadClasses['TalkpageArchiveView'] = $dir.'pages/TalkpageArchiveView.php';
65 -$wgAutoloadClasses['ThreadPermalinkView'] = $dir.'pages/ThreadPermalinkView.php';
66 -$wgAutoloadClasses['TalkpageHeaderView'] = $dir.'pages/TalkpageHeaderView.php';
67 -$wgAutoloadClasses['IndividualThreadHistoryView'] = $dir.'pages/IndividualThreadHistoryView.php';
68 -$wgAutoloadClasses['ThreadDiffView'] = $dir.'pages/ThreadDiffView.php';
69 -$wgAutoloadClasses['ThreadWatchView'] = $dir.'pages/ThreadWatchView.php';
70 -$wgAutoloadClasses['ThreadProtectionFormView'] = $dir.'pages/ThreadProtectionFormView.php';
71 -$wgAutoloadClasses['ThreadHistoryListingView'] = $dir.'pages/ThreadHistoryListingView.php';
72 -$wgAutoloadClasses['ThreadHistoricalRevisionView'] = $dir.'pages/ThreadHistoricalRevisionView.php';
73 -$wgAutoloadClasses['SummaryPageView'] = $dir.'pages/SummaryPageView.php';
74 -$wgAutoloadClasses['SpecialMoveThread'] = $dir.'pages/SpecialMoveThread.php';
75 -$wgAutoloadClasses['SpecialDeleteThread'] = $dir.'pages/SpecialDeleteThread.php';
76 -$wgAutoloadClasses['NewUserMessagesView'] = $dir.'pages/NewUserMessagesView.php';
77 -$wgAutoloadClasses['SpecialNewMessages'] = $dir.'pages/SpecialNewMessages.php';
\ No newline at end of file
 53+$wgAutoloadClasses['LqtDispatch'] = $dir . 'LqtBaseView.php';
 54+$wgAutoloadClasses['LqtView'] = $dir . 'LqtBaseView.php';
 55+$wgAutoloadClasses['Date'] = $dir . 'classes/LqtDate.php';
 56+$wgAutoloadClasses['Post'] = $dir . 'classes/LqtPost.php';
 57+$wgAutoloadClasses['ThreadHistoryIterator'] = $dir . 'classes/LqtThreadHistoryIterator.php';
 58+$wgAutoloadClasses['HistoricalThread'] = $dir . 'classes/LqtHistoricalThread.php';
 59+$wgAutoloadClasses['Thread'] = $dir . 'classes/LqtThread.php';
 60+$wgAutoloadClasses['Threads'] = $dir . 'classes/LqtThreads.php';
 61+$wgAutoloadClasses['QueryGroup'] = $dir . 'classes/LqtQueryGroup.php';
 62+$wgAutoloadClasses['NewMessages'] = $dir . 'classes/LqtNewMessages.php';
 63+$wgAutoloadClasses['TalkpageView'] = $dir . 'pages/TalkpageView.php';
 64+$wgAutoloadClasses['TalkpageArchiveView'] = $dir . 'pages/TalkpageArchiveView.php';
 65+$wgAutoloadClasses['ThreadPermalinkView'] = $dir . 'pages/ThreadPermalinkView.php';
 66+$wgAutoloadClasses['TalkpageHeaderView'] = $dir . 'pages/TalkpageHeaderView.php';
 67+$wgAutoloadClasses['IndividualThreadHistoryView'] = $dir . 'pages/IndividualThreadHistoryView.php';
 68+$wgAutoloadClasses['ThreadDiffView'] = $dir . 'pages/ThreadDiffView.php';
 69+$wgAutoloadClasses['ThreadWatchView'] = $dir . 'pages/ThreadWatchView.php';
 70+$wgAutoloadClasses['ThreadProtectionFormView'] = $dir . 'pages/ThreadProtectionFormView.php';
 71+$wgAutoloadClasses['ThreadHistoryListingView'] = $dir . 'pages/ThreadHistoryListingView.php';
 72+$wgAutoloadClasses['ThreadHistoricalRevisionView'] = $dir . 'pages/ThreadHistoricalRevisionView.php';
 73+$wgAutoloadClasses['SummaryPageView'] = $dir . 'pages/SummaryPageView.php';
 74+$wgAutoloadClasses['SpecialMoveThread'] = $dir . 'pages/SpecialMoveThread.php';
 75+$wgAutoloadClasses['SpecialDeleteThread'] = $dir . 'pages/SpecialDeleteThread.php';
 76+$wgAutoloadClasses['NewUserMessagesView'] = $dir . 'pages/NewUserMessagesView.php';
 77+$wgAutoloadClasses['SpecialNewMessages'] = $dir . 'pages/SpecialNewMessages.php';
Index: trunk/extensions/LiquidThreads/README
@@ -11,13 +11,13 @@
1212 1. Rename this directory to extensions/LiquidThreads inside your
1313 MediaWiki directory.
1414 2. Add database tables from lqt.sql using the sql.php MediaWiki tool.
15 - (On Unix, if the current directory is the MediaWiki root directory, you can
 15+ (On Unix, if the current directory is the MediaWiki root directory, you can
1616 say "php maintenance/sql.php extensions/LiquidThreads/lqt.sql".)
1717 If you haven't created the AdminSettings.php file, you will have to do that
1818 first; see http://www.mediawiki.org/wiki/Manual:AdminSettings.php
1919 Alternatively, you can run lqt.sql manually (you can use the command
2020 "mysql -u $USER -p -e 'source lqt.sql'" on Unix), but you might have to
21 - edit it first, and replace the /*$wgDBprefix*/ and /*$wgDBTableOptions*/
 21+ edit it first, and replace the /*$wgDBprefix*/ and /*$wgDBTableOptions*/
2222 strings with the corresponding settings.
2323 3. Add this line to the end of your LocalSettings.php:
2424 require_once('extensions/LiquidThreads/LiquidThreads.php');
Index: trunk/extensions/LiquidThreads/classes/LqtThread.php
@@ -1,7 +1,6 @@
22 <?php
3 -if (!defined('MEDIAWIKI')) die;
 3+if ( !defined( 'MEDIAWIKI' ) ) die;
44
5 -
65 class Thread {
76 /* SCHEMA changes must be reflected here. */
87
@@ -57,11 +56,11 @@
5857 return $this->revisionNumber;
5958 }
6059
61 - function atRevision($r) {
 60+ function atRevision( $r ) {
6261 if ( $r == $this->revisionNumber() )
6362 return $this;
6463 else
65 - return HistoricalThread::withIdAtRevision($this->id(), $r);
 64+ return HistoricalThread::withIdAtRevision( $this->id(), $r );
6665 }
6766
6867 function historicalRevisions() {
@@ -69,11 +68,11 @@
7069 $res = $dbr->select(
7170 'historical_thread',
7271 'hthread_contents',
73 - array('hthread_id' => $this->id()),
74 - __METHOD__);
 72+ array( 'hthread_id' => $this->id() ),
 73+ __METHOD__ );
7574 $results = array();
76 - while($l = $dbr->fetchObject($res)) {
77 - $results[] = HistoricalThread::fromTextRepresentation($l->hthread_contents);
 75+ while ( $l = $dbr->fetchObject( $res ) ) {
 76+ $results[] = HistoricalThread::fromTextRepresentation( $l->hthread_contents );
7877 }
7978 return $results;
8079 }
@@ -87,48 +86,48 @@
8887 return Threads::where($where);
8988 }
9089 */
91 - private function bumpRevisionsOnAncestors($change_type, $change_object, $change_reason, $timestamp) {
 90+ private function bumpRevisionsOnAncestors( $change_type, $change_object, $change_reason, $timestamp ) {
9291 global $wgUser; // TODO global.
9392
9493 $this->revisionNumber += 1;
95 - $this->setChangeType($change_type);
96 - $this->setChangeObject($change_object);
 94+ $this->setChangeType( $change_type );
 95+ $this->setChangeObject( $change_object );
9796 $this->changeComment = $change_reason;
9897 $this->changeUser = $wgUser->getID();
9998 $this->changeUserText = $wgUser->getName();
10099
101 - if( $this->hasSuperthread() )
102 - $this->superthread()->bumpRevisionsOnAncestors($change_type, $change_object, $change_reason, $timestamp);
 100+ if ( $this->hasSuperthread() )
 101+ $this->superthread()->bumpRevisionsOnAncestors( $change_type, $change_object, $change_reason, $timestamp );
103102 $dbr =& wfGetDB( DB_MASTER );
104103 $res = $dbr->update( 'thread',
105 - /* SET */ array('thread_revision' => $this->revisionNumber,
106 - 'thread_change_type'=>$this->changeType,
107 - 'thread_change_object'=>$this->changeObject,
 104+ /* SET */ array( 'thread_revision' => $this->revisionNumber,
 105+ 'thread_change_type' => $this->changeType,
 106+ 'thread_change_object' => $this->changeObject,
108107 'thread_change_comment' => $this->changeComment,
109108 'thread_change_user' => $this->changeUser,
110109 'thread_change_user_text' => $this->changeUserText,
111 - 'thread_modified' => $timestamp),
 110+ 'thread_modified' => $timestamp ),
112111 /* WHERE */ array( 'thread_id' => $this->id ),
113 - __METHOD__);
 112+ __METHOD__ );
114113 }
115114
116 - private static function setChangeOnDescendents($thread, $change_type, $change_object) {
 115+ private static function setChangeOnDescendents( $thread, $change_type, $change_object ) {
117116 // TODO this is ludicrously inefficient.
118 - $thread->setChangeType($change_type);
119 - $thread->setChangeObject($change_object);
 117+ $thread->setChangeType( $change_type );
 118+ $thread->setChangeObject( $change_object );
120119 $dbr =& wfGetDB( DB_MASTER );
121120 $res = $dbr->update( 'thread',
122 - /* SET */ array('thread_revision' => $thread->revisionNumber,
123 - 'thread_change_type'=>$thread->changeType,
124 - 'thread_change_object'=>$thread->changeObject),
 121+ /* SET */ array( 'thread_revision' => $thread->revisionNumber,
 122+ 'thread_change_type' => $thread->changeType,
 123+ 'thread_change_object' => $thread->changeObject ),
125124 /* WHERE */ array( 'thread_id' => $thread->id ),
126 - __METHOD__);
127 - foreach($thread->replies() as $r)
128 - self::setChangeOnDescendents($r, $change_type, $change_object);
 125+ __METHOD__ );
 126+ foreach ( $thread->replies() as $r )
 127+ self::setChangeOnDescendents( $r, $change_type, $change_object );
129128 return $thread;
130129 }
131130
132 - function commitRevision($change_type, $change_object = null, $reason = "") {
 131+ function commitRevision( $change_type, $change_object = null, $reason = "" ) {
133132 global $wgUser; // TODO global.
134133 /*
135134 $this->changeComment = $reason;
@@ -138,17 +137,17 @@
139138 // TODO open a transaction.
140139 HistoricalThread::create( $this->double, $change_type, $change_object );
141140
142 - $this->bumpRevisionsOnAncestors($change_type, $change_object, $reason, wfTimestampNow());
143 - self::setChangeOnDescendents($this->topmostThread(), $change_type, $change_object);
 141+ $this->bumpRevisionsOnAncestors( $change_type, $change_object, $reason, wfTimestampNow() );
 142+ self::setChangeOnDescendents( $this->topmostThread(), $change_type, $change_object );
144143
145 - if( $change_type == Threads::CHANGE_REPLY_CREATED
 144+ if ( $change_type == Threads::CHANGE_REPLY_CREATED
146145 && $this->editedness == Threads::EDITED_NEVER ) {
147146 $this->editedness = Threads::EDITED_HAS_REPLY;
148147 }
149 - else if( $change_type == Threads::CHANGE_EDITED_ROOT ) {
150 - if( $wgUser->getId() == 0 || $wgUser->getId() != $this->root()->originalAuthor()->getId() ) {
 148+ else if ( $change_type == Threads::CHANGE_EDITED_ROOT ) {
 149+ if ( $wgUser->getId() == 0 || $wgUser->getId() != $this->root()->originalAuthor()->getId() ) {
151150 $this->editedness = Threads::EDITED_BY_OTHERS;
152 - } else if( $this->editedness == Threads::EDITED_HAS_REPLY ) {
 151+ } else if ( $this->editedness == Threads::EDITED_HAS_REPLY ) {
153152 $this->editedness = Threads::EDITED_BY_AUTHOR;
154153 }
155154 }
@@ -167,59 +166,59 @@
168167 'thread_editedness' => $this->editedness,
169168 ),
170169 /* WHERE */ array( 'thread_id' => $this->id, ),
171 - __METHOD__);
 170+ __METHOD__ );
172171
173 - if( $change_type == Threads::CHANGE_EDITED_ROOT ) {
174 - NewMessages::writeMessageStateForUpdatedThread($this);
 172+ if ( $change_type == Threads::CHANGE_EDITED_ROOT ) {
 173+ NewMessages::writeMessageStateForUpdatedThread( $this );
175174 }
176175 }
177176
178 - function delete($reason) {
 177+ function delete( $reason ) {
179178 $this->type = Threads::TYPE_DELETED;
180179 $this->revisionNumber += 1;
181 - $this->commitRevision(Threads::CHANGE_DELETED, $this, $reason);
 180+ $this->commitRevision( Threads::CHANGE_DELETED, $this, $reason );
182181 /* TODO: mark thread as read by all users, or we get blank thingies in New Messages. */
183182 }
184 - function undelete($reason) {
 183+ function undelete( $reason ) {
185184 $this->type = Threads::TYPE_NORMAL;
186185 $this->revisionNumber += 1;
187 - $this->commitRevision(Threads::CHANGE_UNDELETED, $this, $reason);
 186+ $this->commitRevision( Threads::CHANGE_UNDELETED, $this, $reason );
188187 }
189188
190 - function moveToSubjectPage($title, $reason, $leave_trace) {
 189+ function moveToSubjectPage( $title, $reason, $leave_trace ) {
191190 $dbr =& wfGetDB( DB_MASTER );
192191
193192 $new_articleNamespace = $title->getNamespace();
194193 $new_articleTitle = $title->getDBkey();
195194
196 - foreach($this->replies as $r) {
 195+ foreach ( $this->replies as $r ) {
197196 $res = $dbr->update( 'thread',
198197 /* SET */array(
199198 'thread_revision' => $r->revisionNumber() + 1,
200199 'thread_article_namespace' => $new_articleNamespace,
201 - 'thread_article_title' => $new_articleTitle),
 200+ 'thread_article_title' => $new_articleTitle ),
202201 /* WHERE */ array( 'thread_id' => $r->id(), ),
203 - __METHOD__);
 202+ __METHOD__ );
204203 }
205204
206205 $this->articleNamespace = $new_articleNamespace;
207206 $this->articleTitle = $new_articleTitle;
208207 $this->revisionNumber += 1;
209 - $this->commitRevision(Threads::CHANGE_MOVED_TALKPAGE, null, $reason);
 208+ $this->commitRevision( Threads::CHANGE_MOVED_TALKPAGE, null, $reason );
210209
211 - if($leave_trace) {
212 - $this->leaveTrace($reason);
 210+ if ( $leave_trace ) {
 211+ $this->leaveTrace( $reason );
213212 }
214213 }
215214
216 - function leaveTrace($reason) {
 215+ function leaveTrace( $reason ) {
217216 /* Adapted from Title::moveToNewTitle. But now the new title exists on the old talkpage. */
218217 $dbw =& wfGetDB( DB_MASTER );
219218
220219 $mwRedir = MagicWord::get( 'redirect' );
221220 $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $this->title()->getPrefixedText() . "]]\n";
222221 $redirectArticle = new Article( LqtView::incrementedTitle( $this->subjectWithoutIncrement(),
223 - NS_LQT_THREAD) ); ## TODO move to model.
 222+ NS_LQT_THREAD ) ); # # TODO move to model.
224223 $newid = $redirectArticle->insertOn( $dbw );
225224 $redirectRevision = new Revision( array(
226225 'page' => $newid,
@@ -230,7 +229,7 @@
231230
232231 # Log the move
233232 $log = new LogPage( 'move' );
234 - $log->addEntry( 'move', $this->double->title(), $reason, array( 1 => $this->title()->getPrefixedText()) );
 233+ $log->addEntry( 'move', $this->double->title(), $reason, array( 1 => $this->title()->getPrefixedText() ) );
235234
236235 # Purge caches as per article creation
237236 Article::onArticleCreate( $redirectArticle->getTitle() );
@@ -244,7 +243,7 @@
245244 __METHOD__ );
246245
247246 $thread = Threads::newThread( $redirectArticle, $this->double->article(), null,
248 - Threads::TYPE_MOVED, $log);
 247+ Threads::TYPE_MOVED, $log );
249248
250249 # Purge old title from squid
251250 # The new title, and links to the new title, are purged in Article::onArticleCreate()
@@ -253,7 +252,7 @@
254253
255254
256255
257 - function __construct($line, $children) {
 256+ function __construct( $line, $children ) {
258257 /* SCHEMA changes must be reflected here. */
259258
260259 $this->id = $line->thread_id;
@@ -275,8 +274,8 @@
276275 $this->editedness = $line->thread_editedness;
277276
278277 $root_title = Title::makeTitle( $line->page_namespace, $line->page_title );
279 - $this->root = new Post($root_title);
280 - $this->root->loadPageData($line);
 278+ $this->root = new Post( $root_title );
 279+ $this->root->loadPageData( $line );
281280 $this->rootRevision = $this->root->mLatest;
282281 }
283282
@@ -294,7 +293,7 @@
295294 // Update: this doesn't work for some reason, but why do we update the replies array
296295 // in the first place after creating a new reply?
297296 $new_array = array();
298 - foreach( $this->replies as $r )
 297+ foreach ( $this->replies as $r )
299298 $new_array[] = $r;
300299 $this->replies = $new_array;
301300 }
@@ -304,20 +303,20 @@
305304 These methods do not alter the childrens' superthread field. All they do
306305 is make sure the latest info gets into any historicalthreads we commit.
307306 */
308 - function addReply($thread) {
 307+ function addReply( $thread ) {
309308 // TODO: question for myself to ponder: We don't want the latest info in the
310309 // historical thread, duh. Why were we doing this?
311310 // $this->replies[] = $thread;
312311 }
313 - function removeReplyWithId($id) {
 312+ function removeReplyWithId( $id ) {
314313 $target = null;
315 - foreach($this->replies as $k=>$r) {
316 - if ($r->id() == $id) {
 314+ foreach ( $this->replies as $k => $r ) {
 315+ if ( $r->id() == $id ) {
317316 $target = $k; break;
318317 }
319318 }
320 - if ($target) {
321 - unset($this->replies[$target]);
 319+ if ( $target ) {
 320+ unset( $this->replies[$target] );
322321 return true;
323322 } else {
324323 return false;
@@ -327,13 +326,13 @@
328327 return $this->replies;
329328 }
330329
331 - function setSuperthread($thread) {
 330+ function setSuperthread( $thread ) {
332331 $this->parentId = $thread->id();
333332 $this->ancestorId = $thread->ancestorId();
334333 }
335334
336335 function superthread() {
337 - if( !$this->hasSuperthread() ) {
 336+ if ( !$this->hasSuperthread() ) {
338337 return null;
339338 } else {
340339 return Threads::withId( $this->parentId );
@@ -349,17 +348,17 @@
350349 // if we always use Threads::withId instead of returning $this,
351350 // the historical revision is not incremented and we get a
352351 // duplicate key.
353 - if( $this->ancestorId == $this->id )
 352+ if ( $this->ancestorId == $this->id )
354353 return $this;
355354 else
356355 return Threads::withId( $this->ancestorId );
357356 }
358 -
 357+
359358 function isTopmostThread() {
360359 return $this->ancestorId == $this->id;
361360 }
362361
363 - function setArticle($a) {
 362+ function setArticle( $a ) {
364363 $this->articleId = $a->getID();
365364 $this->articleNamespace = $a->getTitle()->getNamespace();
366365 $this->articleTitle = $a->getTitle()->getDBkey();
@@ -368,14 +367,14 @@
369368
370369 function article() {
371370 if ( $this->article ) return $this->article;
372 - $title = Title::newFromID($this->articleId);
373 - if($title) {
374 - $a = new Article($title);
 371+ $title = Title::newFromID( $this->articleId );
 372+ if ( $title ) {
 373+ $a = new Article( $title );
375374 }
376 - if (isset($a) && $a->exists()) {
 375+ if ( isset( $a ) && $a->exists() ) {
377376 return $a;
378377 } else {
379 - return new Article( Title::makeTitle($this->articleNamespace, $this->articleTitle) );
 378+ return new Article( Title::makeTitle( $this->articleNamespace, $this->articleTitle ) );
380379 }
381380 }
382381
@@ -394,10 +393,10 @@
395394 return $this->root;
396395 }
397396
398 - function setRootRevision($rr) {
399 - if( (is_object($rr)) ) {
 397+ function setRootRevision( $rr ) {
 398+ if ( ( is_object( $rr ) ) ) {
400399 $this->rootRevision = $rr->getId();
401 - } else if (is_int($rr)) {
 400+ } else if ( is_int( $rr ) ) {
402401 $this->rootRevision = $rr;
403402 }
404403 }
@@ -429,9 +428,9 @@
430429 return $this->root()->getTitle();
431430 }
432431
433 - private function splitIncrementFromSubject($subject_string) {
434 - preg_match('/^(.*) \((\d+)\)$/', $subject_string, $matches);
435 - if( count($matches) != 3 )
 432+ private function splitIncrementFromSubject( $subject_string ) {
 433+ preg_match( '/^(.*) \((\d+)\)$/', $subject_string, $matches );
 434+ if ( count( $matches ) != 3 )
436435 throw new MWException( __METHOD__ . ": thread subject has no increment: " . $subject_string );
437436 else
438437 return $matches;
@@ -446,19 +445,19 @@
447446 }
448447
449448 function wikilinkWithoutIncrement() {
450 - $tmp = $this->splitIncrementFromSubject($this->wikilink()); return $tmp[1];
 449+ $tmp = $this->splitIncrementFromSubject( $this->wikilink() ); return $tmp[1];
451450 }
452451
453452 function subjectWithoutIncrement() {
454 - $tmp = $this->splitIncrementFromSubject($this->subject()); return $tmp[1];
 453+ $tmp = $this->splitIncrementFromSubject( $this->subject() ); return $tmp[1];
455454 }
456455
457456 function increment() {
458 - $tmp = $this->splitIncrementFromSubject($this->subject()); return $tmp[2];
 457+ $tmp = $this->splitIncrementFromSubject( $this->subject() ); return $tmp[2];
459458 }
460459
461460 function hasDistinctSubject() {
462 - if( $this->hasSuperthread() ) {
 461+ if ( $this->hasSuperthread() ) {
463462 return $this->superthread()->subjectWithoutIncrement()
464463 != $this->subjectWithoutIncrement();
465464 } else {
@@ -467,7 +466,7 @@
468467 }
469468
470469 function hasSubthreads() {
471 - return count($this->replies) != 0;
 470+ return count( $this->replies ) != 0;
472471 }
473472
474473 function subthreads() {
@@ -490,13 +489,13 @@
491490 return $this->changeType;
492491 }
493492
494 - private function replyWithId($id) {
495 - if( $this->id == $id ) return $this;
 493+ private function replyWithId( $id ) {
 494+ if ( $this->id == $id ) return $this;
496495 foreach ( $this->replies as $r ) {
497 - if( $r->id() == $id ) return $r;
 496+ if ( $r->id() == $id ) return $r;
498497 else {
499 - $s = $r->replyWithId($id);
500 - if( $s ) return $s;
 498+ $s = $r->replyWithId( $id );
 499+ if ( $s ) return $s;
501500 }
502501 }
503502 return null;
@@ -505,17 +504,17 @@
506505 return $this->replyWithId( $this->changeObject );
507506 }
508507
509 - function setChangeType($t) {
510 - if (in_array($t, Threads::$VALID_CHANGE_TYPES)) {
 508+ function setChangeType( $t ) {
 509+ if ( in_array( $t, Threads::$VALID_CHANGE_TYPES ) ) {
511510 $this->changeType = $t;
512511 } else {
513512 throw new MWException( __METHOD__ . ": invalid changeType $t." );
514513 }
515514 }
516515
517 - function setChangeObject($o) {
 516+ function setChangeObject( $o ) {
518517 # we assume $o to be a Thread.
519 - if($o === null) {
 518+ if ( $o === null ) {
520519 $this->changeObject = null;
521520 } else {
522521 $this->changeObject = $o->id();
@@ -523,10 +522,10 @@
524523 }
525524
526525 function changeUser() {
527 - if( $this->changeUser == 0 ) {
528 - return User::newFromName($this->changeUserText, false);
 526+ if ( $this->changeUser == 0 ) {
 527+ return User::newFromName( $this->changeUserText, false );
529528 } else {
530 - return User::newFromId($this->changeUser);
 529+ return User::newFromId( $this->changeUser );
531530 }
532531 }
533532
@@ -535,18 +534,18 @@
536535 }
537536
538537 function redirectThread() {
539 - $rev = Revision::newFromId($this->root()->getLatest());
540 - $rtitle = Title::newFromRedirect($rev->getRawText());
541 - if( !$rtitle ) return null;
542 - $rthread = Threads::withRoot(new Article($rtitle));
 538+ $rev = Revision::newFromId( $this->root()->getLatest() );
 539+ $rtitle = Title::newFromRedirect( $rev->getRawText() );
 540+ if ( !$rtitle ) return null;
 541+ $rthread = Threads::withRoot( new Article( $rtitle ) );
543542 return $rthread;
544543 }
545544
546545 // Called from hook in Title::isProtected.
547 - static function getRestrictionsForTitle($title, $action, &$result) {
548 - $thread = Threads::withRoot(new Post($title));
549 - if ($thread)
550 - return $thread->getRestrictions($action, $result);
 546+ static function getRestrictionsForTitle( $title, $action, &$result ) {
 547+ $thread = Threads::withRoot( new Post( $title ) );
 548+ if ( $thread )
 549+ return $thread->getRestrictions( $action, $result );
551550 else
552551 return true; // not a thread; do normal protection check.
553552 }
@@ -554,16 +553,16 @@
555554 // This only makes sense when called from the hook, because it uses the hook's
556555 // default behavior to check whether this thread itself is protected, so you'll
557556 // get false negatives if you use it from some other context.
558 - function getRestrictions($action, &$result) {
559 - if( $this->hasSuperthread() ) {
560 - $parent_restrictions = $this->superthread()->root()->getTitle()->getRestrictions($action);
 557+ function getRestrictions( $action, &$result ) {
 558+ if ( $this->hasSuperthread() ) {
 559+ $parent_restrictions = $this->superthread()->root()->getTitle()->getRestrictions( $action );
561560 } else {
562 - $parent_restrictions = $this->article()->getTitle()->getTalkPage()->getRestrictions($action);
 561+ $parent_restrictions = $this->article()->getTitle()->getTalkPage()->getRestrictions( $action );
563562 }
564563
565564 // TODO this may not be the same as asking "are the parent restrictions more restrictive than
566565 // our own restrictions?", which is what we really want.
567 - if( count($parent_restrictions) == 0 ) {
 566+ if ( count( $parent_restrictions ) == 0 ) {
568567 return true; // go to normal protection check.
569568 } else {
570569 $result = $parent_restrictions;
@@ -571,4 +570,4 @@
572571 }
573572
574573 }
575 -}
\ No newline at end of file
 574+}
Property changes on: trunk/extensions/LiquidThreads/classes/LqtThread.php
___________________________________________________________________
Added: svn:eol-style
576575 + native
Index: trunk/extensions/LiquidThreads/classes/LqtHistoricalThread.php
@@ -1,8 +1,8 @@
22 <?php
3 -if (!defined('MEDIAWIKI')) die;
 3+if ( !defined( 'MEDIAWIKI' ) ) die;
44
55 class HistoricalThread extends Thread {
6 - function __construct($t) {
 6+ function __construct( $t ) {
77 /* SCHEMA changes must be reflected here. */
88 $this->rootId = $t->rootId;
99 $this->rootRevision = $t->rootRevision;
@@ -24,42 +24,47 @@
2525 $this->editedness = $t->editedness;
2626
2727 $this->replies = array();
28 - foreach ($t->replies as $r) {
29 - $this->replies[] = new HistoricalThread($r);
 28+ foreach ( $t->replies as $r ) {
 29+ $this->replies[] = new HistoricalThread( $r );
3030 }
3131 }
32 - static function textRepresentation($t) {
33 - $ht = new HistoricalThread($t);
34 - return serialize($ht);
 32+
 33+ static function textRepresentation( $t ) {
 34+ $ht = new HistoricalThread( $t );
 35+ return serialize( $ht );
3536 }
36 - static function fromTextRepresentation($r) {
37 - return unserialize($r);
 37+
 38+ static function fromTextRepresentation( $r ) {
 39+ return unserialize( $r );
3840 }
 41+
3942 static function create( $t, $change_type, $change_object ) {
4043 $tmt = $t->topmostThread();
41 - $contents = HistoricalThread::textRepresentation($tmt);
 44+ $contents = HistoricalThread::textRepresentation( $tmt );
4245 $dbr =& wfGetDB( DB_MASTER );
4346 $res = $dbr->insert( 'historical_thread', array(
44 - 'hthread_id'=>$tmt->id(),
45 - 'hthread_revision'=>$tmt->revisionNumber(),
46 - 'hthread_contents'=>$contents,
47 - 'hthread_change_type'=>$tmt->changeType(),
48 - 'hthread_change_object'=>$tmt->changeObject() ? $tmt->changeObject()->id() : null),
 47+ 'hthread_id' => $tmt->id(),
 48+ 'hthread_revision' => $tmt->revisionNumber(),
 49+ 'hthread_contents' => $contents,
 50+ 'hthread_change_type' => $tmt->changeType(),
 51+ 'hthread_change_object' => $tmt->changeObject() ? $tmt->changeObject()->id() : null ),
4952 __METHOD__ );
5053 }
 54+
5155 static function withIdAtRevision( $id, $rev ) {
5256 $dbr =& wfGetDB( DB_SLAVE );
5357 $line = $dbr->selectRow(
5458 'historical_thread',
5559 'hthread_contents',
56 - array('hthread_id' => $id, 'hthread_revision' => $rev),
57 - __METHOD__);
 60+ array( 'hthread_id' => $id, 'hthread_revision' => $rev ),
 61+ __METHOD__ );
5862 if ( $line )
59 - return HistoricalThread::fromTextRepresentation($line->hthread_contents);
 63+ return HistoricalThread::fromTextRepresentation( $line->hthread_contents );
6064 else
6165 return null;
6266 }
 67+
6368 function isHistorical() {
6469 return true;
6570 }
66 -}
\ No newline at end of file
 71+}
Property changes on: trunk/extensions/LiquidThreads/classes/LqtHistoricalThread.php
___________________________________________________________________
Added: svn:eol-style
6772 + native
Index: trunk/extensions/LiquidThreads/classes/LqtThreads.php
@@ -1,5 +1,5 @@
22 <?php
3 -if (!defined('MEDIAWIKI')) die;
 3+if ( !defined( 'MEDIAWIKI' ) ) die;
44
55 /** Module of factory methods. */
66 class Threads {
@@ -7,7 +7,7 @@
88 const TYPE_NORMAL = 0;
99 const TYPE_MOVED = 1;
1010 const TYPE_DELETED = 2;
11 - static $VALID_TYPES = array(self::TYPE_NORMAL, self::TYPE_MOVED, self::TYPE_DELETED);
 11+ static $VALID_TYPES = array( self::TYPE_NORMAL, self::TYPE_MOVED, self::TYPE_DELETED );
1212
1313 const CHANGE_NEW_THREAD = 0;
1414 const CHANGE_REPLY_CREATED = 1;
@@ -16,9 +16,9 @@
1717 const CHANGE_DELETED = 4;
1818 const CHANGE_UNDELETED = 5;
1919 const CHANGE_MOVED_TALKPAGE = 6;
20 - static $VALID_CHANGE_TYPES = array(self::CHANGE_EDITED_SUMMARY, self::CHANGE_EDITED_ROOT,
 20+ static $VALID_CHANGE_TYPES = array( self::CHANGE_EDITED_SUMMARY, self::CHANGE_EDITED_ROOT,
2121 self::CHANGE_REPLY_CREATED, self::CHANGE_NEW_THREAD, self::CHANGE_DELETED, self::CHANGE_UNDELETED,
22 - self::CHANGE_MOVED_TALKPAGE);
 22+ self::CHANGE_MOVED_TALKPAGE );
2323
2424 // Possible values of Thread->editedness.
2525 const EDITED_NEVER = 0;
@@ -35,11 +35,11 @@
3636
3737 $dbw =& wfGetDB( DB_MASTER );
3838
39 - if ( !in_array($type, self::$VALID_TYPES) ) {
40 - throw new MWException(__METHOD__ . ": invalid type $type.");
 39+ if ( !in_array( $type, self::$VALID_TYPES ) ) {
 40+ throw new MWException( __METHOD__ . ": invalid type $type." );
4141 }
4242
43 - if ($superthread) {
 43+ if ( $superthread ) {
4444 $change_type = self::CHANGE_REPLY_CREATED;
4545 } else {
4646 $change_type = self::CHANGE_NEW_THREAD;
@@ -48,36 +48,36 @@
4949 global $wgUser; // TODO global.
5050
5151 $timestamp = wfTimestampNow();
52 -
 52+
5353 // TODO PG support
5454 $newid = $dbw->nextSequenceValue( 'thread_thread_id' );
55 -
56 - $row = array('thread_root' => $root->getID(),
57 - 'thread_parent' => $superthread ? $superthread->id() : null,
58 - 'thread_article_namespace' => $article->getTitle()->getNamespace(),
59 - 'thread_article_title' => $article->getTitle()->getDBkey(),
60 - 'thread_modified' => $timestamp,
61 - 'thread_created' => $timestamp,
62 - 'thread_change_type' => $change_type,
63 - 'thread_change_comment' => "", // TODO
64 - 'thread_change_user' => $wgUser->getID(),
65 - 'thread_change_user_text' => $wgUser->getName(),
66 - 'thread_type' => $type,
67 - 'thread_editedness' => self::EDITED_NEVER);
68 -
69 - if( $superthread ) {
 55+
 56+ $row = array( 'thread_root' => $root->getID(),
 57+ 'thread_parent' => $superthread ? $superthread->id() : null,
 58+ 'thread_article_namespace' => $article->getTitle()->getNamespace(),
 59+ 'thread_article_title' => $article->getTitle()->getDBkey(),
 60+ 'thread_modified' => $timestamp,
 61+ 'thread_created' => $timestamp,
 62+ 'thread_change_type' => $change_type,
 63+ 'thread_change_comment' => "", // TODO
 64+ 'thread_change_user' => $wgUser->getID(),
 65+ 'thread_change_user_text' => $wgUser->getName(),
 66+ 'thread_type' => $type,
 67+ 'thread_editedness' => self::EDITED_NEVER );
 68+
 69+ if ( $superthread ) {
7070 $row['thread_ancestor'] = $superthread->ancestorId();
7171 $row['thread_change_object'] = $newid;
7272 } else {
7373 $row['thread_change_object'] = null;
7474 }
7575
76 - $res = $dbw->insert('thread', $row, __METHOD__);
 76+ $res = $dbw->insert( 'thread', $row, __METHOD__ );
7777
7878 $newid = $dbw->insertId();
79 -
 79+
8080 $row['thread_id'] = $newid;
81 -
 81+
8282 // Ew, we have to do a SECOND update
8383 if ( $superthread ) {
8484 $row['thread_change_object'] = $newid;
@@ -86,45 +86,45 @@
8787 array( 'thread_id' => $newid ),
8888 __METHOD__ );
8989 }
90 -
 90+
9191 // Sigh, convert row to an object
9292 $rowObj = new stdClass();
93 - foreach( $row as $key => $value ) {
 93+ foreach ( $row as $key => $value ) {
9494 $rowObj->$key = $value;
9595 }
9696
9797 // We just created the thread, it won't have any children.
98 - $newthread = new Thread( $rowObj, array() );
99 -
100 - if (!$newthread)
101 - throw new MWException( "No new thread with ID $newid\n" );
102 -
103 - if($superthread) {
 98+ $newthread = new Thread( $rowObj, array() );
 99+
 100+ if ( !$newthread )
 101+ throw new MWException( "No new thread with ID $newid\n" );
 102+
 103+ if ( $superthread ) {
104104 $superthread->addReply( $newthread );
105105 }
106106
107 - self::createTalkpageIfNeeded($article);
 107+ self::createTalkpageIfNeeded( $article );
108108
109 - NewMessages::writeMessageStateForUpdatedThread($newthread);
 109+ NewMessages::writeMessageStateForUpdatedThread( $newthread );
110110
111111 return $newthread;
112 - }
 112+ }
113113
114114 /**
115115 * Create the talkpage if it doesn't exist so that links to it
116116 * will show up blue instead of red. For use upon new thread creation.
117117 */
118 - protected static function createTalkpageIfNeeded($subjectPage) {
 118+ protected static function createTalkpageIfNeeded( $subjectPage ) {
119119 $talkpage_t = $subjectPage->getTitle()->getTalkpage();
120 - $talkpage = new Article($talkpage_t);
121 - if( ! $talkpage->exists() ) {
 120+ $talkpage = new Article( $talkpage_t );
 121+ if ( ! $talkpage->exists() ) {
122122 try {
123123 wfLoadExtensionMessages( 'LiquidThreads' );
124 - $talkpage->doEdit( "", wfMsg('lqt_talkpage_autocreate_summary'), EDIT_NEW | EDIT_SUPPRESS_RC );
 124+ $talkpage->doEdit( "", wfMsg( 'lqt_talkpage_autocreate_summary' ), EDIT_NEW | EDIT_SUPPRESS_RC );
125125
126 - } catch( DBQueryError $e ) {
 126+ } catch ( DBQueryError $e ) {
127127 // The article already existed by now. No need to do anything.
128 - wfDebug(__METHOD__ . ": Article already existed by the time we tried to create it.");
 128+ wfDebug( __METHOD__ . ": Article already existed by the time we tried to create it." );
129129 }
130130 }
131131 }
@@ -133,15 +133,15 @@
134134 $joins = "" ) {
135135 global $wgDBprefix;
136136 $dbr = wfGetDB( DB_SLAVE );
137 - if ( is_array($where) ) $where = $dbr->makeList( $where, LIST_AND );
138 - if ( is_array($options) ) $options = implode(',', $options);
 137+ if ( is_array( $where ) ) $where = $dbr->makeList( $where, LIST_AND );
 138+ if ( is_array( $options ) ) $options = implode( ',', $options );
139139
140 - if( is_array($extra_tables) && count($extra_tables) != 0 ) {
141 - if(!empty($wgDBprefix)) {
142 - foreach($extra_tables as $tablekey=>$extra_table)
143 - $extra_tables[$tablekey]=$wgDBprefix.$extra_table;
 140+ if ( is_array( $extra_tables ) && count( $extra_tables ) != 0 ) {
 141+ if ( !empty( $wgDBprefix ) ) {
 142+ foreach ( $extra_tables as $tablekey => $extra_table )
 143+ $extra_tables[$tablekey] = $wgDBprefix . $extra_table;
144144 }
145 - $tables = implode(',', $extra_tables) . ', ';
 145+ $tables = implode( ',', $extra_tables ) . ', ';
146146 } else if ( is_string( $extra_tables ) ) {
147147 $tables = $extra_tables . ', ';
148148 } else {
@@ -155,20 +155,20 @@
156156 WHERE $where
157157 $options
158158 SQL;
159 - $selection_res = $dbr->query($selection_sql);
 159+ $selection_res = $dbr->query( $selection_sql );
160160
161161 $ancestor_conds = array();
162162 $selection_conds = array();
163 - while( $line = $dbr->fetchObject($selection_res) ) {
 163+ while ( $line = $dbr->fetchObject( $selection_res ) ) {
164164 $ancestor_conds[] = $line->thread_ancestor;
165165 $selection_conds[] = $line->thread_id;
166166 }
167 - if( count($selection_conds) == 0 ) {
 167+ if ( count( $selection_conds ) == 0 ) {
168168 // No threads were found, so we can skip the second query.
169169 return array();
170170 } // List comprehensions, how I miss thee.
171 - $ancestor_clause = join(', ', $ancestor_conds);
172 - $selection_clause = join(', ', $selection_conds);
 171+ $ancestor_clause = join( ', ', $ancestor_conds );
 172+ $selection_clause = join( ', ', $selection_conds );
173173
174174 $children_sql = <<< SQL
175175 SELECT DISTINCT thread.*, page.*,
@@ -178,107 +178,107 @@
179179 AND page.page_id = thread.thread_root
180180 $options
181181 SQL;
182 - $res = $dbr->query($children_sql);
 182+ $res = $dbr->query( $children_sql );
183183
184184 $threads = array();
185185 $top_level_threads = array();
186186 $thread_children = array();
187187
188 - while ( $line = $dbr->fetchObject($res) ) {
189 - $new_thread = new Thread($line, null);
 188+ while ( $line = $dbr->fetchObject( $res ) ) {
 189+ $new_thread = new Thread( $line, null );
190190 $threads[] = $new_thread;
191 - if( $line->selected )
 191+ if ( $line->selected )
192192 // thread is one of those that was directly queried for.
193193 $top_level_threads[] = $new_thread;
194 - if( $line->thread_parent !== null ) {
195 - if( !array_key_exists( $line->thread_parent, $thread_children ) )
 194+ if ( $line->thread_parent !== null ) {
 195+ if ( !array_key_exists( $line->thread_parent, $thread_children ) )
196196 $thread_children[$line->thread_parent] = array();
197197 // Can have duplicate if thread is both top_level and child of another top_level thread.
198 - if( !self::arrayContainsThreadWithId($thread_children[$line->thread_parent], $new_thread->id()) )
 198+ if ( !self::arrayContainsThreadWithId( $thread_children[$line->thread_parent], $new_thread->id() ) )
199199 $thread_children[$line->thread_parent][] = $new_thread;
200200 }
201201 }
202202
203 - foreach( $threads as $thread ) {
204 - if( array_key_exists( $thread->id(), $thread_children ) ) {
 203+ foreach ( $threads as $thread ) {
 204+ if ( array_key_exists( $thread->id(), $thread_children ) ) {
205205 $thread->initWithReplies( $thread_children[$thread->id()] );
206206 } else {
207207 $thread->initWithReplies( array() );
208208 }
209 -
 209+
210210 self::$cache_by_root[$thread->root()->getID()] = $thread;
211211 self::$cache_by_id[$thread->id()] = $thread;
212212 }
213 -
 213+
214214 return $top_level_threads;
215215 }
216216
217217 private static function databaseError( $msg ) {
218218 // TODO tie into MW's error reporting facilities.
219 - throw new MWException("Corrupt liquidthreads database: $msg");
 219+ throw new MWException( "Corrupt liquidthreads database: $msg" );
220220 }
221221
222222 private static function assertSingularity( $threads, $attribute, $value ) {
223 - if( count($threads) == 0 ) { return null; }
224 - if( count($threads) == 1 ) { return $threads[0]; }
225 - if( count($threads) > 1 ) {
226 - Threads::databaseError("More than one thread with $attribute = $value.");
 223+ if ( count( $threads ) == 0 ) { return null; }
 224+ if ( count( $threads ) == 1 ) { return $threads[0]; }
 225+ if ( count( $threads ) > 1 ) {
 226+ Threads::databaseError( "More than one thread with $attribute = $value." );
227227 return null;
228228 }
229229 }
230 -
 230+
231231 private static function arrayContainsThreadWithId( $a, $id ) {
232232 // There's gotta be a nice way to express this in PHP. Anyone?
233 - foreach($a as $t)
234 - if($t->id() == $id)
 233+ foreach ( $a as $t )
 234+ if ( $t->id() == $id )
235235 return true;
236236 return false;
237237 }
238238
239239 static function withRoot( $post ) {
240 - if( $post->getTitle()->getNamespace() != NS_LQT_THREAD ) {
 240+ if ( $post->getTitle()->getNamespace() != NS_LQT_THREAD ) {
241241 // No articles outside the thread namespace have threads associated with them;
242242 // avoiding the query saves time during the TitleGetRestrictions hook.
243243 return null;
244244 }
245 - if( array_key_exists( $post->getID(), self::$cache_by_root ) ) {
 245+ if ( array_key_exists( $post->getID(), self::$cache_by_root ) ) {
246246 return self::$cache_by_root[$post->getID()];
247247 }
248 - $ts = Threads::where( array('thread.thread_root' => $post->getID()) );
249 - return self::assertSingularity($ts, 'thread_root', $post->getID());
 248+ $ts = Threads::where( array( 'thread.thread_root' => $post->getID() ) );
 249+ return self::assertSingularity( $ts, 'thread_root', $post->getID() );
250250 }
251251
252252 static function withId( $id ) {
253 - if( array_key_exists( $id, self::$cache_by_id ) ) {
 253+ if ( array_key_exists( $id, self::$cache_by_id ) ) {
254254 return self::$cache_by_id[$id];
255255 }
256 - $ts = Threads::where( array('thread.thread_id' => $id ) );
257 - return self::assertSingularity($ts, 'thread_id', $id);
 256+ $ts = Threads::where( array( 'thread.thread_id' => $id ) );
 257+ return self::assertSingularity( $ts, 'thread_id', $id );
258258 }
259259
260260 static function withSummary( $article ) {
261 - $ts = Threads::where( array('thread.thread_summary_page' => $article->getId()));
262 - return self::assertSingularity($ts, 'thread_summary_page', $article->getId());
 261+ $ts = Threads::where( array( 'thread.thread_summary_page' => $article->getId() ) );
 262+ return self::assertSingularity( $ts, 'thread_summary_page', $article->getId() );
263263 }
264264
265265 /**
266266 * Horrible, horrible!
267267 * List of months in which there are >0 threads, suitable for threadsOfArticleInMonth. */
268268 static function monthsWhereArticleHasThreads( $article ) {
269 - $threads = Threads::where( Threads::articleClause($article) );
 269+ $threads = Threads::where( Threads::articleClause( $article ) );
270270 $months = array();
271 - foreach( $threads as $t ) {
 271+ foreach ( $threads as $t ) {
272272 $m = substr( $t->modified(), 0, 6 );
273273 if ( !array_key_exists( $m, $months ) ) {
274 - if (!in_array( $m, $months )) $months[] = $m;
 274+ if ( !in_array( $m, $months ) ) $months[] = $m;
275275 }
276276 }
277277 return $months;
278278 }
279279
280 - static function articleClause($article) {
281 - $dbr = wfGetDB(DB_SLAVE);
282 - $q_article= $dbr->addQuotes($article->getTitle()->getDBkey());
 280+ static function articleClause( $article ) {
 281+ $dbr = wfGetDB( DB_SLAVE );
 282+ $q_article = $dbr->addQuotes( $article->getTitle()->getDBkey() );
283283 return <<<SQL
284284 (thread.thread_article_title = $q_article
285285 AND thread.thread_article_namespace = {$article->getTitle()->getNamespace()})
@@ -288,5 +288,4 @@
289289 static function topLevelClause() {
290290 return 'thread.thread_parent is null';
291291 }
292 -
293 -}
\ No newline at end of file
 292+}
Property changes on: trunk/extensions/LiquidThreads/classes/LqtThreads.php
___________________________________________________________________
Added: svn:eol-style
294293 + native
Index: trunk/extensions/LiquidThreads/classes/LqtDate.php
@@ -1,12 +1,12 @@
22 <?php
3 -if (!defined('MEDIAWIKI')) die;
 3+if ( !defined( 'MEDIAWIKI' ) ) die;
44
55 class Date {
66 public $year, $month, $day, $hour, $minute, $second;
77
88 // ex. "20070530033751"
99 function __construct( $text ) {
10 - if ( !strlen( $text ) == 14 || !ctype_digit($text) ) {
 10+ if ( !strlen( $text ) == 14 || !ctype_digit( $text ) ) {
1111 $this->isValid = false;
1212 return null;
1313 }
@@ -17,13 +17,16 @@
1818 $this->minute = intval( substr( $text, 10, 2 ) );
1919 $this->second = intval( substr( $text, 12, 2 ) );
2020 }
 21+
2122 function lastMonth() {
22 - return $this->moved('-1 month');
 23+ return $this->moved( '-1 month' );
2324 }
 25+
2426 function nextMonth() {
25 - return $this->moved('+1 month');
 27+ return $this->moved( '+1 month' );
2628 }
27 - function moved($str) {
 29+
 30+ function moved( $str ) {
2831 // Try to set local timezone to attempt to avoid E_STRICT errors.
2932 global $wgLocaltimezone;
3033 if ( isset( $wgLocaltimezone ) ) {
@@ -45,48 +48,52 @@
4649 // Return the generated date object.
4750 return $date;
4851 }
49 - /* function monthString() {
50 - return sprintf( '%04d%02d', $this->year, $this->month );
 52+
 53+ static function monthString( $text ) {
 54+ return substr( $text, 0, 6 );
5155 }
52 - */
53 - static function monthString($text) {
54 - return substr($text, 0, 6);
55 - }
5656
5757 function delta( $o ) {
5858 $t = clone $this;
59 - $els = array('year', 'month', 'day', 'hour', 'minute', 'second');
 59+ $els = array( 'year', 'month', 'day', 'hour', 'minute', 'second' );
6060 $deltas = array();
61 - foreach ($els as $e) {$deltas[$e] = $t->$e - $o->$e;
 61+ foreach ( $els as $e ) { $deltas[$e] = $t->$e - $o->$e;
6262 $t->$e += $t->$e - $o->$e;
6363 }
6464
6565 // format in style of date().
6666 $result = "";
67 - foreach( $deltas as $name => $val ) {
 67+ foreach ( $deltas as $name => $val ) {
6868 $result .= "$val $name ";
6969 }
7070 return $result;
7171 }
72 - static function beginningOfMonth($yyyymm) { return $yyyymm . '00000000'; }
73 - static function endOfMonth($yyyymm) { return $yyyymm . '31235959'; }
 72+
 73+ static function beginningOfMonth( $yyyymm ) { return $yyyymm . '00000000'; }
 74+
 75+ static function endOfMonth( $yyyymm ) { return $yyyymm . '31235959'; }
 76+
7477 function text() {
7578 return sprintf( '%04d%02d%02d%02d%02d%02d', $this->year, $this->month, $this->day,
7679 $this->hour, $this->minute, $this->second );
7780 }
 81+
7882 static function now() {
79 - return new Date(wfTimestampNow());
 83+ return new Date( wfTimestampNow() );
8084 }
81 - function nDaysAgo($n) {
82 - return $this->moved("-$n days");
 85+
 86+ function nDaysAgo( $n ) {
 87+ return $this->moved( "-$n days" );
8388 }
 89+
8490 function midnight() {
8591 $d = clone $this;
8692 $d->hour = $d->minute = $d->second = 0;
8793 return $d;
8894 }
89 - function isBefore($d) {
90 - foreach(array('year', 'month', 'day', 'hour', 'minute', 'second') as $part) {
 95+
 96+ function isBefore( $d ) {
 97+ foreach ( array( 'year', 'month', 'day', 'hour', 'minute', 'second' ) as $part ) {
9198 if ( $this->$part < $d->$part ) return true;
9299 if ( $this->$part > $d->$part ) return false;
93100 }
Property changes on: trunk/extensions/LiquidThreads/classes/LqtDate.php
___________________________________________________________________
Added: svn:eol-style
94101 + native
Index: trunk/extensions/LiquidThreads/classes/LqtNewMessages.php
@@ -1,39 +1,38 @@
22 <?php
3 -if (!defined('MEDIAWIKI')) die;
 3+if ( !defined( 'MEDIAWIKI' ) ) die;
44
5 -
65 class NewMessages {
76
8 - static function markThreadAsUnreadByUser($thread, $user) {
9 - self::writeUserMessageState($thread, $user, null);
 7+ static function markThreadAsUnreadByUser( $thread, $user ) {
 8+ self::writeUserMessageState( $thread, $user, null );
109 }
1110
12 - static function markThreadAsReadByUser($thread, $user) {
13 - self::writeUserMessageState($thread, $user, wfTimestampNow());
 11+ static function markThreadAsReadByUser( $thread, $user ) {
 12+ self::writeUserMessageState( $thread, $user, wfTimestampNow() );
1413 }
1514
16 - private static function writeUserMessageState($thread, $user, $timestamp) {
 15+ private static function writeUserMessageState( $thread, $user, $timestamp ) {
1716 global $wgDBprefix;
18 - if( is_object($thread) ) $thread_id = $thread->id();
19 - else if( is_integer($thread) ) $thread_id = $thread;
20 - else throw new MWException("writeUserMessageState expected Thread or integer but got $thread");
 17+ if ( is_object( $thread ) ) $thread_id = $thread->id();
 18+ else if ( is_integer( $thread ) ) $thread_id = $thread;
 19+ else throw new MWException( "writeUserMessageState expected Thread or integer but got $thread" );
2120
22 - if( is_object($user) ) $user_id = $user->getID();
23 - else if( is_integer($user) ) $user_id = $user;
24 - else throw new MWException("writeUserMessageState expected User or integer but got $user");
 21+ if ( is_object( $user ) ) $user_id = $user->getID();
 22+ else if ( is_integer( $user ) ) $user_id = $user;
 23+ else throw new MWException( "writeUserMessageState expected User or integer but got $user" );
2524
2625 if ( $timestamp === null ) $timestamp = "NULL";
2726
2827 // use query() directly to pass in 'true' for don't-die-on-errors.
2928 $dbr =& wfGetDB( DB_MASTER );
30 - $success = $dbr->query("insert into {$wgDBprefix}user_message_state values ($user_id, $thread_id, $timestamp)",
31 - __METHOD__, true);
 29+ $success = $dbr->query( "insert into {$wgDBprefix}user_message_state values ($user_id, $thread_id, $timestamp)",
 30+ __METHOD__, true );
3231
33 - if( !$success ) {
 32+ if ( !$success ) {
3433 // duplicate key; update.
35 - $dbr->query("update {$wgDBprefix}user_message_state set ums_read_timestamp = $timestamp" .
36 - " where ums_thread = $thread_id and ums_user = $user_id",
37 - __METHOD__);
 34+ $dbr->query( "update {$wgDBprefix}user_message_state set ums_read_timestamp = $timestamp" .
 35+ " where ums_thread = $thread_id and ums_user = $user_id",
 36+ __METHOD__ );
3837 }
3938 }
4039
@@ -41,15 +40,15 @@
4241 * Write a user_message_state for each user who is watching the thread.
4342 * If the thread is on a user's talkpage, set that user's newtalk.
4443 */
45 - static function writeMessageStateForUpdatedThread($t) {
 44+ static function writeMessageStateForUpdatedThread( $t ) {
4645 global $wgDBprefix, $wgUser;
4746
48 - if( $t->article()->getTitle()->getNamespace() == NS_USER ) {
 47+ if ( $t->article()->getTitle()->getNamespace() == NS_USER ) {
4948 $name = $t->article()->getTitle()->getDBkey();
50 - list($name) = split('/', $name); // subpages
51 - $user = User::newFromName($name);
52 - if( $user && $user->getID() != $wgUser->getID() ) {
53 - $user->setNewtalk(true);
 49+ list( $name ) = split( '/', $name ); // subpages
 50+ $user = User::newFromName( $name );
 51+ if ( $user && $user->getID() != $wgUser->getID() ) {
 52+ $user->setNewtalk( true );
5453 }
5554 }
5655
@@ -58,8 +57,8 @@
5958 $talkpage_t = $t->article()->getTitle();
6059 $root_t = $t->root()->getTitle();
6160
62 - $q_talkpage_t = $dbw->addQuotes($talkpage_t->getDBkey());
63 - $q_root_t = $dbw->addQuotes($root_t->getDBkey());
 61+ $q_talkpage_t = $dbw->addQuotes( $talkpage_t->getDBkey() );
 62+ $q_root_t = $dbw->addQuotes( $root_t->getDBkey() );
6463
6564 // Select any applicable watchlist entries for the thread.
6665 $where_clause = <<<SQL
@@ -71,24 +70,23 @@
7271
7372 // it sucks to not have 'on duplicate key update'. first update users who already have a ums for this thread
7473 // and who have already read it, by setting their state to unread.
75 - $dbw->query("update {$wgDBprefix}user_message_state, {$wgDBprefix}watchlist set ums_read_timestamp = null where ums_user = wl_user and ums_thread = {$t->id()} and $where_clause");
 74+ $dbw->query( "update {$wgDBprefix}user_message_state, {$wgDBprefix}watchlist set ums_read_timestamp = null where ums_user = wl_user and ums_thread = {$t->id()} and $where_clause" );
7675
77 - $dbw->query("insert ignore into {$wgDBprefix}user_message_state (ums_user, ums_thread) select user_id, {$t->id()} from {$wgDBprefix}user, {$wgDBprefix}watchlist where user_id = wl_user and $where_clause;");
 76+ $dbw->query( "insert ignore into {$wgDBprefix}user_message_state (ums_user, ums_thread) select user_id, {$t->id()} from {$wgDBprefix}user, {$wgDBprefix}watchlist where user_id = wl_user and $where_clause;" );
7877 }
7978
80 - static function newUserMessages($user) {
 79+ static function newUserMessages( $user ) {
8180 global $wgDBprefix;
82 - return Threads::where( array('ums_read_timestamp is null',
83 - Threads::articleClause(new Article($user->getUserPage()))),
 81+ return Threads::where( array( 'ums_read_timestamp is null',
 82+ Threads::articleClause( new Article( $user->getUserPage() ) ) ),
8483 array(), array(), "left outer join {$wgDBprefix}user_message_state on ums_user is null or (ums_user = {$user->getID()} and ums_thread = thread.thread_id)" );
8584 }
8685
87 - static function watchedThreadsForUser($user) {
88 - return Threads::where( array('ums_read_timestamp is null',
89 - 'ums_user' => $user->getID(),
90 - 'ums_thread = thread.thread_id',
91 - 'NOT (' . Threads::articleClause(new Article($user->getUserPage())) . ')' ),
92 - array(), array('user_message_state') );
 86+ static function watchedThreadsForUser( $user ) {
 87+ return Threads::where( array( 'ums_read_timestamp is null',
 88+ 'ums_user' => $user->getID(),
 89+ 'ums_thread = thread.thread_id',
 90+ 'NOT (' . Threads::articleClause( new Article( $user->getUserPage() ) ) . ')' ),
 91+ array(), array( 'user_message_state' ) );
9392 }
94 -
95 -}
\ No newline at end of file
 93+}
Property changes on: trunk/extensions/LiquidThreads/classes/LqtNewMessages.php
___________________________________________________________________
Added: svn:eol-style
9694 + native
Index: trunk/extensions/LiquidThreads/classes/LqtQueryGroup.php
@@ -1,5 +1,5 @@
22 <?php
3 -if (!defined('MEDIAWIKI')) die;
 3+if ( !defined( 'MEDIAWIKI' ) ) die;
44
55 class QueryGroup {
66 protected $queries;
@@ -9,24 +9,24 @@
1010 }
1111
1212 function addQuery( $name, $where, $options = array(), $extra_tables = array() ) {
13 - $this->queries[$name] = array($where, $options, $extra_tables);
 13+ $this->queries[$name] = array( $where, $options, $extra_tables );
1414 }
1515
16 - function extendQuery( $original, $newname, $where, $options = array(), $extra_tables=array() ) {
17 - if (!array_key_exists($original,$this->queries)) return;
 16+ function extendQuery( $original, $newname, $where, $options = array(), $extra_tables = array() ) {
 17+ if ( !array_key_exists( $original, $this->queries ) ) return;
1818 $q = $this->queries[$original];
19 - $this->queries[$newname] = array( array_merge($q[0], $where),
20 - array_merge($q[1], $options),
21 - array_merge($q[2], $extra_tables) );
 19+ $this->queries[$newname] = array( array_merge( $q[0], $where ),
 20+ array_merge( $q[1], $options ),
 21+ array_merge( $q[2], $extra_tables ) );
2222 }
2323
2424 function deleteQuery( $name ) {
25 - unset ($this->queries[$name]);
 25+ unset ( $this->queries[$name] );
2626 }
2727
28 - function query($name) {
29 - if ( !array_key_exists($name,$this->queries) ) return array();
30 - list($where, $options, $extra_tables) = $this->queries[$name];
31 - return Threads::where($where, $options, $extra_tables);
 28+ function query( $name ) {
 29+ if ( !array_key_exists( $name, $this->queries ) ) return array();
 30+ list( $where, $options, $extra_tables ) = $this->queries[$name];
 31+ return Threads::where( $where, $options, $extra_tables );
3232 }
3333 }
Property changes on: trunk/extensions/LiquidThreads/classes/LqtQueryGroup.php
___________________________________________________________________
Added: svn:eol-style
3434 + native
Index: trunk/extensions/LiquidThreads/classes/LqtThreadHistoryIterator.php
@@ -1,9 +1,9 @@
22 <?php
3 -if (!defined('MEDIAWIKI')) die;
 3+if ( !defined( 'MEDIAWIKI' ) ) die;
44
55 class ThreadHistoryIterator extends ArrayIterator {
66
7 - function __construct($thread, $limit, $offset) {
 7+ function __construct( $thread, $limit, $offset ) {
88 $this->thread = $thread;
99 $this->limit = $limit;
1010 $this->offset = $offset;
@@ -11,7 +11,7 @@
1212 }
1313
1414 private function loadRows() {
15 - if( $this->offset == 0 ) {
 15+ if ( $this->offset == 0 ) {
1616 $this->append( $this->thread );
1717 $this->limit -= 1;
1818 } else {
@@ -22,13 +22,13 @@
2323 $res = $dbr->select(
2424 'historical_thread',
2525 'hthread_contents, hthread_revision',
26 - array('hthread_id' => $this->thread->id()),
 26+ array( 'hthread_id' => $this->thread->id() ),
2727 __METHOD__,
28 - array('ORDER BY' => 'hthread_revision DESC',
 28+ array( 'ORDER BY' => 'hthread_revision DESC',
2929 'LIMIT' => $this->limit,
30 - 'OFFSET' => $this->offset));
31 - while($l = $dbr->fetchObject($res)) {
32 - $this->append( HistoricalThread::fromTextRepresentation($l->hthread_contents) );
 30+ 'OFFSET' => $this->offset ) );
 31+ while ( $l = $dbr->fetchObject( $res ) ) {
 32+ $this->append( HistoricalThread::fromTextRepresentation( $l->hthread_contents ) );
3333 }
3434 }
35 -}
\ No newline at end of file
 35+}
Property changes on: trunk/extensions/LiquidThreads/classes/LqtThreadHistoryIterator.php
___________________________________________________________________
Added: svn:eol-style
3636 + native
Index: trunk/extensions/LiquidThreads/classes/LqtPost.php
@@ -1,5 +1,5 @@
22 <?php
3 -if (!defined('MEDIAWIKI')) die;
 3+if ( !defined( 'MEDIAWIKI' ) ) die;
44
55 // TODO get rid of this class. sheesh.
66 class Post extends Article {
@@ -10,15 +10,15 @@
1111 function originalAuthor() {
1212 $dbr =& wfGetDB( DB_SLAVE );
1313
14 - $line = $dbr->selectRow( array('revision', 'page'), 'rev_user_text',
15 - array('rev_page = page_id',
16 - 'page_id' => $this->getID()),
 14+ $line = $dbr->selectRow( array( 'revision', 'page' ), 'rev_user_text',
 15+ array( 'rev_page = page_id',
 16+ 'page_id' => $this->getID() ),
1717 __METHOD__,
18 - array('ORDER BY'=> 'rev_timestamp',
19 - 'LIMIT' => '1') );
 18+ array( 'ORDER BY' => 'rev_timestamp',
 19+ 'LIMIT' => '1' ) );
2020 if ( $line )
21 - return User::newFromName($line->rev_user_text, false);
 21+ return User::newFromName( $line->rev_user_text, false );
2222 else
2323 return null;
2424 }
25 -}
\ No newline at end of file
 25+}
Property changes on: trunk/extensions/LiquidThreads/classes/LqtPost.php
___________________________________________________________________
Added: svn:eol-style
2626 + native
Index: trunk/extensions/LiquidThreads/pages/SummaryPageView.php
@@ -1,17 +1,17 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class SummaryPageView extends LqtView {
77 function show() {
88 wfLoadExtensionMessages( 'LiquidThreads' );
9 - $thread = Threads::withSummary($this->article);
10 - if( $thread ) {
 9+ $thread = Threads::withSummary( $this->article );
 10+ if ( $thread ) {
1111 $url = $thread->root()->getTitle()->getFullURL();
1212 $name = $thread->root()->getTitle()->getPrefixedText();
1313 $this->output->setSubtitle(
14 - wfMsg('lqt_summary_subtitle',
15 - '<a href="'.$url.'">'.$name.'</a>'));
 14+ wfMsg( 'lqt_summary_subtitle',
 15+ '<a href="' . $url . '">' . $name . '</a>' ) );
1616 }
1717 return true;
1818 }
Property changes on: trunk/extensions/LiquidThreads/pages/SummaryPageView.php
___________________________________________________________________
Added: svn:eol-style
1919 + native
Index: trunk/extensions/LiquidThreads/pages/TalkpageArchiveView.php
@@ -1,175 +1,175 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class TalkpageArchiveView extends TalkpageView {
7 - function __construct(&$output, &$article, &$title, &$user, &$request) {
8 - parent::__construct($output, $article, $title, $user, $request);
 7+ function __construct( &$output, &$article, &$title, &$user, &$request ) {
 8+ parent::__construct( $output, $article, $title, $user, $request );
99 $this->loadQueryFromRequest();
1010 }
11 -
12 - function showThread($t) {
13 - $this->output->addHTML(<<<HTML
 11+
 12+ function showThread( $t ) {
 13+ $this->output->addHTML( <<<HTML
1414 <tr>
1515 <td><a href="{$this->permalinkUrl($t)}">{$t->subjectWithoutIncrement()}</a></td>
1616 <td>
1717 HTML
18 - ); if( $t->hasSummary() ) {
19 - $this->showPostBody($t->summary());
 18+ ); if ( $t->hasSummary() ) {
 19+ $this->showPostBody( $t->summary() );
2020 } else if ( $t->type() == Threads::TYPE_MOVED ) {
2121 $rthread = $t->redirectThread();
22 - if( $rthread && $rthread->summary() ) {
23 - $this->showPostBody($rthread->summary());
 22+ if ( $rthread && $rthread->summary() ) {
 23+ $this->showPostBody( $rthread->summary() );
2424 }
2525 }
26 - $this->output->addHTML(<<<HTML
 26+ $this->output->addHTML( <<<HTML
2727 </td>
2828 </tr>
2929 HTML
3030 );
3131 }
32 -
 32+
3333 function loadQueryFromRequest() {
3434 wfLoadExtensionMessages( 'LiquidThreads' );
3535 // Begin with with the requirements for being *in* the archive.
36 - $startdate = Date::now()->nDaysAgo($this->archive_start_days)->midnight();
37 - $where = array(Threads::articleClause($this->article),
 36+ $startdate = Date::now()->nDaysAgo( $this->archive_start_days )->midnight();
 37+ $where = array( Threads::articleClause( $this->article ),
3838 'thread.thread_parent is null',
3939 '(thread.thread_summary_page is not null' .
40 - ' OR thread.thread_type = '.Threads::TYPE_MOVED.')',
41 - 'thread.thread_modified < ' . $startdate->text());
42 - $options = array('ORDER BY thread.thread_modified DESC');
43 -
44 - $annotations = array( wfMsg ( 'lqt-searching' ));
45 -
 40+ ' OR thread.thread_type = ' . Threads::TYPE_MOVED . ')',
 41+ 'thread.thread_modified < ' . $startdate->text() );
 42+ $options = array( 'ORDER BY thread.thread_modified DESC' );
 43+
 44+ $annotations = array( wfMsg ( 'lqt-searching' ) );
 45+
4646 $r = $this->request;
47 -
 47+
4848 /* START AND END DATES */
4949 // $this->start and $this->end are clipped into the range of available
5050 // months, for use in the actual query and the selects. $this->raw* are
5151 // as actually provided, for use by the 'older' and 'newer' buttons.
52 - $ignore_dates = ! $r->getVal('lqt_archive_filter_by_date', true);
 52+ $ignore_dates = ! $r->getVal( 'lqt_archive_filter_by_date', true );
5353 if ( !$ignore_dates ) {
54 - $months = Threads::monthsWhereArticleHasThreads($this->article);
 54+ $months = Threads::monthsWhereArticleHasThreads( $this->article );
5555 }
56 - $s = $r->getVal('lqt_archive_start');
57 - if ($s && ctype_digit($s) && strlen($s) == 6 && !$ignore_dates) {
 56+ $s = $r->getVal( 'lqt_archive_start' );
 57+ if ( $s && ctype_digit( $s ) && strlen( $s ) == 6 && !$ignore_dates ) {
5858 $this->selstart = new Date( "{$s}01000000" );
59 - $this->starti = array_search($s, $months);
 59+ $this->starti = array_search( $s, $months );
6060 $where[] = 'thread.thread_modified >= ' . $this->selstart->text();
6161 }
62 - $e = $r->getVal('lqt_archive_end');
63 - if ($e && ctype_digit($e) && strlen($e) == 6 && !$ignore_dates) {
64 - $this->selend = new Date("{$e}01000000");
65 - $this->endi = array_search($e, $months);
 62+ $e = $r->getVal( 'lqt_archive_end' );
 63+ if ( $e && ctype_digit( $e ) && strlen( $e ) == 6 && !$ignore_dates ) {
 64+ $this->selend = new Date( "{$e}01000000" );
 65+ $this->endi = array_search( $e, $months );
6666 $where[] = 'thread.thread_modified < ' . $this->selend->nextMonth()->text();
6767 }
68 - if ( isset($this->selstart) && isset($this->selend) ) {
69 -
 68+ if ( isset( $this->selstart ) && isset( $this->selend ) ) {
 69+
7070 $this->datespan = $this->starti - $this->endi;
71 -
72 - $formattedFrom = $this->formattedMonth($this->selstart->text());
73 - $formattedTo = $this->formattedMonth($this->selend->text());
74 -
75 - if( $this->datespan == 0 ) {
76 - $annotations[] = wfMsg('lqt_archive_month_annotation', $formattedFrom);
 71+
 72+ $formattedFrom = $this->formattedMonth( $this->selstart->text() );
 73+ $formattedTo = $this->formattedMonth( $this->selend->text() );
 74+
 75+ if ( $this->datespan == 0 ) {
 76+ $annotations[] = wfMsg( 'lqt_archive_month_annotation', $formattedFrom );
7777 } else {
78 - $annotations[] = wfMsg('lqt_archive_month_range_annotation', $formattedFrom, $formattedTo);
 78+ $annotations[] = wfMsg( 'lqt_archive_month_range_annotation', $formattedFrom, $formattedTo );
7979 }
80 - } else if (isset($this->selstart)) {
 80+ } else if ( isset( $this->selstart ) ) {
8181 $annotations[] = "after {$this->selstart->text()}";
82 - } else if (isset($this->selend)) {
 82+ } else if ( isset( $this->selend ) ) {
8383 $annotations[] = "before {$this->selend->text()}";
8484 }
85 -
 85+
8686 $this->where = $where;
8787 $this->options = $options;
88 - $this->annotations = implode("<br />\n", $annotations);
 88+ $this->annotations = implode( "<br />\n", $annotations );
8989 }
90 -
 90+
9191 function threads() {
92 - return Threads::where($this->where, $this->options);
 92+ return Threads::where( $this->where, $this->options );
9393 }
94 -
95 - function formattedMonth($yyyymm) {
 94+
 95+ function formattedMonth( $yyyymm ) {
9696 global $wgLang; // TODO global.
97 - return $wgLang->getMonthName( substr($yyyymm, 4, 2) ).' '.substr($yyyymm, 0, 4);
 97+ return $wgLang->getMonthName( substr( $yyyymm, 4, 2 ) ) . ' ' . substr( $yyyymm, 0, 4 );
9898 }
99 -
100 - function monthSelect($months, $name) {
101 - $selection = $this->request->getVal($name);
102 -
 99+
 100+ function monthSelect( $months, $name ) {
 101+ $selection = $this->request->getVal( $name );
 102+
103103 // Silently adjust to stay in range.
104 - $selection = max( min( $selection, $months[0] ), $months[count($months)-1] );
105 -
 104+ $selection = max( min( $selection, $months[0] ), $months[count( $months ) - 1] );
 105+
106106 $options = array();
107 - foreach($months as $m) {
108 - $options[$this->formattedMonth($m)] = $m;
 107+ foreach ( $months as $m ) {
 108+ $options[$this->formattedMonth( $m )] = $m;
109109 }
110110 $result = "<select name=\"$name\" id=\"$name\">";
111 - foreach( $options as $label => $value ) {
 111+ foreach ( $options as $label => $value ) {
112112 $selected = $selection == $value ? 'selected="true"' : '';
113113 $result .= "<option value=\"$value\" $selected>$label";
114114 }
115115 $result .= "</select>";
116116 return $result;
117117 }
118 -
 118+
119119 function clip( $vals, $min, $max ) {
120120 $res = array();
121 - foreach($vals as $val) $res[] = max( min( $val, $max ), $min );
 121+ foreach ( $vals as $val ) $res[] = max( min( $val, $max ), $min );
122122 return $res;
123123 }
124 -
 124+
125125 /* @return True if there are no threads to show, false otherwise.
126126 TODO is is somewhat bizarre. */
127127 function showSearchForm() {
128 - $months = Threads::monthsWhereArticleHasThreads($this->article);
129 - if (count($months) == 0) {
 128+ $months = Threads::monthsWhereArticleHasThreads( $this->article );
 129+ if ( count( $months ) == 0 ) {
130130 return true;
131131 }
132132 wfLoadExtensionMessages( 'LiquidThreads' );
133 -
134 - $use_dates = $this->request->getVal('lqt_archive_filter_by_date', null);
 133+
 134+ $use_dates = $this->request->getVal( 'lqt_archive_filter_by_date', null );
135135 if ( $use_dates === null ) {
136 - $use_dates = $this->request->getBool('lqt_archive_start', false) ||
137 - $this->request->getBool('lqt_archive_end', false);
 136+ $use_dates = $this->request->getBool( 'lqt_archive_start', false ) ||
 137+ $this->request->getBool( 'lqt_archive_end', false );
138138 }
139139 $any_date_check = !$use_dates ? 'checked="1"' : '';
140140 $these_dates_check = $use_dates ? 'checked="1"' : '';
141141 $any_date = wfMsg ( 'lqt-any-date' );
142 - $only_date= wfMsg ( 'lqt-only-date' );
143 - $date_from= wfMsg ( 'lqt-date-from' );
 142+ $only_date = wfMsg ( 'lqt-only-date' );
 143+ $date_from = wfMsg ( 'lqt-date-from' );
144144 $date_to = wfMsg ( 'lqt-date-to' );
145145 $date_info = wfMsg ( 'lqt-date-info' );
146 - if( isset($this->datespan) ) {
 146+ if ( isset( $this->datespan ) ) {
147147 $oatte = $this->starti + 1;
148148 $oatts = $this->starti + 1 + $this->datespan;
149 -
 149+
150150 $natts = $this->endi - 1;
151151 $natte = $this->endi - 1 - $this->datespan;
152 -
153 - list($oe, $os, $ns, $ne) =
154 - $this->clip( array($oatte, $oatts, $natts, $natte),
155 - 0, count($months)-1 );
156 -
157 - $older = '<a class="lqt_newer_older" href="' . $this->queryReplace(array(
158 - 'lqt_archive_filter_by_date'=>'1',
 152+
 153+ list( $oe, $os, $ns, $ne ) =
 154+ $this->clip( array( $oatte, $oatts, $natts, $natte ),
 155+ 0, count( $months ) - 1 );
 156+
 157+ $older = '<a class="lqt_newer_older" href="' . $this->queryReplace( array(
 158+ 'lqt_archive_filter_by_date' => '1',
159159 'lqt_archive_start' => $months[$os],
160 - 'lqt_archive_end' => $months[$oe]))
161 - . '">«'.wfMsg ( 'lqt-older' ).'</a>';
162 - $newer = '<a class="lqt_newer_older" href="' . $this->queryReplace(array(
163 - 'lqt_archive_filter_by_date'=>'1',
 160+ 'lqt_archive_end' => $months[$oe] ) )
 161+ . '">«' . wfMsg ( 'lqt-older' ) . '</a>';
 162+ $newer = '<a class="lqt_newer_older" href="' . $this->queryReplace( array(
 163+ 'lqt_archive_filter_by_date' => '1',
164164 'lqt_archive_start' => $months[$ns],
165 - 'lqt_archive_end' => $months[$ne]))
166 - . '">'.wfMsg ( 'lqt-newer' ).'»</a>';
 165+ 'lqt_archive_end' => $months[$ne] ) )
 166+ . '">' . wfMsg ( 'lqt-newer' ) . '»</a>';
167167 }
168168 else {
169 - $older = '<span class="lqt_newer_older_disabled" title="'.wfMsg ( 'lqt-date-info' ).'">«'.wfMsg ( 'lqt-older' ).'</span>';
170 - $newer = '<span class="lqt_newer_older_disabled" title="'.wfMsg ( 'lqt-date-info' ).'">'.wfMsg ( 'lqt-newer' ).'»</span>';
 169+ $older = '<span class="lqt_newer_older_disabled" title="' . wfMsg ( 'lqt-date-info' ) . '">«' . wfMsg ( 'lqt-older' ) . '</span>';
 170+ $newer = '<span class="lqt_newer_older_disabled" title="' . wfMsg ( 'lqt-date-info' ) . '">' . wfMsg ( 'lqt-newer' ) . '»</span>';
171171 }
172 -
173 - $this->output->addHTML(<<<HTML
 172+
 173+ $this->output->addHTML( <<<HTML
174174 <form id="lqt_archive_search_form" action="{$this->title->getLocalURL()}">
175175 <input type="hidden" name="lqt_method" value="talkpage_archive">
176176 <input type="hidden" name="title" value="{$this->title->getPrefixedURL()}"
@@ -194,23 +194,23 @@
195195 );
196196 return false;
197197 }
198 -
 198+
199199 function show() {
200200 global $wgHooks;
201 - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
202 -
 201+ $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
 202+
203203 $this->output->setPageTitle( $this->title->getTalkpage()->getPrefixedText() );
204204 self::addJSandCSS();
205205 wfLoadExtensionMessages( 'LiquidThreads' );
206 -
 206+
207207 $empty = $this->showSearchForm();
208 - if ($empty) {
209 - $this->output->addHTML('<p><br /><b>'. wfMsg('lqt-nothread' ) . '</b></p>' );
 208+ if ( $empty ) {
 209+ $this->output->addHTML( '<p><br /><b>' . wfMsg( 'lqt-nothread' ) . '</b></p>' );
210210 return false;
211211 }
212 - $lqt_title = wfMsg ( 'lqt-title');
 212+ $lqt_title = wfMsg ( 'lqt-title' );
213213 $lqt_summary = wfMsg ( 'lqt-summary' );
214 - $this->output->addHTML(<<<HTML
 214+ $this->output->addHTML( <<<HTML
215215 <p class="lqt_search_annotations">{$this->annotations}</p>
216216 <table class="lqt_archive_listing">
217217 <col class="lqt_titles" />
@@ -218,11 +218,11 @@
219219 <tr><th>{$lqt_title}<th>{$lqt_summary}</tr>
220220 HTML
221221 );
222 - foreach ($this->threads() as $t) {
223 - $this->showThread($t);
 222+ foreach ( $this->threads() as $t ) {
 223+ $this->showThread( $t );
224224 }
225 - $this->output->addHTML('</table>');
226 -
 225+ $this->output->addHTML( '</table>' );
 226+
227227 return false;
228228 }
229229 }
Property changes on: trunk/extensions/LiquidThreads/pages/TalkpageArchiveView.php
___________________________________________________________________
Added: svn:eol-style
230230 + native
Index: trunk/extensions/LiquidThreads/pages/ThreadPermalinkView.php
@@ -1,10 +1,10 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class ThreadPermalinkView extends LqtView {
77 protected $thread;
8 -
 8+
99 function customizeTabs( $skintemplate, $content_actions ) {
1010 wfLoadExtensionMessages( 'LiquidThreads' );
1111 // Insert fake 'article' and 'discussion' tabs before the thread tab.
@@ -12,112 +12,112 @@
1313 // the access key for the talk tab doesn't work.
1414 $article_t = $this->thread->article()->getTitle();
1515 $talk_t = $this->thread->article()->getTitle()->getTalkPage();
16 - efInsertIntoAssoc('article', array(
17 - 'text'=>wfMsg($article_t->getNamespaceKey()),
18 - 'href'=>$article_t->getFullURL(),
19 - 'class' => $article_t->exists() ? '' : 'new'),
20 - 'nstab-thread', $content_actions);
21 - efInsertIntoAssoc('not_talk', array(
 16+ efInsertIntoAssoc( 'article', array(
 17+ 'text' => wfMsg( $article_t->getNamespaceKey() ),
 18+ 'href' => $article_t->getFullURL(),
 19+ 'class' => $article_t->exists() ? '' : 'new' ),
 20+ 'nstab-thread', $content_actions );
 21+ efInsertIntoAssoc( 'not_talk', array(
2222 // talkpage certainly exists since this thread is from it.
23 - 'text'=>wfMsg('talk'),
24 - 'href'=>$talk_t->getFullURL()),
25 - 'nstab-thread', $content_actions);
26 -
27 - unset($content_actions['edit']);
28 - unset($content_actions['viewsource']);
29 - unset($content_actions['talk']);
30 - if( array_key_exists( 'move', $content_actions ) && $this->thread ) {
 23+ 'text' => wfMsg( 'talk' ),
 24+ 'href' => $talk_t->getFullURL() ),
 25+ 'nstab-thread', $content_actions );
 26+
 27+ unset( $content_actions['edit'] );
 28+ unset( $content_actions['viewsource'] );
 29+ unset( $content_actions['talk'] );
 30+ if ( array_key_exists( 'move', $content_actions ) && $this->thread ) {
3131 $content_actions['move']['href'] =
32 - SpecialPage::getTitleFor('MoveThread')->getFullURL() . '/' .
 32+ SpecialPage::getTitleFor( 'MoveThread' )->getFullURL() . '/' .
3333 $this->thread->title()->getPrefixedURL();
3434 }
35 - if( array_key_exists( 'delete', $content_actions ) && $this->thread ) {
 35+ if ( array_key_exists( 'delete', $content_actions ) && $this->thread ) {
3636 $content_actions['delete']['href'] =
37 - SpecialPage::getTitleFor('DeleteThread')->getFullURL() . '/' .
 37+ SpecialPage::getTitleFor( 'DeleteThread' )->getFullURL() . '/' .
3838 $this->thread->title()->getPrefixedURL();
3939 }
40 -
41 - if( array_key_exists('history', $content_actions) ) {
 40+
 41+ if ( array_key_exists( 'history', $content_actions ) ) {
4242 $content_actions['history']['href'] = $this->permalinkUrl( $this->thread, 'thread_history' );
43 - if( $this->methodApplies('thread_history') ) {
 43+ if ( $this->methodApplies( 'thread_history' ) ) {
4444 $content_actions['history']['class'] = 'selected';
4545 }
4646 }
47 -
 47+
4848 return true;
4949 }
50 -
 50+
5151 function showThreadHeading( $thread ) {
5252 if ( $this->headerLevel == 2 ) {
5353 $this->output->setPageTitle( $thread->wikilink() );
5454 } else {
55 - parent::showThreadHeading($thread);
 55+ parent::showThreadHeading( $thread );
5656 }
5757 }
58 -
 58+
5959 function noSuchRevision() {
6060 wfLoadExtensionMessages( 'LiquidThreads' );
61 - $this->output->addHTML(wfMsg('lqt_nosuchrevision'));
 61+ $this->output->addHTML( wfMsg( 'lqt_nosuchrevision' ) );
6262 }
63 -
 63+
6464 function showMissingThreadPage() {
6565 wfLoadExtensionMessages( 'LiquidThreads' );
66 - $this->output->addHTML(wfMsg('lqt_nosuchthread'));
 66+ $this->output->addHTML( wfMsg( 'lqt_nosuchthread' ) );
6767 }
68 -
 68+
6969 function getSubtitle() {
7070 wfLoadExtensionMessages( 'LiquidThreads' );
7171 // TODO the archive month part is obsolete.
72 - if (Date::now()->nDaysAgo(30)->midnight()->isBefore( new Date($this->thread->modified()) ))
 72+ if ( Date::now()->nDaysAgo( 30 )->midnight()->isBefore( new Date( $this->thread->modified() ) ) )
7373 $query = '';
7474 else
75 - $query = 'lqt_archive_month=' . substr($this->thread->modified(),0,6);
 75+ $query = 'lqt_archive_month=' . substr( $this->thread->modified(), 0, 6 );
7676 $talkpage = $this->thread->article()->getTitle()->getTalkpage();
77 - $talkpage_link = $this->user->getSkin()->makeKnownLinkObj($talkpage, '', $query);
 77+ $talkpage_link = $this->user->getSkin()->makeKnownLinkObj( $talkpage, '', $query );
7878 if ( $this->thread->hasSuperthread() ) {
79 - return wfMsg('lqt_fragment',"<a href=\"{$this->permalinkUrl($this->thread->topmostThread())}\">".wfMsg('lqt_discussion_link')."</a>",$talkpage_link);
 79+ return wfMsg( 'lqt_fragment', "<a href=\"{$this->permalinkUrl($this->thread->topmostThread())}\">" . wfMsg( 'lqt_discussion_link' ) . "</a>", $talkpage_link );
8080 } else {
81 - return wfMsg('lqt_from_talk', $talkpage_link);
 81+ return wfMsg( 'lqt_from_talk', $talkpage_link );
8282 }
8383 }
84 -
85 - function __construct(&$output, &$article, &$title, &$user, &$request) {
86 -
87 - parent::__construct($output, $article, $title, $user, $request);
88 -
 84+
 85+ function __construct( &$output, &$article, &$title, &$user, &$request ) {
 86+
 87+ parent::__construct( $output, $article, $title, $user, $request );
 88+
8989 $t = Threads::withRoot( $this->article );
90 - $r = $this->request->getVal('lqt_oldid', null); if( $r ) {
91 - $t = $t->atRevision($r);
92 - if( !$t ) { $this->noSuchRevision(); return; }
93 -
 90+ $r = $this->request->getVal( 'lqt_oldid', null ); if ( $r ) {
 91+ $t = $t->atRevision( $r );
 92+ if ( !$t ) { $this->noSuchRevision(); return; }
 93+
9494 }
9595 $this->thread = $t;
96 - if( ! $t ) {
 96+ if ( ! $t ) {
9797 return; // error reporting is handled in show(). this kinda sucks.
9898 }
99 -
 99+
100100 // $this->article gets saved to thread_article, so we want it to point to the
101101 // subject page associated with the talkpage, always, not the permalink url.
102102 $this->article = $t->article(); # for creating reply threads.
103 -
 103+
104104 }
105 -
 105+
106106 function show() {
107107 global $wgHooks;
108 - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
109 -
110 - if( ! $this->thread ) {
 108+ $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
 109+
 110+ if ( ! $this->thread ) {
111111 $this->showMissingThreadPage();
112112 return false;
113113 }
114 -
 114+
115115 self::addJSandCSS();
116 - $this->output->setSubtitle($this->getSubtitle());
117 -
118 - if( $this->methodApplies('summarize') )
119 - $this->showSummarizeForm($this->thread);
120 -
121 - $this->showThread($this->thread);
 116+ $this->output->setSubtitle( $this->getSubtitle() );
 117+
 118+ if ( $this->methodApplies( 'summarize' ) )
 119+ $this->showSummarizeForm( $this->thread );
 120+
 121+ $this->showThread( $this->thread );
122122 return false;
123123 }
124124 }
Property changes on: trunk/extensions/LiquidThreads/pages/ThreadPermalinkView.php
___________________________________________________________________
Added: svn:eol-style
125125 + native
Index: trunk/extensions/LiquidThreads/pages/ThreadWatchView.php
@@ -1,11 +1,11 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class ThreadWatchView extends ThreadPermalinkView {
77 function show() {
88 global $wgHooks;
9 - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
 9+ $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
1010 return true;
1111 }
1212 }
Property changes on: trunk/extensions/LiquidThreads/pages/ThreadWatchView.php
___________________________________________________________________
Added: svn:eol-style
1313 + native
Index: trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php
@@ -1,15 +1,15 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class NewUserMessagesView extends LqtView {
7 -
 7+
88 protected $threads;
99 protected $tops;
1010 protected $targets;
11 -
12 - protected function htmlForReadButton($label, $title, $class, $ids) {
13 - $ids_s = implode(',', $ids);
 11+
 12+ protected function htmlForReadButton( $label, $title, $class, $ids ) {
 13+ $ids_s = implode( ',', $ids );
1414 return <<<HTML
1515 <form method="POST" class="{$class}">
1616 <input type="hidden" name="lqt_method" value="mark_as_read" />
@@ -18,28 +18,28 @@
1919 </form>
2020 HTML;
2121 }
22 -
23 - function showReadAllButton($threads) {
 22+
 23+ function showReadAllButton( $threads ) {
2424 wfLoadExtensionMessages( 'LiquidThreads' );
25 - $ids = array_map(create_function('$t', 'return $t->id();'), $threads);
 25+ $ids = array_map( create_function( '$t', 'return $t->id();' ), $threads );
2626 $this->output->addHTML(
2727 $this->htmlForReadButton(
28 - wfMsg('lqt-read-all'),
29 - wfMsg('lqt-read-all-tooltip'),
 28+ wfMsg( 'lqt-read-all' ),
 29+ wfMsg( 'lqt-read-all-tooltip' ),
3030 "lqt_newmessages_read_all_button",
3131 $ids )
3232 );
3333 }
34 -
35 - function preShowThread($t) {
 34+
 35+ function preShowThread( $t ) {
3636 wfLoadExtensionMessages( 'LiquidThreads' );
3737 // $t_ids = implode(',', array_map(create_function('$t', 'return $t->id();'), $this->targets[$t->id()]));
3838 $read_button = $this->htmlForReadButton(
39 - wfMsg('lqt-read-message'),
40 - wfMsg('lqt-read-message-tooltip'),
 39+ wfMsg( 'lqt-read-message' ),
 40+ wfMsg( 'lqt-read-message-tooltip' ),
4141 'lqt_newmessages_read_button',
42 - $this->targets[$t->id()]);
43 - $this->output->addHTML(<<<HTML
 42+ $this->targets[$t->id()] );
 43+ $this->output->addHTML( <<<HTML
4444 <table ><tr>
4545 <td style="padding-right: 1em; vertical-align: top; padding-top: 1em;" >
4646 $read_button
@@ -48,30 +48,30 @@
4949 HTML
5050 );
5151 }
52 -
53 - function postShowThread($t) {
54 - $this->output->addHTML(<<<HTML
 52+
 53+ function postShowThread( $t ) {
 54+ $this->output->addHTML( <<<HTML
5555 </td>
5656 </tr></table>
5757 HTML
5858 );
5959 }
60 -
61 - function showUndo($ids) {
 60+
 61+ function showUndo( $ids ) {
6262 wfLoadExtensionMessages( 'LiquidThreads' );
63 - if( count($ids) == 1 ) {
64 - $t = Threads::withId($ids[0]);
65 - if( !$t )
 63+ if ( count( $ids ) == 1 ) {
 64+ $t = Threads::withId( $ids[0] );
 65+ if ( !$t )
6666 return; // empty or just bogus operand.
67 - $msg = wfMsg( 'lqt-marked-read',$t->subject() );
 67+ $msg = wfMsg( 'lqt-marked-read', $t->subject() );
6868 } else {
69 - $count = count($ids);
70 - $msg = wfMsg( 'lqt-count-marked-read',$count );
 69+ $count = count( $ids );
 70+ $msg = wfMsg( 'lqt-count-marked-read', $count );
7171 }
72 - $operand = implode(',', $ids);
 72+ $operand = implode( ',', $ids );
7373 $lqt_email_undo = wfMsg ( 'lqt-email-undo' );
7474 $lqt_info_undo = wfMsg ( 'lqt-email-info-undo' );
75 - $this->output->addHTML(<<<HTML
 75+ $this->output->addHTML( <<<HTML
7676 <form method="POST" class="lqt_undo_mark_as_read">
7777 $msg
7878 <input type="hidden" name="lqt_method" value="mark_as_unread" />
@@ -81,86 +81,87 @@
8282 HTML
8383 );
8484 }
85 -
86 - function postDivClass($thread) {
 85+
 86+ function postDivClass( $thread ) {
8787 $topid = $thread->topmostThread()->id();
88 - if( in_array($thread->id(), $this->targets[$topid]) )
 88+ if ( in_array( $thread->id(), $this->targets[$topid] ) )
8989 return 'lqt_post_new_message';
9090 else
9191 return 'lqt_post';
9292 }
93 -
 93+
9494 function showOnce() {
9595 self::addJSandCSS();
96 -
97 - if( $this->request->wasPosted() ) {
 96+
 97+ if ( $this->request->wasPosted() ) {
9898 // If they just viewed this page, maybe they still want that notice.
9999 // But if they took the time to dismiss even one message, they
100100 // probably don't anymore.
101 - $this->user->setNewtalk(false);
 101+ $this->user->setNewtalk( false );
102102 }
103 -
104 - if( $this->request->wasPosted() && $this->methodApplies('mark_as_unread') ) {
105 - $ids = explode(',', $this->request->getVal('lqt_operand', ''));
106 - if( $ids !== false ) {
107 - foreach($ids as $id) {
108 - $tmp_thread = Threads::withId($id); if($tmp_thread)
109 - NewMessages::markThreadAsReadByUser($tmp_thread, $this->user);
 103+
 104+ if ( $this->request->wasPosted() && $this->methodApplies( 'mark_as_unread' ) ) {
 105+ $ids = explode( ',', $this->request->getVal( 'lqt_operand', '' ) );
 106+ if ( $ids !== false ) {
 107+ foreach ( $ids as $id ) {
 108+ $tmp_thread = Threads::withId( $id ); if ( $tmp_thread )
 109+ NewMessages::markThreadAsReadByUser( $tmp_thread, $this->user );
110110 }
111111 $this->output->redirect( $this->title->getFullURL() );
112112 }
113113 }
114 -
115 - else if( $this->request->wasPosted() && $this->methodApplies('mark_as_read') ) {
116 - $ids = explode(',', $this->request->getVal('lqt_operand'));
117 - if( $ids !== false ) {
118 - foreach($ids as $id) {
119 - $tmp_thread = Threads::withId($id); if($tmp_thread)
120 - NewMessages::markThreadAsReadByUser($tmp_thread, $this->user);
 114+
 115+ else if ( $this->request->wasPosted() && $this->methodApplies( 'mark_as_read' ) ) {
 116+ $ids = explode( ',', $this->request->getVal( 'lqt_operand' ) );
 117+ if ( $ids !== false ) {
 118+ foreach ( $ids as $id ) {
 119+ $tmp_thread = Threads::withId( $id );
 120+ if ( $tmp_thread )
 121+ NewMessages::markThreadAsReadByUser( $tmp_thread, $this->user );
121122 }
122 - $query = 'lqt_method=undo_mark_as_read&lqt_operand=' . implode(',', $ids);
123 - $this->output->redirect( $this->title->getFullURL($query) );
 123+ $query = 'lqt_method=undo_mark_as_read&lqt_operand=' . implode( ',', $ids );
 124+ $this->output->redirect( $this->title->getFullURL( $query ) );
124125 }
125126 }
126 -
127 - else if( $this->methodApplies('undo_mark_as_read') ) {
128 - $ids = explode(',', $this->request->getVal('lqt_operand', ''));
129 - $this->showUndo($ids);
 127+
 128+ else if ( $this->methodApplies( 'undo_mark_as_read' ) ) {
 129+ $ids = explode( ',', $this->request->getVal( 'lqt_operand', '' ) );
 130+ $this->showUndo( $ids );
130131 }
131132 }
132 -
 133+
133134 function show() {
134135 if ( ! is_array( $this->threads ) ) {
135 - throw new MWException('You must use NewUserMessagesView::setThreads() before calling NewUserMessagesView::show().');
 136+ throw new MWException( 'You must use NewUserMessagesView::setThreads() before calling NewUserMessagesView::show().' );
136137 }
137 -
 138+
138139 // Do everything by id, because we can't depend on reference identity; a simple Thread::withId
139140 // can change the cached value and screw up your references.
140 -
 141+
141142 $this->targets = array();
142143 $this->tops = array();
143 - foreach( $this->threads as $t ) {
 144+ foreach ( $this->threads as $t ) {
144145 $top = $t->topmostThread();
145 - if( !in_array($top->id(), $this->tops) )
 146+ if ( !in_array( $top->id(), $this->tops ) )
146147 $this->tops[] = $top->id();
147 - if( !array_key_exists($top->id(), $this->targets) )
 148+ if ( !array_key_exists( $top->id(), $this->targets ) )
148149 $this->targets[$top->id()] = array();
149150 $this->targets[$top->id()][] = $t->id();
150151 }
151 -
152 - foreach($this->tops as $t_id) {
153 - $t = Threads::withId($t_id);
 152+
 153+ foreach ( $this->tops as $t_id ) {
 154+ $t = Threads::withId( $t_id );
154155 // It turns out that with lqtviews composed of threads from various talkpages,
155156 // each thread is going to have a different article... this is pretty ugly.
156157 $this->article = $t->article();
157 -
158 - $this->preShowThread($t);
159 - $this->showThread($t);
160 - $this->postShowThread($t);
 158+
 159+ $this->preShowThread( $t );
 160+ $this->showThread( $t );
 161+ $this->postShowThread( $t );
161162 }
162163 return false;
163164 }
164 -
 165+
165166 function setThreads( $threads ) {
166167 $this->threads = $threads;
167168 }
Property changes on: trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php
___________________________________________________________________
Added: svn:eol-style
168169 + native
Index: trunk/extensions/LiquidThreads/pages/SpecialDeleteThread.php
@@ -1,15 +1,15 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class SpecialDeleteThread extends UnlistedSpecialPage {
77 private $user, $output, $request, $title, $thread;
8 -
 8+
99 function __construct() {
1010 parent::__construct( 'Deletethread' );
1111 $this->includable( false );
1212 }
13 -
 13+
1414 /**
1515 * @see SpecialPage::getDescription
1616 */
@@ -17,28 +17,29 @@
1818 wfLoadExtensionMessages( 'LiquidThreads' );
1919 return wfMsg( 'lqt_deletethread' );
2020 }
21 -
 21+
2222 function handleGet() {
23 - if( !$this->checkUserRights() ) return;
 23+ if ( !$this->checkUserRights() )
 24+ return;
2425 wfLoadExtensionMessages( 'LiquidThreads' );
25 -
 26+
2627 $form_action = $this->title->getLocalURL() . '/' . $this->thread->title()->getPrefixedURL();
2728 $thread_name = $this->thread->title()->getPrefixedText();
2829 $article_name = $this->thread->article()->getTitle()->getTalkPage()->getPrefixedText();
29 -
 30+
3031 $deleting = $this->thread->type() != Threads::TYPE_DELETED;
31 -
 32+
3233 $operation_message = $deleting ?
33 - wfMsg('lqt_delete_deleting', "<b>$thread_name</b>", '<b>'.wfMsg('lqt_delete_deleting_allreplies').'</b>')
 34+ wfMsg( 'lqt_delete_deleting', "<b>$thread_name</b>", '<b>' . wfMsg( 'lqt_delete_deleting_allreplies' ) . '</b>' )
3435 // "Deleting <b>$thread_name</b> and <b>all replies</b> to it."
35 - : wfMsg('lqt_delete_undeleting', "<b>$thread_name</b>");
 36+ : wfMsg( 'lqt_delete_undeleting', "<b>$thread_name</b>" );
3637 $button_label = $deleting ?
37 - wfMsg('lqt_delete_deletethread')
38 - : wfMsg('lqt_delete_undeletethread');
39 - $part_of = wfMsg('lqt_delete_partof', '<b>'.$article_name.'</b>');
40 - $reason = wfMsg('movereason'); // XXX arguably wrong to use movereason.
41 -
42 - $this->output->addHTML(<<<HTML
 38+ wfMsg( 'lqt_delete_deletethread' )
 39+ : wfMsg( 'lqt_delete_undeletethread' );
 40+ $part_of = wfMsg( 'lqt_delete_partof', '<b>' . $article_name . '</b>' );
 41+ $reason = wfMsg( 'movereason' ); // XXX arguably wrong to use movereason.
 42+
 43+ $this->output->addHTML( <<<HTML
4344 <p>$operation_message
4445 $part_of</p>
4546 <form id="lqt_delete_thread_form" action="{$form_action}" method="POST">
@@ -54,80 +55,80 @@
5556 </form>
5657 HTML
5758 );
58 -
 59+
5960 }
60 -
 61+
6162 function checkUserRights() {
62 - if( in_array('delete', $this->user->getRights()) ) {
 63+ if ( in_array( 'delete', $this->user->getRights() ) ) {
6364 return true;
6465 } else {
6566 wfLoadExtensionMessages( 'LiquidThreads' );
66 - $this->output->addHTML(wfMsg('lqt_delete_unallowed'));
 67+ $this->output->addHTML( wfMsg( 'lqt_delete_unallowed' ) );
6768 return false;
6869 }
6970 }
70 -
71 - function redisplayForm($problem_fields, $message) {
72 - $this->output->addHTML($message);
 71+
 72+ function redisplayForm( $problem_fields, $message ) {
 73+ $this->output->addHTML( $message );
7374 $this->handleGet();
7475 }
75 -
 76+
7677 function handlePost() {
7778 // in theory the model should check rights...
78 - if( !$this->checkUserRights() ) return;
 79+ if ( !$this->checkUserRights() ) return;
7980 wfLoadExtensionMessages( 'LiquidThreads' );
80 -
81 - $reason = $this->request->getVal('lqt_delete_thread_reason', wfMsg('lqt_noreason'));
82 -
 81+
 82+ $reason = $this->request->getVal( 'lqt_delete_thread_reason', wfMsg( 'lqt_noreason' ) );
 83+
8384 // TODO: in theory, two fast-acting sysops could undo each others' work.
8485 $is_deleted_already = $this->thread->type() == Threads::TYPE_DELETED;
8586 if ( $is_deleted_already ) {
86 - $this->thread->undelete($reason);
 87+ $this->thread->undelete( $reason );
8788 } else {
88 - $this->thread->delete($reason);
 89+ $this->thread->delete( $reason );
8990 }
9091 $this->showSuccessMessage( $is_deleted_already );
9192 }
92 -
 93+
9394 function showSuccessMessage( $is_deleted_already ) {
9495 wfLoadExtensionMessages( 'LiquidThreads' );
9596 // TODO talkpageUrl should accept threads, and look up their talk pages.
96 - $talkpage_url = LqtView::talkpageUrl($this->thread->article()->getTitle()->getTalkpage());
97 - $message = $is_deleted_already ? wfMsg('lqt_delete_undeleted') : wfMsg('lqt_delete_deleted');
 97+ $talkpage_url = LqtView::talkpageUrl( $this->thread->article()->getTitle()->getTalkpage() );
 98+ $message = $is_deleted_already ? wfMsg( 'lqt_delete_undeleted' ) : wfMsg( 'lqt_delete_deleted' );
9899 $message .= ' ';
99 - $message .= wfMsg('lqt_delete_return', '<a href="'.$talkpage_url.'">'.wfMsg('lqt_delete_return_link').'</a>');
100 - $this->output->addHTML($message);
 100+ $message .= wfMsg( 'lqt_delete_return', '<a href="' . $talkpage_url . '">' . wfMsg( 'lqt_delete_return_link' ) . '</a>' );
 101+ $this->output->addHTML( $message );
101102 }
102 -
 103+
103104 function execute( $par ) {
104105 global $wgOut, $wgRequest, $wgTitle, $wgUser;
105106 $this->user = $wgUser;
106107 $this->output = $wgOut;
107108 $this->request = $wgRequest;
108109 $this->title = $wgTitle;
109 -
 110+
110111 $this->setHeaders();
111 -
112 - if( $par === null || $par === "") {
 112+
 113+ if ( $par === null || $par === "" ) {
113114 wfLoadExtensionMessages( 'LiquidThreads' );
114 - $this->output->addHTML(wfMsg('lqt_threadrequired'));
 115+ $this->output->addHTML( wfMsg( 'lqt_threadrequired' ) );
115116 return;
116117 }
117118 // TODO should implement Threads::withTitle(...).
118 - $thread = Threads::withRoot( new Article(Title::newFromURL($par)) );
119 - if (!$thread) {
 119+ $thread = Threads::withRoot( new Article( Title::newFromURL( $par ) ) );
 120+ if ( !$thread ) {
120121 wfLoadExtensionMessages( 'LiquidThreads' );
121 - $this->output->addHTML(wfMsg('lqt_nosuchthread'));
 122+ $this->output->addHTML( wfMsg( 'lqt_nosuchthread' ) );
122123 return;
123124 }
124 -
 125+
125126 $this->thread = $thread;
126 -
 127+
127128 if ( $this->request->wasPosted() ) {
128129 $this->handlePost();
129130 } else {
130131 $this->handleGet();
131132 }
132 -
 133+
133134 }
134135 }
Property changes on: trunk/extensions/LiquidThreads/pages/SpecialDeleteThread.php
___________________________________________________________________
Added: svn:eol-style
135136 + native
Index: trunk/extensions/LiquidThreads/pages/ThreadDiffView.php
@@ -1,22 +1,22 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class ThreadDiffView {
77 function customizeTabs( $skintemplate, $content_actions ) {
8 - unset($content_actions['edit']);
9 - unset($content_actions['viewsource']);
10 - unset($content_actions['talk']);
11 -
 8+ unset( $content_actions['edit'] );
 9+ unset( $content_actions['viewsource'] );
 10+ unset( $content_actions['talk'] );
 11+
1212 $content_actions['talk']['class'] = false;
1313 $content_actions['history']['class'] = 'selected';
14 -
 14+
1515 return true;
1616 }
17 -
 17+
1818 function show() {
1919 global $wgHooks;
20 - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
 20+ $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
2121 return true;
2222 }
2323 }
Property changes on: trunk/extensions/LiquidThreads/pages/ThreadDiffView.php
___________________________________________________________________
Added: svn:eol-style
2424 + native
Index: trunk/extensions/LiquidThreads/pages/TalkpageHeaderView.php
@@ -1,40 +1,40 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class TalkpageHeaderView extends LqtView {
77 function customizeTabs( $skintemplate, $content_actions ) {
8 - unset($content_actions['edit']);
9 - unset($content_actions['addsection']);
10 - unset($content_actions['history']);
11 - unset($content_actions['watch']);
12 - unset($content_actions['move']);
13 -
 8+ unset( $content_actions['edit'] );
 9+ unset( $content_actions['addsection'] );
 10+ unset( $content_actions['history'] );
 11+ unset( $content_actions['watch'] );
 12+ unset( $content_actions['move'] );
 13+
1414 $content_actions['talk']['class'] = false;
15 - $content_actions['header'] = array( 'class'=>'selected',
16 - 'text'=>'header',
17 - 'href'=>'');
18 -
 15+ $content_actions['header'] = array( 'class' => 'selected',
 16+ 'text' => 'header',
 17+ 'href' => '' );
 18+
1919 return true;
2020 }
21 -
 21+
2222 function show() {
2323 global $wgHooks, $wgOut, $wgTitle, $wgRequest;
2424 // Why is a hook added here?
25 - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
26 -
27 - if( $wgRequest->getVal('action') === 'edit' ) {
 25+ $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
 26+
 27+ if ( $wgRequest->getVal( 'action' ) === 'edit' ) {
2828 wfLoadExtensionMessages( 'LiquidThreads' );
29 - $warn_bold = '<strong>' . wfMsg('lqt_header_warning_bold') . '</strong>';
30 - $warn_link = '<a href="'.$this->talkpageUrl($wgTitle, 'talkpage_new_thread').'">'.
31 - wfMsg('lqt_header_warning_new_discussion').'</a>';
32 - $wgOut->addHTML('<p class="lqt_header_warning">' .
33 - wfMsg('lqt_header_warning_before_big', $warn_bold, $warn_link) .
34 - '<big>' . wfMsg('lqt_header_warning_big', $warn_bold, $warn_link) . '</big>' .
35 - wfMsg('lqt_header_warning_after_big', $warn_bold, $warn_link) .
36 - '</p>');
 29+ $warn_bold = '<strong>' . wfMsg( 'lqt_header_warning_bold' ) . '</strong>';
 30+ $warn_link = '<a href="' . $this->talkpageUrl( $wgTitle, 'talkpage_new_thread' ) . '">' .
 31+ wfMsg( 'lqt_header_warning_new_discussion' ) . '</a>';
 32+ $wgOut->addHTML( '<p class="lqt_header_warning">' .
 33+ wfMsg( 'lqt_header_warning_before_big', $warn_bold, $warn_link ) .
 34+ '<big>' . wfMsg( 'lqt_header_warning_big', $warn_bold, $warn_link ) . '</big>' .
 35+ wfMsg( 'lqt_header_warning_after_big', $warn_bold, $warn_link ) .
 36+ '</p>' );
3737 }
38 -
 38+
3939 return true;
4040 }
4141 }
Property changes on: trunk/extensions/LiquidThreads/pages/TalkpageHeaderView.php
___________________________________________________________________
Added: svn:eol-style
4242 + native
Index: trunk/extensions/LiquidThreads/pages/IndividualThreadHistoryView.php
@@ -1,47 +1,47 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class IndividualThreadHistoryView extends ThreadPermalinkView {
77 protected $oldid;
8 -
 8+
99 function customizeTabs( $skintemplate, $content_actions ) {
1010 $content_actions['history']['class'] = 'selected';
11 - parent::customizeTabs($skintemplate, $content_actions);
 11+ parent::customizeTabs( $skintemplate, $content_actions );
1212 return true;
1313 }
14 -
 14+
1515 /* This customizes the subtitle of a history *listing* from the hook,
1616 and of an old revision from getSubtitle() below. */
1717 function customizeSubtitle() {
1818 wfLoadExtensionMessages( 'LiquidThreads' );
19 - $msg = wfMsg('lqt_hist_view_whole_thread');
 19+ $msg = wfMsg( 'lqt_hist_view_whole_thread' );
2020 $threadhist = "<a href=\"{$this->permalinkUrl($this->thread->topmostThread(), 'thread_history')}\">$msg</a>";
2121 $this->output->setSubtitle( parent::getSubtitle() . '<br />' . $this->output->getSubtitle() . "<br />$threadhist" );
2222 return true;
2323 }
24 -
 24+
2525 /* */
2626 function getSubtitle() {
27 - $this->article->setOldSubtitle($this->oldid);
 27+ $this->article->setOldSubtitle( $this->oldid );
2828 $this->customizeSubtitle();
2929 return $this->output->getSubtitle();
3030 }
31 -
 31+
3232 function show() {
3333 global $wgHooks;
3434 /*
3535 $this->oldid = $this->request->getVal('oldid', null);
3636 if( $this->oldid !== null ) {
37 -
 37+
3838 parent::show();
3939 return false;
4040 }
4141 */
42 - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
43 -
44 - $wgHooks['PageHistoryBeforeList'][] = array($this, 'customizeSubtitle');
45 -
 42+ $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
 43+
 44+ $wgHooks['PageHistoryBeforeList'][] = array( $this, 'customizeSubtitle' );
 45+
4646 return true;
4747 }
4848 }
Property changes on: trunk/extensions/LiquidThreads/pages/IndividualThreadHistoryView.php
___________________________________________________________________
Added: svn:eol-style
4949 + native
Index: trunk/extensions/LiquidThreads/pages/ThreadProtectionFormView.php
@@ -1,26 +1,26 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class ThreadProtectionFormView {
77 function customizeTabs( $skintemplate, $content_actions ) {
8 - unset($content_actions['edit']);
9 - unset($content_actions['addsection']);
10 - unset($content_actions['viewsource']);
11 - unset($content_actions['talk']);
12 -
 8+ unset( $content_actions['edit'] );
 9+ unset( $content_actions['addsection'] );
 10+ unset( $content_actions['viewsource'] );
 11+ unset( $content_actions['talk'] );
 12+
1313 $content_actions['talk']['class'] = false;
14 - if ( array_key_exists('protect', $content_actions) )
 14+ if ( array_key_exists( 'protect', $content_actions ) )
1515 $content_actions['protect']['class'] = 'selected';
16 - else if ( array_key_exists('unprotect', $content_actions) )
 16+ else if ( array_key_exists( 'unprotect', $content_actions ) )
1717 $content_actions['unprotect']['class'] = 'selected';
18 -
 18+
1919 return true;
2020 }
21 -
 21+
2222 function show() {
2323 global $wgHooks;
24 - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
 24+ $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
2525 return true;
2626 }
2727 }
Property changes on: trunk/extensions/LiquidThreads/pages/ThreadProtectionFormView.php
___________________________________________________________________
Added: svn:eol-style
2828 + native
Index: trunk/extensions/LiquidThreads/pages/ThreadHistoryListingView.php
@@ -1,107 +1,107 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class ThreadHistoryListingView extends ThreadPermalinkView {
7 -
8 - private function rowForThread($t) {
 7+
 8+ private function rowForThread( $t ) {
99 global $wgLang, $wgOut; // TODO global.
1010 wfLoadExtensionMessages( 'LiquidThreads' );
1111 /* TODO: best not to refer to LqtView class directly. */
1212 /* We don't use oldid because that has side-effects. */
1313 $result = array();
14 - $change_names = array( Threads::CHANGE_EDITED_ROOT => wfMsg('lqt_hist_comment_edited'),
15 - Threads::CHANGE_EDITED_SUMMARY => wfMsg('lqt_hist_summary_changed'),
16 - Threads::CHANGE_REPLY_CREATED => wfMsg('lqt_hist_reply_created'),
17 - Threads::CHANGE_NEW_THREAD => wfMsg('lqt_hist_thread_created'),
18 - Threads::CHANGE_DELETED => wfMsg('lqt_hist_deleted'),
19 - Threads::CHANGE_UNDELETED => wfMsg('lqt_hist_undeleted'),
20 - Threads::CHANGE_MOVED_TALKPAGE => wfMsg('lqt_hist_moved_talkpage'));
21 - $change_label = array_key_exists($t->changeType(), $change_names) ? $change_names[$t->changeType()] : "";
22 -
 14+ $change_names = array( Threads::CHANGE_EDITED_ROOT => wfMsg( 'lqt_hist_comment_edited' ),
 15+ Threads::CHANGE_EDITED_SUMMARY => wfMsg( 'lqt_hist_summary_changed' ),
 16+ Threads::CHANGE_REPLY_CREATED => wfMsg( 'lqt_hist_reply_created' ),
 17+ Threads::CHANGE_NEW_THREAD => wfMsg( 'lqt_hist_thread_created' ),
 18+ Threads::CHANGE_DELETED => wfMsg( 'lqt_hist_deleted' ),
 19+ Threads::CHANGE_UNDELETED => wfMsg( 'lqt_hist_undeleted' ),
 20+ Threads::CHANGE_MOVED_TALKPAGE => wfMsg( 'lqt_hist_moved_talkpage' ) );
 21+ $change_label = array_key_exists( $t->changeType(), $change_names ) ? $change_names[$t->changeType()] : "";
 22+
2323 $url = LqtView::permalinkUrlWithQuery( $this->thread, 'lqt_oldid=' . $t->revisionNumber() );
24 -
 24+
2525 $user_id = $t->changeUser()->getID(); # ever heard of a User object?
2626 $user_text = $t->changeUser()->getName();
2727 $sig = $this->user->getSkin()->userLink( $user_id, $user_text ) .
2828 $this->user->getSkin()->userToolLinks( $user_id, $user_text );
29 -
30 - $change_comment=$t->changeComment();
31 - if(!empty($change_comment))
32 - $change_comment="<em>($change_comment)</em>";
33 -
 29+
 30+ $change_comment = $t->changeComment();
 31+ if ( !empty( $change_comment ) )
 32+ $change_comment = "<em>($change_comment)</em>";
 33+
3434 $result[] = "<tr>";
35 - $result[] = "<td><a href=\"$url\">" . $wgLang->timeanddate($t->modified()) . "</a></td>";
 35+ $result[] = "<td><a href=\"$url\">" . $wgLang->timeanddate( $t->modified() ) . "</a></td>";
3636 $result[] = "<td>" . $sig . "</td>";
3737 $result[] = "<td>$change_label</td>";
3838 $result[] = "<td>$change_comment</td>";
3939 $result[] = "</tr>";
40 - return implode('', $result);
 40+ return implode( '', $result );
4141 }
42 -
43 - function showHistoryListing($t) {
 42+
 43+ function showHistoryListing( $t ) {
4444 wfLoadExtensionMessages( 'LiquidThreads' );
45 - $revisions = new ThreadHistoryIterator($t, $this->perPage, $this->perPage * ($this->page - 1));
46 -
47 - $this->output->addHTML('<table>');
48 - foreach($revisions as $ht) {
49 - $this->output->addHTML($this->rowForThread($ht));
 45+ $revisions = new ThreadHistoryIterator( $t, $this->perPage, $this->perPage * ( $this->page - 1 ) );
 46+
 47+ $this->output->addHTML( '<table>' );
 48+ foreach ( $revisions as $ht ) {
 49+ $this->output->addHTML( $this->rowForThread( $ht ) );
5050 }
51 - $this->output->addHTML('</table>');
52 -
53 - if ( count($revisions) == 0 && $this->page == 1 ) {
54 - $this->output->addHTML('<p>'.wfMsg('lqt_hist_no_revisions_error'));
 51+ $this->output->addHTML( '</table>' );
 52+
 53+ if ( count( $revisions ) == 0 && $this->page == 1 ) {
 54+ $this->output->addHTML( '<p>' . wfMsg( 'lqt_hist_no_revisions_error' ) );
5555 }
56 - else if ( count($revisions) == 0 ) {
 56+ else if ( count( $revisions ) == 0 ) {
5757 // we could redirect to the previous page... yow.
58 - $this->output->addHTML('<p>'.wfMsg('lqt_hist_past_last_page_error'));
 58+ $this->output->addHTML( '<p>' . wfMsg( 'lqt_hist_past_last_page_error' ) );
5959 }
60 -
61 - if( $this->page > 1 ) {
62 - $this->output->addHTML( '<a class="lqt_newer_older" href="' . $this->queryReplace(array('lqt_hist_page'=>$this->page - 1)) .'">'.wfMsg('lqt_newer').'</a>' );
 60+
 61+ if ( $this->page > 1 ) {
 62+ $this->output->addHTML( '<a class="lqt_newer_older" href="' . $this->queryReplace( array( 'lqt_hist_page' => $this->page - 1 ) ) . '">' . wfMsg( 'lqt_newer' ) . '</a>' );
6363 } else {
64 - $this->output->addHTML( '<span class="lqt_newer_older_disabled" title="'.wfMsg('lqt_hist_tooltip_newer_disabled').'">'.wfMsg('lqt_newer').'</span>' );
 64+ $this->output->addHTML( '<span class="lqt_newer_older_disabled" title="' . wfMsg( 'lqt_hist_tooltip_newer_disabled' ) . '">' . wfMsg( 'lqt_newer' ) . '</span>' );
6565 }
66 -
 66+
6767 $is_last_page = false;
68 - foreach($revisions as $r)
69 - if( $r->changeType() == Threads::CHANGE_NEW_THREAD )
 68+ foreach ( $revisions as $r )
 69+ if ( $r->changeType() == Threads::CHANGE_NEW_THREAD )
7070 $is_last_page = true;
71 - if( $is_last_page ) {
72 - $this->output->addHTML( '<span class="lqt_newer_older_disabled" title="'.wfMsg('lqt_hist_tooltip_older_disabled').'">'.wfMsg('lqt_older').'</span>' );
 71+ if ( $is_last_page ) {
 72+ $this->output->addHTML( '<span class="lqt_newer_older_disabled" title="' . wfMsg( 'lqt_hist_tooltip_older_disabled' ) . '">' . wfMsg( 'lqt_older' ) . '</span>' );
7373 } else {
74 - $this->output->addHTML( '<a class="lqt_newer_older" href="' . $this->queryReplace(array('lqt_hist_page'=>$this->page + 1)) . '">'.wfMsg('lqt_older').'</a>' );
 74+ $this->output->addHTML( '<a class="lqt_newer_older" href="' . $this->queryReplace( array( 'lqt_hist_page' => $this->page + 1 ) ) . '">' . wfMsg( 'lqt_older' ) . '</a>' );
7575 }
7676 }
77 -
78 - function __construct(&$output, &$article, &$title, &$user, &$request) {
79 - parent::__construct($output, $article, $title, $user, $request);
 77+
 78+ function __construct( &$output, &$article, &$title, &$user, &$request ) {
 79+ parent::__construct( $output, $article, $title, $user, $request );
8080 $this->loadParametersFromRequest();
8181 }
82 -
 82+
8383 function loadParametersFromRequest() {
84 - $this->perPage = $this->request->getInt('lqt_hist_per_page', 10);
85 - $this->page = $this->request->getInt('lqt_hist_page', 1);
 84+ $this->perPage = $this->request->getInt( 'lqt_hist_per_page', 10 );
 85+ $this->page = $this->request->getInt( 'lqt_hist_page', 1 );
8686 }
87 -
 87+
8888 function show() {
8989 global $wgHooks;
90 - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
91 -
92 - if( ! $this->thread ) {
 90+ $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
 91+
 92+ if ( ! $this->thread ) {
9393 $this->showMissingThreadPage();
9494 return false;
9595 }
9696 self::addJSandCSS();
9797 wfLoadExtensionMessages( 'LiquidThreads' );
98 -
99 - $this->output->setSubtitle($this->getSubtitle() . '<br />' . wfMsg('lqt_hist_listing_subtitle'));
100 -
101 - $this->showThreadHeading($this->thread);
102 - $this->showHistoryListing($this->thread);
103 -
104 - $this->showThread($this->thread);
105 -
 98+
 99+ $this->output->setSubtitle( $this->getSubtitle() . '<br />' . wfMsg( 'lqt_hist_listing_subtitle' ) );
 100+
 101+ $this->showThreadHeading( $this->thread );
 102+ $this->showHistoryListing( $this->thread );
 103+
 104+ $this->showThread( $this->thread );
 105+
106106 return false;
107107 }
108108 }
Property changes on: trunk/extensions/LiquidThreads/pages/ThreadHistoryListingView.php
___________________________________________________________________
Added: svn:eol-style
109109 + native
Index: trunk/extensions/LiquidThreads/pages/SpecialMoveThread.php
@@ -1,15 +1,15 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class SpecialMoveThread extends UnlistedSpecialPage {
77 private $user, $output, $request, $title, $thread;
8 -
 8+
99 function __construct() {
1010 parent::__construct( 'Movethread' );
1111 $this->includable( false );
1212 }
13 -
 13+
1414 /**
1515 * @see SpecialPage::getDescription
1616 */
@@ -17,15 +17,15 @@
1818 wfLoadExtensionMessages( 'LiquidThreads' );
1919 return wfMsg( 'lqt_movethread' );
2020 }
21 -
 21+
2222 function handleGet() {
2323 wfLoadExtensionMessages( 'LiquidThreads' );
2424 $form_action = $this->title->getLocalURL() . '/' . $this->thread->title()->getPrefixedURL();
2525 $thread_name = $this->thread->title()->getPrefixedText();
2626 $article_name = $this->thread->article()->getTitle()->getTalkPage()->getPrefixedText();
27 - $edit_url = LqtView::permalinkUrl($this->thread, 'edit', $this->thread);
 27+ $edit_url = LqtView::permalinkUrl( $this->thread, 'edit', $this->thread );
2828 $wfMsg = 'wfMsg'; // functions can only be called within string expansion by variable name.
29 - $this->output->addHTML(<<<HTML
 29+ $this->output->addHTML( <<<HTML
3030 <p>{$wfMsg('lqt_move_movingthread', "<b>$thread_name</b>", "<b>$article_name</b>")}</p>
3131 <p>{$wfMsg('lqt_move_torename', "<a href=\"$edit_url\">{$wfMsg('lqt_move_torename_edit')}</a>")}</p>
3232 <form id="lqt_move_thread_form" action="$form_action" method="POST">
@@ -44,9 +44,9 @@
4545 </form>
4646 HTML
4747 );
48 -
 48+
4949 }
50 -
 50+
5151 function checkUserRights() {
5252 if ( !$this->user->isAllowed( 'move' ) ) {
5353 $this->output->showErrorPage( 'movenologin', 'movenologintext' );
@@ -67,66 +67,66 @@
6868 /* Am I forgetting anything? */
6969 return true;
7070 }
71 -
72 - function redisplayForm($problem_fields, $message) {
73 - $this->output->addHTML($message);
 71+
 72+ function redisplayForm( $problem_fields, $message ) {
 73+ $this->output->addHTML( $message );
7474 $this->handleGet();
7575 }
76 -
 76+
7777 function handlePost() {
78 - if( !$this->checkUserRights() ) return;
 78+ if ( !$this->checkUserRights() ) return;
7979 wfLoadExtensionMessages( 'LiquidThreads' );
80 -
81 - $tmp = $this->request->getVal('lqt_move_thread_target_title');
82 - if( $tmp === "" ) {
83 - $this->redisplayForm(array('lqt_move_thread_target_title'), wfMsg('lqt_move_nodestination'));
 80+
 81+ $tmp = $this->request->getVal( 'lqt_move_thread_target_title' );
 82+ if ( $tmp === "" ) {
 83+ $this->redisplayForm( array( 'lqt_move_thread_target_title' ), wfMsg( 'lqt_move_nodestination' ) );
8484 return;
8585 }
8686 $newtitle = Title::newFromText( $tmp )->getSubjectPage();
87 -
88 - $reason = $this->request->getVal('lqt_move_thread_reason', wfMsg('lqt_noreason'));
89 -
 87+
 88+ $reason = $this->request->getVal( 'lqt_move_thread_reason', wfMsg( 'lqt_noreason' ) );
 89+
9090 // TODO no status code from this method.
9191 $this->thread->moveToSubjectPage( $newtitle, $reason, true );
92 -
 92+
9393 $this->showSuccessMessage( $newtitle->getTalkPage() );
9494 }
95 -
 95+
9696 function showSuccessMessage( $target_title ) {
9797 wfLoadExtensionMessages( 'LiquidThreads' );
98 - $this->output->addHTML(wfMsg('lqt_move_success',
99 - '<a href="'.$target_title->getFullURL().'">'.$target_title->getPrefixedText().'</a>'));
 98+ $this->output->addHTML( wfMsg( 'lqt_move_success',
 99+ '<a href="' . $target_title->getFullURL() . '">' . $target_title->getPrefixedText() . '</a>' ) );
100100 }
101 -
 101+
102102 function execute( $par ) {
103103 global $wgOut, $wgRequest, $wgTitle, $wgUser;
104104 $this->user = $wgUser;
105105 $this->output = $wgOut;
106106 $this->request = $wgRequest;
107107 $this->title = $wgTitle;
108 -
 108+
109109 $this->setHeaders();
110 -
111 - if( $par === null || $par === "") {
 110+
 111+ if ( $par === null || $par === "" ) {
112112 wfLoadExtensionMessages( 'LiquidThreads' );
113 - $this->output->addHTML(wfMsg('lqt_threadrequired'));
 113+ $this->output->addHTML( wfMsg( 'lqt_threadrequired' ) );
114114 return;
115115 }
116116 // TODO should implement Threads::withTitle(...).
117 - $thread = Threads::withRoot( new Article(Title::newFromURL($par)) );
118 - if (!$thread) {
 117+ $thread = Threads::withRoot( new Article( Title::newFromURL( $par ) ) );
 118+ if ( !$thread ) {
119119 wfLoadExtensionMessages( 'LiquidThreads' );
120 - $this->output->addHTML(wfMsg('lqt_nosuchthread'));
 120+ $this->output->addHTML( wfMsg( 'lqt_nosuchthread' ) );
121121 return;
122122 }
123 -
 123+
124124 $this->thread = $thread;
125 -
 125+
126126 if ( $this->request->wasPosted() ) {
127127 $this->handlePost();
128128 } else {
129129 $this->handleGet();
130130 }
131 -
 131+
132132 }
133133 }
Property changes on: trunk/extensions/LiquidThreads/pages/SpecialMoveThread.php
___________________________________________________________________
Added: svn:eol-style
134134 + native
Index: trunk/extensions/LiquidThreads/pages/SpecialNewMessages.php
@@ -1,15 +1,15 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class SpecialNewMessages extends SpecialPage {
77 private $user, $output, $request, $title;
8 -
 8+
99 function __construct() {
1010 SpecialPage::SpecialPage( 'Newmessages' );
1111 $this->includable( true );
1212 }
13 -
 13+
1414 /**
1515 * @see SpecialPage::getDescription
1616 */
@@ -17,7 +17,7 @@
1818 wfLoadExtensionMessages( 'LiquidThreads' );
1919 return wfMsg( 'lqt_newmessages' );
2020 }
21 -
 21+
2222 function execute( $par ) {
2323 global $wgOut, $wgRequest, $wgTitle, $wgUser;
2424 wfLoadExtensionMessages( 'LiquidThreads' );
@@ -25,30 +25,30 @@
2626 $this->output = $wgOut;
2727 $this->request = $wgRequest;
2828 $this->title = $wgTitle;
29 -
 29+
3030 $this->setHeaders();
31 -
32 - $view = new NewUserMessagesView( $this->output, new Article($this->title),
 31+
 32+ $view = new NewUserMessagesView( $this->output, new Article( $this->title ),
3333 $this->title, $this->user, $this->request );
34 -
 34+
3535 $view->showOnce(); // handles POST etc.
36 -
37 - $first_set = NewMessages::newUserMessages($this->user);
38 - $second_set = NewMessages::watchedThreadsForUser($this->user);
39 - $both_sets = array_merge($first_set, $second_set);
40 - if( count($both_sets) == 0 ) {
41 - $wgOut->addWikitext( wfMsg('lqt-no-new-messages') );
 36+
 37+ $first_set = NewMessages::newUserMessages( $this->user );
 38+ $second_set = NewMessages::watchedThreadsForUser( $this->user );
 39+ $both_sets = array_merge( $first_set, $second_set );
 40+ if ( count( $both_sets ) == 0 ) {
 41+ $wgOut->addWikitext( wfMsg( 'lqt-no-new-messages' ) );
4242 return;
4343 }
44 - $view->showReadAllButton($both_sets); // ugly hack.
45 -
46 - $view->setHeaderLevel(3);
47 -
48 - $this->output->addHTML('<h2 class="lqt_newmessages_section">'.wfMsg ( 'lqt-messages-sent' ).'</h2>');
 44+ $view->showReadAllButton( $both_sets ); // ugly hack.
 45+
 46+ $view->setHeaderLevel( 3 );
 47+
 48+ $this->output->addHTML( '<h2 class="lqt_newmessages_section">' . wfMsg ( 'lqt-messages-sent' ) . '</h2>' );
4949 $view->setThreads( $first_set );
5050 $view->show();
51 -
52 - $this->output->addHTML('<h2 class="lqt_newmessages_section">'.wfMsg ( 'lqt-other-messages' ).'</h2>');
 51+
 52+ $this->output->addHTML( '<h2 class="lqt_newmessages_section">' . wfMsg ( 'lqt-other-messages' ) . '</h2>' );
5353 $view->setThreads( $second_set );
5454 $view->show();
5555 }
Property changes on: trunk/extensions/LiquidThreads/pages/SpecialNewMessages.php
___________________________________________________________________
Added: svn:eol-style
5656 + native
Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php
@@ -1,18 +1,18 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class TalkpageView extends LqtView {
77 /* Added to SkinTemplateTabs hook in TalkpageView::show(). */
88 function customizeTabs( $skintemplate, $content_actions ) {
99 // The arguments are passed in by reference.
10 - unset($content_actions['edit']);
11 - unset($content_actions['viewsource']);
12 - unset($content_actions['addsection']);
13 - unset($content_actions['history']);
14 - unset($content_actions['watch']);
15 - unset($content_actions['move']);
16 -
 10+ unset( $content_actions['edit'] );
 11+ unset( $content_actions['viewsource'] );
 12+ unset( $content_actions['addsection'] );
 13+ unset( $content_actions['history'] );
 14+ unset( $content_actions['watch'] );
 15+ unset( $content_actions['move'] );
 16+
1717 /*
1818 TODO:
1919 We could make these tabs actually follow the tab metaphor if we repointed
@@ -22,120 +22,120 @@
2323 */
2424 return true;
2525 }
26 -
27 - function permalinksForThreads($ts, $method = null, $operand = null) {
 26+
 27+ function permalinksForThreads( $ts, $method = null, $operand = null ) {
2828 $ps = array();
29 - foreach ($ts as $t) {
30 - $u = $this->permalinkUrl($t, $method, $operand);
 29+ foreach ( $ts as $t ) {
 30+ $u = $this->permalinkUrl( $t, $method, $operand );
3131 $l = $t->subjectWithoutIncrement();
3232 $ps[] = "<a href=\"$u\">$l</a>";
3333 }
3434 return $ps;
3535 }
36 -
 36+
3737 function showHeader() {
3838 /* Show the contents of the actual talkpage article if it exists. */
39 -
 39+
4040 $article = new Article( $this->title );
41 - $revision = Revision::newFromId($article->getLatest());
42 - if( $revision ) $article_text = $revision->getRawText();
43 -
44 - $oldid = $this->request->getVal('oldid', null);
 41+ $revision = Revision::newFromId( $article->getLatest() );
 42+ if ( $revision ) $article_text = $revision->getRawText();
 43+
 44+ $oldid = $this->request->getVal( 'oldid', null );
4545 $editlink = $this->title->getFullURL( 'action=edit' );
46 -
 46+
4747 wfLoadExtensionMessages( 'LiquidThreads' );
4848 // If $article_text == "", the talkpage was probably just created
4949 // when the first thread was posted to make the links blue.
5050 if ( $article->exists() && $article_text != "" ) {
5151 $historylink = $this->title->getFullURL( 'action=history' );
52 - $this->openDiv('lqt_header_content');
53 - $this->showPostBody($article, $oldid);
54 - $this->outputList('ul', 'lqt_header_commands', null, array(
55 - "[<a href=\"$editlink\">".wfMsg('edit')."&uarr;</a>]",
56 - "[<a href=\"$historylink\">".wfMsg('history_short')."&uarr;</a>]"
57 - ));
 52+ $this->openDiv( 'lqt_header_content' );
 53+ $this->showPostBody( $article, $oldid );
 54+ $this->outputList( 'ul', 'lqt_header_commands', null, array(
 55+ "[<a href=\"$editlink\">" . wfMsg( 'edit' ) . "&uarr;</a>]",
 56+ "[<a href=\"$historylink\">" . wfMsg( 'history_short' ) . "&uarr;</a>]"
 57+ ) );
5858 $this->closeDiv();
5959 } else {
60 - $this->output->addHTML("<p class=\"lqt_header_notice\">[<a href=\"$editlink\">".wfMsg('lqt_add_header')."</a>]</p>");
 60+ $this->output->addHTML( "<p class=\"lqt_header_notice\">[<a href=\"$editlink\">" . wfMsg( 'lqt_add_header' ) . "</a>]</p>" );
6161 }
6262 }
63 -
 63+
6464 function outputList( $kind, $class, $id, $contents ) {
65 - $this->output->addHTML(Xml::openElement($kind, array('class'=>$class,'id'=>$id)));
66 - foreach ($contents as $li) {
67 - $this->output->addHTML( Xml::openElement('li') );
 65+ $this->output->addHTML( Xml::openElement( $kind, array( 'class' => $class, 'id' => $id ) ) );
 66+ foreach ( $contents as $li ) {
 67+ $this->output->addHTML( Xml::openElement( 'li' ) );
6868 $this->output->addHTML( $li );
69 - $this->output->addHTML( Xml::closeElement('li') );
 69+ $this->output->addHTML( Xml::closeElement( 'li' ) );
7070 }
71 - $this->output->addHTML(Xml::closeElement($kind));
 71+ $this->output->addHTML( Xml::closeElement( $kind ) );
7272 }
73 -
74 - function showTOC($threads) {
 73+
 74+ function showTOC( $threads ) {
7575 wfLoadExtensionMessages( 'LiquidThreads' );
76 -
 76+
7777 $sk = $this->user->getSkin();
7878 $toclines = array();
7979 $i = 1;
8080 $toclines[] = $sk->tocIndent();
81 - foreach($threads as $t) {
82 - $toclines[] = $sk->tocLine($this->anchorName($t), $t->subjectWithoutIncrement(), $i, 1);
 81+ foreach ( $threads as $t ) {
 82+ $toclines[] = $sk->tocLine( $this->anchorName( $t ), $t->subjectWithoutIncrement(), $i, 1 );
8383 $i++;
8484 }
85 - $toclines[] = $sk->tocUnindent(1);
86 -
87 - $this->openDiv('lqt_toc_wrapper');
88 - $this->output->addHTML('<h2 class="lqt_toc_title">'.wfMsg('lqt_contents_title').'</h2> <ul>');
89 -
90 - foreach($threads as $t) {
91 - $this->output->addHTML('<li><a href="#'.$this->anchorName($t).'">'.$t->subjectWithoutIncrement().'</a></li>');
 85+ $toclines[] = $sk->tocUnindent( 1 );
 86+
 87+ $this->openDiv( 'lqt_toc_wrapper' );
 88+ $this->output->addHTML( '<h2 class="lqt_toc_title">' . wfMsg( 'lqt_contents_title' ) . '</h2> <ul>' );
 89+
 90+ foreach ( $threads as $t ) {
 91+ $this->output->addHTML( '<li><a href="#' . $this->anchorName( $t ) . '">' . $t->subjectWithoutIncrement() . '</a></li>' );
9292 }
93 -
94 - $this->output->addHTML('</ul></div>');
 93+
 94+ $this->output->addHTML( '</ul></div>' );
9595 }
96 -
97 - function showArchiveWidget($threads) {
 96+
 97+ function showArchiveWidget( $threads ) {
9898 wfLoadExtensionMessages( 'LiquidThreads' );
99 -
100 - $threadlinks = $this->permalinksForThreads($threads);
101 - $url = $this->talkpageUrl($this->title, 'talkpage_archive');
102 -
103 - if ( count($threadlinks) > 0 ) {
104 - $this->openDiv('lqt_archive_teaser');
105 - $this->output->addHTML('<h2 class="lqt_recently_archived">'.wfMsg('lqt_recently_archived').'</h2>');
 99+
 100+ $threadlinks = $this->permalinksForThreads( $threads );
 101+ $url = $this->talkpageUrl( $this->title, 'talkpage_archive' );
 102+
 103+ if ( count( $threadlinks ) > 0 ) {
 104+ $this->openDiv( 'lqt_archive_teaser' );
 105+ $this->output->addHTML( '<h2 class="lqt_recently_archived">' . wfMsg( 'lqt_recently_archived' ) . '</h2>' );
106106 // $this->output->addHTML("<span class=\"lqt_browse_archive\">[<a href=\"$url\">".wfMsg('lqt_browse_archive_with_recent')."</a>]</span></h2>");
107 - $this->outputList('ul', '', '', $threadlinks);
 107+ $this->outputList( 'ul', '', '', $threadlinks );
108108 $this->closeDiv();
109109 } else {
110110 }
111111 }
112 -
113 - function showTalkpageViewOptions($article) {
 112+
 113+ function showTalkpageViewOptions( $article ) {
114114 wfLoadExtensionMessages( 'LiquidThreads' );
115115 // TODO WTF who wrote this?
116 -
117 - if( $this->methodApplies('talkpage_sort_order') ) {
118 - $remember_sort_checked = $this->request->getBool('lqt_remember_sort') ? 'checked ' : '';
119 - $this->user->setOption('lqt_sort_order', $this->sort_order);
 116+
 117+ if ( $this->methodApplies( 'talkpage_sort_order' ) ) {
 118+ $remember_sort_checked = $this->request->getBool( 'lqt_remember_sort' ) ? 'checked ' : '';
 119+ $this->user->setOption( 'lqt_sort_order', $this->sort_order );
120120 $this->user->saveSettings();
121121 } else {
122122 $remember_sort_checked = '';
123 - }
124 -
125 - if($article->exists()) {
126 - $nc_sort = $this->sort_order==LQT_NEWEST_CHANGES ? ' selected' : '';
127 - $nt_sort = $this->sort_order==LQT_NEWEST_THREADS ? ' selected' : '';
128 - $ot_sort = $this->sort_order==LQT_OLDEST_THREADS ? ' selected' : '';
129 - $newest_changes = wfMsg('lqt_sort_newest_changes');
130 - $newest_threads = wfMsg('lqt_sort_newest_threads');
131 - $oldest_threads = wfMsg('lqt_sort_oldest_threads');
132 - $lqt_remember_sort = wfMsg('lqt_remember_sort') ;
133 - $form_action_url = $this->talkpageUrl( $this->title, 'talkpage_sort_order');
134 - $lqt_sorting_order = wfMsg('lqt_sorting_order');
135 - $lqt_sort_newest_changes = wfMsg('lqt_sort_newest_changes');
136 - $lqt_sort_newest_threads = wfMsg('lqt_sort_newest_threads');
137 - $lqt_sort_oldest_threads = wfMsg('lqt_sort_oldest_threads');
138 - $go=wfMsg('go');
139 - if($this->user->isLoggedIn()) {
 123+ }
 124+
 125+ if ( $article->exists() ) {
 126+ $nc_sort = $this->sort_order == LQT_NEWEST_CHANGES ? ' selected' : '';
 127+ $nt_sort = $this->sort_order == LQT_NEWEST_THREADS ? ' selected' : '';
 128+ $ot_sort = $this->sort_order == LQT_OLDEST_THREADS ? ' selected' : '';
 129+ $newest_changes = wfMsg( 'lqt_sort_newest_changes' );
 130+ $newest_threads = wfMsg( 'lqt_sort_newest_threads' );
 131+ $oldest_threads = wfMsg( 'lqt_sort_oldest_threads' );
 132+ $lqt_remember_sort = wfMsg( 'lqt_remember_sort' ) ;
 133+ $form_action_url = $this->talkpageUrl( $this->title, 'talkpage_sort_order' );
 134+ $lqt_sorting_order = wfMsg( 'lqt_sorting_order' );
 135+ $lqt_sort_newest_changes = wfMsg( 'lqt_sort_newest_changes' );
 136+ $lqt_sort_newest_threads = wfMsg( 'lqt_sort_newest_threads' );
 137+ $lqt_sort_oldest_threads = wfMsg( 'lqt_sort_oldest_threads' );
 138+ $go = wfMsg( 'go' );
 139+ if ( $this->user->isLoggedIn() ) {
140140 $remember_sort =
141141 <<<HTML
142142 <br />
@@ -146,8 +146,8 @@
147147 } else {
148148 $remember_sort = '';
149149 }
150 - if ( in_array('deletedhistory', $this->user->getRights()) ) {
151 - $show_deleted_checked = $this->request->getBool('lqt_show_deleted_threads') ? 'checked ' : '';
 150+ if ( in_array( 'deletedhistory', $this->user->getRights() ) ) {
 151+ $show_deleted_checked = $this->request->getBool( 'lqt_show_deleted_threads' ) ? 'checked ' : '';
152152 $show_deleted = "<br />\n" .
153153 "<label for=\"lqt_show_deleted_threads_checkbox\">\n" .
154154 "<input id=\"lqt_show_deleted_threads_checkbox\" name=\"lqt_show_deleted_threads\" type=\"checkbox\" value=\"1\" $show_deleted_checked />\n" .
@@ -155,9 +155,9 @@
156156 } else {
157157 $show_deleted = "";
158158 }
159 - $this->openDiv('lqt_view_options');
 159+ $this->openDiv( 'lqt_view_options' );
160160 $this->output->addHTML(
161 -
 161+
162162 <<<HTML
163163 <form name="lqt_sort" action="$form_action_url" method="post">$lqt_sorting_order
164164 <select name="lqt_order" class="lqt_sort_select">
@@ -173,50 +173,50 @@
174174 );
175175 $this->closeDiv();
176176 }
177 -
 177+
178178 }
179 -
 179+
180180 function show() {
181181 global $wgHooks;
182182 wfLoadExtensionMessages( 'LiquidThreads' );
183183 // Why is a hook added here?
184 - $wgHooks['SkinTemplateTabs'][] = array($this, 'customizeTabs');
185 -
 184+ $wgHooks['SkinTemplateTabs'][] = array( $this, 'customizeTabs' );
 185+
186186 $this->output->setPageTitle( $this->title->getTalkpage()->getPrefixedText() );
187187 self::addJSandCSS();
188188 $article = new Article( $this->title ); // Added in r29715 sorting. Why?
189 -
 189+
190190 // Removed in r29715 sorting. Again, why?
191191 $this->showHeader();
192192
193193 global $wgRequest; // TODO
194 - if( $this->methodApplies('talkpage_new_thread') ) {
 194+ if ( $this->methodApplies( 'talkpage_new_thread' ) ) {
195195 $this->showNewThreadForm();
196196 } else {
197 - $this->showTalkpageViewOptions($article);
 197+ $this->showTalkpageViewOptions( $article );
198198 $url = $this->talkpageUrl( $this->title, 'talkpage_new_thread' );
199 - $this->output->addHTML("<strong><a class=\"lqt_start_discussion\" href=\"$url\">".wfMsg('lqt_new_thread')."</a></strong>");
 199+ $this->output->addHTML( "<strong><a class=\"lqt_start_discussion\" href=\"$url\">" . wfMsg( 'lqt_new_thread' ) . "</a></strong>" );
200200 }
201 -
202 - $threads = $this->queries->query('fresh');
203 -
204 - $this->openDiv('lqt_toc_archive_wrapper');
205 -
206 - $this->openDiv('lqt_archive_teaser_empty');
207 - $this->output->addHTML("<div class=\"lqt_browse_archive\"><a href=\"{$this->talkpageUrl($this->title, 'talkpage_archive')}\">".
208 - wfMsg('lqt_browse_archive_without_recent')."</a></div>");
 201+
 202+ $threads = $this->queries->query( 'fresh' );
 203+
 204+ $this->openDiv( 'lqt_toc_archive_wrapper' );
 205+
 206+ $this->openDiv( 'lqt_archive_teaser_empty' );
 207+ $this->output->addHTML( "<div class=\"lqt_browse_archive\"><a href=\"{$this->talkpageUrl($this->title, 'talkpage_archive')}\">" .
 208+ wfMsg( 'lqt_browse_archive_without_recent' ) . "</a></div>" );
209209 $this->closeDiv();
210 - $recently_archived_threads = $this->queries->query('recently-archived');
211 - if(count($threads) > 3 || count($recently_archived_threads) > 0) {
212 - $this->showTOC($threads);
 210+ $recently_archived_threads = $this->queries->query( 'recently-archived' );
 211+ if ( count( $threads ) > 3 || count( $recently_archived_threads ) > 0 ) {
 212+ $this->showTOC( $threads );
213213 }
214 - $this->showArchiveWidget($recently_archived_threads);
 214+ $this->showArchiveWidget( $recently_archived_threads );
215215 $this->closeDiv();
216216 // Clear any floats
217 - $this->output->addHTML('<br clear="all" />');
218 -
219 - foreach($threads as $t) {
220 - $this->showThread($t);
 217+ $this->output->addHTML( '<br clear="all" />' );
 218+
 219+ foreach ( $threads as $t ) {
 220+ $this->showThread( $t );
221221 }
222222 return false;
223223 }
Property changes on: trunk/extensions/LiquidThreads/pages/TalkpageView.php
___________________________________________________________________
Added: svn:eol-style
224224 + native
Index: trunk/extensions/LiquidThreads/pages/ThreadHistoricalRevisionView.php
@@ -1,12 +1,12 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die;
 4+if ( !defined( 'MEDIAWIKI' ) ) die;
55
66 class ThreadHistoricalRevisionView extends ThreadPermalinkView {
7 -
 7+
88 /* TOOD: customize tabs so that History is highlighted. */
9 -
10 - function postDivClass($thread) {
 9+
 10+ function postDivClass( $thread ) {
1111 $is_changed_thread = $thread->changeObject() &&
1212 $thread->changeObject()->id() == $thread->id();
1313 if ( $is_changed_thread )
@@ -14,26 +14,26 @@
1515 else
1616 return 'lqt_post';
1717 }
18 -
 18+
1919 function showHistoryInfo() {
2020 global $wgLang; // TODO global.
2121 wfLoadExtensionMessages( 'LiquidThreads' );
22 - $this->openDiv('lqt_history_info');
23 - $this->output->addHTML(wfMsg('lqt_revision_as_of', $wgLang->timeanddate($this->thread->modified())) .'<br />' );
24 -
 22+ $this->openDiv( 'lqt_history_info' );
 23+ $this->output->addHTML( wfMsg( 'lqt_revision_as_of', $wgLang->timeanddate( $this->thread->modified() ) ) . '<br />' );
 24+
2525 $ct = $this->thread->changeType();
26 - if( $ct == Threads::CHANGE_NEW_THREAD ) $msg = wfMsg('lqt_change_new_thread');
27 - else if( $ct == Threads::CHANGE_REPLY_CREATED ) $msg = wfMsg('lqt_change_reply_created');
28 - else if( $ct == Threads::CHANGE_EDITED_ROOT ) {
29 - $diff_url = $this->permalinkUrlWithDiff($this->thread);
30 - $msg = wfMsg('lqt_change_edited_root') . " [<a href=\"$diff_url\">" . wfMsg('diff') . '</a>]';
 26+ if ( $ct == Threads::CHANGE_NEW_THREAD ) $msg = wfMsg( 'lqt_change_new_thread' );
 27+ else if ( $ct == Threads::CHANGE_REPLY_CREATED ) $msg = wfMsg( 'lqt_change_reply_created' );
 28+ else if ( $ct == Threads::CHANGE_EDITED_ROOT ) {
 29+ $diff_url = $this->permalinkUrlWithDiff( $this->thread );
 30+ $msg = wfMsg( 'lqt_change_edited_root' ) . " [<a href=\"$diff_url\">" . wfMsg( 'diff' ) . '</a>]';
3131 }
32 - $this->output->addHTML($msg);
 32+ $this->output->addHTML( $msg );
3333 $this->closeDiv();
3434 }
35 -
 35+
3636 function show() {
37 - if( ! $this->thread ) {
 37+ if ( ! $this->thread ) {
3838 $this->showMissingThreadPage();
3939 return false;
4040 }
Property changes on: trunk/extensions/LiquidThreads/pages/ThreadHistoricalRevisionView.php
___________________________________________________________________
Added: svn:eol-style
4141 + native

Status & tagging log