SF Bug #3036033 - Error if CN begins with a % sign

This commit is contained in:
Deon George
2011-04-29 12:08:38 +10:00
parent 2ea1fc6314
commit a35298e7f3
11 changed files with 57 additions and 29 deletions

View File

@@ -634,6 +634,14 @@ class Template extends xmlTemplate {
return $this->getRDN();
}
public function getDNEncode($url=true) {
// @todo Be nice to do all this in 1 location
if ($url)
return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->getDN()));
else
return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->getDN());
}
/**
* Set the container for this template, if we are creating entries
*
@@ -665,6 +673,14 @@ class Template extends xmlTemplate {
return $this->container;
}
public function getContainerEncode($url=true) {
// @todo Be nice to do all this in 1 location
if ($url)
return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->container));
else
return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->container);
}
/**
* Copy a DN
*/