1<?php
2/**
3 * Change_ldappass options
4 *
5 * V.1.6 copyright notice
6 * ----------------------
7 * Copyright Simon Annetts 2000 - 2003. simon@ateb.co.uk
8 *
9 * This software may be used, modified and distributed freely
10 * providing this copyright notice remains intact at the head
11 * of the file.
12 *
13 * This software is freeware. The author accepts no liability for
14 * any loss or damages whatsoever incurred directly or indirectly
15 * from the use of this script. The author of this software makes
16 * no claims as to its fitness for any purpose whatsoever. If you
17 * wish to use this software you should first satisfy yourself that
18 * it meets your requirements.
19 * ----------------------
20 * change_ldappass v.2.0 version is relicensed under GPL.
21 *
22 * @copyright (c) 2000-2003 Simon Annetts <simon@ateb.co.uk>
23 * @copyright (c) 2006-2007 The SquirrelMail Project Team
24 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
25 * @version $Id: options.php,v 1.13 2007/07/18 20:47:26 tokul Exp $
26 * @package plugins
27 * @subpackage change_ldappass
28 */
29
30/** @ignore */
31define('SM_PATH','../../');
32
33/**/
34include_once(SM_PATH . 'include/validate.php');
35include_once(SM_PATH . 'plugins/change_ldappass/functions.php');
36
37unset($Messages);
38if ( file_exists(SM_PATH . 'plugins/change_ldappass/config.php') &&
39     sqGetGlobalVar('plugin_change_ldappass',$plugin_change_ldappass,SQ_POST)) {
40    if (sqGetGlobalVar('sync_smb_pass',$sync_smb_pass,SQ_POST)) {
41        setPref($data_dir,$username,'sync_smb_pass',SMPREF_ON);
42    } else {
43        setPref($data_dir,$username,'sync_smb_pass',SMPREF_OFF);
44    }
45    bindtextdomain('change_ldappass', SM_PATH . 'plugins/change_ldappass/locale');
46    textdomain('change_ldappass');
47    $Messages = change_ldappass_check();
48    bindtextdomain('squirrelmail', SM_PATH . 'locale');
49    textdomain('squirrelmail');
50}
51
52displayPageHeader($color, '');
53
54bindtextdomain('change_ldappass', SM_PATH . 'plugins/change_ldappass/locale');
55textdomain('change_ldappass');
56
57// Make sure that ldap extension is available
58if (! extension_loaded('ldap')) {
59    include_once(SM_PATH . 'functions/display_messages.php');
60    $error = _("PHP LDAP extension is not available.");
61    bindtextdomain('squirrelmail', SM_PATH . 'locale');
62    textdomain('squirrelmail');
63    error_box($error,$color);
64    die('</body></html>');
65}
66
67// Make sure that config file is present
68if (! file_exists(SM_PATH . 'plugins/change_ldappass/config.php')) {
69    include_once(SM_PATH . 'functions/display_messages.php');
70    $error = _("Please create plugin configuration file.");
71    bindtextdomain('squirrelmail', SM_PATH . 'locale');
72    textdomain('squirrelmail');
73    error_box($error,$color);
74    die('</body></html>');
75}
76
77echo '<br>'
78    .'<table width="95%" align="center" cellpadding="2" cellspacing="2" border="0">'
79    .'<tr><td bgcolor="' . $color[0] . '">'
80    .'<center><b>' . _("Change Password") . '</b></center>'
81    .'</td></tr>';
82
83if (isset($Messages) && count($Messages)) {
84    echo "<tr align=\"center\"><td>\n";
85    echo "<table><tr align=\"left\"><td>";
86    echo "<br>\n";
87    foreach ($Messages as $line) {
88        echo $line . "<br>\n";
89    }
90    echo "<br>\n";
91    echo "</td></tr></table>";
92    echo "</td></tr>\n";
93}
94?>
95  <tr><td align="center">
96    <form method="post" action="options.php">
97    <table>
98      <tr>
99        <th align="right"><?php echo _("Old Password:"); ?></th>
100        <td><input type="password" name="cp_oldpass" value="" size="20"></td>
101      </tr>
102      <tr>
103        <th align="right"><?php echo _("New Password:"); ?></th>
104        <td><input type="password" name="cp_newpass" value="" size="20"></td>
105      </tr>
106      <tr>
107        <th align="right"><?php echo _("Verify New Password:"); ?></th>
108        <td><input type="password" name="cp_verify" value="" size="20"></td>
109      </tr>
110<?php
111if (($change_ldapsmb || $change_smb) && ! $force_smb_sync) {
112    $sync_smb_pass = getPref($data_dir,$username,'sync_smb_pass',SMPREF_ON);
113    if ($sync_smb_pass) {
114        $sync_checkbox = ' checked="checked"';
115    } else {
116        $sync_checkbox = '';
117    }
118
119    echo "        <tr>\n"
120        .'          <td colspan="2" align="center"><input type="checkbox" name="sync_smb_pass"' . $sync_checkbox . '>&nbsp;'
121        ._("Sync with local network password")
122        .'          </td>'
123        ."        </tr>\n";
124}
125?>
126      <tr>
127        <td align="center" colspan="2">
128        <input type="submit" value="<?php echo _("Change Password"); ?>" name="plugin_change_ldappass">
129        </td>
130      </tr>
131    </table>
132    </form>
133  </td></tr>
134  </table>
135</body></html>
136