3 require_once('include/Contact.php');
4 require_once('include/socgraph.php');
5 require_once('include/contact_selectors.php');
6 require_once('include/Scrape.php');
7 require_once('mod/proxy.php');
8 require_once('include/Photo.php');
10 function contacts_init(&$a) {
16 if(($a->argc == 2) && intval($a->argv[1])) {
17 $contact_id = intval($a->argv[1]);
18 $r = q("SELECT * FROM `contact` WHERE `uid` = %d and `id` = %d LIMIT 1",
27 require_once('include/group.php');
28 require_once('include/contact_widgets.php');
30 if ($_GET['nets'] == "all")
33 if(! x($a->page,'aside'))
34 $a->page['aside'] = '';
37 $a->data['contact'] = $r[0];
38 $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array(
39 '$name' => htmlentities($a->data['contact']['name']),
40 '$photo' => $a->data['contact']['photo'],
41 '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? $a->get_baseurl()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url']
44 $networks_widget = '';
48 $networks_widget .= networks_widget('contacts',$_GET['nets']);
49 if (isset($_GET['add']))
50 $follow_widget = follow_widget($_GET['add']);
52 $follow_widget = follow_widget();
55 $findpeople_widget .= findpeople_widget();
56 $groups_widget .= group_side('contacts','group',false,0,$contact_id);
58 $a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"),array(
59 '$vcard_widget' => $vcard_widget,
60 '$findpeople_widget' => $findpeople_widget,
61 '$follow_widget' => $follow_widget,
62 '$groups_widget' => $groups_widget,
63 '$networks_widget' => $networks_widget
66 $base = $a->get_baseurl();
67 $tpl = get_markup_template("contacts-head.tpl");
68 $a->page['htmlhead'] .= replace_macros($tpl,array(
69 '$baseurl' => $a->get_baseurl(true),
73 $tpl = get_markup_template("contacts-end.tpl");
74 $a->page['end'] .= replace_macros($tpl,array(
75 '$baseurl' => $a->get_baseurl(true),
82 function contacts_batch_actions(&$a){
83 $contacts_id = $_POST['contact_batch'];
84 if (!is_array($contacts_id)) return;
86 $orig_records = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND `uid` = %d AND `self` = 0",
87 implode(",", $contacts_id),
92 foreach($orig_records as $orig_record) {
93 $contact_id = $orig_record['id'];
94 if (x($_POST, 'contacts_batch_update')) {
95 _contact_update($contact_id);
98 if (x($_POST, 'contacts_batch_block')) {
99 $r = _contact_block($contact_id, $orig_record);
100 if ($r) $count_actions++;
102 if (x($_POST, 'contacts_batch_ignore')) {
103 $r = _contact_ignore($contact_id, $orig_record);
104 if ($r) $count_actions++;
106 if (x($_POST, 'contacts_batch_archive')) {
107 $r = _contact_archive($contact_id, $orig_record);
108 if ($r) $count_actions++;
110 if (x($_POST, 'contacts_batch_drop')) {
111 _contact_drop($contact_id, $orig_record);
115 if ($count_actions>0) {
116 info ( sprintf( tt("%d contact edited.", "%d contacts edited", $count_actions), $count_actions) );
119 if(x($_SESSION,'return_url'))
120 goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
122 goaway($a->get_baseurl(true) . '/contacts');
127 function contacts_post(&$a) {
132 if ($a->argv[1]==="batch") {
133 contacts_batch_actions($a);
137 $contact_id = intval($a->argv[1]);
141 $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
146 if(! count($orig_record)) {
147 notice( t('Could not access contact record.') . EOL);
148 goaway($a->get_baseurl(true) . '/contacts');
149 return; // NOTREACHED
152 call_hooks('contact_edit_post', $_POST);
154 $profile_id = intval($_POST['profile-assign']);
156 $r = q("SELECT `id` FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
161 notice( t('Could not locate selected profile.') . EOL);
166 $hidden = intval($_POST['hidden']);
168 $notify = intval($_POST['notify']);
170 $fetch_further_information = intval($_POST['fetch_further_information']);
172 $ffi_keyword_blacklist = fix_mce_lf(escape_tags(trim($_POST['ffi_keyword_blacklist'])));
174 $priority = intval($_POST['poll']);
175 if($priority > 5 || $priority < 0)
178 $info = fix_mce_lf(escape_tags(trim($_POST['info'])));
180 $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
181 `hidden` = %d, `notify_new_posts` = %d, `fetch_further_information` = %d,
182 `ffi_keyword_blacklist` = '%s' WHERE `id` = %d AND `uid` = %d",
188 intval($fetch_further_information),
189 dbesc($ffi_keyword_blacklist),
194 info( t('Contact updated.') . EOL);
196 notice( t('Failed to update contact record.') . EOL);
198 $r = q("select * from contact where id = %d and uid = %d limit 1",
203 $a->data['contact'] = $r[0];
210 function _contact_update($contact_id) {
211 $r = q("SELECT `uid`, `url`, `network` FROM `contact` WHERE `id` = %d", intval($contact_id));
217 if ($uid != local_user())
220 if ($r[0]["network"] == NETWORK_OSTATUS) {
221 $result = new_contact($uid, $r[0]["url"], false);
223 if ($result['success'])
224 $r = q("UPDATE `contact` SET `subhub` = 1 WHERE `id` = %d",
225 intval($contact_id));
227 // pull feed and consume it, which should subscribe to the hub.
228 proc_run('php',"include/onepoll.php","$contact_id", "force");
231 function _contact_update_profile($contact_id) {
232 $r = q("SELECT `uid`, `url`, `network` FROM `contact` WHERE `id` = %d", intval($contact_id));
238 if ($uid != local_user())
241 $data = probe_url($r[0]["url"]);
243 // "Feed" or "Unknown" is mostly a sign of communication problems
244 if ((in_array($data["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) AND ($data["network"] != $r[0]["network"]))
247 $updatefields = array("name", "nick", "url", "addr", "batch", "notify", "poll", "request", "confirm",
248 "poco", "network", "alias");
251 if ($data["network"] == NETWORK_OSTATUS) {
252 $result = new_contact($uid, $data["url"], false);
254 if ($result['success'])
255 $update["subhub"] = true;
258 foreach($updatefields AS $field)
259 if (isset($data[$field]) AND ($data[$field] != ""))
260 $update[$field] = $data[$field];
262 $update["nurl"] = normalise_link($data["url"]);
266 if (isset($data["priority"]) AND ($data["priority"] != 0))
267 $query = "`priority` = ".intval($data["priority"]);
269 foreach($update AS $key => $value) {
273 $query .= "`".$key."` = '".dbesc($value)."'";
279 $r = q("UPDATE `contact` SET $query WHERE `id` = %d AND `uid` = %d",
284 $photos = import_profile_photo($data['photo'], local_user(), $contact_id);
286 $r = q("UPDATE `contact` SET `photo` = '%s',
296 dbesc(datetime_convert()),
297 dbesc(datetime_convert()),
298 dbesc(datetime_convert()),
304 function _contact_block($contact_id, $orig_record) {
305 $blocked = (($orig_record['blocked']) ? 0 : 1);
306 $r = q("UPDATE `contact` SET `blocked` = %d WHERE `id` = %d AND `uid` = %d",
314 function _contact_ignore($contact_id, $orig_record) {
315 $readonly = (($orig_record['readonly']) ? 0 : 1);
316 $r = q("UPDATE `contact` SET `readonly` = %d WHERE `id` = %d AND `uid` = %d",
323 function _contact_archive($contact_id, $orig_record) {
324 $archived = (($orig_record['archive']) ? 0 : 1);
325 $r = q("UPDATE `contact` SET `archive` = %d WHERE `id` = %d AND `uid` = %d",
331 q("UPDATE `item` SET `private` = 2 WHERE `contact-id` = %d AND `uid` = %d", intval($contact_id), intval(local_user()));
335 function _contact_drop($contact_id, $orig_record) {
336 require_once('include/Contact.php');
339 terminate_friendship($a->user,$a->contact,$orig_record);
340 contact_remove($orig_record['id']);
344 function contacts_content(&$a) {
348 nav_set_selected('contacts');
352 notice( t('Permission denied.') . EOL);
358 $contact_id = intval($a->argv[1]);
364 $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d AND `self` = 0 LIMIT 1",
369 if(! count($orig_record)) {
370 notice( t('Could not access contact record.') . EOL);
371 goaway($a->get_baseurl(true) . '/contacts');
372 return; // NOTREACHED
375 if($cmd === 'update') {
376 _contact_update($contact_id);
377 goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
381 if($cmd === 'updateprofile') {
382 _contact_update_profile($contact_id);
383 goaway($a->get_baseurl(true) . '/crepair/' . $contact_id);
387 if($cmd === 'block') {
388 $r = _contact_block($contact_id, $orig_record[0]);
390 $blocked = (($orig_record[0]['blocked']) ? 0 : 1);
391 info((($blocked) ? t('Contact has been blocked') : t('Contact has been unblocked')).EOL);
394 goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
395 return; // NOTREACHED
398 if($cmd === 'ignore') {
399 $r = _contact_ignore($contact_id, $orig_record[0]);
401 $readonly = (($orig_record[0]['readonly']) ? 0 : 1);
402 info((($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')).EOL);
405 goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
406 return; // NOTREACHED
410 if($cmd === 'archive') {
411 $r = _contact_archive($contact_id, $orig_record[0]);
413 $archived = (($orig_record[0]['archive']) ? 0 : 1);
414 info((($archived) ? t('Contact has been archived') : t('Contact has been unarchived')).EOL);
417 goaway($a->get_baseurl(true) . '/contacts/' . $contact_id);
418 return; // NOTREACHED
421 if($cmd === 'drop') {
423 // Check if we should do HTML-based delete confirmation
424 if($_REQUEST['confirm']) {
425 // <form> can't take arguments in its "action" parameter
426 // so add any arguments as hidden inputs
427 $query = explode_querystring($a->query_string);
429 foreach($query['args'] as $arg) {
430 if(strpos($arg, 'confirm=') === false) {
431 $arg_parts = explode('=', $arg);
432 $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]);
436 $a->page['aside'] = '';
438 return replace_macros(get_markup_template('contact_drop_confirm.tpl'), array(
439 '$contact' => _contact_detail_for_template($orig_record[0]),
441 '$message' => t('Do you really want to delete this contact?'),
442 '$extra_inputs' => $inputs,
443 '$confirm' => t('Yes'),
444 '$confirm_url' => $query['base'],
445 '$confirm_name' => 'confirmed',
446 '$cancel' => t('Cancel'),
449 // Now check how the user responded to the confirmation query
450 if($_REQUEST['canceled']) {
451 if(x($_SESSION,'return_url'))
452 goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
454 goaway($a->get_baseurl(true) . '/contacts');
457 _contact_drop($contact_id, $orig_record[0]);
458 info( t('Contact has been removed.') . EOL );
459 if(x($_SESSION,'return_url'))
460 goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
462 goaway($a->get_baseurl(true) . '/contacts');
463 return; // NOTREACHED
469 $_SESSION['return_url'] = $a->query_string;
471 if((x($a->data,'contact')) && (is_array($a->data['contact']))) {
473 $contact_id = $a->data['contact']['id'];
474 $contact = $a->data['contact'];
476 $editselect = 'none';
477 if( feature_enabled(local_user(),'richtext') )
478 $editselect = 'exact';
480 $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array(
481 '$baseurl' => $a->get_baseurl(true),
482 '$editselect' => $editselect,
484 $a->page['end'] .= replace_macros(get_markup_template('contact_end.tpl'), array(
485 '$baseurl' => $a->get_baseurl(true),
486 '$editselect' => $editselect,
489 require_once('include/contact_selectors.php');
491 $tpl = get_markup_template("contact_edit.tpl");
493 switch($contact['rel']) {
494 case CONTACT_IS_FRIEND:
495 $dir_icon = 'images/lrarrow.gif';
496 $relation_text = t('You are mutual friends with %s');
498 case CONTACT_IS_FOLLOWER;
499 $dir_icon = 'images/larrow.gif';
500 $relation_text = t('You are sharing with %s');
503 case CONTACT_IS_SHARING;
504 $dir_icon = 'images/rarrow.gif';
505 $relation_text = t('%s is sharing with you');
511 if(!in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA)))
514 $relation_text = sprintf($relation_text,htmlentities($contact['name']));
516 if(($contact['network'] === NETWORK_DFRN) && ($contact['rel'])) {
517 $url = "redir/{$contact['id']}";
518 $sparkle = ' class="sparkle" ';
521 $url = $contact['url'];
525 $insecure = t('Private communications are not available for this contact.');
527 $last_update = (($contact['last-update'] == '0000-00-00 00:00:00')
529 : datetime_convert('UTC',date_default_timezone_get(),$contact['last-update'],'D, j M Y, g:i A'));
531 if($contact['last-update'] !== '0000-00-00 00:00:00')
532 $last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29"));
534 $lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : '');
536 $poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2));
538 $nettype = sprintf( t('Network type: %s'),network_to_name($contact['network'], $contact["url"]));
540 $common = count_common_friends(local_user(),$contact['id']);
541 $common_text = (($common) ? sprintf( tt('%d contact in common','%d contacts in common', $common),$common) : '');
543 $polling = (($contact['network'] === NETWORK_MAIL | $contact['network'] === NETWORK_FEED) ? 'polling' : '');
545 $x = count_all_friends(local_user(), $contact['id']);
546 $all_friends = (($x) ? t('View all contacts') : '');
551 'label' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
552 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/block',
554 'title' => t('Toggle Blocked status'),
558 'label' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
559 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/ignore',
561 'title' => t('Toggle Ignored status'),
566 'label' => (($contact['archive']) ? t('Unarchive') : t('Archive') ),
567 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/archive',
569 'title' => t('Toggle Archive status'),
573 'label' => t('Repair'),
574 'url' => $a->get_baseurl(true) . '/crepair/' . $contact_id,
576 'title' => t('Advanced Contact Settings'),
580 $tab_tpl = get_markup_template('common_tabs.tpl');
581 $tab_str = replace_macros($tab_tpl, array('$tabs' => $tabs));
583 $lost_contact = (($contact['archive'] && $contact['term-date'] != '0000-00-00 00:00:00' && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : '');
585 if ($contact['network'] == NETWORK_FEED)
586 $fetch_further_information = array('fetch_further_information', t('Fetch further information for feeds'), $contact['fetch_further_information'], t('Fetch further information for feeds'),
587 array('0'=>t('Disabled'), '1'=>t('Fetch information'), '2'=>t('Fetch information and keywords')));
589 if (in_array($contact['network'], array(NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2)))
590 $poll_interval = contact_poll_interval($contact['priority'],(! $poll_enabled));
592 if ($contact['network'] == NETWORK_DFRN)
593 $profile_select = contact_profile_assign($contact['profile-id'],(($contact['network'] !== NETWORK_DFRN) ? true : false));
595 if (in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_OSTATUS)) AND
596 ($contact['rel'] == CONTACT_IS_FOLLOWER))
597 $follow = $a->get_baseurl(true)."/follow?url=".urlencode($contact["url"]);
599 $o .= replace_macros($tpl, array(
600 '$header' => t('Contact Editor'),
601 '$tab_str' => $tab_str,
602 '$submit' => t('Submit'),
603 '$lbl_vis1' => t('Profile Visibility'),
604 '$lbl_vis2' => sprintf( t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $contact['name']),
605 '$lbl_info1' => t('Contact Information / Notes'),
606 '$infedit' => t('Edit contact notes'),
607 '$common_text' => $common_text,
608 '$common_link' => $a->get_baseurl(true) . '/common/loc/' . local_user() . '/' . $contact['id'],
609 '$all_friends' => $all_friends,
610 '$relation_text' => $relation_text,
611 '$visit' => sprintf( t('Visit %s\'s profile [%s]'),$contact['name'],$contact['url']),
612 '$blockunblock' => t('Block/Unblock contact'),
613 '$ignorecont' => t('Ignore contact'),
614 '$lblcrepair' => t("Repair URL settings"),
615 '$lblrecent' => t('View conversations'),
616 '$lblsuggest' => $lblsuggest,
617 '$delete' => t('Delete contact'),
618 '$nettype' => $nettype,
619 '$poll_interval' => $poll_interval,
620 '$poll_enabled' => $poll_enabled,
621 '$lastupdtext' => t('Last update:'),
622 '$lost_contact' => $lost_contact,
623 '$updpub' => t('Update public posts'),
624 '$last_update' => $last_update,
625 '$udnow' => t('Update now'),
626 '$follow' => $follow,
627 '$follow_text' => t("Connect/Follow"),
628 '$profile_select' => $profile_select,
629 '$contact_id' => $contact['id'],
630 '$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
631 '$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
632 '$insecure' => (($contact['network'] !== NETWORK_DFRN && $contact['network'] !== NETWORK_MAIL && $contact['network'] !== NETWORK_FACEBOOK && $contact['network'] !== NETWORK_DIASPORA) ? $insecure : ''),
633 '$info' => $contact['info'],
634 '$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''),
635 '$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''),
636 '$archived' => (($contact['archive']) ? t('Currently archived') : ''),
637 '$hidden' => array('hidden', t('Hide this contact from others'), ($contact['hidden'] == 1), t('Replies/likes to your public posts <strong>may</strong> still be visible')),
638 '$notify' => array('notify', t('Notification for new posts'), ($contact['notify_new_posts'] == 1), t('Send a notification of every new post of this contact')),
639 '$fetch_further_information' => $fetch_further_information,
640 '$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'],
641 '$ffi_keyword_blacklist' => array('ffi_keyword_blacklist', t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')),
642 '$photo' => $contact['photo'],
643 '$name' => htmlentities($contact['name']),
644 '$dir_icon' => $dir_icon,
645 '$alt_text' => $alt_text,
646 '$sparkle' => $sparkle,
648 '$profileurllabel' => t('Profile URL'),
649 '$profileurl' => $contact['url'],
653 $arr = array('contact' => $contact,'output' => $o);
655 call_hooks('contact_edit', $arr);
657 return $arr['output'];
666 if(($a->argc == 2) && ($a->argv[1] === 'all')) {
670 elseif(($a->argc == 2) && ($a->argv[1] === 'blocked')) {
671 $sql_extra = " AND `blocked` = 1 ";
674 elseif(($a->argc == 2) && ($a->argv[1] === 'hidden')) {
675 $sql_extra = " AND `hidden` = 1 ";
678 elseif(($a->argc == 2) && ($a->argv[1] === 'ignored')) {
679 $sql_extra = " AND `readonly` = 1 ";
682 elseif(($a->argc == 2) && ($a->argv[1] === 'archived')) {
683 $sql_extra = " AND `archive` = 1 ";
687 $sql_extra = " AND `blocked` = 0 ";
689 $search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : '');
690 $nets = ((x($_GET,'nets')) ? notags(trim($_GET['nets'])) : '');
694 'label' => t('Suggestions'),
695 'url' => $a->get_baseurl(true) . '/suggest',
697 'title' => t('Suggest potential friends'),
701 'label' => t('All Contacts'),
702 'url' => $a->get_baseurl(true) . '/contacts/all',
703 'sel' => ($all) ? 'active' : '',
704 'title' => t('Show all contacts'),
708 'label' => t('Unblocked'),
709 'url' => $a->get_baseurl(true) . '/contacts',
710 'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored) && (! $archived)) ? 'active' : '',
711 'title' => t('Only show unblocked contacts'),
716 'label' => t('Blocked'),
717 'url' => $a->get_baseurl(true) . '/contacts/blocked',
718 'sel' => ($blocked) ? 'active' : '',
719 'title' => t('Only show blocked contacts'),
724 'label' => t('Ignored'),
725 'url' => $a->get_baseurl(true) . '/contacts/ignored',
726 'sel' => ($ignored) ? 'active' : '',
727 'title' => t('Only show ignored contacts'),
732 'label' => t('Archived'),
733 'url' => $a->get_baseurl(true) . '/contacts/archived',
734 'sel' => ($archived) ? 'active' : '',
735 'title' => t('Only show archived contacts'),
740 'label' => t('Hidden'),
741 'url' => $a->get_baseurl(true) . '/contacts/hidden',
742 'sel' => ($hidden) ? 'active' : '',
743 'title' => t('Only show hidden contacts'),
749 $tab_tpl = get_markup_template('common_tabs.tpl');
750 $t = replace_macros($tab_tpl, array('$tabs'=>$tabs));
756 $search_hdr = $search;
757 $search_txt = dbesc(protect_sprintf(preg_quote($search)));
760 $sql_extra .= (($searching) ? " AND (name REGEXP '$search_txt' OR url REGEXP '$search_txt' OR nick REGEXP '$search_txt') " : "");
763 $sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets));
765 $sql_extra2 = ((($sort_type > 0) && ($sort_type <= CONTACT_IS_FRIEND)) ? sprintf(" AND `rel` = %d ",intval($sort_type)) : '');
768 $r = q("SELECT COUNT(*) AS `total` FROM `contact`
769 WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
770 intval($_SESSION['uid']));
772 $a->set_pager_total($r[0]['total']);
773 $total = $r[0]['total'];
777 $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ORDER BY `name` ASC LIMIT %d , %d ",
778 intval($_SESSION['uid']),
779 intval($a->pager['start']),
780 intval($a->pager['itemspage'])
787 $contacts[] = _contact_detail_for_template($rr);
791 $tpl = get_markup_template("contacts-template.tpl");
792 $o .= replace_macros($tpl, array(
793 '$baseurl' => $a->get_baseurl(),
794 '$header' => t('Contacts') . (($nets) ? ' - ' . network_to_name($nets) : ''),
797 '$search' => $search_hdr,
798 '$desc' => t('Search your contacts'),
799 '$finding' => (($searching) ? t('Finding: ') . "'" . $search . "'" : ""),
800 '$submit' => t('Find'),
802 '$contacts' => $contacts,
803 '$contact_drop_confirm' => t('Do you really want to delete this contact?'),
805 '$batch_actions' => array(
806 'contacts_batch_update' => t('Update'),
807 'contacts_batch_block' => t('Block')."/".t("Unblock"),
808 "contacts_batch_ignore" => t('Ignore')."/".t("Unignore"),
809 "contacts_batch_archive" => t('Archive')."/".t("Unarchive"),
810 "contacts_batch_drop" => t('Delete'),
812 '$paginate' => paginate($a),
819 function _contact_detail_for_template($rr){
821 case CONTACT_IS_FRIEND:
822 $dir_icon = 'images/lrarrow.gif';
823 $alt_text = t('Mutual Friendship');
825 case CONTACT_IS_FOLLOWER;
826 $dir_icon = 'images/larrow.gif';
827 $alt_text = t('is a fan of yours');
829 case CONTACT_IS_SHARING;
830 $dir_icon = 'images/rarrow.gif';
831 $alt_text = t('you are a fan of');
836 if(($rr['network'] === NETWORK_DFRN) && ($rr['rel'])) {
837 $url = "redir/{$rr['id']}";
838 $sparkle = ' class="sparkle" ';
847 'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']),
848 'edit_hover' => t('Edit contact'),
849 'photo_menu' => contact_photo_menu($rr),
851 'alt_text' => $alt_text,
852 'dir_icon' => $dir_icon,
853 'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB),
854 'name' => htmlentities($rr['name']),
855 'username' => htmlentities($rr['name']),
856 'sparkle' => $sparkle,
857 'itemurl' => $rr['url'],
859 'network' => network_to_name($rr['network'], $rr['url']),