From 8879776d6436ed5257648a1873ddaa9486b25070 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 23 Oct 2022 14:02:19 +0200 Subject: fix php warnings --- Zotlabs/Module/Cal.php | 2 +- Zotlabs/Module/Channel.php | 2 +- Zotlabs/Module/Directory.php | 2 +- Zotlabs/Module/Follow.php | 3 +-- Zotlabs/Module/Lostpass.php | 4 ++-- Zotlabs/Module/Manage.php | 2 +- Zotlabs/Module/Photos.php | 1 + Zotlabs/Module/Profile.php | 2 +- Zotlabs/Module/Pubsites.php | 4 +++- Zotlabs/Module/Settings.php | 7 ++++--- Zotlabs/Module/Settings/Channel.php | 9 +++++---- Zotlabs/Module/Settings/Display.php | 10 +++++----- Zotlabs/Module/Theme_info.php | 28 ++++++++++++++-------------- 13 files changed, 40 insertions(+), 36 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cal.php b/Zotlabs/Module/Cal.php index 329150424..9049fe7d0 100644 --- a/Zotlabs/Module/Cal.php +++ b/Zotlabs/Module/Cal.php @@ -39,7 +39,7 @@ class Cal extends Controller { head_set_icon(App::$data['channel']['xchan_photo_s']); - App::$page['htmlhead'] .= "" ; + App::$page['htmlhead'] = "" ; } diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 24a3fd44f..0874551d6 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -294,7 +294,7 @@ class Channel extends Controller { $abook_uids = " and abook.abook_channel = " . intval(App::$profile['profile_uid']) . " "; $simple_update = ''; - if ($update && $_SESSION['loadtime']) + if ($update && isset($_SESSION['loadtime'])) $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC', 'UTC', $_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC', 'UTC', $_SESSION['loadtime']) . "' ) "; if ($search) { diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index 8995f709c..d92ea2c0e 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -309,7 +309,7 @@ class Directory extends Controller { $keywords = str_replace(',',' ', $keywords); $keywords = str_replace(' ',' ', $keywords); $karr = explode(' ', $keywords); - + $marr = []; if($karr) { if(local_channel()) { $r = q("select keywords from profile where uid = %d and is_default = 1 limit 1", diff --git a/Zotlabs/Module/Follow.php b/Zotlabs/Module/Follow.php index 94daa4c70..54e29c492 100644 --- a/Zotlabs/Module/Follow.php +++ b/Zotlabs/Module/Follow.php @@ -72,8 +72,7 @@ class Follow extends Controller { $uid = local_channel(); $url = notags(trim(punify($_REQUEST['url']))); $return_url = $_SESSION['return_url']; - $confirm = intval($_REQUEST['confirm']); - $interactive = (($_REQUEST['interactive']) ? intval($_REQUEST['interactive']) : 1); + $interactive = $_REQUEST['interactive'] ?? 1; $channel = App::get_channel(); $result = Connect::connect($channel,$url); diff --git a/Zotlabs/Module/Lostpass.php b/Zotlabs/Module/Lostpass.php index 83478bb10..a0f9018b2 100644 --- a/Zotlabs/Module/Lostpass.php +++ b/Zotlabs/Module/Lostpass.php @@ -87,7 +87,7 @@ class Lostpass extends \Zotlabs\Web\Controller { if($r) { $tpl = get_markup_template('pwdreset.tpl'); - $o .= replace_macros($tpl,array( + $o = replace_macros($tpl,array( '$lbl1' => t('Password Reset'), '$lbl2' => t('Your password has been reset as requested.'), '$lbl3' => t('Your new password is'), @@ -126,7 +126,7 @@ class Lostpass extends \Zotlabs\Web\Controller { else { $tpl = get_markup_template('lostpass.tpl'); - $o .= replace_macros($tpl,array( + $o = replace_macros($tpl,array( '$title' => t('Forgot your Password?'), '$desc' => t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'), '$name' => t('Email Address'), diff --git a/Zotlabs/Module/Manage.php b/Zotlabs/Module/Manage.php index 3f168c15d..2cc05e09c 100644 --- a/Zotlabs/Module/Manage.php +++ b/Zotlabs/Module/Manage.php @@ -6,7 +6,7 @@ class Manage extends \Zotlabs\Web\Controller { function get() { - if((! get_account_id()) || ($_SESSION['delegate'])) { + if((! get_account_id()) || (isset($_SESSION['delegate']) && $_SESSION['delegate'])) { notice( t('Permission denied.') . EOL); return; } diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 6acaf6673..68f7c55e7 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -593,6 +593,7 @@ class Photos extends \Zotlabs\Web\Controller { */ $upload_form = ''; + $usage_message = ''; if($can_post) { diff --git a/Zotlabs/Module/Profile.php b/Zotlabs/Module/Profile.php index bcc7ad930..732beaa6a 100644 --- a/Zotlabs/Module/Profile.php +++ b/Zotlabs/Module/Profile.php @@ -110,7 +110,7 @@ class Profile extends Controller { $is_owner = ((local_channel()) && (local_channel() == App::$profile['profile_uid']) ? true : false); - if (App::$profile['hidewall'] && (!$is_owner) && (!remote_channel())) { + if ((isset(App::$profile['hidewall']) && App::$profile['hidewall']) && (!$is_owner) && (!remote_channel())) { notice(t('Permission denied.') . EOL); return; } diff --git a/Zotlabs/Module/Pubsites.php b/Zotlabs/Module/Pubsites.php index fd5aeaa72..032406be4 100644 --- a/Zotlabs/Module/Pubsites.php +++ b/Zotlabs/Module/Pubsites.php @@ -8,6 +8,8 @@ class Pubsites extends \Zotlabs\Web\Controller { function get() { $dirmode = intval(get_config('system','directory_mode')); + $url = ''; + if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) { $url = z_root() . '/dirsearch'; } @@ -19,7 +21,7 @@ class Pubsites extends \Zotlabs\Web\Controller { $rating_enabled = get_config('system','rating_enabled'); - $o .= '
'; + $o = '
'; $o .= '

' . t('Public Hubs') . '

'; diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 624cbb0c1..94f67a349 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -11,8 +11,9 @@ class Settings extends \Zotlabs\Web\Controller { if(! local_channel()) return; - if($_SESSION['delegate']) + if (isset($_SESSION['delegate']) && $_SESSION['delegate']) { return; + } \App::$profile_uid = local_channel(); @@ -33,7 +34,7 @@ class Settings extends \Zotlabs\Web\Controller { if(! local_channel()) return; - if($_SESSION['delegate']) + if(isset($_SESSION['delegate']) && $_SESSION['delegate']) return; // logger('mod_settings: ' . print_r($_REQUEST,true)); @@ -54,7 +55,7 @@ class Settings extends \Zotlabs\Web\Controller { nav_set_selected('Settings'); - if((! local_channel()) || ($_SESSION['delegate'])) { + if((! local_channel()) || (isset($_SESSION['delegate']) && $_SESSION['delegate'])) { notice( t('Permission denied.') . EOL ); return login(); } diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index 840efc162..1e0c2a2db 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -27,10 +27,10 @@ class Channel { $photo_path = ((x($_POST, 'photo_path')) ? escape_tags(trim($_POST['photo_path'])) : ''); $attach_path = ((x($_POST, 'attach_path')) ? escape_tags(trim($_POST['attach_path'])) : ''); $allow_location = (((x($_POST, 'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1 : 0); - $post_newfriend = (($_POST['post_newfriend'] == 1) ? 1 : 0); - $post_joingroup = (($_POST['post_joingroup'] == 1) ? 1 : 0); - $post_profilechange = (($_POST['post_profilechange'] == 1) ? 1 : 0); - $adult = (($_POST['adult'] == 1) ? 1 : 0); + $post_newfriend = ((isset($_POST['post_newfriend']) && $_POST['post_newfriend'] == 1) ? 1 : 0); + $post_joingroup = ((isset($_POST['post_joingroup']) && $_POST['post_joingroup'] == 1) ? 1 : 0); + $post_profilechange = ((isset($_POST['post_profilechange']) && $_POST['post_profilechange'] == 1) ? 1 : 0); + $adult = ((isset($_POST['adult']) && $_POST['adult'] == 1) ? 1 : 0); $mailhost = ((array_key_exists('mailhost', $_POST)) ? notags(trim($_POST['mailhost'])) : ''); $pageflags = $channel['channel_pageflags']; $existing_adult = (($pageflags & PAGE_ADULT) ? 1 : 0); @@ -152,6 +152,7 @@ class Channel { Master::Summon(['Directory', local_channel()]); Libsync::build_sync_packet(); + $email_changed = false; if ($email_changed && App::$config['system']['register_policy'] == REGISTER_VERIFY) { // FIXME - set to un-verified, blocked and redirect to logout diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index 11181907b..ea9ae2da1 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -90,8 +90,8 @@ class Display { $default_theme = 'redbasic'; $themespec = explode(':', \App::$channel['channel_theme']); - $existing_theme = $themespec[0]; - $existing_schema = $themespec[1]; + $existing_theme = $themespec[0] ?? ''; + $existing_schema = $themespec[1] ?? ''; $theme = (($existing_theme) ? $existing_theme : $default_theme); @@ -207,12 +207,12 @@ class Display { function get_theme_config_file($theme){ - $base_theme = \App::$theme_info['extends']; + $base_theme = \App::$theme_info['extends'] ?? ''; - if (file_exists("view/theme/$theme/php/config.php")){ + if ($theme && file_exists("view/theme/$theme/php/config.php")){ return "view/theme/$theme/php/config.php"; } - if (file_exists("view/theme/$base_theme/php/config.php")){ + if ($base_theme && file_exists("view/theme/$base_theme/php/config.php")){ return "view/theme/$base_theme/php/config.php"; } return null; diff --git a/Zotlabs/Module/Theme_info.php b/Zotlabs/Module/Theme_info.php index e27ec9444..bf1e5cb9b 100644 --- a/Zotlabs/Module/Theme_info.php +++ b/Zotlabs/Module/Theme_info.php @@ -9,7 +9,7 @@ class Theme_info extends \Zotlabs\Web\Controller { $theme = argv(1); if(! $theme) killme(); - + $schemalist = array(); $theme_config = ""; @@ -40,32 +40,32 @@ class Theme_info extends \Zotlabs\Web\Controller { $credits = ''; } - $ret = [ - 'theme' => $theme, - 'img' => get_theme_screenshot($theme), - 'desc' => $desc, - 'version' => $version, - 'credits' => $credits, + $ret = [ + 'theme' => $theme, + 'img' => get_theme_screenshot($theme), + 'desc' => $desc, + 'version' => $version, + 'credits' => $credits, 'schemas' => $schemalist, 'config' => $theme_config ]; json_return_and_die($ret); - + } function get_theme_config_file($theme){ - $base_theme = \App::$theme_info['extends']; - - if (file_exists("view/theme/$theme/php/config.php")){ + $base_theme = \App::$theme_info['extends'] ?? ''; + + if ($theme && file_exists("view/theme/$theme/php/config.php")){ return "view/theme/$theme/php/config.php"; - } - if (file_exists("view/theme/$base_theme/php/config.php")){ + } + if ($base_theme && file_exists("view/theme/$base_theme/php/config.php")){ return "view/theme/$base_theme/php/config.php"; } return null; } -} \ No newline at end of file +} -- cgit v1.2.3