aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-03-03 12:39:41 +0000
committerMario <mario@mariovavti.com>2021-03-03 14:11:29 +0100
commit3d264f5a55f340e3c20c1181c8b4578abecf3f1c (patch)
tree6c5eba25568a65e7317588717df048042a45685a /include
parentfbb1d6aa41d9eb7a27b4a8bc79747ac0797db0c7 (diff)
downloadvolse-hubzilla-3d264f5a55f340e3c20c1181c8b4578abecf3f1c.tar.gz
volse-hubzilla-3d264f5a55f340e3c20c1181c8b4578abecf3f1c.tar.bz2
volse-hubzilla-3d264f5a55f340e3c20c1181c8b4578abecf3f1c.zip
php8: fix warnings during install procedure
(cherry picked from commit 48bae9d4219735bc44f4ee72228d19d3e6b9efc9)
Diffstat (limited to 'include')
-rw-r--r--include/account.php12
-rw-r--r--include/channel.php10
-rw-r--r--include/environment.php9
-rw-r--r--include/language.php14
-rw-r--r--include/permissions.php25
5 files changed, 39 insertions, 31 deletions
diff --git a/include/account.php b/include/account.php
index 34936c33f..fefe61d15 100644
--- a/include/account.php
+++ b/include/account.php
@@ -605,8 +605,8 @@ function account_approve($hash) {
*/
function downgrade_accounts() {
- $r = q("select * from account where not ( account_flags & %d ) > 0
- and account_expires > '%s'
+ $r = q("select * from account where not ( account_flags & %d ) > 0
+ and account_expires > '%s'
and account_expires < %s ",
intval(ACCOUNT_EXPIRED),
dbesc(NULL_DATE),
@@ -746,8 +746,8 @@ function service_class_fetch($uid, $property) {
$service_class = App::$account['account_service_class'];
}
else {
- $r = q("select account_service_class as service_class
- from channel c, account a
+ $r = q("select account_service_class as service_class
+ from channel c, account a
where c.channel_account_id=a.account_id and c.channel_id= %d limit 1",
intval($uid)
);
@@ -780,6 +780,8 @@ function service_class_fetch($uid, $property) {
*/
function account_service_class_fetch($aid, $property) {
+ $service_class = null;
+
$r = q("select account_service_class as service_class from account where account_id = %d limit 1",
intval($aid)
);
@@ -787,7 +789,7 @@ function account_service_class_fetch($aid, $property) {
$service_class = $r[0]['service_class'];
}
- if(! x($service_class))
+ if(! isset($service_class))
return false; // everything is allowed
$arr = get_config('service_class', $service_class);
diff --git a/include/channel.php b/include/channel.php
index c6ca673eb..d1095115d 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -303,8 +303,8 @@ function create_identity($arr) {
$photo_type = null;
$z = [
- 'account' => $a[0],
- 'channel' => $r[0],
+ 'account' => $a[0] ?? [],
+ 'channel' => $r[0] ?? [],
'photo_url' => ''
];
/**
@@ -1098,11 +1098,11 @@ function identity_basic_export($channel_id, $sections = null, $zap_compat = fals
// @fixme - Not totally certain how to handle $zot_compat for the event timezone which exists
// in Hubzilla but is stored with the item and not the event. In Zap, stored information is
- // always UTC and localised on access as per standard conventions for working with global time data.
+ // always UTC and localised on access as per standard conventions for working with global time data.
// Older Zot (pre-Zot6) records aren't translated correctly w/r/t AS2 so only include events for the last year or so if
- // migrating to Zap.
-
+ // migrating to Zap.
+
$sqle = (($zap_compat) ? " and created > '2020-01-01 00:00:00' " : '');
$r = q("select * from event where uid = %d $sqle",
diff --git a/include/environment.php b/include/environment.php
index 96a614821..274eca214 100644
--- a/include/environment.php
+++ b/include/environment.php
@@ -52,17 +52,18 @@ function getPhpiniUploadLimits() {
*/
function phpiniSizeToBytes($val) {
$val = trim($val);
+ $num = (double)$val;
$unit = strtolower($val[strlen($val)-1]);
switch($unit) {
case 'g':
- $val *= 1024;
+ $num *= 1024;
case 'm':
- $val *= 1024;
+ $num *= 1024;
case 'k':
- $val *= 1024;
+ $num *= 1024;
default:
break;
}
- return (int)$val;
+ return (int)$num;
}
diff --git a/include/language.php b/include/language.php
index 622b9614d..d291deb63 100644
--- a/include/language.php
+++ b/include/language.php
@@ -77,7 +77,7 @@ function get_best_language() {
if(! isset($preferred)) {
/*
- * We could find no perfect match for any of the preferred languages.
+ * We could find no perfect match for any of the preferred languages.
* For cases where the preference is fr-fr and we have fr but *not* fr-fr
* run the test again and only look for the language base
* which should provide an interface they can sort of understand
@@ -262,11 +262,15 @@ function tt($singular, $plural, $count, $ctx = ''){
* @return string
*/
function ta($k){
+ $t = null;
- $t = App::$strings[$k];
- if (is_array($t))
- $t = implode("/", $t);
- return ($t == "" ? $k : $t);
+ if(isset(App::$strings[$k]))
+ $t = App::$strings[$k];
+
+ if (is_array($t))
+ $t = implode("/", $t);
+
+ return ($t == "" ? $k : $t);
}
/**
diff --git a/include/permissions.php b/include/permissions.php
index c7eee11f4..9dd503132 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -6,7 +6,7 @@ require_once('include/security.php');
* @file include/permissions.php
*
* This file conntains functions to check and work with permissions.
- *
+ *
*/
@@ -27,7 +27,7 @@ function get_all_perms($uid, $observer_xchan, $check_siteblock = true, $default_
$api = App::get_oauth_key();
if($api)
- return get_all_api_perms($uid,$api);
+ return get_all_api_perms($uid,$api);
$global_perms = \Zotlabs\Access\Permissions::Perms();
@@ -210,7 +210,7 @@ function get_all_perms($uid, $observer_xchan, $check_siteblock = true, $default_
$ret[$perm_name] = false;
continue;
}
-
+
$ret[$perm_name] = true;
continue;
}
@@ -294,14 +294,14 @@ function perm_is_allowed($uid, $observer_xchan, $permission, $check_siteblock =
if($channel_perm & PERMS_AUTHED)
return true;
- $x = q("select abook_my_perms, abook_blocked, abook_ignored, abook_pending, xchan_network from abook left join xchan on abook_xchan = xchan_hash
+ $x = q("select abook_my_perms, abook_blocked, abook_ignored, abook_pending, xchan_network from abook left join xchan on abook_xchan = xchan_hash
where abook_channel = %d and abook_xchan = '%s' and abook_self = 0 limit 1",
intval($uid),
dbesc($observer_xchan)
);
// If they're blocked - they can't read or write
-
+
if(($x) && intval($x[0]['abook_blocked']))
return false;
@@ -324,9 +324,9 @@ function perm_is_allowed($uid, $observer_xchan, $permission, $check_siteblock =
// This requires an explanation and the effects are subtle.
// The following line creates a fake connection, and this allows
- // access tokens to have specific permissions even though they are
+ // access tokens to have specific permissions even though they are
// not actual connections.
- // The existence of this fake entry must be checked when dealing
+ // The existence of this fake entry must be checked when dealing
// with connection related permissions.
$x = array(pseudo_abook($y[0]));
@@ -343,7 +343,7 @@ function perm_is_allowed($uid, $observer_xchan, $permission, $check_siteblock =
return false;
// Check if this $uid is actually the $observer_xchan
- // you will have full access unless the channel was moved -
+ // you will have full access unless the channel was moved -
// in which case you will have read_only access
if($r[0]['channel_hash'] === $observer_xchan) {
@@ -366,7 +366,7 @@ function perm_is_allowed($uid, $observer_xchan, $permission, $check_siteblock =
// If we're still here, we have an observer, check the network.
if($channel_perm & PERMS_NETWORK) {
- if ($x && in_array($x[0]['xchan_network'], ['zot','zot6']))
+ if ($x && in_array($x[0]['xchan_network'], ['zot','zot6']))
return true;
}
@@ -382,7 +382,7 @@ function perm_is_allowed($uid, $observer_xchan, $permission, $check_siteblock =
return false;
}
- // From here on we require that the observer be a connection or pseudo connection
+ // From here on we require that the observer be a connection or pseudo connection
if(! $x) {
return false;
@@ -425,7 +425,7 @@ function perm_is_allowed($uid, $observer_xchan, $permission, $check_siteblock =
return false;
}
-function get_all_api_perms($uid,$api) {
+function get_all_api_perms($uid,$api) {
$global_perms = \Zotlabs\Access\Permissions::Perms();
@@ -541,7 +541,8 @@ function site_default_perms() {
'write_pages' => PERMS_SPECIFIC,
'write_wiki' => PERMS_SPECIFIC,
'delegate' => PERMS_SPECIFIC,
- 'post_like' => PERMS_NETWORK
+ 'republish' => PERMS_SPECIFIC,
+ 'post_like' => PERMS_NETWORK,
);
$global_perms = \Zotlabs\Access\Permissions::Perms();