Ejemplo n.º 1
0
 /**
  * Removes a rule from this store (must be passed an object, not string/name). Returns TRUE if found.
  * @param Rule|SecurityRule $rule
  * @param bool $deleteForever
  * @return bool
  */
 public function remove($rule, $deleteForever = false)
 {
     $found = false;
     $serial = spl_object_hash($rule);
     if (isset($this->fastMemToIndex[$serial])) {
         $found = true;
         unset($this->fastNameToIndex[$rule->name()]);
         unset($this->rules[$this->fastMemToIndex[$serial]]);
         unset($this->fastMemToIndex[$serial]);
         $this->xmlroot->removeChild($rule->xmlroot);
         $rule->owner = null;
         if ($deleteForever) {
             $rule->cleanForDestruction();
         }
     } elseif ($this->isPreOrPost) {
         if (isset($this->fastMemToIndex_forPost[$serial])) {
             $found = true;
             unset($this->fastNameToIndex_forPost[$rule->name()]);
             unset($this->postRules[$this->fastMemToIndex_forPost[$serial]]);
             unset($this->fastMemToIndex_forPost[$serial]);
             $this->postRulesRoot->removeChild($rule->xmlroot);
             $rule->owner = null;
             if ($deleteForever) {
                 $rule->cleanForDestruction();
             }
         }
     }
     return $found;
 }
Ejemplo n.º 2
0
 /**
  * @param string $local
  * @param string $remote
  * @return bool
  */
 function removeProxyId($local, $remote)
 {
     foreach ($this->proxys as $index => &$proxy) {
         if ($proxy['local'] == $local && $proxy['remote'] == $remote) {
             unset($this->proxys[$index]);
             $this->proxyIdRoot->removeChild($proxy['xmlroot']);
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 3
0
 /**
  * @param Address|AddressGroup $s
  * @param bool $rewriteXML
  * @return bool
  */
 public function remove($s, $rewriteXML = true)
 {
     $class = get_class($s);
     $objectName = $s->name();
     if (!isset($this->all[$objectName])) {
         mdeb('Tried to remove an object that is not part of this store');
         return false;
     }
     unset($this->all[$objectName]);
     if ($class == 'Address') {
         if ($s->isTmpAddr()) {
             unset($this->tmpaddr[$objectName]);
         } else {
             unset($this->addr[$objectName]);
         }
     } else {
         if ($class == 'AddressGroup') {
             unset($this->addrg[$objectName]);
         } else {
             derr('invalid class found');
         }
     }
     $s->owner = null;
     if ($rewriteXML && !$s->isTmpAddr()) {
         if ($class == "Address") {
             $this->addrroot->removeChild($s->xmlroot);
         } else {
             if ($class == "AddressGroup") {
                 $this->addrgroot->removeChild($s->xmlroot);
             } else {
                 derr('unsupported');
             }
         }
     }
     return true;
 }