r41044 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41043‎ | r41044 | r41045 >
Date:19:13, 19 September 2008
Author:aaron
Status:old
Tags:
Comment:
Add option to show curid in urls. Useful for google news and WN.
Modified paths:
  • /trunk/extensions/intersection/DynamicPageList.php (modified) (history)

Diff [purge]

Index: trunk/extensions/intersection/DynamicPageList.php
@@ -89,6 +89,8 @@
9090
9191 $bNamespace = false;
9292 $iNamespace = 0;
 93+
 94+ $bShowCurId = false;
9395
9496 $bSuppressErrors = false;
9597 $bShowNamespace = true;
@@ -270,6 +272,13 @@
271273 else
272274 $bShowNamespace = true;
273275 }
 276+ else if ('showcurid' == $sType )
 277+ {
 278+ if ('false' == $sArg)
 279+ $bShowCurId = false;
 280+ else
 281+ $bShowCurId = true;
 282+ }
274283 }
275284
276285 $iCatCount = count($aCategories);
@@ -325,7 +334,7 @@
326335 $dbr =& wfGetDB( DB_SLAVE );
327336 $sPageTable = $dbr->tableName( 'page' );
328337 $categorylinks = $dbr->tableName( 'categorylinks' );
329 - $sSqlSelectFrom = "SELECT page_namespace, page_title, c1.cl_timestamp FROM $sPageTable";
 338+ $sSqlSelectFrom = "SELECT page_namespace, page_title, page_id, c1.cl_timestamp FROM $sPageTable";
330339
331340 if (true == $bNamespace)
332341 $sSqlWhere = ' WHERE page_namespace='.$iNamespace.' ';
@@ -422,9 +431,9 @@
423432 if ($dbr->numRows( $res ) == 0)
424433 {
425434 if (false == $bSuppressErrors)
426 - return htmlspecialchars( wfMsg( 'intersection_noresults' ) );
 435+ return htmlspecialchars( wfMsg( 'intersection_noresults' ) );
427436 else
428 - return '';
 437+ return '';
429438 }
430439
431440 //start unordered list
@@ -438,10 +447,15 @@
439448 if (true == $bAddFirstCategoryDate)
440449 $output .= $wgLang->date($row->cl_timestamp) . ': ';
441450
 451+ $query = '';
 452+ if (true == $bShowCurId)
 453+ $query = 'curid='.intval($row->page_id);
 454+
442455 if (true == $bShowNamespace)
443 - $output .= $sk->makeKnownLinkObj($title);
 456+ $output .= $sk->makeKnownLinkObj($title, htmlspecialchars($title->getPrefixedText()),$query);
444457 else
445 - $output .= $sk->makeKnownLinkObj($title, htmlspecialchars($title->getText()));
 458+ $output .= $sk->makeKnownLinkObj($title, htmlspecialchars($title->getText()),$query);
 459+
446460 $output .= $sEndItem . "\n";
447461 }
448462