if(local_user()) {
require_once('include/contact_widgets.php');
+ $a->page['aside'] .= follow_widget();
+
$a->page['aside'] .= findpeople_widget();
}
require_once("mod/proxy.php");
if((get_config('system','block_public')) && (! local_user()) && (! remote_user()) ||
- (get_config('system','block_local_dir')) && (! local_user()) && (! remote_user())) {
+ (get_config('system','block_local_dir')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
return;
}
else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
- $tpl = get_markup_template('directory_header.tpl');
-
- $globaldir = '';
- $gdirpath = get_config('system','directory');
- if(strlen($gdirpath)) {
- $globaldir = '<ul><li><div id="global-directory-link"><a href="'
- . zrl($gdirpath,true) . '">' . t('Global Directory') . '</a></div></li></ul>';
+ $gdirpath = '';
+ $dirurl = get_config('system','directory');
+ if(strlen($dirurl)) {
+ $gdirpath = zrl($dirurl,true);
}
- $admin = '';
-
- $o .= replace_macros($tpl, array(
- '$search' => $search,
- '$globaldir' => $globaldir,
- '$desc' => t('Find on this site'),
- '$admin' => $admin,
- '$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
- '$sitedir' => t('Site Directory'),
- '$submit' => t('Find')
- ));
-
if($search) {
$search = dbesc($search);
$about = ((x($profile,'about') == 1) ? t('About:') : False);
- $tpl = get_markup_template('directory_item.tpl');
-
if($a->theme['template_engine'] === 'internal') {
$location_e = template_escape($location);
}
$location_e = $location;
}
- $entry = replace_macros($tpl,array(
- '$id' => $rr['id'],
- '$profile_link' => $profile_link,
- '$photo' => proxy_url($a->get_cached_avatar_image($rr[$photo]), false, PROXY_SIZE_THUMB),
- '$alt_text' => $rr['name'],
- '$name' => $rr['name'],
- '$details' => $pdesc . $details,
- '$page_type' => $page_type,
- '$profile' => $profile,
- '$location' => $location_e,
- '$gender' => $gender,
- '$pdesc' => $pdesc,
- '$marital' => $marital,
- '$homepage' => $homepage,
- '$about' => $about,
-
- ));
+ $entry = array(
+ 'id' => $rr['id'],
+ 'profile_link' => $profile_link,
+ 'photo' => proxy_url($a->get_cached_avatar_image($rr[$photo]), false, PROXY_SIZE_THUMB),
+ 'alt_text' => $rr['name'],
+ 'name' => $rr['name'],
+ 'details' => $pdesc . $details,
+ 'page_type' => $page_type,
+ 'profile' => $profile,
+ 'location' => $location_e,
+ 'gender' => $gender,
+ 'pdesc' => $pdesc,
+ 'marital' => $marital,
+ 'homepage' => $homepage,
+ 'about' => $about,
+
+ );
$arr = array('contact' => $rr, 'entry' => $entry);
unset($profile);
unset($location);
- $o .= $entry;
+ if(! $arr['entry'])
+ continue;
+
+ $entries[] = $arr['entry'];
}
- $o .= "<div class=\"directory-end\" ></div>\r\n";
- $o .= paginate($a);
+ $tpl = get_markup_template('directory_header.tpl');
+
+ $o .= replace_macros($tpl, array(
+ '$search' => $search,
+ '$globaldir' => t('Global Directory'),
+ '$gdirpath' => $gdirpath,
+ '$desc' => t('Find on this site'),
+ '$entries' => $entries,
+ '$finding' => t('Finding:'),
+ '$findterm' => (strlen($search) ? $search : ""),
+ '$title' => t('Site Directory'),
+ '$submit' => t('Find'),
+ '$paginate' => paginate($a),
+ ));
}
else
$o = '';
- $o .= replace_macros(get_markup_template("section_title.tpl"),array(
- '$title' => sprintf( t('People Search - %s'), $search)
- ));
-
if($search) {
if ($local) {
$id = 0;
- $tpl = get_markup_template('match.tpl');
foreach($j->results as $jj) {
// If We already know this contact then don't show the "connect" button
$jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);
- $o .= replace_macros($tpl,array(
- '$url' => zrl($jj->url),
- '$name' => htmlentities($jj->name),
- '$photo' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
- '$tags' => $jj->tags,
- '$conntxt' => $conntxt,
- '$connlnk' => $connlnk,
- '$photo_menu' => $photo_menu,
- '$id' => ++$id,
- ));
+ $entry = array(
+ 'url' => zrl($jj->url),
+ 'name' => htmlentities($jj->name),
+ 'photo' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
+ 'tags' => $jj->tags,
+ 'conntxt' => $conntxt,
+ 'connlnk' => $connlnk,
+ 'photo_menu' => $photo_menu,
+ 'id' => ++$id,
+ );
+ $entries[] = $entry;
}
+
+ $tpl = get_markup_template('match.tpl');
+
+ $o .= replace_macros($tpl,array(
+ 'title' => sprintf( t('People Search - %s'), $search),
+ '$entries' => $entries,
+ '$paginate' => paginate($a),
+ ));
+
}
else {
info( t('No matches') . EOL);
}
- $o .= '<div class="clear"></div>';
- $o .= paginate($a);
return $o;
}
require_once('include/contact_widgets.php');
require_once('mod/proxy.php');
+/**
+ * @brief Controller for /match.
+ *
+ * It takes keywords from your profile and queries the directory server for
+ * matching keywords from other profiles.
+ *
+ * @param App &$a
+ * @return void|string
+ */
function match_content(&$a) {
$o = '';
$_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
- $o .= replace_macros(get_markup_template("section_title.tpl"),array(
- '$title' => t('Profile Match')
- ));
-
$r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
intval(local_user())
);
if(! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) {
notice( t('No keywords to match. Please add keywords to your default profile.') . EOL);
return;
-
}
$params = array();
if(count($j->results)) {
-
-
- $tpl = get_markup_template('match.tpl');
foreach($j->results as $jj) {
$match_nurl = normalise_link($jj->url);
$match = q("SELECT `nurl` FROM `contact` WHERE `uid` = '%d' AND nurl='%s' LIMIT 1",
if (!count($match)) {
$jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);
$connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url;
- $o .= replace_macros($tpl,array(
- '$url' => zrl($jj->url),
- '$name' => $jj->name,
- '$photo' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
- '$inttxt' => ' ' . t('is interested in:'),
- '$conntxt' => t('Connect'),
- '$connlnk' => $connlnk,
- '$tags' => $jj->tags
- ));
+ $entry = array(
+ 'url' => zrl($jj->url),
+ 'name' => $jj->name,
+ 'photo' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
+ 'inttxt' => ' ' . t('is interested in:'),
+ 'conntxt' => t('Connect'),
+ 'connlnk' => $connlnk,
+ 'tags' => $jj->tags
+ );
+ $entries[] = $entry;
}
}
- } else {
+
+ $tpl = get_markup_template('match.tpl');
+
+ $o .= replace_macros($tpl,array(
+ '$title' => t('Profile Match'),
+ 'entries' => $entries,
+ '$paginate' => paginate($a),
+ ));
+
+ }
+ else {
info( t('No matches') . EOL);
}
}
- $o .= cleardiv();
- $o .= paginate($a);
return $o;
}
$a->page['aside'] .= findpeople_widget();
- $o .= replace_macros(get_markup_template("section_title.tpl"),array(
- '$title' => t('Friend Suggestions')
- ));
-
-
$r = suggestion_query(local_user());
if(! count($r)) {
return $o;
}
- $tpl = get_markup_template('suggest_friends.tpl');
-
foreach($r as $rr) {
$connlnk = $a->get_baseurl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);
- $o .= replace_macros($tpl,array(
- '$url' => zrl($rr['url']),
- '$name' => $rr['name'],
- '$photo' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB),
- '$ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'],
- '$ignid' => $rr['id'],
- '$conntxt' => t('Connect'),
- '$connlnk' => $connlnk,
- '$ignore' => t('Ignore/Hide')
- ));
+ $entry = array(
+ 'url' => zrl($rr['url']),
+ 'url_clean' => $rr['url'],
+ 'name' => $rr['name'],
+ 'photo' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB),
+ 'ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['id'],
+ 'ignid' => $rr['id'],
+ 'conntxt' => t('Connect'),
+ 'connlnk' => $connlnk,
+ 'ignore' => t('Ignore/Hide')
+ );
+ $entries[] = $entry;
}
- $o .= cleardiv();
+ $tpl = get_markup_template('suggest_friends.tpl');
+
+ $o .= replace_macros($tpl,array(
+ '$title' => t('Friend Suggestions'),
+ '$entries' => $entries,
+ ));
+
// $o .= paginate($a);
return $o;
}
-<h1>{{$sitedir}}</h1>
+{{include file="section_title.tpl"}}
-{{$globaldir}}
-{{$admin}}
+{{if $gdirpath}}
+ <ul>
+ <li><div id="global-directory-link"><a href="{{$gdirpath}}">{{$globaldir}}</a></div></li>
+ </ul>
+{{/if}}
-{{$finding}}
<div id="directory-search-wrapper">
-<form id="directory-search-form" action="directory" method="get" >
-<span class="dirsearch-desc">{{$desc}}</span>
-<input type="text" name="search" id="directory-search" class="search-input" onfocus="this.select();" value="{{$search|escape:'html'}}" />
-<input type="submit" name="submit" id="directory-search-submit" value="{{$submit|escape:'html'}}" class="button" />
-</form>
+ <form id="directory-search-form" action="directory" method="get" >
+ <span class="dirsearch-desc">{{$desc}}</span>
+ <input type="text" name="search" id="directory-search" class="search-input" onfocus="this.select();" value="{{$search|escape:'html'}}" />
+ <input type="submit" name="submit" id="directory-search-submit" value="{{$submit|escape:'html'}}" class="button" />
+ </form>
</div>
+
+{{if $findterm}}
+ <h4>{{$finding}} '{{$findterm}}'</h4>
+{{/if}}
+
<div id="directory-search-end"></div>
+{{foreach $entries as $entry}}
+ {{include file="directory_item.tpl"}}
+{{/foreach}}
+
+<div class="directory-end" ></div>
+
+{{$paginate}}
-<div class="directory-item lframe" id="directory-item-{{$id}}" >
- <div class="contact-photo-wrapper" id="directory-photo-wrapper-{{$id}}" >
- <div class="contact-photo" id="directory-photo-{{$id}}" >
- <a href="{{$profile_link}}" class="directory-profile-link" id="directory-profile-link-{{$id}}" ><img class="directory-photo-img" src="{{$photo}}" alt="{{$alt_text}}" title="{{$alt_text}}" /></a>
+<div class="directory-item lframe" id="directory-item-{{$entry.id}}" >
+ <div class="contact-photo-wrapper" id="directory-photo-wrapper-{{$entry.id}}" >
+ <div class="contact-photo" id="directory-photo-{{$entry.id}}" >
+ <a href="{{$entry.profile_link}}" class="directory-profile-link" id="directory-profile-link-{{$entry.id}}" >
+ <img class="directory-photo-img" src="{{$entry.photo}}" alt="{{$entry.alt_text}}" title="{{$entry.alt_text}}" />
+ </a>
</div>
</div>
- <div class="contact-name" id="directory-name-{{$id}}">{{$name}}</div>
- <div class="contact-details">{{$details}}</div>
+ <div class="contact-name" id="directory-name-{{$entry.id}}">{{$entry.name}}</div>
+ <div class="contact-details">{{$entry.details}}</div>
</div>
+{{include file="section_title.tpl"}}
+
+{{foreach $entries as $entry}}
+ <div class="profile-match-wrapper">
+ <div class="profile-match-photo" id="contact-entry-photo-{{$entry.id}}"
+ onmouseover="if (typeof t{{$entry.id}} != 'undefined') clearTimeout(t{{$id}}); openMenu('contact-photo-menu-button-{{$entry.id}}')"
+ onmouseout="t{{$entry.id}}=setTimeout('closeMenu(\'contact-photo-menu-button-{{$entry.id}}\'); closeMenu(\'contact-photo-menu-{{$entry.id}}\');',200)" >
+ <a href="{{$entry.url}}">
+ <img width="80" height="80" src="{{$entry.photo}}" alt="{{$entry.name}}" title="{{$entry.name}}[{{$entry.tags}}]" />
+ </a>
+ {{if $entry.photo_menu}}
+ <span onclick="openClose('contact-photo-menu-{{$entry.id}}');" class="fakelink contact-photo-menu-button" id="contact-photo-menu-button-{{$entry.id}}">menu</span>
+ <div class="contact-photo-menu" id="contact-photo-menu-{{$entry.id}}">
+ <ul>
+ {{foreach $entry.photo_menu as $k=>$c}}
+ {{if $c.2}}
+ <li><a class="{{$k}}" target="redir" href="{{$c.1}}">{{$c.0}}</a></li>
+ {{else}}
+ <li><a class="{{$k}}" href="{{$c.1}}">{{$c.0}}</a></li>
+ {{/if}}
+ {{/foreach}}
+ </ul>
+ </div>
+ {{/if}}
+ </div>
+ <div class="profile-match-break"></div>
+ <div class="profile-match-name">
+ <a href="{{$entry.url}}" title="{{$entry.name}}[{{$entry.tags}}]">{{$entry.name}}</a>
+ </div>
+ <div class="profile-match-end"></div>
+ {{if $entry.connlnk}}
+ <div class="profile-match-connect"><a href="{{$entry.connlnk}}" title="{{$entry.conntxt}}">{{$entry.conntxt}}</a></div>
+ {{/if}}
-<div class="profile-match-wrapper">
- <div class="profile-match-photo" id="contact-entry-photo-{{$id}}"
- onmouseover="if (typeof t{{$id}} != 'undefined') clearTimeout(t{{$id}}); openMenu('contact-photo-menu-button-{{$id}}')"
- onmouseout="t{{$id}}=setTimeout('closeMenu(\'contact-photo-menu-button-{{$id}}\'); closeMenu(\'contact-photo-menu-{{$id}}\');',200)" >
- <a href="{{$url}}">
- <img width="80" height="80" src="{{$photo}}" alt="{{$name}}" title="{{$name}}[{{$tags}}]" />
- </a>
- {{if $photo_menu}}
- <span onclick="openClose('contact-photo-menu-{{$id}}');" class="fakelink contact-photo-menu-button" id="contact-photo-menu-button-{{$id}}">menu</span>
- <div class="contact-photo-menu" id="contact-photo-menu-{{$id}}">
- <ul>
- {{foreach $photo_menu as $k=>$c}}
- {{if $c.2}}
- <li><a class="{{$k}}" target="redir" href="{{$c.1}}">{{$c.0}}</a></li>
- {{else}}
- <li><a class="{{$k}}" href="{{$c.1}}">{{$c.0}}</a></li>
- {{/if}}
- {{/foreach}}
- </ul>
- </div>
- {{/if}}
- </div>
- <div class="profile-match-break"></div>
- <div class="profile-match-name">
- <a href="{{$url}}" title="{{$name}}[{{$tags}}]">{{$name}}</a>
</div>
- <div class="profile-match-end"></div>
- {{if $connlnk}}
- <div class="profile-match-connect"><a href="{{$connlnk}}" title="{{$conntxt}}">{{$conntxt}}</a></div>
- {{/if}}
+{{/foreach}}
+
+<div class="clear"></div>
-</div>
+{{$paginate}}
-<div class="profile-match-wrapper">
- <a href="{{$ignlnk}}" title="{{$ignore}}" class="icon drophide profile-match-ignore" onmouseout="imgdull(this);" onmouseover="imgbright(this);" onclick="return confirmDelete();" ></a>
- <div class="profile-match-photo">
- <a href="{{$url}}">
- <img src="{{$photo}}" alt="{{$name}}" width="80" height="80" title="{{$name}} [{{$url}}]" />
- </a>
- </div>
- <div class="profile-match-break"></div>
- <div class="profile-match-name">
- <a href="{{$url}}" title="{{$name}}">{{$name}}</a>
+{{include file="section_title.tpl"}}
+
+{{foreach $entries as $entry}}
+ <div class="profile-match-wrapper">
+ <a href="{{$entry.ignlnk}}" title="{{$entry.ignore}}" class="icon drophide profile-match-ignore" onmouseout="imgdull(this);" onmouseover="imgbright(this);" onclick="return confirmDelete();" ></a>
+ <div class="profile-match-photo">
+ <a href="{{$entry.url}}">
+ <img src="{{$entry.photo}}" alt="{{$entry.name}}" width="80" height="80" title="{{$entry.name}} [{{$entry.url_clean}}]" />
+ </a>
+ </div>
+ <div class="profile-match-break"></div>
+ <div class="profile-match-name">
+ <a href="{{$entry.url}}" title="{{$entry.name}}">{{$entry.name}}</a>
+ </div>
+ <div class="profile-match-end"></div>
+ {{if $entry.connlnk}}
+ <div class="profile-match-connect"><a href="{{$entry.connlnk}}" title="{{$entry.conntxt}}">{{$entry.conntxt}}</a></div>
+ {{/if}}
</div>
- <div class="profile-match-end"></div>
- {{if $connlnk}}
- <div class="profile-match-connect"><a href="{{$connlnk}}" title="{{$conntxt}}">{{$conntxt}}</a></div>
- {{/if}}
-</div>
\ No newline at end of file
+{{/foreach}}
+
+<div class="clear"></div>
-<div class="profile-match-wrapper">
- <div class="profile-match-photo">
- <a href="{{$url}}">
- <img src="{{$photo}}" alt="{{$name}}" width="80" height="80" title="{{$name}} [{{$url}}]" onError="this.src='../../../images/person-48.jpg';" />
- </a>
- </div>
- <div class="profile-match-break"></div>
- <div class="profile-match-name">
- <a href="{{$url}}" title="{{$name}}">{{$name}}</a>
+{{include file="section_title.tpl"}}
+
+{{foreach $entries as $entry}}
+ <div class="profile-match-wrapper">
+ <div class="profile-match-photo">
+ <a href="{{$entry.url}}">
+ <img src="{{$entry.photo}}" alt="{{$entry.name}}" width="80" height="80" title="{{$entry.name}} [{{$entry.url_clean}}]" onError="this.src='../../../images/person-48.jpg';" />
+ </a>
+ </div>
+ <div class="profile-match-break"></div>
+ <div class="profile-match-name">
+ <a href="{{$entry.url}}" title="{{$entry.name}}">{{$entry.name}}</a>
+ </div>
+ <div class="profile-match-end"></div>
+ {{if $entry.connlnk}}
+ <div class="profile-match-connect"><a href="{{$entry.connlnk}}" title="{{$entry.conntxt}}">{{$entry.conntxt}}</a></div>
+ {{/if}}
+ <a href="{{$entry.ignlnk}}" title="{{$entry.ignore}}" class="icon drophide profile-match-ignore" {{*onmouseout="imgdull(this);" onmouseover="imgbright(this);" *}}onclick="return confirmDelete();" ></a>
</div>
- <div class="profile-match-end"></div>
- {{if $connlnk}}
- <div class="profile-match-connect"><a href="{{$connlnk}}" title="{{$conntxt}}">{{$conntxt}}</a></div>
- {{/if}}
- <a href="{{$ignlnk}}" title="{{$ignore}}" class="icon drophide profile-match-ignore" {{*onmouseout="imgdull(this);" onmouseover="imgbright(this);" *}}onclick="return confirmDelete();" ></a>
-</div>
+{{/foreach}}
+
+<div class="clear"></div>
-<div class="profile-match-wrapper">
- <div class="profile-match-photo">
- <a href="{{$url}}">
- <img src="{{$photo}}" alt="{{$name}}" width="80" height="80" title="{{$name}} [{{$url}}]" onError="this.src='../../../images/person-48.jpg';" />
- </a>
- </div>
- <div class="profile-match-break"></div>
- <div class="profile-match-name">
- <a href="{{$url}}" title="{{$name}}">{{$name}}</a>
+{{include file="section_title.tpl"}}
+
+{{foreach $entries as $entry}}
+ <div class="profile-match-wrapper">
+ <div class="profile-match-photo">
+ <a href="{{$entry.url}}">
+ <img src="{{$entry.photo}}" alt="{{$entry.name}}" width="80" height="80" title="{{$entry.name}} [{{$entry.url_clean}}]" onError="this.src='../../../images/person-48.jpg';" />
+ </a>
+ </div>
+ <div class="profile-match-break"></div>
+ <div class="profile-match-name">
+ <a href="{{$entry.url}}" title="{{$entry.name}}">{{$entry.name}}</a>
+ </div>
+ <div class="profile-match-end"></div>
+ {{if $entry.connlnk}}
+ <div class="profile-match-connect"><a href="{{$entry.connlnk}}" title="{{$entry.conntxt}}">{{$entry.conntxt}}</a></div>
+ {{/if}}
+ <a href="{{$entry.ignlnk}}" title="{{$entry.ignore}}" class="icon drophide profile-match-ignore" {{*onmouseout="imgdull(this);" onmouseover="imgbright(this);" *}}onclick="return confirmDelete();" ></a>
</div>
- <div class="profile-match-end"></div>
- {{if $connlnk}}
- <div class="profile-match-connect"><a href="{{$connlnk}}" title="{{$conntxt}}">{{$conntxt}}</a></div>
- {{/if}}
- <a href="{{$ignlnk}}" title="{{$ignore}}" class="icon drophide profile-match-ignore" {{*onmouseout="imgdull(this);" onmouseover="imgbright(this);" *}}onclick="return confirmDelete();" ></a>
-</div>
+{{/foreach}}
+
+<div class="clear"></div>