aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-07-09 22:47:32 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-07-09 22:47:32 -0700
commitcb54cda17454fde783c165c37d6ece1ba2067253 (patch)
treefbb8ad7380fa713c066b7accd171b55231577d79 /mod
parent51b51bd039d85573cb508c28811df52f198fa210 (diff)
downloadvolse-hubzilla-cb54cda17454fde783c165c37d6ece1ba2067253.tar.gz
volse-hubzilla-cb54cda17454fde783c165c37d6ece1ba2067253.tar.bz2
volse-hubzilla-cb54cda17454fde783c165c37d6ece1ba2067253.zip
more directory work
Diffstat (limited to 'mod')
-rw-r--r--mod/directory.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/mod/directory.php b/mod/directory.php
index 0a7d7355e..aec34f910 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -3,14 +3,20 @@
function directory_content(&$a) {
+ $search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : '');
$tpl .= file_get_contents('view/directory_header.tpl');
$o .= replace_macros($tpl, array(
+ '$search' => $search
));
- $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 ORDER BY `name` ASC");
+ if($search)
+ $search = dbesc($search);
+ $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`employer`,`school`) AGAINST ('$search' IN BOOLEAN MODE) " : "");
+
+ $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 $sql_extra ORDER BY `name` ASC");
if(count($r)) {
$tpl = file_get_contents('view/directory_item.tpl');
@@ -36,8 +42,10 @@ function directory_content(&$a) {
$details .= ', ';
$details .= $rr['country-name'];
}
- if(strlen($rr['dob']))
- $details .= '<br />Age: ' ; // . calculate age($rr['dob'])) ;
+ if(strlen($rr['dob'])) {
+ if(($years = age($rr['dob'],$rr['timezone'],'')) != 0)
+ $details .= "<br />Age: $years" ;
+ }
if(strlen($rr['gender']))
$details .= '<br />Gender: ' . $rr['gender'];