index 75a7b1f684f115f6b6c9489674ff8795b8a90da6..fd58da5b07fd25f17917bd75ff504a8706fa1d89 100644 (file)
/* TEST PHASE .... */
+ static function get_all_objects_for_given_object($dn,$filter,$detailed = false)
+ {
+ $res = FAI::get_all_objects_for_given_base($dn,$filter,$detailed);
+ $name = preg_replace("/,ou=.*$/","",$dn);
+ $entries = array();
+ foreach($res as $entry_dn => $data){
+ if(!preg_match("/,".$name.",/",$entry_dn)) continue;
+ $entries[$entry_dn] = $data;
+ }
+ return($entries);
+ }
+
+
+
+
/* Returns all object for the given release.
This function resolves the releases
from base up to the given dn.
foreach($res_tmp as $attr){
$buffer = array();
- $name = preg_replace("/".normalizePreg($release)."/i","",$attr['dn']);
+ $name = preg_replace("/".preg_quote($release, '/')."/i","",$attr['dn']);
if(isset($attr['FAIstate'][0])){
if(preg_match("/removed$/",$attr['FAIstate'][0])){
/* Seems to be an inherited class, apply current FAIstate to this classes
*/
- if(!preg_match("/".normalizePreg($base_release)."$/i",$attr['dn'])){
+ if(!preg_match("/".preg_quote($base_release, '/')."$/i",$attr['dn'])){
$buffer['FAIstate'] = $FAIstate;
}else{
{
global $config;
- if(!preg_match("/".normalizePreg(get_ou('faiou'))."/",$dn)){
- $base = get_ou('faiou').$dn;
+ if(!preg_match("/".preg_quote(get_ou('faiBaseRDN'), '/')."/",$dn)){
+ $base = get_ou('faiBaseRDN').$dn;
}else{
$base = $dn;
}
$ldap->search("(objectClass=FAIbranch)",array("ou","dn"));
while($attrs = $ldap->fetch()){
if($appendedName){
- $res[$attrs['dn']] = convert_department_dn(preg_replace("/,".normalizePreg(get_ou('faiou')).".*$/","",$attrs['dn']));
+ $res[$attrs['dn']] = convert_department_dn(preg_replace("/,".preg_quote(get_ou('faiBaseRDN'), '/').".*$/","",$attrs['dn']));
}else{
$res[$attrs['dn']] = $attrs['ou'][0];
}
/* Dont't try to modify non FAIclasses
*/
- if(!preg_match("/[^,]+,".normalizePreg(get_ou("faiou"))."/",$obj_dn)){
+ if(!preg_match("/[^,]+,".preg_quote(get_ou("faiBaseRDN"), '/')."/",$obj_dn)){
trigger_error("PLEASE check fai class handling in ".__LINE__." -> ".__FILE__);
echo "<br>-->".$Current_DN."<br>";
echo "<br>-->".$obj_dn."<br>";
/* Check if this Profile uses the source class ($cn)
*/
- if(preg_match("/".normalizePreg($cn)."/",$attrs['FAIclass'])){
- $attrs['FAIclass'] = preg_replace("/[ ]*".normalizePreg($cn)."[ ]*/i"," ",$attrs['FAIclass']);
+ if(preg_match("/".preg_quote($cn, '/')."/",$attrs['FAIclass'])){
+ $attrs['FAIclass'] = preg_replace("/[ ]*".preg_quote($cn, '/')."[ ]*/i"," ",$attrs['FAIclass']);
if(empty($attrs['FAIclass'])){
$attrs['FAIclass'] = array();
}
$evt = $events['TRIGGERED']['DaemonEvent_recreate_fai_release_db'];
$tmp = new $evt['CLASS_NAME']($config);
$tmp->set_type(TRIGGERED_EVENT);
- $tmp->add_targets(array("GOsa"));
+ $tmp->add_targets(array("GOSA"));
$o_queue = new gosaSupportDaemon();
if(!$o_queue->append($tmp)){
msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
$buffer = array();
# $name = str_ireplace($release,"",$attr['dn']);
- $name = preg_replace("/".normalizePreg($release)."/i","",$attr['dn']);
+ $name = preg_replace("/".preg_quote($release, '/')."/i","",$attr['dn']);
if(isset($attr['FAIstate'][0])&&(preg_match("/removed$/",$attr['FAIstate'][0]))){
/* Get dn suffix. Example "FAIvairableEntry=keksdose,FAIvariable=Keksregal," */
# $dn_suffix = str_ireplace($base_release,"",$dn);
- $dn_suffix = preg_replace("/".normalizePreg($base_release)."/i","",$dn);
+ $dn_suffix = preg_replace("/".preg_quote($base_release, '/')."/i","",$dn);
/* Check if given object also exists whitin one of these releases */
foreach($sub_releases as $p_release => $name){
/* Get dn suffix. Example "FAIvairableEntry=keksdose,FAIvariable=Keksregal," */
# $dn_suffix = str_ireplace($base_release,"",$dn);
- $dn_suffix = preg_replace("/".normalizePreg($base_release)."/i","",$dn);
+ $dn_suffix = preg_replace("/".preg_quote($base_release, '/')."/i","",$dn);
/* Check if given object also exists whitin one of these releases */
foreach($previous_releases as $p_release){
$ret = array();
/* Explode dns into pieces, to be able to build parent dns */
- $dns_to_check = gosa_ldap_explode_dn(preg_replace("/".normalizePreg(",".$config->current['BASE'])."/i","",$dn));
+ $dns_to_check = gosa_ldap_explode_dn(preg_replace("/".preg_quote(",".$config->current['BASE'], '/')."/i","",$dn));
if(!is_array($dns_to_check)){
return;
$ldap->search("(objectClass=FAIbranch)",array("ou","FAIstate"));
while($attrs = $ldap->fetch()){
foreach($sub_releases as $sub_rel){
- if(preg_match("/^".normalizePreg($sub_rel.get_ou('faiou'))."/",$attrs['dn'])){
- $f_releases[$sub_rel.get_ou('faiou')] = $attrs;
+ if(preg_match("/^".preg_quote($sub_rel.get_ou('faiBaseRDN'), '/')."/",$attrs['dn'])){
+ $f_releases[$sub_rel.get_ou('faiBaseRDN')] = $attrs;
}
}
}
foreach($sub_releases as $name => $sub_rel){
$FAIstate = "";
- if(isset($f_releases[$sub_rel.get_ou('faiou')]) && isset($f_releases[$sub_rel.get_ou('faiou')]['FAIstate'])){
- $FAIstate = $f_releases[$sub_rel.get_ou('faiou')]['FAIstate'][0];
+ if(isset($f_releases[$sub_rel.get_ou('faiBaseRDN')]) && isset($f_releases[$sub_rel.get_ou('faiBaseRDN')]['FAIstate'])){
+ $FAIstate = $f_releases[$sub_rel.get_ou('faiBaseRDN')]['FAIstate'][0];
}
foreach($groups as $dn => $data){
}else{
$source_dns = array();
foreach($g_releases as $dn => $data){
- if(preg_match("/^".normalizePreg($source_dn)."/",$dn)){
+ if(preg_match("/^".preg_quote($source_dn, '/')."/",$dn)){
$source_dns[$dn] = $data;
}
}
$ldap->cd($dn);
$ldap->ls("(|(objectClass=gotoSubmenuEntry)(objectClass=gotoMenuEntry))",$dn,array("dn"));
while($attrs = $ldap->fetch()){
- $destination = preg_replace("/".normalizePreg($dn)."$/","ou=".$destination_name.",".$dn,$attrs['dn']);
+ $destination = preg_replace("/".preg_quote($dn, '/')."$/","ou=".$destination_name.",".$dn,$attrs['dn']);
$to_copy[$attrs['dn']] = $destination;
}
}
}
unset($attr['count']);
unset($attr['dn']);
- if(!in_array("FAIclass",$attr['objectClass'])){
+ if(!in_array("FAIobject",$attr['objectClass'])){
$attr['objectClass'][] = "FAIobject";
}
$attr['FAIstate'] = $type;
if(!$ldap->success()){
/* Some error occurred */
- print "---------------------------------------------";
- print $ldap->get_error()."<br>";
- print $sourcedn."<br>";
- print $destinationdn."<br>";
- print_a( $attr);
+ msg_dialog::display(_("Fatal error"),
+ sprintf(_("Release creation failed due to ldap errors. Additional informations '%s'."),
+ $ldap->get_error()."<br>".$sourcedn."<br>".$destinationdn."<br>"),FATAL_ERROR_DIALOG);
exit();
}
}
$ldap->cd($config->current['BASE']);
/* Split dn into pices */
- $dns_to_check = gosa_ldap_explode_dn(preg_replace("/".normalizePreg(",".$config->current['BASE'])."/i","",$Current_DN));
+ $dns_to_check = gosa_ldap_explode_dn(preg_replace("/".preg_quote(",".$config->current['BASE'], '/')."/i","",$Current_DN));
if(!is_array($dns_to_check)){
return;