s_title = _("Ldap settings"); $this->s_title_long = _("Ldap connection setup"); $this->s_info = _("This dialog allows the basic configuration of GOsa's behaviour and properties in your main configuration."); $tmp = @passwordMethod::get_available_methods_if_not_loaded(); $this->crypt_methods = $tmp['name']; $tmp = $this->get_available_mail_classes(); $this->mail_methods = $tmp['name']; } function execute() { $smarty = get_smarty(); foreach($this->attributes as $attr){ $smarty->assign($attr,$this->$attr); } $smarty->assign("connection_established",$this->is_connection_established()); $smarty->assign("peopledns",array("uid","cn")); $smarty->assign("crypt_methods",$this->crypt_methods); $smarty->assign("mail_methods",$this->mail_methods); return($smarty -> fetch (get_template_path("../setup/setup_step4.tpl"))); } /* Returns the classnames auf the mail classes */ function get_available_mail_classes() { $dir = opendir( "../include"); $methods = array(); $suffix = "class_mail-methods-"; $lensuf = strlen($suffix); $prefix = ".inc"; $lenpre = strlen($prefix); $i = 0; while (($file = readdir($dir)) !== false){ if(stristr($file,$suffix)) { $lenfile = strlen($file); $methods['name'][$i] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre); $methods['file'][$i] = $file; $methods[$i]['file'] = $file; $methods[$i]['name'] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre); $i++; } } return($methods); } /* Check if specified server is reachable */ function is_connection_established() { @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); $cid = @ldap_connect($this->connection); $ds = @ldap_bind($cid, $this->admin, $this->password); @ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); } function try_to_get_base_automatically() { @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); $cid = @ldap_connect($this->connection); $ds = @ldap_bind($cid); @ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); $sr= ldap_search ($ds, NULL, "objectClass=*", array("namingContexts")); $attr= ldap_get_entries($cid,$sr); echo ldap_error($cid); print_a($attr); } function save_object() { foreach($this->attributes as $attr){ if(isset($_POST[$attr])){ $this->$attr = $_POST[$attr]; } } /* Get base automatically */ if(isset($_POST['get_base'])){ $this->try_to_get_base_automatically(); } } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>