From 9db190c7e736ec8d063187d4241b59feaf7dc2d1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 22 Jun 2011 11:28:20 +0200 Subject: update to MediaWiki 1.17.0 --- includes/installer/WebInstallerOutput.php | 269 ++++++++++++++++++++++++++++++ 1 file changed, 269 insertions(+) create mode 100644 includes/installer/WebInstallerOutput.php (limited to 'includes/installer/WebInstallerOutput.php') diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php new file mode 100644 index 00000000..cb708d13 --- /dev/null +++ b/includes/installer/WebInstallerOutput.php @@ -0,0 +1,269 @@ +parent = $parent; + } + + public function addHTML( $html ) { + $this->contents .= $html; + $this->flush(); + } + + public function addWikiText( $text ) { + $this->addHTML( $this->parent->parse( $text ) ); + } + + public function addHTMLNoFlush( $html ) { + $this->contents .= $html; + } + + public function redirect( $url ) { + if ( $this->headerDone ) { + throw new MWException( __METHOD__ . ' called after sending headers' ); + } + $this->redirectTarget = $url; + } + + public function output() { + $this->flush(); + $this->outputFooter(); + } + + /** + * Get the raw vector CSS, flipping if needed + * @param $dir String 'ltr' or 'rtl' + * @return String + */ + public function getCSS( $dir ) { + $skinDir = dirname( dirname( dirname( __FILE__ ) ) ) . '/skins'; + $vectorCssFile = "$skinDir/vector/screen.css"; + $configCssFile = "$skinDir/common/config.css"; + $css = ''; + wfSuppressWarnings(); + $vectorCss = file_get_contents( $vectorCssFile ); + $configCss = file_get_contents( $configCssFile ); + wfRestoreWarnings(); + if( !$vectorCss || !$configCss ) { + $css = "/** Your webserver cannot read $vectorCssFile or $configCssFile, please check file permissions */"; + } + + $css .= str_replace( 'images/', '../skins/vector/images/', $vectorCss ) . "\n" . str_replace( 'images/', '../skins/common/images/', $configCss ); + if( $dir == 'rtl' ) { + $css = CSSJanus::transform( $css, true ); + } + return $css; + } + + /** + * URL for index.php?css=foobar + * @return String + */ + private function getCssUrl( ) { + return $_SERVER['PHP_SELF'] . '?css=' . $this->getDir(); + } + + public function useShortHeader( $use = true ) { + $this->useShortHeader = $use; + } + + public function allowFrames( $allow = true ) { + $this->allowFrames = $allow; + } + + public function flush() { + if ( !$this->headerDone ) { + $this->outputHeader(); + } + if ( !$this->redirectTarget && strlen( $this->contents ) ) { + echo $this->contents; + flush(); + $this->contents = ''; + } + } + + public function getDir() { + global $wgLang; + if( !is_object( $wgLang ) || !$wgLang->isRtl() ) + return 'ltr'; + else + return 'rtl'; + } + + public function getLanguageCode() { + global $wgLang; + if( !is_object( $wgLang ) ) + return 'en'; + else + return $wgLang->getCode(); + } + + public function getHeadAttribs() { + return array( + 'dir' => $this->getDir(), + 'lang' => $this->getLanguageCode(), + ); + } + + /** + * Get whether the header has been output + * @return bool + */ + public function headerDone() { + return $this->headerDone; + } + + public function outputHeader() { + $this->headerDone = true; + $dbTypes = $this->parent->getDBTypes(); + + $this->parent->request->response()->header( 'Content-Type: text/html; charset=utf-8' ); + if (!$this->allowFrames) { + $this->parent->request->response()->header( 'X-Frame-Options: DENY' ); + } + if ( $this->redirectTarget ) { + $this->parent->request->response()->header( 'Location: '.$this->redirectTarget ); + return; + } + + if ( $this->useShortHeader ) { + $this->outputShortHeader(); + return; + } + +?> +getHeadAttribs() ); ?> + + + + <?php $this->outputTitle(); ?> + + getCssUrl() ) . "\n"; ?> + + getJQuery() . "\n"; ?> + + + + $this->getDir() ) ) . "\n"; ?> +
+
+
+
+ +

outputTitle(); ?>

+useShortHeader ) { +?> + + + +
+ + +
+ + +
+parent->parse( wfMsgNoTrans( 'config-sidebar' ), true ); +?> +
+
+ + + + +getHeadAttribs() ); ?> + + + + <?php $this->outputTitle(); ?> + getCssUrl() ) . "\n"; ?> + getJQuery(); ?> + + + + +