aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-10-12 19:36:24 +0000
committerMario <mario@mariovavti.com>2022-10-12 19:36:24 +0000
commit71efb0565803018cb1ba362706c763714c596cf7 (patch)
tree508827af55db42365892e6064f0e009e5068567e /Zotlabs/Module
parenta9a36894cb2637b546ed566ee06f20511cce031f (diff)
downloadvolse-hubzilla-71efb0565803018cb1ba362706c763714c596cf7.tar.gz
volse-hubzilla-71efb0565803018cb1ba362706c763714c596cf7.tar.bz2
volse-hubzilla-71efb0565803018cb1ba362706c763714c596cf7.zip
fix php warnings
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Acl.php2
-rw-r--r--Zotlabs/Module/Directory.php41
-rw-r--r--Zotlabs/Module/File_upload.php10
-rw-r--r--Zotlabs/Module/Item.php56
-rw-r--r--Zotlabs/Module/Lockview.php2
-rw-r--r--Zotlabs/Module/Owa.php4
6 files changed, 64 insertions, 51 deletions
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index 9dc422e6b..f8c6232c5 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -284,7 +284,7 @@ class Acl extends \Zotlabs\Web\Controller {
}
elseif($type == 'm') {
$r = array();
- $z = q("SELECT xchan_hash as hash, xchan_name as name, xchan_network as net, xchan_addr as nick, xchan_photo_s as micro, xchan_url as url
+ $z = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_network as net, xchan_addr as nick, xchan_photo_s as micro, xchan_url as url, abook_self
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d
and xchan_deleted = 0
diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php
index da37c582f..c543503e4 100644
--- a/Zotlabs/Module/Directory.php
+++ b/Zotlabs/Module/Directory.php
@@ -83,7 +83,7 @@ class Directory extends Controller {
$globaldir = Libzotdir::get_directory_setting($observer, 'globaldir');
// override your personal global search pref if we're doing a navbar search of the directory
- if(intval($_REQUEST['navsearch']))
+ if(isset($_REQUEST['navsearch']) && intval($_REQUEST['navsearch']))
$globaldir = 1;
$safe_mode = Libzotdir::get_directory_setting($observer, 'safemode');
@@ -98,15 +98,18 @@ class Directory extends Controller {
else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
-
+ $advanced = '';
if(strpos($search,'=') && local_channel() && feature_enabled(local_channel(), 'advanced_dirsearch'))
$advanced = $search;
- $keywords = (($_GET['keywords']) ? $_GET['keywords'] : '');
+ $keywords = $_GET['keywords'] ?? '';
// Suggest channels if no search terms or keywords are given
$suggest = (local_channel() && x($_REQUEST,'suggest')) ? $_REQUEST['suggest'] : '';
+ $addresses = [];
+ $common = [];
+
if($suggest) {
// the directory options have no effect in suggestion mode
@@ -123,8 +126,7 @@ class Directory extends Controller {
}
// Remember in which order the suggestions were
- $addresses = array();
- $common = array();
+
$index = 0;
foreach($r as $rr) {
$common[$rr['xchan_addr']] = ((intval($rr['total']) > 0) ? intval($rr['total']) - 1 : 0);
@@ -132,7 +134,7 @@ class Directory extends Controller {
}
// Build query to get info about suggested people
- $advanced = '';
+
foreach(array_keys($addresses) as $address) {
$advanced .= "address=\"$address\" ";
}
@@ -147,6 +149,8 @@ class Directory extends Controller {
$directory_admin = false;
+ $url = '';
+
if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
$url = z_root() . '/dirsearch';
if (is_site_admin()) {
@@ -275,19 +279,12 @@ class Directory extends Controller {
$page_type = '';
- $rating_enabled = get_config('system','rating_enabled');
-
- if($rr['total_ratings'] && $rating_enabled)
- $total_ratings = sprintf( tt("%d rating", "%d ratings", $rr['total_ratings']), $rr['total_ratings']);
- else
- $total_ratings = '';
-
$profile = $rr;
- if ((x($profile,'locale') == 1)
- || (x($profile,'region') == 1)
- || (x($profile,'postcode') == 1)
- || (x($profile,'country') == 1))
+ // if ((x($profile,'locale') == 1)
+ // || (x($profile,'region') == 1)
+ // || (x($profile,'postcode') == 1)
+ // || (x($profile,'country') == 1))
$gender = ((x($profile,'gender') == 1) ? t('Gender: ') . $profile['gender']: False);
@@ -352,9 +349,6 @@ class Directory extends Controller {
'location' => $location,
'location_label' => t('Location:'),
'gender' => $gender,
- 'total_ratings' => $total_ratings,
- 'viewrate' => true,
- 'canrate' => (($rating_enabled && local_channel()) ? true : false),
'pdesc' => $pdesc,
'pdesc_label' => t('Description:'),
'censor' => (($directory_admin) ? 'dircensor/' . $rr['hash'] : ''),
@@ -374,9 +368,9 @@ class Directory extends Controller {
'keywords' => $out,
'ignlink' => $suggest ? z_root() . '/directory?ignore=' . $rr['hash'] : '',
'ignore_label' => t('Don\'t suggest'),
- 'common_friends' => (($common[$rr['address']]) ? intval($common[$rr['address']]) : ''),
+ 'common_friends' => $common[$rr['address']] ?? '',
'common_label' => t('Common connections (estimated):'),
- 'common_count' => intval($common[$rr['address']]),
+ 'common_count' => $common[$rr['address']] ?? '',
'safe' => $safe_mode
);
@@ -408,8 +402,9 @@ class Directory extends Controller {
logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA);
+ $aj = $_REQUEST['aj'] ?? '';
- if($_REQUEST['aj']) {
+ if($aj) {
if($entries) {
$o = replace_macros(get_markup_template('directajax.tpl'),array(
'$entries' => $entries
diff --git a/Zotlabs/Module/File_upload.php b/Zotlabs/Module/File_upload.php
index d4c9ad59a..39a30cb1a 100644
--- a/Zotlabs/Module/File_upload.php
+++ b/Zotlabs/Module/File_upload.php
@@ -30,12 +30,12 @@ class File_upload extends \Zotlabs\Web\Controller {
$_REQUEST['group_deny'] = expand_acl($channel['channel_deny_gid']);
}
- $_REQUEST['allow_cid'] = perms2str($_REQUEST['contact_allow']);
- $_REQUEST['allow_gid'] = perms2str($_REQUEST['group_allow']);
- $_REQUEST['deny_cid'] = perms2str($_REQUEST['contact_deny']);
- $_REQUEST['deny_gid'] = perms2str($_REQUEST['group_deny']);
+ $_REQUEST['allow_cid'] = ((isset($_REQUEST['contact_allow'])) ? perms2str($_REQUEST['contact_allow']) : '');
+ $_REQUEST['allow_gid'] = ((isset($_REQUEST['group_allow'])) ? perms2str($_REQUEST['group_allow']) : '');
+ $_REQUEST['deny_cid'] = ((isset($_REQUEST['contact_deny'])) ? perms2str($_REQUEST['contact_deny']) : '');
+ $_REQUEST['deny_gid'] = ((isset($_REQUEST['group_deny'])) ? perms2str($_REQUEST['group_deny']) : '');
- if($_REQUEST['filename']) {
+ if(isset($_REQUEST['filename']) && $_REQUEST['filename']) {
$r = attach_mkdir($channel, get_observer_hash(), $_REQUEST);
if($r['success']) {
$hash = $r['data']['hash'];
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 588391843..3104ce9fb 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -312,6 +312,21 @@ class Item extends Controller {
$observer = null;
$datarray = [];
+ $item_starred = false;
+ $item_uplink = false;
+ $item_notshown = false;
+ $item_nsfw = false;
+ $item_relay = false;
+ $item_mentionsme = false;
+ $item_verified = false;
+ $item_retained = false;
+ $item_rss = false;
+ $item_deleted = false;
+ $item_hidden = false;
+ $item_unpublished = false;
+ $item_delayed = false;
+ $item_pending_remove = false;
+ $item_blocked = false;
/**
* Is this a reply to something?
@@ -319,7 +334,7 @@ class Item extends Controller {
$parent = ((x($_REQUEST, 'parent')) ? intval($_REQUEST['parent']) : 0);
$parent_mid = ((x($_REQUEST, 'parent_mid')) ? trim($_REQUEST['parent_mid']) : '');
- $mode = (($_REQUEST['conv_mode'] === 'channel') ? 'channel' : 'network');
+ $mode = ((isset($_REQUEST['conv_mode']) && $_REQUEST['conv_mode'] === 'channel') ? 'channel' : 'network');
$remote_xchan = ((x($_REQUEST, 'remote_xchan')) ? trim($_REQUEST['remote_xchan']) : false);
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
@@ -355,10 +370,10 @@ class Item extends Controller {
$api_source = ((x($_REQUEST, 'api_source') && $_REQUEST['api_source']) ? true : false);
- $consensus = intval($_REQUEST['consensus']);
- $nocomment = intval($_REQUEST['nocomment']);
+ $consensus = $_REQUEST['consensus'] ?? 0;
+ $nocomment = $_REQUEST['nocomment'] ?? 0;
- $is_poll = ((trim((string)$_REQUEST['poll_answers'][0]) != '' && trim((string)$_REQUEST['poll_answers'][1]) != '') ? true : false);
+ $is_poll = ((isset($_REQUEST['poll_answers'][0]) && $_REQUEST['poll_answers'][0]) && (isset($_REQUEST['poll_answers'][1]) && $_REQUEST['poll_answers'][1]));
// 'origin' (if non-zero) indicates that this network is where the message originated,
// for the purpose of relaying comments to other conversation members.
@@ -720,18 +735,18 @@ class Item extends Controller {
}
- $location = notags(trim((string)$_REQUEST['location']));
- $coord = notags(trim((string)$_REQUEST['coord']));
- $verb = notags(trim((string)$_REQUEST['verb']));
- $title = escape_tags(trim((string)$_REQUEST['title']));
- $summary = trim((string)$_REQUEST['summary']);
- $body = trim((string)$_REQUEST['body']);
- $body .= trim((string)$_REQUEST['attachment']);
+ $location = ((isset($_REQUEST['location'])) ? notags(trim($_REQUEST['location'])) : '');
+ $coord = ((isset($_REQUEST['coord'])) ? notags(trim($_REQUEST['coord'])) : '');
+ $verb = ((isset($_REQUEST['verb'])) ? notags(trim($_REQUEST['verb'])) : '');
+ $title = ((isset($_REQUEST['title'])) ? escape_tags(trim($_REQUEST['title'])) : '');
+ $summary = ((isset($_REQUEST['summary'])) ? trim($_REQUEST['summary']) : '');
+ $body = ((isset($_REQUEST['body'])) ? trim($_REQUEST['body']) : '');
+ $body .= ((isset($_REQUEST['attachment'])) ? trim($_REQUEST['attachment']) : '');
$postopts = '';
$allow_empty = ((array_key_exists('allow_empty', $_REQUEST)) ? intval($_REQUEST['allow_empty']) : 0);
- $private = (($private) ? $private : intval($acl->is_private() || ($public_policy)));
+ $private = ((isset($private) && $private) ? $private : intval($acl->is_private() || ($public_policy)));
// If this is a comment, set the permissions from the parent.
@@ -767,7 +782,8 @@ class Item extends Controller {
}
- $mimetype = notags(trim((string)$_REQUEST['mimetype']));
+ $mimetype = ((isset($_REQUEST['mimetype'])) ? notags(trim($_REQUEST['mimetype'])) : '');
+
if (!$mimetype)
$mimetype = 'text/bbcode';
@@ -957,7 +973,7 @@ class Item extends Controller {
$item_unseen = ((local_channel() != $profile_uid) ? 1 : 0);
- $item_wall = (($_REQUEST['type'] === 'wall' || $_REQUEST['type'] === 'wall-comment') ? 1 : 0);
+ $item_wall = ((isset($_REQUEST['type']) && ($_REQUEST['type'] === 'wall' || $_REQUEST['type'] === 'wall-comment')) ? 1 : 0);
$item_origin = (($origin) ? 1 : 0);
$item_consensus = (($consensus) ? 1 : 0);
$item_nocomment = (($nocomment) ? 1 : 0);
@@ -986,9 +1002,7 @@ class Item extends Controller {
$uuid = (($message_id) ? $message_id : item_message_id());
- if (!$mid) {
- $mid = z_root() . '/item/' . $uuid;
- }
+ $mid = $mid ?? z_root() . '/item/' . $uuid;
if ($is_poll) {
@@ -1045,7 +1059,7 @@ class Item extends Controller {
$plink = $mid;
}
- if ($datarray['obj']) {
+ if (isset($datarray['obj']) && $datarray['obj']) {
$datarray['obj']['id'] = $mid;
}
@@ -1285,7 +1299,7 @@ class Item extends Controller {
// This way we don't see every picture in your new photo album posted to your wall at once.
// They will show up as people comment on them.
- if (intval($parent_item['item_hidden'])) {
+ if ($parent_item && intval($parent_item['item_hidden'])) {
$r = q("UPDATE item SET item_hidden = 0 WHERE id = %d",
intval($parent_item['id'])
);
@@ -1437,7 +1451,11 @@ class Item extends Controller {
if ($complex) {
tag_deliver($i[0]['uid'], $i[0]['id']);
}
+
}
+
+ killme();
+
}
}
diff --git a/Zotlabs/Module/Lockview.php b/Zotlabs/Module/Lockview.php
index 3637482c7..bac3a7eb9 100644
--- a/Zotlabs/Module/Lockview.php
+++ b/Zotlabs/Module/Lockview.php
@@ -101,7 +101,7 @@ class Lockview extends Controller {
killme();
}
- if (intval($item['item_private']) && (!strlen($item['allow_cid'])) && (!strlen($item['allow_gid']))
+ if ((isset($item['item_private']) && intval($item['item_private'])) && (!strlen($item['allow_cid'])) && (!strlen($item['allow_gid']))
&& (!strlen($item['deny_cid'])) && (!strlen($item['deny_gid']))) {
// if the post is private, but public_policy is blank ("visible to the internet"), and there aren't any
diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php
index 0922eb5d4..3400defd7 100644
--- a/Zotlabs/Module/Owa.php
+++ b/Zotlabs/Module/Owa.php
@@ -32,14 +32,14 @@ class Owa extends Controller {
$keyId = $sigblock['keyId'];
if ($keyId) {
$r = q("SELECT * FROM hubloc LEFT JOIN xchan ON hubloc_hash = xchan_hash
- WHERE hubloc_id_url = '%s' AND hubloc_deleted = 0 ORDER BY hubloc_id DESC",
+ WHERE hubloc_id_url = '%s' AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC",
dbesc($keyId)
);
if (! $r) {
$found = discover_by_webbie($keyId);
if ($found) {
$r = q("SELECT * FROM hubloc LEFT JOIN xchan ON hubloc_hash = xchan_hash
- WHERE hubloc_id_url = '%s' AND hubloc_deleted = 0 ORDER BY hubloc_id DESC ",
+ WHERE hubloc_id_url = '%s' AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC ",
dbesc($keyId)
);
}