Add link to wiki explaining configuration options.
[phpmyadmin/crack.git] / libraries / display_select_lang.lib.php
blob781fcd9ad4598f4cea2056313925e7b2d28a10de
1 <?php
2 /*
3 * Code for displaying language selection
4 * $Id$
5 */
7 /**
8 * Sorts available languages by their true english names
10 * @param array the array to be sorted
11 * @param mixed a required parameter
12 * @return the sorted array
13 * @access private
15 function PMA_language_cmp( &$a, &$b ) {
16 return (strcmp($a[1], $b[1]));
17 } // end of the 'PMA_language_cmp()' function
19 /**
20 * Displays for for language selection
22 * @access public
24 function PMA_select_language($use_fieldset = FALSE) {
25 global $cfg, $lang;
28 <form method="post" action="index.php" target="_parent">
29 <?php
30 if (isset($GLOBALS['collation_connection'])) {
31 echo ' <input type="hidden" name="collation_connection" value="'
32 . htmlspecialchars($GLOBALS['collation_connection']) . '" />' . "\n";
34 if (isset($GLOBALS['convcharset'])) {
35 echo ' <input type="hidden" name="convcharset" value="'
36 . htmlspecialchars($GLOBALS['convcharset']) . '" />' . "\n";
38 if (isset($GLOBALS['db'])) {
39 echo ' <input type="hidden" name="db" value="'
40 . htmlspecialchars($GLOBALS['db']) . '" />' . "\n";
42 if (isset($GLOBALS['table'])) {
43 echo ' <input type="hidden" name="table" value="'
44 . htmlspecialchars($GLOBALS['table']) . '" />' . "\n";
46 if (isset($GLOBALS['server'])) {
47 echo ' <input type="hidden" name="server" value="'
48 . ((int)$GLOBALS['server']) . '" />' . "\n";
51 $language_title = $GLOBALS['strLanguage'] . ($GLOBALS['strLanguage'] != 'Language' ? ' - Language' : '') . ' <a href="./translators.html" target="documentation">' .
52 ( $cfg['ReplaceHelpImg'] ?
53 '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_info.png" width="11" height="11" alt="Info" />' :
54 '(*)' ) . '</a>';
55 if ($use_fieldset) {
56 echo '<fieldset><legend xml:lang="en" dir="ltr">' . $language_title . '</legend>';
57 } else {
58 echo '<bdo xml:lang="en" dir="ltr">' . $language_title . ':</bdo>';
62 <select name="lang" onchange="this.form.submit();" xml:lang="en" dir="ltr">
63 <?php
65 uasort($GLOBALS['available_languages'], 'PMA_language_cmp');
66 foreach ($GLOBALS['available_languages'] AS $id => $tmplang) {
67 $lang_name = ucfirst(substr(strrchr($tmplang[0], '|'), 1));
69 // Include native name if non empty
70 if (!empty($tmplang[3])) {
71 $lang_name = $tmplang[3] . ' - '
72 . $lang_name;
75 // Include charset if it makes sense
76 if (!defined('PMA_REMOVED_NON_UTF_8')) {
77 $lang_name .= ' (' . substr($id, strpos($id, '-') + 1) . ')';
80 //Is current one active?
81 if ($lang == $id) {
82 $selected = ' selected="selected"';
83 } else {
84 $selected = '';
87 echo ' ';
88 echo '<option value="' . $id . '"' . $selected . '>' . $lang_name
89 . '</option>' . "\n";
93 </select>
94 <?php
95 if ($use_fieldset) {
96 echo '</fieldset>';
100 <noscript>
101 <?php
102 if ($use_fieldset) {
103 echo '<fieldset class="tblFooters">';
107 <input type="submit" value="Go" />
108 <?php
109 if ($use_fieldset) {
110 echo '</fieldset>';
114 </noscript>
115 </form>
116 <?php
117 } // End of function PMA_select_language