From c3ed6f7d0116dfc5a5a13ee5c88b75bb8c86a76c Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 19 Jun 2016 01:22:32 +0200 Subject: [PATCH] Improved default value handling --- include/Contact.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/include/Contact.php b/include/Contact.php index 896edaac7d..3ee491e505 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -255,11 +255,20 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) { $profile["bd"] = (++$current_year)."-".$month."-".$day; } else $profile["bd"] = "0000-00-00"; - } else { + } else $profile = $default; - if (!isset($profile["thumb"]) AND isset($profile["photo"])) - $profile["thumb"] = $profile["photo"]; - } + + if (($profile["photo"] == "") AND isset($default["photo"])) + $profile["photo"] = $default["photo"]; + + if (($profile["name"] == "") AND isset($default["name"])) + $profile["name"] = $default["name"]; + + if (($profile["network"] == "") AND isset($default["network"])) + $profile["network"] = $default["network"]; + + if (!isset($profile["thumb"]) AND isset($profile["photo"])) + $profile["thumb"] = $profile["photo"]; if ((($profile["addr"] == "") OR ($profile["name"] == "")) AND ($profile["gid"] != 0) AND in_array($profile["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) -- 2.39.5