31 $r = $this->parent->request;
32 $userLang = $r->getVal(
'uselang' );
33 $contLang = $r->getVal(
'ContLang' );
35 $languages = MediaWikiServices::getInstance()
36 ->getLanguageNameUtils()
37 ->getLanguageNames(
null,
'mwfile' );
38 $lifetime = intval( ini_get(
'session.gc_maxlifetime' ) );
43 if ( $r->wasPosted() ) {
45 if ( $this->parent->getSession(
'test' ) ===
null ) {
46 $requestTime = $r->getVal(
'LanguageRequestTime' );
47 if ( !$requestTime ) {
50 $msg =
'config-session-expired';
51 } elseif ( time() - $requestTime > $lifetime ) {
52 $msg =
'config-session-expired';
54 $msg =
'config-no-session';
56 $this->parent->showError( $msg,
$wgLang->formatTimePeriod( $lifetime ) );
58 if ( isset( $languages[$userLang] ) ) {
59 $this->
setVar(
'_UserLang', $userLang );
61 if ( isset( $languages[$contLang] ) ) {
62 $this->
setVar(
'wgLanguageCode', $contLang );
67 } elseif ( $this->parent->showSessionWarning ) {
68 # The user was knocked back from another page to the start
69 # This probably indicates a session expiry
70 $this->parent->showError(
'config-session-expired',
71 $wgLang->formatTimePeriod( $lifetime ) );
74 $this->parent->setSession(
'test',
true );
76 if ( !isset( $languages[$userLang] ) ) {
77 $userLang = $this->
getVar(
'_UserLang',
'en' );
79 if ( !isset( $languages[$contLang] ) ) {
80 $contLang = $this->
getVar(
'wgLanguageCode',
'en' );
83 $s = Html::hidden(
'LanguageRequestTime', time() ) .
85 $this->parent->getHelpBox(
'config-your-language-help' ) ) .
87 $this->parent->getHelpBox(
'config-wiki-language-help' ) );
89 $this->
endForm(
'continue',
false );
107 $select =
new XmlSelect( $name, $name, $selectedCode );
108 $select->setAttribute(
'tabindex', $this->parent->nextTabIndex() );
110 $languages = MediaWikiServices::getInstance()
111 ->getLanguageNameUtils()
112 ->getLanguageNames(
null,
'mwfile' );
113 foreach ( $languages as $code =>
$lang ) {
114 $select->addOption(
"$code - $lang", $code );
117 $output .= $select->getHTML();
118 return $this->parent->label( $label, $name, $output );