From 963da8fc7055c7533a3cf123c57640fab177a330 Mon Sep 17 00:00:00 2001 From: opensides Date: Tue, 16 Oct 2007 10:37:18 +0000 Subject: [PATCH] Cleaning up code git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5-plugins@7571 594d385d-05f5-0310-b6e9-bd551577e9d8 --- vhost-apache2/class_apacheEditVhost.inc | 21 ++++++--------- vhost-apache2/class_apacheVhost.inc | 36 ++++++++++++------------- vhost-apache2/functions_apache.inc | 12 ++++----- 3 files changed, 32 insertions(+), 37 deletions(-) diff --git a/vhost-apache2/class_apacheEditVhost.inc b/vhost-apache2/class_apacheEditVhost.inc index 37422c518..3eb455307 100644 --- a/vhost-apache2/class_apacheEditVhost.inc +++ b/vhost-apache2/class_apacheEditVhost.inc @@ -1,6 +1,6 @@ assign("AllowVhostEdit" , true); if(isset($_POST['EditVhostEntries'])){ - $this->dialog= new servAPACHE2editVhostEntries($this->config,$this->dn,$this->VhostObject); + $this->dialog= new apacheVhostEditEntries($this->config,$this->dn,$this->VhostObject); } } @@ -305,8 +305,6 @@ class servapacheeditVhost extends plugin $smarty->assign("apacheServerAlias", $div->DrawList()); - - $div = new DivSelectBox("apacheScriptAlias"); $div->setHeight(120); $recs = $this->apacheScriptAlias; @@ -326,12 +324,9 @@ class servapacheeditVhost extends plugin )); } - $smarty->assign("NotNew", false); - $smarty->assign("apacheScriptAlias", $div->DrawList()); - - + $smarty->assign("apacheScriptAlias", $div->DrawList()); /* Display template */ $display.= $smarty->fetch(get_template_path('apache_editVhost.tpl', TRUE)); @@ -362,7 +357,7 @@ class servapacheeditVhost extends plugin $message= plugin::check(); /* Check if apacheServerName is already in use */ - $usedVhosts = $this->getUsedapacheServerNames(); + $usedVhosts = $this->getUsedServerNames(); if(($this->isNew == true)||($this->apacheServerName != $this->InitialApacheServerName)){ /* if((isset($usedVhosts[$this->apacheServerName]))&&($this->apacheServerName != $this->InitialApacheServerName)){ $message[] =_("This apacheServerName is already in use"); @@ -414,7 +409,7 @@ class servapacheeditVhost extends plugin } /* This funtion returns all used apacheServerNames */ - function getUsedapacheServerNames() + function getUsedServerNames() { $ret = array(); $ldap = $this->config->get_ldap_link(); diff --git a/vhost-apache2/class_apacheVhost.inc b/vhost-apache2/class_apacheVhost.inc index 9c9ca50f0..90bf51bbe 100644 --- a/vhost-apache2/class_apacheVhost.inc +++ b/vhost-apache2/class_apacheVhost.inc @@ -16,7 +16,7 @@ class servapache extends plugin var $APACHE2initially_was_account; - function servapache2 ($config, $dn= NULL, $parent= NULL) + function servapache ($config, $dn= NULL, $parent= NULL) { plugin::plugin ($config, $dn, $parent); @@ -24,7 +24,7 @@ class servapache extends plugin /* Get all vhost Informations */ - $this->Vhosts = getAPACHE2VhostEntries($config,$dn); + $this->Vhosts = getVhostEntries($config,$dn); /* If there is at least one entry in this -> types, we have APACHE2 enabled */ @@ -63,11 +63,11 @@ class servapache extends plugin } if ($this->is_account){ - $display= $this->show_header(_("Remove APACHE2 service"), - _("This server has APACHE2 features enabled. You can disable them by clicking below.")); + $display= $this->show_header(_("Remove Apache service"), + _("This server has Apache features enabled. You can disable them by clicking below.")); } else { - $display= $this->show_header(_("Add APACHE2 service"), - _("This server has APACHE2 features disabled. You can enable them by clicking below.")); + $display= $this->show_header(_("Add Apache service"), + _("This server has Apache features disabled. You can enable them by clicking below.")); return ($display); } @@ -103,7 +103,7 @@ class servapache extends plugin /* Add empty new vhost */ if(isset($_POST['AddVhost']) && chkacl($this->acl,"servapache2") == ""){ - $this->dialog = new servapache2editVhost($this->config,$this->dn); + $this->dialog = new apacheEditVhost($this->config,$this->dn); } /* Check for edit vhost request @@ -117,7 +117,7 @@ class servapache extends plugin $once =true; $tmp = preg_replace("/^editVhost_/","",$name); $tmp = base64_decode(preg_replace("/_.*$/","",$tmp)); - $this->dialog= new servapache2editVhost($this->config,$this->dn,$this->Vhosts[$tmp]); + $this->dialog= new apacheEditVhost($this->config,$this->dn,$this->Vhosts[$tmp]); } /* check posts for delete vhost @@ -172,7 +172,7 @@ class servapache extends plugin */ function RemoveVhost($id) { - $vhosts = $this->getUsedapacheServerNames(); + $vhosts = $this->getUsedServerNames(); $vhostname = ""; if(isset($this->Vhosts[$id]['InitialApacheServerName'])){ @@ -216,9 +216,9 @@ class servapache extends plugin } - /* This funtion returns all used Vhostnames + /* This function returns all used Vhostnames */ - function getUsedapacheServerNames() + function getUsedServerNames() { $ret = array(); $ldap = $this->config->get_ldap_link(); @@ -232,7 +232,7 @@ class servapache extends plugin - /* Remove apache2 service + /* Remove apache service */ function remove_from_parent() { @@ -265,7 +265,7 @@ class servapache extends plugin $old_dn = $this->dn; } - $tmp = getAPACHE2VhostEntriesDiff($this->config,$this->Vhosts,$old_dn); + $tmp = getVhostEntriesDiff($this->config,$this->Vhosts,$old_dn); /* Updated vhost entries if reverser or forward name has changed * Must be done before moving entries, else the given dn is invalid @@ -274,16 +274,16 @@ class servapache extends plugin foreach($tmp['vhostUpdates'] as $dn => $attrs){ $ldap->cd($dn); $ldap->modify($attrs); - show_ldap_error("Vhost:".$ldap->get_error(), _("Updating APACHE2 service failed")); + show_ldap_error("Vhost:".$ldap->get_error(), _("Updating Apache service failed")); } } - /* Delete apache2 + /* Delete apache vhost */ foreach($tmp['del'] as $dn => $del){ $ldap->cd($dn); $ldap->rmdir_recursive($dn); - show_ldap_error($ldap->get_error(), _("Removing APACHE2 entries failed")); + show_ldap_error($ldap->get_error(), _("Removing Apache entries failed")); } /* move follwoing entries @@ -292,7 +292,7 @@ class servapache extends plugin $this->recursive_move($src,$dst); } - /* Add || Update new APACHE2 entries + /* Add || Update new apache entries */ foreach($tmp['add'] as $dn => $attrs){ $ldap->cd($dn); @@ -306,7 +306,7 @@ class servapache extends plugin $ldap->cd($dn); $ldap->add($attrs); } - show_ldap_error($ldap->get_error(), _("Saving APACHE2 entries failed")); + show_ldap_error($ldap->get_error(), _("Saving apache entries failed")); } } } diff --git a/vhost-apache2/functions_apache.inc b/vhost-apache2/functions_apache.inc index 8a8217994..9f11882f1 100644 --- a/vhost-apache2/functions_apache.inc +++ b/vhost-apache2/functions_apache.inc @@ -1,7 +1,7 @@