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
This commit is contained in:
Hypolite Petovan 2018-01-01 15:08:00 -05:00
parent 54d598ce7c
commit 585c00347d
3 changed files with 8 additions and 8 deletions

View File

@ -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);
}

View File

@ -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";
}

View File

@ -37,6 +37,7 @@ class App {
public $query_string;
public $config;
public $page;
public $page_offset;
public $profile;
public $profile_uid;
public $user;