From 585c00347d501b3f61c2c0bd662fd7b2562f9ac9 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 1 Jan 2018 15:08:00 -0500 Subject: [PATCH] Fix PHP notices in boot, index and App - Use defaults() with $_GET variables in boot - Initialize $a before checking for object member in boot - Initilialize the $_SESSION variable for backend mode in index - Add member variable page_offset to App --- boot.php | 12 +++++------- index.php | 3 ++- src/App.php | 1 + 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/boot.php b/boot.php index a9d5ffdb8..73a1ef100 100644 --- a/boot.php +++ b/boot.php @@ -1635,14 +1635,11 @@ function argv($x) function infinite_scroll_data($module) { if (PConfig::get(local_user(), 'system', 'infinite_scroll') - && ($module == "network") && ($_GET["mode"] != "minimal") + && $module == 'network' + && defaults($_GET, 'mode', '') != 'minimal' ) { // get the page number - if (is_string($_GET["page"])) { - $pageno = $_GET["page"]; - } else { - $pageno = 1; - } + $pageno = defaults($_GET, 'page', 1); $reload_uri = ""; @@ -1653,7 +1650,8 @@ function infinite_scroll_data($module) } } - if (($a->page_offset != "") && ! strstr($reload_uri, "&offset=")) { + $a = get_app(); + if ($a->page_offset != "" && !strstr($reload_uri, "&offset=")) { $reload_uri .= "&offset=" . urlencode($a->page_offset); } diff --git a/index.php b/index.php index 9cbbad605..a20646cb0 100644 --- a/index.php +++ b/index.php @@ -97,6 +97,7 @@ if (!$a->is_backend()) { session_start(); $a->save_timestamp($stamp1, "parser"); } else { + $_SESSION = []; Worker::executeIfIdle(); } @@ -148,7 +149,7 @@ if ((x($_GET, 'zrl')) && (!$install && !$maintenance)) { // header('Link: <' . System::baseUrl() . '/amcd>; rel="acct-mgmt";'); -if (x($_COOKIE["Friendica"]) || (x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || ($a->module === 'login')) { +if (x($_COOKIE, "Friendica") || (x($_SESSION, 'authenticated')) || (x($_POST, 'auth-params')) || ($a->module === 'login')) { require "include/auth.php"; } diff --git a/src/App.php b/src/App.php index c32cf79d9..f9f443449 100644 --- a/src/App.php +++ b/src/App.php @@ -37,6 +37,7 @@ class App { public $query_string; public $config; public $page; + public $page_offset; public $profile; public $profile_uid; public $user;