* 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): * ___ *
* ___ * */ // 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); ?> Manage IMP Users ', $REQUEST_URI); echo 'Custom IMP Users
' . '' . '' . '' . ''; $rowIndex = 0; while ($myrow = mysql_fetch_array($result)) { $isNotEnabled = ''; if ($myrow['enabled'] != 1) { $isNotEnabled = 'selected'; } printf( '' . '' . '' . '' . '' . '' . '' . '' . '', $rowIndex,$myrow['id'],$myrow['id'],$myrow['horde_user_uid'],$myrow['imp_imapuser'], $myrow['imp_server'],$isNotEnabled,$myrow['last_updated'], $myrow['id'],$myrow['id'] ); $rowIndex = $rowIndex + 1; } // row for insert echo '' . '' . '' . '' . '' . '' . '' . '' . '' . ''; // hidden values and submit button echo ''; echo '
 idhorde_user_uidimp_imapuserimp_passimp_serverenabledlast_updated 
%s%s

all fields are required for an update or insert

   new 
' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '
'; } else if ($transaction == 'update') { if ((empty($_POST['id'])) || (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: 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/')); ?>