From: Hypolite Petovan Date: Mon, 1 Jan 2018 20:08:00 +0000 (-0500) Subject: Fix PHP notices in boot, index and App X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=585c00347d501b3f61c2c0bd662fd7b2562f9ac9;p=friendica.git 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 --- diff --git a/boot.php b/boot.php index a9d5ffdb88..73a1ef1007 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 9cbbad605a..a20646cb0f 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 c32cf79d98..f9f4434490 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;