Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge

This commit is contained in:
zotlabs 2017-04-07 14:56:53 -07:00
commit 2ebf76cd50
5 changed files with 11979 additions and 12476 deletions

View File

@ -310,8 +310,6 @@ function zot_refresh($them, $channel = null, $force = false) {
$result = z_post_url($url . $rhs,$postvars); $result = z_post_url($url . $rhs,$postvars);
logger('zot_refresh: zot-info: ' . print_r($result,true), LOGGER_DATA, LOG_DEBUG);
if ($result['success']) { if ($result['success']) {
$j = json_decode($result['body'],true); $j = json_decode($result['body'],true);
@ -321,6 +319,8 @@ function zot_refresh($them, $channel = null, $force = false) {
return false; return false;
} }
logger('zot-info: ' . print_r($result,true), LOGGER_DATA, LOG_DEBUG);
$signed_token = ((is_array($j) && array_key_exists('signed_token',$j)) ? $j['signed_token'] : null); $signed_token = ((is_array($j) && array_key_exists('signed_token',$j)) ? $j['signed_token'] : null);
if($signed_token) { if($signed_token) {
$valid = rsa_verify('token.' . $token,base64url_decode($signed_token),$j['key']); $valid = rsa_verify('token.' . $token,base64url_decode($signed_token),$j['key']);
@ -3585,7 +3585,9 @@ function import_author_zot($x) {
// of a hassle to repair. If either or both are missing, do a full discovery probe. // of a hassle to repair. If either or both are missing, do a full discovery probe.
$hash = make_xchan_hash($x['guid'],$x['guid_sig']); $hash = make_xchan_hash($x['guid'],$x['guid_sig']);
$r1 = q("select hubloc_url from hubloc where hubloc_guid = '%s' and hubloc_guid_sig = '%s' and hubloc_primary = 1 limit 1",
$r1 = q("select hubloc_url, hubloc_updated, site_dead from hubloc left join site on
hubloc_url = site_url where hubloc_guid = '%s' and hubloc_guid_sig = '%s' and hubloc_primary = 1 limit 1",
dbesc($x['guid']), dbesc($x['guid']),
dbesc($x['guid_sig']) dbesc($x['guid_sig'])
); );
@ -3595,12 +3597,42 @@ function import_author_zot($x) {
dbesc($x['guid_sig']) dbesc($x['guid_sig'])
); );
$site_dead = false;
if($r1 && intval($r1[0]['site_dead'])) {
$site_dead = true;
}
// We have valid and somewhat fresh information.
if($r1 && $r2 && $r1[0]['hubloc_updated'] > datetime_convert('UTC','UTC','now - 1 week')) { if($r1 && $r2 && $r1[0]['hubloc_updated'] > datetime_convert('UTC','UTC','now - 1 week')) {
logger('in cache', LOGGER_DEBUG); logger('in cache', LOGGER_DEBUG);
return $hash; return $hash;
} }
logger('not in cache - probing: ' . print_r($x,true), LOGGER_DEBUG); logger('not in cache or cache stale - probing: ' . print_r($x,true), LOGGER_DEBUG,LOG_INFO);
// The primary hub may be dead. Try to find another one associated with this identity that is
// still alive. If we find one, use that url for the discovery/refresh probe. Otherwise, the dead site
// is all we have and there is no point probing it. Just return the hash indicating we have a
// cached entry and the identity is valid. It's just unreachable until they bring back their
// server from the grave or create another clone elsewhere.
if($site_dead) {
logger('dead site - ignoring', LOGGER_DEBUG,LOG_INFO);
$r = q("select hubloc_url from hubloc left join site on hubloc_url = site_url
where hubloc_hash = '%s' and site_dead = 0",
dbesc($hash)
);
if($r) {
logger('found another site that is not dead: ' . $r[0]['hubloc_url'], LOGGER_DEBUG,LOG_INFO);
$x['url'] = $r[0]['hubloc_url'];
}
else {
return $hash;
}
}
$them = array('hubloc_url' => $x['url'], 'xchan_guid' => $x['guid'], 'xchan_guid_sig' => $x['guid_sig']); $them = array('hubloc_url' => $x['url'], 'xchan_guid' => $x['guid'], 'xchan_guid_sig' => $x['guid_sig']);
if(zot_refresh($them)) if(zot_refresh($them))

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
<div id="side-bar-photos-albums" class="widget"> <div id="side-bar-photos-albums" class="widget">
<h3>{{$title}}</h3> <h3>{{$title}}</h3>
<ul class="nav nav-pills flex-column"> <ul class="nav nav-pills flex-column">
<li class="nav-item"><a class="nav-link" href="{{$baseurl}}/photos/{{$nick}}" title="{{$title}}" >{{$recent_photos}}</a></li> <li class="nav-item"><a class="nav-link" href="{{$baseurl}}/photos/{{$nick}}" title="{{$title}}" >{{$recent}}</a></li>
{{if $albums}} {{if $albums}}
{{foreach $albums as $al}} {{foreach $albums as $al}}
{{if $al.shorttext}} {{if $al.shorttext}}

View File

@ -7,26 +7,18 @@
<button type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-cog"></i>&nbsp;{{$tools_label}} <i class="fa fa-cog"></i>&nbsp;{{$tools_label}}
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <div class="dropdown-menu dropdown-menu-right flex-column">
{{if $tools}} {{if $tools}}
<li class="nav-item"> <a class="dropdown-item" href="{{$tools.profile.0}}"><i class="fa fa-user"></i>&nbsp;{{$tools.profile.1}}</a>
<a class="nav-link" href="{{$tools.profile.0}}"><i class="fa fa-user"></i>&nbsp;{{$tools.profile.1}}</a> <a class="dropdown-item" href="{{$tools.cover.0}}"><i class="fa fa-picture-o"></i>&nbsp;{{$tools.cover.1}}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{$tools.cover.0}}"><i class="fa fa-picture-o"></i>&nbsp;{{$tools.cover.1}}</a>
</li>
{{/if}} {{/if}}
{{if $map}} {{if $map}}
<li class="nav-item"> <a class="dropdown-item" href="#" onclick="var pos = $('#photo-map').css('position'); if(pos === 'absolute') { $('#photo-map').css( { position: 'relative', left: 'auto', top: 'auto' }); } else { $('#photo-map').css( { position: 'absolute', left: '-9999px', top: '-9999px' }); } return false; " ><i class="fa fa-globe"></i>&nbsp;{{$map_text}}</a>
<a class="nav-link" href="#" onclick="var pos = $('#photo-map').css('position'); if(pos === 'absolute') { $('#photo-map').css( { position: 'relative', left: 'auto', top: 'auto' }); } else { $('#photo-map').css( { position: 'absolute', left: '-9999px', top: '-9999px' }); } return false; " ><i class="fa fa-globe"></i>&nbsp;{{$map_text}}</a>
</li>
{{/if}} {{/if}}
{{if $edit}} {{if $edit}}
<li class="nav-item"> <a class="dropdown-item acl-form-trigger" href="#" title="" onclick="openClose('photo-edit'); return false;" data-form_id="photo_edit_form"><i class="fa fa-pencil"></i>&nbsp;{{$edit.edit}}</a>
<a class="nav-link acl-form-trigger" href="#" title="" onclick="openClose('photo-edit'); return false;" data-form_id="photo_edit_form"><i class="fa fa-pencil"></i>&nbsp;{{$edit.edit}}</a>
</li>
{{/if}} {{/if}}
</ul> </div>
</div> </div>
{{/if}} {{/if}}
{{if $lock}} {{if $lock}}