From 07e6492263fef837908f515518bd362b433a44ce Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 5 Apr 2006 14:47:54 +0000 Subject: [PATCH] Added support for general check hooks git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2995 594d385d-05f5-0310-b6e9-bd551577e9d8 --- FAQ | 13 ++++ include/class_plugin.inc | 64 +++++++++++++++++++ .../addons/addressbook/class_addressbook.inc | 3 +- .../applications/class_applicationGeneric.inc | 3 +- .../class_applicationParameters.inc | 3 +- .../departments/class_departmentGeneric.inc | 3 +- plugins/admin/fai/class_askClassName.inc | 4 +- plugins/admin/fai/class_faiHook.inc | 4 +- plugins/admin/fai/class_faiHookEntry.inc | 4 +- plugins/admin/fai/class_faiPackage.inc | 3 +- .../fai/class_faiPackageConfiguration.inc | 4 +- plugins/admin/fai/class_faiPackageEntry.inc | 4 +- plugins/admin/fai/class_faiPackageNew.inc | 4 +- plugins/admin/fai/class_faiPartitionTable.inc | 3 +- .../fai/class_faiPartitionTableEntry.inc | 3 +- plugins/admin/fai/class_faiProfile.inc | 3 +- plugins/admin/fai/class_faiProfileEntry.inc | 4 +- plugins/admin/fai/class_faiScript.inc | 4 +- plugins/admin/fai/class_faiScriptEntry.inc | 3 +- plugins/admin/fai/class_faiTemplate.inc | 4 +- plugins/admin/fai/class_faiTemplateEntry.inc | 4 +- plugins/admin/fai/class_faiVariable.inc | 4 +- plugins/admin/fai/class_faiVariableEntry.inc | 3 +- .../admin/groups/class_groupApplication.inc | 4 +- plugins/admin/groups/class_groupGeneric.inc | 3 +- plugins/admin/groups/class_groupMail.inc | 4 +- plugins/admin/ogroups/class_mailogroup.inc | 3 +- plugins/admin/ogroups/class_ogroup.inc | 3 +- plugins/admin/ogroups/class_phonequeue.inc | 4 +- .../admin/systems/class_SelectDeviceType.inc | 3 +- .../admin/systems/class_componentGeneric.inc | 6 +- plugins/admin/systems/class_glpiAccount.inc | 3 +- .../systems/class_glpiAttachmentPool.inc | 4 +- .../systems/class_glpiDeviceManagement.inc | 3 +- .../systems/class_glpiPrinterAccount.inc | 3 +- .../systems/class_glpiPrinterCartridges.inc | 4 +- .../class_glpiPrinterCartridgesEdit.inc | 3 +- plugins/admin/systems/class_phoneGeneric.inc | 5 +- plugins/admin/systems/class_printGeneric.inc | 4 +- .../admin/systems/class_printerPPDDialog.inc | 6 +- .../class_selectUserToPrinterDialog.inc | 4 +- plugins/admin/systems/class_servDB.inc | 3 +- plugins/admin/systems/class_servDHCP.inc | 5 +- .../admin/systems/class_servDNSeditZone.inc | 4 +- .../systems/class_servDNSeditZoneEntries.inc | 3 +- plugins/admin/systems/class_servGeneric.inc | 4 +- plugins/admin/systems/class_servKolab.inc | 4 +- plugins/admin/systems/class_servNfs.inc | 3 +- .../admin/systems/class_servRepository.inc | 4 +- .../systems/class_servRepositorySetup.inc | 3 +- plugins/admin/systems/class_servService.inc | 3 +- plugins/admin/systems/class_termDNS.inc | 4 +- .../admin/systems/class_terminalGeneric.inc | 4 +- plugins/admin/systems/class_terminalInfo.inc | 1 - .../admin/systems/class_terminalService.inc | 3 +- plugins/admin/systems/class_winGeneric.inc | 4 +- .../systems/class_workstationGeneric.inc | 4 +- .../systems/class_workstationService.inc | 3 +- .../systems/class_workstationStartup.inc | 5 ++ .../blocklists/class_blocklistManagement.inc | 3 +- .../gofax/faxaccount/class_gofaxAccount.inc | 4 +- .../class_phoneConferenceGeneric.inc | 3 +- plugins/gofon/macro/class_gofonMacro.inc | 3 +- .../macro/class_gofonMacroParameters.inc | 3 +- .../gofon/phoneaccount/class_phoneAccount.inc | 4 +- .../connectivity/class_connectivity.inc | 2 +- .../connectivity/class_kolabAccount.inc | 3 +- .../connectivity/class_proxyAccount.inc | 3 +- .../connectivity/class_pureftpdAccount.inc | 3 +- .../environment/class_environment.inc | 3 +- .../environment/class_hotplugDialog.inc | 4 +- .../class_logonManagementDialog.inc | 21 +++--- .../environment/class_selectPrinterDialog.inc | 4 +- plugins/personal/generic/class_user.inc | 3 +- plugins/personal/mail/class_mailAccount.inc | 3 +- .../personal/nagios/class_nagiosAccount.inc | 4 +- plugins/personal/posix/class_posixAccount.inc | 4 +- plugins/personal/samba/class_sambaAccount.inc | 3 +- 78 files changed, 271 insertions(+), 93 deletions(-) diff --git a/FAQ b/FAQ index 04a56a192..690b07478 100644 --- a/FAQ +++ b/FAQ @@ -283,3 +283,16 @@ A: Yes, add to the main section of GOsa and the folders are created in unix style. + +Q: I'd like to do special checks for several plugin parameters. How can I modify + GOsa to take care of these checks? + +A: No need to modify anything. Just add a hook the the plugin you'd like to + check: + + check="/your/command/binary" + + This binary will get an ldif to STDIN for analysis and may write an error message + to STDOUT. Note, that the supplied ldif may NOT be the original target ldif due + to technical reasons. + diff --git a/include/class_plugin.inc b/include/class_plugin.inc index dc24a4b17..afaaf8100 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -371,6 +371,70 @@ class plugin function check() { $message= array(); + + /* Skip if we've no config object */ + if (!isset($this->config)){ + return $message; + } + + /* Find hooks entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "CHECK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "CHECK"); + } + + if ($command != ""){ + + if (!check_command($command)){ + $message[]= sprintf(_("Command '%s', specified as CHECK hook for plugin '%s' doesn't seem to exist."), $command, + get_class($this)); + } else { + + /* Generate "ldif" for check hook */ + $ldif= "dn: $this->dn\n"; + + /* ... objectClasses */ + foreach ($this->objectclasses as $oc){ + $ldif.= "objectClass: $oc\n"; + } + + /* ... attributes */ + foreach ($this->attributes as $attr){ + if ($this->$attr == ""){ + continue; + } + if (is_array($this->$attr)){ + foreach ($this->$attr as $val){ + $ldif.= "$attr: $val\n"; + } + } else { + $ldif.= "$attr: ".$this->$attr."\n"; + } + } + + /* Append empty line */ + $ldif.= "\n"; + + /* Feed "ldif" into hook and retrieve result*/ + $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w")); + $fh= proc_open($command, $descriptorspec, $pipes); + if (is_resource($fh)) { + fwrite ($pipes[0], $ldif); + fclose($pipes[0]); + + $result= stream_get_contents($pipes[1]); + if ($result != ""){ + $message[]= $result; + } + + fclose($pipes[1]); + fclose($pipes[2]); + proc_close($fh); + } + } + + } + return ($message); } diff --git a/plugins/addons/addressbook/class_addressbook.inc b/plugins/addons/addressbook/class_addressbook.inc index f116acfe7..63415e90e 100644 --- a/plugins/addons/addressbook/class_addressbook.inc +++ b/plugins/addons/addressbook/class_addressbook.inc @@ -538,7 +538,8 @@ class addressbook extends plugin function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* must: sn, givenName */ if ($this->sn == ""){ diff --git a/plugins/admin/applications/class_applicationGeneric.inc b/plugins/admin/applications/class_applicationGeneric.inc index 03a6ab413..2b5e5a645 100644 --- a/plugins/admin/applications/class_applicationGeneric.inc +++ b/plugins/admin/applications/class_applicationGeneric.inc @@ -300,7 +300,8 @@ class application extends plugin /* Check values */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if(!preg_match("#^/#",$this->gosaApplicationExecute)){ $message[]=(_("Specified execute path must start with '/'.")); diff --git a/plugins/admin/applications/class_applicationParameters.inc b/plugins/admin/applications/class_applicationParameters.inc index 3cbf0118f..12e055a77 100644 --- a/plugins/admin/applications/class_applicationParameters.inc +++ b/plugins/admin/applications/class_applicationParameters.inc @@ -150,7 +150,8 @@ $ldap->modify ($this->attrs); /* Check values */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* Check for valid option names */ for ($i= 0; $ioption_name); $i++){ diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index d062799a8..9d0c5d652 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -177,7 +177,8 @@ class department extends plugin /* Check values */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* Permissions for that base? */ // $this->dn= "ou=$this->ou,".$this->base; diff --git a/plugins/admin/fai/class_askClassName.inc b/plugins/admin/fai/class_askClassName.inc index 13b923a8b..df59a0f97 100644 --- a/plugins/admin/fai/class_askClassName.inc +++ b/plugins/admin/fai/class_askClassName.inc @@ -132,7 +132,9 @@ class askClassName extends plugin */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + if(empty($this->ClassName)){ $message[]=_("The given class name is empty."); } diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc index 7dd077eb1..09b270d83 100644 --- a/plugins/admin/fai/class_faiHook.inc +++ b/plugins/admin/fai/class_faiHook.inc @@ -351,7 +351,9 @@ class faiHook extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + return ($message); } diff --git a/plugins/admin/fai/class_faiHookEntry.inc b/plugins/admin/fai/class_faiHookEntry.inc index 8a7f0c990..14bc4959e 100644 --- a/plugins/admin/fai/class_faiHookEntry.inc +++ b/plugins/admin/fai/class_faiHookEntry.inc @@ -136,7 +136,9 @@ class faiHookEntry extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + if(empty($this->FAIscript)) { $message[]=_("Please enter a value for script."); } diff --git a/plugins/admin/fai/class_faiPackage.inc b/plugins/admin/fai/class_faiPackage.inc index 04f0a2b8a..8d7f326b6 100644 --- a/plugins/admin/fai/class_faiPackage.inc +++ b/plugins/admin/fai/class_faiPackage.inc @@ -334,7 +334,8 @@ class faiPackage extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if(count($this->usedPackages)==0){ $message[]=_("Please select a least one Package."); diff --git a/plugins/admin/fai/class_faiPackageConfiguration.inc b/plugins/admin/fai/class_faiPackageConfiguration.inc index 1717887d7..63c2f90d5 100644 --- a/plugins/admin/fai/class_faiPackageConfiguration.inc +++ b/plugins/admin/fai/class_faiPackageConfiguration.inc @@ -60,7 +60,9 @@ class faiPackageConfiguration extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + return ($message); } diff --git a/plugins/admin/fai/class_faiPackageEntry.inc b/plugins/admin/fai/class_faiPackageEntry.inc index 2d1d52e17..a8c78aeb3 100644 --- a/plugins/admin/fai/class_faiPackageEntry.inc +++ b/plugins/admin/fai/class_faiPackageEntry.inc @@ -181,7 +181,9 @@ $CHKS = "FAIclasses) == 0){ $message[]=_("Please assign at least one class to this profile."); diff --git a/plugins/admin/fai/class_faiProfileEntry.inc b/plugins/admin/fai/class_faiProfileEntry.inc index f44cd0adf..dcda988af 100644 --- a/plugins/admin/fai/class_faiProfileEntry.inc +++ b/plugins/admin/fai/class_faiProfileEntry.inc @@ -226,7 +226,9 @@ class faiProfileEntry extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + return ($message); } diff --git a/plugins/admin/fai/class_faiScript.inc b/plugins/admin/fai/class_faiScript.inc index c8bc4d802..6ba262020 100644 --- a/plugins/admin/fai/class_faiScript.inc +++ b/plugins/admin/fai/class_faiScript.inc @@ -326,7 +326,9 @@ class faiScript extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + return ($message); } diff --git a/plugins/admin/fai/class_faiScriptEntry.inc b/plugins/admin/fai/class_faiScriptEntry.inc index 91fa11ff7..35ba0b38b 100644 --- a/plugins/admin/fai/class_faiScriptEntry.inc +++ b/plugins/admin/fai/class_faiScriptEntry.inc @@ -126,7 +126,8 @@ class faiScriptEntry extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if(empty($this->cn)){ $message[] = _("Please enter a name."); diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc index 279050b46..8d7d51fb2 100644 --- a/plugins/admin/fai/class_faiTemplate.inc +++ b/plugins/admin/fai/class_faiTemplate.inc @@ -259,7 +259,9 @@ class faiTemplate extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + return ($message); } diff --git a/plugins/admin/fai/class_faiTemplateEntry.inc b/plugins/admin/fai/class_faiTemplateEntry.inc index 33092b851..34ee7a744 100644 --- a/plugins/admin/fai/class_faiTemplateEntry.inc +++ b/plugins/admin/fai/class_faiTemplateEntry.inc @@ -165,7 +165,9 @@ class faiTemplateEntry extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + if(empty($this->FAItemplateFile)){ $message[]=_("Please specify a value for attribute 'file'."); } diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc index baa760623..81a411dc7 100644 --- a/plugins/admin/fai/class_faiVariable.inc +++ b/plugins/admin/fai/class_faiVariable.inc @@ -265,7 +265,9 @@ class faiVariable extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + return ($message); } diff --git a/plugins/admin/fai/class_faiVariableEntry.inc b/plugins/admin/fai/class_faiVariableEntry.inc index 12c66fe13..46614d0cb 100644 --- a/plugins/admin/fai/class_faiVariableEntry.inc +++ b/plugins/admin/fai/class_faiVariableEntry.inc @@ -91,7 +91,8 @@ class faiVariableEntry extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if(empty($this->FAIvariableContent)) { $message[]=_("Please specify a value for the attribute 'content'."); diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc index 246945aff..4727a3ea3 100644 --- a/plugins/admin/groups/class_groupApplication.inc +++ b/plugins/admin/groups/class_groupApplication.inc @@ -784,7 +784,9 @@ $ldap->modify ($this->attrs); function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + return ($message); } diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc index 4e0cd4d09..b52fc2e1f 100644 --- a/plugins/admin/groups/class_groupGeneric.inc +++ b/plugins/admin/groups/class_groupGeneric.inc @@ -725,7 +725,8 @@ class group extends plugin function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* Permissions for that base? */ if ($this->base != ""){ diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc index f898fb4c3..e3430eaaf 100644 --- a/plugins/admin/groups/class_groupMail.inc +++ b/plugins/admin/groups/class_groupMail.inc @@ -794,7 +794,9 @@ I: Only insider delivery */ { $ldap= $this->config->get_ldap_link(); - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + if(!$this->is_account) return array(); //$message[] = $str; diff --git a/plugins/admin/ogroups/class_mailogroup.inc b/plugins/admin/ogroups/class_mailogroup.inc index cfed78cf4..f3eacafb0 100644 --- a/plugins/admin/ogroups/class_mailogroup.inc +++ b/plugins/admin/ogroups/class_mailogroup.inc @@ -60,7 +60,8 @@ class mailogroup extends plugin /* Check formular input */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if ($this->is_account){ $ldap= $this->config->get_ldap_link(); diff --git a/plugins/admin/ogroups/class_ogroup.inc b/plugins/admin/ogroups/class_ogroup.inc index b961cf339..0cf122946 100644 --- a/plugins/admin/ogroups/class_ogroup.inc +++ b/plugins/admin/ogroups/class_ogroup.inc @@ -629,7 +629,8 @@ class ogroup extends plugin function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* Permissions for that base? */ if ($this->base != ""){ diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc index 4917f27df..27c4e21a9 100644 --- a/plugins/admin/ogroups/class_phonequeue.inc +++ b/plugins/admin/ogroups/class_phonequeue.inc @@ -186,7 +186,9 @@ class phonequeue extends plugin /* Check formular input */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + if($this->is_number_used()){ $message[] = $this->is_number_used(); } diff --git a/plugins/admin/systems/class_SelectDeviceType.inc b/plugins/admin/systems/class_SelectDeviceType.inc index 66c2eed59..cbe2e66f7 100644 --- a/plugins/admin/systems/class_SelectDeviceType.inc +++ b/plugins/admin/systems/class_SelectDeviceType.inc @@ -69,7 +69,8 @@ class SelectDeviceType extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); return ($message); } diff --git a/plugins/admin/systems/class_componentGeneric.inc b/plugins/admin/systems/class_componentGeneric.inc index 23c242855..e06e3cc37 100644 --- a/plugins/admin/systems/class_componentGeneric.inc +++ b/plugins/admin/systems/class_componentGeneric.inc @@ -128,9 +128,9 @@ class componentGeneric extends plugin /* Check supplied data */ function check() { - $message= array(); - - $message = array_merge($message,$this->netConfigDNS->check()); + /* Call common method to give check the hook */ + $message= plugin::check(); + $message= array_merge($message,$this->netConfigDNS->check()); $this->dn= "cn=".$this->cn.",ou=netdevices,ou=systems,".$this->base; diff --git a/plugins/admin/systems/class_glpiAccount.inc b/plugins/admin/systems/class_glpiAccount.inc index 617b8f9b3..353bf8e3f 100644 --- a/plugins/admin/systems/class_glpiAccount.inc +++ b/plugins/admin/systems/class_glpiAccount.inc @@ -692,7 +692,8 @@ class glpiAccount extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); // if($this->TechnicalResponsible == ""){ // $message[] = _("Please select a technical responsible person for this entry."); diff --git a/plugins/admin/systems/class_glpiAttachmentPool.inc b/plugins/admin/systems/class_glpiAttachmentPool.inc index fb1d5618d..8b0300d6f 100644 --- a/plugins/admin/systems/class_glpiAttachmentPool.inc +++ b/plugins/admin/systems/class_glpiAttachmentPool.inc @@ -326,7 +326,9 @@ class glpiAttachmentPool extends plugin /* Simple check */ function check() { - $message = array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + if($this->edit){ /* check if given name is already in use */ diff --git a/plugins/admin/systems/class_glpiDeviceManagement.inc b/plugins/admin/systems/class_glpiDeviceManagement.inc index c99e382ba..9fe20a9f1 100644 --- a/plugins/admin/systems/class_glpiDeviceManagement.inc +++ b/plugins/admin/systems/class_glpiDeviceManagement.inc @@ -335,7 +335,8 @@ class glpiDeviceManagement extends plugin */ function check($attr) { - $message = array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if(isset($attr['designation'])){ $str2 = "designation"; diff --git a/plugins/admin/systems/class_glpiPrinterAccount.inc b/plugins/admin/systems/class_glpiPrinterAccount.inc index abaa32acb..4ee03e31a 100644 --- a/plugins/admin/systems/class_glpiPrinterAccount.inc +++ b/plugins/admin/systems/class_glpiPrinterAccount.inc @@ -675,7 +675,8 @@ class glpiPrinterAccount extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); // if($this->TechnicalResponsible == ""){ // $message[] = _("Please select a technical responsible person for this entry."); diff --git a/plugins/admin/systems/class_glpiPrinterCartridges.inc b/plugins/admin/systems/class_glpiPrinterCartridges.inc index 4f31fdfa5..708da0f4f 100644 --- a/plugins/admin/systems/class_glpiPrinterCartridges.inc +++ b/plugins/admin/systems/class_glpiPrinterCartridges.inc @@ -279,7 +279,9 @@ class glpiPrinterCartridges extends plugin */ function check($attr) { - $message = array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + return($message); } diff --git a/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc b/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc index ff8d42751..c43a3f112 100644 --- a/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc +++ b/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc @@ -295,7 +295,8 @@ class glpiPrinterCartridgesEdit extends plugin /* Check given values */ function check(){ - $message=array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* Avoid choosing an already used name */ $types = $this->parent->handle->getCartridgeTypeInformations(); diff --git a/plugins/admin/systems/class_phoneGeneric.inc b/plugins/admin/systems/class_phoneGeneric.inc index 2ac553d1b..65cb290a5 100644 --- a/plugins/admin/systems/class_phoneGeneric.inc +++ b/plugins/admin/systems/class_phoneGeneric.inc @@ -272,7 +272,10 @@ class phoneGeneric extends plugin /* Check supplied data */ function check() { - $message= $this->netConfigDNS->check(); + /* Call common method to give check the hook */ + $message= plugin::check(); + $message= array_merge($message, $this->netConfigDNS->check()); + $this->dn= "cn=".$this->cn.",ou=phones,ou=systems,".$this->base; /* To check for valid ip*/ diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index 568bc420f..df9f7f128 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -495,7 +495,9 @@ class printgeneric extends plugin /* Check supplied data */ function check() { - $message= $this->netConfigDNS->check(); + /* Call common method to give check the hook */ + $message= plugin::check(); + $message= array_merge($message, $this->netConfigDNS->check()); if(isset($this->parent->by_name['workgeneric'])){ if($this->parent->by_object['workgeneric']->cn == "wdefault"){ diff --git a/plugins/admin/systems/class_printerPPDDialog.inc b/plugins/admin/systems/class_printerPPDDialog.inc index befe1cc91..f8f9b35da 100644 --- a/plugins/admin/systems/class_printerPPDDialog.inc +++ b/plugins/admin/systems/class_printerPPDDialog.inc @@ -238,9 +238,9 @@ class printerPPDDialog extends plugin } function check(){ - /* Check the given data - */ - $message=array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + return $message; } diff --git a/plugins/admin/systems/class_selectUserToPrinterDialog.inc b/plugins/admin/systems/class_selectUserToPrinterDialog.inc index 923f9454f..143695676 100644 --- a/plugins/admin/systems/class_selectUserToPrinterDialog.inc +++ b/plugins/admin/systems/class_selectUserToPrinterDialog.inc @@ -94,7 +94,9 @@ class selectUserToPrinterDialog extends plugin } function check(){ - $message=array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + if(empty($_POST['gotoPrinter'])){ $message[] = _("Please select a printer or press cancel."); } diff --git a/plugins/admin/systems/class_servDB.inc b/plugins/admin/systems/class_servDB.inc index 65e0f9df5..6ceef64e6 100644 --- a/plugins/admin/systems/class_servDB.inc +++ b/plugins/admin/systems/class_servDB.inc @@ -127,7 +127,8 @@ class servdb extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if(in_array("goGlpiServer",$this->objectclasses)){ foreach(array("goGlpiAdmin","goGlpiDatabase") as $attr){ diff --git a/plugins/admin/systems/class_servDHCP.inc b/plugins/admin/systems/class_servDHCP.inc index 9f4a6e867..8d468f948 100644 --- a/plugins/admin/systems/class_servDHCP.inc +++ b/plugins/admin/systems/class_servDHCP.inc @@ -61,8 +61,9 @@ class servdhcp extends plugin /* Check supplied data */ function check() { - $message= array(); - + /* Call common method to give check the hook */ + $message= plugin::check(); + return ($message); } diff --git a/plugins/admin/systems/class_servDNSeditZone.inc b/plugins/admin/systems/class_servDNSeditZone.inc index 13ed5678e..19662d38b 100644 --- a/plugins/admin/systems/class_servDNSeditZone.inc +++ b/plugins/admin/systems/class_servDNSeditZone.inc @@ -341,7 +341,9 @@ class servdnseditZone extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + /* Check if zoneName is already in use */ $usedZones = $this->getUsedZoneNames(); if(($this->isNew == true)||($this->zoneName != $this->InitialzoneName)||($this->ReverseZone != $this->InitialReverseZone)){ diff --git a/plugins/admin/systems/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/class_servDNSeditZoneEntries.inc index 7a2e57a45..bf510a9bb 100644 --- a/plugins/admin/systems/class_servDNSeditZoneEntries.inc +++ b/plugins/admin/systems/class_servDNSeditZoneEntries.inc @@ -185,7 +185,8 @@ class servDNSeditZoneEntries extends plugin */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); $ldap = $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc index 62a31192a..bd66de5c9 100644 --- a/plugins/admin/systems/class_servGeneric.inc +++ b/plugins/admin/systems/class_servGeneric.inc @@ -183,7 +183,9 @@ class servgeneric extends plugin /* Check supplied data */ function check() { - $message= $this->netConfigDNS->check(); + /* Call common method to give check the hook */ + $message= plugin::check(); + $message= array_merge($message, $this->netConfigDNS->check()); $this->dn= "cn=".$this->cn.",ou=servers,ou=systems,".$this->base; /* must: cn */ diff --git a/plugins/admin/systems/class_servKolab.inc b/plugins/admin/systems/class_servKolab.inc index d2e5eb0b6..ba733edf5 100644 --- a/plugins/admin/systems/class_servKolab.inc +++ b/plugins/admin/systems/class_servKolab.inc @@ -222,7 +222,9 @@ $ldap->modify ($attrs); function check() { - $message = array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + if(($this->kolabFreeBusyFuture=="")) { $message[] = _("Future days in Free/Busy settings must be set."); }elseif(!is_uid($this->kolabFreeBusyFuture) || $this->kolabFreeBusyFuture < 0){ diff --git a/plugins/admin/systems/class_servNfs.inc b/plugins/admin/systems/class_servNfs.inc index 8b724f4cf..0b96923ca 100644 --- a/plugins/admin/systems/class_servNfs.inc +++ b/plugins/admin/systems/class_servNfs.inc @@ -118,7 +118,8 @@ class servnfs extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); // fixme : a check for the path ? ? if(empty($this->path)){ diff --git a/plugins/admin/systems/class_servRepository.inc b/plugins/admin/systems/class_servRepository.inc index eaa059376..ddb27e1ab 100644 --- a/plugins/admin/systems/class_servRepository.inc +++ b/plugins/admin/systems/class_servRepository.inc @@ -310,7 +310,9 @@ $ldap->modify ($this->attrs); /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + return ($message); } diff --git a/plugins/admin/systems/class_servRepositorySetup.inc b/plugins/admin/systems/class_servRepositorySetup.inc index bb64d2f8d..b4a9d686f 100644 --- a/plugins/admin/systems/class_servRepositorySetup.inc +++ b/plugins/admin/systems/class_servRepositorySetup.inc @@ -111,7 +111,8 @@ class servRepositorySetup extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if(empty($this->Release)){ $message[]=_("Please enter a value for 'release'."); diff --git a/plugins/admin/systems/class_servService.inc b/plugins/admin/systems/class_servService.inc index e55f2beed..5c86fc578 100644 --- a/plugins/admin/systems/class_servService.inc +++ b/plugins/admin/systems/class_servService.inc @@ -266,7 +266,8 @@ class servservice extends plugin /* Check supplied data */ function check() { - $message= array(); + /* 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."); diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc index 653f9900c..299335cb8 100644 --- a/plugins/admin/systems/class_termDNS.inc +++ b/plugins/admin/systems/class_termDNS.inc @@ -246,8 +246,8 @@ class termDNS extends plugin /* Check supplied data */ function check() { - $message= array(); - + /* Call common method to give check the hook */ + $message= plugin::check(); /* Check if ip must be given */ diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index 8b252d8f0..f991dae27 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -257,7 +257,9 @@ class termgeneric extends plugin /* Check supplied data */ function check() { - $message= $this->netConfigDNS->check(); + /* Call common method to give check the hook */ + $message= plugin::check(); + $message= array_merge($message, $this->netConfigDNS->check()); /* Permissions for that base? */ $this->dn= "cn=".$this->cn."ou=terminals,ou=systems,".$this->base; diff --git a/plugins/admin/systems/class_terminalInfo.inc b/plugins/admin/systems/class_terminalInfo.inc index 0c3060534..58fb0b356 100644 --- a/plugins/admin/systems/class_terminalInfo.inc +++ b/plugins/admin/systems/class_terminalInfo.inc @@ -234,7 +234,6 @@ class terminfo extends plugin } - /* Save to LDAP */ function save() { diff --git a/plugins/admin/systems/class_terminalService.inc b/plugins/admin/systems/class_terminalService.inc index e4eb153d7..fe580b76e 100644 --- a/plugins/admin/systems/class_terminalService.inc +++ b/plugins/admin/systems/class_terminalService.inc @@ -257,7 +257,8 @@ class termservice extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* Default entries can use blank hsync/vsync entries */ if ($this->dn != "" && $this->cn != "default" && $this->cn != "wdefault"){ diff --git a/plugins/admin/systems/class_winGeneric.inc b/plugins/admin/systems/class_winGeneric.inc index 5f250619c..196a8bb7a 100644 --- a/plugins/admin/systems/class_winGeneric.inc +++ b/plugins/admin/systems/class_winGeneric.inc @@ -152,7 +152,9 @@ class wingeneric extends plugin /* Check supplied data */ function check() { - $message=$this->netConfigDNS->check(); + /* Call common method to give check the hook */ + $message= plugin::check(); + $message= array_merge($message, $this->netConfigDNS->check()); $this->dn= "cn=".$this->cn.",ou=netdevices,ou=systems,".$this->base; $ui= get_userinfo(); diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc index d55db1094..6bdcbc96e 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -218,7 +218,9 @@ class workgeneric extends plugin /* Check supplied data */ function check() { - $message=$this->netConfigDNS->check(); + /* Call common method to give check the hook */ + $message= plugin::check(); + $message= array_merge($message, $this->netConfigDNS->check()); $ui= get_userinfo(); $this->dn= "cn=".$this->cn.",ou=workstations,ou=systems,".$this->base; diff --git a/plugins/admin/systems/class_workstationService.inc b/plugins/admin/systems/class_workstationService.inc index 2359b8566..ffbb2cbce 100644 --- a/plugins/admin/systems/class_workstationService.inc +++ b/plugins/admin/systems/class_workstationService.inc @@ -250,7 +250,8 @@ class workservice extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* Default entries can use blank hsync/vsync entries */ if ($this->dn != "" && $this->cn != "default" && $this->cn != "wdefault"){ diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc index a3f3366b2..c43f70d47 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -346,10 +346,15 @@ class workstartup extends plugin function check() { $messages = array(); + + /* Call common method to give check the hook */ + $messages= plugin::check(); + /* If there are packages selected, but no mirror show error */ if(($this->FAIdebianMirror == "none")&&(count($this->FAIclass)>0)){ $messages[]=_("Please select a 'FAI server' or remove the 'FAI classes'."); } + return($messages); } diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc index 0e470ae16..0730ce6cd 100644 --- a/plugins/gofax/blocklists/class_blocklistManagement.inc +++ b/plugins/gofax/blocklists/class_blocklistManagement.inc @@ -530,7 +530,8 @@ class blocklist extends plugin /* Check values */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* Permissions for that base? */ if ($this->base != ""){ diff --git a/plugins/gofax/faxaccount/class_gofaxAccount.inc b/plugins/gofax/faxaccount/class_gofaxAccount.inc index e82755001..feec09343 100644 --- a/plugins/gofax/faxaccount/class_gofaxAccount.inc +++ b/plugins/gofax/faxaccount/class_gofaxAccount.inc @@ -631,8 +631,8 @@ $ldap->modify ($this->attrs); /* Check formular input */ function check() { - /* Reset message array */ - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* must: facsimileTelephoneNumber */ if ($this->facsimileTelephoneNumber == ""){ diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc index 1f5cd480f..4713d4570 100644 --- a/plugins/gofon/conference/class_phoneConferenceGeneric.inc +++ b/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -180,7 +180,8 @@ class conference extends plugin /* Check values */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if($this->is_number_used()){ $message[] = $this->is_number_used(); diff --git a/plugins/gofon/macro/class_gofonMacro.inc b/plugins/gofon/macro/class_gofonMacro.inc index d358ef900..c549a62c1 100755 --- a/plugins/gofon/macro/class_gofonMacro.inc +++ b/plugins/gofon/macro/class_gofonMacro.inc @@ -344,8 +344,9 @@ class macro extends plugin */ function check() { + /* Call common method to give check the hook */ + $message= plugin::check(); - $message = array(); if(!$this->generate_mysql_entension_entries()){ $message[] = $this->generate_error; } diff --git a/plugins/gofon/macro/class_gofonMacroParameters.inc b/plugins/gofon/macro/class_gofonMacroParameters.inc index 451462083..f5a762f94 100755 --- a/plugins/gofon/macro/class_gofonMacroParameters.inc +++ b/plugins/gofon/macro/class_gofonMacroParameters.inc @@ -320,7 +320,8 @@ class macroParameter extends plugin */ function check() { - $message = array(); + /* Call common method to give check the hook */ + $message= plugin::check(); foreach($this->attributes as $attr){ if(chkacl($this->acl,"edit")){ diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index 6d2c229e2..fb709d0d9 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -881,8 +881,8 @@ class phoneAccount extends plugin function check() { - /* Reset message array */ - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if((strlen($this->goFonVoicemailPIN)==0)||(strlen($this->goFonVoicemailPIN)>4)){ $message[]=(_("Voicemail PIN must be between 1-4 characters.")); diff --git a/plugins/personal/connectivity/class_connectivity.inc b/plugins/personal/connectivity/class_connectivity.inc index 4b81da675..12be3de59 100644 --- a/plugins/personal/connectivity/class_connectivity.inc +++ b/plugins/personal/connectivity/class_connectivity.inc @@ -105,7 +105,7 @@ class connectivity extends plugin function check() { - $message= array(); + $message= plugin::check(); foreach ($this->plugin_name as $name){ $tmp= $this->plugin[$name]->check(); diff --git a/plugins/personal/connectivity/class_kolabAccount.inc b/plugins/personal/connectivity/class_kolabAccount.inc index 2b5ae71c8..114444cf9 100644 --- a/plugins/personal/connectivity/class_kolabAccount.inc +++ b/plugins/personal/connectivity/class_kolabAccount.inc @@ -225,7 +225,8 @@ class kolabAccount extends plugin function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* FBFuture is in days... */ if ($this->kolabFreeBusyFuture != "" && !preg_match('/^[0-9]+$/', $this->kolabFreeBusyFuture)){ diff --git a/plugins/personal/connectivity/class_proxyAccount.inc b/plugins/personal/connectivity/class_proxyAccount.inc index 1c2596582..d439a601e 100644 --- a/plugins/personal/connectivity/class_proxyAccount.inc +++ b/plugins/personal/connectivity/class_proxyAccount.inc @@ -162,7 +162,8 @@ $ldap->modify ($this->attrs); /* Check values */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* We've got only one value to check for positive integer or emtpy field */ if ($this->is_account){ diff --git a/plugins/personal/connectivity/class_pureftpdAccount.inc b/plugins/personal/connectivity/class_pureftpdAccount.inc index 733428ac7..41dc63e68 100644 --- a/plugins/personal/connectivity/class_pureftpdAccount.inc +++ b/plugins/personal/connectivity/class_pureftpdAccount.inc @@ -129,7 +129,8 @@ $ldap->modify ($this->attrs); /* Check values */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* Check for positive integer values */ if ($this->is_account){ diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc index d34c14f02..6e1121ae8 100644 --- a/plugins/personal/environment/class_environment.inc +++ b/plugins/personal/environment/class_environment.inc @@ -752,7 +752,8 @@ class environment extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if(preg_match("/[^0-9]/",$this->gotoProfileQuota)) { $message[]=_("Please set a valid profile quota size."); diff --git a/plugins/personal/environment/class_hotplugDialog.inc b/plugins/personal/environment/class_hotplugDialog.inc index 08e3f3386..eb013741f 100644 --- a/plugins/personal/environment/class_hotplugDialog.inc +++ b/plugins/personal/environment/class_hotplugDialog.inc @@ -105,7 +105,9 @@ class hotplugDialog extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + if(!$this->use_existing){ if((empty($this->HOT_name))||(preg_match("/[^a-z0-9 ]/i",$this->HOT_name))){ $message[]=_("Please specify a valid name. Only 0-9 a-Z is allowed."); diff --git a/plugins/personal/environment/class_logonManagementDialog.inc b/plugins/personal/environment/class_logonManagementDialog.inc index c5ac543c8..a8a2821b0 100644 --- a/plugins/personal/environment/class_logonManagementDialog.inc +++ b/plugins/personal/environment/class_logonManagementDialog.inc @@ -90,17 +90,18 @@ class logonManagementDialog extends plugin function check() { - $message = array(); + /* Call common method to give check the hook */ + $message= plugin::check(); - if(preg_match("/[^a-z]/",$this->LogonName)){ - $message[] = _("Specified name is invalid."); - } - - if(preg_match("/[^a-z0-9,\.-;:_\(\)!\? ]/i",$this->LogonDescription)){ - $message[] = _("Specified description contains invalid characters."); - } - - return $message; + if(preg_match("/[^a-z]/",$this->LogonName)){ + $message[] = _("Specified name is invalid."); + } + + if(preg_match("/[^a-z0-9,\.-;:_\(\)!\? ]/i",$this->LogonDescription)){ + $message[] = _("Specified description contains invalid characters."); + } + + return $message; } diff --git a/plugins/personal/environment/class_selectPrinterDialog.inc b/plugins/personal/environment/class_selectPrinterDialog.inc index 9f880aa06..efeca4e99 100644 --- a/plugins/personal/environment/class_selectPrinterDialog.inc +++ b/plugins/personal/environment/class_selectPrinterDialog.inc @@ -62,7 +62,9 @@ class selectPrinterDialog extends plugin } function check(){ - $message=array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + if(empty($_POST['gotoPrinter'])){ $message[] = _("Please select a printer or press cancel."); } diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index ab24dffcd..0d7a91873 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -928,7 +928,8 @@ class user extends plugin /* Check formular input */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* Assemble cn */ $this->cn= $this->givenName." ".$this->sn; diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index 2da4db13c..0d51a29dd 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -712,7 +712,8 @@ $ldap->modify ($this->attrs); if(!$this->is_account) return(array()); $ldap= $this->config->get_ldap_link(); - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if(empty($this->gosaMailServer)){ $message[]= _("There is no valid mailserver specified, please add one in the system setup."); diff --git a/plugins/personal/nagios/class_nagiosAccount.inc b/plugins/personal/nagios/class_nagiosAccount.inc index ba64598dc..1afde98f7 100644 --- a/plugins/personal/nagios/class_nagiosAccount.inc +++ b/plugins/personal/nagios/class_nagiosAccount.inc @@ -158,7 +158,9 @@ $ldap->modify ($this->attrs); function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + $ldap= $this->config->get_ldap_link(); /* must: mail */ if ($this->NagiosAlias == ""){ diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index dec7b5e05..864ec87b5 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -901,8 +901,8 @@ $ldap->modify ($this->attrs); /* Include global link_info */ $ldap= $this->config->get_ldap_link(); - /* Reset message array */ - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* must: homeDirectory */ if ($this->homeDirectory == ""){ diff --git a/plugins/personal/samba/class_sambaAccount.inc b/plugins/personal/samba/class_sambaAccount.inc index 239090344..177e6836b 100644 --- a/plugins/personal/samba/class_sambaAccount.inc +++ b/plugins/personal/samba/class_sambaAccount.inc @@ -634,7 +634,8 @@ $ldap->modify ($this->attrs); /* Check for input problems */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if ($this->samba3){ -- 2.30.2