Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
lolo888
ISPConfig 3
Commits
cc215651
Commit
cc215651
authored
Oct 06, 2009
by
tbrehm
Browse files
Fixed: FS#843 - replacePrefix just returns last result (tools.inc.php)
parent
0e11b4b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
interface/web/sites/tools.inc.php
View file @
cc215651
...
...
@@ -27,27 +27,27 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function
replacePrefix
(
$name
,
$dataRecord
){
$keywordlist
=
array
(
'CLIENTNAME'
,
'CLIENTID'
);
function
replacePrefix
(
$name
,
$dataRecord
)
{
// No input -> no possible output -> go out!
if
(
$name
==
""
)
return
""
;
if
(
$name
!=
''
)
{
foreach
(
$keywordlist
as
$keyword
)
{
if
(
substr_count
(
$name
,
'['
.
$keyword
.
']'
)
>
0
)
{
switch
(
$keyword
)
{
case
'CLIENTNAME'
:
$res
=
str_replace
(
'['
.
$keyword
.
']'
,
getClientName
(
$dataRecord
),
$name
);
break
;
case
'CLIENTID'
:
$res
=
str_replace
(
'['
.
$keyword
.
']'
,
getClientID
(
$dataRecord
),
$name
);
break
;
}
}
}
}
else
{
$res
=
''
;
}
return
$res
;
// Array containing keys to search
$keywordlist
=
array
(
'CLIENTNAME'
,
'CLIENTID'
);
// Try to match the key within the string
foreach
(
$keywordlist
as
$keyword
)
{
if
(
substr_count
(
$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
;
}
function
getClientName
(
$dataRecord
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment