]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Merge pull request #4165 from MrPetovan/bug/4163-null-profile
[friendica.git] / boot.php
index a9d5ffdb883ac9d77b5198aa033c6276ca7e3743..8c3cd786f54dd5de79a074e143c528e77959aa0c 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -595,9 +595,6 @@ function defaults() {
        if (count($args) > 3) {
                throw new BadFunctionCallException('defaults() cannot use more than 3 parameters');
        }
-       if (count($args) === 3 && !is_array($args[0])) {
-               throw new BadFunctionCallException('defaults($arr, $key, $def) requires an array as first parameter');
-       }
        if (count($args) === 3 && is_null($args[1])) {
                throw new BadFunctionCallException('defaults($arr, $key, $def) $key is null');
        }
@@ -1635,14 +1632,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 +1647,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);
                }