From: hickert Date: Thu, 8 Jun 2006 08:45:24 +0000 (+0000) Subject: Added action hook X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=86dc47191dcc613135e397ff06ac19750248db7b;p=gosa.git Added action hook git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3707 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_goCupsServer.inc b/plugins/admin/systems/class_goCupsServer.inc index 6e95c7bed..924519abf 100644 --- a/plugins/admin/systems/class_goCupsServer.inc +++ b/plugins/admin/systems/class_goCupsServer.inc @@ -105,6 +105,7 @@ class goCupsServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } @@ -120,6 +121,40 @@ class goCupsServer extends plugin{ { plugin::save_object(); } + + + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/class_goFaxServer.inc b/plugins/admin/systems/class_goFaxServer.inc index 71db436e1..d83331606 100644 --- a/plugins/admin/systems/class_goFaxServer.inc +++ b/plugins/admin/systems/class_goFaxServer.inc @@ -107,6 +107,7 @@ class goFaxServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } @@ -129,7 +130,39 @@ class goFaxServer extends plugin{ if(isset($_POST['goFaxServerPosted'])){ plugin::save_object(); } - } + } + + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/class_goFonServer.inc b/plugins/admin/systems/class_goFonServer.inc index c117972d5..e42080179 100644 --- a/plugins/admin/systems/class_goFonServer.inc +++ b/plugins/admin/systems/class_goFonServer.inc @@ -110,6 +110,7 @@ class goFonServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } @@ -138,7 +139,40 @@ class goFonServer extends plugin{ if(isset($_POST['goFonServerPosted'])){ plugin::save_object(); } - } + } + + + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/class_goGlpiServer.inc b/plugins/admin/systems/class_goGlpiServer.inc index 83970daad..7491ea640 100644 --- a/plugins/admin/systems/class_goGlpiServer.inc +++ b/plugins/admin/systems/class_goGlpiServer.inc @@ -109,6 +109,7 @@ class goGlpiServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } @@ -131,7 +132,39 @@ class goGlpiServer extends plugin{ if(isset($_POST['goLogDBServerPosted'])){ plugin::save_object(); } - } + } + + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/class_goImapServer.inc b/plugins/admin/systems/class_goImapServer.inc index 56d658bab..8ad0d12da 100644 --- a/plugins/admin/systems/class_goImapServer.inc +++ b/plugins/admin/systems/class_goImapServer.inc @@ -142,6 +142,7 @@ class goImapServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } @@ -189,6 +190,38 @@ class goImapServer extends plugin{ } } } + + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/class_goKrbServer.inc b/plugins/admin/systems/class_goKrbServer.inc index f2637b541..e5beef125 100644 --- a/plugins/admin/systems/class_goKrbServer.inc +++ b/plugins/admin/systems/class_goKrbServer.inc @@ -108,6 +108,7 @@ class goKrbServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } @@ -135,7 +136,39 @@ class goKrbServer extends plugin{ if(isset($_POST['goKrbServerPosted'])){ plugin::save_object(); } - } + } + + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/class_goLdapServer.inc b/plugins/admin/systems/class_goLdapServer.inc index d18c6a224..ce2e2c77b 100644 --- a/plugins/admin/systems/class_goLdapServer.inc +++ b/plugins/admin/systems/class_goLdapServer.inc @@ -1,7 +1,7 @@ "Eins ist toll", "zwei" => "Zwei ist noch besser"); @@ -10,7 +10,7 @@ class goLdapServer extends plugin{ var $objectclasses = array("goLdapServer"); var $attributes = array("goLdapServerStatus","goLdapBase"); var $StatusFlag = "goLdapServerStatus"; - + /* This class can't be assigned twice so it conflicts with itsself */ var $conflicts = array("goLdapServer"); @@ -20,7 +20,7 @@ class goLdapServer extends plugin{ var $goLdapServerStatus = ""; var $goLdapBase = ""; - + function goLdapServer($config,$dn) { plugin::plugin($config,$dn); @@ -106,10 +106,11 @@ class goLdapServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } - + function check() { $message = plugin::check(); @@ -118,14 +119,46 @@ class goLdapServer extends plugin{ } return($message); } - + function save_object() { if(isset($_POST['goLdapServerPosted'])){ plugin::save_object(); } - } + } + + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/class_goLogDBServer.inc b/plugins/admin/systems/class_goLogDBServer.inc index 0abf2163b..6c0ab3a56 100644 --- a/plugins/admin/systems/class_goLogDBServer.inc +++ b/plugins/admin/systems/class_goLogDBServer.inc @@ -10,7 +10,7 @@ class goLogDBServer extends plugin{ var $objectclasses = array("goLogDBServer"); var $attributes = array("goLogDBServerStatus","goLogAdmin", "goLogPassword"); var $StatusFlag = "goLogDBServerStatus"; - + /* This class can't be assigned twice so it conflicts with itsself */ var $conflicts = array("goLogDBServer"); @@ -21,8 +21,8 @@ class goLogDBServer extends plugin{ var $goLogDBServerStatus = ""; var $goLogAdmin = ""; var $goLogPassword = ""; - - + + function goLogDBServer($config,$dn) { plugin::plugin($config,$dn); @@ -108,6 +108,7 @@ class goLogDBServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } @@ -123,14 +124,46 @@ class goLogDBServer extends plugin{ } return($message); } - + function save_object() { if(isset($_POST['goLogDBServerPosted'])){ plugin::save_object(); } - } + } + + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/class_goMailServer.inc b/plugins/admin/systems/class_goMailServer.inc index 7e8d8cf8a..bb0a9347a 100644 --- a/plugins/admin/systems/class_goMailServer.inc +++ b/plugins/admin/systems/class_goMailServer.inc @@ -553,7 +553,7 @@ class goMailServer extends plugin{ foreach($this->postfixMyNetworks as $entry){ $this->attrs['postfixMyNetworks'] .=$entry.","; } - $this->postfixMyNetworks = preg_replace("/,$/","",$this->attrs['postfixMyNetworks']); + $this->attrs['postfixMyNetworks'] = preg_replace("/,$/","",$this->attrs['postfixMyNetworks']); }else{ $this->attrs['postfixMyNetworks'] = array(); } @@ -592,6 +592,7 @@ class goMailServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } @@ -683,6 +684,37 @@ class goMailServer extends plugin{ return($ret); } + + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } function save_object() { diff --git a/plugins/admin/systems/class_goNtpServer.inc b/plugins/admin/systems/class_goNtpServer.inc index b7577f202..3f423dea7 100644 --- a/plugins/admin/systems/class_goNtpServer.inc +++ b/plugins/admin/systems/class_goNtpServer.inc @@ -1,7 +1,7 @@ "Eins ist toll", "zwei" => "Zwei ist noch besser"); @@ -10,7 +10,7 @@ class goNtpServer extends plugin{ var $objectclasses = array("goNtpServer"); var $attributes = array("goTimeSource","goNtpServerStatus"); var $StatusFlag = "goNtpServerStatus"; - + /* This class can't be assigned twice so it conflicts with itsself */ var $conflicts = array("goNtpServer"); @@ -19,13 +19,13 @@ class goNtpServer extends plugin{ var $goTimeSource = array(); var $goNtpServerStatus= ""; var $acl; - - + + function goNtpServer($config,$dn) { plugin::plugin($config,$dn); $this->DisplayName = _("Time service"); - + /* Load arrays */ $tmp = array(); if (isset($this->attrs['goTimeSource'])){ @@ -41,7 +41,7 @@ class goNtpServer extends plugin{ { $smarty = get_smarty(); - /* Here we add a new entry */ + /* Here we add a new entry */ if(isset($_POST['NewNTPAdd']) && $_POST['NewNTPExport'] != "") { $this->goTimeSource[$_POST['NewNTPExport']]= $_POST['NewNTPExport']; asort($this->goTimeSource); @@ -133,13 +133,44 @@ class goNtpServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } function check(){ return array();} - -function save_object(){;} + + function save_object(){;} } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/class_goShareServer.inc b/plugins/admin/systems/class_goShareServer.inc index 3a00600e6..ac6c5408b 100644 --- a/plugins/admin/systems/class_goShareServer.inc +++ b/plugins/admin/systems/class_goShareServer.inc @@ -223,6 +223,7 @@ class goShareServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } @@ -300,6 +301,37 @@ class goShareServer extends plugin{ } } + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/plugins/admin/systems/class_goSyslogServer.inc b/plugins/admin/systems/class_goSyslogServer.inc index f1cb8203c..8011baff6 100644 --- a/plugins/admin/systems/class_goSyslogServer.inc +++ b/plugins/admin/systems/class_goSyslogServer.inc @@ -105,6 +105,7 @@ class goSyslogServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } @@ -114,12 +115,45 @@ class goSyslogServer extends plugin{ $message = plugin::check(); return($message); } - + function save_object() { plugin::save_object(); - } + } + + + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/systems/class_goTerminalServer.inc b/plugins/admin/systems/class_goTerminalServer.inc index 7fe970968..3ddc52c8e 100644 --- a/plugins/admin/systems/class_goTerminalServer.inc +++ b/plugins/admin/systems/class_goTerminalServer.inc @@ -21,8 +21,8 @@ class goTerminalServer extends plugin{ var $goTerminalServerStatus = ""; var $goXdmcpIsEnabled = false; var $goFontPath = ""; - - + + function goTerminalServer($config,$dn) { plugin::plugin($config,$dn); @@ -79,7 +79,7 @@ class goTerminalServer extends plugin{ if(!$this->goXdmcpIsEnabled){ $this->attrs['goXdmcpIsEnabled'] = "0"; } - + /* Check if this is a new entry ... add/modify */ $ldap = $this->config->get_ldap_link(); $ldap->cat($this->dn,array("objectClass")); @@ -113,6 +113,7 @@ class goTerminalServer extends plugin{ $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); + $this->action_hook(); } } @@ -126,7 +127,7 @@ class goTerminalServer extends plugin{ return($message); } - + function save_object() { @@ -138,7 +139,39 @@ class goTerminalServer extends plugin{ $this->goXdmcpIsEnabled = false; } } - } + } + + function action_hook($add_attrs= array()) + { + /* Find postcreate entries for this class */ + $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK"); + if ($command == "" && isset($this->config->data['TABS'])){ + $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK"); + } + if ($command != ""){ + /* Walk through attribute list */ + foreach ($this->attributes as $attr){ + if (!is_array($this->$attr)){ + $command= preg_replace("/%$attr/", $this->$attr, $command); + } + } + $command= preg_replace("/%dn/", $this->dn, $command); + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, + $command, "Execute"); + + exec($command); + } else { + $message= sprintf(_("Command '%s', specified as ACTION_HOOK for plugin '%s' doesn't seem to exist."), $command, get_class($this)); + print_red ($message); + } + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>