* Make makeInternalOrExternalUrl() use the same url protocols as the parser
[lhc/web/wiklou.git] / includes / OutputPage.php
index e079edb..36e5871 100644 (file)
@@ -32,6 +32,7 @@ class OutputPage {
        var $mParserOptions;
        var $mShowFeedLinks = false;
        var $mEnableClientCache = true;
+       var $mArticleBodyOnly = false;
 
        /**
         * Constructor
@@ -67,6 +68,8 @@ class OutputPage {
        function getScript() { return $this->mScripts; }
 
        function setETag($tag) { $this->mETag = $tag; }
+       function setArticleBodyOnly($only) { $this->mArticleBodyOnly = $only; }
+       function getArticleBodyOnly($only) { return $this->mArticleBodyOnly; }
 
        function addLink( $linkarr ) {
                # $linkarr should be an associative array of attributes. We'll escape on output.
@@ -110,7 +113,8 @@ class OutputPage {
                        # Wed, 20 Aug 2003 06:51:19 GMT; length=5202
                        # this breaks strtotime().
                        $modsince = preg_replace( '/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"] );
-                       $ismodsince = wfTimestamp( TS_MW, strtotime( $modsince ) );
+                       $modsinceTime = strtotime( $modsince );
+                       $ismodsince = wfTimestamp( TS_MW, $modsinceTime ? $modsinceTime : 1 );
                        wfDebug( "-- client send If-Modified-Since: " . $modsince . "\n", false );
                        wfDebug( "--  we might send Last-Modified : $lastmod\n", false );
                        if( ($ismodsince >= $timestamp ) && $wgUser->validateCache( $ismodsince ) ) {
@@ -120,6 +124,7 @@ class OutputPage {
                                $this->sendCacheControl();
                                wfDebug( "CACHED client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp\n", false );
                                $this->disable();
+                               @ob_end_clean(); // Don't output compressed blob
                                return true;
                        } else {
                                wfDebug( "READY  client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp\n", false );
@@ -447,9 +452,13 @@ class OutputPage {
                        setcookie( $name, $val, $exp, '/' );
                }
 
-               wfProfileIn( 'Output-skin' );
-               $sk->outputPage( $this );
-               wfProfileOut( 'Output-skin' );
+               if ($this->mArticleBodyOnly) {
+                       $this->out($this->mBodytext);
+               } else {
+                       wfProfileIn( 'Output-skin' );
+                       $sk->outputPage( $this );
+                       wfProfileOut( 'Output-skin' );
+               }
 
                $this->sendCacheControl();
                ob_end_flush();
@@ -756,14 +765,15 @@ class OutputPage {
        }
 
        /**
-        * This function takes the existing and broken links for the page
+        * This function takes the title (first item of mGoodLinks), categories, existing and broken links for the page
         * and uses the first 10 of them for META keywords
         */
        function addMetaTags () {
                global $wgLinkCache , $wgOut ;
+               $categories = array_keys ( $wgLinkCache->mCategoryLinks ) ;
                $good = array_keys ( $wgLinkCache->mGoodLinks ) ;
                $bad = array_keys ( $wgLinkCache->mBadLinks ) ;
-               $a = array_merge ( $good , $bad ) ;
+               $a = array_merge ( array_slice ( $good , 0 , 1 ), $categories, array_slice ( $good , 1 , 9 ) , $bad ) ;
                $a = array_slice ( $a , 0 , 10 ) ; # 10 keywords max
                $a = implode ( ',' , $a ) ;
                $strip = array(
@@ -871,7 +881,7 @@ class OutputPage {
        /**
         * Turn off regular page output and return an error reponse
         * for when rate limiting has triggered.
-        * @todo: i18n
+        * @todo i18n
         * @access public
         */
        function rateLimited() {