options.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /**
  3. * options.php - Change Password HTML page
  4. *
  5. * @copyright 2004-2025 The SquirrelMail Project Team
  6. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  7. * @version $Id$
  8. * @package plugins
  9. * @subpackage change_password
  10. */
  11. /**
  12. * Include the SquirrelMail initialization file.
  13. */
  14. require('../../include/init.php');
  15. include_once (SM_PATH . 'plugins/change_password/functions.php');
  16. include_once (SM_PATH . 'functions/forms.php');
  17. /** load default config */
  18. if (file_exists(SM_PATH . 'plugins/change_password/config_default.php')) {
  19. include_once (SM_PATH . 'plugins/change_password/config_default.php');
  20. } else {
  21. // somebody decided to remove default config
  22. $cpw_backend = 'template';
  23. $cpw_pass_min_length = 4;
  24. $cpw_pass_max_length = 25;
  25. $cpw_require_ssl = FALSE;
  26. }
  27. /**
  28. * prevent possible corruption of configuration overrides in
  29. * register_globals=on and preloaded php scripts.
  30. */
  31. $cpw_ldap=array();
  32. $cpw_merak=array();
  33. $cpw_mysql=array();
  34. $cpw_poppassd=array();
  35. $cpw_vmailmgrd=array();
  36. /** load site config */
  37. if (file_exists(SM_PATH . 'config/change_password_config.php')) {
  38. include_once (SM_PATH . 'config/change_password_config.php');
  39. } elseif (file_exists(SM_PATH . 'plugins/change_password/config.php')) {
  40. include_once (SM_PATH . 'plugins/change_password/config.php');
  41. }
  42. // must load backend libraries here in order to get working change_password_init hook.
  43. if (file_exists(SM_PATH . 'plugins/change_password/backend/'.$cpw_backend.'.php')) {
  44. include_once(SM_PATH . 'plugins/change_password/backend/'.$cpw_backend.'.php');
  45. }
  46. /* the form was submitted, go for it */
  47. if(sqgetGlobalVar('cpw_go', $cpw_go, SQ_POST)) {
  48. // security check
  49. sqgetGlobalVar('smtoken', $submitted_token, SQ_POST, '');
  50. sm_validate_security_token($submitted_token, -1, TRUE);
  51. /* perform basic checks */
  52. $Messages = cpw_check_input();
  53. /* if no errors, go ahead with the actual change */
  54. if(count($Messages) == 0) {
  55. $Messages = cpw_do_change();
  56. }
  57. }
  58. displayPageHeader($color);
  59. do_hook('change_password_init', $null);
  60. ?>
  61. <br />
  62. <table align="center" cellpadding="2" cellspacing="2" border="0">
  63. <tr><td bgcolor="<?php echo $color[0] ?>">
  64. <div style="text-align: center;"><b><?php echo _("Change Password") ?></b></div>
  65. </td><?php
  66. if (isset($Messages) && count($Messages) > 0) {
  67. echo "<tr><td>\n";
  68. foreach ($Messages as $line) {
  69. echo sm_encode_html_special_chars($line) . "<br />\n";
  70. }
  71. echo "</td></tr>\n";
  72. }
  73. ?><tr><td>
  74. <?php echo addForm($_SERVER['PHP_SELF'], 'post'); ?>
  75. <input type="hidden" name="smtoken" value="<?php echo sm_generate_security_token() ?>" />
  76. <table>
  77. <tr>
  78. <th align="right"><?php echo _("Current Password:")?></th>
  79. <td><?php echo addPwField('cpw_curpass'); ?></td>
  80. </tr>
  81. <tr>
  82. <th align="right"><?php echo _("New Password:")?></th>
  83. <td><?php echo addPwField('cpw_newpass'); ?></td>
  84. </tr>
  85. <tr>
  86. <th align=right><?php echo _("Verify New Password:")?></th>
  87. <td><?php echo addPwField('cpw_verify'); ?></td>
  88. </tr>
  89. <tr>
  90. <td align="center" colspan="2">
  91. <?php echo addSubmit(_("Change Password"), 'cpw_go'); ?></td>
  92. </tr>
  93. </table>
  94. </form>
  95. </td></tr>
  96. </table>
  97. </body></html>