Welcome to mirror list, hosted at ThFree Co, Russian Federation.

server_collations.lib.php « libraries - github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0ea690355f96585af46cd1ce6f41295db2eddaa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */

/**
 * functions for displaying server Character Sets and Collations
 *
 * @usedby  server_collations.php
 *
 * @package PhpMyAdmin
 */
if (! defined('PHPMYADMIN')) {
    exit;
}

/**
 * Returns the html for server Character Sets and Collations.
 *
 * @param Array $mysqlCharsets      Mysql Charsets list
 * @param Array $mysqlCollations    Mysql Collations list
 * @param Array $mysqlCharsetsDesc  Charsets descriptions
 * @param Array $mysqlDftCollations Default Collations list
 * @param Array $mysqlCollAvailable Available Collations list
 *
 * @return string
 */
function PMA_getHtmlForCharsets($mysqlCharsets, $mysqlCollations,
    $mysqlCharsetsDesc, $mysqlDftCollations,
    $mysqlCollAvailable
) {
    /**
     * Outputs the result
     */
    $html = '<div id="div_mysql_charset_collations">' . "\n"
        . '<table class="data noclick">' . "\n"
        . '<tr><th id="collationHeader">' . __('Collation') . '</th>' . "\n"
        . '    <th>' . __('Description') . '</th>' . "\n"
        . '</tr>' . "\n";

    $table_row_count = count($mysqlCharsets) + count($mysqlCollations);

    foreach ($mysqlCharsets as $current_charset) {

        $html .= '<tr><th colspan="2" class="right">' . "\n"
            . '        ' . htmlspecialchars($current_charset) . "\n"
            . (empty($mysqlCharsetsDesc[$current_charset])
                ? ''
                : '        (<i>' . htmlspecialchars(
                    $mysqlCharsetsDesc[$current_charset]
                ) . '</i>)' . "\n")
            . '    </th>' . "\n"
            . '</tr>' . "\n";

        $html .= PMA_getHtmlForCollationCurrentCharset(
            $current_charset,
            $mysqlCollations,
            $mysqlDftCollations,
            $mysqlCollAvailable
        );

    }
    unset($table_row_count);
    $html .= '</table>' . "\n"
        . '</div>' . "\n";

    return $html;
}

/**
 * Returns the html for Collations of Current Charset.
 *
 * @param String $currCharset        Current Charset
 * @param Array  $mysqlColl          Collations list
 * @param Array  $mysqlDefaultColl   Default Collations list
 * @param Array  $mysqlCollAvailable Available Collations list
 *
 * @return string
 */
function PMA_getHtmlForCollationCurrentCharset(
    $currCharset, $mysqlColl,
    $mysqlDefaultColl, $mysqlCollAvailable
) {
    $odd_row = true;
    $html = '';
    foreach ($mysqlColl[$currCharset] as $current_collation) {

        $html .= '<tr class="'
            . ($odd_row ? 'odd' : 'even')
            . ($mysqlDefaultColl[$currCharset] == $current_collation
                ? ' marked'
                : '')
            . ($mysqlCollAvailable[$current_collation] ? '' : ' disabled')
            . '">' . "\n"
            . '    <td>' . htmlspecialchars($current_collation) . '</td>' . "\n"
            . '    <td>' . PMA_getCollationDescr($current_collation) . '</td>' . "\n"
            . '</tr>' . "\n";
        $odd_row = !$odd_row;
    }
    return $html;
}
?>