* See http://www.fsf.org/copyleft/gpl.html for license information (GPL).
*
*
* See imp/_custom/imp_sql_auth.php for table structure information.
*
*
* imp/_custom/key.php contains the secret key for encoding/decoding the stored pop/imap passwords
*
*
* Place this line of code in
* horde/templates/admin/index/admin.inc (revision 1.2)
* (available via cvs.horde.org, not in distribution of Horde 2.0;
* you will also need horde/admin/index.php):
* ___
* = Horde::link(Horde::applicationUrl('admin/custom_imp_users.php'), _("Custom - IMP Users"), 'menuitem') . Horde::img('user.gif') . ' ' . _("Custom - IMP Users") ?>
* ___
*
*/
// set these
$_custom_db_name = 'horde';
$_custom_db_host = 'localhost';
$_custom_db_user = 'horde';
$_custom_db_pass = '*****';
$path_to_key = '../imp/_custom'; // path to key.php
// only allow admin users (code from horde/admin/user.php,v 1.3.2.2 2002/01/02)
require_once '../lib/base.php';
if (!@is_array($conf['auth']['admins'])) {
exit('there are no administrators. user administration is disabled.');
}
if (!Auth::getAuth() || !in_array(Auth::getAuth(), $conf['auth']['admins'])) {
exit('forbidden.');
}
// -------
$_custom_db = mysql_connect($_custom_db_host, $_custom_db_user, $_custom_db_pass);
mysql_select_db($_custom_db_name, $_custom_db);
?>
| id | horde_user_uid | ' . 'imp_imapuser | imp_pass | ' . 'imp_server | enabled | ' . 'last_updated | ||
| ' . ' | %s | ' . '' . ' | ' . ' | ' . ' | ' . ' | ' . ' | %s | ' . '|
all fields are required for an update or insert | ||||||||
| ' . ' | ' . ' | ' . ' | ' . ' | ' . ' | ' . ' | ' . ' | new | ' . '|
| ' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . ' | ||||||||
Transaction: update'; } else { require_once $path_to_key . '/key.php'; $result = mysql_query("UPDATE custom_imp_users SET horde_user_uid = '$horde_user_uid', imp_imapuser = '$imp_imapuser', imp_pass = encode('$imp_pass', '$_custom_key'), imp_server = '$imp_server', enabled = '$enabled' WHERE id = '$id'", $_custom_db); } } else if ($transaction == 'insert') { if ((empty($_POST['horde_user_uid'])) || (empty($_POST['imp_imapuser'])) || (empty($_POST['imp_pass'])) || (empty($_POST['imp_server'])) || (empty($_POST['enabled']))) { echo 'Error: data is missing
Transaction: insert'; } else { require_once $path_to_key . '/key.php'; $result = mysql_query("INSERT into custom_imp_users VALUES ( null, '$horde_user_uid', '$imp_imapuser', encode('$imp_pass', '$_custom_key'), '$imp_server', '$enabled', null)", $_custom_db); } } else if ($transaction == 'delete') { if (empty($_POST['id'])) { echo 'Error: data is missing
Transaction: delete'; } else { $result = mysql_query("DELETE FROM custom_imp_users WHERE id = '$id'", $_custom_db); } } else { echo 'Error: invalid transaction'; } if ($transaction != 'list') { printf('
Return to listing of IMP users', Horde::applicationUrl('admin/custom_imp_users.php')); } printf('
Return to Horde Administration', Horde::applicationUrl('admin/')); ?>