5 require_once('include/text.php');
6 require_once('include/socgraph.php');
7 require_once('include/contact_widgets.php');
8 require_once('mod/proxy.php');
11 * @brief Controller for /match.
13 * It takes keywords from your profile and queries the directory server for
14 * matching keywords from other profiles.
19 function match_content(App $a) {
26 $a->page['aside'] .= findpeople_widget();
27 $a->page['aside'] .= follow_widget();
29 $_SESSION['return_url'] = App::get_baseurl() . '/' . $a->cmd;
31 $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
34 if (! dbm::is_result($r)) {
37 if(! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) {
38 notice( t('No keywords to match. Please add keywords to your default profile.') . EOL);
43 $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']);
47 if($a->pager['page'] != 1)
48 $params['p'] = $a->pager['page'];
50 if(strlen(get_config('system','directory')))
51 $x = post_url(get_server().'/msearch', $params);
53 $x = post_url(App::get_baseurl() . '/msearch', $params);
58 $a->set_pager_total($j->total);
59 $a->set_pager_itemspage($j->items_page);
62 if(count($j->results)) {
66 foreach($j->results as $jj) {
67 $match_nurl = normalise_link($jj->url);
68 $match = q("SELECT `nurl` FROM `contact` WHERE `uid` = '%d' AND nurl='%s' LIMIT 1",
73 $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);
74 $connlnk = App::get_baseurl() . '/follow/?url=' . $jj->url;
76 'profile' => array(t("View Profile"), zrl($jj->url)),
77 'follow' => array(t("Connect/Follow"), $connlnk)
80 $contact_details = get_contact_details_by_url($jj->url, local_user());
83 'url' => zrl($jj->url),
84 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $jj->url),
86 'details' => $contact_details['location'],
87 'tags' => $contact_details['keywords'],
88 'about' => $contact_details['about'],
89 'account_type' => account_type($contact_details),
90 'thumb' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
91 'inttxt' => ' ' . t('is interested in:'),
92 'conntxt' => t('Connect'),
93 'connlnk' => $connlnk,
94 'img_hover' => $jj->tags,
95 'photo_menu' => $photo_menu,
102 $tpl = get_markup_template('viewcontact_template.tpl');
104 $o .= replace_macros($tpl,array(
105 '$title' => t('Profile Match'),
106 '$contacts' => $entries,
107 '$paginate' => paginate($a),
112 info( t('No matches') . EOL);