return;
}
if ( $rt->getNamespace() == Namespace::getSpecial() ) {
- $wgOut->redirect( $rt->getURL() );
+ $wgOut->redirect( $rt->getFullURL() );
return;
}
$rid = $rt->getArticleID();
# Squid purging
if ( $wgUseSquid ) {
$urlArr = Array(
- $wgInternalServer.$this->mTitle->getURL()
+ $this->mTitle->getInternalURL()
);
wfPurgeSquidServers($urlArr);
/* this needs to be done after LinksUpdate */
if ( $wgUseSquid ) {
$urlArr = Array(
- $wgInternalServer.$this->mTitle->getURL()
+ $this->mTitle->getInternalURL()
);
wfPurgeSquidServers($urlArr);
}
$r = "redirect=no";
else
$r = "";
- $wgOut->redirect( $this->mTitle->getURL( $r ) );
+ $wgOut->redirect( $this->mTitle->getFullURL( $r ) );
}
# Add this page to my watchlist
} else {
$log->addEntry( wfMsg( "protectedarticle", $this->mTitle->getPrefixedText() ), "" );
}
- $wgOut->redirect( $this->mTitle->getURL() );
+ $wgOut->redirect( $this->mTitle->getFullURL() );
}
function unprotect()
$wgOut->setRobotpolicy( "noindex,nofollow" );
$wgOut->addWikiText( wfMsg( "confirmdeletetext" ) );
- $formaction = $this->mTitle->getURL( $this->mTitle, "action=delete" . $par, true );
+ $formaction = $this->mTitle->escapeLocalURL( "action=delete" . $par );
$confirm = wfMsg( "confirm" );
$check = wfMsg( "confirmcheck" );
# Squid purging
if ( $wgUseSquid ) {
$urlArr = Array(
- $wgInternalServer.$this->mTitle->getURL()
+ $this->mTitle->getInternalURL()
);
wfPurgeSquidServers($urlArr);
while ( $BL = wfFetchObject ( $res ) )
{
$tobj = Title::newFromDBkey( $BL->l_from) ;
- $blurlArr[] = $wgInternalServer.$tobj->getURL();
+ $blurlArr[] = $tobj->getInternalURL();
}
wfFreeResult ( $res ) ;
$u = new SquidUpdate( $this->mTitle, $blurlArr );
# append them and the string comparison fails
if ( ( "" == $wpTextbox1 ) ||
( wfMsg( "newarticletext" ) == rtrim( preg_replace("/\r/","",$wpTextbox1) ) ) ) {
- $wgOut->redirect( $this->mTitle->getURL() );
+ $wgOut->redirect( $this->mTitle->getFullURL() );
return;
}
$this->mArticle->insertNewArticle( $wpTextbox1, $wpSummary, $wpMinoredit, $wpWatchthis );
$q = "action=submit";
if ( "no" == $redirect ) { $q .= "&redirect=no"; }
- $action = $this->mTitle->getURL( $q, true );
+ $action = $this->mTitle->escapeLocalURL( $q );
$summary = wfMsg( "summary" );
$subject = wfMsg("subject");
}
# Generates a URL from a URL-encoded title and a query string
-# Title::getURL() is preferred in most cases
+# Title::getLocalURL() is preferred in most cases
#
function wfLocalUrl( $a, $q = "" )
{
function wfLocalUrlE( $a, $q = "" )
{
return wfEscapeHTML( wfLocalUrl( $a, $q ) );
+ # die( "Call to obsolete function wfLocalUrlE()" );
}
function wfFullUrl( $a, $q = "" ) {
- $titleObj = Title::newFromURL( $a );
- return $titleObj->getURL( $q, false, true );
+ die( "Call to obsolete function wfFullUrl()" );
}
function wfFullUrlE( $a, $q = "" ) {
- $titleObj = Title::newFromURL( $a );
- return $titleObj->getURL( $q, true, true );
+ die( "Call to obsolete function wfFullUrlE()" );
}
$r = wfMsg( "returnto", $link );
if ( $auto ) {
$titleObj = Title::newFromText( $returnto );
- $wgOut->addMeta( "http:Refresh", "10;url=" . $titleObj->getUrl( "", true, true ));
+ $wgOut->addMeta( "http:Refresh", "10;url=" . $titleObj->escapeFullURL() );
}
$wgOut->addHTML( "\n<p>$r\n" );
}
global $wgTitle;
$this->lastdate = $this->lastline = "";
$s = "\n<p>" . wfMsg( "histlegend" ) . "\n<ul>";
- $url = $wgTitle->getURL("-");
+ $url = $wgTitle->getLocalURL("-");
$s .= "<SCRIPT>
var sel = -1;
function anysel(oid){
} else {
$titleObj = Title::makeTitle( NS_SPECIAL, "Booksources" );
$text .= "<a href=\"" .
- $titleObj->getUrl( "isbn={$num}", false, true ) .
+ $titleObj->escapeLocalUrl( "isbn={$num}" ) .
"\" class=\"internal\">ISBN $isbn</a>";
$text .= $x;
}
return new FeedItem(
$title->getText(),
$this->feedItemDesc( $row ),
- $title->getURL( "", false, true ) ,
+ $title->getFullURL(),
$date);
} else {
return NULL;
wfMsg("powersearch") . "\">\n";
$ret = str_replace( "$9", $tempText, $ret );
- $titleObj = NULL; # this does tricky stuff
-
+ global $wgScript;
$ret = "<br><br>\n<form id=\"powersearch\" method=\"get\" " .
- "action=\"" . $titleObj->getUrl() . "\">\n{$ret}\n</form>\n";
+ "action=\"$wgScript\">\n{$ret}\n</form>\n";
if ( isset ( $searchx ) ) {
if ( ! $listredirs ) {
}
if ( 0 != $t->getArticleID() ) {
- $wgOut->redirect( $t->getURL() );
+ $wgOut->redirect( $t->getFullURL() );
return;
}
#
$t = Title::newFromText( strtolower( $search ) );
if ( 0 != $t->getArticleID() ) {
- $wgOut->redirect( $t->getURL() );
+ $wgOut->redirect( $t->getFullURL() );
return;
}
#
$t = Title::newFromText( ucwords( strtolower( $search ) ) );
if ( 0 != $t->getArticleID() ) {
- $wgOut->redirect( $t->getURL() );
+ $wgOut->redirect( $t->getFullURL() );
return;
}
#
$t = Title::newFromText( strtoupper( $search ) );
if ( 0 != $t->getArticleID() ) {
- $wgOut->redirect( $t->getURL() );
+ $wgOut->redirect( $t->getFullURL() );
return;
}
# No match, generate an edit URL
$t = Title::newFromText( $this->mUsertext );
- $wgOut->addHTML( wfMsg("nogomatch", $t->getURL( "action=edit", true ) ) . "\n<p>" );
+ $wgOut->addHTML( wfMsg("nogomatch", $t->escapeLocalURL( "action=edit" ) ) . "\n<p>" );
# Try a fuzzy title search
$anyhit = false;
if ( $oldid && ! isset( $diff ) ) {
$oid = "&oldid={$oldid}";
}
- $s = $wgTitle->getUrl( "action=edit{$oid}{$red}", false, true );
+ $s = $wgTitle->getFullURL( "action=edit{$oid}{$red}" );
$s = "document.location = \"" .$s ."\";";
$a += array ("ondblclick" => $s);
$mp = wfMsg( "mainpage" );
$titleObj = Title::newFromText( $mp );
- $s = "<a href=\"" . $titleObj->getURL( "", true )
+ $s = "<a href=\"" . $titleObj->escapeLocalURL()
. "\"><img{$a} border=0 src=\""
. $this->getLogo() . "\" alt=\"" . "[{$mp}]\"></a>";
return $s;
$u = "";
if ( "" == $text ) { $text = $nt->getFragment(); }
} else {
- $u = $nt->getURL( $query, true );
+ $u = $nt->escapeLocalURL( $query );
}
if ( "" != $nt->getFragment() ) {
$u .= "#" . wfEscapeHTML( $nt->getFragment() );
$fname = "Skin::makeBrokenLinkObj";
wfProfileIn( $fname );
- $link = $nt->getPrefixedURL();
-
- if ( "" == $query ) { $q = "action=edit"; }
- else { $q = "action=edit&{$query}"; }
- $u = $nt->getURL( $q );
+ if ( "" == $query ) {
+ $q = "action=edit";
+ } else {
+ $q = "action=edit&{$query}";
+ }
+ $u = $nt->escapeLocalURL( $q );
if ( "" == $text ) { $text = $nt->getPrefixedText(); }
$style = $this->getInternalLinkAttributesObj( $nt, $text, "yes" );
$link = $nt->getPrefixedURL();
- $u = $nt->getURL( $query, true );
+ $u = $nt->escapeLocalURL( $query );
if ( "" == $text ) { $text = $nt->getPrefixedText(); }
$style = $this->getInternalLinkAttributesObj( $nt, $text, "stub" );
}
$alt = htmlspecialchars( $alt );
- $u = $nt->getURL( "", true );
+ $u = $nt->escapeLocalURL();
$s = "<a href=\"{$u}\" class='image' title=\"{$alt}\">" .
"<img border=\"0\" src=\"{$url}\" alt=\"{$alt}\"></a>";
if ( "" != $align ) {
$thumbUrl = $this->createThumb( $name, $boxwidth );
- $u = $nt->getURL( "", true );
+ $u = $nt->escapeLocalURL();
$more = htmlspecialchars(wfMsg( "thumbnail-more" ));
$url = wfImageUrl( $img );
$rlink = $cur;
if ( $wgUser->isSysop() ) {
- $link = $wgTitle->getURL( "image=" . $wgTitle->getPartialURL() .
- "&action=delete", true );
+ $link = $wgTitle->escapeLocalURL( "image=" . $wgTitle->getPartialURL() .
+ "&action=delete" );
$style = $this->getInternalLinkAttributes( $link, $del );
$dlink = "<a href=\"{$link}\"{$style}>{$del}</a>";
global $wgTitle,$wgUser,$oldid;
if($oldid) return $head;
- $url = $wgTitle->getUrl( "action=edit§ion=$section", true );
+ $url = $wgTitle->escapeLocalURL( "action=edit§ion=$section" );
return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
}
"<table width='100%' border=0 cellspacing=0 cellpadding=8><tr>";
$s .= "<td class='top' align=left valign=middle nowrap>";
- $s .= "<a href=\"" . $mainPageObj->getURL("", true) . "\">";
+ $s .= "<a href=\"" . $mainPageObj->escapeLocalURL() . "\">";
$s .= "<span id='sitetitle'>" . wfMsg( "sitetitle" ) . "</span></a>";
$s .= "</td><td class='top' align=right valign=bottom width='100%'>";
$text = $popup = $title->getPrefixedText();
}
- $url = $title->getURL( $action, true );
+ $url = $title->escapeLocalURL( $action );
if($params['text']) $text = $params['text'];
if($params['key']) $text = wfMsg( $params['key'] );
$q = wfMsg( "sqlquery" );
$qb = wfMsg( "querybtn" );
$titleObj = Title::makeTitle( NS_SPECIAL, "Asksql" );
- $action = $titleObj->getURL( "action=submit", true );
+ $action = $titleObj->escapeLocalURL( "action=submit" );
$wgOut->addHTML( "<p>
<form id=\"asksql\" method=\"post\" action=\"{$action}\">
$mIpbreason = wfMsg( "ipbreason" );
$mIpbsubmit = wfMsg( "ipbsubmit" );
$titleObj = Title::makeTitle( NS_SPECIAL, "Blockip" );
- $action = $titleObj->getURL( "action=submit", true );
+ $action = $titleObj->escapeLocalURL( "action=submit" );
if ( "" != $err ) {
$wgOut->setSubtitle( wfMsg( "formerror" ) );
# Report to the user
$titleObj = Title::makeTitle( NS_SPECIAL, "Blockip" );
- $wgOut->redirect( $titleObj->getURL( "action=success&ip={$wpBlockAddress}" ) );
+ $wgOut->redirect( $titleObj->getFullURL( "action=success&ip={$wpBlockAddress}" ) );
}
function showSuccess()
$ems = wfMsg( "emailsend" );
$titleObj = Title::makeTitle( NS_SPECIAL, "Emailuser" );
- $action = $titleObj->getURL( "target={$target}&action=submit", true );
+ $action = $titleObj->escapeLocalURL( "target={$target}&action=submit" );
if ( "" != $err ) {
$wgOut->setSubtitle( wfMsg( "formerror" ) );
if (! $mailResult)
{
$titleObj = Title::makeTitle( NS_SPECIAL, "Emailuser" );
- $wgOut->redirect( $titleObj->getURL( "target={$target}&action=success" ) );
+ $wgOut->redirect( $titleObj->getFullURL( "target={$target}&action=success" ) );
}
else
$wgOut->addHTML( wfMsg( "usermailererror" ) . $mailResult);
$wgOut->addWikiText( wfMsg( "exporttext" ) );
$titleObj = Title::makeTitle( NS_SPECIAL, "Export" );
- $action = $titleObj->getURL( "", true );
+ $action = $titleObj->escapeLocalURL();
$wgOut->addHTML( "
<form method='post' action=\"$action\">
<input type='hidden' name='action' value='submit' />
$cap = wfMsg( "ilshowmatch" );
$sub = wfMsg( "ilsubmit" );
$titleObj = Title::makeTitle( NS_SPECIAL, "Imagelist" );
- $action = $titleObj->getURL( "sort=byname&limit={$limit}", true );
+ $action = $titleObj->escapeLocalURL( "sort=byname&limit={$limit}" );
$wgOut->addHTML( "<form id=\"imagesearch\" method=\"post\" action=\"" .
"{$action}\">" .
$ipr = wfMsg( "ipbreason" );
$ipus = wfMsg( "ipusubmit" );
$titleObj = Title::makeTitle( NS_SPECIAL, "Ipblocklist" );
- $action = $titleObj->getURL( "action=submit", true );
+ $action = $titleObj->escapeLocalURL( "action=submit" );
if ( "" != $err ) {
$wgOut->setSubtitle( wfMsg( "formerror" ) );
# Report to the user
$titleObj = Title::makeTitle( NS_SPECIAL, "Ipblocklist" );
- $success = $titleObj->getURL( "action=success&ip=" . urlencode($wpUnblockAddress) );
+ $success = $titleObj->getFullURL( "action=success&ip=" . urlencode($wpUnblockAddress) );
$wgOut->redirect( $success );
}
if ( !$block->mAuto ) {
$titleObj = Title::makeTitle( NS_SPECIAL, "Contributions" );
- $clink = "<a href=\"" . $titleObj->getURL( "target={$block->mAddress}", true ) . "\">" .
+ $clink = "<a href=\"" . $titleObj->escapeLocalURL( "target={$block->mAddress}" ) . "\">" .
wfMsg( "contribslink" ) . "</a>";
$wgOut->addHTML( " ({$clink})" );
}
if ( $wgUser->isSysop() ) {
$titleObj = Title::makeTitle( NS_SPECIAL, "Ipblocklist" );
$ublink = "<a href=\"" .
- $titleObj->getURL( "action=unblock&ip=" . urlencode( $addr ), true ) . "\">" .
+ $titleObj->escapeLocalURL( "action=unblock&ip=" . urlencode( $addr ) ) . "\">" .
wfMsg( "unblocklink" ) . "</a>";
$wgOut->addHTML( " ({$ublink})" );
}
$lb = wfMsg( "lockbtn" );
$elr = wfMsg( "enterlockreason" );
$titleObj = Title::makeTitle( NS_SPECIAL, "Lockdb" );
- $action = $titleObj->getURL( "action=submit", true );
+ $action = $titleObj->escapeLocalURL( "action=submit" );
$wgOut->addHTML( "<p>
<form id=\"lockdb\" method=\"post\" action=\"{$action}\">
fclose( $fp );
$titleObj = Title::makeTitle( NS_SPECIAL, "Lockdb" );
- $wgOut->redirect( $titleObj->getURL( "action=success" ) );
+ $wgOut->redirect( $titleObj->getFullURL( "action=success" ) );
}
function showSuccess()
$wgOut->addWikiText( wfMsg( "makesysoptext" ) );
$titleObj = Title::makeTitle( NS_SPECIAL, "Makesysop" );
- $action = $titleObj->getURL( "action=submit", true );
+ $action = $titleObj->escapeLocalURL( "action=submit" );
if ( "" != $err ) {
$wgOut->setSubtitle( wfMsg( "formerror" ) );
$movetalk = wfMsg( "movetalk" );
$titleObj = Title::makeTitle( NS_SPECIAL, "Movepage" );
- $action = $titleObj->getURL( "action=submit", true );
+ $action = $titleObj->escapeLocalURL( "action=submit" );
if ( "" != $err ) {
$wgOut->setSubtitle( wfMsg( "formerror" ) );
/* this needs to be done after LinksUpdate */
$urlArr = Array(
# purge new title
- $wgInternalServer.$this->nt->getURL(),
+ $wgInternalServer.$this->nt->getLocalURL(),
# purge old title
- $wgInternalServer.$this->ot->getURL())
+ $wgInternalServer.$this->ot->getLocalURL())
);
wfPurgeSquidServers($urlArr);
# purge pages linking to new title
/* this needs to be done after LinksUpdate */
$urlArr = Array(
# purge new title
- $wgInternalServer.$nt->getURL()),
+ $nt->getInternalURL()),
# purge old title
- $wgInternalServer.$ot->getURL())
+ $ot->getInternalURL())
);
wfPurgeSquidServers($urlArr);
# purge pages linking to new title
}
}
$titleObj = Title::makeTitle( NS_SPECIAL, "Movepage" );
- $success = $titleObj->getURL(
+ $success = $titleObj->getFullURL(
"action=success&oldtitle=" . wfUrlencode( $this->ofx ) .
"&newtitle=" . wfUrlencode( $this->nfx ) .
"&talkmoved={$this->talkmoved}" );
$togs = $wgLang->getUserToggles();
$titleObj = Title::makeTitle( NS_SPECIAL, "Preferences" );
- $action = $titleObj->getURL( "", true );
+ $action = $titleObj->escapeLocalURL();
$qb = wfMsg( "qbsettings" );
$cp = wfMsg( "changepassword" );
$wgOut->addWikiText( wfMsg( "undeletehistory" ) . "\n<hr>\n" . $row->ar_text );
$titleObj = Title::makeTitle( NS_SPECIAL, "Undelete" );
- $action = $titleObj->getURL( "action=submit", true );
+ $action = $titleObj->escapeLocalURL( "action=submit" );
$wgOut->addHTML("<p>
<form id=\"undelete\" method=\"post\" action=\"{$action}\">
<input type=hidden name=\"target\" value=\"{$target}\">
$lc = wfMsg( "unlockconfirm" );
$lb = wfMsg( "unlockbtn" );
$titleObj = Title::makeTitle( NS_SPECIAL, "Unlockdb" );
- $action = $titleObj->getURL( "action=submit", true );
+ $action = $titleObj->escapeLocalURL( "action=submit" );
$wgOut->addHTML( "<p>
<form id=\"unlockdb\" method=\"post\" action=\"{$action}\">
return;
}
$titleObj = Title::makeTitle( NS_SPECIAL, "Unlockdb" );
- $success = $titleObj->getURL( "action=success" );
+ $success = $titleObj->getFullURL( "action=success" );
$wgOut->redirect( $success );
}
$iw = wfMsg( "ignorewarning" );
$reup = wfMsg( "reuploaddesc" );
$titleObj = Title::makeTitle( NS_SPECIAL, "Upload" );
- $action = $titleObj->getURL( "action=submit", true );
+ $action = $titleObj->escapeLocalURL( "action=submit" );
if ( $wgUseCopyrightUpload )
{
$iw = wfMsg( "ignorewarning" );
$titleObj = Title::makeTitle( NS_SPECIAL, "Upload" );
- $action = $titleObj->getURL( "", true );
+ $action = $titleObj->escapeLocalURL();
$source = "
<td align=right>
$q = "action=submit";
if ( "" != $_REQUEST['returnto'] ) { $q .= "&returnto=" . wfUrlencode($_REQUEST['returnto']); }
$titleObj = Title::makeTitle( NS_SPECIAL, "Userlogin" );
- $action = $titleObj->getURL( $q, true );
+ $action = $titleObj->escapeLocalUrl( $q );
$encName = wfEscapeHTML( $name );
$encPassword = wfEscapeHTML( $pwd );
global $wgOut, $wgLang;
$titleObj = Title::makeTitle( NS_SPECIAL, "Userlogin" );
- $check = $titleObj->getURL( "wpCookieCheck=$type" );
+ $check = $titleObj->getFullURL( "wpCookieCheck=$type" );
return $wgOut->redirect( $check );
}
"<p>" . wfMsg( "watcheditlist" ) . "</p>\n" );
$wgOut->addHTML( "<form action='" .
- $specialTitle->getURL( "action=submit", true ) .
+ $specialTitle->escapeLocalUrl( "action=submit" ) .
"' method='post'>\n" .
"<ul>\n" );
$sql = "SELECT wl_namespace,wl_title FROM watchlist WHERE wl_user=$uid";
$wgOut->addHTML( "<i>" . wfMsg( "watchdetails",
$wgLang->formatNum( $nitems ), $wgLang->formatNum( $npages ), $y,
- $specialTitle->getURL( "magic=yes", true ) ) . "</i><br>\n" );
+ $specialTitle->escapeLocalUrl( "magic=yes" ) ) . "</i><br>\n" );
$sql = "SELECT
while ( $BL = wfFetchObject ( $res ) )
{
$t = Title::newFromDBkey( $BL->l_from) ;
- $this->urlArr[] = $wgInternalServer.$t->getURL() ;
+ $this->urlArr[] = $wgInternalServer.$t->getLocalURL() ;
}
wfFreeResult ( $res ) ;
}
# Get a real URL referring to this title, with interwiki link and fragment
- function getFullURL()
+ function getFullURL( $query = "" )
{
global $wgLang, $wgArticlePath, $wgServer, $wgScript;
if ( "" == $this->mInterwiki ) {
$p = $wgArticlePath;
- } else {
- $p = $this->getInterwikiLink( $this->mInterwiki );
+ return $wgServer . $this->getLocalUrl( $query );
}
+
+ $p = $this->getInterwikiLink( $this->mInterwiki );
$n = $wgLang->getNsText( $this->mNamespace );
if ( "" != $n ) { $n .= ":"; }
$u = str_replace( "$1", $n . $this->mUrlform, $p );
if ( "" != $this->mFragment ) {
- $u .= "#" . $this->mFragment;
+ $u .= "#" . wfUrlencode( $this->mFragment );
}
return $u;
}
# * Optionally adds the server and escapes for HTML
# * Setting $query to "-" makes an old-style URL with nothing in the
# query except a title
- function getURL( $query = "", $escape = false, $full = false )
+
+ function getURL() {
+ die( "Call to obsolete obsolete function Title::getURL()" );
+ }
+
+ function getLocalURL( $query = "" )
{
- global $wgLang, $wgArticlePath, $wgScript, $wgServer;
+ global $wgLang, $wgArticlePath, $wgScript;
if ( $this->isExternal() ) {
return $this->getFullURL();
$url = "{$wgScript}?title={$dbkey}&{$query}";
} else {
# Top level wiki
- $url = "/{$dbkey}&{$query}";
+ $url = "/{$dbkey}?{$query}";
}
}
-
- if ( $full ) {
- $url = $wgServer . $url;
- }
-
- if ( $escape ) {
- $url = wfEscapeHTML( $url );
- }
return $url;
}
+
+ function escapeLocalURL( $query = "" ) {
+ return wfEscapeHTML( $this->getLocalURL( $query ) );
+ }
+
+ function escapeFullURL( $query = "" ) {
+ return wfEscapeHTML( $this->getFullURL( $query ) );
+ }
+
+ function getInternalURL( $query = "" ) {
+ # Used in various Squid-related code, in case we have a different
+ # internal hostname for the server than the exposed one.
+ global $wgInternalServer;
+ return $wgInternalServer . $this->getLocalURL( $query );
+ }
# Get the edit URL, or a null string if it is an interwiki link
function getEditURL()
global $wgServer, $wgScript;
if ( "" != $this->mInterwiki ) { return ""; }
- $s = $this->getURL( "action=edit" );
+ $s = $this->getLocalURL( "action=edit" );
return $s;
}