hidden directory entries

This commit is contained in:
friendica 2013-01-22 00:20:25 -08:00
parent fb76675a28
commit bda4ca4c0d
5 changed files with 24 additions and 8 deletions

View File

@ -266,6 +266,8 @@ define ( 'HUBLOC_FLAGS_PRIMARY', 0x0001);
define ( 'HUBLOC_FLAGS_UNVERIFIED', 0x0002); define ( 'HUBLOC_FLAGS_UNVERIFIED', 0x0002);
define ( 'XCHAN_FLAGS_HIDDEN', 0x0001);
/** /**
* Tag/term types * Tag/term types

View File

@ -531,14 +531,22 @@ function import_xchan($arr) {
dbesc($xchan_hash) dbesc($xchan_hash)
); );
if($r) { if($r) {
if($r[0]['xchan_photo_date'] != $arr['photo_updated']) if($r[0]['xchan_photo_date'] != $arr['photo_updated'])
$update_photos = true; $import_photos = true;
if(($r[0]['xchan_name_date'] != $arr['name_updated']) || ($r[0]['xchan_connurl'] != $arr['connections_url'])) {
$r = q("update xchan set xchan_name = '%s', xchan_name_date = '%s', xchan_connurl = '%s' where xchan_hash = '%s' limit 1", if(($r[0]['xchan_flags'] & XCHAN_FLAGS_HIDDEN) != $arr['searchable'])
$new_flags = $r[0]['xchan_flags'] ^ XCHAN_FLAGS_HIDDEN;
else
$new_flags = $r[0]['xchan_flags'];
if(($r[0]['xchan_name_date'] != $arr['name_updated']) || ($r[0]['xchan_connurl'] != $arr['connections_url']) || ($r[0]['xchan_flags'] != $new_flags)) {
$r = q("update xchan set xchan_name = '%s', xchan_name_date = '%s', xchan_connurl = '%s', xchan_flags = %d where xchan_hash = '%s' limit 1",
dbesc($arr['name']), dbesc($arr['name']),
dbesc($arr['name_updated']), dbesc($arr['name_updated']),
dbesc($arr['connections_url']), dbesc($arr['connections_url']),
intval($new_flags),
dbesc($xchan_hash) dbesc($xchan_hash)
); );
} }

View File

@ -74,12 +74,16 @@ function dirsearch_content(&$a) {
// If &return_total=1, we count matching entries and return that as 'total_items' for use in pagination. // If &return_total=1, we count matching entries and return that as 'total_items' for use in pagination.
// By default we return one page (default 80 items maximum) and do not count total entries // By default we return one page (default 80 items maximum) and do not count total entries
$logic = ((strlen($sql_extra)) ? 0 : 1);
if($limit) if($limit)
$qlimit = " LIMIT $limit "; $qlimit = " LIMIT $limit ";
else { else {
$qlimit = " LIMIT " . intval($startrec) . " , " . intval($perpage); $qlimit = " LIMIT " . intval($startrec) . " , " . intval($perpage);
if($return_total) { if($return_total) {
$r = q("SELECT COUNT(xchan_hash) AS `total` FROM xchan left join xprof on xchan_hash = xprof_hash where 1 $sql_extra"); $r = q("SELECT COUNT(xchan_hash) AS `total` FROM xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and not ( xchan_flags & %d) ",
intval(XCHAN_FLAGS_HIDDEN)
);
if($r) { if($r) {
$ret['total_items'] = $r[0]['total']; $ret['total_items'] = $r[0]['total'];
} }
@ -87,9 +91,10 @@ function dirsearch_content(&$a) {
} }
$order = " ORDER BY `xchan_name` ASC "; $order = " ORDER BY `xchan_name` ASC ";
$logic = ((strlen($sql_extra)) ? 0 : 1);
$r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra $order $qlimit "); $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and not ( xchan_flags & %d ) $order $qlimit ",
intval(XCHAN_FLAGS_HIDDEN)
);
$ret['page'] = $page + 1; $ret['page'] = $page + 1;
$ret['records'] = count($r); $ret['records'] = count($r);

View File

@ -620,7 +620,7 @@ function profiles_content(&$a) {
foreach($r as $rr) { foreach($r as $rr) {
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$photo' => $a->get_cached_avatar_image($rr['thumb']), '$photo' => $rr['thumb'],
'$id' => $rr['id'], '$id' => $rr['id'],
'$alt' => t('Profile Image'), '$alt' => t('Profile Image'),
'$profile_name' => $rr['profile_name'], '$profile_name' => $rr['profile_name'],

View File

@ -72,7 +72,8 @@ function zfinger_init(&$a) {
$id = $e['channel_id']; $id = $e['channel_id'];
$searchable = (($e['channel_pageflags'] & PAGE_HIDDEN) ? false : true); $searchable = (($e['channel_pageflags'] & PAGE_HIDDEN) ? false : true);
if($e['xchan_flags'] & XCHAN_FLAGS_HIDDEN)
$searchable = false;
// This is for birthdays and keywords, but must check access permissions // This is for birthdays and keywords, but must check access permissions