2004-02-18 02:15:00 +00:00
|
|
|
<?php
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
# shortcut to get the current language "special" namespace name
|
|
|
|
|
function sns() {
|
2003-04-14 23:10:40 +00:00
|
|
|
global $wgLang ;
|
|
|
|
|
$ns = $wgLang->getNamespaces() ;
|
2004-08-15 18:28:02 +00:00
|
|
|
return $ns[NS_SPECIAL] ;
|
2003-07-02 06:22:03 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
|
|
|
|
|
# Entry point
|
|
|
|
|
function wfSpecialMaintenance( $par=NULL ) {
|
2004-04-01 12:55:59 +00:00
|
|
|
global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest, $wgLanguageCode;
|
2004-07-10 03:09:26 +00:00
|
|
|
global $wgMiserMode;
|
2004-04-01 12:55:59 +00:00
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
# This pages is expensive ressource wise
|
2003-04-14 23:10:40 +00:00
|
|
|
if ( $wgMiserMode ) {
|
2004-08-15 18:28:02 +00:00
|
|
|
$wgOut->addWikiText( wfMsg( 'perfdisabled' ) );
|
2003-04-14 23:10:40 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2003-07-02 06:22:03 +00:00
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
# Get parameters from the URL
|
2004-04-01 12:55:59 +00:00
|
|
|
$submitmll = $wgRequest->getVal( 'submitmll' );
|
2004-07-10 03:09:26 +00:00
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
if( $par ) {
|
2003-07-02 06:22:03 +00:00
|
|
|
$subfunction = $par;
|
2004-08-15 18:28:02 +00:00
|
|
|
} else {
|
2004-04-01 12:55:59 +00:00
|
|
|
$subfunction = $wgRequest->getText( 'subfunction' );
|
2004-08-15 18:28:02 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
# Call the subfunction requested by the user
|
|
|
|
|
switch( $subfunction ) {
|
|
|
|
|
case 'disambiguations': return wfSpecialDisambiguations() ; break;
|
|
|
|
|
case 'doubleredirects': return wfSpecialDoubleRedirects() ; break;
|
|
|
|
|
case 'brokenredirects': return wfSpecialBrokenRedirects() ; break;
|
|
|
|
|
case 'selflinks': return wfSpecialSelfLinks() ; break;
|
|
|
|
|
case 'mispeelings': return wfSpecialMispeelings() ; break;
|
|
|
|
|
case 'missinglanguagelinks': return wfSpecialMissingLanguageLinks() ; break;
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-10 03:09:26 +00:00
|
|
|
if ( !is_null( $submitmll ) ) return wfSpecialMissingLanguageLinks() ;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
|
|
|
|
$sk = $wgUser->getSkin();
|
|
|
|
|
$ns = $wgLang->getNamespaces() ;
|
2004-08-15 18:28:02 +00:00
|
|
|
|
|
|
|
|
# Generate page output
|
|
|
|
|
|
|
|
|
|
$r = wfMsg('maintnancepagetext') ;
|
|
|
|
|
|
|
|
|
|
# Links to subfunctions
|
2003-04-14 23:10:40 +00:00
|
|
|
$r .= "<UL>\n" ;
|
2004-07-18 08:48:43 +00:00
|
|
|
#$r .= "<li>".getMPL("disambiguations")."</li>\n" ; # Doesn't work
|
2004-08-15 18:28:02 +00:00
|
|
|
$r .= '<li>'.getMPL("doubleredirects")."</li>\n" ;
|
|
|
|
|
$r .= '<li>'.getMPL("brokenredirects")."</li>\n" ;
|
2004-07-18 08:48:43 +00:00
|
|
|
#$r .= "<li>".getMPL("selflinks")."</li>\n" ; # Doesn't work
|
2004-08-15 18:28:02 +00:00
|
|
|
$r .= '<li>'.getMPL("mispeelings")."</li>\n" ;
|
|
|
|
|
|
|
|
|
|
# Interface for the missing language links
|
|
|
|
|
$r .= '<li>';
|
|
|
|
|
$l = getMPL('missinglanguagelinks');
|
|
|
|
|
$l = str_replace ( '</a>' , '' , $l ) ;
|
|
|
|
|
$l = str_replace ( '<a ' , '<FORM method="post" ' , $l ) ;
|
|
|
|
|
$l = explode ( '>' , $l ) ;
|
|
|
|
|
$l = $l[0] ;
|
2003-04-14 23:10:40 +00:00
|
|
|
$r .= $l.">\n" ;
|
2004-08-15 18:28:02 +00:00
|
|
|
$r .= '<input type="submit" name="submitmll" value="' ;
|
|
|
|
|
$r .= htmlspecialchars(wfMsg('missinglanguagelinksbutton'), ENT_QUOTES);
|
|
|
|
|
$r .= "\">\n" ;
|
|
|
|
|
$r .= "<select name=\"thelang\">\n" ;
|
|
|
|
|
|
2003-04-14 23:10:40 +00:00
|
|
|
$a = $wgLang->getLanguageNames();
|
|
|
|
|
$ak = array_keys ( $a ) ;
|
|
|
|
|
foreach ( $ak AS $k ) {
|
|
|
|
|
if ( $k != $wgLanguageCode )
|
|
|
|
|
$r .= "<option value='{$k}'>{$a[$k]}</option>\n" ;
|
2004-07-10 03:09:26 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
$r .= "</select>\n" ;
|
|
|
|
|
$r .= "</FORM>\n</li>" ;
|
|
|
|
|
|
|
|
|
|
$r .= "</UL>\n" ;
|
|
|
|
|
$wgOut->addHTML ( $r ) ;
|
2003-07-02 06:22:03 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
# Generate a maintenance page link
|
|
|
|
|
function getMPL ( $x ) {
|
2003-04-14 23:10:40 +00:00
|
|
|
global $wgUser , $wgLang;
|
|
|
|
|
$sk = $wgUser->getSkin() ;
|
2004-08-15 18:28:02 +00:00
|
|
|
return $sk->makeKnownLink( sns().":Maintenance" , wfMsg($x), 'subfunction='.$x ) ;
|
2003-07-02 06:22:03 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
|
|
|
|
|
function getMaintenancePageBacklink( $subfunction ) {
|
2004-04-01 12:55:59 +00:00
|
|
|
global $wgUser , $wgLang;
|
2003-04-14 23:10:40 +00:00
|
|
|
$sk = $wgUser->getSkin() ;
|
|
|
|
|
$ns = $wgLang->getNamespaces() ;
|
|
|
|
|
$r = $sk->makeKnownLink (
|
2004-08-15 18:28:02 +00:00
|
|
|
$ns[-1].':Maintenance',
|
|
|
|
|
wfMsg( 'maintenancebacklink' ) ) ;
|
2003-04-14 23:10:40 +00:00
|
|
|
$t = wfMsg ( $subfunction ) ;
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$s = '<table width="100%" border="0"><tr><td>';
|
|
|
|
|
$s .= '<h2>'.$t.'</h2></td><td align="right">';
|
2003-04-14 23:10:40 +00:00
|
|
|
$s .= "{$r}</td></tr></table>\n" ;
|
|
|
|
|
return $s ;
|
2003-07-02 06:22:03 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-04-01 12:55:59 +00:00
|
|
|
# Broken function
|
|
|
|
|
# Suggest deprecating this in favour of a Special:Whatlinkshere with prev/next links [TS]
|
2004-08-15 18:28:02 +00:00
|
|
|
function wfSpecialDisambiguations() {
|
2003-04-14 23:10:40 +00:00
|
|
|
global $wgUser, $wgOut, $wgLang, $wgTitle;
|
|
|
|
|
$fname = "wfSpecialDisambiguations";
|
|
|
|
|
|
2003-06-03 08:44:50 +00:00
|
|
|
list( $limit, $offset ) = wfCheckLimits();
|
2004-07-18 08:48:43 +00:00
|
|
|
$dbr =& wfGetDB( DB_SLAVE );
|
|
|
|
|
extract( $dbr->tableNames( 'links', 'cur' ) );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
$dp = $dbr->strencode( wfMsg("disambiguationspage") );
|
2004-03-11 09:06:13 +00:00
|
|
|
|
|
|
|
|
die( "wfSpecialDisambiguation is broken. Link tables have changed...\n" );
|
|
|
|
|
|
2003-04-14 23:10:40 +00:00
|
|
|
$sql = "SELECT la.l_from,la.l_to,"
|
|
|
|
|
. " lb.l_from AS source,lb.l_to AS dest,"
|
|
|
|
|
. " c.cur_id, c.cur_title AS dt"
|
2004-07-18 08:48:43 +00:00
|
|
|
. " FROM $links AS la, $links AS lb, $cur AS c, $cur AS d"
|
2003-04-14 23:10:40 +00:00
|
|
|
. " WHERE la.l_from='{$dp}'"
|
|
|
|
|
. " AND la.l_to=lb.l_to"
|
|
|
|
|
. " AND la.l_from<>lb.l_from"
|
|
|
|
|
. " AND c.cur_id=lb.l_to"
|
|
|
|
|
. " AND c.cur_namespace=0"
|
|
|
|
|
. " AND d.cur_title=lb.l_from"
|
|
|
|
|
. " AND d.cur_namespace=0"
|
|
|
|
|
. " LIMIT {$offset}, {$limit}";
|
|
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
$res = $dbr->query( $sql, $fname );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
|
|
|
|
$sk = $wgUser->getSkin();
|
|
|
|
|
|
2003-11-15 13:56:14 +00:00
|
|
|
$top = "<p>".wfMsg( "disambiguationstext", $sk->makeKnownLink( $dp ) )."</p><br>\n";
|
2004-04-01 12:55:59 +00:00
|
|
|
$top = getMaintenancePageBacklink( "disambiguations" ) . $top;
|
2003-04-14 23:10:40 +00:00
|
|
|
$top .= wfShowingResults( $offset, $limit );
|
|
|
|
|
$wgOut->addHTML( "<p>{$top}\n" );
|
|
|
|
|
|
|
|
|
|
$sl = wfViewPrevNext( $offset, $limit, "REPLACETHIS" ) ;
|
|
|
|
|
$sl = str_replace ( "REPLACETHIS" , sns().":Maintenance&subfunction=disambiguations" , $sl ) ;
|
|
|
|
|
$wgOut->addHTML( "<br>{$sl}\n" );
|
|
|
|
|
|
|
|
|
|
$s = "<ol start=" . ( $offset + 1 ) . ">";
|
2004-07-18 08:48:43 +00:00
|
|
|
while ( $obj = $dbr->fetchObject( $res ) ) {
|
2003-04-14 23:10:40 +00:00
|
|
|
$l1 = $sk->makeKnownLink ( $obj->source , "" , "redirect=no" ) ;
|
|
|
|
|
$l2 = $sk->makeKnownLink ( $obj->dt ) ;
|
|
|
|
|
$l3 = $sk->makeBrokenLink ( $obj->source , "(".wfMsg("qbedit").")" , "redirect=no" ) ;
|
|
|
|
|
$s .= "<li>{$l1} {$l3} => {$l2}</li>\n" ;
|
|
|
|
|
}
|
2004-07-18 08:48:43 +00:00
|
|
|
$dbr->freeResult( $res );
|
2004-08-15 18:28:02 +00:00
|
|
|
$s .= '</ol>';
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->addHTML( $s );
|
|
|
|
|
$wgOut->addHTML( "<p>{$sl}\n" );
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
|
|
|
|
|
function wfSpecialDoubleRedirects() {
|
2003-04-14 23:10:40 +00:00
|
|
|
global $wgUser, $wgOut, $wgLang, $wgTitle;
|
2004-08-15 18:28:02 +00:00
|
|
|
$fname = 'wfSpecialDoubleRedirects';
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2003-06-03 08:44:50 +00:00
|
|
|
list( $limit, $offset ) = wfCheckLimits();
|
2004-07-18 08:48:43 +00:00
|
|
|
$dbr =& wfGetDB( DB_SLAVE );
|
|
|
|
|
extract( $dbr->tableNames( 'cur', 'links' ) );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-04-01 12:55:59 +00:00
|
|
|
$sql = "SELECT ca.cur_namespace as ns_a, ca.cur_title as title_a," .
|
|
|
|
|
" cb.cur_namespace as ns_b, cb.cur_title as title_b," .
|
|
|
|
|
" cb.cur_text AS rt " .
|
2004-07-18 08:48:43 +00:00
|
|
|
"FROM $links,$cur AS ca,$cur AS cb ".
|
2004-04-01 12:55:59 +00:00
|
|
|
"WHERE ca.cur_is_redirect=1 AND cb.cur_is_redirect=1 AND l_to=cb.cur_id " .
|
|
|
|
|
" AND l_from=ca.cur_id LIMIT {$offset}, {$limit}" ;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
$res = $dbr->query( $sql, $fname );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$top = getMaintenancePageBacklink( 'doubleredirects' );
|
|
|
|
|
$top .= '<p>'.wfMsg("doubleredirectstext")."</p><br>\n";
|
2003-04-14 23:10:40 +00:00
|
|
|
$top .= wfShowingResults( $offset, $limit );
|
|
|
|
|
$wgOut->addHTML( "<p>{$top}\n" );
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$sl = wfViewPrevNext( $offset, $limit, 'REPLACETHIS' ) ;
|
|
|
|
|
$sl = str_replace ( 'REPLACETHIS' , sns().':Maintenance&subfunction=doubleredirects' , $sl ) ;
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->addHTML( "<br>{$sl}\n" );
|
|
|
|
|
|
|
|
|
|
$sk = $wgUser->getSkin();
|
2004-08-15 18:28:02 +00:00
|
|
|
$s = '<ol start=' . ( $offset + 1 ) . '>';
|
2004-07-18 08:48:43 +00:00
|
|
|
while ( $obj = $dbr->fetchObject( $res ) ) {
|
2003-04-14 23:10:40 +00:00
|
|
|
$n = explode ( "\n" , $obj->rt ) ;
|
|
|
|
|
$n = $n[0] ;
|
2004-04-01 12:55:59 +00:00
|
|
|
$sourceTitle = Title::makeTitle( $obj->ns_a, $obj->title_a );
|
|
|
|
|
$destTitle = Title::makeTitle( $obj->ns_b, $obj->title_b );
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$l1 = $sk->makeKnownLinkObj( $sourceTitle , '' , 'redirect=no' ) ;
|
|
|
|
|
$l2 = $sk->makeKnownLinkObj( $destTitle , '' , 'redirect=no' ) ;
|
|
|
|
|
$l3 = $sk->makeBrokenLinkObj( $sourceTitle , '('.wfMsg('qbedit').')' , 'redirect=no' ) ;
|
2003-04-14 23:10:40 +00:00
|
|
|
$s .= "<li>{$l1} {$l3} => {$l2} (\"{$n}\")</li>\n" ;
|
|
|
|
|
}
|
2004-07-18 08:48:43 +00:00
|
|
|
$dbr->freeResult( $res );
|
2004-08-15 18:28:02 +00:00
|
|
|
$s .= '</ol>';
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->addHTML( $s );
|
|
|
|
|
$wgOut->addHTML( "<p>{$sl}\n" );
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
|
|
|
|
|
function wfSpecialBrokenRedirects() {
|
2003-04-14 23:10:40 +00:00
|
|
|
global $wgUser, $wgOut, $wgLang, $wgTitle;
|
2004-08-15 18:28:02 +00:00
|
|
|
$fname = 'wfSpecialBrokenRedirects';
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2003-06-03 08:44:50 +00:00
|
|
|
list( $limit, $offset ) = wfCheckLimits();
|
2004-07-18 08:48:43 +00:00
|
|
|
$dbr =& wfGetDB( DB_SLAVE );
|
|
|
|
|
extract( $dbr->tableNames( 'cur', 'brokenlinks' ) );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
|
|
|
|
|
$sql = "SELECT bl_to,cur_title FROM $brokenlinks,$cur " .
|
2004-04-01 12:55:59 +00:00
|
|
|
"WHERE cur_is_redirect=1 AND cur_namespace=0 AND bl_from=cur_id " .
|
|
|
|
|
"LIMIT {$offset}, {$limit}" ;
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
$res = $dbr->query( $sql, $fname );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$top = getMaintenancePageBacklink( 'brokenredirects' );
|
|
|
|
|
$top .= '<p>'.wfMsg('brokenredirectstext')."</p><br>\n";
|
2003-04-14 23:10:40 +00:00
|
|
|
$top .= wfShowingResults( $offset, $limit );
|
|
|
|
|
$wgOut->addHTML( "<p>{$top}\n" );
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$sl = wfViewPrevNext( $offset, $limit, 'REPLACETHIS' ) ;
|
|
|
|
|
$sl = str_replace ( 'REPLACETHIS' , sns().":Maintenance&subfunction=brokenredirects" , $sl ) ;
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->addHTML( "<br>{$sl}\n" );
|
|
|
|
|
|
|
|
|
|
$sk = $wgUser->getSkin();
|
2004-08-15 18:28:02 +00:00
|
|
|
$s = '<ol start=' . ( $offset + 1 ) . '>';
|
2004-07-18 08:48:43 +00:00
|
|
|
while ( $obj = $dbr->fetchObject( $res ) ) {
|
2004-08-15 18:28:02 +00:00
|
|
|
$l1 = $sk->makeKnownLink ( $obj->cur_title , '' , 'redirect=no' ) ;
|
2003-04-14 23:10:40 +00:00
|
|
|
$l2 = $sk->makeBrokenLink ( $obj->cur_title , "(".wfMsg("qbedit").")" , "redirect=no" ) ;
|
2004-08-15 18:28:02 +00:00
|
|
|
$l3 = $sk->makeBrokenLink ( $obj->bl_to , '' , 'redirect=no' ) ;
|
2003-04-14 23:10:40 +00:00
|
|
|
$s .= "<li>{$l1} {$l2} => {$l3}</li>\n" ;
|
|
|
|
|
}
|
2004-07-18 08:48:43 +00:00
|
|
|
$dbr->freeResult( $res );
|
2004-08-15 18:28:02 +00:00
|
|
|
$s .= '</ol>';
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->addHTML( $s );
|
|
|
|
|
$wgOut->addHTML( "<p>{$sl}\n" );
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
|
2004-04-01 12:55:59 +00:00
|
|
|
# This doesn't really work anymore, because self-links are now displayed as
|
|
|
|
|
# unlinked bold text, and are not entered into the link table.
|
2004-08-15 18:28:02 +00:00
|
|
|
function wfSpecialSelfLinks() {
|
2003-04-14 23:10:40 +00:00
|
|
|
global $wgUser, $wgOut, $wgLang, $wgTitle;
|
2004-08-15 18:28:02 +00:00
|
|
|
$fname = 'wfSpecialSelfLinks';
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2003-06-03 08:44:50 +00:00
|
|
|
list( $limit, $offset ) = wfCheckLimits();
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-04-01 12:55:59 +00:00
|
|
|
$sql = "SELECT cur_namespace,cur_title FROM cur,links " .
|
|
|
|
|
"WHERE l_from=l_to AND l_to=cur_id " .
|
|
|
|
|
"LIMIT {$offset}, {$limit}";
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
$res = wfQuery( $sql, DB_SLAVE, $fname );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$top = getMaintenancePageBacklink( 'selflinks' );
|
|
|
|
|
$top .= '<p>'.wfMsg('selflinkstext')."</p><br>\n";
|
2003-04-14 23:10:40 +00:00
|
|
|
$top .= wfShowingResults( $offset, $limit );
|
|
|
|
|
$wgOut->addHTML( "<p>{$top}\n" );
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$sl = wfViewPrevNext( $offset, $limit, 'REPLACETHIS' ) ;
|
|
|
|
|
$sl = str_replace ( 'REPLACETHIS' , sns().":Maintenance&subfunction=selflinks" , $sl ) ;
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->addHTML( "<br>{$sl}\n" );
|
|
|
|
|
|
|
|
|
|
$sk = $wgUser->getSkin();
|
2004-08-15 18:28:02 +00:00
|
|
|
$s = '<ol start=' . ( $offset + 1 ) . '>';
|
2004-04-01 12:55:59 +00:00
|
|
|
while ( $obj = wfFetchObject( $res ) ) {
|
|
|
|
|
$title = Title::makeTitle( $obj->cur_namespace, $obj->cur_title );
|
|
|
|
|
$s .= "<li>".$sk->makeKnownLinkObj( $title )."</li>\n" ;
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
wfFreeResult( $res );
|
2004-08-15 18:28:02 +00:00
|
|
|
$s .= '</ol>';
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->addHTML( $s );
|
|
|
|
|
$wgOut->addHTML( "<p>{$sl}\n" );
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
|
|
|
|
|
function wfSpecialMispeelings () {
|
2004-07-10 03:09:26 +00:00
|
|
|
global $wgUser, $wgOut, $wgLang, $wgTitle;
|
|
|
|
|
$sk = $wgUser->getSkin();
|
2004-08-15 18:28:02 +00:00
|
|
|
$fname = 'wfSpecialMispeelings';
|
2004-07-10 03:09:26 +00:00
|
|
|
|
|
|
|
|
list( $limit, $offset ) = wfCheckLimits();
|
2004-07-18 08:48:43 +00:00
|
|
|
$dbr =& wfGetDB( DB_SLAVE );
|
|
|
|
|
extract( $dbr->tableNames( 'cur', 'searchindex' ) );
|
2004-07-10 03:09:26 +00:00
|
|
|
|
|
|
|
|
# Determine page name
|
2004-08-15 18:28:02 +00:00
|
|
|
$ms = wfMsg ( 'mispeelingspage' ) ;
|
|
|
|
|
$mss = str_replace ( ' ' , '_' , $ms );
|
|
|
|
|
$msp = $wgLang->getNsText(4).':'.$ms ;
|
2004-07-10 03:09:26 +00:00
|
|
|
$msl = $sk->makeKnownLink ( $msp ) ;
|
|
|
|
|
|
|
|
|
|
# Load list from database
|
2004-07-18 08:48:43 +00:00
|
|
|
$l = $dbr->selectField( 'cur', 'cur_text', array( 'cur_title' => $mss, 'cur_namespace' => 4 ), $fname );
|
2004-07-10 03:09:26 +00:00
|
|
|
$l = explode ( "\n" , $l ) ;
|
|
|
|
|
$a = array () ;
|
|
|
|
|
foreach ( $l as $x )
|
2004-08-15 18:28:02 +00:00
|
|
|
if ( substr ( trim ( $x ) , 0 , 1 ) == '*' )
|
2004-07-10 03:09:26 +00:00
|
|
|
$a[] = strtolower ( trim ( substr ( trim ( $x ) , 1 ) ) );
|
|
|
|
|
asort ( $a ) ;
|
|
|
|
|
|
|
|
|
|
$cnt = 0 ;
|
|
|
|
|
$b = array () ;
|
|
|
|
|
foreach ( $a AS $x ) {
|
2004-08-15 18:28:02 +00:00
|
|
|
if ( $cnt < $offset+$limit && $x != '' ) {
|
2004-07-10 03:09:26 +00:00
|
|
|
$y = $x ;
|
|
|
|
|
$x = preg_replace( '/^(\S+).*$/', '$1', $x );
|
2004-07-18 08:48:43 +00:00
|
|
|
$sql = "SELECT DISTINCT cur_title FROM $cur,$searchindex WHERE cur_id=si_page AND ".
|
|
|
|
|
"cur_namespace=0 AND cur_is_redirect=0 AND " .
|
|
|
|
|
"(MATCH(si_text) AGAINST ('" . $dbr->strencode( $wgLang->stripForSearch( $x ) ) . "'))" ;
|
|
|
|
|
$res = $dbr->query( $sql, $fname );
|
|
|
|
|
while ( $obj = $dbr->fetchObject ( $res ) ) {
|
2004-07-10 03:09:26 +00:00
|
|
|
if ( $cnt >= $offset AND $cnt < $offset+$limit ) {
|
2004-08-15 18:28:02 +00:00
|
|
|
if ( $y != '' ) {
|
2004-07-10 03:09:26 +00:00
|
|
|
if ( count ( $b ) > 0 ) $b[] = "</OL>\n" ;
|
|
|
|
|
$b[] = "<H3>{$y}</H3>\n<OL start=".($cnt+1).">\n" ;
|
2004-08-15 18:28:02 +00:00
|
|
|
$y = '' ;
|
2004-07-10 03:09:26 +00:00
|
|
|
}
|
2004-08-15 18:28:02 +00:00
|
|
|
$b[] = '<li>'.
|
2004-07-10 03:09:26 +00:00
|
|
|
$sk->makeKnownLink ( $obj->cur_title ).
|
2004-08-15 18:28:02 +00:00
|
|
|
' ('.
|
2004-07-10 03:09:26 +00:00
|
|
|
$sk->makeBrokenLink ( $obj->cur_title , wfMsg ( "qbedit" ) ).
|
|
|
|
|
")</li>\n" ;
|
|
|
|
|
}
|
|
|
|
|
$cnt++ ;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-08-15 18:28:02 +00:00
|
|
|
$top = getMaintenancePageBacklink( 'mispeelings' );
|
|
|
|
|
$top .= "<p>".wfMsg( 'mispeelingstext', $msl )."</p><br>\n";
|
2004-07-10 03:09:26 +00:00
|
|
|
$top .= wfShowingResults( $offset, $limit );
|
|
|
|
|
$wgOut->addHTML( "<p>{$top}\n" );
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$sl = wfViewPrevNext( $offset, $limit, 'REPLACETHIS' ) ;
|
|
|
|
|
$sl = str_replace ( 'REPLACETHIS' , sns().":Maintenance&subfunction=mispeelings" , $sl ) ;
|
2004-07-10 03:09:26 +00:00
|
|
|
$wgOut->addHTML( "<br>{$sl}\n" );
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$s = implode ( '' , $b ) ;
|
|
|
|
|
if ( count ( $b ) > 0 ) $s .= '</ol>';
|
2004-07-10 03:09:26 +00:00
|
|
|
$wgOut->addHTML( $s );
|
|
|
|
|
$wgOut->addHTML( "<p>{$sl}\n" );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
function wfSpecialMissingLanguageLinks() {
|
2004-04-01 12:55:59 +00:00
|
|
|
global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest;
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$fname = 'wfSpecialMissingLanguageLinks';
|
2004-04-01 12:55:59 +00:00
|
|
|
$thelang = $wgRequest->getText( 'thelang' );
|
2004-08-15 18:28:02 +00:00
|
|
|
if ( $thelang == 'w' ) $thelang = 'en' ; # Fix for international wikis
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2003-06-03 08:44:50 +00:00
|
|
|
list( $limit, $offset ) = wfCheckLimits();
|
2004-07-18 08:48:43 +00:00
|
|
|
$dbr =& wfGetDB( DB_SLAVE );
|
|
|
|
|
$cur = $dbr->tableName( 'cur' );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
$sql = "SELECT cur_title FROM $cur " .
|
2004-04-01 12:55:59 +00:00
|
|
|
"WHERE cur_namespace=0 AND cur_is_redirect=0 " .
|
|
|
|
|
"AND cur_title NOT LIKE '%/%' AND cur_text NOT LIKE '%[[{$thelang}:%' " .
|
|
|
|
|
"LIMIT {$offset}, {$limit}";
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
$res = $dbr->query( $sql, $fname );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$mll = wfMsg( 'missinglanguagelinkstext', $wgLang->getLanguageName($thelang) );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$top = getMaintenancePageBacklink( 'missinglanguagelinks' );
|
2003-04-14 23:10:40 +00:00
|
|
|
$top .= "<p>$mll</p><br>";
|
|
|
|
|
$top .= wfShowingResults( $offset, $limit );
|
|
|
|
|
$wgOut->addHTML( "<p>{$top}\n" );
|
|
|
|
|
|
2004-08-15 18:28:02 +00:00
|
|
|
$sl = wfViewPrevNext( $offset, $limit, 'REPLACETHIS' ) ;
|
|
|
|
|
$sl = str_replace ( 'REPLACETHIS' , sns().":Maintenance&subfunction=missinglanguagelinks&thelang={$thelang}" , $sl ) ;
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->addHTML( "<br>{$sl}\n" );
|
|
|
|
|
|
|
|
|
|
$sk = $wgUser->getSkin();
|
2004-08-15 18:28:02 +00:00
|
|
|
$s = '<ol start=' . ( $offset + 1 ) . '>';
|
2004-07-18 08:48:43 +00:00
|
|
|
while ( $obj = $dbr->fetchObject( $res ) )
|
2003-04-14 23:10:40 +00:00
|
|
|
$s .= "<li>".$sk->makeKnownLink ( $obj->cur_title )."</li>\n" ;
|
2004-07-18 08:48:43 +00:00
|
|
|
$dbr->freeResult( $res );
|
2004-08-15 18:28:02 +00:00
|
|
|
$s .= '</ol>';
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->addHTML( $s );
|
|
|
|
|
$wgOut->addHTML( "<p>{$sl}\n" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|