removing print_r *hides
[lhc/web/wiklou.git] / index.php
index 5cea983..3eb2572 100644 (file)
--- a/index.php
+++ b/index.php
@@ -31,7 +31,6 @@ $wgTitle = Title::newFromText( wfMsg( "badtitle" ) );
 $wgArticle = new Article($wgTitle);
 
 $action = strtolower( trim( $action ) );
-if ( "" == $action ) { $action = "view"; }
 if ($wgRequest->getVal( "printable" ) == "yes") {
        $wgOut->setPrintable();
 }
@@ -49,7 +48,7 @@ wfProfileOut( "main-misc-setup" );
 # 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())
-if ( !$wgTitle->userCanRead() ) {
+if ( !is_null( $wgTitle ) && !$wgTitle->userCanRead() ) {
        $wgOut->loginToUse();
        $wgOut->output();
        exit;
@@ -68,7 +67,7 @@ if ( $search = $wgRequest->getText( 'search' ) ) {
 } else if ( $wgTitle->getInterwiki() != "" ) {
        $url = $wgTitle->getFullURL();
        # Check for a redirect loop
-       if ( !preg_match( "/^" . preg_quote( $wgServer ) . "/", $url ) && $wgTitle->isLocal() ) {
+       if ( !preg_match( "/^" . preg_quote( $wgServer, "/" ) . "/", $url ) && $wgTitle->isLocal() ) {
                $wgOut->redirect( $url );
        } else {
                $wgTitle = Title::newFromText( wfMsg( "badtitle" ) );
@@ -78,7 +77,10 @@ if ( $search = $wgRequest->getText( 'search' ) ) {
        /* redirect to canonical url, make it a 301 to allow caching */
        $wgOut->redirect( $wgTitle->getFullURL(), '301');
 } else if ( Namespace::getSpecial() == $wgTitle->getNamespace() ) {
-       wfSpecialPage();
+       # actions that need to be made when we have a special pages
+       require_once( 'includes/SpecialPage.php' );
+       if ( !$wgAllowSysopQueries ) {SpecialPage::removePage( 'Asksql' ); }
+       SpecialPage::executePath( $wgTitle );
 } else {
        if ( Namespace::getMedia() == $wgTitle->getNamespace() ) {
                $wgTitle = Title::makeTitle( Namespace::getImage(), $wgTitle->getDBkey() );
@@ -152,6 +154,7 @@ if ( $search = $wgRequest->getText( 'search' ) ) {
                case "purge":
                        wfPurgeSquidServers(array($wgTitle->getInternalURL()));
                        $wgOut->setSquidMaxage( $wgSquidMaxage );
+                       $wgTitle->invalidateCache();
                        $wgArticle->view();
                        break;
                default: