3 * @file mod/suggest.php
6 use Friendica\Content\ContactSelector;
7 use Friendica\Core\System;
8 use Friendica\Database\DBM;
9 use Friendica\Model\Contact;
10 use Friendica\Model\GContact;
11 use Friendica\Model\Profile;
13 require_once 'include/contact_widgets.php';
15 function suggest_init(App $a) {
20 if (x($_GET,'ignore') && intval($_GET['ignore'])) {
21 // Check if we should do HTML-based delete confirmation
22 if ($_REQUEST['confirm']) {
23 // <form> can't take arguments in its "action" parameter
24 // so add any arguments as hidden inputs
25 $query = explode_querystring($a->query_string);
27 foreach ($query['args'] as $arg) {
28 if (strpos($arg, 'confirm=') === false) {
29 $arg_parts = explode('=', $arg);
30 $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]);
34 $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), array(
36 '$message' => t('Do you really want to delete this suggestion?'),
37 '$extra_inputs' => $inputs,
38 '$confirm' => t('Yes'),
39 '$confirm_url' => $query['base'],
40 '$confirm_name' => 'confirmed',
41 '$cancel' => t('Cancel'),
43 $a->error = 1; // Set $a->error so the other module functions don't execute
46 // Now check how the user responded to the confirmation query
47 if (!$_REQUEST['canceled']) {
48 dba::insert('gcign', array('uid' => local_user(), 'gcid' => $_GET['ignore']));
58 function suggest_content(App $a) {
60 require_once("mod/proxy.php");
64 notice( t('Permission denied.') . EOL);
68 $_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd;
70 $a->page['aside'] .= findpeople_widget();
71 $a->page['aside'] .= follow_widget();
74 $r = GContact::suggestionQuery(local_user());
76 if (! DBM::is_result($r)) {
77 $o .= t('No suggestions available. If this is a new site, please try again in 24 hours.');
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"), 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' => Profile::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' => ContactSelector::networkToName($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,