$tpl = new Template(); echo $tpl->Process(BASE_PATH . 'error.tpl', $vars); } function Haxor() { $this->Error('Please stop hack us, evil haxor.'); } function Process() { if (_GET('filename') == '') { $this->Haxor(); return; } $img = new Image(); if (!$img->Find(array('filename' => _GET('filename')))) { $this->Error('Requested file not found'); return; } $this->img = $img; $this->Render(); } function Render() { $vars = array(); $vars['img'] = $this->img; $tpl = new Template(); echo $tpl->Process(BASE_PATH . 'info.tpl', $vars); } } $page = new InfoPage(); $page->Process();
/** * If existing wiki: show message or redirect if &testwiki is set to that * Missing article on Wx/xx info pages: show welcome page * See also: IncubatorTest::onGetUserPermissionsErrors() * @return True */ static function onShowMissingArticle( $article ) { global $wgOut, $wmincTestWikiNamespaces; $title = $article->getTitle(); $prefix = self::analyzePrefix( $title->getText(), true /* only info pages */, true /* allow sister projects */ ); if( !in_array( $title->getNamespace(), $wmincTestWikiNamespaces ) ) { return true; } if( $prefix['error'] ) { # We are not on info pages global $wmincSisterProjects; $prefix2 = self::analyzePrefix( $title->getText(), false, true ); $p = isset( $prefix2['project' ] ) ? $prefix2['project'] : ''; if( self::getDBState( $prefix2 ) == 'existing' ) { $link = self::getSubdomain( $prefix2['lang'], $p, ( $title->getNsText() ? $title->getNsText() . ':' : '' ) . $prefix2['realtitle'] ); if( self::displayPrefix() == $prefix2['prefix'] ) { # Redirect to the existing wiki if the user has this wiki as preference $wgOut->redirect( $link ); return true; } else { # Show a link to the existing wiki $showLink = self::makeExternalLinkText( $link, true ); $wgOut->addHtml( '<div class="wminc-wiki-exists">' . wfMsgHtml( 'wminc-error-wiki-exists', $showLink ) . '</div>' ); } } elseif( array_key_exists( $p, $wmincSisterProjects ) ) { # A sister project is not hosted here, so direct the user to the relevant wiki $link = self::getSubdomain( $prefix2['lang'], $p, ( $title->getNsText() ? $title->getNsText() . ':' : '' ) . $prefix2['realtitle'] ); $showLink = self::makeExternalLinkText( $link, true ); $wgOut->addHtml( '<div class="wminc-wiki-sister">' . wfMsgHtml( 'wminc-error-wiki-sister', $showLink ) . '</div>' ); } elseif ( self::shouldWeShowUnprefixedError( $title ) ) { # Unprefixed pages if( self::isContentProject() ) { # If the user has a test wiki pref, suggest a page title with prefix $suggesttitle = isset( $prefix2['realtitle'] ) ? $prefix2['realtitle'] : $title->getText(); $suggest = self::displayPrefixedTitle( $suggesttitle, $title->getNamespace() ); # Suggest to create a prefixed page $wgOut->addHtml( '<div class="wminc-unprefixed-suggest">' . wfMsgWikiHtml( 'wminc-error-unprefixed-suggest', $suggest ) . '</div>' ); } else { $wgOut->addWikiMsg( 'wminc-error-unprefixed' ); } } return true; } # At this point we should be on info pages ("Wx/xx[x]" pages) # So use the InfoPage class to show a nice welcome page # depending on whether it belongs to an existing, closed or missing wiki if( $title->getNamespace() != NS_MAIN ) { return true; # not for other namespaces } $infopage = new InfoPage( $title, $prefix ); $infopage->mDbStatus = $dbstate = self::getDBState( $prefix ); if( $dbstate == 'existing' ) { $infopage->mSubStatus = 'beforeincubator'; $wgOut->addHtml( $infopage->showExistingWiki() ); } elseif( $dbstate == 'closed' ) { $infopage->mSubStatus = 'imported'; $wgOut->addHtml( $infopage->showIncubatingWiki() ); } else { $wgOut->addHtml( $infopage->showMissingWiki() ); } # Set the page title from "Wx/xyz - Incubator" to "Wikiproject Language - Incubator" $wgOut->setHTMLTitle( wfMsg( 'pagetitle', $infopage->mFormatTitle ) ); return true; }