aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2022-10-23 14:02:19 +0200
committerMario Vavti <mario@mariovavti.com>2022-10-23 14:02:19 +0200
commit8879776d6436ed5257648a1873ddaa9486b25070 (patch)
tree996c192607ed8b1a4b03bd620deb4b1f3b348a48 /Zotlabs/Lib
parent5edd13c6bb89c7434d8437f8cc74c038371fdbf8 (diff)
downloadvolse-hubzilla-8879776d6436ed5257648a1873ddaa9486b25070.tar.gz
volse-hubzilla-8879776d6436ed5257648a1873ddaa9486b25070.tar.bz2
volse-hubzilla-8879776d6436ed5257648a1873ddaa9486b25070.zip
fix php warnings
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/ASCollection.php4
-rw-r--r--Zotlabs/Lib/AbConfig.php15
-rw-r--r--Zotlabs/Lib/Connect.php3
-rw-r--r--Zotlabs/Lib/Libzot.php14
-rw-r--r--Zotlabs/Lib/Webfinger.php2
5 files changed, 28 insertions, 10 deletions
diff --git a/Zotlabs/Lib/ASCollection.php b/Zotlabs/Lib/ASCollection.php
index 392dd5d4e..c72b2fd04 100644
--- a/Zotlabs/Lib/ASCollection.php
+++ b/Zotlabs/Lib/ASCollection.php
@@ -24,6 +24,8 @@ class ASCollection {
$this->direction = $direction;
$this->limit = $limit;
+ $data = null;
+
if (is_array($obj)) {
$data = $obj;
}
@@ -147,4 +149,4 @@ class ASCollection {
}
logger('nextpage: ' . $this->nextpage, LOGGER_DEBUG);
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Lib/AbConfig.php b/Zotlabs/Lib/AbConfig.php
index dfc9efc6c..af1786966 100644
--- a/Zotlabs/Lib/AbConfig.php
+++ b/Zotlabs/Lib/AbConfig.php
@@ -6,12 +6,17 @@ namespace Zotlabs\Lib;
class AbConfig {
static public function Load($chan,$xhash,$family = '') {
- if($family)
+ $where = '';
+
+ if($family) {
$where = sprintf(" and cat = '%s' ",dbesc($family));
+ }
+
$r = q("select * from abconfig where chan = %d and xchan = '%s' $where",
intval($chan),
dbesc($xhash)
);
+
return $r;
}
@@ -21,7 +26,7 @@ class AbConfig {
intval($chan),
dbesc($xhash),
dbesc($family),
- dbesc($key)
+ dbesc($key)
);
if($r) {
return ((preg_match('|^a:[0-9]+:{.*}$|s', $r[0]['v'])) ? unserialize($r[0]['v']) : $r[0]['v']);
@@ -41,19 +46,19 @@ class AbConfig {
dbesc($xhash),
dbesc($family),
dbesc($key),
- dbesc($dbvalue)
+ dbesc($dbvalue)
);
}
else {
$r = q("update abconfig set v = '%s' where chan = %d and xchan = '%s' and cat = '%s' and k = '%s' ",
- dbesc($dbvalue),
+ dbesc($dbvalue),
dbesc($chan),
dbesc($xhash),
dbesc($family),
dbesc($key)
);
}
-
+
if($r)
return $value;
return false;
diff --git a/Zotlabs/Lib/Connect.php b/Zotlabs/Lib/Connect.php
index 0b9ff7089..6f10bbbae 100644
--- a/Zotlabs/Lib/Connect.php
+++ b/Zotlabs/Lib/Connect.php
@@ -86,6 +86,7 @@ class Connect {
$singleton = false;
$d = false;
+ $wf = false;
if (! $r) {
@@ -111,7 +112,7 @@ class Connect {
// something was discovered - find the record which was just created.
$r = q("select * from xchan where ( xchan_hash = '%s' or xchan_url = '%s' or xchan_addr = '%s' ) $sql_options",
- dbesc(($wf) ? $wf : $url),
+ dbesc($wf ?? $url),
dbesc($url),
dbesc($url)
);
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index c86eb29cd..6e8a5d5bc 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -589,8 +589,6 @@ class Libzot {
*/
static function register_hub($id) {
- $hsig_valid = false;
-
$result = ['success' => false];
if (!$id) {
@@ -599,8 +597,14 @@ class Libzot {
$record = Zotfinger::exec($id);
+ if (!$record) {
+ return $result;
+ }
+
// Check the HTTP signature
+ $hsig_valid = false;
+
$hsig = $record['signature'];
if ($hsig['signer'] === $id && $hsig['header_valid'] === true && $hsig['content_valid'] === true) {
$hsig_valid = true;
@@ -641,6 +645,12 @@ class Libzot {
*/
static function import_xchan($arr, $ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) {
+
+ if (!is_array($arr)) {
+ logger('Not an array: ' . print_r($arr, true), LOGGER_DEBUG);
+ return $ret;
+ }
+
/**
* @hooks import_xchan
* Called when processing the result of zot_finger() to store the result
diff --git a/Zotlabs/Lib/Webfinger.php b/Zotlabs/Lib/Webfinger.php
index 8484fb797..16d54010c 100644
--- a/Zotlabs/Lib/Webfinger.php
+++ b/Zotlabs/Lib/Webfinger.php
@@ -53,7 +53,7 @@ class Webfinger {
if(strpos($resource,'http') === 0) {
$m = parse_url($resource);
if($m) {
- if($m['scheme'] !== 'https') {
+ if(isset($m['scheme']) && $m['scheme'] !== 'https') {
return false;
}
self::$server = $m['host'] . ((isset($m['port'])) ? ':' . $m['port'] : '');