33 $r = $this->parent->request;
34 $userLang = $r->getVal(
'uselang' );
35 $contLang = $r->getVal(
'ContLang' );
37 $languages = MediaWikiServices::getInstance()
38 ->getLanguageNameUtils()
39 ->getLanguageNames( LanguageNameUtils::AUTONYMS, LanguageNameUtils::SUPPORTED );
40 $lifetime = intval( ini_get(
'session.gc_maxlifetime' ) );
45 if ( $r->wasPosted() ) {
47 if ( $this->parent->getSession(
'test' ) ===
null ) {
48 $requestTime = $r->getIntOrNull(
'LanguageRequestTime' );
49 if ( !$requestTime ) {
52 $msg =
'config-session-expired';
53 } elseif ( time() - $requestTime > $lifetime ) {
54 $msg =
'config-session-expired';
56 $msg =
'config-no-session';
58 $this->parent->showError( $msg,
$wgLang->formatTimePeriod( $lifetime ) );
60 if ( isset( $languages[$userLang] ) ) {
61 $this->
setVar(
'_UserLang', $userLang );
63 if ( isset( $languages[$contLang] ) ) {
64 $this->
setVar(
'wgLanguageCode', $contLang );
69 } elseif ( $this->parent->showSessionWarning ) {
70 # The user was knocked back from another page to the start
71 # This probably indicates a session expiry
72 $this->parent->showError(
'config-session-expired',
73 $wgLang->formatTimePeriod( $lifetime ) );
76 $this->parent->setSession(
'test',
true );
78 if ( !isset( $languages[$userLang] ) ) {
79 $userLang = $this->
getVar(
'_UserLang',
'en' );
81 if ( !isset( $languages[$contLang] ) ) {
82 $contLang = $this->
getVar(
'wgLanguageCode',
'en' );
85 $s = Html::hidden(
'LanguageRequestTime', time() ) .
87 $this->parent->getHelpBox(
'config-your-language-help' ) ) .
89 $this->parent->getHelpBox(
'config-wiki-language-help' ) );
91 $this->
endForm(
'continue',
false );
109 $select =
new XmlSelect( $name, $name, $selectedCode );
110 $select->setAttribute(
'tabindex', $this->parent->nextTabIndex() );
112 $languages = MediaWikiServices::getInstance()
113 ->getLanguageNameUtils()
114 ->getLanguageNames( LanguageNameUtils::AUTONYMS, LanguageNameUtils::SUPPORTED );
115 foreach ( $languages as $code =>
$lang ) {
116 $select->addOption(
"$code - $lang", $code );
119 $output .= $select->getHTML();
120 return $this->parent->label( $label, $name, $output );