*
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* Alexandros Vellis' Version for use with the ldapuserdata plugin and
* attributes such as mailAlternateAddress, mailAuthorizedAddress.
*
* National & Kapodistrian University of Athens
* http://email.uoa.gr
*
* Display Identities Options
*
*/
if (file_exists('../../include/init.php')) {
include_once('../../include/init.php');
} else if (file_exists('../../include/validate.php')) {
define('SM_PATH','../../');
require_once(SM_PATH . 'include/validate.php');
}
require_once(SM_PATH . 'functions/display_messages.php');
require_once(SM_PATH . 'functions/html.php');
require_once(SM_PATH . 'functions/identity.php');
$ldapidentities = $_SESSION['ldapidentities'];
$identities_map = $_SESSION['identities_map'];
/* User's current identity preferences */
$identity = getpref($data_dir, $username, 'identity');
$namepreferred = getpref($data_dir, $username, 'namepreferred');
$em_preferred = getpref($data_dir, $username, 'mailpreferred');
/* defining $selection */
if(isset($_POST['selection'])) {
$selection = $_POST['selection'];
} elseif(!empty($em_preferred)) {
if(in_array($em_preferred, $ldapidentities['main']['email_address'])){
$selection = 'main';
} else {
$selection = $em_preferred;
}
} else {
$selection = 'main';
}
/* Default email identity (full_name, email_address) */
$full_name = getpref($data_dir, $username, 'full_name');
$email_address = getpref($data_dir, $username, 'email_address');
$id_default = $full_name.' <'.$email_address.'>';
if (isset($_POST['update'])) {
if($selection == 'main') {
removePref($data_dir, $username, 'identity');
removePref($data_dir, $username, 'mailpreferred');
removePref($data_dir, $username, 'namepreferred');
if(isset($ldapidentities['main']['allowed_names'])){
$_SESSION['alternatenames'] = $ldapidentities['main']['allowed_names'];
}
} elseif(in_array($selection, $identities_map)) {
foreach($identities_map as $no=>$mail) {
if($mail == $selection) {
setPref($data_dir, $username, 'identity', $no);
setPref($data_dir, $username, 'mailpreferred', $selection);
/* Set a default name... */
if(isset($ldapidentities[$selection]['allowed_names'])){
setPref($data_dir, $username, 'namepreferred', $ldapidentities[$selection]['allowed_names'][0]);
}
}
}
if(isset($ldapidentities[$selection]['allowed_names'])){
$_SESSION['alternatenames'] = $ldapidentities[$selection]['allowed_names'];
}
} else {
print "Wrong identity specified.";
exit;
}
header('Location: ../../src/options.php?optpage=personal');
exit;
}
displayPageHeader($color, 'None');
print '
';
print _("Options") . ' - ' . _("Advanced Identities");
$prev = sq_bindtextdomain ('ldapudidentities', SM_PATH . 'plugins/ldapuserdata/locale');
textdomain ('ldapudidentities');
print '
'. _("This page allows you to choose between a default mail identity for this system, and one of the identities which you have been authorized to send mail as.") . '
'. _("Authorized mail identities are provided by the mail administrators on demand, in order to allow certain users to use third-party or non-returnable addresses.") . '
'. _("Note that you can always choose a specific identity on-the-fly, while composing a new mail.") . ' ';
if(isset($ldapidentities)) {
print ' |
|