1 <?php
3 class configRegistry{
5 public $config = NULL;
6 public $properties = array();
7 public $ldapStoredProperties = array();
8 public $fileStoredProperties = array();
9 public $classToName = array();
11 public $status = 'none';
13 // Excludes property values defined in ldap
14 public $ignoreLdapProperties = FALSE;
16 // Contains all classes with plInfo
17 public $classesWithInfo = array();
18 public $pluginRequirements = array();
19 public $categoryToClass = array();
21 public $objectClasses = array();
23 public $detectedSchemaIssues = array();
24 public $schemaCheckFailed = FALSE;
25 public $schemaCheckFinished = FALSE;
26 public $pluginsDeactivated = array();
28 function __construct($config)
29 {
30 $this->config = &$config;
32 // Detect classes that have a plInfo method
33 global $class_mapping;
34 foreach ($class_mapping as $cname => $path){
35 $cmethods = get_class_methods($cname);
36 if (is_array($cmethods) && in_array_ics('plInfo',$cmethods)){
38 // Get plugin definitions
39 $def = call_user_func(array($cname, 'plInfo'));;
41 // Register Post Events (postmodfiy,postcreate,postremove,checkhook)
42 if(count($def)){
43 $this->classesWithInfo[$cname] = $def;
44 }
45 }
46 }
48 // (Re)Load properties
49 $this->reload();
50 }
53 function schemaCheckFinished()
54 {
55 return($this->schemaCheckFinished);
56 }
59 function validateSchemata($force = FALSE, $disableIncompatiblePlugins = FALSE)
60 {
61 // We can check the schemata only with a valid LDAP connection
62 if(empty($this->config->current['CONFIG'])){
63 return(TRUE);
64 }
66 // Don't do things twice unless forced
67 if($this->schemaCheckFinished && !$force) return($this->schemaCheckFailed);
69 // Prepare result array
70 $this->detectedSchemaIssues = array();
71 $this->detectedSchemaIssues['missing'] = array();
72 $this->detectedSchemaIssues['versionMismatch'] = array();
74 // Clear last results
75 $this->pluginsDeactivated = array();
77 // Read objectClasses from ldap
78 if(!count($this->objectClasses)){
79 $ldap = $this->config->get_ldap_link();
80 $ldap->cd($this->config->current['BASE']);
81 $this->objectClasses = $ldap->get_objectclasses();
82 }
84 // Collect required schema infos
85 $this->pluginRequirements = array('ldapSchema' => array());
86 $this->categoryToClass = array();
87 foreach($this->classesWithInfo as $cname => $defs){
88 if(isset($defs['plRequirements'])){
89 $this->pluginRequirements[$cname] = $defs['plRequirements'];
90 }
91 }
93 // Check schema requirements now $missing = $invalid = array();
94 foreach($this->pluginRequirements as $cname => $requirements){
96 // Check LDAP schema requirements for this plugins
97 $failure = FALSE;
98 if(isset($requirements['ldapSchema'])){
99 foreach($requirements['ldapSchema'] as $oc => $version){
100 if(rand(0,5)==1 || !$this->ocAvailable($oc)){
101 $this->detectedSchemaIssues['missing'][] = $oc;
102 $this->schemaCheckFailed = TRUE;
103 $failure = TRUE;
104 }elseif(!empty($version)){
105 $currentVersion = $this->getObjectClassVersion($oc);
106 if(1 || !empty($currentVersion) && !$this->ocVersionMatch($version, $currentVersion)){
107 if($currentVersion == -1){
108 $currentVersion = _("unknown");
109 }
110 $this->detectedSchemaIssues['versionMismatch'][] =
111 sprintf(_("%s has version %s but %s required!"), bold($oc),bold($currentVersion),bold($version));
112 $this->schemaCheckFailed = TRUE;
113 $failure = TRUE;
114 }
115 }
116 }
117 }
119 // Display corresponding plugins now
120 if($disableIncompatiblePlugins && $failure && isset($requirements['onFailureDisablePlugin'])){
121 foreach($requirements['onFailureDisablePlugin'] as $name){
122 $this->pluginsDeactivated[$name] = $name;
123 }
124 }
125 }
126 $this->schemaCheckFinished =TRUE;
127 session::un_set('plist');
128 return(!$this->schemaCheckFailed);
129 }
132 function getDisabledPlugins()
133 {
134 return($this->pluginsDeactivated);
135 }
138 function displayErrors()
139 {
141 $message = "";
142 if(count($this->detectedSchemaIssues['missing'])){
143 $message .=
144 _("The following objectClasses are missing:").
145 "<div class='scrollContainer' style='height:100px'>".
146 msgPool::buildList($this->detectedSchemaIssues['missing']).
147 "</div>";
148 }
149 if(count($this->detectedSchemaIssues['versionMismatch'])){
150 $message.=
151 _("The following objectClasses do not match the version requirements:").
152 "<div class='scrollContainer' style='height:100px'>".
153 msgPool::buildList($this->detectedSchemaIssues['versionMismatch']).
154 "</div>";
155 }
156 if(count($this->pluginsDeactivated)){
158 $tmp = array();
159 foreach($this->pluginsDeactivated as $class){
160 $tmp[$class] = (isset($this->classToName[$class]))? $this->classToName[$class] : $class;
161 }
163 $message.= _("Due to unresolved requirements GOsa will deactivate the following plugins:").
164 "<div class='scrollContainer' style='height:100px'>".
165 msgPool::buildList($tmp).
166 "</div>";
167 }
169 if($message != ""){
170 msg_dialog::display(_("Schema validation error"),$message, ERROR_DIALOG);
171 }
172 }
175 function ocVersionMatch($required, $installed)
176 {
177 $operator = preg_replace('/^([=<>]*).*$/',"\\1",$required);
178 $required = preg_replace('/^[=<>]*(.*)$/',"\\1",$required);
179 return(version_compare($installed,$required, $operator));
180 }
183 function getObjectClassVersion($oc)
184 {
185 if(!isset($this->objectClasses[$oc])){
186 return(NULL);
187 }else{
188 $version = -1; // unknown
189 if(preg_match("/(v[^)]*)/", $this->objectClasses[$oc]['DESC'])){
190 $version = preg_replace('/^.*\(v([^)]*)\).*$/',"\\1", $this->objectClasses[$oc]['DESC']);
191 }
192 }
193 return($version);
194 }
197 // check wheter an objectClass is installed or not.
198 function ocAvailable($name)
199 {
200 return(isset($this->objectClasses[$name]));
201 }
204 function reload($force = FALSE)
205 {
206 // Do not reload the properties everytime, once we have
207 // everything loaded and registrered skip the reload.
208 // Status is 'finished' once we had a ldap connection (logged in)
209 if(!$force && $this->status == 'finished') return;
211 // Reset everything
212 $this->ldapStoredProperties = array();
213 $this->fileStoredProperties = array();
214 $this->properties = array();
215 $this->mapByName = array();
217 // Search for config flags defined in the config file (TAB section)
218 foreach($this->config->data['TABS'] as $tabname => $tabdefs){
219 foreach($tabdefs as $info){
221 // Check if the info is valid
222 if(isset($info['NAME']) && isset($info['CLASS'])){
224 // Check if there is nore than just the plugin definition
225 if(count($info) > 2){
226 foreach($info as $name => $value){
228 if(!in_array($name, array('CLASS','NAME'))){
229 $class= $info['CLASS'];
230 $this->fileStoredProperties[$class][strtolower($name)] = $value;
231 }
232 }
233 }
234 }
235 }
236 }
238 // Search for config flags defined in the config file (MENU section)
239 foreach($this->config->data['MENU'] as $section => $entries){
240 foreach($entries as $entry){
241 if(count($entry) > 2 && isset($entry['CLASS'])){
242 $class = $entry['CLASS'];
243 foreach($entry as $name => $value){
244 if(!in_array($name, array('CLASS','ACL'))){
245 $this->fileStoredProperties[strtolower($class)][strtolower($name)] = $value;
246 }
247 }
248 }
249 }
250 }
252 // Search for config flags defined in the config file (MAIN section)
253 foreach($this->config->data['MAIN'] as $name => $value){
254 $this->fileStoredProperties['core'][strtolower($name)] = $value;
255 }
257 // Search for config flags defined in the config file (Current LOCATION section)
258 if(isset($this->config->current)){
259 foreach($this->config->current as $name => $value){
260 $this->fileStoredProperties['core'][strtolower($name)] = $value;
261 }
262 }
264 // Skip searching for LDAP defined properties if 'ignoreLdapProperties' is set to 'true'
265 // in the config.
266 $this->ignoreLdapProperties = FALSE;
267 if(isset($this->fileStoredProperties['core'][strtolower('ignoreLdapProperties')]) &&
268 preg_match("/(true|on)/i", $this->fileStoredProperties['core'][strtolower('ignoreLdapProperties')])){
269 $this->ignoreLdapProperties = TRUE;
270 }
272 // Search for all config flags defined in the LDAP - BUT only if we ARE logged in.
273 if(!empty($this->config->current['CONFIG'])){
274 $ldap = $this->config->get_ldap_link();
275 $ldap->cd($this->config->current['CONFIG']);
276 $ldap->search('(&(objectClass=gosaConfig)(gosaSetting=*))', array('cn','gosaSetting'));
277 while($attrs = $ldap->fetch()){
278 $class = $attrs['cn'][0];
279 for($i=0; $i<$attrs['gosaSetting']['count']; $i++){
280 list($name,$value) = preg_split("/:/",$attrs['gosaSetting'][$i],2);
281 $this->ldapStoredProperties[$class][$name] = $value;
282 }
283 }
284 $this->status = 'finished';
285 }
287 // Register plugin properties.
288 foreach ($this->classesWithInfo as $cname => $def){
290 // Detect class name
291 $name = $cname;
292 $name = (isset($def['plShortName'])) ? $def['plShortName'] : $cname;
293 $name = (isset($def['plDescription'])) ? $def['plDescription'] : $cname;
295 // Register post events
296 $this->classToName[$cname] = $name;
297 $data = array('name' => 'postcreate','type' => 'command');
298 $this->register($cname, $data);
299 $data = array('name' => 'postremove','type' => 'command');
300 $this->register($cname, $data);
301 $data = array('name' => 'postmodify','type' => 'command');
302 $this->register($cname, $data);
303 $data = array('name' => 'check', 'type' => 'command');
304 $this->register($cname, $data);
306 // Register properties
307 if(isset($def['plProperties'])){
308 foreach($def['plProperties'] as $property){
309 $this->register($cname, $property);
310 }
311 }
312 }
313 }
315 function register($class,$data)
316 {
317 $id = count($this->properties);
318 $this->properties[$id] = new gosaProperty($this,$class,$data);
319 $p = strtolower("{$class}::{$data['name']}");
320 $this->mapByName[$p] = $id;
321 }
323 public function getAllProperties()
324 {
325 return($this->properties);
326 }
328 function propertyExists($class,$name)
329 {
330 $p = strtolower("{$class}::{$name}");
331 return(isset($this->mapByName[$p]));
332 }
334 private function getId($class,$name)
335 {
336 $p = strtolower("{$class}::{$name}");
337 if(!isset($this->mapByName[$p])){
338 return(-1);
339 }
340 return($this->mapByName[$p]);
341 }
343 function getProperty($class,$name)
344 {
345 if($this->propertyExists($class,$name)){
346 return($this->properties[$this->getId($class,$name)]);
347 }
348 return(NULL);
349 }
351 function getPropertyValue($class,$name)
352 {
353 if($this->propertyExists($class,$name)){
354 $tmp = $this->getProperty($class,$name);
355 return($tmp->getValue());
356 }
357 return("");
358 }
360 function setPropertyValue($class,$name, $value)
361 {
362 if($this->propertyExists($class,$name)){
363 $tmp = $this->getProperty($class,$name);
364 return($tmp->setValue($value));
365 }
366 return("");
367 }
369 function saveChanges()
370 {
371 $migrate = array();
372 foreach($this->properties as $prop){
374 // Is this property modified
375 if(in_array($prop->getStatus(),array('modified','removed'))){
377 // Check if we've to migrate something before we can make the changes effective.
378 if($prop->migrationRequired()){
379 $migrate[] = $prop;
380 }else{
381 $prop->save();
382 }
383 }
384 }
385 return($migrate);
386 }
387 }
390 class gosaProperty
391 {
392 protected $name = "";
393 protected $class = "";
394 protected $value = "";
395 protected $tmp_value = ""; // Used when modified but not saved
396 protected $type = "string";
397 protected $default = "";
398 protected $defaults = "";
399 protected $description = "";
400 protected $check = "";
401 protected $migrate = "";
402 protected $mandatory = FALSE;
403 protected $group = "default";
404 protected $parent = NULL;
405 protected $data = array();
407 protected $migrationClass = NULL;
409 /*! The current property status
410 * 'ldap' Property is stored in ldap
411 * 'file' Property is stored in the config file
412 * 'undefined' Property is currently not stored anywhere
413 * 'modified' Property has been modified (should be saved)
414 */
415 protected $status = 'undefined';
417 protected $attributes = array('name','type','default','description','check',
418 'migrate','mandatory','group','defaults');
423 function __construct($parent,$classname,$data)
424 {
425 // Set some basic infos
426 $this->parent = &$parent;
427 $this->class = $classname;
428 $this->data = $data;
430 // Get all relevant information from the data array (comes from plInfo)
431 foreach($this->attributes as $aName){
432 if(isset($data[$aName])){
433 $this->$aName = $data[$aName];
434 }
435 }
437 // Initialize with the current value
438 $this->_restoreCurrentValue();
440 }
442 function migrationRequired()
443 {
444 // Instantiate migration class
445 if(!empty($this->migrate) && $this->migrationClass == NULL){
446 if(!class_available($this->migrate)){
447 trigger_error("Cannot start migration for gosaProperty::'{$this->getName()}' class not found ({$this->migrate})!");
448 }else{
449 $class = $this->migrate;
450 $tmp = new $class($this->parent->config,$this);
451 if(! $tmp instanceof propertyMigration){
452 trigger_error("Cannot start migration for gosaProperty::'{$this->getName()}' doesn't implement propertyMigration!");
453 }else{
454 $this->migrationClass = $tmp;
455 }
456 }
457 }
458 if(empty($this->migrate) || $this->migrationClass == NULL){
459 return(FALSE);
460 }
461 return($this->migrationClass->checkForIssues());
462 }
464 function getMigrationClass()
465 {
466 return($this->migrationClass);
467 }
469 function check()
470 {
471 $val = $this->getValue(TRUE);
472 $return = TRUE;
473 if($this->mandatory && empty($val)){
474 $return = FALSE;
475 }
477 $check = $this->getCheck();
478 if(!empty($val) && !empty($check)){
479 $res = call_user_func(preg_split("/::/", $this->check),$messages=TRUE, $this->class,$this->name,$val, $this->type);
480 if(!$res){
481 $return = FALSE;
482 }
483 }
484 return($return);
485 }
487 static function isBool($message,$class,$name,$value, $type)
488 {
489 $match = in_array($value,array('true','false',''));
491 // Display the reason for failing this check.
492 if($message && ! $match){
493 msg_dialog::display(_("Warning"),
494 sprintf(_("The value '%s' specified for '%s:%s' is invalid. A bool value is required here!"),
495 bold($value),bold($class),bold($name)),
496 WARNING_DIALOG);
497 }
499 return($match);
500 }
502 static function isString($message,$class,$name,$value, $type)
503 {
504 $match = TRUE;
506 // Display the reason for failing this check.
507 if($message && ! $match){
508 msg_dialog::display(_("Warning"),
509 sprintf(_("The value '%s' specified for '%s:%s' is invalid. A string value is required here!"),
510 bold($value),bold($class),bold($name)),
511 WARNING_DIALOG);
512 }
514 return($match);
515 }
517 static function isInteger($message,$class,$name,$value, $type)
518 {
519 $match = is_numeric($value) && !preg_match("/[^0-9]/", $value);
521 // Display the reason for failing this check.
522 if($message && ! $match){
523 msg_dialog::display(_("Warning"),
524 sprintf(_("The value '%s' specified for '%s:%s' is invalid. A numeric value is required here!"),
525 bold($value),bold($class),bold($name)),
526 WARNING_DIALOG);
527 }
529 return($match);
530 }
532 static function isPath($message,$class,$name,$value, $type)
533 {
534 $match = preg_match("#^(/[^/]*/){1}#", $value);
536 // Display the reason for failing this check.
537 if($message && ! $match){
538 msg_dialog::display(_("Warning"),
539 sprintf(_("The path '%s' specified for '%s:%s' is invalid!"),
540 bold($value),bold($class),bold($name)),
541 WARNING_DIALOG);
542 }
544 return($match);
545 }
547 static function isReadablePath($message,$class,$name,$value, $type)
548 {
549 $match = !empty($value)&&is_dir($value)&&is_writeable($value);
551 // Display the reason for failing this check.
552 if($message && ! $match){
553 if(!is_dir($value)){
554 msg_dialog::display(_("Warning"),
555 sprintf(_("The folder '%s' specified for '%s:%s' does not exists!"),
556 bold($value),bold($class),bold($name)),
557 WARNING_DIALOG);
558 }elseif(!is_readable($value)){
559 msg_dialog::display(_("Warning"),
560 sprintf(_("The folder '%s' specified for '%s:%s' cannot be used for reading!"),
561 bold($value),bold($class),bold($name)),
562 WARNING_DIALOG);
563 }
564 }
566 return($match);
567 }
569 static function isWriteablePath($message,$class,$name,$value, $type)
570 {
571 $match = !empty($value)&&is_dir($value)&&is_writeable($value);
573 // Display the reason for failing this check.
574 if($message && ! $match){
575 if(!is_dir($value)){
576 msg_dialog::display(_("Warning"),
577 sprintf(_("The folder '%s' specified for '%s:%s' does not exists!"),
578 bold($value),bold($class),bold($name)),
579 WARNING_DIALOG);
580 }elseif(!is_writeable($value)){
581 msg_dialog::display(_("Warning"),
582 sprintf(_("The folder '%s' specified for '%s:%s' cannot be used for writing!"),
583 bold($value),bold($class),bold($name)),
584 WARNING_DIALOG);
585 }
586 }
588 return($match);
589 }
591 static function isReadableFile($message,$class,$name,$value, $type)
592 {
593 $match = !empty($value) && is_readable($value) && is_file($value);
595 // Display the reason for failing this check.
596 if($message && ! $match){
598 if(!is_file($value)){
599 msg_dialog::display(_("Warning"),
600 sprintf(_("The file '%s' specified for '%s:%s' does not exists!"),
601 bold($value),bold($class),bold($name)),
602 WARNING_DIALOG);
603 }elseif(!is_readable($value)){
604 msg_dialog::display(_("Warning"),
605 sprintf(_("The file '%s' specified for '%s:%s' cannot be read!"),
606 bold($value),bold($class),bold($name)),
607 WARNING_DIALOG);
608 }
609 }
611 return($match);
612 }
614 static function isCommand($message,$class,$name,$value, $type)
615 {
616 $match = TRUE;
618 // Display the reason for failing this check.
619 if($message && ! $match){
620 msg_dialog::display(_("Warning"),
621 sprintf(_("The command '%s' specified for '%s:%s' is invalid!"),
622 bold($value),bold($class),bold($name)),
623 WARNING_DIALOG);
624 }
626 return($match);
627 }
629 static function isDn($message,$class,$name,$value, $type)
630 {
631 $match = preg_match("/^([a-z]*=[^=,]*,)*[^=]*=[^=]*$/i", $value);
633 // Display the reason for failing this check.
634 if($message && ! $match){
635 msg_dialog::display(_("Warning"),
636 sprintf(_("The dn '%s' specified for '%s:%s' is invalid!"),
637 bold($value),bold($class),bold($name)),
638 WARNING_DIALOG);
639 }
641 return($match);
642 }
644 static function isRdn($message,$class,$name,$value, $type)
645 {
646 $match = preg_match("/^([a-z]*=[^=,]*,)*[^=]*=[^=,]*,?$/i", $value);
648 // Display the reason for failing this check.
649 if($message && ! $match){
650 msg_dialog::display(_("Warning"),
651 sprintf(_("The rdn '%s' specified for '%s:%s' is invalid!"),
652 bold($value),bold($class),bold($name)),
653 WARNING_DIALOG);
654 }
656 return($match);
657 }
659 private function _restoreCurrentValue()
660 {
661 // First check for values in the LDAP Database.
662 if(isset($this->parent->ldapStoredProperties[$this->class][$this->name])){
663 $this->setStatus('ldap');
664 $this->value = $this->parent->ldapStoredProperties[$this->class][$this->name];
665 return;
666 }
668 // Second check for values in the config file.
669 if(isset($this->parent->fileStoredProperties[strtolower($this->class)][strtolower($this->name)])){
670 $this->setStatus('file');
671 $this->value = $this->parent->fileStoredProperties[strtolower($this->class)][strtolower($this->name)];
672 return;
673 }
675 // If there still wasn't found anything then fallback to the default.
676 if($this->getStatus() == 'undefined'){
677 $this->value = $this->getDefault();
678 }
679 }
681 function getMigrate() { return($this->migrate); }
682 function getCheck() { return($this->check); }
683 function getName() { return($this->name); }
684 function getClass() { return($this->class); }
685 function getGroup() { return($this->group); }
686 function getType() { return($this->type); }
687 function getDescription() { return($this->description); }
688 function getDefault() { return($this->default); }
689 function getDefaults() { return($this->defaults); }
690 function getStatus() { return($this->status); }
691 function isMandatory() { return($this->mandatory); }
693 function setValue($str)
694 {
695 if(in_array($this->getStatus(), array('modified'))){
696 $this->tmp_value = $str;
697 }elseif($this->value != $str){
698 $this->setStatus('modified');
699 $this->tmp_value = $str;
700 }
701 }
703 function getValue($temporary = FALSE)
704 {
705 if($temporary){
706 if(in_array($this->getStatus(), array('modified','removed'))){
707 return($this->tmp_value);
708 }else{
709 return($this->value);
710 }
711 }else{
713 // Do not return ldap values if we've to ignore them.
714 if($this->parent->ignoreLdapProperties){
715 if(isset($this->parent->fileStoredProperties[strtolower($this->class)][strtolower($this->name)])){
716 return($this->parent->fileStoredProperties[strtolower($this->class)][strtolower($this->name)]);
717 }else{
718 return($this->getDefault());
719 }
720 }else{
721 return($this->value);
722 }
723 }
724 }
726 function restoreDefault()
727 {
728 if(in_array($this->getStatus(),array('ldap'))){
729 $this->setStatus('removed');
731 // Second check for values in the config file.
732 if(isset($this->parent->fileStoredProperties[strtolower($this->class)][strtolower($this->name)])){
733 $this->tmp_value = $this->parent->fileStoredProperties[strtolower($this->class)][strtolower($this->name)];
734 }else{
735 $this->tmp_value = $this->getDefault();
736 }
737 }
738 }
740 function save()
741 {
742 if($this->getStatus() == 'modified'){
743 $ldap = $this->parent->config->get_ldap_link();
744 $ldap->cd($this->parent->config->current['BASE']);
745 $dn = "cn={$this->class},".$this->parent->config->current['CONFIG'];
746 $ldap->cat($dn);
747 if(!$ldap->count()){
748 $ldap->cd($dn);
749 $data = array(
750 'cn' => $this->class,
751 'objectClass' => array('top','gosaConfig'),
752 'gosaSetting' => $this->name.":".$this->tmp_value);
754 $ldap->add($data);
755 if(!$ldap->success()){
756 echo $ldap->get_error();
757 }
759 }else{
760 $attrs = $ldap->fetch();
761 $data = array();
762 $found = false;
763 if(isset($attrs['gosaSetting']['count'])){
764 for($i = 0;$i<$attrs['gosaSetting']['count']; $i ++){
765 $set = $attrs['gosaSetting'][$i];
766 if(preg_match("/^{$this->name}:/", $set)){
767 $set = "{$this->name}:{$this->tmp_value}";
768 $found = true;
769 }
770 $data['gosaSetting'][] = $set;
771 }
772 }
773 if(!$found) $data['gosaSetting'][] = "{$this->name}:{$this->tmp_value}";
774 $ldap->cd($dn);
775 $ldap->modify($data);
776 if(!$ldap->success()){
777 echo $ldap->get_error();
778 }
779 }
780 $this->value = $this->tmp_value;
781 $this->setStatus('ldap');
782 }elseif($this->getStatus() == 'removed'){
783 $ldap = $this->parent->config->get_ldap_link();
784 $ldap->cd($this->parent->config->current['BASE']);
785 $dn = "cn={$this->class},".$this->parent->config->current['CONFIG'];
786 $ldap->cat($dn);
787 $attrs = $ldap->fetch();
788 $data = array('gosaSetting' => array());
789 for($i = 0;$i<$attrs['gosaSetting']['count']; $i ++){
790 $set = $attrs['gosaSetting'][$i];
791 if(preg_match("/^{$this->name}:/", $set)){
792 continue;
793 }
794 $data['gosaSetting'][] = $set;
795 }
796 $ldap->cd($dn);
797 $ldap->modify($data);
798 if(!$ldap->success()){
799 echo $ldap->get_error();
800 }
801 $this->_restoreCurrentValue();
802 }
803 }
805 private function setStatus($state)
806 {
807 if(!in_array($state, array('ldap','file','undefined','modified','removed'))) {
808 trigger_error("Unknown property status given '{$state}' for {$this->class}:{$this->name}!");
809 }else{
810 $this->status = $state;
811 }
812 }
814 function isValid()
815 {
816 return(TRUE);
817 }
818 }
822 interface propertyMigration
823 {
824 function __construct($config,$property);
825 }
828 ?>