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 function match_content(App &$a) {
23 $a->page['aside'] .= findpeople_widget();
24 $a->page['aside'] .= follow_widget();
26 $_SESSION['return_url'] = App::get_baseurl() . '/' . $a->cmd;
28 $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
31 if (! dbm::is_result($r)) {
34 if(! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) {
35 notice( t('No keywords to match. Please add keywords to your default profile.') . EOL);
40 $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']);
44 if($a->pager['page'] != 1)
45 $params['p'] = $a->pager['page'];
47 if(strlen(get_config('system','directory')))
48 $x = post_url(get_server().'/msearch', $params);
50 $x = post_url(App::get_baseurl() . '/msearch', $params);
55 $a->set_pager_total($j->total);
56 $a->set_pager_itemspage($j->items_page);
59 if(count($j->results)) {
63 foreach($j->results as $jj) {
64 $match_nurl = normalise_link($jj->url);
65 $match = q("SELECT `nurl` FROM `contact` WHERE `uid` = '%d' AND nurl='%s' LIMIT 1",
70 $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);
71 $connlnk = App::get_baseurl() . '/follow/?url=' . $jj->url;
73 'profile' => array(t("View Profile"), zrl($jj->url)),
74 'follow' => array(t("Connect/Follow"), $connlnk)
77 $contact_details = get_contact_details_by_url($jj->url, local_user());
80 'url' => zrl($jj->url),
81 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $jj->url),
83 'details' => $contact_details['location'],
84 'tags' => $contact_details['keywords'],
85 'about' => $contact_details['about'],
86 'account_type' => account_type($contact_details),
87 'thumb' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
88 'inttxt' => ' ' . t('is interested in:'),
89 'conntxt' => t('Connect'),
90 'connlnk' => $connlnk,
91 'img_hover' => $jj->tags,
92 'photo_menu' => $photo_menu,
99 $tpl = get_markup_template('viewcontact_template.tpl');
101 $o .= replace_macros($tpl,array(
102 '$title' => t('Profile Match'),
103 '$contacts' => $entries,
104 '$paginate' => paginate($a),
109 info( t('No matches') . EOL);