]> git.mxchange.org Git - friendica.git/blobdiff - index.php
Merge branch 'feature/edit-profile-improvements' into develop
[friendica.git] / index.php
index 39b4337f3cc337a308feeca33f6580be714d3a2f..1b60071534c5df978ca5a9beea8e5e5adb5bd284 100644 (file)
--- a/index.php
+++ b/index.php
@@ -191,6 +191,10 @@ if(strlen($a->module)) {
        if ($a->module == "stream")
                $a->module = "network";
 
+       // Compatibility with the Firefox App
+       if (($a->module == "users") AND ($a->cmd == "users/sign_in"))
+               $a->module = "login";
+
        $privateapps = get_config('config','private_addons');
 
        if(is_array($a->plugins) && in_array($a->module,$a->plugins) && file_exists("addon/{$a->module}/{$a->module}.php")) {
@@ -428,7 +432,7 @@ else
 $a->page['htmlhead'] = str_replace('{{$stylesheet}}',$stylesheet,$a->page['htmlhead']);
 //$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet));
 
-if ($_GET["mode"] == "raw") {
+if (isset($_GET["mode"]) AND (($_GET["mode"] == "raw") OR ($_GET["mode"] == "minimal"))) {
        $doc = new DOMDocument();
 
        $target = new DOMDocument();
@@ -449,6 +453,9 @@ if ($_GET["mode"] == "raw") {
                // And then append it to the target
                $target->documentElement->appendChild($item);
        }
+}
+
+if (isset($_GET["mode"]) AND ($_GET["mode"] == "raw")) {
 
        header("Content-type: text/html; charset=utf-8");
 
@@ -457,7 +464,8 @@ if ($_GET["mode"] == "raw") {
        session_write_close();
        exit;
 
-} elseif (get_pconfig(local_user(),'system','infinite_scroll') AND ($_GET["q"] == "network")) {
+} elseif (get_pconfig(local_user(),'system','infinite_scroll')
+          AND ($a->module == "network") AND ($_GET["mode"] != "minimal")) {
        if (is_string($_GET["page"]))
                $pageno = $_GET["page"];
        else
@@ -467,7 +475,11 @@ if ($_GET["mode"] == "raw") {
 
        foreach ($_GET AS $param => $value)
                if (($param != "page") AND ($param != "q"))
-                       $reload_uri .= "&".$param."=".$value;
+                       $reload_uri .= "&".$param."=".urlencode($value);
+
+       if (($a->page_offset != "") AND !strstr($reload_uri, "&offset="))
+               $reload_uri .= "&offset=".urlencode($a->page_offset);
+
 
 $a->page['htmlhead'] .= <<< EOT
 <script type="text/javascript">
@@ -494,9 +506,14 @@ var num = $pageno;
 
 $(window).scroll(function(e){
 
-       //if ($(window).scrollTop() == $(document).height() - $(window).height()){
-       if ($(window).scrollTop() > $("section").height() - $(window).height()){
-               loadcontent();
+       if ($(document).height() != $(window).height()) {
+               // First method that is expected to work - but has problems with Chrome
+               if ($(window).scrollTop() == $(document).height() - $(window).height())
+                       loadcontent();
+       } else {
+               // This method works with Chrome - but seems to be much slower in Firefox
+               if ($(window).scrollTop() > (($("section").height() + $("header").height() + $("footer").height()) - $(window).height()))
+                       loadcontent();
        }
 });
 </script>
@@ -510,13 +527,21 @@ $profile = $a->profile;
 
 header("Content-type: text/html; charset=utf-8");
 
-$template = 'view/theme/' . current_theme() . '/' 
-       . ((x($a->page,'template')) ? $a->page['template'] : 'default' ) . '.php';
 
-if(file_exists($template))
-       require_once($template);
-else
-       require_once(str_replace('theme/' . current_theme() . '/', '', $template));
+if (isset($_GET["mode"]) AND ($_GET["mode"] == "minimal")) {
+       //$page['content'] = substr($target->saveHTML(), 6, -8)."\n\n".
+       //                      '<div id="conversation-end"></div>'."\n\n";
+
+       require "view/minimal.php";
+} else {
+       $template = 'view/theme/' . current_theme() . '/' 
+               . ((x($a->page,'template')) ? $a->page['template'] : 'default' ) . '.php';
+
+       if(file_exists($template))
+               require_once($template);
+       else
+               require_once(str_replace('theme/' . current_theme() . '/', '', $template));
+}
 
 session_write_close();
 exit;