more directory work
This commit is contained in:
parent
51b51bd039
commit
cb54cda174
1
boot.php
1
boot.php
|
@ -357,3 +357,4 @@ function xmlify($str) {
|
||||||
function hex2bin($s) {
|
function hex2bin($s) {
|
||||||
return(pack("H*",$s));
|
return(pack("H*",$s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,8 @@ function relative_date($posted_date) {
|
||||||
$diff -= $minutes*60;
|
$diff -= $minutes*60;
|
||||||
$seconds = $diff;
|
$seconds = $diff;
|
||||||
|
|
||||||
|
if($months > 2)
|
||||||
|
return(datetime_convert('UTC',date_default_timezone_get(),$posted_date,'\o\n Y-m-d \a\t H:i:s'));
|
||||||
if ($months>0) {
|
if ($months>0) {
|
||||||
// over a month old,
|
// over a month old,
|
||||||
return 'over a month ago';
|
return 'over a month ago';
|
||||||
|
@ -143,3 +144,22 @@ function relative_date($posted_date) {
|
||||||
// show relative date and add proper verbiage
|
// show relative date and add proper verbiage
|
||||||
return $relative_date.' ago';
|
return $relative_date.' ago';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function age($dob,$owner_tz = '',$viewer_tz = '') {
|
||||||
|
if(strlen($dob) != 10)
|
||||||
|
return 0;
|
||||||
|
if(! $owner_tz)
|
||||||
|
$owner_tz = date_default_timezone_get();
|
||||||
|
if(! $viewer_tz)
|
||||||
|
$viewer_tz = date_default_timezone_get();
|
||||||
|
|
||||||
|
$birthdate = datetime_convert('UTC',$owner_tz,$dob . ' 00:00:00+00:00','Y-m-d');
|
||||||
|
list($year,$month,$day) = explode("-",$birthdate);
|
||||||
|
$year_diff = datetime_convert('UTC',$viewer_tz,'now','Y') - $year;
|
||||||
|
$curr_month = datetime_convert('UTC',$viewer_tz,'now','m');
|
||||||
|
$curr_day = datetime_convert('UTC',$viewer_tz,'now','d');
|
||||||
|
|
||||||
|
if(($curr_month < $month) || (($curr_month == $month) && ($curr_day < $day)))
|
||||||
|
$year_diff--;
|
||||||
|
return $year_diff;
|
||||||
|
}
|
||||||
|
|
|
@ -3,14 +3,20 @@
|
||||||
|
|
||||||
function directory_content(&$a) {
|
function directory_content(&$a) {
|
||||||
|
|
||||||
|
$search = ((x($_GET,'search')) ? notags(trim($_GET['search'])) : '');
|
||||||
|
|
||||||
$tpl .= file_get_contents('view/directory_header.tpl');
|
$tpl .= file_get_contents('view/directory_header.tpl');
|
||||||
|
|
||||||
$o .= replace_macros($tpl, array(
|
$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)) {
|
if(count($r)) {
|
||||||
|
|
||||||
$tpl = file_get_contents('view/directory_item.tpl');
|
$tpl = file_get_contents('view/directory_item.tpl');
|
||||||
|
@ -36,8 +42,10 @@ function directory_content(&$a) {
|
||||||
$details .= ', ';
|
$details .= ', ';
|
||||||
$details .= $rr['country-name'];
|
$details .= $rr['country-name'];
|
||||||
}
|
}
|
||||||
if(strlen($rr['dob']))
|
if(strlen($rr['dob'])) {
|
||||||
$details .= '<br />Age: ' ; // . calculate age($rr['dob'])) ;
|
if(($years = age($rr['dob'],$rr['timezone'],'')) != 0)
|
||||||
|
$details .= "<br />Age: $years" ;
|
||||||
|
}
|
||||||
if(strlen($rr['gender']))
|
if(strlen($rr['gender']))
|
||||||
$details .= '<br />Gender: ' . $rr['gender'];
|
$details .= '<br />Gender: ' . $rr['gender'];
|
||||||
|
|
||||||
|
|
|
@ -491,3 +491,12 @@ input#dfrn-url {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#directory-search-wrapper {
|
||||||
|
float: right;
|
||||||
|
margin-right: 20px;
|
||||||
|
margin-bottom: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#directory-search-end {
|
||||||
|
clear: both;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user