Browse Source

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
tags/3.6
Hypolite Petovan 2 years ago
parent
commit
585c00347d
3 changed files with 8 additions and 8 deletions
  1. +5
    -7
      boot.php
  2. +2
    -1
      index.php
  3. +1
    -0
      src/App.php

+ 5
- 7
boot.php 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);
}



+ 2
- 1
index.php 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";
}



+ 1
- 0
src/App.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;


Loading…
Cancel
Save