3 * @file mod/suggest.php
6 use Friendica\Core\System;
7 use Friendica\Database\DBM;
8 use Friendica\Model\Contact;
9 use Friendica\Model\GContact;
11 require_once 'include/contact_widgets.php';
13 function suggest_init(App $a) {
18 if (x($_GET,'ignore') && intval($_GET['ignore'])) {
19 // Check if we should do HTML-based delete confirmation
20 if ($_REQUEST['confirm']) {
21 // <form> can't take arguments in its "action" parameter
22 // so add any arguments as hidden inputs
23 $query = explode_querystring($a->query_string);
25 foreach ($query['args'] as $arg) {
26 if (strpos($arg, 'confirm=') === false) {
27 $arg_parts = explode('=', $arg);
28 $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]);
32 $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), array(
34 '$message' => t('Do you really want to delete this suggestion?'),
35 '$extra_inputs' => $inputs,
36 '$confirm' => t('Yes'),
37 '$confirm_url' => $query['base'],
38 '$confirm_name' => 'confirmed',
39 '$cancel' => t('Cancel'),
41 $a->error = 1; // Set $a->error so the other module functions don't execute
44 // Now check how the user responded to the confirmation query
45 if (!$_REQUEST['canceled']) {
46 dba::insert('gcign', array('uid' => local_user(), 'gcid' => $_GET['ignore']));
56 function suggest_content(App $a) {
58 require_once("mod/proxy.php");
62 notice( t('Permission denied.') . EOL);
66 $_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd;
68 $a->page['aside'] .= findpeople_widget();
69 $a->page['aside'] .= follow_widget();
72 $r = GContact::suggestionQuery(local_user());
74 if (! DBM::is_result($r)) {
75 $o .= t('No suggestions available. If this is a new site, please try again in 24 hours.');
79 require_once 'include/contact_selectors.php';
83 $connlnk = System::baseUrl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);
84 $ignlnk = System::baseUrl() . '/suggest?ignore=' . $rr['id'];
86 'profile' => array(t("View Profile"), zrl($rr["url"])),
87 'follow' => array(t("Connect/Follow"), $connlnk),
88 'hide' => array(t('Ignore/Hide'), $ignlnk)
91 $contact_details = Contact::getDetailsByURL($rr["url"], local_user(), $rr);
94 'url' => zrl($rr['url']),
95 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
96 'img_hover' => $rr['url'],
97 'name' => $contact_details['name'],
98 'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
99 'details' => $contact_details['location'],
100 'tags' => $contact_details['keywords'],
101 'about' => $contact_details['about'],
102 'account_type' => Contact::getAccountType($contact_details),
104 'ignid' => $rr['id'],
105 'conntxt' => t('Connect'),
106 'connlnk' => $connlnk,
107 'photo_menu' => $photo_menu,
108 'ignore' => t('Ignore/Hide'),
109 'network' => network_to_name($rr['network'], $rr['url']),
115 $tpl = get_markup_template('viewcontact_template.tpl');
117 $o .= replace_macros($tpl,array(
118 '$title' => t('Friend Suggestions'),
119 '$contacts' => $entries,