$rid = $rt->getArticleID();
if ( 0 != $rid ) {
$sql = "SELECT cur_text,cur_timestamp,cur_user," .
- "cur_counter,cur_touched FROM cur WHERE cur_id={$rid}";
+ "cur_counter,cur_restrictions,cur_touched FROM cur WHERE cur_id={$rid}";
$res = wfQuery( $sql, DB_READ, $fname );
if ( 0 != wfNumRows( $res ) ) {
# diff page instead of the article.
if ( isset( $diff ) ) {
- include_once( "$IP/DifferenceEngine.php" );
$wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
$de = new DifferenceEngine( $oldid, $diff );
$de->showDiffPage();
$sk = $wgUser->getSkin();
$redir = $sk->makeKnownLink( $this->mRedirectedFrom, "",
"redirect=no" );
- $s = str_replace( "$1", $redir, wfMsg( "redirectedfrom" ) );
+ $s = wfMsg( "redirectedfrom", $redir );
$wgOut->setSubtitle( $s );
}
$wgOut->checkLastModified( $this->mTouched );
$wgOut->setArticleFlag( false );
if ( $isConflict ) {
- $s = str_replace( "$1", $this->mTitle->getPrefixedText(),
- wfMsg( "editconflict" ) );
+ $s = wfMsg( "editconflict", $this->mTitle->getPrefixedText() );
$wgOut->setPageTitle( $s );
$wgOut->addHTML( wfMsg( "explainconflict" ) );
$wpTextbox1 = $this->getContent(true);
$wpEdittime = $this->getTimestamp();
} else {
- $s = str_replace( "$1", $this->mTitle->getPrefixedText(),
- wfMsg( "editing" ) );
+ $s = wfMsg( "editing", $this->mTitle->getPrefixedText() );
if($section!="") {
if($section=="new") {
$kblength = (int)(strlen( $wpTextbox1 ) / 1024);
if( $kblength > 29 ) {
$wgOut->addHTML( "<strong>" .
- str_replace( '$1', $kblength , wfMsg( "longpagewarning" ) )
+ wfMsg( "longpagewarning", $kblength )
. "</strong>" );
}
wfMsg( "cancel" ) );
$edithelp = $sk->makeKnownLink( wfMsg( "edithelppage" ),
wfMsg( "edithelp" ) );
- $copywarn = str_replace( "$1", $sk->makeKnownLink(
- wfMsg( "copyrightpage" ) ), wfMsg( "copyrightwarning" ) );
+ $copywarn = wfMsg( "copyrightwarning", $sk->makeKnownLink(
+ wfMsg( "copyrightpage" ) ) );
$wpTextbox1 = wfEscapeHTML( $wpTextbox1 );
$wpTextbox2 = wfEscapeHTML( $wpTextbox2 );
}
}
+ # The talk page isn't in the regular link tables, so we need to update manually:
+ $talkns = $ns ^ 1; # talk -> normal; normal -> talk
+ $sql = "UPDATE cur set cur_touched='$now' WHERE cur_namespace=$talkns AND cur_title='" . wfStrencode( $ttl ) . "'";
+ wfQuery( $sql, DB_WRITE );
+
$this->showArticle( $text, wfMsg( "newarticle" ) );
}
"cur_restrictions='{$limit}' WHERE cur_id={$id}";
wfQuery( $sql, DB_WRITE, "Article::protect" );
+ $log = new LogPage( wfMsg( "protectlogpage" ), wfMsg( "protectlogtext" ) );
+ if ( $limit === "" ) {
+ $log->addEntry( wfMsg( "unprotectedarticle", $this->mTitle->getPrefixedText() ), "" );
+ } else {
+ $log->addEntry( wfMsg( "protectedarticle", $this->mTitle->getPrefixedText() ), "" );
+ }
$wgOut->redirect( wfLocalUrl( $this->mTitle->getPrefixedURL() ) );
}
return;
}
+ if ( $wpConfirm ) {
+ $this->doDelete();
+ return;
+ }
+
# determine whether this page has earlier revisions
# and insert a warning if it does
# we select the text because it might be useful below
function confirmDelete( $par = "" )
{
global $wgOut;
+
+ wfDebug( "Article::confirmDelete\n" );
$sub = htmlspecialchars( $this->mTitle->getPrefixedText() );
$wgOut->setSubtitle( wfMsg( "deletesub", $sub ) );
global $wgOut, $wgUser, $wgLang;
global $wpReason;
$fname = "Article::doDelete";
+ wfDebug( "$fname\n" );
$this->doDeleteArticle( $this->mTitle );
$deleted = $this->mTitle->getPrefixedText();
Namespace::getWikipedia() ) .
":" . wfMsg( "dellogpage" ), wfMsg( "deletionlog" ) );
- $text = str_replace( "$1" , $deleted, wfMsg( "deletedtext" ) );
- $text = str_replace( "$2", $loglink, $text );
+ $text = wfMsg( "deletedtext", $deleted, $loglink );
$wgOut->addHTML( "<p>" . $text );
$wgOut->returnToMain( false );
global $wgUser, $wgOut, $wgLang, $wpReason, $wgDeferredUpdateList;
$fname = "Article::doDeleteArticle";
+ wfDebug( "$fname\n" );
+
$ns = $title->getNamespace();
$t = wfStrencode( $title->getDBkey() );
$id = $title->getArticleID();
$log = new LogPage( wfMsg( "dellogpage" ), wfMsg( "dellogpagetext" ) );
$art = $title->getPrefixedText();
$wpReason = wfCleanQueryVar( $wpReason );
- $log->addEntry( str_replace( "$1", $art, wfMsg( "deletedarticle" ) ), $wpReason );
+ $log->addEntry( wfMsg( "deletedarticle", $art ), $wpReason );
# Clear the cached article id so the interface doesn't act like we exist
$this->mTitle->resetArticleID( 0 );
$s = wfFetchObject( $res );
# Save it!
- $newcomment = str_replace( "$1", $s->old_user_text, wfMsg( "revertpage" ) );
+ $newcomment = wfMsg( "revertpage", $s->old_user_text );
$wgOut->setPagetitle( wfMsg( "actioncomplete" ) );
$wgOut->setRobotpolicy( "noindex,nofollow" );
$wgOut->addHTML( "<h2>" . $newcomment . "</h2>\n<hr>\n" );
global $wgLang, $wgOut;
$td = $wgLang->timeanddate( $this->mTimestamp, true );
- $r = str_replace( "$1", "{$td}", wfMsg( "revisionasof" ) );
+ $r = wfMsg( "revisionasof", $td );
$wgOut->setSubtitle( "({$r})" );
}
$link = "[[" . $wgLang->getNsText( Namespace::getUser() ) .
":{$name}|{$name}]]";
- $text = str_replace( "$1", $link, wfMsg( "blockedtext" ) );
- $text = str_replace( "$2", $reason, $text );
- $text = str_replace( "$3", getenv( "REMOTE_ADDR" ), $text );
+ $text = wfMsg( "blockedtext", $link, $reason, getenv( "REMOTE_ADDR" ) );
$wgOut->addWikiText( $text );
$wgOut->returnToMain( false );
}
#
$tc = "[&;%\\-,.\\(\\)' _0-9A-Za-z\\/:\\x80-\\xff]";
$np = "[&;%\\-,.' _0-9A-Za-z\\/:\\x80-\\xff]"; # No parens
+ $namespacechar = '[ _0-9A-Za-z\x80-\xff]'; # Namespaces can use non-ascii!
$conpat = "/^({$np}+) \\(({$tc}+)\\)$/";
$p1 = "/\[\[({$np}+) \\(({$np}+)\\)\\|]]/"; # [[page (context)|]]
$p2 = "/\[\[\\|({$tc}+)]]/"; # [[|page]]
- $p3 = "/\[\[([A-Za-z _]+):({$np}+)\\|]]/"; # [[namespace:page|]]
- $p4 = "/\[\[([A-Aa-z _]+):({$np}+) \\(({$np}+)\\)\\|]]/";
+ $p3 = "/\[\[($namespacechar+):({$np}+)\\|]]/"; # [[namespace:page|]]
+ $p4 = "/\[\[($namespacechar+):({$np}+) \\(({$np}+)\\)\\|]]/";
# [[ns:page (cont)|]]
$context = "";
$t = $this->mTitle->getText();