mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-12 02:25:18 +02:00
[ticket/11404] Use a default data row if $row is empty in clean_row()
A statically defined $default_row will be used inside the phpbb_avatar_manager::clean_row() method if the $row passed to it is empty. PHPBB3-11404
This commit is contained in:
parent
5963905825
commit
bb58462724
@ -45,6 +45,17 @@ class phpbb_avatar_manager
|
|||||||
*/
|
*/
|
||||||
protected $container;
|
protected $container;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default avatar data row
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
static protected $default_row = array(
|
||||||
|
'avatar' => '',
|
||||||
|
'avatar_type' => '',
|
||||||
|
'avatar_width' => '',
|
||||||
|
'avatar_height' => '',
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an avatar manager object
|
* Construct an avatar manager object
|
||||||
*
|
*
|
||||||
@ -174,20 +185,15 @@ class phpbb_avatar_manager
|
|||||||
*/
|
*/
|
||||||
static public function clean_row($row)
|
static public function clean_row($row)
|
||||||
{
|
{
|
||||||
|
// Upon creation of a user/group $row might be empty
|
||||||
|
if (empty($row))
|
||||||
|
{
|
||||||
|
return self::$default_row;
|
||||||
|
}
|
||||||
|
|
||||||
$keys = array_keys($row);
|
$keys = array_keys($row);
|
||||||
$values = array_values($row);
|
$values = array_values($row);
|
||||||
|
|
||||||
// Upon creation of a user/group $row might be empty
|
|
||||||
if (empty($keys))
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'avatar' => '',
|
|
||||||
'avatar_type' => '',
|
|
||||||
'avatar_width' => '',
|
|
||||||
'avatar_height' => '',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$keys = array_map(array('phpbb_avatar_manager', 'strip_prefix'), $keys);
|
$keys = array_map(array('phpbb_avatar_manager', 'strip_prefix'), $keys);
|
||||||
|
|
||||||
return array_combine($keys, $values);
|
return array_combine($keys, $values);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user