From 8c177fbc4b20c297afbd7035dbb5e59d94fb4020 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 18 Mar 2014 16:50:46 -0700 Subject: cleanup --- include/items.php | 28 +++++++++++++++------------- include/reddav.php | 3 ++- include/zot.php | 31 +++++++++++++++++++------------ version.inc | 2 +- 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/include/items.php b/include/items.php index 70e098415..6788ac3da 100755 --- a/include/items.php +++ b/include/items.php @@ -3931,23 +3931,25 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C if(isset($arr['start']) && isset($arr['records'])) $pager_sql = sprintf(" LIMIT %d, %d ",intval($arr['start']), intval($arr['records'])); - if(($arr['cmin'] != 0) || ($arr['cmax'] != 99)) { + if(array_key_exists('cmin',$arr) || array_key_exists('cmax',$arr)) { + if(($arr['cmin'] != 0) || ($arr['cmax'] != 99)) { - // Not everybody who shows up in the network stream will be in your address book. - // By default those that aren't are assumed to have closeness = 99; but this isn't - // recorded anywhere. So if cmax is 99, we'll open the search up to anybody in - // the stream with a NULL address book entry. + // Not everybody who shows up in the network stream will be in your address book. + // By default those that aren't are assumed to have closeness = 99; but this isn't + // recorded anywhere. So if cmax is 99, we'll open the search up to anybody in + // the stream with a NULL address book entry. - $sql_nets .= " AND "; + $sql_nets .= " AND "; - if($arr['cmax'] == 99) - $sql_nets .= " ( "; + if($arr['cmax'] == 99) + $sql_nets .= " ( "; - $sql_nets .= "( abook.abook_closeness >= " . intval($arr['cmin']) . " "; - $sql_nets .= " AND abook.abook_closeness <= " . intval($arr['cmax']) . " ) "; - if($cmax == 99) - $sql_nets .= " OR abook.abook_closeness IS NULL ) "; - } + $sql_nets .= "( abook.abook_closeness >= " . intval($arr['cmin']) . " "; + $sql_nets .= " AND abook.abook_closeness <= " . intval($arr['cmax']) . " ) "; + if($cmax == 99) + $sql_nets .= " OR abook.abook_closeness IS NULL ) "; + } + } $simple_update = (($client_mode & CLIENT_MODE_UPDATE) ? " and ( item.item_flags & " . intval(ITEM_UNSEEN) . " ) " : ''); if($client_mode & CLIENT_MODE_LOAD) diff --git a/include/reddav.php b/include/reddav.php index 1047bdc9e..b7bb94fa0 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -590,9 +590,10 @@ function RedCollectionData($file,&$auth) { if(! $r) { // path wasn't found. Try without permissions to see if it was the result of permissions. $errors = true; - $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and (flags & %d) limit 1", + $r = q("select id, hash, filename, flags from attach where folder = '%s' and filename = '%s' and uid = %d and (flags & %d) limit 1", dbesc($folder), basename($path_arr[$x]), + intval($channel_id), intval(ATTACH_FLAG_DIR) ); if($r) { diff --git a/include/zot.php b/include/zot.php index 934348d2d..d4d77157a 100644 --- a/include/zot.php +++ b/include/zot.php @@ -872,21 +872,28 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) { } // get rid of any hubs we have for this channel which weren't reported. + // This was needed at one time to resolve complicated cross-site inconsistencies, but can cause sync conflict. + // currently disabled. + +// if($xisting) { +// foreach($xisting as $x) { +// if(! array_key_exists('updated',$x)) { +// logger('import_xchan: removing unreferenced hub location ' . $x['hubloc_url']); +// $r = q("delete from hubloc where hubloc_id = %d limit 1", +// intval($x['hubloc_id']) +// ); +// $what .= 'removed_hub'; +// $changed = true; +// } +// } +// } - if($xisting) { - foreach($xisting as $x) { - if(! array_key_exists('updated',$x)) { - logger('import_xchan: removing unreferenced hub location ' . $x['hubloc_url']); - $r = q("delete from hubloc where hubloc_id = %d limit 1", - intval($x['hubloc_id']) - ); - $what .= 'removed_hub'; - $changed = true; - } - } - } } + + + + // Are we a directory server of some kind? if($dirmode != DIRECTORY_MODE_NORMAL) { diff --git a/version.inc b/version.inc index 57151d089..c901375c2 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2014-03-17.619 +2014-03-18.620 -- cgit v1.2.3