From: hickert Date: Fri, 14 Jan 2011 16:03:08 +0000 (+0000) Subject: Updated Placeholder handling, fixed problems with UPPER/lowercase handling X-Git-Url: https://git.tokkee.org/?p=gosa.git;a=commitdiff_plain;h=fe335ff52d8edba0ea30dc06bae92adc0fb8c04d Updated Placeholder handling, fixed problems with UPPER/lowercase handling Updated email address test for templates, it allows {} now, to be able to handle replacements. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.7@20596 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index f932dd3f2..0180a8529 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -595,7 +595,7 @@ class plugin $this->attrs= $ldap->fetch(); $values = array(); - foreach($this->attributes as $name){ + foreach(array('uid','sn','givenName') as $name){ if(isset($this->parent->$name)){ $value = $this->parent->$name; if(is_numeric($name)) continue; diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index fde2df70e..22670325a 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -3717,11 +3717,14 @@ function fillReplacements($str, $attrs, $shellArg = FALSE, $default = "") } krsort($hits); + // Add lower case placeholders to avoid errors + foreach($attrs as $key => $attr) $attrs[strtolower($key)] = $attr; + // Replace the placeholder in the given string now. foreach($hits as $match){ // Avoid errors about undefined index. - $name = $match[2]; + $name = strtolower($match[2]); if(!isset($attrs[$name])) $attrs[$name] = $default; // Calculate the replacement diff --git a/gosa-core/include/utils/class_tests.inc b/gosa-core/include/utils/class_tests.inc index 602ce0623..6b2e283a2 100644 --- a/gosa-core/include/utils/class_tests.inc +++ b/gosa-core/include/utils/class_tests.inc @@ -205,7 +205,7 @@ class tests { return (TRUE); } if ($template){ - return preg_match ("/^[._a-z0-9%\+-]+@[_a-z0-9-]+(\.[a-z0-9-]+)(\.[a-z0-9-]+)*$/i", + return preg_match ("/^[._a-z0-9{\[\]}%\+-]+@[_a-{}\[\]%z0-9-]+(\.[a-z0-9-]+)(\.[a-z0-9-]+)*$/i", $address); } else { return preg_match ("/^[._a-z0-9\+-]+@[_a-z0-9-]+(\.[a-z0-9i-]+)(\.[a-z0-9-]+)*$/i",