Permalink
Browse files

Format install params

  • Loading branch information...
yurabakhtin committed Aug 9, 2017
1 parent 17913ca commit b899d654d931f3bf3cfbbdd71e0d1a0f3a16d04c
Showing with 19 additions and 7 deletions.
  1. +19 −7 install/_functions_install.php
@@ -1791,6 +1791,18 @@ function check_quick_install_request()
}
/**
* Format an install param like DB config and base url
*
* @return string
*/
function format_install_param( $value )
{
$value = str_replace( array( "'", "\$" ), array( "\'", "\\$" ), $value );
return preg_replace( "#([\\\\]*)(\\\\\\\')#", "\\\\\\\\\\\\\\\\\'", $value );
}
/**
* Update file /conf/_basic_config.php
*
@@ -1891,13 +1903,13 @@ function update_basic_config_file( $params = array() )
),
array(
"\$db_config = array(\n"
."\t'user' => '".str_replace( array( "'", "\$" ), array( "\'", "\\$" ), $params['db_user'] )."',\$1"
."\t'password' => '".str_replace( array( "'", "\$" ), array( "\'", "\\$" ), $params['db_password'] )."',\$2"
."\t'name' => '".str_replace( array( "'", "\$" ), array( "\'", "\\$" ), $params['db_name'] )."',\$3"
."\t'host' => '".str_replace( array( "'", "\$" ), array( "\'", "\\$" ), $params['db_host'] )."',\$4",
"tableprefix = '".str_replace( "'", "\'", $params['db_tableprefix'] )."';",
"baseurl = '".str_replace( "'", "\'", $params['baseurl'] )."';",
"admin_email = '".str_replace( "'", "\'", $params['admin_email'] )."';",
."\t'user' => '".format_install_param( $params['db_user'] )."',\$1"
."\t'password' => '".format_install_param( $params['db_password'] )."',\$2"
."\t'name' => '".format_install_param( $params['db_name'] )."',\$3"
."\t'host' => '".format_install_param( $params['db_host'] )."',\$4",
"tableprefix = '".format_install_param( $params['db_tableprefix'] )."';",
"baseurl = '".format_install_param( $params['baseurl'] )."';",
"admin_email = '".format_install_param( $params['admin_email'] )."';",
'config_is_done = 1;',
), $conf );

0 comments on commit b899d65

Please sign in to comment.