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