mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
fix php warnings
This commit is contained in:
@@ -113,8 +113,8 @@ class Notifier {
|
||||
$normal_mode = true;
|
||||
$upstream = false;
|
||||
$uplink = false;
|
||||
$target_item = [];
|
||||
$parent_item = [];
|
||||
$target_item = null;
|
||||
$parent_item = null;
|
||||
$top_level_post = false;
|
||||
$relay_to_owner = false;
|
||||
|
||||
@@ -651,7 +651,7 @@ class Notifier {
|
||||
// This shouldn't produce false positives on comment boosts that were generated on other platforms
|
||||
// because we won't be delivering them.
|
||||
|
||||
if (isset($target_item) && isset($target_item['verb']) && $target_item['verb'] === 'Announce' && $target_item['author_xchan'] === $target_item['owner_xchan'] && ! intval($target_item['item_thread_top'])) {
|
||||
if (isset($target_item['verb']) && $target_item['verb'] === 'Announce' && $target_item['author_xchan'] === $target_item['owner_xchan'] && ! intval($target_item['item_thread_top'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -694,7 +694,7 @@ class Notifier {
|
||||
|
||||
}
|
||||
|
||||
if ($normal_mode) {
|
||||
if ($normal_mode && is_array($target_item)) {
|
||||
// This wastes a process if there are no delivery hooks configured, so check this before launching the new process
|
||||
$x = q("select * from hook where hook = 'notifier_normal'");
|
||||
if ($x) {
|
||||
|
||||
@@ -162,7 +162,7 @@ class XConfig {
|
||||
*/
|
||||
static public function Delete($xchan, $family, $key) {
|
||||
|
||||
if(x(\App::$config[$xchan][$family], $key))
|
||||
if(isset(\App::$config[$xchan][$family][$key]))
|
||||
unset(\App::$config[$xchan][$family][$key]);
|
||||
|
||||
$ret = q("DELETE FROM xconfig WHERE xchan = '%s' AND cat = '%s' AND k = '%s'",
|
||||
|
||||
@@ -396,7 +396,7 @@ class Directory extends Controller {
|
||||
|
||||
ksort($entries); // Sort array by key so that foreach-constructs work as expected
|
||||
|
||||
if($j['keywords']) {
|
||||
if(isset($j['keywords']) && $j['keywords']) {
|
||||
App::$data['directory_keywords'] = $j['keywords'];
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ class Rpost extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
}
|
||||
|
||||
if($_REQUEST['remote_return']) {
|
||||
if(isset($_REQUEST['remote_return']) && $_REQUEST['remote_return']) {
|
||||
$_SESSION['remote_return'] = $_REQUEST['remote_return'];
|
||||
}
|
||||
if(argc() > 1 && argv(1) === 'return') {
|
||||
@@ -162,14 +162,14 @@ class Rpost extends \Zotlabs\Web\Controller {
|
||||
|
||||
$plaintext = true;
|
||||
|
||||
if(array_key_exists('type', $_REQUEST) && $_REQUEST['type'] === 'html') {
|
||||
if(isset($_REQUEST['type']) && $_REQUEST['type'] === 'html') {
|
||||
require_once('include/html2bbcode.php');
|
||||
$_REQUEST['body'] = html2bbcode($_REQUEST['body']);
|
||||
}
|
||||
|
||||
$channel = \App::get_channel();
|
||||
|
||||
if($_REQUEST['acl']) {
|
||||
if(isset($_REQUEST['acl']) && $_REQUEST['acl']) {
|
||||
$acl = new \Zotlabs\Access\AccessList([]);
|
||||
$acl->set($_REQUEST['acl']);
|
||||
$channel_acl = $acl->get();
|
||||
@@ -180,13 +180,13 @@ class Rpost extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
|
||||
|
||||
if($_REQUEST['url']) {
|
||||
if(isset($_REQUEST['url']) && $_REQUEST['url']) {
|
||||
$x = z_fetch_url(z_root() . '/linkinfo?f=&url=' . urlencode($_REQUEST['url']));
|
||||
if($x['success'])
|
||||
$_REQUEST['body'] = $_REQUEST['body'] . $x['body'];
|
||||
}
|
||||
|
||||
if($_REQUEST['post_id']) {
|
||||
if(isset($_REQUEST['post_id']) && $_REQUEST['post_id']) {
|
||||
$_REQUEST['body'] .= '[share=' . intval($_REQUEST['post_id']) . '][/share]';
|
||||
}
|
||||
|
||||
|
||||
@@ -146,10 +146,10 @@ class Search extends Controller {
|
||||
$o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1))
|
||||
. "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n";
|
||||
|
||||
App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"), [
|
||||
App::$page['htmlhead'] = replace_macros(get_markup_template("build_query.tpl"), [
|
||||
'$baseurl' => z_root(),
|
||||
'$pgtype' => 'search',
|
||||
'$uid' => ((App::$profile['profile_uid']) ? App::$profile['profile_uid'] : '0'),
|
||||
'$uid' => App::$profile['profile_uid'] ?? '0',
|
||||
'$gid' => '0',
|
||||
'$cid' => '0',
|
||||
'$cmin' => '(-1)',
|
||||
@@ -180,6 +180,8 @@ class Search extends Controller {
|
||||
|
||||
}
|
||||
|
||||
$r = null;
|
||||
|
||||
if (($update) && ($load)) {
|
||||
$itemspage = get_pconfig(local_channel(), 'system', 'itemspage');
|
||||
App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 10));
|
||||
@@ -195,8 +197,6 @@ class Search extends Controller {
|
||||
$sys_id = perm_is_allowed($sys['channel_id'], $observer_hash, 'view_stream') ? $sys['channel_id'] : 0;
|
||||
|
||||
if ($load) {
|
||||
$r = null;
|
||||
|
||||
if (local_channel()) {
|
||||
$r = q("SELECT mid, MAX(id) AS item_id FROM item
|
||||
WHERE (( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = '' AND item.deny_gid = '' AND item.item_private = 0 )
|
||||
@@ -208,7 +208,7 @@ class Search extends Controller {
|
||||
);
|
||||
}
|
||||
|
||||
if (!$r) {
|
||||
if ($r === null) {
|
||||
$r = q("SELECT mid, MAX(id) AS item_id FROM item
|
||||
WHERE (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = '' AND item.deny_gid = '' AND item.item_private = 0 )
|
||||
AND item.uid IN ( " . stream_perms_api_uids(($observer_hash) ? (PERMS_NETWORK | PERMS_PUBLIC) : PERMS_PUBLIC) . " ))
|
||||
@@ -225,11 +225,6 @@ class Search extends Controller {
|
||||
$r = dbq("select *, id as item_id from item where id in ( " . $str . ") order by created desc");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$r = [];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$items = [];
|
||||
|
||||
@@ -77,6 +77,7 @@ function guess_image_type($filename, $data = '') {
|
||||
|
||||
$type = null;
|
||||
$m = null;
|
||||
$headers = '';
|
||||
|
||||
$ph = photo_factory('');
|
||||
$types = $ph->supportedTypes();
|
||||
|
||||
@@ -555,7 +555,7 @@ function dir_tagblock($link,$r) {
|
||||
$o = '';
|
||||
|
||||
if(! $r)
|
||||
$r = App::$data['directory_keywords'];
|
||||
$r = App::$data['directory_keywords'] ?? [];
|
||||
|
||||
if($r) {
|
||||
$o = '<div class="dirtagblock widget"><h3>' . t('Keywords') . '</h3><div class="tags" align="center">';
|
||||
|
||||
@@ -2206,6 +2206,8 @@ function mimetype_select($channel_id, $current = 'text/bbcode', $choices = null,
|
||||
$x['application/x-php'] = t('PHP');
|
||||
}
|
||||
|
||||
$options = '';
|
||||
|
||||
foreach($x as $y => $z) {
|
||||
$selected = (($y == $current) ? ' selected="selected" ' : '');
|
||||
$options .= '<option value="' . $y . '"' . $selected . '>' . $z . '</option>';
|
||||
|
||||
Reference in New Issue
Block a user