aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-10-20 13:16:03 +0000
committerMario <mario@mariovavti.com>2022-10-20 13:16:03 +0000
commitbf434818d7cfac6bf29482d4bb07fc567de2fc90 (patch)
treefc50a3cafce38134d758767caec1ffea8da8fdcf
parent03aeb888322e792ccb17593761f1f93ad2906c7e (diff)
downloadvolse-hubzilla-bf434818d7cfac6bf29482d4bb07fc567de2fc90.tar.gz
volse-hubzilla-bf434818d7cfac6bf29482d4bb07fc567de2fc90.tar.bz2
volse-hubzilla-bf434818d7cfac6bf29482d4bb07fc567de2fc90.zip
fix php warnings
-rw-r--r--Zotlabs/Lib/Activity.php8
-rw-r--r--Zotlabs/Lib/Enotify.php6
-rw-r--r--Zotlabs/Module/Channel_calendar.php18
-rw-r--r--Zotlabs/Module/Dreport.php1
-rw-r--r--Zotlabs/Module/Editpost.php21
-rw-r--r--Zotlabs/Module/Permcats.php2
-rw-r--r--Zotlabs/Module/Siteinfo.php2
-rw-r--r--Zotlabs/Module/Tokens.php8
-rw-r--r--Zotlabs/Web/HTTPSig.php2
-rw-r--r--Zotlabs/Widget/Permcats.php5
-rw-r--r--Zotlabs/Zot6/Receiver.php2
-rw-r--r--include/conversation.php10
-rw-r--r--include/items.php1
-rw-r--r--include/text.php2
14 files changed, 46 insertions, 42 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index d80394c7b..8380e2287 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -1600,9 +1600,9 @@ class Activity {
// we already store this in Activity::fetch()
// XConfig::Set($url, 'system', 'actor_record', $person_obj);
- $name = $person_obj['name'];
+ $name = $person_obj['name'] ?? '';
if (!$name) {
- $name = $person_obj['preferredUsername'];
+ $name = $person_obj['preferredUsername'] ?? '';
}
if (!$name) {
$name = t('Unknown');
@@ -1644,7 +1644,7 @@ class Activity {
$links = false;
$profile = false;
- if (is_array($person_obj['url'])) {
+ if (isset($person_obj['url']) && is_array($person_obj['url'])) {
if (!array_key_exists(0, $person_obj['url'])) {
$links = [$person_obj['url']];
}
@@ -1653,7 +1653,7 @@ class Activity {
}
}
- if ($links) {
+ if (is_array($links) && $links) {
foreach ($links as $link) {
if (is_array($link) && array_key_exists('mediaType', $link) && $link['mediaType'] === 'text/html') {
$profile = $link['href'];
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 5a09ade90..513f4ae14 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -499,6 +499,7 @@ class Enotify {
$datarray['verb'] = $params['verb'];
$datarray['otype'] = $params['otype'];
$datarray['abort'] = false;
+ $datarray['seen'] = 0;
$datarray['item'] = $params['item'];
@@ -511,7 +512,6 @@ class Enotify {
// create notification entry in DB
- $seen = 0;
// Mark some notifications as seen right away
// Note! The notification have to be created, because they are used to send emails
@@ -521,7 +521,7 @@ class Enotify {
if (!$always_show_in_notices) {
if (($params['type'] === NOTIFY_WALL) || ($params['type'] === NOTIFY_MAIL) || ($params['type'] === NOTIFY_INTRO)) {
- $seen = 1;
+ $datarray['seen'] = 1;
}
}
@@ -537,7 +537,7 @@ class Enotify {
intval($datarray['uid']),
dbesc($datarray['link']),
dbesc($datarray['parent']),
- intval($seen),
+ intval($datarray['seen']),
intval($datarray['ntype']),
dbesc($datarray['verb']),
dbesc($datarray['otype'])
diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php
index 26c6aaf40..289e3a734 100644
--- a/Zotlabs/Module/Channel_calendar.php
+++ b/Zotlabs/Module/Channel_calendar.php
@@ -30,7 +30,7 @@ class Channel_calendar extends Controller {
$xchan = ((x($_POST, 'xchan')) ? dbesc($_POST['xchan']) : '');
- // only allow editing your own events.
+ // only allow editing your own events.
if (($xchan) && ($xchan !== get_observer_hash()))
return;
@@ -55,8 +55,8 @@ class Channel_calendar extends Controller {
// Don't allow the event to finish before it begins.
// It won't hurt anything, but somebody will file a bug report
- // and we'll waste a bunch of time responding to it. Time that
- // could've been spent doing something else.
+ // and we'll waste a bunch of time responding to it. Time that
+ // could've been spent doing something else.
if (strcmp($finish, $start) < 0) {
notice(t('Event can not end before it has started.') . EOL);
@@ -319,12 +319,12 @@ class Channel_calendar extends Controller {
// fixed an issue with "nofinish" events not showing up in the calendar.
// There's still an issue if the finish date crosses the end of month.
// Noting this for now - it will need to be fixed here and in Friendica.
- // Ultimately the finish date shouldn't be involved in the query.
+ // Ultimately the finish date shouldn't be involved in the query.
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan, item.id as item_id
- from event left join item on event.event_hash = item.resource_id
- where item.resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored
- AND (( event.adjust = 0 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' )
+ from event left join item on event.event_hash = item.resource_id
+ where item.resource_type = 'event' and event.uid = %d and event.uid = item.uid $ignored
+ AND (( event.adjust = 0 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' )
OR ( event.adjust = 1 AND ( event.dtend >= '%s' or event.nofinish = 1 ) AND event.dtstart <= '%s' )) ",
intval(local_channel()),
dbesc($start),
@@ -357,7 +357,7 @@ class Channel_calendar extends Controller {
$catsenabled = feature_enabled(local_channel(), 'categories');
$categories = '';
if ($catsenabled) {
- if ($rr['term']) {
+ if (isset($rr['term']) && $rr['term']) {
$cats = get_terms_oftype($rr['term'], TERM_CATEGORY);
foreach ($cats as $cat) {
if (strlen($categories))
@@ -449,7 +449,7 @@ class Channel_calendar extends Controller {
}
// The site admin can delete any post/item on the site.
- // If the item originated on this site+channel the deletion will propagate downstream.
+ // If the item originated on this site+channel the deletion will propagate downstream.
// Otherwise just the local copy is removed.
if (is_site_admin()) {
diff --git a/Zotlabs/Module/Dreport.php b/Zotlabs/Module/Dreport.php
index d6f4e5979..759e1acb4 100644
--- a/Zotlabs/Module/Dreport.php
+++ b/Zotlabs/Module/Dreport.php
@@ -94,6 +94,7 @@ class Dreport extends \Zotlabs\Web\Controller {
case 'updated':
$r[$x]['gravity'] = 5;
$r[$x]['dreport_result'] = t('updated');
+ break;
case 'update ignored':
$r[$x]['gravity'] = 6;
$r[$x]['dreport_result'] = t('update ignored');
diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php
index c6cfc6dc4..b21c58af2 100644
--- a/Zotlabs/Module/Editpost.php
+++ b/Zotlabs/Module/Editpost.php
@@ -57,15 +57,17 @@ class Editpost extends \Zotlabs\Web\Controller {
$catsenabled = ((feature_enabled($owner_uid,'categories')) ? 'categories' : '');
if ($catsenabled){
- $itm = fetch_post_tags($itm);
-
- $cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY);
-
- foreach ($cats as $cat) {
- if (strlen($category))
- $category .= ', ';
- $category .= $cat['term'];
- }
+ $itm = fetch_post_tags($itm);
+ if (isset($itm[0]['term'])) {
+ $cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY);
+ if ($cats) {
+ foreach ($cats as $cat) {
+ if (strlen($category))
+ $category .= ', ';
+ $category .= $cat['term'];
+ }
+ }
+ }
}
if($itm[0]['attach']) {
@@ -104,6 +106,7 @@ class Editpost extends \Zotlabs\Web\Controller {
'bbcode' => true
);
+ $a = '';
$editor = status_editor($a, $x, false, 'Editpost');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
diff --git a/Zotlabs/Module/Permcats.php b/Zotlabs/Module/Permcats.php
index d42e45beb..a9ba6dc18 100644
--- a/Zotlabs/Module/Permcats.php
+++ b/Zotlabs/Module/Permcats.php
@@ -213,7 +213,7 @@ class Permcats extends Controller {
$thisperm = Permcat::find_permcat($existing, $k);
$checkinherited = PermissionLimits::Get(local_channel(), $k);
- if ($existing[$k])
+ if (isset($existing[$k]) && $existing[$k])
$thisperm = 1;
$perms[] = [
diff --git a/Zotlabs/Module/Siteinfo.php b/Zotlabs/Module/Siteinfo.php
index be6862c6b..ac33747f8 100644
--- a/Zotlabs/Module/Siteinfo.php
+++ b/Zotlabs/Module/Siteinfo.php
@@ -5,7 +5,7 @@ namespace Zotlabs\Module;
class Siteinfo extends \Zotlabs\Web\Controller {
function init() {
- if (argv(1) === 'json' || $_REQUEST['module_format'] === 'json') {
+ if (argv(1) === 'json' || (isset($_REQUEST['module_format']) && $_REQUEST['module_format'] === 'json')) {
$data = get_site_info();
json_return_and_die($data);
}
diff --git a/Zotlabs/Module/Tokens.php b/Zotlabs/Module/Tokens.php
index a41003f6b..701f29c19 100644
--- a/Zotlabs/Module/Tokens.php
+++ b/Zotlabs/Module/Tokens.php
@@ -282,15 +282,15 @@ class Tokens extends Controller {
}
$tpl = get_markup_template("tokens.tpl");
- $o .= replace_macros($tpl, array(
+ $o = replace_macros($tpl, array(
'$form_security_token' => get_form_security_token('tokens'),
'$permcat' => ['permcat', t('Select a role for this guest'), $current_permcat, '', $permcats],
'$title' => t('Guest Access'),
'$desc' => $desc,
'$atoken' => $atoken,
- '$name' => array('name', t('Login Name') . ' <span class="required">*</span>', (($atoken) ? $atoken['atoken_name'] : ''),''),
- '$token'=> array('token', t('Login Password') . ' <span class="required">*</span>',(($atoken) ? $atoken['atoken_token'] : new_token()), ''),
- '$expires'=> array('expires', t('Expires (yyyy-mm-dd)'), (($atoken['atoken_expires'] && $atoken['atoken_expires'] > NULL_DATE) ? datetime_convert('UTC',date_default_timezone_get(),$atoken['atoken_expires']) : ''), ''),
+ '$name' => array('name', t('Login Name') . ' <span class="required">*</span>', $atoken['atoken_name'] ?? '',''),
+ '$token'=> array('token', t('Login Password') . ' <span class="required">*</span>', $atoken['atoken_token'] ?? new_token(), ''),
+ '$expires'=> array('expires', t('Expires (yyyy-mm-dd)'), ((isset($atoken['atoken_expires']) && $atoken['atoken_expires'] > NULL_DATE) ? datetime_convert('UTC',date_default_timezone_get(),$atoken['atoken_expires']) : ''), ''),
'$submit' => t('Submit'),
'$delete' => t('Delete')
));
diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php
index c831acda4..9ff0267c3 100644
--- a/Zotlabs/Web/HTTPSig.php
+++ b/Zotlabs/Web/HTTPSig.php
@@ -207,7 +207,7 @@ class HTTPSig {
$key = (($fetched_key) ? $fetched_key : $cached_key);
- $result['portable_id'] = $key['portable_id'];
+ $result['portable_id'] = $key['portable_id'] ?? '';
$result['header_valid'] = true;
if (in_array('digest', $signed_headers)) {
diff --git a/Zotlabs/Widget/Permcats.php b/Zotlabs/Widget/Permcats.php
index 9226b3c71..9bda5b8f1 100644
--- a/Zotlabs/Widget/Permcats.php
+++ b/Zotlabs/Widget/Permcats.php
@@ -24,6 +24,7 @@ class Permcats {
$roles = [];
$active_role = '';
+ $members = [];
foreach($pcatlist as $pc) {
if (!$active_role) {
@@ -76,8 +77,6 @@ class Permcats {
dbesc($active_role)
);
- $members = [];
-
foreach ($r as $rr) {
$members[] = [
'name' => $rr['xchan_name'],
@@ -89,7 +88,7 @@ class Permcats {
}
$tpl = get_markup_template("permcats_widget.tpl");
- $o .= replace_macros($tpl, [
+ $o = replace_macros($tpl, [
'$roles_label' => t('Contact roles'),
'$members_label' => t('Role members'),
'$roles' => $roles,
diff --git a/Zotlabs/Zot6/Receiver.php b/Zotlabs/Zot6/Receiver.php
index 78661865e..b276cbe31 100644
--- a/Zotlabs/Zot6/Receiver.php
+++ b/Zotlabs/Zot6/Receiver.php
@@ -81,7 +81,7 @@ class Receiver {
}
else {
$this->error = true;
- $this->response['message'] = 'no data';
+ $this->response['message'] = 'no data (decryption failed)';
}
}
}
diff --git a/include/conversation.php b/include/conversation.php
index 2b00c12be..bb0603eca 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1328,7 +1328,7 @@ function hz_status_editor($a, $x, $popup = false) {
if(x($x, 'hide_future'))
$feature_future = false;
- $geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
+ $geotag = ((isset($x['allow_location']) && $x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
$setloc = t('Set your location');
$clearloc = ((get_pconfig($x['profile_uid'], 'system', 'use_browser_location')) ? t('Clear browser location') : '');
if(x($x, 'hide_location'))
@@ -1491,10 +1491,10 @@ function hz_status_editor($a, $x, $popup = false) {
'$content' => ((x($x,'body')) ? htmlspecialchars($x['body'], ENT_COMPAT,'UTF-8') : ''),
'$attachment' => ((x($x, 'attachment')) ? $x['attachment'] : ''),
'$post_id' => ((x($x, 'post_id')) ? $x['post_id'] : ''),
- '$defloc' => $x['default_location'],
+ '$defloc' => $x['default_location'] ?? '',
'$visitor' => $x['visitor'],
- '$lockstate' => $x['lockstate'],
- '$acl' => $x['acl'],
+ '$lockstate' => $x['lockstate'] ?? '',
+ '$acl' => $x['acl'] ?? '',
'$allow_cid' => acl2json($x['permissions']['allow_cid']),
'$allow_gid' => acl2json($x['permissions']['allow_gid']),
'$deny_cid' => acl2json($x['permissions']['deny_cid']),
@@ -1502,7 +1502,7 @@ function hz_status_editor($a, $x, $popup = false) {
'$mimeselect' => $mimeselect,
'$layoutselect' => $layoutselect,
'$showacl' => ((array_key_exists('showacl', $x)) ? $x['showacl'] : true),
- '$bang' => $x['bang'],
+ '$bang' => $x['bang'] ?? '',
'$profile_uid' => $x['profile_uid'],
'$preview' => $preview,
'$source' => ((x($x, 'source')) ? $x['source'] : ''),
diff --git a/include/items.php b/include/items.php
index 8a244db2f..a01a0e2fa 100644
--- a/include/items.php
+++ b/include/items.php
@@ -2409,6 +2409,7 @@ function send_status_notifications($post_id,$item) {
$parent = 0;
$is_reaction = false;
+ $thr_parent_id = 0;
$type = ((intval($item['item_private']) === 2) ? NOTIFY_MAIL : NOTIFY_COMMENT);
diff --git a/include/text.php b/include/text.php
index 37d185ce6..220844fd1 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3977,7 +3977,7 @@ function new_token($minlen = 36, $maxlen = 48) {
$len = (($minlen === $maxlen) ? $minlen : mt_rand($minlen, $maxlen));
for ($a = 0; $a < $len; $a++) {
- $str .= $chars[mt_rand(0, 62)];
+ $str .= $chars[mt_rand(0, 61)];
}
return $str;