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

display_change_password.lib.php « libraries - github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 54d86c1fef7467f2adbca65293633a36bbabd820 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Displays form for password change
 *
 * @package PhpMyAdmin
 */
if (! defined('PHPMYADMIN')) {
    exit;
}

/**
  * Get HTML for the Change password dialog
  *
  * @param string $username username
  * @param string $hostname hostname
  *
  * @return string html snippet
  */
function PMA_getHtmlForChangePassword($username, $hostname)
{
    /**
     * autocomplete feature of IE kills the "onchange" event handler and it
     * must be replaced by the "onpropertychange" one in this case
     */
    $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE'
        && PMA_USR_BROWSER_VER >= 5
        && PMA_USR_BROWSER_VER < 7)
                 ? 'onpropertychange'
                 : 'onchange';

    $is_privileges = basename($_SERVER['SCRIPT_NAME']) === 'server_privileges.php';

    $html = '<form method="post" id="change_password_form" '
        . 'action="' . basename($GLOBALS['PMA_PHP_SELF']) . '" '
        . 'name="chgPassword" '
        . 'class="' . ($is_privileges ? 'submenu-item' : '') . '">';

    $html .= PMA_URL_getHiddenInputs();

    if (strpos($GLOBALS['PMA_PHP_SELF'], 'server_privileges') !== false) {
        $html .= '<input type="hidden" name="username" '
            . 'value="' . htmlspecialchars($username) . '" />'
            . '<input type="hidden" name="hostname" '
            . 'value="' . htmlspecialchars($hostname) . '" />';
    }
    $html .= '<fieldset id="fieldset_change_password">'
        . '<legend'
        . ($is_privileges
            ? ' data-submenu-label="' . __('Change password') . '"'
            : ''
        )
        . '>' . __('Change password') . '</legend>'
        . '<table class="data noclick">'
        . '<tr class="odd">'
        . '<td colspan="2">'
        . '<input type="radio" name="nopass" value="1" id="nopass_1" '
        . 'onclick="pma_pw.value = \'\'; pma_pw2.value = \'\'; '
        . 'this.checked = true" />'
        . '<label for="nopass_1">' . __('No Password') . '</label>'
        . '</td>'
        . '</tr>'
        . '<tr class="even vmiddle">'
        . '<td>'
        . '<input type="radio" name="nopass" value="0" id="nopass_0" '
        . 'onclick="document.getElementById(\'text_pma_pw\').focus();" '
        . 'checked="checked " />'
        . '<label for="nopass_0">' . __('Password:') . '&nbsp;</label>'
        . '</td>'
        . '<td>'
        . '<input type="password" name="pma_pw" id="text_pma_pw" size="10" '
        . 'class="textfield"'
        . $chg_evt_handler . '="nopass[1].checked = true" />'
        . '&nbsp;&nbsp;' . __('Re-type:') . '&nbsp;'
        . '<input type="password" name="pma_pw2" id="text_pma_pw2" size="10" '
        . 'class="textfield"'
        . $chg_evt_handler . '="nopass[1].checked = true" />'
        . '</td>'
        . '</tr>';

    if (PMA_MYSQL_INT_VERSION < 50705) {
        $html .= '<tr class="vmiddle">'
            . '<td>' . __('Password Hashing:')
            . '</td>'
            . '<td>'
            . '<input type="radio" name="pw_hash" id="radio_pw_hash_new" '
            . 'value="new" checked="checked" />'
            . '<label for="radio_pw_hash_new">MySQL&nbsp;4.1+</label>'
            . '</td>'
            . '</tr>'
            . '<tr id="tr_element_before_generate_password">'
            . '<td>&nbsp;</td>'
            . '<td>'
            . '<input type="radio" name="pw_hash" id="radio_pw_hash_old" '
            . 'value="old" />'
            . '<label for="radio_pw_hash_old">' . __('MySQL 4.0 compatible')
            . '</label>'
            . '</td>'
            . '</tr>';
    } else {
        // See http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-5.html
        $html .= '<input type="hidden" name="pw_hash" value="new" />';
    }

    $html .=  '</table>'
        . '</fieldset>'
        . '<fieldset id="fieldset_change_password_footer" class="tblFooters">'
        . '<input type="hidden" name="change_pw" value="1" />'
        . '<input type="submit" value="' . __('Go') . '" />'
        . '</fieldset>'
        . '</form>';
    return $html;
}