You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.6 KiB

<?php
ini_set('log_errors', 1);
ini_set('display_errors', 0);
require('conf.php');
if(isset($_SERVER['QUERY_STRING']) && preg_match('/^.+@' . DOMAIN . '$/', $_SERVER['QUERY_STRING'])) {
$temp = explode('@', $_SERVER['QUERY_STRING']);
$uid = $temp[0];
// Bind to the LDAP server
// Not used for now, but might be usefull one day to generate conf per group or per user
$link = @ldap_connect(LDAP_SERVER) or die ("Couldn't connect to the LDAP server");
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_bind($link) or die ("Couldn't bind to the LDAP server");
// Lookup the user
$result = ldap_search($link, USER_BASE, "uid=" . $uid);
$user = ldap_get_entries($link, $result);
if($user['count'] == 0) {
// user not found
exit;
}
$pref = FF_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;
}
}
$url = HOME_URL;
if (preg_match('/^https?:\/\//', $user[0]['labeleduri'][0]))
$url = $user[0]['labeleduri'][0];
}
else {
exit;
}
?>
// 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);
// Disable the "know your rights" message
<?php echo $pref;?>("browser.rights.3.shown", true);
// Home page
<?php
if ($pref == 'defaultPref'){
// startup.homepage is a complex setting.
// see http://mike.kaply.com/2012/08/29/setting-the-default-firefox-homepage-with-autoconfig/
$url = 'data:text/plain,browser.startup.homepage='.$url;
}
?>
<?php echo $pref;?>("browser.startup.homepage", "'.<?php echo $url;?>.'");
<?php echo $pref;?>("browser.startup.page", 1);
<?php echo $pref;?>("startup.homepage_override_url", "");
<?php echo $pref;?>("startup.homepage_welcome_url", "");
// Do not check for default browser
<?php echo $pref;?>("browser.shell.checkDefaultBrowser", false);
// Disable popup blocker
// not that very useful anymore, and blocks legitim popups from SOGo
<?php echo $pref;?>("dom.disable_open_during_load", false);
// Block 3rd party cookies
<?php echo $pref;?>("network.cookie.cookieBehavior", 1);
<?php
// Include other conf fragment if they exist
if (is_array(glob("firefox.mod.*.php"))){
foreach (glob("firefox.mod.*.php") as $filename){
require($filename);
}
}
?>