Common code for language selection form.
This commit is contained in:
@@ -13,6 +13,9 @@ $Source$
|
||||
* libraries/import/csv.php: Make enclosing behaviour same as in MySQL LOAD
|
||||
DATA (bug #1363532).
|
||||
* lang/*: Remove unused messages.
|
||||
* main.php, libraries/display_select_lang.lib.php,
|
||||
libraries/auth/cookie.auth.lib.php: Common code for language selection
|
||||
form.
|
||||
|
||||
2005-11-20 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
||||
* added test/theme.php: for testing themes
|
||||
|
@@ -146,49 +146,11 @@ if (top != self) {
|
||||
// Displays the languages form
|
||||
if (empty($cfg['Lang'])) {
|
||||
echo "\n";
|
||||
?>
|
||||
<!-- Language selection -->
|
||||
<form method="post" action="index.php" target="_top">
|
||||
<?php
|
||||
if (isset($GLOBALS['db'])) {
|
||||
echo ' <input type="hidden" name="db" value="' . htmlspecialchars($GLOBALS['db']) . '" />' . "\n";
|
||||
}
|
||||
if (isset($GLOBALS['table'])) {
|
||||
echo ' <input type="hidden" name="table" value="' . htmlspecialchars($GLOBALS['table']) . '" />' . "\n";
|
||||
}
|
||||
?>
|
||||
<input type="hidden" name="server" value="<?php echo $server; ?>" />
|
||||
<table border="0" cellpadding="3" cellspacing="0">
|
||||
<tr>
|
||||
<td><b>Language: </b></td>
|
||||
<td>
|
||||
<select name="lang" dir="ltr" onchange="this.form.submit();">
|
||||
<?php
|
||||
echo "\n";
|
||||
|
||||
uasort($available_languages, 'PMA_cookie_cmp');
|
||||
foreach ($available_languages AS $id => $tmplang) {
|
||||
$lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
|
||||
if ($lang == $id) {
|
||||
$selected = ' selected="selected"';
|
||||
} else {
|
||||
$selected = '';
|
||||
}
|
||||
echo ' ';
|
||||
echo '<option value="' . $id . '"' . $selected . '>' . $lang_name . ' (' . $id . ')</option>' . "\n";
|
||||
} // end while
|
||||
?>
|
||||
</select>
|
||||
<input type="submit" value="<?php echo $GLOBALS['strGo']; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
require_once('./libraries/display_select_lang.lib.php');
|
||||
PMA_select_language();
|
||||
}
|
||||
echo "\n\n";
|
||||
|
||||
echo ' </table>' . "\n"
|
||||
. ' </form>' . "\n";
|
||||
|
||||
// Displays the warning message and the login form
|
||||
|
||||
if (empty($GLOBALS['cfg']['blowfish_secret'])) {
|
||||
@@ -202,10 +164,7 @@ if (top != self) {
|
||||
. '</html>';
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
if ( !empty($conn_error)) {
|
||||
echo '<div class="error"><h1>' . $GLOBALS['strError'] . '</h1>' . "\n";
|
||||
echo $conn_error . '</div>' . "\n";
|
||||
|
67
libraries/display_select_lang.lib.php
Normal file
67
libraries/display_select_lang.lib.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Sorts available languages by their true english names
|
||||
*
|
||||
* @param array the array to be sorted
|
||||
* @param mixed a required parameter
|
||||
* @return the sorted array
|
||||
* @access private
|
||||
*/
|
||||
function PMA_language_cmp( &$a, $b ) {
|
||||
return (strcmp($a[1], $b[1]));
|
||||
} // end of the 'PMA_language_cmp()' function
|
||||
|
||||
/**
|
||||
* Displays for for language selection
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_select_language() {
|
||||
global $cfg, $lang;
|
||||
?>
|
||||
<form method="post" action="index.php" target="_parent">
|
||||
<bdo xml:lang="en" dir="ltr">
|
||||
<?php
|
||||
if (isset($GLOBALS['collation_connection'])) {
|
||||
echo ' <input type="hidden" name="collation_connection" value="' . htmlspecialchars($GLOBALS['collation_connection']) . '" />' . "\n";
|
||||
}
|
||||
if (isset($GLOBALS['convcharset'])) {
|
||||
echo ' <input type="hidden" name="convcharset" value="' . htmlspecialchars($GLOBALS['convcharset']) . '" />' . "\n";
|
||||
}
|
||||
if (isset($GLOBALS['db'])) {
|
||||
echo ' <input type="hidden" name="db" value="' . htmlspecialchars($GLOBALS['db']) . '" />' . "\n";
|
||||
}
|
||||
if (isset($GLOBALS['table'])) {
|
||||
echo ' <input type="hidden" name="table" value="' . htmlspecialchars($GLOBALS['table']) . '" />' . "\n";
|
||||
}
|
||||
if (isset($GLOBALS['server'])) {
|
||||
echo ' <input type="hidden" name="server" value="' . ((int)$GLOBALS['server']) . '" />' . "\n";
|
||||
}
|
||||
?>
|
||||
Language <a href="./translators.html" target="documentation"><?php
|
||||
if ( $cfg['ReplaceHelpImg'] ) {
|
||||
echo '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_info.png" width="11" height="11" alt="Info" />';
|
||||
} else { echo '(*)'; }
|
||||
?></a>: <select name="lang" onchange="this.form.submit();">
|
||||
<?php
|
||||
|
||||
uasort($GLOBALS['available_languages'], 'PMA_language_cmp');
|
||||
foreach ($GLOBALS['available_languages'] AS $id => $tmplang) {
|
||||
$lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
|
||||
if ($lang == $id) {
|
||||
$selected = ' selected="selected"';
|
||||
} else {
|
||||
$selected = '';
|
||||
}
|
||||
echo ' ';
|
||||
echo '<option value="' . $id . '"' . $selected . '>' . $lang_name . ' (' . $id . ')</option>' . "\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</bdo>
|
||||
<noscript><input type="submit" value="<?php echo $GLOBALS['strGo'];?>" /></noscript>
|
||||
</form>
|
||||
<?php
|
||||
} // End of function PMA_select_language
|
||||
?>
|
41
main.php
41
main.php
@@ -321,49 +321,12 @@ if ( $server > 0 ) {
|
||||
<?php
|
||||
// Displays language selection combo
|
||||
if (empty($cfg['Lang'])) {
|
||||
require_once('./libraries/display_select_lang.lib.php');
|
||||
?>
|
||||
<tr><?php
|
||||
echo ($str_iconic_list !='' ? sprintf($str_iconic_list,'<a href="./translators.html" target="documentation">','s_lang.png','Language','</a>') : $str_normal_list);
|
||||
?>
|
||||
<td><form method="post" action="index.php" target="_parent">
|
||||
<bdo xml:lang="en" dir="ltr">
|
||||
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
|
||||
<input type="hidden" name="server" value="<?php echo $server; ?>" />
|
||||
Language <a href="./translators.html" target="documentation"><?php
|
||||
if ( $cfg['ReplaceHelpImg'] ) {
|
||||
echo '<img class="icon" src="' . $pmaThemeImage . 'b_info.png" width="11" height="11" alt="Info" />';
|
||||
} else { echo '(*)'; }
|
||||
?></a>: <select name="lang" onchange="this.form.submit();">
|
||||
<?php
|
||||
/**
|
||||
* Sorts available languages by their true names
|
||||
*
|
||||
* @param array the array to be sorted
|
||||
* @param mixed a required parameter
|
||||
* @return the sorted array
|
||||
* @access private
|
||||
*/
|
||||
function PMA_cmp( &$a, $b ) {
|
||||
return (strcmp($a[1], $b[1]));
|
||||
} // end of the 'PMA_cmp()' function
|
||||
|
||||
uasort($available_languages, 'PMA_cmp');
|
||||
foreach ($available_languages AS $id => $tmplang) {
|
||||
$lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
|
||||
if ($lang == $id) {
|
||||
$selected = ' selected="selected"';
|
||||
} else {
|
||||
$selected = '';
|
||||
}
|
||||
echo ' ';
|
||||
echo '<option value="' . $id . '"' . $selected . '>' . $lang_name . ' (' . $id . ')</option>' . "\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</bdo>
|
||||
<noscript><input type="submit" value="<?php echo $strGo;?>" /></noscript>
|
||||
</form>
|
||||
</td>
|
||||
<td><?php PMA_select_language(); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
Reference in New Issue
Block a user