X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2FNotificationsManager.php;h=57c315c9d741954b671aff04560cadbc52202e63;hb=0cd9db9cb7f4c96f597e37590a536eaae123238d;hp=37d93b750c27b733c15902ca4648093b418f3181;hpb=df7acc76557e96a3a907deb6378450d579be1100;p=friendica.git diff --git a/include/NotificationsManager.php b/include/NotificationsManager.php index 37d93b750c..57c315c9d7 100644 --- a/include/NotificationsManager.php +++ b/include/NotificationsManager.php @@ -4,10 +4,12 @@ * @brief Methods for read and write notifications from/to database * or for formatting notifications */ + require_once 'include/html2plain.php'; require_once 'include/probe.php'; require_once 'include/datetime.php'; require_once 'include/bbcode.php'; +require_once 'include/Contact.php'; /** * @brief Methods for read and write notifications from/to database @@ -510,7 +512,7 @@ class NotificationsManager { $myurl = substr($myurl,strpos($myurl,'://')+3); $myurl = str_replace(array('www.','.'),array('','\\.'),$myurl); $diasp_url = str_replace('/profile/','/u/',$myurl); - $sql_extra = sprintf(" AND ( `item`.`author-link` regexp '%s' or `item`.`tag` regexp '%s' or `item`.`tag` regexp '%s' ) ", + $sql_extra = sprintf(" AND ( `item`.`author-link` regexp '%s' OR `item`.`tag` regexp '%s' OR `item`.`tag` regexp '%s' ) ", dbesc($myurl . '$'), dbesc($myurl . '\\]'), dbesc($diasp_url . '\\]') @@ -827,11 +829,11 @@ class NotificationsManager { } /** - * @brief Check for missing contact data and try to fetch the data from + * @brief Check for missing contact data and try to fetch the data from * from other sources - * + * * @param array $arr The input array with the intro data - * + * * @return array The array with the intro data */ private function getMissingIntroData($arr) { @@ -844,17 +846,17 @@ class NotificationsManager { $arr['gaddr'] = $arr['addr']; } - // If the network and addr is still not available try to probe - // the contact url to fetch the missing data + // If the network and addr is still not available + // get the missing data data from other sources if ($arr['gnetwork'] == "" || $arr['gaddr'] == "") { - $ret = probe_url($arr["url"]); - } + $ret = get_contact_details_by_url($arr['url']); - if ($arr['gnetwork'] == "") { - $arr['gnetwork'] = $ret['network']; - } - if ($arr['gaddr'] == "") { - $arr['gaddr'] = $ret['addr']; + if ($arr['gnetwork'] == "" && $ret['network'] != "") { + $arr['gnetwork'] = $ret['network']; + } + if ($arr['gaddr'] == "" && $ret['addr'] != "") { + $arr['gaddr'] = $ret['addr']; + } } return $arr;