X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2FContact.php;h=4e86b32977695c361de3b120aab84d6fc45012db;hb=47fd9226c3f0b90f460fe2031fa46cbb49a87100;hp=dc29d38257a38a6cca4f0ae60c7f0df152215661;hpb=5a6da8b447430174ae231a3b8203fd4bd8416cc1;p=friendica.git diff --git a/include/Contact.php b/include/Contact.php index dc29d38257..4e86b32977 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -5,7 +5,7 @@ // authorisation to do this. function user_remove($uid) { - if (! $uid) + if(! $uid) return; logger('Removing user: ' . $uid); @@ -49,7 +49,7 @@ function user_remove($uid) { // Send an update to the directory proc_run(PRIORITY_LOW, "include/directory.php", $r[0]['url']); - if ($uid == local_user()) { + if($uid == local_user()) { unset($_SESSION['authenticated']); unset($_SESSION['uid']); goaway(App::get_baseurl()); @@ -122,13 +122,11 @@ function terminate_friendship($user,$self,$contact) { // This provides for the possibility that their database is temporarily messed // up or some other transient event and that there's a possibility we could recover from it. -function mark_for_death(array $contact) { +function mark_for_death($contact) { - if ($contact['archive']) { + if($contact['archive']) return; - } - /// @TODO Comparison of strings this way may lead to bugs/incompatibility, better switch to DateTime if ($contact['term-date'] <= NULL_DATE) { q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d", dbesc(datetime_convert()), @@ -153,7 +151,7 @@ function mark_for_death(array $contact) { /// Check for contact vitality via probing $expiry = $contact['term-date'] . ' + 32 days '; - if (datetime_convert() > datetime_convert('UTC','UTC',$expiry)) { + if(datetime_convert() > datetime_convert('UTC','UTC',$expiry)) { // relationship is really truly dead. // archive them rather than delete @@ -256,7 +254,7 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) { // "bd" always contains the upcoming birthday of a contact. // "birthday" might contain the birthday including the year of birth. - if ($profile["birthday"] != "0000-00-00") { + if ($profile["birthday"] > '0001-01-01') { $bd_timestamp = strtotime($profile["birthday"]); $month = date("m", $bd_timestamp); $day = date("d", $bd_timestamp); @@ -273,7 +271,7 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) { $profile["bd"] = (++$current_year)."-".$month."-".$day; } } else { - $profile["bd"] = "0000-00-00"; + $profile["bd"] = '0001-01-01'; } } else { $profile = $default; @@ -309,7 +307,7 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) { $profile["location"] = ""; $profile["about"] = ""; $profile["gender"] = ""; - $profile["birthday"] = "0000-00-00"; + $profile["birthday"] = '0001-01-01'; } $cache[$url][$uid] = $profile; @@ -485,7 +483,7 @@ function random_profile() { function contacts_not_grouped($uid,$start = 0,$count = 0) { - if (! $count) { + if(! $count) { $r = q("select count(*) as total from contact where uid = %d and self = 0 and id not in (select distinct(`contact-id`) from group_member where uid = %d) ", intval($uid), intval($uid) @@ -777,18 +775,18 @@ function posts_from_contact_url(App $a, $contact_url) { function formatted_location($profile) { $location = ''; - if ($profile['locality']) + if($profile['locality']) $location .= $profile['locality']; - if ($profile['region'] AND ($profile['locality'] != $profile['region'])) { - if ($location) + if($profile['region'] AND ($profile['locality'] != $profile['region'])) { + if($location) $location .= ', '; $location .= $profile['region']; } - if ($profile['country-name']) { - if ($location) + if($profile['country-name']) { + if($location) $location .= ', '; $location .= $profile['country-name']; @@ -810,7 +808,7 @@ function account_type($contact) { // "page-flags" is a field in the user table, // "forum" and "prv" are used in the contact table. They stand for PAGE_COMMUNITY and PAGE_PRVGROUP. // "community" is used in the gcontact table and is true if the contact is PAGE_COMMUNITY or PAGE_PRVGROUP. - if ((isset($contact['page-flags']) && (intval($contact['page-flags']) == PAGE_COMMUNITY)) + if((isset($contact['page-flags']) && (intval($contact['page-flags']) == PAGE_COMMUNITY)) || (isset($contact['page-flags']) && (intval($contact['page-flags']) == PAGE_PRVGROUP)) || (isset($contact['forum']) && intval($contact['forum'])) || (isset($contact['prv']) && intval($contact['prv']))