X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fcontacts.php;h=6ee9a4a92b23165e2df3a49cfb4583482d14e338;hb=836058c47745f502890a209dfd6efcb3596ace84;hp=05a84279b01270322583c36999ff71ed16060efa;hpb=2c3e2908b244d4d6a95104f8278eaecd57bd3a1d;p=friendica.git diff --git a/mod/contacts.php b/mod/contacts.php index 05a84279b0..6ee9a4a92b 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -35,7 +35,7 @@ function contacts_init(&$a) { $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array( '$name' => $a->data['contact']['name'], '$photo' => $a->data['contact']['photo'], - '$url' => ($a->data['contact']['network'] == 'dfrn') ? $a->get_baseurl()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url'] + '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? $a->get_baseurl()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url'] )); $follow_widget = ''; } @@ -211,12 +211,16 @@ function _contact_update($contact_id) { } function _contact_update_profile($contact_id) { - $r = q("SELECT `url` FROM `contact` WHERE `id` = %d", intval($contact_id)); + $r = q("SELECT `url`, `network` FROM `contact` WHERE `id` = %d", intval($contact_id)); if (!$r) return; $data = probe_url($r[0]["url"]); + // "Feed" is mostly a sign of communication problems + if (($data["network"] == NETWORK_FEED) AND ($data["network"] != $r[0]["network"])) + return; + $updatefields = array("name", "nick", "url", "addr", "batch", "notify", "poll", "request", "confirm", "poco", "network", "alias", "pubkey"); $update = array(); @@ -225,6 +229,8 @@ function _contact_update_profile($contact_id) { if (isset($data[$field]) AND ($data[$field] != "")) $update[$field] = $data[$field]; + $update["nurl"] = normalise_link($data["url"]); + $query = ""; if (isset($data["priority"]) AND ($data["priority"] != 0)) @@ -344,7 +350,7 @@ function contacts_content(&$a) { if($cmd === 'updateprofile') { _contact_update_profile($contact_id); - goaway($a->get_baseurl(true) . '/contacts/' . $contact_id); + goaway($a->get_baseurl(true) . '/crepair/' . $contact_id); // NOTREACHED } @@ -398,7 +404,9 @@ function contacts_content(&$a) { } $a->page['aside'] = ''; - return replace_macros(get_markup_template('confirm.tpl'), array( + + return replace_macros(get_markup_template('contact_drop_confirm.tpl'), array( + '$contact' => _contact_detail_for_template($orig_record[0]), '$method' => 'get', '$message' => t('Do you really want to delete this contact?'), '$extra_inputs' => $inputs, @@ -726,54 +734,9 @@ function contacts_content(&$a) { $contacts = array(); if(count($r)) { - foreach($r as $rr) { - - switch($rr['rel']) { - case CONTACT_IS_FRIEND: - $dir_icon = 'images/lrarrow.gif'; - $alt_text = t('Mutual Friendship'); - break; - case CONTACT_IS_FOLLOWER; - $dir_icon = 'images/larrow.gif'; - $alt_text = t('is a fan of yours'); - break; - case CONTACT_IS_SHARING; - $dir_icon = 'images/rarrow.gif'; - $alt_text = t('you are a fan of'); - break; - default: - break; - } - if(($rr['network'] === 'dfrn') && ($rr['rel'])) { - $url = "redir/{$rr['id']}"; - $sparkle = ' class="sparkle" '; - } - else { - $url = $rr['url']; - $sparkle = ''; - } - - - $contacts[] = array( - 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']), - 'edit_hover' => t('Edit contact'), - 'photo_menu' => contact_photo_menu($rr), - 'id' => $rr['id'], - 'alt_text' => $alt_text, - 'dir_icon' => $dir_icon, - 'thumb' => proxy_url($rr['thumb']), - 'name' => $rr['name'], - 'username' => $rr['name'], - 'sparkle' => $sparkle, - 'itemurl' => $rr['url'], - 'url' => $url, - 'network' => network_to_name($rr['network']), - ); + $contacts[] = _contact_detail_for_template($rr); } - - - } $tpl = get_markup_template("contacts-template.tpl"); @@ -802,3 +765,48 @@ function contacts_content(&$a) { return $o; } + +function _contact_detail_for_template($rr){ + switch($rr['rel']) { + case CONTACT_IS_FRIEND: + $dir_icon = 'images/lrarrow.gif'; + $alt_text = t('Mutual Friendship'); + break; + case CONTACT_IS_FOLLOWER; + $dir_icon = 'images/larrow.gif'; + $alt_text = t('is a fan of yours'); + break; + case CONTACT_IS_SHARING; + $dir_icon = 'images/rarrow.gif'; + $alt_text = t('you are a fan of'); + break; + default: + break; + } + if(($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) { + $url = "redir/{$rr['id']}"; + $sparkle = ' class="sparkle" '; + } + else { + $url = $rr['url']; + $sparkle = ''; + } + + + return array( + 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']), + 'edit_hover' => t('Edit contact'), + 'photo_menu' => contact_photo_menu($rr), + 'id' => $rr['id'], + 'alt_text' => $alt_text, + 'dir_icon' => $dir_icon, + 'thumb' => proxy_url($rr['thumb']), + 'name' => $rr['name'], + 'username' => $rr['name'], + 'sparkle' => $sparkle, + 'itemurl' => $rr['url'], + 'url' => $url, + 'network' => network_to_name($rr['network']), + ); + +} \ No newline at end of file