XHTML fixes
[phpmyadmin/crack.git] / libraries / display_select_lang.lib.php
blob6f7a5215d240e9db115312a8f2a0ed34ecc23980
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Code for displaying language selection
6 * @version $Id$
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
13 * Sorts available languages by their true english names
15 * @param array the array to be sorted
16 * @param mixed a required parameter
17 * @return the sorted array
18 * @access private
20 function PMA_language_cmp(&$a, &$b) {
21 return (strcmp($a[1], $b[1]));
22 } // end of the 'PMA_language_cmp()' function
24 /**
25 * Displays for for language selection
27 * @access public
29 function PMA_select_language($use_fieldset = FALSE) {
30 global $cfg, $lang;
33 <form method="post" action="index.php" target="_parent">
34 <?php
35 if (isset($GLOBALS['collation_connection'])) {
36 echo ' <input type="hidden" name="collation_connection" value="'
37 . htmlspecialchars($GLOBALS['collation_connection']) . '" />' . "\n";
39 if (isset($GLOBALS['convcharset'])) {
40 echo ' <input type="hidden" name="convcharset" value="'
41 . htmlspecialchars($GLOBALS['convcharset']) . '" />' . "\n";
43 if (strlen($GLOBALS['db'])) {
44 echo ' <input type="hidden" name="db" value="'
45 . htmlspecialchars($GLOBALS['db']) . '" />' . "\n";
47 if (strlen($GLOBALS['table'])) {
48 echo ' <input type="hidden" name="table" value="'
49 . htmlspecialchars($GLOBALS['table']) . '" />' . "\n";
51 if (isset($GLOBALS['server'])) {
52 echo ' <input type="hidden" name="server" value="'
53 . ((int)$GLOBALS['server']) . '" />' . "\n";
56 $language_title = $GLOBALS['strLanguage'] . ($GLOBALS['strLanguage'] != 'Language' ? ' - Language' : '') . ' <a href="./translators.html" target="documentation">' .
57 ($cfg['ReplaceHelpImg'] ?
58 '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_info.png" width="11" height="11" alt="Info" />' :
59 '(*)') . '</a>';
60 if ($use_fieldset) {
61 echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>';
62 } else {
63 echo '<bdo xml:lang="en" dir="ltr">' . $language_title . ':</bdo>';
67 <select name="lang" onchange="this.form.submit();" xml:lang="en" dir="ltr">
68 <?php
70 uasort($GLOBALS['available_languages'], 'PMA_language_cmp');
71 foreach ($GLOBALS['available_languages'] AS $id => $tmplang) {
72 $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
74 // Include native name if non empty
75 if (!empty($tmplang[3])) {
76 $lang_name = $tmplang[3] . ' - '
77 . $lang_name;
80 // Include charset if it makes sense
81 if (!defined('PMA_REMOVED_NON_UTF_8')) {
82 $lang_name .= ' (' . substr($id, strpos($id, '-') + 1) . ')';
85 //Is current one active?
86 if ($lang == $id) {
87 $selected = ' selected="selected"';
88 } else {
89 $selected = '';
92 echo ' ';
93 echo '<option value="' . $id . '"' . $selected . '>' . $lang_name
94 . '</option>' . "\n";
98 </select>
99 <?php
100 if ($use_fieldset) {
101 echo '</fieldset>';
105 <noscript>
106 <?php
107 if ($use_fieldset) {
108 echo '<fieldset class="tblFooters">';
112 <input type="submit" value="Go" />
113 <?php
114 if ($use_fieldset) {
115 echo '</fieldset>';
119 </noscript>
120 </form>
121 <?php
122 } // End of function PMA_select_language