32 $r = $this->parent->request;
33 $userLang = $r->getVal(
'uselang' );
34 $contLang = $r->getVal(
'ContLang' );
36 $languages = MediaWikiServices::getInstance()
37 ->getLanguageNameUtils()
38 ->getLanguageNames( LanguageNameUtils::AUTONYMS, LanguageNameUtils::SUPPORTED );
39 $lifetime = intval( ini_get(
'session.gc_maxlifetime' ) );
44 if ( $r->wasPosted() ) {
46 if ( $this->parent->getSession(
'test' ) ===
null ) {
47 $requestTime = $r->getIntOrNull(
'LanguageRequestTime' );
48 if ( !$requestTime ) {
51 $msg =
'config-session-expired';
52 } elseif ( time() - $requestTime > $lifetime ) {
53 $msg =
'config-session-expired';
55 $msg =
'config-no-session';
57 $this->parent->showError( $msg,
$wgLang->formatTimePeriod( $lifetime ) );
59 if ( isset( $languages[$userLang] ) ) {
60 $this->
setVar(
'_UserLang', $userLang );
62 if ( isset( $languages[$contLang] ) ) {
63 $this->
setVar(
'wgLanguageCode', $contLang );
68 } elseif ( $this->parent->showSessionWarning ) {
69 # The user was knocked back from another page to the start
70 # This probably indicates a session expiry
71 $this->parent->showError(
'config-session-expired',
72 $wgLang->formatTimePeriod( $lifetime ) );
75 $this->parent->setSession(
'test',
true );
77 if ( !isset( $languages[$userLang] ) ) {
78 $userLang = $this->
getVar(
'_UserLang',
'en' );
80 if ( !isset( $languages[$contLang] ) ) {
81 $contLang = $this->
getVar(
'wgLanguageCode',
'en' );
84 $s = Html::hidden(
'LanguageRequestTime', time() ) .
86 $this->parent->getHelpBox(
'config-your-language-help' ) ) .
88 $this->parent->getHelpBox(
'config-wiki-language-help' ) );
90 $this->
endForm(
'continue',
false );
108 $select =
new XmlSelect( $name, $name, $selectedCode );
109 $select->setAttribute(
'tabindex', $this->parent->nextTabIndex() );
111 $languages = MediaWikiServices::getInstance()
112 ->getLanguageNameUtils()
113 ->getLanguageNames( LanguageNameUtils::AUTONYMS, LanguageNameUtils::SUPPORTED );
114 foreach ( $languages as $code =>
$lang ) {
115 $select->addOption(
"$code - $lang", $code );
118 $output .= $select->getHTML();
119 return $this->parent->label( $label, $name, $output );