* Main wiki script; see docs/design.txt
* @package MediaWiki
*/
-
$wgRequestTime = microtime();
+# getrusage() does not exist on the Window$ platform, catching this
+if ( function_exists ( 'getrusage' ) ) {
+ $wgRUstart = getrusage();
+} else {
+ $wgRUstart = array() ;
+}
+
unset( $IP );
@ini_set( 'allow_url_fopen', 0 ); # For security...
+if ( isset( $_REQUEST['GLOBALS'] ) ) {
+ die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>');
+}
+
# Valid web server entry point, enable includes.
# Please don't move this line to includes/Defines.php. This line essentially defines
# a valid entry point. If you put it in includes/Defines.php, then any script that includes
/* check variant links so that interwiki links don't have to worry about
the possible different language variants
*/
- if( !is_null($wgTitle) && $wgTitle->getArticleID() == 0 )
+ if( count($wgContLang->getVariants()) > 1 && !is_null($wgTitle) && $wgTitle->getArticleID() == 0 )
$wgContLang->findVariantLink( $title, $wgTitle );
}
# Debug statement for user levels
// print_r($wgUser);
+$search = $wgRequest->getText( 'search' );
+if( !is_null( $search ) && $search !== '' ) {
+ // Compatibility with old search URLs which didn't use Special:Search
+ // Do this above the read whitelist check for security...
+ $wgTitle = Title::makeTitle( NS_SPECIAL, 'Search' );
+}
+
# If the user is not logged in, the Namespace:title of the article must be in
# the Read array in order for the user to see it. (We have to check here to
# catch special pages etc. We check again in Article::view())
}
wfProfileIn( 'main-action' );
-$search = $wgRequest->getText( 'search' );
-if( $wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
- $wgTitle = Title::makeTitle( NS_SPECIAL, 'Search' );
-}
if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
require_once( 'includes/SpecialSearch.php' );
wfSpecialSearch();
} else if( !$wgTitle or $wgTitle->getDBkey() == '' ) {
$wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) );
- $wgOut->setStatusCode( 404 );
$wgOut->errorpage( 'badtitle', 'badtitletext' );
} else if ( $wgTitle->getInterwiki() != '' ) {
if( $rdfrom = $wgRequest->getVal( 'rdfrom' ) ) {
$wgOut->redirect( $url );
} else {
$wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) );
- $wgOut->setStatusCode( 404 );
$wgOut->errorpage( 'badtitle', 'badtitletext' );
}
} else if ( ( $action == 'view' ) &&
$wgTitle = Title::makeTitle( NS_IMAGE, $wgTitle->getDBkey() );
}
- if ( !$wgTitle->exists() ) {
- $wgOut->setStatusCode( 404 );
- }
-
$ns = $wgTitle->getNamespace();
// Namespace might change when using redirects
unset($wgArticle);
require_once( 'includes/ImagePage.php' );
$wgArticle = new ImagePage( $wgTitle );
- } elseif ( $wgUseCategoryMagic && $ns == NS_CATEGORY ) {
+ } elseif ( $ns == NS_CATEGORY ) {
unset($wgArticle);
require_once( 'includes/CategoryPage.php' );
$wgArticle = new CategoryPage( $wgTitle );
}
if ( in_array( $action, $wgDisabledActions ) ) {
- $wgOut->setStatusCode( 404 );
$wgOut->errorpage( 'nosuchaction', 'nosuchactiontext' );
} else {
switch( $action ) {
case 'validate':
case 'render':
case 'deletetrackback':
+ case 'purge':
$wgArticle->$action();
break;
case 'print':
$raw = new RawPage( $wgArticle );
$raw->view();
break;
- case 'purge':
- wfPurgeSquidServers(array($wgTitle->getInternalURL()));
- $wgOut->setSquidMaxage( $wgSquidMaxage );
- $wgTitle->invalidateCache();
- $wgArticle->view();
- break;
default:
if (wfRunHooks('UnknownAction', array($action, $wgArticle))) {
- $wgOut->setStatusCode( 404 );
$wgOut->errorpage( 'nosuchaction', 'nosuchactiontext' );
}
}
wfProfileOut( 'main-cleanup' );
+wfProfileClose();
logProfilingData();
$wgLoadBalancer->closeAll();
wfDebug( "Request ended normally\n" );