Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.2 KiB

  1. <?php
  2. function viewcontacts_init(&$a) {
  3. require_once("mod/profile.php");
  4. profile_load($a,$a->argv[1]);
  5. }
  6. function viewcontacts_content(&$a) {
  7. if(((! count($a->profile)) || ($a->profile['hide-friends']))) {
  8. notice( t('Permission denied.') . EOL);
  9. return;
  10. }
  11. $o .= '<h3>' . t('View Contacts') . '</h3>';
  12. $r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0",
  13. intval($a->profile['uid'])
  14. );
  15. if(count($r))
  16. $a->pager['totalitems'] = $r[0]['total'];
  17. $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 ORDER BY `name` ASC LIMIT %d , %d ",
  18. intval($a->profile['uid']),
  19. intval($a->pager['start']),
  20. intval($a->pager['itemspage'])
  21. );
  22. if(! count($r)) {
  23. notice( t('No contacts.') . EOL );
  24. return $o;
  25. }
  26. $tpl = file_get_contents("view/viewcontact_template.tpl");
  27. foreach($r as $rr) {
  28. if($rr['self'])
  29. continue;
  30. $o .= replace_macros($tpl, array(
  31. '$id' => $rr['id'],
  32. '$alt_text' => t('Visit ') . $rr['name'] . t('\'s profile'),
  33. '$thumb' => $rr['thumb'],
  34. '$name' => $rr['name'],
  35. '$url' => $rr['url']
  36. ));
  37. }
  38. $o .= '<div id="view-contact-end"></div>';
  39. $o .= paginate($a);
  40. return $o;
  41. }