MediaWiki
REL1_24
|
00001 <?php 00052 class UserNotLoggedIn extends ErrorPageError { 00053 00065 public function __construct( 00066 $reasonMsg = 'exception-nologin-text', 00067 $titleMsg = 'exception-nologin', 00068 $params = array() 00069 ) { 00070 parent::__construct( $titleMsg, $reasonMsg, $params ); 00071 } 00072 00077 public function report() { 00078 // If an unsupported message is used, don't try redirecting to Special:Userlogin, 00079 // since the message may not be compatible. 00080 if ( !in_array( $this->msg, LoginForm::$validErrorMessages ) ) { 00081 parent::report(); 00082 } 00083 00084 // Message is valid. Redirec to Special:Userlogin 00085 00086 $context = RequestContext::getMain(); 00087 00088 $output = $context->getOutput(); 00089 $query = $context->getRequest()->getValues(); 00090 // Title will be overridden by returnto 00091 unset( $query['title'] ); 00092 // Redirect to Special:Userlogin 00093 $output->redirect( SpecialPage::getTitleFor( 'Userlogin' )->getFullURL( array( 00094 // Return to this page when the user logs in 00095 'returnto' => $context->getTitle()->getFullText(), 00096 'returntoquery' => wfArrayToCgi( $query ), 00097 'warning' => $this->msg, 00098 ) ) ); 00099 00100 $output->output(); 00101 } 00102 }