2.11.3-rc1, 2.11.4-dev
[phpmyadmin/crack.git] / libraries / display_select_lang.lib.php
blobe7a48ab474053ce7b410de33beb623385f4e1af2
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Code for displaying language selection
6 * @version $Id$
7 */
9 /**
10 * Sorts available languages by their true english names
12 * @param array the array to be sorted
13 * @param mixed a required parameter
14 * @return the sorted array
15 * @access private
17 function PMA_language_cmp(&$a, &$b) {
18 return (strcmp($a[1], $b[1]));
19 } // end of the 'PMA_language_cmp()' function
21 /**
22 * Displays for for language selection
24 * @access public
26 function PMA_select_language($use_fieldset = FALSE) {
27 global $cfg, $lang;
30 <form method="post" action="index.php" target="_parent">
31 <?php
32 if (isset($GLOBALS['collation_connection'])) {
33 echo ' <input type="hidden" name="collation_connection" value="'
34 . htmlspecialchars($GLOBALS['collation_connection']) . '" />' . "\n";
36 if (isset($GLOBALS['convcharset'])) {
37 echo ' <input type="hidden" name="convcharset" value="'
38 . htmlspecialchars($GLOBALS['convcharset']) . '" />' . "\n";
40 if (strlen($GLOBALS['db'])) {
41 echo ' <input type="hidden" name="db" value="'
42 . htmlspecialchars($GLOBALS['db']) . '" />' . "\n";
44 if (strlen($GLOBALS['table'])) {
45 echo ' <input type="hidden" name="table" value="'
46 . htmlspecialchars($GLOBALS['table']) . '" />' . "\n";
48 if (isset($GLOBALS['server'])) {
49 echo ' <input type="hidden" name="server" value="'
50 . ((int)$GLOBALS['server']) . '" />' . "\n";
53 $language_title = $GLOBALS['strLanguage'] . ($GLOBALS['strLanguage'] != 'Language' ? ' - Language' : '') . ' <a href="./translators.html" target="documentation">' .
54 ($cfg['ReplaceHelpImg'] ?
55 '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_info.png" width="11" height="11" alt="Info" />' :
56 '(*)') . '</a>';
57 if ($use_fieldset) {
58 echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>';
59 } else {
60 echo '<bdo xml:lang="en" dir="ltr">' . $language_title . ':</bdo>';
64 <select name="lang" onchange="this.form.submit();" xml:lang="en" dir="ltr">
65 <?php
67 uasort($GLOBALS['available_languages'], 'PMA_language_cmp');
68 foreach ($GLOBALS['available_languages'] AS $id => $tmplang) {
69 $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
71 // Include native name if non empty
72 if (!empty($tmplang[3])) {
73 $lang_name = $tmplang[3] . ' - '
74 . $lang_name;
77 // Include charset if it makes sense
78 if (!defined('PMA_REMOVED_NON_UTF_8')) {
79 $lang_name .= ' (' . substr($id, strpos($id, '-') + 1) . ')';
82 //Is current one active?
83 if ($lang == $id) {
84 $selected = ' selected="selected"';
85 } else {
86 $selected = '';
89 echo ' ';
90 echo '<option value="' . $id . '"' . $selected . '>' . $lang_name
91 . '</option>' . "\n";
95 </select>
96 <?php
97 if ($use_fieldset) {
98 echo '</fieldset>';
102 <noscript>
103 <?php
104 if ($use_fieldset) {
105 echo '<fieldset class="tblFooters">';
109 <input type="submit" value="Go" />
110 <?php
111 if ($use_fieldset) {
112 echo '</fieldset>';
116 </noscript>
117 </form>
118 <?php
119 } // End of function PMA_select_language