display_change_password.lib.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Displays form for password change
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. if (! defined('PHPMYADMIN')) {
  9. exit;
  10. }
  11. /**
  12. * Get HTML for the Change password dialog
  13. *
  14. * @param string $username username
  15. * @param string $hostname hostname
  16. *
  17. * @return string html snippet
  18. */
  19. function PMA_getHtmlForChangePassword($username, $hostname)
  20. {
  21. /**
  22. * autocomplete feature of IE kills the "onchange" event handler and it
  23. * must be replaced by the "onpropertychange" one in this case
  24. */
  25. $chg_evt_handler = (PMA_USR_BROWSER_AGENT == 'IE'
  26. && PMA_USR_BROWSER_VER >= 5
  27. && PMA_USR_BROWSER_VER < 7)
  28. ? 'onpropertychange'
  29. : 'onchange';
  30. $html = '<form method="post" id="change_password_form" '
  31. . 'action="' . $GLOBALS['PMA_PHP_SELF'] . '" '
  32. . 'name="chgPassword" '
  33. . 'class="ajax" >';
  34. $html .= PMA_generate_common_hidden_inputs();
  35. if (strpos($GLOBALS['PMA_PHP_SELF'], 'server_privileges') !== false) {
  36. $html .= '<input type="hidden" name="username" '
  37. . 'value="' . htmlspecialchars($username) . '" />'
  38. . '<input type="hidden" name="hostname" '
  39. . 'value="' . htmlspecialchars($hostname) . '" />';
  40. }
  41. $html .= '<fieldset id="fieldset_change_password">'
  42. . '<legend>' . __('Change password') . '</legend>'
  43. . '<table class="data noclick">'
  44. . '<tr class="odd">'
  45. . '<td colspan="2">'
  46. . '<input type="radio" name="nopass" value="1" id="nopass_1" '
  47. . 'onclick="pma_pw.value = \'\'; pma_pw2.value = \'\'; '
  48. . 'this.checked = true" />'
  49. . '<label for="nopass_1">' . __('No Password') . '</label>'
  50. . '</td>'
  51. . '</tr>'
  52. . '<tr class="even vmiddle">'
  53. . '<td>'
  54. . '<input type="radio" name="nopass" value="0" id="nopass_0" '
  55. . 'onclick="document.getElementById(\'text_pma_pw\').focus();" '
  56. . 'checked="checked " />'
  57. . '<label for="nopass_0">' . __('Password') . ':&nbsp;</label>'
  58. . '</td>'
  59. . '<td>'
  60. . '<input type="password" name="pma_pw" id="text_pma_pw" size="10" '
  61. . 'class="textfield"'
  62. . $chg_evt_handler . '="nopass[1].checked = true" />'
  63. . '&nbsp;&nbsp;' . __('Re-type') . ':&nbsp;'
  64. . '<input type="password" name="pma_pw2" id="text_pma_pw2" size="10" '
  65. . 'class="textfield"'
  66. . $chg_evt_handler . '="nopass[1].checked = true" />'
  67. . '</td>'
  68. . '</tr>'
  69. . '<tr class="vmiddle">'
  70. . '<td>' . __('Password Hashing') . ':'
  71. . '</td>'
  72. . '<td>'
  73. . '<input type="radio" name="pw_hash" id="radio_pw_hash_new" '
  74. . 'value="new" checked="checked" />'
  75. . '<label for="radio_pw_hash_new">MySQL&nbsp;4.1+</label>'
  76. . '</td>'
  77. . '</tr>'
  78. . '<tr id="tr_element_before_generate_password">'
  79. . '<td>&nbsp;</td>'
  80. . '<td>'
  81. . '<input type="radio" name="pw_hash" id="radio_pw_hash_old" '
  82. . 'value="old" />'
  83. . '<label for="radio_pw_hash_old">' . __('MySQL 4.0 compatible')
  84. . '</label>'
  85. . '</td>'
  86. . '</tr>'
  87. . '</table>'
  88. . '</fieldset>'
  89. . '<fieldset id="fieldset_change_password_footer" class="tblFooters">'
  90. . '<input type="submit" name="change_pw" value="' . __('Go') . '" />'
  91. . '</fieldset>'
  92. . '</form>';
  93. return $html;
  94. }