index d648d588dbe6e03b38a59feb6c37f4790ff2cf44..6cb2ede0581e9d969b690b0e3f9a09c4036f3cf8 100644 (file)
define ("DEBUG_SESSION",32);
define ("DEBUG_CONFIG", 64);
define ("DEBUG_ACL", 128);
+define ("DEBUG_SI", 256);
/* Rewrite german 'umlauts' and spanish 'accents'
to get better results */
}
/* Check for global language settings in gosa.conf */
- if ($config->get_cfg_value('lang') != ""){
- $lang = $config->get_cfg_value('lang');
+ if (isset ($config) && $config->get_cfg_value('language') != ""){
+ $lang = $config->get_cfg_value('language');
if(!preg_match("/utf/i",$lang)){
$lang .= ".UTF-8";
}
global $config, $BASE_DIR;
/* Set theme */
- $theme= $config->get_cfg_value("theme", "default");
+ if (isset ($config)){
+ $theme= $config->get_cfg_value("theme", "default");
+ } else {
+ $theme= "default";
+ }
/* Return path for empty filename */
if ($filename == ''){
}
+function array_remove_entries_ics($needles, $haystack)
+{
+ $tmp= array();
+
+ /* Loop through entries to be removed */
+ foreach ($haystack as $entry){
+ if (!in_array_ics($entry, $needles)){
+ $tmp[]= $entry;
+ }
+ }
+
+ return ($tmp);
+}
+
+
function gosa_array_merge($ar1,$ar2)
{
if(!is_array($ar1) || !is_array($ar2)){
global $config;
$ldap = new LDAP ($binddn, $pass, $server,
- isset($config->current['RECURSIVE']) && $config->current['RECURSIVE'] == "true",
- isset($config->current['TLS']) && $config->current['TLS'] == "true");
+ isset($config->current['LDAPFOLLOWREFERRALS']) && $config->current['LDAPFOLLOWREFERRALS'] == "true",
+ isset($config->current['LDAPTLS']) && $config->current['LDAPTLS'] == "true");
/* Sadly we've no proper return values here. Use the error message instead. */
if (!$ldap->success()){
- echo sprintf(_("FATAL: Error when connecting the LDAP. Server said '%s'."), $ldap->get_error());
+ msg_dialog::display(_("Fatal error"),
+ sprintf(_("FATAL: Error when connecting the LDAP. Server said '%s'."), $ldap->get_error()),
+ FATAL_ERROR_DIALOG);
exit();
}
$config->set_current($name);
$mode= "kerberos";
- if ($config->get_cfg_value("krbsasl") == "true"){
+ if ($config->get_cfg_value("useSaslForKerberos") == "true"){
$mode= "sasl";
}
/* Look for entry or realm */
$ldap= $config->get_ldap_link();
if (!$ldap->success()){
- msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "", LDAP_AUTH, ERROR_DIALOG));
- $smarty= get_smarty();
- $smarty->display(get_template_path('headers.tpl'));
- echo "<body>".session::get('errors')."</body></html>";
+ msg_dialog::display(_("LDAP error"),
+ msgPool::ldaperror($ldap->get_error(), "", LDAP_AUTH)."<br><br>".session::get('errors'),
+ FATAL_ERROR_DIALOG);
exit();
}
$ldap->search("(&(objectClass=gosaAccount)(|(uid=$username)(userPassword={$mode}$username)))", array("uid"));
/* Look for entry or realm */
$ldap= $config->get_ldap_link();
if (!$ldap->success()){
- msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), "", LDAP_AUTH, FATAL_ERROR_DIALOG));
- $smarty= get_smarty();
- $smarty->display(get_template_path('headers.tpl'));
- echo "<body>".session::get('errors')."</body></html>";
+ msg_dialog::display(_("LDAP error"),
+ msgPool::ldaperror($ldap->get_error(), "", LDAP_AUTH)."<br><br>".session::get('errors'),
+ FATAL_ERROR_DIALOG);
exit();
}
$ldap->search("(&(objectClass=gosaAccount)(uid=$username))", array("uid"));
/* look through the entire ldap */
$ldap = $config->get_ldap_link();
if (!$ldap->success()){
- msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error()), FATAL_ERROR_DIALOG);
- $smarty= get_smarty();
- $smarty->display(get_template_path('headers.tpl'));
- echo "<body>".session::get('errors')."</body></html>";
+ msg_dialog::display(_("LDAP error"),
+ msgPool::ldaperror($ldap->get_error(), "", LDAP_AUTH)."<br><br>".session::get('errors'),
+ FATAL_ERROR_DIALOG);
exit();
}
$ldap->cd($config->current['BASE']);
$allowed_attributes = array("uid","mail");
$verify_attr = array();
- if($config->get_cfg_value("login_attribute") != ""){
- $tmp = split(",", $config->get_cfg_value("login_attribute"));
+ if($config->get_cfg_value("loginAttribute") != ""){
+ $tmp = split(",", $config->get_cfg_value("loginAttribute"));
foreach($tmp as $attr){
if(in_array($attr,$allowed_attributes)){
$verify_attr[] = $attr;
/* password check, bind as user with supplied password */
$ldap->disconnect();
$ldap= new LDAP($ui->dn, $password, $config->current['SERVER'],
- isset($config->current['RECURSIVE']) &&
- $config->current['RECURSIVE'] == "true",
- isset($config->current['TLS'])
- && $config->current['TLS'] == "true");
+ isset($config->current['LDAPFOLLOWREFERRALS']) &&
+ $config->current['LDAPFOLLOWREFERRALS'] == "true",
+ isset($config->current['LDAPTLS'])
+ && $config->current['LDAPTLS'] == "true");
if (!$ldap->success()){
return (NULL);
}
global $config;
$map = array(
- "ogroupou" => "ou=groups,",
- "applicationou" => "ou=apps,",
- "systemsou" => "ou=systems,",
- "serverou" => "ou=servers,ou=systems,",
- "terminalou" => "ou=terminals,ou=systems,",
- "workstationou" => "ou=workstations,ou=systems,",
- "printerou" => "ou=printers,ou=systems,",
- "phoneou" => "ou=phones,ou=systems,",
- "componentou" => "ou=netdevices,ou=systems,",
- "winstations" => "ou=winstation,",
-
- "blocklistou" => "ou=gofax,ou=systems,",
- "incomingou" => "ou=incoming,",
- "aclroleou" => "ou=aclroles,",
- "macroou" => "ou=macros,ou=asterisk,ou=configs,ou=systems,",
- "conferenceou" => "ou=conferences,ou=asterisk,ou=configs,ou=systems,",
-
- "faiou" => "ou=fai,ou=configs,ou=systems,",
- "faiscriptou" => "ou=scripts,",
- "faihookou" => "ou=hooks,",
- "faitemplateou" => "ou=templates,",
- "faivariableou" => "ou=variables,",
- "faiprofileou" => "ou=profiles,",
- "faipackageou" => "ou=packages,",
- "faipartitionou"=> "ou=disk,",
-
- "deviceou" => "ou=devices,",
- "mimetypeou" => "ou=mime,");
+ "ogroupRDN" => "ou=groups,",
+ "applicationRDN" => "ou=apps,",
+ "systemRDN" => "ou=systems,",
+ "serverRDN" => "ou=servers,ou=systems,",
+ "terminalRDN" => "ou=terminals,ou=systems,",
+ "workstationRDN" => "ou=workstations,ou=systems,",
+ "printerRDN" => "ou=printers,ou=systems,",
+ "phoneRDN" => "ou=phones,ou=systems,",
+ "componentRDN" => "ou=netdevices,ou=systems,",
+ "sambaMachineAccountRDN" => "ou=winstation,",
+
+ "faxBlocklistRDN" => "ou=gofax,ou=systems,",
+ "systemIncomingRDN" => "ou=incoming,",
+ "aclRoleRDN" => "ou=aclroles,",
+ "phoneMacroRDN" => "ou=macros,ou=asterisk,ou=configs,ou=systems,",
+ "phoneConferenceRDN" => "ou=conferences,ou=asterisk,ou=configs,ou=systems,",
+
+ "faiBaseRDN" => "ou=fai,ou=configs,ou=systems,",
+ "faiScriptRDN" => "ou=scripts,",
+ "faiHookRDN" => "ou=hooks,",
+ "faiTemplateRDN" => "ou=templates,",
+ "faiVariableRDN" => "ou=variables,",
+ "faiProfileRDN" => "ou=profiles,",
+ "faiPackageRDN" => "ou=packages,",
+ "faiPartitionRDN"=> "ou=disk,",
+
+ "sudoRDN" => "ou=sudoers,",
+
+ "deviceRDN" => "ou=devices,",
+ "mimetypeRDN" => "ou=mime,");
/* Preset ou... */
- if ($config->get_cfg_value($name) != ""){
+ if ($config->get_cfg_value($name, "_not_set_") != "_not_set_"){
$ou= $config->get_cfg_value($name);
} elseif (isset($map[$name])) {
$ou = $map[$name];
function get_people_ou()
{
- return (get_ou("PEOPLE"));
+ return (get_ou("userRDN"));
}
function get_groups_ou()
{
- return (get_ou("GROUPS"));
+ return (get_ou("groupRDN"));
}
function get_winstations_ou()
{
- return (get_ou("WINSTATIONS"));
+ return (get_ou("sambaMachineAccountRDN"));
}
{
global $config;
- return ($config->get_cfg_value("strict") == "true");
+ if (isset($config)){
+ return ($config->get_cfg_value("strictNamingRules") == "true");
+ }
+ return (TRUE);
}
return ($result);
}
- echo "Error in idgen string: don't know how to handle rule $rule.\n";
+ echo "Error in idGenerator string: don't know how to handle rule $rule.\n";
return (array($rule));
}
$progress = (int)(($percentage /100)*$width);
- /* Abort printing out percentage, if divs are to small */
-
-
/* If theres a better solution for this, use it... */
- $str = "
- <div style=\" width:".($width)."px;
- height:".($height)."px;
- background-color:#000000;
-padding:1px;\">
+ $str = "\n <div style=\" width:".($width)."px; ";
+ $str.= "\n height:".($height)."px; ";
+ $str.= "\n background-color:#000000; ";
+ $str.= "\n padding:1px;\" > ";
+
+ $str.= "\n <div style=\" width:".($width)."px; ";
+ $str.= "\n background-color:#$bgcolor; ";
+ $str.= "\n height:".($height)."px;\" > ";
+
+ if(($height >10)&&($showvalue)){
+ $str.= "\n <font style=\"font-size:".($height-2)."px; ";
+ $str.= "\n color:#FF0000; align:middle; ";
+ $str.= "\n padding-left:".((int)(($width*0.4)))."px; \"> ";
+ $str.= "\n <b>".$percentage."%</b> ";
+ $str.= "\n </font> ";
+ }
+
+ $str.= "\n <div style=\" width:".$progress."px; ";
+ $str.= "\n height:".$height."px; ";
+ $str.= "\n background-color:#".$color2.$color2.$color."; \" >";
+ $str.= "\n </div>";
+ $str.= "\n </div>";
+ $str.= "\n </div>";
- <div style=\" width:".($width)."px;
- background-color:#$bgcolor;
-height:".($height)."px;\">
-
- <div style=\" width:".$progress."px;
-height:".$height."px;
- background-color:#".$color2.$color2.$color."; \">";
-
-
- if(($height >10)&&($showvalue)){
- $str.= "<font style=\"font-size:".($height-2)."px;color:#FF0000;align:middle;padding-left:".((int)(($width*0.4)))."px;\">
- <b>".$percentage."%</b>
- </font>";
- }
-
- $str.= "</div></div></div>";
-
- return($str);
+ return($str);
}
{
global $config;
- if ($config->get_cfg_value("base_hook") != ""){
+ if ($config->get_cfg_value("nextIdHook") != ""){
/* Call hook script - if present */
- $command= $config->get_cfg_value("base_hook");
+ $command= $config->get_cfg_value("nextIdHook");
if ($command != ""){
$command.= " '".LDAP::fix($dn)."' $attrib";
if (preg_match("/^[0-9]+$/", $output[0])){
return ($output[0]);
} else {
- msg_dialog::display(_("Warning"), _("'base_hook' is not available. Using default base!"), WARNING_DIALOG);
- return ($config->get_cfg_value("uidbase"));
+ msg_dialog::display(_("Warning"), _("'nextIdHook' is not available. Using default base!"), WARNING_DIALOG);
+ return ($config->get_cfg_value("uidNumberBase"));
}
} else {
- msg_dialog::display(_("Warning"), _("'base_hook' is not available. Using default base!"), WARNING_DIALOG);
- return ($config->get_cfg_value("uidbase"));
+ msg_dialog::display(_("Warning"), _("'nextIdHook' is not available. Using default base!"), WARNING_DIALOG);
+ return ($config->get_cfg_value("uidNumberBase"));
}
} else {
- msg_dialog::display(_("Warning"), _("'base_hook' is not available. Using default base!"), WARNING_DIALOG);
- return ($config->get_cfg_value("uidbase"));
+ msg_dialog::display(_("Warning"), _("'nextIdHook' is not available. Using default base!"), WARNING_DIALOG);
+ return ($config->get_cfg_value("uidNumberBase"));
}
}
$messages= array();
/* Get objectclasses */
- $ldap = new ldapMultiplexer(new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE,$cfg['tls']));
+ $ldap = new ldapMultiplexer(new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE, $cfg['tls']));
$objectclasses = $ldap->get_objectclasses();
if(count($objectclasses) == 0){
msg_dialog::display(_("LDAP warning"), _("Cannot get schema information from server. No schema check possible!"), WARNING_DIALOG);
@@ -2351,7 +2373,7 @@ function get_languages($languages_in_own_language = FALSE,$strip_region_tag = FA
"en_US" => "English",
"nl_NL" => "Dutch",
"pl_PL" => "Polish",
- "sv_SE" => "Swedish",
+ #"sv_SE" => "Swedish",
"zh_CN" => "Chinese",
"vi_VN" => "Vietnamese",
"ru_RU" => "Russian");
@@ -2364,7 +2386,7 @@ function get_languages($languages_in_own_language = FALSE,$strip_region_tag = FA
"en_US" => _("English"),
"nl_NL" => _("Dutch"),
"pl_PL" => _("Polish"),
- "sv_SE" => _("Swedish"),
+ #"sv_SE" => _("Swedish"),
"zh_CN" => _("Chinese"),
"vi_VN" => _("Vietnamese"),
"ru_RU" => _("Russian"));
global $config;
# Try to use gosa-si?
- if ($config->get_cfg_value("gosa_si") != ""){
+ if ($config->get_cfg_value("gosaSupportURI") != ""){
$res= gosaSupportDaemon::send("gosa_gen_smb_hash", "GOSA", array("password" => $password), TRUE);
if (isset($res['XML']['HASH'])){
$hash= $res['XML']['HASH'];
$hash= "";
}
} else {
- $tmp= $config->get_cfg_value('smbhash')." ".escapeshellarg($password);
+ $tmp= $config->get_cfg_value('sambaHashHook')." ".escapeshellarg($password);
@DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $tmp, "Execute");
exec($tmp, $ar);
}
/* Get attribute that we should use as serial number */
- $attr= $config->get_cfg_value("uniq_identifier");
+ $attr= $config->get_cfg_value("modificationDetectionAttribute");
if($attr != ""){
$ldap = $config->get_ldap_link();
$ldap->cat($dn,array($attr));
$tmp= array();
foreach ($attrs['objectClass'] as $oc) {
foreach ($list as $class){
- if ($oc != $class){
+ if (strtolower($oc) != strtolower($class)){
$tmp[]= $oc;
}
}