summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4a208ff)
raw | patch | inline | side by side (parent: 4a208ff)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 29 Jun 2006 11:55:53 +0000 (11:55 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 29 Jun 2006 11:55:53 +0000 (11:55 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3994 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/systems/class_componentGeneric.inc b/plugins/admin/systems/class_componentGeneric.inc
index 1d61176a11d3d396e088c4ee76f14f3df037f795..8648d0bc40cb3b3cd0e11d2c476e3ff2acd3b8db 100644 (file)
$ldap= $this->config->get_ldap_link();
$this->netConfigDNS->remove_from_parent();
$ldap->rmdir($this->dn);
- show_ldap_error($ldap->get_error(), _("Removing generic component failed"));
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing of system component/generic with dn '%s' failed."),$this->dn));
$this->handle_post_events("remove");
/* Delete references to object groups */
$this->netConfigDNS->cn = $this->cn;
$this->netConfigDNS->save($this->dn);
- show_ldap_error($ldap->get_error(), _("Saving generic component failed"));
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of system component/generic with dn '%s' failed."),$this->dn));
/* Optionally execute a command after we're done */
$this->postcreate();
diff --git a/plugins/admin/systems/class_goShareServer.inc b/plugins/admin/systems/class_goShareServer.inc
index e905b8894497a991517c36c84dba6b75ef0e7013..07b01117aa91c7d2544bf8bcf2a265ad033a62fd 100644 (file)
$ldap->cd($this->dn);
$ldap->add($this->attrs);
}
- show_ldap_error($ldap->get_error());
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing of system server/shares with dn '%s' failed."),$this->dn));
$this->handle_post_events("remove");
}
$ldap->cd($this->dn);
$ldap->add($this->attrs);
}
- show_ldap_error($ldap->get_error());
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/shares with dn '%s' failed."),$this->dn));
if($this->initially_was_account){
$this->handle_post_events("modify");
}else{
$attrs[$flag] = $value;
$this->$flag = $value;
$ldap->modify($attrs);
- show_ldap_error($ldap->get_error());
+ show_ldap_error($ldap->get_error(), sprintf(_("Set status flag, for system server/shares with dn '%s' failed."),$this->dn));
$this->action_hook();
}
}
if (count($attrs) == 0) {
$ldap->cd($mountsdn);
$ldap->add($mounts);
- show_ldap_error($ldap->get_error(), _("Creating mount container failed"));
+ show_ldap_error($ldap->get_error(), sprintf(_("Creating system server/shares (mount container) with dn '%s' failed."),$this->dn));
gosa_log("Mount container '$mountsdn' has been created");
}
if (count($attrs) != 0) {
$ldap->rmdir($mountdn);
- show_ldap_error($ldap->get_error(), _("Removing mount container failed"));
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing system server/shares (mount container) with dn '%s' failed."),$this->dn));
gosa_log("Mount object '".$mountdn."' has been removed");
}
}
$mountdn = "cn=".$mount["cn"].","."$mountsdn";
$ldap->cd($mountdn);
$ldap->add($mount);
- show_ldap_error($ldap->get_error(), _("Saving mount container failed"));
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving system server/shares (mount container) with dn '%s' failed."),$this->dn));
gosa_log("Mount object '".$mountdn."' has been added");
}
}
diff --git a/plugins/admin/systems/class_phoneGeneric.inc b/plugins/admin/systems/class_phoneGeneric.inc
index 09949d694c586c7b01ae7e54ae8cef0fa5fec28e..e85dc25cf8a1727bbf40cb40ef1934f85553ee40 100644 (file)
$this->netConfigDNS->remove_from_parent();
$ldap->rmdir($this->dn);
- show_ldap_error($ldap->get_error(), _("Removing phone failed"));
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing of system phone/generic with dn '%s' failed."),$this->dn));
$this->handle_post_events("remove");
/* Delete references to object groups */
}
$this->netConfigDNS->cn = $this->cn;
$this->netConfigDNS->save($this->dn);
- show_ldap_error($ldap->get_error(), _("Saving phone failed"));
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of system phone/generic with dn '%s' failed."),$this->dn));
/* Optionally execute a command after we're done */
$this->postcreate();
diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc
index af71cf6756744a3ca952bbf087c295abd07578e7..830f81e4499532d94eb86c94d1a66530e2e9c396 100644 (file)
/* Remove account & dns extension */
$this->netConfigDNS->remove_from_parent();
$ldap->rmdir($this->dn);
- show_ldap_error($ldap->get_error(), _("Removing printer failed"));
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing of system print/generic with dn '%s' failed."),$this->dn));
$this->handle_post_events("remove");
/* Delete references to object groups */
$this->handle_post_events("modify");
}
- show_ldap_error($ldap->get_error(), _("Saving printer failed"));
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of system print/generic with dn '%s' failed."),$this->dn));
$this->netConfigDNS->cn = $this->cn;
$this->netConfigDNS->dn = $this->dn;
diff --git a/plugins/admin/systems/class_servDB.inc b/plugins/admin/systems/class_servDB.inc
+++ /dev/null
@@ -1,260 +0,0 @@
-<?php
-
-class servdb extends plugin
-{
- /* CLI vars */
- var $cli_summary= "Manage server basic objects";
- var $cli_description= "Some longer text\nfor help";
- var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
- /* Object information */
- var $goImapName= "";
- var $goImapName_old= "";
- var $goImapConnect= "";
- var $goImapAdmin= "";
- var $goImapPassword= "";
- var $goImapSieveServer= "";
- var $goImapSievePort= "";
- var $goKrbRealm= "";
- var $goKrbAdmin= "";
- var $goKrbPassword= "";
- var $goFaxAdmin= "";
- var $goFaxPassword= "";
- var $goLogAdmin= "";
- var $goLogPassword= "";
- var $goFonAdmin= "";
- var $goFonPassword= "";
- var $goFonAreaCode= "";
- var $goFonCountryCode= "";
- var $ignore_account= TRUE;
- var $goGlpiAdmin="";
- var $goGlpiDatabase = "";
- var $goGlpiPassword ="";
-
-
- /* attribute list for save action */
- var $attributes= array("goImapName", "goImapConnect", "goImapAdmin", "goImapPassword",
- "goImapSieveServer", "goImapSievePort", "goKrbRealm",
- "goKrbAdmin", "goKrbPassword", "goFaxAdmin", "goFaxPassword",
- "goLogAdmin", "goLogPassword", "goFonAdmin", "goFonPassword",
- "goFonAreaCode", "goFonCountryCode","goGlpiAdmin","goGlpiDatabase","goGlpiPassword");
- var $objectclasses= array("top", "goServer");
- var $additionaloc= array("goImapServer" => array("goImapName", "goImapConnect",
- "goImapAdmin", "goImapPassword",
- "goImapSieveServer",
- "goImapSievePort"),
- "goKrbServer" => array("goKrbRealm", "goKrbAdmin",
- "goKrbPassword"),
- "goFaxServer" => array("goFaxAdmin", "goFaxPassword"),
- "goLogDBServer" => array("goLogAdmin", "goLogPassword"),
- "goGlpiServer" => array("goGlpiAdmin","goGlpiDatabase","goGlpiPassword"),
- "goFonServer" => array("goFonAdmin", "goFonPassword",
- "goFonAreaCode", "goFonCountryCode"));
-
- function servdb ($config, $dn= NULL)
- {
- plugin::plugin ($config, $dn);
-
- /* Make dynamic list of objectClasses */
- foreach ($this->additionaloc as $oc => $dummy){
- if (isset($this->attrs['objectClass']) && in_array($oc, $this->attrs['objectClass'])){
- $this->objectclasses[$oc]= $oc;
- }
- }
-
- /* We need to save the historical state of goImapName for later checking */
- $this->goImapName_old= $this->goImapName;
-
- /* Always is account... */
- $this->is_account= TRUE;
- }
-
- function execute()
- {
- /* Call parent execute */
- plugin::execute();
-
- /* Fill templating stuff */
- $smarty= get_smarty();
-
- /* Attributes... */
- foreach ($this->attributes as $attr){
- $smarty->assign("$attr", $this->$attr);
- $smarty->assign("$attr"."ACL", chkacl($this->acl, $attr));
- }
-
- /* Classes... */
- foreach ($this->additionaloc as $oc => $dummy){
- if (isset($this->objectclasses[$oc])){
- $smarty->assign("$oc", "checked");
- $smarty->assign("$oc"."State", "");
- $smarty->assign("$oc"."ACL", chkacl($this->acl, $oc));
-
- } else {
- $smarty->assign("$oc", "");
- $smarty->assign("$oc"."ACL", chkacl($this->acl, $oc));
- $smarty->assign("$oc"."State", "disabled");
- }
- }
-
- return($smarty->fetch (get_template_path('servdb.tpl', TRUE)));
- }
-
- function remove_from_parent()
- {
- /* This cannot be removed... */
- }
-
-
- /* Save data to object */
- function save_object()
- {
- if (isset($_POST['dbtab'])){
- plugin::save_object();
-
- /* Save checkbox state */
- foreach ($this->additionaloc as $oc => $dummy){
- if (isset($_POST[$oc]) && $_POST[$oc] == '1'){
- $this->objectclasses[$oc]= $oc;
- } else {
- unset($this->objectclasses[$oc]);
- }
- }
- }
- }
-
-
- /* Check supplied data */
- function check()
- {
- /* Call common method to give check the hook */
- $message= plugin::check();
-
- if(in_array("goGlpiServer",$this->objectclasses)){
- foreach(array("goGlpiAdmin","goGlpiDatabase") as $attr){
- if(empty($this->$attr)){
- $message[]= sprintf(_("The attribute '%s' is empty or contains invalid characters."), $attr);
- }
- }
- }
-
- /* All fields are marked as *must* */
- if (in_array("goImapServer", $this->objectclasses)){
- foreach (array("goImapAdmin", "goImapName") as $attr){
- if ($this->$attr == "" || preg_match("/ /", $this->$attr)){
- $message[]= sprintf(_("The attribute '%s' is empty or contains invalid characters."), $attr);
- }
- }
-
-
- /* Check connect string */
- if (!preg_match('/^\{[^:]+:[0-9]+.*\}$/', $this->goImapConnect)){
- $message[]= sprintf(_("The imap connect string needs to be in the form '%s'."),
- '{server-name:port/options}');
- }
- if (!preg_match('/^[0-9]+$/', $this->goImapSievePort)){
- $message[]= _("The sieve port needs to be numeric.");
- }
- }
- if (in_array("goKrbServer", $this->objectclasses)){
- foreach (array("goKrbAdmin", "goKrbRealm") as $attr){
- if ($this->$attr == "" || preg_match("/ /", $this->$attr)){
- $message[]= sprintf(_("The attribute '%s' is empty or contains invalid characters."), $attr);
- }
- }
- /* goKrbPassword is a must field, if goKrbServer is used as objectClass */
- if ($this->goKrbPassword == "" ){
- $message[]= sprintf(_("The specified kerberos password is empty."), $attr);
- }
- }
- if (in_array("goFaxServer", $this->objectclasses)){
- if ($this->goFaxAdmin == "" || preg_match("/ /", $this->goFaxAdmin)){
- $message[]= sprintf(_("The attribute '%s' is empty or contains invalid characters."), "goFaxAdmin");
- }
- }
- if (in_array("goLogServer", $this->objectclasses)){
- if ($this->goLogAdmin == "" || preg_match("/ /", $this->goLogAdmin)){
- $message[]= sprintf(_("The attribute '%s' is empty or contains invalid characters."), "goLogAdmin");
- }
- }
- if (in_array("goFonServer", $this->objectclasses)){
- foreach (array("goFonAdmin", "goFonAreaCode", "goFonCountryCode") as $attr){
- if ($this->$attr == "" || preg_match("/ /", $this->$attr)){
- $message[]= sprintf(_("The attribute '%s' is empty or contains invalid characters."), $attr);
- }
- }
- }
- if (in_array("goImapServer", $this->objectclasses) &&
- $this->goImapName != $this->goImapName_old) {
- // Attribute has changed
- if(!preg_match("/^[a-z0-9.-]+$/", $this->goImapName)) {
- $message[]= sprintf(_("The imap name string needs to be a hostname or an IP-address."));
- }
- }
-
- return ($message);
- }
-
-
- /* Save to LDAP */
- function save()
- {
- /* Normalize lazy objectclass arrays */
- $objectclasses= array();
- foreach($this->objectclasses as $oc){
- $objectclasses[]= $oc;
- }
-
- /* Move cn to sieve server */
- $this->goImapSieveServer= $this->cn;
-
- plugin::save();
-
- $test = $this->objectclasses;
- $tmp = array_flip($this->attrs['objectClass']);
-
- foreach($this->additionaloc as $key=>$val) {
- unset($tmp[$key]);
- }
-
- $classes = (array_flip(array_merge(array_flip($test),$tmp)));
-
- unset($this->attrs['objectClass']);
-
- foreach($classes as $class){
- $this->attrs['objectClass'][]=$class;
- }
-
-
- /* Remove unneeded attributes */
- foreach ($this->additionaloc as $oc => $attrs){
- if (!in_array($oc, $this->attrs['objectClass'])){
- foreach ($attrs as $attr){
- $this->attrs[$attr]= array();
- }
- }
- }
- $this->attrs = array_reverse($this->attrs);
-
- /* Write to LDAP */
- $ldap= $this->config->get_ldap_link();
- $ldap->cd($this->dn);
- $this->cleanup();
- $ldap->modify ($this->attrs);
-
- show_ldap_error($ldap->get_error(), _("Saving server db settings failed"));
-
- /* Optionally execute a command after we're done */
- if ($this->initially_was_account == $this->is_account){
- if ($this->is_modified){
- $this->handle_post_events("mofify");
- }
- } else {
- $this->handle_post_events("add");
- }
- }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/systems/class_servService.inc b/plugins/admin/systems/class_servService.inc
+++ /dev/null
@@ -1,490 +0,0 @@
-<?php
-
-class servservice extends plugin
-{
- /* CLI vars */
- var $cli_summary= "Manage server basic objects";
- var $cli_description= "Some longer text\nfor help";
- var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
- var $goExportEntry = array();
- var $goExportEntryList= array();
- var $goTimeSource = array();
- var $goLdapBase = "";
- var $goXdmcpIsEnabled = "";
- var $goFontPath = "";
- var $goNTPServer = "";
- var $goShareServer = false;
- var $goLdapServer = "";
- var $goTerminalServer = "";
- var $goSyslogServer = "";
- var $goCupsServer = "";
- var $goMailServer = "";
- var $o_subWindow = NULL;
-
- /* attribute list for save action */
- var $ignore_account= TRUE;
- var $attributes = array("goLdapBase","goXdmcpIsEnabled","goFontPath","goExportEntry","goTimeSource");
- var $possible_objectclasses= array( "goShareServer", "goNtpServer", "goServer", "GOhard", "goLdapServer",
- "goTerminalServer", "goSyslogServer", "goCupsServer","goMailServer");
- var $objectclasses = array( "top","goServer", "GOhard");
- var $additionaloc = array( "goShareServer" => array("goExportEntry"),
- "goNtpServer" => array("goTimeSource"),
- "goLdapServer" => array("goLdapBase"),
- "goTerminalServer"=> array("goXdmcpIsEnabled", "goFontPath"),
- "goSyslogServer" => array(),
- "goMailServer" => array(),
- "goCupsServer" => array());
-
- var $allow_mounts = false; //do we allow mount entries?
- var $mounts_to_add = array();
- var $mounts_to_remove = array();
- var $oldone = NULL; //temp dave for old mount entry
-
- function servservice ($config, $dn= NULL)
- {
-
- plugin::plugin ($config, $dn);
-
- /* Check if mount objectClass is available */
- $ldap = $this->config->get_ldap_link();
- $avl_objectclasses = $ldap->get_objectclasses();
- if (isset($avl_objectclasses["mount"])) {
- $this->allow_mounts = true;
- }
-
- /* Assemble final object class list */
- foreach ($this->additionaloc as $oc => $dummy){
- if (isset($this->attrs['objectClass']) && in_array($oc, $this->attrs['objectClass'])){
- $this->objectclasses[$oc]= $oc;
- }
- }
-
- /* Load arrays */
- foreach (array("goTimeSource") as $name){
- $tmp= array();
- if (isset($this->attrs[$name])){
- for ($i= 0; $i<$this->attrs[$name]['count']; $i++){
- $tmp[$this->attrs[$name][$i]]= $this->attrs[$name][$i];
- }
- }
- $this->$name= $tmp;
- }
-
- $tmp =array();
- $tmp2=array();
- if(isset($this->attrs['goExportEntry'])){
- if(isset($this->attrs['goExportEntry']['count'])){
- for($i= 0; $i<$this->attrs['goExportEntry']['count']; $i++){
- $entry= $this->attrs['goExportEntry'][$i];
- $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry;
- }
- }
- }
- $this->goExportEntryList = $tmp;
-
- /* Always is account... */
- $this->is_account= TRUE;
-
- /* Check if goShareServer is defined */
- if((isset($this->attrs['objectClass']))&&(is_array($this->attrs['objectClass']))){
- if(in_array("goShareServer",$this->attrs['objectClass'])){
- $this->goShareServer = true;
- }
- }
- }
-
- function addToList($entry){
- $key = key($entry);
- $this->goExportEntryList[$key]=$entry[$key];
- }
-
- function deleteFromList($id){
- unset($this->goExportEntryList[$id]);
- }
-
- function addToMountList($entry) {
- $key = key($entry);
- $type = $this->get_share_type($entry[$key]);
- if (($type == "netatalk") || ($type == "NFS")) {
- $this->mounts_to_add[$entry[$key]] = $entry[$key];
- unset($this->mounts_to_remove[$entry[$key]]);
- }
- }
-
- function deleteFromMountList($entry) {
- $type = $this->get_share_type($entry);
- if (($type == "netatalk") || ($type == "NFS")) {
- $this->mounts_to_remove[$entry] = $entry;
- unset($this->mounts_to_add[$entry]);
- }
- }
-
- function execute()
- {
- /* Call parent execute */
- plugin::execute();
-
- /* Fill templating stuff */
- $smarty= get_smarty();
- $smarty->assign("staticAddress", "");
-
- if((isset($_POST['DelNfsEnt']))&&(isset($_POST['goExportEntryList']))){
- if($this->allow_mounts){
- foreach($_POST['goExportEntryList'] as $entry){
- $this->deleteFromMountList($this->goExportEntryList[$entry]);
- }
- }
- foreach($_POST['goExportEntryList'] as $entry){
- $this->deleteFromList($entry);
- }
- }
-
- if(isset($_POST['NewNfsAdd'])){
- $this->oldone = NULL;
- $this->o_subWindow = new servnfs($this->config,$this->acl, $this->allow_mounts, $this->dn);
- $this->dialog = true;
- }
-
- if((isset($_POST['NewNfsEdit']))&&(isset($_POST['goExportEntryList']))){
- $entry = $this->goExportEntryList[$_POST['goExportEntryList'][0]];
- $add_mount=isset($this->mounts_to_add[$entry]);
- $this->oldone=$entry;
- $this->o_subWindow = new servnfs($this->config,$this->acl,$this->allow_mounts,$this->dn,$entry,$add_mount);
- $this->dialog = true;
- }
-
- if(isset($this->o_subWindow)){
- $this->o_subWindow->save_object(TRUE);
- }
-
- /* Save NFS setup */
- if(isset($_POST['NFSsave'])){
- if(count($this->o_subWindow->check())>0){
- foreach($this->o_subWindow->check() as $msg) {
- print_red($msg);
- }
- }else{
- $this->o_subWindow->save_object();
- $newone = $this->o_subWindow->save();
- $this->addToList($newone);
- if($this->allow_mounts){
- if($this->oldone) {
- $this->deleteFromMountList($this->oldone);
- }
- if ($this->o_subWindow->should_create_mount()) {
- $this->addToMountList($newone);
- }
- }
- unset($this->o_subWindow);
- $this->dialog = false;
- }
- }
-
- /* Cancel NFS setup */
- if(isset($_POST['NFScancel'])){
- $this->oldone = NULL;
- unset($this->o_subWindow);
- $this->dialog = false;
- }
-
- /* Execute NFS setup dialog*/
- if(isset($this->o_subWindow)){
- return $this->o_subWindow->execute();
- }
-
- /* Here we add a new entry */
- if(isset($_POST['NewNTPAdd']) && $_POST['NewNTPExport'] != "") {
- $this->goTimeSource[$_POST['NewNTPExport']]= $_POST['NewNTPExport'];
- asort($this->goTimeSource);
- }
-
- /* Deleting an Entry, is a bit more complicated than adding one*/
- if(isset($_POST['DelNTPEnt'])) {
- foreach ($_POST['goTimeSource'] as $entry){
- if (isset($this->goTimeSource[$entry])){
- unset($this->goTimeSource[$entry]);
- }
- }
- }
-
- /* Attributes */
- foreach ($this->attributes as $attr){
- $smarty->assign("$attr", $this->$attr);
- $smarty->assign("$attr"."ACL", chkacl($this->acl, $attr));
- $smarty->assign($attr."State","");
- }
-
- $tellSmarty=array();
- ksort($this->goExportEntryList);
- foreach($this->goExportEntryList as $name=>$values){
- $tmp = split("\|",$values);
- $tellSmarty[$name] = $tmp[0]." ".$tmp[4]." (".$tmp[2].")";
- }
- $smarty->assign("goExportEntry",array_keys($tellSmarty));
- $smarty->assign("goExportEntryKeys",($tellSmarty));
- $smarty->assign("goExportEntryACL", chkacl($this->acl, "goExportEntry"));
-
- $smarty->assign("goTimeSource", $this->goTimeSource);
- $smarty->assign("goTimeSourceACL", chkacl($this->acl, "goTimeSource"));
- $smarty->assign("goTimeSourceState","");
-
-
- /* Classes... */
- foreach ($this->additionaloc as $oc => $dummy){
- if (isset($this->objectclasses[$oc])){
- $smarty->assign("$oc", "checked");
- $smarty->assign("$oc"."State", "");
- $smarty->assign("$oc"."ACL", chkacl($this->acl, $oc));
-
- } else {
- $smarty->assign("$oc", "");
- $smarty->assign("$oc"."ACL", chkacl($this->acl, $oc));
- $smarty->assign("$oc"."State", "disabled");
- }
- }
-
- if(!$this->goShareServer){
- $smarty->assign("goShareServerState", " disabled ");
- $smarty->assign("goExportEntryACL", " disabled ");
- }else{
- $smarty->assign("goShareServerState", " ");
- $smarty->assign("goExportEntryACL", " ");
- }
-
- /* Different handling for checkbox */
- if($this->goXdmcpIsEnabled == "true"){
- $smarty->assign("goXdmcpIsEnabled","checked");
- } else {
- $smarty->assign("goXdmcpIsEnabled","");
- }
-
- return($smarty->fetch (get_template_path('servservice.tpl', TRUE)));
- }
-
-
- function remove_from_parent()
- {
- /* This cannot be removed... */
- }
-
-
- /* Save data to object */
- function save_object()
- {
- plugin::save_object();
- if (isset($_POST['servicetab'])){
- $tmp = $this->goTimeSource;
-
- if(isset($_POST['goLdapBase'])){
- $this->goLdapBase = $_POST['goLdapBase'];
- }
-
- /* Save checkbox state */
- foreach ($this->additionaloc as $oc => $dummy){
-// if($oc == "goNtpServer") continue;
- if (chkacl($this->acl, $oc) == ""){
- if (isset($_POST[$oc]) && $_POST[$oc] == '1'){
- $this->objectclasses[$oc]= $oc;
- } else {
- unset($this->objectclasses[$oc]);
- }
- }
- }
-
- /* Save xdmcp is enabled flag */
- if (isset($_POST['goXdmcpIsEnabled'])){
- $this->goXdmcpIsEnabled= "true";
- } else {
- $this->goXdmcpIsEnabled= "false";
- }
-
- /* Save xdmcp is enabled flag */
- if (isset($_POST['goShareServer'])){
- $this->goShareServer = true;
- } else {
- $this->goShareServer = false;
- }
- $this->goTimeSource = array();
- $this->goTimeSource = $tmp;
- }
- }
-
-
- /* Check supplied data */
- function check()
- {
- /* Call common method to give check the hook */
- $message= plugin::check();
-
- if((isset($_POST['goTerminalServer']))&&(empty($this->goFontPath))){
- $message[]=_("Terminal server, must have fontpath specified.");
- }
-
- return ($message);
- }
-
-
- /* Save to LDAP */
- function save()
- {
- plugin::save();
-
- $tmp= array();
-
- /* Remove all from this plugin */
- foreach($this->attrs['objectClass'] as $oc){
- if (!in_array_ics($oc, $this->possible_objectclasses)){
- $tmp[]= $oc;
- }
- }
-
- /* Merge our current objectclasses */
- foreach($this->objectclasses as $oc){
- if (!in_array_ics($oc, $tmp)){
- $tmp[]= $oc;
- }
- }
-
- /* Reassign cleaned value */
- $this->attrs['objectClass']= $tmp;
-
- /* Arrays */
- foreach (array("goTimeSource"=>"goTimeSource", "goExportEntryList"=>"goExportEntry") as $source => $destination){
- $this->attrs[$destination]= array();
- foreach ($this->$source as $element){
- $this->attrs[$destination][]= $element;
- }
- }
-
- /* Process netatalk mounts */
- if($this->allow_mounts) {
- $this->process_mounts();
- }
-
- /* Remove illegal attributes */
- foreach ($this->additionaloc as $oc => $attrs){
- if (!in_array($oc, $this->objectclasses)){
- foreach ($attrs as $attr){
- $this->attrs[$attr]= array();
- }
- }
- }
-
- /* Write to LDAP */
- $ldap= $this->config->get_ldap_link();
- $ldap->cd($this->dn);
- $this->cleanup();
- $ldap->modify ($this->attrs);
-
- show_ldap_error($ldap->get_error(), _("Saving server service object failed"));
-
- /* Optionally execute a command after we're done */
- if ($this->initially_was_account == $this->is_account){
- if ($this->is_modified){
- $this->handle_post_events("mofify");
- }
- } else {
- $this->handle_post_events("add");
- }
- }
-
- function process_mounts() {
-
- $clip = "cn=" . $this->cn . ",ou=servers,ou=systems,";
- $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip));
-
- $mounts = array(
- "objectClass" => "container",
- "cn" => "mounts"
- );
-
- # load data from mounts container
- $ldap = $this->config->get_ldap_link();
- $ldap->cat($mountsdn, array('dn'));
- $attrs = $ldap->fetch();
-
- # mounts container not present yet, so we create it
- if (count($attrs) == 0) {
- $ldap->cd($mountsdn);
- $ldap->add($mounts);
- show_ldap_error($ldap->get_error(), _("Creating mount container failed"));
- gosa_log("Mount container '$mountsdn' has been created");
- }
-
- # remove deleted mounts from the container
- foreach ($this->mounts_to_remove as $entry) {
- $mount=$this->returnMountEntry($entry);
- $mountdn = "cn=".$mount["cn"].","."$mountsdn";
-
- $ldap->cat($mountdn, array('dn'));
- $attrs = $ldap->fetch();
-
- if (count($attrs) != 0) {
- $ldap->rmdir($mountdn);
- show_ldap_error($ldap->get_error(), _("Removing mount container failed"));
- gosa_log("Mount object '".$mountdn."' has been removed");
- }
- }
-
- # add new mounts to the container
- foreach ($this->mounts_to_add as $entry) {
-
- $mount=$this->returnMountEntry($entry);
- $mountdn = "cn=".$mount["cn"].","."$mountsdn";
- $ldap->cd($mountdn);
- $ldap->add($mount);
- show_ldap_error($ldap->get_error(), _("Saving mount container failed"));
- gosa_log("Mount object '".$mountdn."' has been added");
- }
- }
-
- function get_share_type($share) {
- $tmp = split("\|", $share);
- return $tmp[2];
- }
-
-
- function returnMountEntry($entry) {
- $item = split("\|", $entry);
- $name = $item[0];
- $description = $item[1];
- $type = $item[2];
- $charset = $item[3];
- $path = $item[4];
- $options = $item[5];
-
- switch ($type) {
- case "netatalk" : {
- $mount = array(
- "mountDirectory" => "/Network/Servers/",
- "mountOption" => array(
- "net",
- "url==afp://;AUTH=NO%20USER%20AUTHENT@".$this->cn."/$name/"
- ),
- "mountType" => "url",
- "objectClass" => "mount",
- "cn" => $this->cn .":/".$name
- );
- break;
- }
- case "NFS" : {
- $mount = array(
- "mountDirectory" => "/Network/Servers/",
- "mountOption" => "net",
- "mountType" => "nfs",
- "objectClass" => "mount",
- "cn" => $this->cn .":".$path
- );
- break;
- }
- default : {
- continue;
- }
- }
- return $mount;
- }
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>