replacePrefix just returns last result (tools.inc.php)
When using multiple codes in prefixes (like u[CLIENTID]_[CLIENTNAME]), only the last result is being returned, causing validation errors (because [ and ] are not supported). Located in /usr/local/ispconfig/interface/web/sites/tools.inc.php @ r30.
I prefer the following solution (not tested yet):
function replacePrefix($name, $dataRecord) { // No input -> no possible output -> go out! if ($name=="") return "";
// Array containing keys to search $keywordlist=array('CLIENTNAME','CLIENTID');
name, '['.
keyword.']') > 0)
{
switch ($keyword)
{
case 'CLIENTNAME' : name=str_replace('['.
keyword.']', getClientName(dataRecord),
name);
break;
case 'CLIENTID' : name=str_replace('['.
keyword.']', getClientID(dataRecord),
name);
break;
}
}
return $name;
}
// Try to match the key within the string
foreach ($keywordlist as $keyword)
if (substr_count(Maybe interesting to think about a regular expression solution, instaid of this array-key-find method.
if (preg_match_all(/[([^]+)]]/,name,
matches)>0)
foreach($matches[1] as $match)
switch (strtoupper($match))
....
Code-blocks can perhaps also be lowercase.