aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-01-20 20:17:50 +0000
committerMario <mario@mariovavti.com>2021-01-20 20:17:50 +0000
commitb242347fa1d41695edcdc378a2403b1621303da2 (patch)
tree6e800d8a5d5b53f4552f620b1f7435b03e38042e /include
parent4e9d8e1a8342d7ae603a3d6caf714ce8b43b00ac (diff)
downloadvolse-hubzilla-b242347fa1d41695edcdc378a2403b1621303da2.tar.gz
volse-hubzilla-b242347fa1d41695edcdc378a2403b1621303da2.tar.bz2
volse-hubzilla-b242347fa1d41695edcdc378a2403b1621303da2.zip
onepoll via zot6 to /zotfeed which implements an outbox
Diffstat (limited to 'include')
-rwxr-xr-xinclude/items.php20
-rw-r--r--include/network.php29
2 files changed, 45 insertions, 4 deletions
diff --git a/include/items.php b/include/items.php
index bfca354d1..5b9bbd1f9 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4562,9 +4562,11 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
// only setup pagination on initial page view
$pager_sql = '';
} else {
- $itemspage = (($channel) ? get_pconfig($uid,'system','itemspage') : 10);
- App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 10));
- $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
+ if(! $arr['total']) {
+ $itemspage = (($channel) ? get_pconfig($uid,'system','itemspage') : 20);
+ App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
+ $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
+ }
}
if (isset($arr['start']) && isset($arr['records']))
@@ -4613,6 +4615,18 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
// "New Item View" - show all items unthreaded in reverse created date order
+ if ($arr['total']) {
+ $items = q("SELECT count(item.id) AS total FROM item
+ WHERE $item_uids $item_restrict
+ $simple_update
+ $sql_extra $sql_nets $sql_extra3"
+ );
+ if ($items) {
+ return intval($items[0]['total']);
+ }
+ return 0;
+ }
+
$items = q("SELECT item.*, item.id AS item_id FROM item
WHERE $item_uids $item_restrict
$simple_update
diff --git a/include/network.php b/include/network.php
index 324a99eba..f5ff48fce 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1,8 +1,10 @@
<?php
+use Zotlabs\Lib\LDSignatures;
use Zotlabs\Lib\Zotfinger;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Queue;
+use Zotlabs\Web\HTTPSig;
/**
* @file include/network.php
@@ -404,6 +406,31 @@ function json_return_and_die($x, $content_type = 'application/json') {
killme();
}
+function as_return_and_die($obj,$channel) {
+
+ $x = array_merge(['@context' => [
+ ACTIVITYSTREAMS_JSONLD_REV,
+ 'https://w3id.org/security/v1',
+ z_root() . ZOT_APSCHEMA_REV
+ ]], $obj );
+
+ $headers = [];
+ $headers['Content-Type'] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ;
+ $x['signature'] = LDSignatures::sign($x,$channel);
+ $ret = json_encode($x, JSON_UNESCAPED_SLASHES);
+ logger('data: ' . jindent($ret), LOGGER_DATA);
+ $headers['Date'] = datetime_convert('UTC','UTC', 'now', 'D, d M Y H:i:s \\G\\M\\T');
+ $headers['Digest'] = HTTPSig::generate_digest_header($ret);
+ $headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
+
+ $h = HTTPSig::create_sig($headers,$channel['channel_prvkey'],channel_url($channel));
+ HTTPSig::set_headers($h);
+
+ echo $ret;
+ killme();
+
+}
+
/**
* @brief Send HTTP status header.
*
@@ -1978,7 +2005,7 @@ function getBestSupportedMimeType($mimeTypes = null, $acceptedTypes = false) {
// check if there is a different quality
if (strpos($a, ';q=')) {
// divide "mime/type;q=X" into two parts: "mime/type" i "X"
- list($a, $q) = explode(';q=', $a);
+ [$a, $q] = explode(';q=', $a);
}
// mime-type $a is accepted with the quality $q
// WARNING: $q == 0 means, that mime-type isn’t supported!