Adding template for error box.
[squirrelmail.git] / plugins / change_password / options.php
CommitLineData
27663afe 1<?php
2
087508d9 3/**
4 * options.php - Change Password HTML page
5 *
47ccfad4 6 * @copyright &copy; 2004-2006 The SquirrelMail Project Team
4b4abf93 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
882acf90 8 * @version $Id$
087508d9 9 * @package plugins
10 * @subpackage change_password
11 */
12
882acf90 13/** @ignore */
27663afe 14define('SM_PATH','../../');
15
76063016 16include_once (SM_PATH . 'include/validate.php');
17include_once (SM_PATH . 'plugins/change_password/functions.php');
18include_once (SM_PATH . 'functions/forms.php');
27663afe 19
76063016 20/** load default config */
21if (file_exists(SM_PATH . 'plugins/change_password/config_default.php')) {
22 include_once (SM_PATH . 'plugins/change_password/config_default.php');
23} else {
24 // somebody decided to remove default config
25 $cpw_backend = 'template';
26 $cpw_pass_min_length = 4;
27 $cpw_pass_max_length = 25;
28 $cpw_require_ssl = FALSE;
29}
30
31/**
c683d87f 32 * prevent possible corruption of configuration overrides in
76063016 33 * register_globals=on and preloaded php scripts.
34 */
35$cpw_ldap=array();
36$cpw_merak=array();
37$cpw_mysql=array();
38$cpw_poppassd=array();
39$cpw_vmailmgrd=array();
40
41/** load site config */
42if (file_exists(SM_PATH . 'config/change_password_config.php')) {
43 include_once (SM_PATH . 'config/change_password_config.php');
44} elseif (file_exists(SM_PATH . 'plugins/change_password/config.php')) {
45 include_once (SM_PATH . 'plugins/change_password/config.php');
46}
47
48// must load backend libraries here in order to get working change_password_init hook.
ebf9211b 49if (file_exists(SM_PATH . 'plugins/change_password/backend/'.$cpw_backend.'.php')) {
50 include_once(SM_PATH . 'plugins/change_password/backend/'.$cpw_backend.'.php');
51}
52
27663afe 53/* the form was submitted, go for it */
54if(sqgetGlobalVar('cpw_go', $cpw_go, SQ_POST)) {
087508d9 55
76063016 56 // SM14 code: use change_password gettext domain binding for 1.4.x
57 if (! check_sm_version(1,5,0)) {
58 bindtextdomain('change_password',SM_PATH . 'locale');
59 textdomain('change_password');
60 }
61
27663afe 62 /* perform basic checks */
63 $Messages = cpw_check_input();
91e0dccc 64
27663afe 65 /* if no errors, go ahead with the actual change */
66 if(count($Messages) == 0) {
67 $Messages = cpw_do_change();
68 }
76063016 69
70 // SM14 code: use change_password gettext domain binding for 1.4.x
71 if (! check_sm_version(1,5,0)) {
72 bindtextdomain('squirrelmail',SM_PATH . 'locale');
73 textdomain('squirrelmail');
74 }
27663afe 75}
76
77displayPageHeader($color, 'None');
78
76063016 79// SM14 code: use change_password gettext domain binding for 1.4.x
80if (! check_sm_version(1,5,0)) {
81 bindtextdomain('change_password',SM_PATH . 'locale');
82 textdomain('change_password');
83}
84
5c34b0bb 85do_hook('change_password_init');
27663afe 86?>
87
88<br />
89<table align="center" cellpadding="2" cellspacing="2" border="0">
90<tr><td bgcolor="<?php echo $color[0] ?>">
f265009a 91 <div style="text-align: center;"><b><?php echo _("Change Password") ?></b></div>
27663afe 92</td><?php
93
94if (isset($Messages) && count($Messages) > 0) {
95 echo "<tr><td>\n";
96 foreach ($Messages as $line) {
97 echo htmlspecialchars($line) . "<br />\n";
98 }
99 echo "</td></tr>\n";
100}
101
102?><tr><td>
c435f076 103 <?php echo addForm($_SERVER['PHP_SELF'], 'post'); ?>
27663afe 104 <table>
105 <tr>
106 <th align="right"><?php echo _("Current Password:")?></th>
b11b4108 107 <td><?php echo addPwField('cpw_curpass'); ?></td>
27663afe 108 </tr>
109 <tr>
110 <th align="right"><?php echo _("New Password:")?></th>
b11b4108 111 <td><?php echo addPwField('cpw_newpass'); ?></td>
27663afe 112 </tr>
113 <tr>
114 <th align=right><?php echo _("Verify New Password:")?></th>
b11b4108 115 <td><?php echo addPwField('cpw_verify'); ?></td>
27663afe 116 </tr>
117 <tr>
118 <td align="center" colspan="2">
91e0dccc 119 <?php echo addSubmit(_("Change Password"), 'cpw_go'); ?></td>
27663afe 120 </tr>
121 </table>
122 </form>
123</td></tr>
17546ef4 124</table>
91e0dccc 125</body></html>