diff options
Diffstat (limited to 'phpBB/includes/functions_acp.php')
| -rw-r--r-- | phpBB/includes/functions_acp.php | 30 | 
1 files changed, 22 insertions, 8 deletions
| diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index e30c6da505..390b59b9e9 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -245,8 +245,13 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)  	switch ($tpl_type[0])  	{ -		case 'text':  		case 'password': +			if ($new[$config_key] !== '') +			{ +				// replace passwords with asterixes +				$new[$config_key] = '********'; +			} +		case 'text':  		case 'url':  		case 'email':  		case 'color': @@ -378,6 +383,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)  		$tpl .= $vars['append'];  	} +	$new_ary = $new;  	/**  	* Overwrite the html code we display for the config value  	* @@ -387,14 +393,17 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)  	*						1 [optional] => string: size, int: minimum  	*						2 [optional] => string: max. length, int: maximum  	* @var	string	key			Should be used for the id attribute in html -	* @var	array	new			Array with the config values we display +	* @var	array	new_ary			Array with the config values we display  	* @var	string	name		Should be used for the name attribute  	* @var	array	vars		Array with the options for the config  	* @var	string	tpl			The resulting html code we display  	* @since 3.1.0-a1 +	* @change 3.2.0-a1 Replaced new with new_ary  	*/ -	$vars = array('tpl_type', 'key', 'new', 'name', 'vars', 'tpl'); +	$vars = array('tpl_type', 'key', 'new_ary', 'name', 'vars', 'tpl');  	extract($phpbb_dispatcher->trigger_event('core.build_config_template', compact($vars))); +	$new = $new_ary; +	unset($new_ary);  	return $tpl;  } @@ -405,7 +414,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)  */  function validate_config_vars($config_vars, &$cfg_array, &$error)  { -	global $phpbb_root_path, $user, $phpbb_dispatcher; +	global $phpbb_root_path, $user, $phpbb_dispatcher, $phpbb_filesystem;  	$type	= 0;  	$min	= 1; @@ -550,6 +559,9 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)  				$cfg_array[$config_name] = trim($destination); +			// Absolute file path +			case 'absolute_path': +			case 'absolute_path_writable':  			// Path being relative (still prefixed by phpbb_root_path), but with the ability to escape the root dir...  			case 'path':  			case 'wpath': @@ -568,20 +580,22 @@ function validate_config_vars($config_vars, &$cfg_array, &$error)  					break;  				} -				if (!file_exists($phpbb_root_path . $cfg_array[$config_name])) +				$path = in_array($config_definition['validate'], array('wpath', 'path', 'rpath', 'rwpath')) ? $phpbb_root_path . $cfg_array[$config_name] : $cfg_array[$config_name]; + +				if (!file_exists($path))  				{  					$error[] = sprintf($user->lang['DIRECTORY_DOES_NOT_EXIST'], $cfg_array[$config_name]);  				} -				if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !is_dir($phpbb_root_path . $cfg_array[$config_name])) +				if (file_exists($path) && !is_dir($path))  				{  					$error[] = sprintf($user->lang['DIRECTORY_NOT_DIR'], $cfg_array[$config_name]);  				}  				// Check if the path is writable -				if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath') +				if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath' || $config_definition['validate'] === 'absolute_path_writable')  				{ -					if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !phpbb_is_writable($phpbb_root_path . $cfg_array[$config_name])) +					if (file_exists($path) && !$phpbb_filesystem->is_writable($path))  					{  						$error[] = sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]);  					} | 
