Merge branch 'dev' of /home/macgirvin/z into dev

This commit is contained in:
nobody 2021-02-13 14:40:51 -08:00
commit 96c5b7b93e
3 changed files with 28 additions and 8 deletions

View file

@ -131,6 +131,7 @@ class Onepoll {
$url = ((array_key_exists('outbox',$cl)) ? $cl['outbox'] : '');
if ($url) {
logger('fetching outbox');
$url = $url . '?date_begin=' . urlencode($last_update);
$obj = new ASCollection($url, $importer, 0, $max);
$messages = $obj->get();
if ($messages) {

View file

@ -240,16 +240,28 @@ class Activity {
$numpages = $total / App::$pager['itemspage'];
$lastpage = (($numpages > intval($numpages)) ? intval($numpages) + 1 : $numpages);
$stripped = preg_replace('/([&|\?]page=[0-9]*)/','',$id);
$stripped = rtrim($stripped,'/');
$url_parts = parse_url($id);
$ret['partOf'] = z_root() . '/' . $stripped;
$ret['partOf'] = z_root() . '/' . $url_parts['path'];
$extra_query_args = '';
$query_args = null;
if (isset($url_parts['query'])) {
parse_str($url_parts['query'], $query_args);
}
if (is_array($query_args)) {
unset($query_args['page']);
foreach ($query_args as $k => $v) {
$extra_query_args .= '&' . urlencode($k) . '=' . urlencode($v);
}
}
if (App::$pager['page'] < $lastpage) {
$ret['next'] = z_root() . '/' . $stripped . '?page=' . (intval(App::$pager['page']) + 1);
$ret['next'] = z_root() . '/' . $url_parts['path'] . '?page=' . (intval(App::$pager['page']) + 1) . $extra_query_args;
}
if (App::$pager['page'] > 1) {
$ret['prev'] = z_root() . '/' . $stripped . '?page=' . (intval(App::$pager['page']) - 1);
$ret['prev'] = z_root() . '/' . $url_parts['path'] . '?page=' . (intval(App::$pager['page']) - 1) . $extra_query_args;
}
}
else {

View file

@ -2192,14 +2192,16 @@ class Libzot {
// logger($AS->debug());
$r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' limit 1",
dbesc($AS->actor['id'])
$r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' or hubloc_hash = '%s' limit 1",
dbesc($AS->actor['id']),
dbesc($AS->actor['id'])
);
if (! $r) {
$y = import_author_xchan([ 'url' => $AS->actor['id'] ]);
if ($y) {
$r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' limit 1",
$r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' or hubloc_hash = '%s' limit 1",
dbesc($AS->actor['id']),
dbesc($AS->actor['id'])
);
}
@ -3354,6 +3356,11 @@ class Libzot {
);
}
// this site obviously isn't dead because they are trying to communicate with us.
q("update site set site_dead = 0 where site_dead = 1 and site_url = '%s' ",
dbesc($hub['hubloc_url'])
);
return $hub['hubloc_url'];
}