directory client mode
This commit is contained in:
parent
af5666b791
commit
a168c628a2
@ -38,90 +38,80 @@ function directory_content(&$a) {
|
|||||||
|
|
||||||
$dirmode = intval(get_config('system','directory_mode'));
|
$dirmode = intval(get_config('system','directory_mode'));
|
||||||
|
|
||||||
// if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
|
if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
|
||||||
// $localdir = true;
|
$url = z_root() . '/dirsearch';
|
||||||
// return;
|
}
|
||||||
// }
|
if(! $url) {
|
||||||
|
|
||||||
// FIXME
|
|
||||||
$localdir = true;
|
|
||||||
|
|
||||||
|
|
||||||
if(! $localdir) {
|
|
||||||
$directory = find_upstream_directory($dirmode);
|
$directory = find_upstream_directory($dirmode);
|
||||||
|
|
||||||
if($directory) {
|
if($directory) {
|
||||||
$url = $directory['url'];
|
$url = $directory['url'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$url = DIRECTORY_FALLBACK_MASTER . '/post';
|
$url = DIRECTORY_FALLBACK_MASTER . '/dirsearch';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($url) {
|
||||||
|
$query = $url . ' ?f=' ;
|
||||||
if($localdir) {
|
|
||||||
if($search)
|
if($search)
|
||||||
$search = dbesc($search);
|
$query .= '$name=' . urlencode($search);
|
||||||
$sql_extra = ((strlen($search)) ? " AND MATCH ( xchan_name, xchan_addr, xprof_desc, xprof_locale, xprof_region, xprof_country, xprof_gender, xprof_marital ) AGAINST ('$search' IN BOOLEAN MODE) " : "");
|
|
||||||
|
|
||||||
// group_concat(xtag_term separator ', ') as tags
|
}
|
||||||
$r = q("SELECT COUNT(xchan_hash) AS `total` FROM xchan left join xprof on xchan_hash = xprof_hash $sql_extra");
|
if($a->pager['page'] != 1)
|
||||||
if($r)
|
$query .= '&p=' . $a->pager['page'];
|
||||||
$a->set_pager_total($r[0]['total']);
|
|
||||||
|
|
||||||
$order = " ORDER BY `xchan_name` ASC ";
|
|
||||||
|
|
||||||
|
|
||||||
$r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash $sql_extra $order LIMIT %d , %d ",
|
$x = z_fetch_url($query);
|
||||||
intval($a->pager['start']),
|
if($x['success']) {
|
||||||
intval($a->pager['itemspage'])
|
$t = 0;
|
||||||
);
|
$j = json_decode($x['body'],true);
|
||||||
|
if($j && $j['results']) {
|
||||||
|
|
||||||
if($r) {
|
|
||||||
|
|
||||||
$entries = array();
|
$entries = array();
|
||||||
|
|
||||||
$photo = 'thumb';
|
$photo = 'thumb';
|
||||||
|
|
||||||
foreach($r as $rr) {
|
foreach($j['results'] as $rr) {
|
||||||
|
|
||||||
$profile_link = chanlink_hash($rr['xchan_hash']);
|
|
||||||
|
|
||||||
$pdesc = (($rr['xprof_desc']) ? $rr['xprof_desc'] . '<br />' : '');
|
|
||||||
|
|
||||||
|
$profile_link = chanlink_url($rr['url']);
|
||||||
|
|
||||||
|
$pdesc = (($rr['description']) ? $rr['description'] . '<br />' : '');
|
||||||
|
|
||||||
$details = '';
|
$details = '';
|
||||||
if(strlen($rr['xprof_locale']))
|
if(strlen($rr['locale']))
|
||||||
$details .= $rr['xprof_locale'];
|
$details .= $rr['locale'];
|
||||||
if(strlen($rr['xprof_region'])) {
|
if(strlen($rr['region'])) {
|
||||||
if(strlen($rr['xprof_locale']))
|
if(strlen($rr['locale']))
|
||||||
$details .= ', ';
|
$details .= ', ';
|
||||||
$details .= $rr['xprof_region'];
|
$details .= $rr['region'];
|
||||||
}
|
}
|
||||||
if(strlen($rr['xprof_country'])) {
|
if(strlen($rr['country'])) {
|
||||||
if(strlen($details))
|
if(strlen($details))
|
||||||
$details .= ', ';
|
$details .= ', ';
|
||||||
$details .= $rr['xprof_country'];
|
$details .= $rr['country'];
|
||||||
}
|
}
|
||||||
if(strlen($rr['xprof_dob'])) {
|
if(strlen($rr['birthday'])) {
|
||||||
if(($years = age($rr['xprof_dob'],'UTC','')) != 0)
|
if(($years = age($rr['birthday'],'UTC','')) != 0)
|
||||||
$details .= '<br />' . t('Age: ') . $years ;
|
$details .= '<br />' . t('Age: ') . $years ;
|
||||||
}
|
}
|
||||||
if(strlen($rr['xprof_gender']))
|
if(strlen($rr['gender']))
|
||||||
$details .= '<br />' . t('Gender: ') . $rr['xprof_gender'];
|
$details .= '<br />' . t('Gender: ') . $rr['gender'];
|
||||||
|
|
||||||
$page_type = '';
|
$page_type = '';
|
||||||
|
|
||||||
$profile = $rr;
|
$profile = $rr;
|
||||||
|
|
||||||
if ((x($profile,'xprof_locale') == 1)
|
if ((x($profile,'locale') == 1)
|
||||||
|| (x($profile,'xprof_region') == 1)
|
|| (x($profile,'region') == 1)
|
||||||
|| (x($profile,'xprof_postcode') == 1)
|
|| (x($profile,'postcode') == 1)
|
||||||
|| (x($profile,'xprof_country') == 1))
|
|| (x($profile,'country') == 1))
|
||||||
$location = t('Location:');
|
$location = t('Location:');
|
||||||
|
|
||||||
$gender = ((x($profile,'xprof_gender') == 1) ? t('Gender:') : False);
|
$gender = ((x($profile,'gender') == 1) ? t('Gender:') : False);
|
||||||
|
|
||||||
$marital = ((x($profile,'marital') == 1) ? t('Status:') : False);
|
$marital = ((x($profile,'marital') == 1) ? t('Status:') : False);
|
||||||
|
|
||||||
@ -129,14 +119,13 @@ $localdir = true;
|
|||||||
|
|
||||||
$about = ((x($profile,'about') == 1) ? t('About:') : False);
|
$about = ((x($profile,'about') == 1) ? t('About:') : False);
|
||||||
|
|
||||||
$t = 0;
|
|
||||||
|
|
||||||
$entry = array(
|
$entry = array(
|
||||||
'id' => ++$t,
|
'id' => ++$t,
|
||||||
'profile_link' => $profile_link,
|
'profile_link' => $profile_link,
|
||||||
'photo' => $rr[xchan_photo_m],
|
'photo' => $rr['photo'],
|
||||||
'alttext' => $rr['xchan_name'],
|
'alttext' => $rr['name'] . ' ' . $rr['address'],
|
||||||
'name' => $rr['xchan_name'],
|
'name' => $rr['name'],
|
||||||
'details' => $pdesc . $details,
|
'details' => $pdesc . $details,
|
||||||
'profile' => $profile,
|
'profile' => $profile,
|
||||||
'location' => $location,
|
'location' => $location,
|
||||||
@ -152,10 +141,11 @@ $localdir = true;
|
|||||||
|
|
||||||
call_hooks('directory_item', $arr);
|
call_hooks('directory_item', $arr);
|
||||||
|
|
||||||
|
$entries[] = $entry;
|
||||||
|
|
||||||
unset($profile);
|
unset($profile);
|
||||||
unset($location);
|
unset($location);
|
||||||
|
|
||||||
$entries[] = $entry;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +162,7 @@ $localdir = true;
|
|||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
$o .= paginate($a);
|
$o .= alt_pager($a,$j['records']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,3 +173,4 @@ $localdir = true;
|
|||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ function dirsearch_content(&$a) {
|
|||||||
$marital = ((x($_REQUEST,'marital')) ? $_REQUEST['marital'] : '');
|
$marital = ((x($_REQUEST,'marital')) ? $_REQUEST['marital'] : '');
|
||||||
$keywords = ((x($_REQUEST,'keywords')) ? $_REQUEST['keywords'] : '');
|
$keywords = ((x($_REQUEST,'keywords')) ? $_REQUEST['keywords'] : '');
|
||||||
|
|
||||||
|
|
||||||
$sql_extra = '';
|
$sql_extra = '';
|
||||||
|
|
||||||
if($name)
|
if($name)
|
||||||
|
Reference in New Issue
Block a user