2 include_once('include/text.php');
3 require_once('include/socgraph.php');
4 require_once('include/contact_widgets.php');
5 require_once('mod/proxy.php');
8 * @brief Controller for /match.
10 * It takes keywords from your profile and queries the directory server for
11 * matching keywords from other profiles.
16 if(! function_exists('match_content')) {
17 function match_content(&$a) {
23 $a->page['aside'] .= findpeople_widget();
24 $a->page['aside'] .= follow_widget();
26 $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
28 $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
33 if(! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) {
34 notice( t('No keywords to match. Please add keywords to your default profile.') . EOL);
39 $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']);
43 if($a->pager['page'] != 1)
44 $params['p'] = $a->pager['page'];
46 if(strlen(get_config('system','directory')))
47 $x = post_url(get_server().'/msearch', $params);
49 $x = post_url($a->get_baseurl() . '/msearch', $params);
54 $a->set_pager_total($j->total);
55 $a->set_pager_itemspage($j->items_page);
58 if(count($j->results)) {
62 foreach($j->results as $jj) {
63 $match_nurl = normalise_link($jj->url);
64 $match = q("SELECT `nurl` FROM `contact` WHERE `uid` = '%d' AND nurl='%s' LIMIT 1",
69 $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);
70 $connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url;
71 $photo_menu = array(array(t("View Profile"), zrl($jj->url)));
72 $photo_menu[] = array(t("Connect/Follow"), $connlnk);
74 $contact_details = get_contact_details_by_url($jj->url, local_user());
77 'url' => zrl($jj->url),
78 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $jj->url),
80 'details' => $contact_details['location'],
81 'tags' => $contact_details['keywords'],
82 'about' => $contact_details['about'],
83 'account_type' => (($contact_details['community']) ? t('Forum') : ''),
84 'thumb' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
85 'inttxt' => ' ' . t('is interested in:'),
86 'conntxt' => t('Connect'),
87 'connlnk' => $connlnk,
88 'img_hover' => $jj->tags,
89 'photo_menu' => $photo_menu,
96 $tpl = get_markup_template('viewcontact_template.tpl');
98 $o .= replace_macros($tpl,array(
99 '$title' => t('Profile Match'),
100 '$contacts' => $entries,
101 '$paginate' => paginate($a),
106 info( t('No matches') . EOL);