aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/NativeWiki.php11
-rw-r--r--Zotlabs/Web/HTTPSig.php12
-rwxr-xr-xinclude/dba/dba_pdo.php4
3 files changed, 21 insertions, 6 deletions
diff --git a/Zotlabs/Lib/NativeWiki.php b/Zotlabs/Lib/NativeWiki.php
index 7642dbb3e..6f916216e 100644
--- a/Zotlabs/Lib/NativeWiki.php
+++ b/Zotlabs/Lib/NativeWiki.php
@@ -171,16 +171,23 @@ class NativeWiki {
dbesc(NWIKI_ITEM_RESOURCE_TYPE),
dbesc($resource_id)
);
+
if($r) {
$q = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s'",
- dbesc($r[0]['resource_type'])
+ dbesc($r[0]['resource_id'])
);
if($q) {
$r = array_merge($r,$q);
}
xchan_query($r);
$sync_item = fetch_post_tags($r);
- build_sync_packet($uid,array('wiki' => array(encode_item($sync_item[0],true))));
+ if($sync_item) {
+ $pkt = [];
+ foreach($sync_item as $w) {
+ $pkt[] = encode_item($w,true);
+ }
+ build_sync_packet($uid,array('wiki' => $pkt));
+ }
}
}
diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php
index 9bcc2e5ec..255511ede 100644
--- a/Zotlabs/Web/HTTPSig.php
+++ b/Zotlabs/Web/HTTPSig.php
@@ -59,6 +59,8 @@ class HTTPSig {
$headers['(request-target)'] =
strtolower($_SERVER['REQUEST_METHOD']) . ' ' .
$_SERVER['REQUEST_URI'];
+ $headers['content-type'] = $_SERVER['CONTENT_TYPE'];
+
foreach($_SERVER as $k => $v) {
if(strpos($k,'HTTP_') === 0) {
$field = str_replace('_','-',strtolower(substr($k,5)));
@@ -67,6 +69,10 @@ class HTTPSig {
}
}
+ // logger('SERVER: ' . print_r($_SERVER,true), LOGGER_ALL);
+
+ // logger('headers: ' . print_r($headers,true), LOGGER_ALL);
+
$sig_block = null;
if(array_key_exists('signature',$headers)) {
@@ -194,10 +200,10 @@ class HTTPSig {
if($r) {
$j = json_decode($r,true);
- if($j['id'] !== $id)
- return false;
-
if(array_key_exists('publicKey',$j) && array_key_exists('publicKeyPem',$j['publicKey'])) {
+ if((array_key_exists('id',$j['publicKey']) && $j['publicKey']['id'] !== $id) && $j['id'] !== $id)
+ return false;
+
return($j['publicKey']['publicKeyPem']);
}
}
diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php
index f24c5381a..5002f53e7 100755
--- a/include/dba/dba_pdo.php
+++ b/include/dba/dba_pdo.php
@@ -100,7 +100,9 @@ class dba_pdo extends dba_driver {
if($this->debug) {
db_logger('dba_pdo: DEBUG: ' . printable($sql) . ' returned ' . count($r) . ' results.', LOGGER_NORMAL, LOG_INFO);
- db_logger('dba_pdo: ' . printable(print_r($r,true)), LOGGER_NORMAL, LOG_INFO);
+ if(intval($this->debug) > 1) {
+ db_logger('dba_pdo: ' . printable(print_r($r,true)), LOGGER_NORMAL, LOG_INFO);
+ }
}
return (($this->error) ? false : $r);