From 40aaa768dd3529b05563f7c0193c1a70661574fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 21 Jul 2010 09:30:31 +0200 Subject: [PATCH] Factor out variable expanding. --- libraries/common.lib.php | 25 +++++++++++++++++++++++++ libraries/header_scripts.inc.php | 20 +------------------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 058fe0d0e..e2af6d9cc 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -2827,4 +2827,29 @@ $mapping = array( return $mapping[$target]; } +/** + * Formats user string, expading @VARIABLES@. + */ +function PMA_expandUserString($string) { + return str_replace( + array( + '@HTTP_HOST@', + '@SERVER@', + '@VERBOSE@', + '@VSERVER@', + '@DATABASE@', + '@TABLE@', + '@PHPMYADMIN@', + ), + array( + PMA_getenv('HTTP_HOST') ? PMA_getenv('HTTP_HOST') : '', + $GLOBALS['cfg']['Server']['host'], + $GLOBALS['cfg']['Server']['verbose'], + !empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : $GLOBALS['cfg']['Server']['host'], + $GLOBALS['db'], + $GLOBALS['table'], + 'phpMyAdmin ' . PMA_VERSION, + ), + $string); +} ?> diff --git a/libraries/header_scripts.inc.php b/libraries/header_scripts.inc.php index 34633090d..a292d0f2f 100644 --- a/libraries/header_scripts.inc.php +++ b/libraries/header_scripts.inc.php @@ -21,25 +21,7 @@ if ( false === $GLOBALS['cfg']['AllowThirdPartyFraming']) {