aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2022-10-18 12:39:13 +0200
committerMario Vavti <mario@mariovavti.com>2022-10-18 12:39:13 +0200
commite9ca17cec14c5a702cc7d656e5206a3c086dd550 (patch)
tree0770b4274c0e109056199db55429b0801b3ce60c
parentf70956964be5792be296a4e3ec1889a4be2fd475 (diff)
downloadvolse-hubzilla-e9ca17cec14c5a702cc7d656e5206a3c086dd550.tar.gz
volse-hubzilla-e9ca17cec14c5a702cc7d656e5206a3c086dd550.tar.bz2
volse-hubzilla-e9ca17cec14c5a702cc7d656e5206a3c086dd550.zip
fix php warnings
-rw-r--r--Zotlabs/Lib/Activity.php8
-rw-r--r--Zotlabs/Lib/Libzot.php2
-rw-r--r--Zotlabs/Module/Cloud_tiles.php4
-rw-r--r--Zotlabs/Module/Photos.php79
-rw-r--r--Zotlabs/Storage/Browser.php11
-rw-r--r--Zotlabs/Widget/Categories.php2
-rw-r--r--Zotlabs/Widget/Profile.php2
-rw-r--r--include/attach.php23
-rw-r--r--include/items.php6
-rw-r--r--include/photos.php10
10 files changed, 72 insertions, 75 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 26aef8104..633f18235 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -68,6 +68,10 @@ class Activity {
else {
$m = parse_url($url);
+ if (!$m) {
+ return null;
+ }
+
// handle bearcaps
if ($m['scheme'] === 'bear') {
$params = explode('&', $m['query']);
@@ -2262,6 +2266,10 @@ class Activity {
$obj_actor = ((isset($act->obj['actor'])) ? $act->obj['actor'] : $act->get_actor('attributedTo', $act->obj));
+ if (!isset($obj_actor['id'])) {
+ return false;
+ }
+
// ensure we store the original actor
self::actor_store($obj_actor['id'], $obj_actor);
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 2da829ba2..77b481c25 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1945,7 +1945,7 @@ class Libzot {
return false;
}
- if ($a['data']['type'] !== 'OrderedCollection') {
+ if (isset($a['data']['type']) && $a['data']['type'] !== 'OrderedCollection') {
return false;
}
diff --git a/Zotlabs/Module/Cloud_tiles.php b/Zotlabs/Module/Cloud_tiles.php
index da551904f..9ec050c20 100644
--- a/Zotlabs/Module/Cloud_tiles.php
+++ b/Zotlabs/Module/Cloud_tiles.php
@@ -6,7 +6,7 @@ class Cloud_tiles extends \Zotlabs\Web\Controller {
function init() {
- if(intval($_SESSION['cloud_tiles']))
+ if(isset($_SESSION['cloud_tiles']) && intval($_SESSION['cloud_tiles']))
$_SESSION['cloud_tiles'] = 0;
else
$_SESSION['cloud_tiles'] = 1;
@@ -18,4 +18,4 @@ class Cloud_tiles extends \Zotlabs\Web\Controller {
goaway(z_root() . '/' . hex2bin(argv(1)));
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php
index 45fe3d9e0..6acaf6673 100644
--- a/Zotlabs/Module/Photos.php
+++ b/Zotlabs/Module/Photos.php
@@ -40,7 +40,7 @@ class Photos extends \Zotlabs\Web\Controller {
head_set_icon(\App::$data['channel']['xchan_photo_s']);
- \App::$page['htmlhead'] .= "<script> var profile_uid = " . ((\App::$data['channel']) ? \App::$data['channel']['channel_id'] : 0) . "; </script>" ;
+ \App::$page['htmlhead'] = "<script> var profile_uid = " . ((\App::$data['channel']) ? \App::$data['channel']['channel_id'] : 0) . "; </script>" ;
}
@@ -74,18 +74,6 @@ class Photos extends \Zotlabs\Web\Controller {
return;
}
- $s = abook_self($page_owner_uid);
-
- if(! $s) {
- notice( t('Page owner information could not be retrieved.') . EOL);
- logger('mod_photos: post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
- if(is_ajax())
- killme();
- return;
- }
-
- $owner_record = $s[0];
-
$acl = new \Zotlabs\Access\AccessList(\App::$data['channel']);
if((argc() > 3) && (argv(2) === 'album')) {
@@ -467,7 +455,7 @@ class Photos extends \Zotlabs\Web\Controller {
if($partial) {
$x = save_chunk($channel,$matches[1],$matches[2],$matches[3]);
- if($x['partial']) {
+ if(isset($x['partial']) && $x['partial']) {
header('Range: bytes=0-' . (($x['length']) ? $x['length'] - 1 : 0));
json_return_and_die($x);
}
@@ -545,6 +533,7 @@ class Photos extends \Zotlabs\Web\Controller {
//
$can_comment = perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),'post_comments');
+ $datum = '';
if(argc() > 3) {
$datatype = argv(2);
@@ -552,7 +541,6 @@ class Photos extends \Zotlabs\Web\Controller {
} else {
if(argc() > 2) {
$datatype = argv(2);
- $datum = '';
}
else
$datatype = 'summary';
@@ -576,8 +564,8 @@ class Photos extends \Zotlabs\Web\Controller {
$observer = \App::get_observer();
- $can_post = perm_is_allowed($owner_uid,$observer['xchan_hash'],'write_storage');
- $can_view = perm_is_allowed($owner_uid,$observer['xchan_hash'],'view_storage');
+ $can_post = perm_is_allowed($owner_uid,get_observer_hash(),'write_storage');
+ $can_view = perm_is_allowed($owner_uid,get_observer_hash(),'view_storage');
if(! $can_view) {
notice( t('Access to this item is restricted.') . EOL);
@@ -604,7 +592,9 @@ class Photos extends \Zotlabs\Web\Controller {
* Display upload form
*/
- if( $can_post) {
+ $upload_form = '';
+
+ if($can_post) {
$uploader = '';
@@ -620,14 +610,12 @@ class Photos extends \Zotlabs\Web\Controller {
intval(\App::$data['channel']['channel_account_id'])
);
-
+ $usage_message = sprintf( t('%1$.2f MB photo storage used.'), $r[0]['total'] / 1024000 );
$limit = engr_units_to_bytes(service_class_fetch(\App::$data['channel']['channel_id'],'photo_upload_limit'));
+
if($limit !== false) {
$usage_message = sprintf( t("%1$.2f MB of %2$.2f MB photo storage used."), $r[0]['total'] / 1024000, $limit / 1024000 );
}
- else {
- $usage_message = sprintf( t('%1$.2f MB photo storage used.'), $r[0]['total'] / 1024000 );
- }
if($_is_owner) {
$channel = \App::get_channel();
@@ -712,17 +700,17 @@ class Photos extends \Zotlabs\Web\Controller {
'title' => 'oembed'
]);
+ $folder_hash = '';
+ $album = '/';
+
if($x = photos_album_exists($owner_uid, get_observer_hash(), $datum)) {
$album = $x['display_path'];
- }
- else {
- $album = '/';
- //goaway(z_root() . '/photos/' . \App::$data['channel']['channel_address']);
+ $folder_hash = $x['hash'];
}
\App::set_pager_itemspage(30);
- if($_GET['order'] === 'posted')
+ if(isset($_GET['order']) && $_GET['order'] === 'posted')
$order = 'ASC';
else
$order = 'DESC';
@@ -731,7 +719,7 @@ class Photos extends \Zotlabs\Web\Controller {
(SELECT resource_id, max(imgscale) imgscale FROM photo left join attach on folder = '%s' and photo.resource_id = attach.hash WHERE attach.uid = %d AND imgscale <= 4 AND photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY resource_id) ph
ON (p.resource_id = ph.resource_id AND p.imgscale = ph.imgscale)
ORDER BY created $order LIMIT %d OFFSET %d",
- dbesc($x['hash']),
+ dbesc($folder_hash),
intval($owner_uid),
intval(PHOTO_NORMAL),
intval(PHOTO_PROFILE),
@@ -763,7 +751,7 @@ class Photos extends \Zotlabs\Web\Controller {
}
- if($_GET['order'] === 'posted')
+ if(isset($_GET['order']) && $_GET['order'] === 'posted')
$order = array(t('Show Newest First'), z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/album/' . $datum);
else
$order = array(t('Show Oldest First'), z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/album/' . $datum . '?f=&order=posted');
@@ -784,7 +772,7 @@ class Photos extends \Zotlabs\Web\Controller {
$desc_e = $rr['description'];
$imagelink = (z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/image/' . $rr['resource_id']
- . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''));
+ . ((isset($_GET['order']) && $_GET['order'] === 'posted') ? '?f=&order=posted' : ''));
$photos[] = array(
'id' => $rr['id'],
@@ -801,7 +789,7 @@ class Photos extends \Zotlabs\Web\Controller {
}
}
- if($_REQUEST['aj']) {
+ if(isset($_REQUEST['aj']) && $_REQUEST['aj']) {
if($photos) {
$o = replace_macros(get_markup_template('photosajax.tpl'),array(
'$photos' => $photos,
@@ -831,7 +819,7 @@ class Photos extends \Zotlabs\Web\Controller {
}
- if((! $photos) && ($_REQUEST['aj'])) {
+ if((! $photos) && (isset($_REQUEST['aj']) && $_REQUEST['aj'])) {
$o .= '<div id="content-complete"></div>';
echo $o;
killme();
@@ -1021,7 +1009,7 @@ class Photos extends \Zotlabs\Web\Controller {
// FIXME - remove this when we move to conversation module
- $r = $r[0]['children'];
+ $r = $r[0]['children'] ?? [];
$edit = null;
if($can_post) {
@@ -1121,9 +1109,6 @@ class Photos extends \Zotlabs\Web\Controller {
'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title'))
);
-
-
-
if($r) {
foreach($r as $item) {
@@ -1266,19 +1251,19 @@ class Photos extends \Zotlabs\Web\Controller {
'$likebuttons' => $likebuttons,
'$like' => $like_e,
'$dislike' => $dislike_e,
- '$like_count' => $like_count,
- '$like_list' => $like_list,
- '$like_list_part' => $like_list_part,
- '$like_button_label' => $like_button_label,
+ '$like_count' => $like_count ?? '',
+ '$like_list' => $like_list ?? '',
+ '$like_list_part' => $like_list_part ?? '',
+ '$like_button_label' => $like_button_label ?? '',
'$like_modal_title' => t('Likes','noun'),
'$dislike_modal_title' => t('Dislikes','noun'),
- '$dislike_count' => $dislike_count, //((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_count : ''),
- '$dislike_list' => $dislike_list, //((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list : ''),
- '$dislike_list_part' => $dislike_list_part, //((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list_part : ''),
- '$dislike_button_label' => $dislike_button_label, //((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_button_label : ''),
+ '$dislike_count' => $dislike_count ?? '', //((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_count : ''),
+ '$dislike_list' => $dislike_list ?? '', //((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list : ''),
+ '$dislike_list_part' => $dislike_list_part ?? '', //((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_list_part : ''),
+ '$dislike_button_label' => $dislike_button_label ?? '', //((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike_button_label : ''),
'$modal_dismiss' => t('Close'),
'$comments' => $comments,
- '$commentbox' => $commentbox,
+ '$commentbox' => $commentbox ?? '',
'$paginate' => $paginate,
'$onclick' => $hookdata['onclick']
));
@@ -1345,7 +1330,7 @@ class Photos extends \Zotlabs\Web\Controller {
}
}
- if($_REQUEST['aj']) {
+ if(isset($_REQUEST['aj']) && $_REQUEST['aj']) {
if($photos) {
$o = replace_macros(get_markup_template('photosajax.tpl'),array(
'$photos' => $photos,
@@ -1373,7 +1358,7 @@ class Photos extends \Zotlabs\Web\Controller {
}
- if((! $photos) && ($_REQUEST['aj'])) {
+ if((! $photos) && (isset($_REQUEST['aj']) && $_REQUEST['aj'])) {
$o .= '<div id="content-complete"></div>';
echo $o;
killme();
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php
index 923906371..590c1cd9c 100644
--- a/Zotlabs/Storage/Browser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -351,6 +351,9 @@ class Browser extends DAV\Browser\Plugin {
$header = (($cat) ? t('File category') . ": " . $this->escapeHTML($cat) : t('Files'));
$channel = channelx_by_n($channel_id);
+ $lockstate = null;
+ $channel_acl = null;
+
if($channel) {
$acl = new \Zotlabs\Access\AccessList($channel);
$channel_acl = $acl->get();
@@ -391,10 +394,10 @@ class Browser extends DAV\Browser\Plugin {
'$copy' => ['copy', t('Copy to target location'), 0, '', [t('No'), t('Yes')]],
'$return_path' => $path,
'$lockstate' => $lockstate,
- '$allow_cid' => acl2json($channel_acl['allow_cid']),
- '$allow_gid' => acl2json($channel_acl['allow_gid']),
- '$deny_cid' => acl2json($channel_acl['deny_cid']),
- '$deny_gid' => acl2json($channel_acl['deny_gid']),
+ '$allow_cid' => ((isset($channel_acl['allow_cid'])) ? acl2json($channel_acl['allow_cid']) : ''),
+ '$allow_gid' => ((isset($channel_acl['allow_gid'])) ? acl2json($channel_acl['allow_gid']) : ''),
+ '$deny_cid' => ((isset($channel_acl['deny_cid'])) ? acl2json($channel_acl['deny_cid']) : ''),
+ '$deny_gid' => ((isset($channel_acl['deny_gid'])) ? acl2json($channel_acl['deny_gid']) : ''),
'$is_owner' => $is_owner,
'$select_all_label' => t('Select All'),
'$bulk_actions_label' => t('Bulk Actions'),
diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php
index 0a1c80061..b31856e48 100644
--- a/Zotlabs/Widget/Categories.php
+++ b/Zotlabs/Widget/Categories.php
@@ -19,7 +19,7 @@ class Categories {
$files = ((array_key_exists('files',$arr) && $arr['files']) ? true : false);
- if(!App::$profile['profile_uid'] || !perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_stream')) {
+ if(!isset(App::$profile['profile_uid']) || !perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_stream')) {
return '';
}
diff --git a/Zotlabs/Widget/Profile.php b/Zotlabs/Widget/Profile.php
index a0bb1a66a..9e04524c1 100644
--- a/Zotlabs/Widget/Profile.php
+++ b/Zotlabs/Widget/Profile.php
@@ -13,7 +13,7 @@ use App;
class Profile {
function widget($args) {
- if(!App::$profile['profile_uid']) {
+ if(!isset(App::$profile['profile_uid'])) {
return;
}
diff --git a/include/attach.php b/include/attach.php
index edf05689e..3b63bd651 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -962,32 +962,33 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
if($is_photo && $r) {
$args = array( 'source' => $source, 'visible' => $visible, 'resource_id' => $hash, 'album' => $pathname, 'os_syspath' => $os_basepath . $os_relpath, 'os_path' => $os_path, 'display_path' => $display_path, 'filename' => $filename, 'getimagesize' => $gis, 'directory' => $direct, 'options' => $options );
- if($arr['contact_allow'])
+ if (array_key_exists('contact_allow', $arr))
$args['contact_allow'] = $arr['contact_allow'];
- if($arr['group_allow'])
+ if (array_key_exists('contact_deny', $arr))
$args['group_allow'] = $arr['group_allow'];
- if($arr['contact_deny'])
+ if (array_key_exists('contact_deny', $arr))
$args['contact_deny'] = $arr['contact_deny'];
- if($arr['group_deny'])
+ if (array_key_exists('group_deny', $arr))
$args['group_deny'] = $arr['group_deny'];
- if(array_key_exists('allow_cid',$arr))
+ if (array_key_exists('allow_cid', $arr))
$args['allow_cid'] = $arr['allow_cid'];
- if(array_key_exists('allow_gid',$arr))
+ if (array_key_exists('allow_gid', $arr))
$args['allow_gid'] = $arr['allow_gid'];
- if(array_key_exists('deny_cid',$arr))
+ if (array_key_exists('deny_cid', $arr))
$args['deny_cid'] = $arr['deny_cid'];
- if(array_key_exists('deny_gid',$arr))
+ if (array_key_exists('deny_gid', $arr))
$args['deny_gid'] = $arr['deny_gid'];
$args['created'] = $created;
$args['edited'] = $edited;
- if($arr['item'])
+
+ if (array_key_exists('item', $arr))
$args['item'] = $arr['item'];
- if($arr['body'])
+ if (array_key_exists('body', $arr))
$args['body'] = $arr['body'];
- if($arr['description'])
+ if (array_key_exists('description', $arr))
$args['description'] = $arr['description'];
$args['deliver'] = $dosync;
diff --git a/include/items.php b/include/items.php
index bf81cf56d..28b311021 100644
--- a/include/items.php
+++ b/include/items.php
@@ -1030,20 +1030,20 @@ function import_author_unknown($x) {
return $r[0]['xchan_hash'];
}
- $name = trim($x['name']);
+ $name = ((isset($x['name'])) ? trim($x['name']) : 'Unknown');
$r = xchan_store_lowlevel(
[
'xchan_hash' => $x['url'],
'xchan_guid' => $x['url'],
'xchan_url' => $x['url'],
- 'xchan_name' => (($name) ? $name : t('(Unknown)')),
+ 'xchan_name' => $name,
'xchan_name_date' => datetime_convert(),
'xchan_network' => 'unknown'
]
);
- if($r && $x['photo']) {
+ if($r && isset($x['photo']) && $x['photo']) {
$photos = import_xchan_photo($x['photo']['src'],$x['url']);
diff --git a/include/photos.php b/include/photos.php
index 9e4e8923d..de9cc6b13 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -247,13 +247,13 @@ function photo_upload($channel, $observer, $args) {
'os_storage' => $os_storage, 'os_syspath' => $args['os_syspath'],
'os_path' => $args['os_path'], 'display_path' => $args['display_path']
];
- if ($args['created'])
+ if (isset($args['created']))
$p['created'] = $args['created'];
- if ($args['edited'])
+ if (isset($args['edited']))
$p['edited'] = $args['edited'];
- if ($args['title'])
+ if (isset($args['title']))
$p['title'] = $args['title'];
- if ($args['description'])
+ if (isset($args['description']))
$p['description'] = $args['description'];
$url = [];
@@ -446,7 +446,7 @@ function photo_upload($channel, $observer, $args) {
];
// Create item container
- if ($args['item']) {
+ if (isset($args['item'])) {
foreach ($args['item'] as $i) {
$item = get_item_elements($i);