# This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
if( defined( "MEDIAWIKI" ) ) {
-$wgVersion = '1.3.0+';
+$wgVersion = '1.4-prealpha';
$wgSitename = 'MediaWiki'; # Please customize!
$wgMetaNamespace = FALSE; # will be same as you set $wgSitename
function wfLocalUrlE( $a, $q = '' )
{
- return wfEscapeHTML( wfLocalUrl( $a, $q ) );
+ return htmlspecialchars( wfLocalUrl( $a, $q ) );
# die( "Call to obsolete function wfLocalUrlE()" );
}
-function wfFullUrl( $a, $q = '' ) {
- wfDebugDieBacktrace( 'Call to obsolete function wfFullUrl(); use Title::getFullURL' );
-}
-
-function wfFullUrlE( $a, $q = '' ) {
- wfDebugDieBacktrace( 'Call to obsolete function wfFullUrlE(); use Title::getFullUrlE' );
-
-}
-
-// orphan function wfThumbUrl( $img )
-//{
-// global $wgUploadPath;
-//
-// $nt = Title::newFromText( $img );
-// if( !$nt ) return "";
-//
-// $name = $nt->getDBkey();
-// $hash = md5( $name );
-//
-// $url = "{$wgUploadPath}/thumb/" . $hash{0} . "/" .
-// substr( $hash, 0, 2 ) . "/{$name}";
-// return wfUrlencode( $url );
-//}
-
-
-function wfImageArchiveUrl( $name )
-{
- global $wgUploadPath;
-
- $hash = md5( substr( $name, 15) );
- $url = "{$wgUploadPath}/archive/" . $hash{0} . "/" .
- substr( $hash, 0, 2 ) . "/{$name}";
- return wfUrlencode($url);
-}
-
+# We want / and : to be included as literal characters in our title URLs.
+# %2F in the page titles seems to fatally break for some reason.
+#
function wfUrlencode ( $s )
{
$s = urlencode( $s );
return $s;
}
-function wfUtf8Sequence($codepoint) {
+# Return the UTF-8 sequence for a given Unicode code point.
+# Currently doesn't work for values outside the Basic Multilingual Plane.
+#
+function wfUtf8Sequence( $codepoint ) {
if($codepoint < 0x80) return chr($codepoint);
if($codepoint < 0x800) return chr($codepoint >> 6 & 0x3f | 0xc0) .
chr($codepoint & 0x3f | 0x80);
}
# Converts numeric character entities to UTF-8
-function wfMungeToUtf8($string) {
+function wfMungeToUtf8( $string ) {
global $wgInputEncoding; # This is debatable
#$string = iconv($wgInputEncoding, "UTF-8", $string);
$string = preg_replace ( '/&#([0-9]+);/e', 'wfUtf8Sequence($1)', $string );
}
# Converts a single UTF-8 character into the corresponding HTML character entity
+# (for use with preg_replace_callback)
function wfUtf8Entity( $matches ) {
$char = $matches[0];
# Find the length
}
}
-
-function wfReadOnly()
-{
+# Check if the wiki read-only lock file is present. This can be used to lock off
+# editing functions, but doesn't guarantee that the database will not be modified.
+function wfReadOnly() {
global $wgReadOnlyFile;
- if ( "" == $wgReadOnlyFile ) { return false; }
+ if ( "" == $wgReadOnlyFile ) {
+ return false;
+ }
return is_file( $wgReadOnlyFile );
}
# Get a message from anywhere
function wfMsg( $key ) {
global $wgRequest;
- if ( $wgRequest->getVal( 'debugmsg' ) )
- {
+ if ( $wgRequest->getVal( 'debugmsg' ) ) {
if ( $key == 'linktrail' /* a special case where we want to return something specific */ )
return "/^()(.*)$/sD";
else
return $message;
}
-function wfCleanFormFields( $fields )
-{
- wfDebugDieBacktrace( 'Call to obsolete wfCleanFormFields(). Use wgRequest instead...' );
-}
-
-function wfMungeQuotes( $in )
-{
- $out = str_replace( '%', '%25', $in );
- $out = str_replace( "'", '%27', $out );
- $out = str_replace( '"', '%22', $out );
- return $out;
-}
-
-function wfDemungeQuotes( $in )
-{
- $out = str_replace( '%22', '"', $in );
- $out = str_replace( '%27', "'", $out );
- $out = str_replace( '%25', '%', $out );
- return $out;
-}
-
-function wfCleanQueryVar( $var )
-{
- wfDebugDieBacktrace( 'Call to obsolete function wfCleanQueryVar(); use wgRequest instead' );
-}
-
-function wfSearch( $s )
-{
- $se = new SearchEngine( $s );
- $se->showResults();
-}
-
-function wfGo( $s )
-{ # pick the nearest match
- $se = new SearchEngine( $s );
- $se->goResult();
-}
-
# Just like exit() but makes a note of it.
# Commits open transactions except if the error parameter is set
function wfAbruptExit( $error = false ){
wfAbruptExit( true );
}
+# This is meant as a debugging aid to track down where bad data comes from.
+# Shouldn't be used in production code except maybe in "shouldn't happen" areas.
+#
function wfDebugDieBacktrace( $msg = '' ) {
global $wgCommandLineMode;
die( $msg );
}
-function wfNumberOfArticles()
-{
- global $wgNumberOfArticles;
-
- wfLoadSiteStats();
- return $wgNumberOfArticles;
-}
-
-/* private */ function wfLoadSiteStats()
-{
- global $wgNumberOfArticles, $wgTotalViews, $wgTotalEdits;
- $fname = 'wfLoadSiteStats';
-
- if ( -1 != $wgNumberOfArticles ) return;
- $dbr =& wfGetDB( DB_SLAVE );
- $s = $dbr->getArray( 'site_stats',
- array( 'ss_total_views', 'ss_total_edits', 'ss_good_articles' ),
- array( 'ss_row_id' => 1 ), $fname
- );
-
- if ( $s === false ) {
- return;
- } else {
- $wgTotalViews = $s->ss_total_views;
- $wgTotalEdits = $s->ss_total_edits;
- $wgNumberOfArticles = $s->ss_good_articles;
- }
-}
-
-function wfEscapeHTML( $in )
-{
- return str_replace(
- array( '&', '"', '>', '<' ),
- array( '&', '"', '>', '<' ),
- $in );
-}
-
-function wfEscapeHTMLTagsOnly( $in ) {
- return str_replace(
- array( '"', '>', '<' ),
- array( '"', '>', '<' ),
- $in );
-}
-
-function wfUnescapeHTML( $in )
-{
- $in = str_replace( '<', '<', $in );
- $in = str_replace( '>', '>', $in );
- $in = str_replace( '"', '"', $in );
- $in = str_replace( '&', '&', $in );
- return $in;
-}
-
-function wfImageDir( $fname )
-{
- global $wgUploadDirectory;
-
- $hash = md5( $fname );
- $oldumask = umask(0);
- $dest = $wgUploadDirectory . '/' . $hash{0};
- if ( ! is_dir( $dest ) ) { mkdir( $dest, 0777 ); }
- $dest .= '/' . substr( $hash, 0, 2 );
- if ( ! is_dir( $dest ) ) { mkdir( $dest, 0777 ); }
-
- umask( $oldumask );
- return $dest;
-}
-
-function wfImageThumbDir( $fname , $subdir='thumb')
-{
- return wfImageArchiveDir( $fname, $subdir );
-}
-
-function wfImageArchiveDir( $fname , $subdir='archive')
-{
- global $wgUploadDirectory;
-
- $hash = md5( $fname );
- $oldumask = umask(0);
-
- # Suppress warning messages here; if the file itself can't
- # be written we'll worry about it then.
- $archive = "{$wgUploadDirectory}/{$subdir}";
- if ( ! is_dir( $archive ) ) { @mkdir( $archive, 0777 ); }
- $archive .= '/' . $hash{0};
- if ( ! is_dir( $archive ) ) { @mkdir( $archive, 0777 ); }
- $archive .= '/' . substr( $hash, 0, 2 );
- if ( ! is_dir( $archive ) ) { @mkdir( $archive, 0777 ); }
-
- umask( $oldumask );
- return $archive;
-}
-
-function wfRecordUpload( $name, $oldver, $size, $desc, $copyStatus = "", $source = "" )
-{
- global $wgUser, $wgLang, $wgTitle, $wgOut, $wgDeferredUpdateList;
- global $wgUseCopyrightUpload;
-
- $fname = 'wfRecordUpload';
- $dbw =& wfGetDB( DB_MASTER );
-
- # img_name must be unique
- if ( !$dbw->indexUnique( 'image', 'img_name' ) ) {
- wfDebugDieBacktrace( 'Database schema not up to date, please run maintenance/archives/patch-image_name_unique.sql' );
- }
-
-
- $now = wfTimestampNow();
- $won = wfInvertTimestamp( $now );
- $size = IntVal( $size );
-
- if ( $wgUseCopyrightUpload )
- {
- $textdesc = '== ' . wfMsg ( 'filedesc' ) . " ==\n" . $desc . "\n" .
- '== ' . wfMsg ( 'filestatus' ) . " ==\n" . $copyStatus . "\n" .
- '== ' . wfMsg ( 'filesource' ) . " ==\n" . $source ;
- }
- else $textdesc = $desc ;
-
- $now = wfTimestampNow();
- $won = wfInvertTimestamp( $now );
-
- # Test to see if the row exists using INSERT IGNORE
- # This avoids race conditions by locking the row until the commit, and also
- # doesn't deadlock. SELECT FOR UPDATE causes a deadlock for every race condition.
- $dbw->insert( 'image',
- array(
- 'img_name' => $name,
- 'img_size'=> $size,
- 'img_timestamp' => $now,
- 'img_description' => $desc,
- 'img_user' => $wgUser->getID(),
- 'img_user_text' => $wgUser->getName(),
- ), $fname, 'IGNORE'
- );
- $descTitle = Title::makeTitle( NS_IMAGE, $name );
-
- if ( $dbw->affectedRows() ) {
- # Successfully inserted, this is a new image
- $id = $descTitle->getArticleID();
-
- if ( $id == 0 ) {
- $seqVal = $dbw->nextSequenceValue( 'cur_cur_id_seq' );
- $dbw->insertArray( 'cur',
- array(
- 'cur_id' => $seqVal,
- 'cur_namespace' => NS_IMAGE,
- 'cur_title' => $name,
- 'cur_comment' => $desc,
- 'cur_user' => $wgUser->getID(),
- 'cur_user_text' => $wgUser->getName(),
- 'cur_timestamp' => $now,
- 'cur_is_new' => 1,
- 'cur_text' => $textdesc,
- 'inverse_timestamp' => $won,
- 'cur_touched' => $now
- ), $fname
- );
- $id = $dbw->insertId() or 0; # We should throw an error instead
-
- RecentChange::notifyNew( $now, $descTitle, 0, $wgUser, $desc );
-
- $u = new SearchUpdate( $id, $name, $desc );
- $u->doUpdate();
- }
- } else {
- # Collision, this is an update of an image
- # Get current image row for update
- $s = $dbw->getArray( 'image', array( 'img_name','img_size','img_timestamp','img_description',
- 'img_user','img_user_text' ), array( 'img_name' => $name ), $fname, 'FOR UPDATE' );
-
- # Insert it into oldimage
- $dbw->insertArray( 'oldimage',
- array(
- 'oi_name' => $s->img_name,
- 'oi_archive_name' => $oldver,
- 'oi_size' => $s->img_size,
- 'oi_timestamp' => $s->img_timestamp,
- 'oi_description' => $s->img_description,
- 'oi_user' => $s->img_user,
- 'oi_user_text' => $s->img_user_text
- ), $fname
- );
-
- # Update the current image row
- $dbw->updateArray( 'image',
- array( /* SET */
- 'img_size' => $size,
- 'img_timestamp' => wfTimestampNow(),
- 'img_user' => $wgUser->getID(),
- 'img_user_text' => $wgUser->getName(),
- 'img_description' => $desc,
- ), array( /* WHERE */
- 'img_name' => $name
- ), $fname
- );
-
- # Invalidate the cache for the description page
- $descTitle->invalidateCache();
- }
-
- $log = new LogPage( wfMsg( 'uploadlogpage' ), wfMsg( 'uploadlogpagetext' ) );
- $da = wfMsg( 'uploadedimage', '[[:' . $wgLang->getNsText(
- Namespace::getImage() ) . ":{$name}|{$name}]]" );
- $ta = wfMsg( 'uploadedimage', $name );
- $log->addEntry( $da, $desc, $ta );
-}
-
/* Some generic result counters, pulled out of SearchEngine */
$first = false;
}
- if ( wfIsWindows() ) {
- $retVal .= '"' . str_replace( '"','\"', $arg ) . '"';
- } else {
+ if ( function_exists( 'escapeshellarg' ) ) {
$retVal .= escapeshellarg( $arg );
+ } else {
+ $retVal .= '"' . str_replace( '"','\"', $arg ) . '"';
}
}
return $retVal;
return array_flip( array_intersect( array_flip( $a ), array_keys( $b ) ) );
}
-# Since Windows is so different to any of the other popular OSes, it seems appropriate
-# to have a simple way to test for its presence
-function wfIsWindows() {
- if (substr(php_uname(), 0, 7) == 'Windows') {
- return true;
- } else {
- return false;
- }
-}
-
# Ideally we'd be using actual time fields in the db
function wfTimestamp2Unix( $ts ) {
} //class
+
+function wfImageDir( $fname )
+{
+ global $wgUploadDirectory;
+
+ $hash = md5( $fname );
+ $oldumask = umask(0);
+ $dest = $wgUploadDirectory . '/' . $hash{0};
+ if ( ! is_dir( $dest ) ) { mkdir( $dest, 0777 ); }
+ $dest .= '/' . substr( $hash, 0, 2 );
+ if ( ! is_dir( $dest ) ) { mkdir( $dest, 0777 ); }
+
+ umask( $oldumask );
+ return $dest;
+}
+
+function wfImageThumbDir( $fname , $subdir='thumb')
+{
+ return wfImageArchiveDir( $fname, $subdir );
+}
+
+function wfImageArchiveDir( $fname , $subdir='archive')
+{
+ global $wgUploadDirectory;
+
+ $hash = md5( $fname );
+ $oldumask = umask(0);
+
+ # Suppress warning messages here; if the file itself can't
+ # be written we'll worry about it then.
+ $archive = "{$wgUploadDirectory}/{$subdir}";
+ if ( ! is_dir( $archive ) ) { @mkdir( $archive, 0777 ); }
+ $archive .= '/' . $hash{0};
+ if ( ! is_dir( $archive ) ) { @mkdir( $archive, 0777 ); }
+ $archive .= '/' . substr( $hash, 0, 2 );
+ if ( ! is_dir( $archive ) ) { @mkdir( $archive, 0777 ); }
+
+ umask( $oldumask );
+ return $archive;
+}
+
+function wfRecordUpload( $name, $oldver, $size, $desc, $copyStatus = "", $source = "" )
+{
+ global $wgUser, $wgLang, $wgTitle, $wgOut, $wgDeferredUpdateList;
+ global $wgUseCopyrightUpload;
+
+ $fname = 'wfRecordUpload';
+ $dbw =& wfGetDB( DB_MASTER );
+
+ # img_name must be unique
+ if ( !$dbw->indexUnique( 'image', 'img_name' ) ) {
+ wfDebugDieBacktrace( 'Database schema not up to date, please run maintenance/archives/patch-image_name_unique.sql' );
+ }
+
+
+ $now = wfTimestampNow();
+ $won = wfInvertTimestamp( $now );
+ $size = IntVal( $size );
+
+ if ( $wgUseCopyrightUpload )
+ {
+ $textdesc = '== ' . wfMsg ( 'filedesc' ) . " ==\n" . $desc . "\n" .
+ '== ' . wfMsg ( 'filestatus' ) . " ==\n" . $copyStatus . "\n" .
+ '== ' . wfMsg ( 'filesource' ) . " ==\n" . $source ;
+ }
+ else $textdesc = $desc ;
+
+ $now = wfTimestampNow();
+ $won = wfInvertTimestamp( $now );
+
+ # Test to see if the row exists using INSERT IGNORE
+ # This avoids race conditions by locking the row until the commit, and also
+ # doesn't deadlock. SELECT FOR UPDATE causes a deadlock for every race condition.
+ $dbw->insert( 'image',
+ array(
+ 'img_name' => $name,
+ 'img_size'=> $size,
+ 'img_timestamp' => $now,
+ 'img_description' => $desc,
+ 'img_user' => $wgUser->getID(),
+ 'img_user_text' => $wgUser->getName(),
+ ), $fname, 'IGNORE'
+ );
+ $descTitle = Title::makeTitle( NS_IMAGE, $name );
+
+ if ( $dbw->affectedRows() ) {
+ # Successfully inserted, this is a new image
+ $id = $descTitle->getArticleID();
+
+ if ( $id == 0 ) {
+ $seqVal = $dbw->nextSequenceValue( 'cur_cur_id_seq' );
+ $dbw->insertArray( 'cur',
+ array(
+ 'cur_id' => $seqVal,
+ 'cur_namespace' => NS_IMAGE,
+ 'cur_title' => $name,
+ 'cur_comment' => $desc,
+ 'cur_user' => $wgUser->getID(),
+ 'cur_user_text' => $wgUser->getName(),
+ 'cur_timestamp' => $now,
+ 'cur_is_new' => 1,
+ 'cur_text' => $textdesc,
+ 'inverse_timestamp' => $won,
+ 'cur_touched' => $now
+ ), $fname
+ );
+ $id = $dbw->insertId() or 0; # We should throw an error instead
+
+ RecentChange::notifyNew( $now, $descTitle, 0, $wgUser, $desc );
+
+ $u = new SearchUpdate( $id, $name, $desc );
+ $u->doUpdate();
+ }
+ } else {
+ # Collision, this is an update of an image
+ # Get current image row for update
+ $s = $dbw->getArray( 'image', array( 'img_name','img_size','img_timestamp','img_description',
+ 'img_user','img_user_text' ), array( 'img_name' => $name ), $fname, 'FOR UPDATE' );
+
+ # Insert it into oldimage
+ $dbw->insertArray( 'oldimage',
+ array(
+ 'oi_name' => $s->img_name,
+ 'oi_archive_name' => $oldver,
+ 'oi_size' => $s->img_size,
+ 'oi_timestamp' => $s->img_timestamp,
+ 'oi_description' => $s->img_description,
+ 'oi_user' => $s->img_user,
+ 'oi_user_text' => $s->img_user_text
+ ), $fname
+ );
+
+ # Update the current image row
+ $dbw->updateArray( 'image',
+ array( /* SET */
+ 'img_size' => $size,
+ 'img_timestamp' => wfTimestampNow(),
+ 'img_user' => $wgUser->getID(),
+ 'img_user_text' => $wgUser->getName(),
+ 'img_description' => $desc,
+ ), array( /* WHERE */
+ 'img_name' => $name
+ ), $fname
+ );
+
+ # Invalidate the cache for the description page
+ $descTitle->invalidateCache();
+ }
+
+ $log = new LogPage( wfMsg( 'uploadlogpage' ), wfMsg( 'uploadlogpagetext' ) );
+ $da = wfMsg( 'uploadedimage', '[[:' . $wgLang->getNsText(
+ Namespace::getImage() ) . ":{$name}|{$name}]]" );
+ $ta = wfMsg( 'uploadedimage', $name );
+ $log->addEntry( $da, $desc, $ta );
+}
+
+function wfImageArchiveUrl( $name )
+{
+ global $wgUploadPath;
+
+ $hash = md5( substr( $name, 15) );
+ $url = "{$wgUploadPath}/archive/" . $hash{0} . "/" .
+ substr( $hash, 0, 2 ) . "/{$name}";
+ return wfUrlencode($url);
+}
+
+?>
Special handling for image description pages
*/
+require_once( "Image.php" );
+
class ImagePage extends Article {
/* private */ var $img; // Image object this page is shown for. Initilaized in openShowImage, not
}
}
+
?>
$this->lastdate = $this->lastline = "";
$s = "\n<p>" . wfMsg( "histlegend" ).'</p>';
$s .="\n<form action=\"" . $wgTitle->escapeLocalURL( '-' ) . "\" method=\"get\">";
- $s .= "<input type=\"hidden\" name=\"title\" value=\"".wfEscapeHTML($wgTitle->getPrefixedDbKey())."\"/>\n";
+ $s .= "<input type=\"hidden\" name=\"title\" value=\"".htmlspecialchars($wgTitle->getPrefixedDbKey())."\"/>\n";
$s .= !empty($this->submitbuttonhtml1) ? $this->submitbuttonhtml1."\n":'';
$s .= "" . "\n<ul id=\"pagehistory\" >";
return $s;
$text = "[" . ++$this->mAutonumber . "]";
} else {
# Otherwise just use the URL
- $text = wfEscapeHTML( $url );
+ $text = htmlspecialchars( $url );
}
} else {
# Have link text, e.g. [http://domain.tld/some.link text]s
return $wgCurParser->variableSubstitution( $matches );
}
+function wfNumberOfArticles()
+{
+ global $wgNumberOfArticles;
+
+ wfLoadSiteStats();
+ return $wgNumberOfArticles;
+}
+
+/* private */ function wfLoadSiteStats()
+{
+ global $wgNumberOfArticles, $wgTotalViews, $wgTotalEdits;
+ $fname = 'wfLoadSiteStats';
+
+ if ( -1 != $wgNumberOfArticles ) return;
+ $dbr =& wfGetDB( DB_SLAVE );
+ $s = $dbr->getArray( 'site_stats',
+ array( 'ss_total_views', 'ss_total_edits', 'ss_good_articles' ),
+ array( 'ss_row_id' => 1 ), $fname
+ );
+
+ if ( $s === false ) {
+ return;
+ } else {
+ $wgTotalViews = $s->ss_total_views;
+ $wgTotalEdits = $s->ss_total_edits;
+ $wgNumberOfArticles = $s->ss_good_articles;
+ }
+}
+
+function wfEscapeHTMLTagsOnly( $in ) {
+ return str_replace(
+ array( '"', '>', '<' ),
+ array( '"', '>', '<' ),
+ $in );
+}
+
+
?>
$link = urldecode( $link );
$link = $wgLang->checkTitleEncoding( $link );
$link = str_replace( '_', ' ', $link );
- $link = wfEscapeHTML( $link );
+ $link = htmlspecialchars( $link );
$r = ($class != '') ? " class='$class'" : " class='external'";
$link = urldecode( $link );
$link = str_replace( '_', ' ', $link );
- $link = wfEscapeHTML( $link );
+ $link = htmlspecialchars( $link );
if ( $broken == 'stub' ) {
$r = ' class="stub"';
if ( $wgOut->isArticleRelated() ) {
if ( $wgTitle->getNamespace() == Namespace::getImage() ) {
$name = $wgTitle->getDBkey();
- $link = wfEscapeHTML( Image::wfImageUrl( $name ) );
+ $link = htmlspecialchars( Image::wfImageUrl( $name ) );
$style = $this->getInternalLinkAttributes( $link, $name );
$s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
}
$t = $wgTitle->getDBkey();
$name = 'Approve this article' ;
$link = "http://test.wikipedia.org/w/magnus/wiki.phtml?title={$t}&action=submit&doit=1" ;
- #wfEscapeHTML( wfImageUrl( $name ) );
+ #htmlspecialchars( wfImageUrl( $name ) );
$style = $this->getExternalLinkAttributes( $link, $name );
$s .= " | <a href=\"{$link}\"{$style}>{$name}</a>" ;
}
function fnamePart( $url )
{
$basename = strrchr( $url, '/' );
- if ( false === $basename ) { $basename = $url; }
- else { $basename = substr( $basename, 1 ); }
- return wfEscapeHTML( $basename );
+ if ( false === $basename ) {
+ $basename = $url;
+ } else {
+ $basename = substr( $basename, 1 );
+ }
+ return htmlspecialchars( $basename );
}
function makeImage( $url, $alt = '' )
{
global $wgOut;
- if ( '' == $alt ) { $alt = $this->fnamePart( $url ); }
+ if ( '' == $alt ) {
+ $alt = $this->fnamePart( $url );
+ }
$s = '<img src="'.$url.'" alt="'.$alt.'" />';
return $s;
}
function formatComment($comment)
{
global $wgLang;
- $comment=wfEscapeHTML($comment);
+ $comment = htmlspecialchars( $comment );
# The pattern for autogen comments is / * foo * /, which makes for
# some nasty regex.
$dlink = $del;
}
} else {
- $url = wfEscapeHTML( wfImageArchiveUrl( $img ) );
+ $url = htmlspecialchars( wfImageArchiveUrl( $img ) );
if( $wgUser->getID() != 0 && $wgTitle->userCanEdit() ) {
$rlink = $this->makeKnownLink( $wgTitle->getPrefixedText(),
wfMsg( 'revertimg' ), 'action=revert&oldimage=' .
$cmq = "AND cur_minor_edit=0";
$omq = "AND old_minor_edit=0";
$mlink = $sk->makeKnownLink( $wgLang->specialPage( "Contributions" ),
- WfMsg( "show" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
+ WfMsg( "show" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
"&offset={$offset}&limit={$limit}&hideminor=0" );
} else {
$cmq = $omq = "";
$mlink = $sk->makeKnownLink( $wgLang->specialPage( "Contributions" ),
- WfMsg( "hide" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
+ WfMsg( "hide" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
"&offset={$offset}&limit={$limit}&hideminor=1" );
}
$wgOut->addHTML( " ({$ublink})" );
}
if ( "" != $block->mReason ) {
- $wgOut->addHTML( " <em>(" . wfEscapeHTML( $block->mReason ) .
+ $wgOut->addHTML( " <em>(" . htmlspecialchars( $block->mReason ) .
")</em>" );
}
$wgOut->addHTML( "</li>\n" );
# First section: identity
# Email, etc.
#
- $this->mUserEmail = wfEscapeHTML( $this->mUserEmail );
- $this->mRealName = wfEscapeHTML( $this->mRealName );
- $this->mNick = wfEscapeHTML( $this->mNick );
+ $this->mUserEmail = htmlspecialchars( $this->mUserEmail );
+ $this->mRealName = htmlspecialchars( $this->mRealName );
+ $this->mNick = htmlspecialchars( $this->mNick );
if ( $this->mEmailFlag ) { $emfc = 'checked="checked"'; }
else { $emfc = ""; }
# Fields for changing password
#
- $this->mOldpass = wfEscapeHTML( $this->mOldpass );
- $this->mNewpass = wfEscapeHTML( $this->mNewpass );
- $this->mRetypePass = wfEscapeHTML( $this->mRetypePass );
+ $this->mOldpass = htmlspecialchars( $this->mOldpass );
+ $this->mNewpass = htmlspecialchars( $this->mNewpass );
+ $this->mRetypePass = htmlspecialchars( $this->mRetypePass );
$wgOut->addHTML( "<fieldset>
<legend>$cp</legend>
$hideminor = ($hideminor ? 1 : 0);
if ( $hideminor ) {
$mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
- WfMsg( "show" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
+ WfMsg( "show" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
"&days={$days}&limit={$limit}&hideminor=0" );
} else {
$mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
- WfMsg( "hide" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
+ WfMsg( "hide" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
"&days={$days}&limit={$limit}&hideminor=1" );
}
if ( $hideminor ) {
function wfSpecialSearch( $par ) {
global $wgOutput;
- wfSearch( $par );
+ $searchEngine = new SearchEngine( $par );
+ $searchEngine->showResults();
}
# Hey, it could be worse. It could be /bin/true on Solaris!
<?php
+require_once( "Image.php" );
+
function wfSpecialUpload()
{
global $wgRequest;
$titleObj = Title::makeTitle( NS_SPECIAL, "Userlogin" );
$action = $titleObj->escapeLocalUrl( $q );
- $encName = wfEscapeHTML( $this->mName );
- $encPassword = wfEscapeHTML( $this->mPassword );
- $encRetype = wfEscapeHTML( $this->mRetype );
- $encEmail = wfEscapeHTML( $this->mEmail );
- $encRealName = wfEscapeHTML( $this->mRealName );
+ $encName = htmlspecialchars( $this->mName );
+ $encPassword = htmlspecialchars( $this->mPassword );
+ $encRetype = htmlspecialchars( $this->mRetype );
+ $encEmail = htmlspecialchars( $this->mEmail );
+ $encRealName = htmlspecialchars( $this->mRealName );
if ($wgUser->getID() != 0) {
$cambutton = "<input tabindex='6' type='submit' name=\"wpCreateaccountMail\" value=\"{$cam}\" />";
if ( $search = $wgRequest->getText( 'search' ) ) {
$wgTitle = Title::makeTitle( NS_SPECIAL, "Search" );
+ $searchEngine = new SearchEngine( $search );
if( $wgRequest->getVal( 'fulltext' ) ||
!is_null( $wgRequest->getVal( 'offset' ) ) ||
!is_null ($wgRequest->getVal( 'searchx' ) ) ) {
- wfSearch( $search );
+ $searchEngine->showResults();
} else {
- wfGo( $search );
+ $searchEngine->goResult();
}
} else if( !$wgTitle or $wgTitle->getDBkey() == "" ) {
$wgTitle = Title::newFromText( wfMsg( "badtitle" ) );