|
|
@ -2,99 +2,49 @@ |
|
|
|
ini_set('log_errors', 1); |
|
|
|
ini_set('log_errors', 1); |
|
|
|
ini_set('display_errors', 0); |
|
|
|
ini_set('display_errors', 0); |
|
|
|
|
|
|
|
|
|
|
|
require('conf.php'); |
|
|
|
require('thunderbird.conf.php'); |
|
|
|
|
|
|
|
|
|
|
|
if(isset($_SERVER['QUERY_STRING']) && preg_match('/^.+@' . DOMAIN . '$/', $_SERVER['QUERY_STRING'])) { |
|
|
|
if(isset($_SERVER['QUERY_STRING']) && preg_match('/^.+@' . DOMAIN . '$/', $_SERVER['QUERY_STRING'])) { |
|
|
|
$temp = explode('@', $_SERVER['QUERY_STRING']); |
|
|
|
$temp = explode('@', $_SERVER['QUERY_STRING']); |
|
|
|
$uid = $temp[0]; |
|
|
|
$uid = $temp[0]; |
|
|
|
|
|
|
|
|
|
|
|
// Bind to the LDAP server |
|
|
|
//Connexion a l'annuaire LDAP |
|
|
|
$link = @ldap_connect(LDAP_SERVER) or die ("Couldn't connect to the LDAP server"); |
|
|
|
$link = @ldap_connect(LDAP_SERVER) or die ('connexion echouee'); |
|
|
|
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 3); |
|
|
|
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 3); |
|
|
|
@ldap_bind($link) or die ("Couldn't bind to the LDAP server"); |
|
|
|
@ldap_bind($link) or die ('identification echouee'); |
|
|
|
// Lookup the user |
|
|
|
// Recherche de l'utilisateur demandé |
|
|
|
$result = ldap_search($link, USER_BASE, "uid=" . $uid); |
|
|
|
$result = ldap_search($link, USER_BASE, "uid=" . $uid); |
|
|
|
$user = ldap_get_entries($link, $result); |
|
|
|
$user = ldap_get_entries($link, $result); |
|
|
|
$configaccounts = 1; |
|
|
|
|
|
|
|
if($user['count'] == 0) { |
|
|
|
if($user['count'] == 0) { |
|
|
|
$result = ldap_search($link, USER_BASE, "mail=" . $_SERVER['QUERY_STRING']); |
|
|
|
|
|
|
|
$user = ldap_get_entries($link, $result); |
|
|
|
|
|
|
|
if ($user['count'] == 1){ |
|
|
|
|
|
|
|
// If we received an valid email address and not an uid |
|
|
|
|
|
|
|
// considere TB as already configured |
|
|
|
|
|
|
|
// so we don't need to generate accounts config |
|
|
|
|
|
|
|
// only general settings will be sent |
|
|
|
|
|
|
|
$configaccounts = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
// user not found |
|
|
|
// user not found |
|
|
|
header("HTTP/1.1 403 Forbidden"); |
|
|
|
|
|
|
|
exit; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$pref = TB_PREF; |
|
|
|
|
|
|
|
// Don't lock pref if the user is member of some special groups |
|
|
|
|
|
|
|
// regardless of the setting |
|
|
|
|
|
|
|
foreach ($user[0]['posixmemberof'] as $group){ |
|
|
|
|
|
|
|
if (in_array($group, $NOENFORCEGROUPS)){ |
|
|
|
|
|
|
|
$pref = 'defaultPref'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Stop here if the user is not part of the whitelist groups |
|
|
|
|
|
|
|
if (count($WHITELISTGROUPS) > 0){ |
|
|
|
|
|
|
|
$conf = 0; |
|
|
|
|
|
|
|
foreach ($user[0]['posixmemberof'] as $group){ |
|
|
|
|
|
|
|
if (in_array($group, $WHITELISTGROUPS)){ |
|
|
|
|
|
|
|
$conf = 1; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ($conf != 1){ |
|
|
|
|
|
|
|
header("HTTP/1.1 403 Forbidden"); |
|
|
|
|
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
else { |
|
|
|
// We've not received a valid email address |
|
|
|
|
|
|
|
header("HTTP/1.1 403 Forbidden"); |
|
|
|
|
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($configaccounts == 1){ |
|
|
|
|
|
|
|
?> |
|
|
|
?> |
|
|
|
|
|
|
|
|
|
|
|
// Linux / UNIX ? |
|
|
|
|
|
|
|
if(getenv("USER") != "") { |
|
|
|
|
|
|
|
var path_sep = '/'; |
|
|
|
|
|
|
|
var path_profile = getenv("HOME"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Windows ? |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
var path_sep = '\\'; |
|
|
|
|
|
|
|
var path_profile = getenv("USERPROFILE"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Local Account |
|
|
|
// Compte local |
|
|
|
<?php echo $pref;?>("mail.account.account1.server", "server1");
|
|
|
|
<?php echo PREF;?>("mail.account.account1.server", "server1");
|
|
|
|
<?php echo $pref;?>("mail.accountmanager.localfoldersserver", "server1");
|
|
|
|
<?php echo PREF;?>("mail.accountmanager.localfoldersserver", "server1");
|
|
|
|
<?php echo $pref;?>("mail.server.server1.directory-rel", "[ProfD]Mail/Local Folders");
|
|
|
|
<?php echo PREF;?>("mail.server.server1.directory-rel", "[ProfD]Mail/Local Folders");
|
|
|
|
<?php echo $pref;?>("mail.server.server1.hostname", "Local Folders");
|
|
|
|
<?php echo PREF;?>("mail.server.server1.hostname", "Local Folders");
|
|
|
|
<?php echo $pref;?>("mail.server.server1.name", "Dossiers locaux");
|
|
|
|
<?php echo PREF;?>("mail.server.server1.name", "Dossiers locaux");
|
|
|
|
<?php echo $pref;?>("mail.server.server1.type", "none");
|
|
|
|
<?php echo PREF;?>("mail.server.server1.type", "none");
|
|
|
|
<?php echo $pref;?>("mail.server.server1.userName", "nobody");
|
|
|
|
<?php echo PREF;?>("mail.server.server1.userName", "nobody");
|
|
|
|
|
|
|
|
|
|
|
|
// SMTP config |
|
|
|
// SMTP |
|
|
|
<?php echo $pref;?>("mail.smtp.defaultserver", "smtp1");
|
|
|
|
<?php echo PREF;?>("mail.smtp.defaultserver", "smtp1");
|
|
|
|
<?php echo $pref;?>("mail.smtpservers", "smtp1");
|
|
|
|
<?php echo PREF;?>("mail.smtpservers", "smtp1");
|
|
|
|
<?php echo $pref;?>("mail.smtpserver.smtp1.try_ssl", 3);
|
|
|
|
<?php echo PREF;?>("mail.smtpserver.smtp1.try_ssl", 3);
|
|
|
|
<?php echo $pref;?>("mail.smtpserver.smtp1.port", <?php echo SMTP_PORT; ?>);
|
|
|
|
<?php echo PREF;?>("mail.smtpserver.smtp1.port", <?php echo SMTP_PORT; ?>);
|
|
|
|
<?php echo $pref;?>("mail.smtpserver.smtp1.hostname", "<?php echo SMTP_SERVER; ?>");
|
|
|
|
<?php echo PREF;?>("mail.smtpserver.smtp1.hostname", "<?php echo SMTP_SERVER; ?>");
|
|
|
|
<?php echo $pref;?>("mail.smtpserver.smtp1.username", "<?php echo $uid; ?>");
|
|
|
|
<?php echo PREF;?>("mail.smtpserver.smtp1.username", "<?php echo $uid; ?>");
|
|
|
|
|
|
|
|
|
|
|
|
// Default account is acocunt2 (the personal account) |
|
|
|
// Compte par défaut |
|
|
|
<?php echo $pref;?>("mail.accountmanager.defaultaccount", "account2");
|
|
|
|
<?php echo PREF;?>("mail.accountmanager.defaultaccount", "account2");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
<?php |
|
|
@ -105,89 +55,65 @@ $server = 2; |
|
|
|
$accountlist = 'account1'; |
|
|
|
$accountlist = 'account1'; |
|
|
|
$identities = '' |
|
|
|
$identities = '' |
|
|
|
?> |
|
|
|
?> |
|
|
|
|
|
|
|
// Compte personnel |
|
|
|
// Personnal account |
|
|
|
<?php echo PREF;?>("mail.account.account2.server", "server<?php echo $server?>");
|
|
|
|
<?php echo $pref;?>("mail.account.account2.server", "server<?php echo $server?>");
|
|
|
|
<?php echo PREF;?>("mail.server.server2.hostname", "<?php echo IMAP_SERVER; ?>");
|
|
|
|
<?php echo $pref;?>("mail.server.server2.hostname", "<?php echo IMAP_SERVER; ?>");
|
|
|
|
<?php echo PREF;?>("mail.server.server2.name", "<?php echo $user[0]['mail'][0]; ?>");
|
|
|
|
<?php echo $pref;?>("mail.server.server2.name", "<?php echo $user[0]['mail'][0]; ?>");
|
|
|
|
<?php echo PREF;?>("mail.server.server2.port", <?php echo IMAP_PORT; ?>);
|
|
|
|
<?php echo $pref;?>("mail.server.server2.port", <?php echo IMAP_PORT; ?>);
|
|
|
|
<?php echo PREF;?>("mail.server.server2.socketType", 3);
|
|
|
|
<?php echo $pref;?>("mail.server.server2.socketType", 3);
|
|
|
|
<?php echo PREF;?>("mail.server.server2.type", "imap");
|
|
|
|
<?php echo $pref;?>("mail.server.server2.type", "imap");
|
|
|
|
<?php echo PREF;?>("mail.server.server2.userName", "<?php echo $uid; ?>");
|
|
|
|
<?php echo $pref;?>("mail.server.server2.userName", "<?php echo $uid; ?>");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
<?php |
|
|
|
for ($i=0; $i < count($user[0]['mail'])-1; $i++){ |
|
|
|
for ($i=0; $i < count($user[0]['mail'])-1; $i++){ |
|
|
|
?> |
|
|
|
?> |
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.fullName", "<?php echo $user[0]['cn'][0]; ?>");
|
|
|
|
<?php echo PREF;?>("mail.identity.id<?php echo $id; ?>.fullName", "<?php echo $user[0]['cn'][0]; ?>");
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.organization", "<?php echo $user[0]['o'][0]; ?>");
|
|
|
|
<?php echo PREF;?>("mail.identity.id<?php echo $id; ?>.organization", "<?php echo $user[0]['o'][0]; ?>");
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.smtpServer", "smtp1");
|
|
|
|
<?php echo PREF;?>("mail.identity.id<?php echo $id; ?>.smtpServer", "smtp1");
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.useremail", "<?php echo $user[0]['mail'][$i]; ?>");
|
|
|
|
<?php echo PREF;?>("mail.identity.id<?php echo $id; ?>.useremail", "<?php echo $user[0]['mail'][$i]; ?>");
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.valid", true);
|
|
|
|
<?php echo PREF;?>("mail.identity.id<?php echo $id; ?>.valid", true);
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.fcc_folder_pickup_mode", "1");
|
|
|
|
defaultPref("mail.identity.id<?php echo $id; ?>.fcc_folder", "imap://<?php echo $uid; ?>@<?php echo IMAP_SERVER; ?>/Sent");
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.fcc_folder", "imap://<?php echo $uid; ?>@<?php echo IMAP_SERVER; ?>/Sent");
|
|
|
|
defaultPref("mail.identity.id<?php echo $id; ?>.draft_folder", "imap://<?php echo $uid; ?>@<?php echo IMAP_SERVER; ?>/Drafts");
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.drafts_folder_pickup_mode", "1");
|
|
|
|
defaultPref("mail.identity.id<?php echo $id; ?>.stationery_folder", "imap://<?php echo $uid; ?>@<?php echo IMAP_SERVER; ?>/Templates");
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.draft_folder", "imap://<?php echo $uid; ?>@<?php echo IMAP_SERVER; ?>/Drafts");
|
|
|
|
defaultPref("mail.identity.id<?php echo $id; ?>.attach_signature", true);
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.templ_folder_pickup_mode", "1");
|
|
|
|
defaultPref("mail.identity.id<?php echo $id; ?>.sig_file-rel", "[ProfD]../../../../../signature/email.html");
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.stationery_folder", "imap://<?php echo $uid; ?>@<?php echo IMAP_SERVER; ?>/Templates");
|
|
|
|
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.reply_on_top", 1);
|
|
|
|
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.attach_signature", true);
|
|
|
|
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.sig_file", path_profile+path_sep+"signature"+path_sep+"email.html");
|
|
|
|
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.sig_on_fwd", true);
|
|
|
|
|
|
|
|
<?php echo $pref;?>("mail.identity.id<?php echo $id; ?>.sig_on_reply", true);
|
|
|
|
|
|
|
|
<?php |
|
|
|
<?php |
|
|
|
|
|
|
|
//$accountlist .= ',account' . $account; |
|
|
|
$identities .= ',id' . $id; |
|
|
|
$identities .= ',id' . $id; |
|
|
|
$account++; |
|
|
|
$account++; |
|
|
|
$id++; |
|
|
|
$id++; |
|
|
|
} |
|
|
|
} |
|
|
|
?> |
|
|
|
?> |
|
|
|
<?php echo $pref;?>("mail.account.account2.identities", "<?php echo $identities;?>");
|
|
|
|
<?php echo PREF;?>("mail.account.account2.identities", "<?php echo $identities;?>");
|
|
|
|
<?php echo $pref;?>("mail.accountmanager.accounts", "account1,account2");
|
|
|
|
<?php echo PREF;?>("mail.accountmanager.accounts", "account1,account2");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Mise a jour |
|
|
|
|
|
|
|
<?php echo PREF;?>("app.update.enabled", false);
|
|
|
|
|
|
|
|
<?php echo PREF;?>("app.update.auto", false);
|
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
// Extension |
|
|
|
// End if for account settings |
|
|
|
<?php echo PREF;?>("extensions.installDistroAddons", true);
|
|
|
|
} |
|
|
|
<?php echo PREF;?>("extensions.enabledScopes", 13);
|
|
|
|
?> |
|
|
|
<?php echo PREF;?>("extensions.autoDisableScopes", 2);
|
|
|
|
|
|
|
|
|
|
|
|
// Disable auto updates |
|
|
|
|
|
|
|
<?php echo $pref;?>("app.update.enabled", false);
|
|
|
|
|
|
|
|
<?php echo $pref;?>("app.update.auto", false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Extensions |
|
|
|
|
|
|
|
<?php echo $pref;?>("extensions.installDistroAddons", true);
|
|
|
|
|
|
|
|
<?php echo $pref;?>("extensions.enabledScopes", 13);
|
|
|
|
|
|
|
|
<?php echo $pref;?>("extensions.autoDisableScopes", 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Spam |
|
|
|
// Spam |
|
|
|
<?php echo $pref;?>("mail.adaptivefilters.junk_threshold", 500);
|
|
|
|
<?php echo PREF;?>("mail.adaptivefilters.junk_threshold", 500);
|
|
|
|
|
|
|
|
|
|
|
|
// Checks IMAP folders |
|
|
|
// Checks |
|
|
|
<?php echo $pref;?>("mail.check_all_imap_folders_for_new", true);
|
|
|
|
defaultPref("mail.check_all_imap_folders_for_new", true); |
|
|
|
|
|
|
|
|
|
|
|
// Composition |
|
|
|
// Composition |
|
|
|
<?php echo $pref;?>("mail.default_html_action", 3);
|
|
|
|
defaultPref("mail.default_html_action", 3); |
|
|
|
|
|
|
|
|
|
|
|
// Attachments |
|
|
|
// Pièces jointes |
|
|
|
<?php echo $pref;?>("mail.content_disposition_type", 1);
|
|
|
|
defaultPref("mail.content_disposition_type ", 1); |
|
|
|
|
|
|
|
|
|
|
|
// Expunge |
|
|
|
// Expunge |
|
|
|
<?php echo $pref;?>("mail.imap.expunge_option", 3);
|
|
|
|
defaultPref("mail.imap.expunge_option", 3); |
|
|
|
<?php echo $pref;?>("mail.imap.expunge_threshold_number", 100);
|
|
|
|
defaultPref("mail.imap.expunge_threshold_number", 100); |
|
|
|
|
|
|
|
|
|
|
|
// Adds the domain from your email address to the |
|
|
|
|
|
|
|
// recipients email address if it doesn't have a domain |
|
|
|
|
|
|
|
<?php echo $pref;?>("mail.enable_autocomplete", true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Hide useless messages |
|
|
|
|
|
|
|
<?php echo $pref;?>("mail.ui.show.migration.on.upgrade", false);
|
|
|
|
|
|
|
|
<?php echo $pref;?>("app.update.showInstalledUI", false);
|
|
|
|
|
|
|
|
<?php echo $pref;?>("browser.startup.homepage_override.mstone", "ignore");
|
|
|
|
|
|
|
|
<?php echo $pref;?>("mailnews.start_page_override.mstone", "ignore");
|
|
|
|
|
|
|
|
<?php echo $pref;?>("mail.rights.version", 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
<?php |
|
|
|
// Include other conf fragment if they exist |
|
|
|
|
|
|
|
if (is_array(glob("thunderbird.mod.*.php"))){ |
|
|
|
if (is_array(glob("thunderbird.mod.*.php"))){ |
|
|
|
foreach (glob("thunderbird.mod.*.php") as $filename){ |
|
|
|
foreach (glob("thunderbird.mod.*.php") as $filename){ |
|
|
|
require($filename); |
|
|
|
require($filename); |
|
|
|