]> git.mxchange.org Git - friendica.git/blobdiff - index.php
killme() does the same here + added curly braces
[friendica.git] / index.php
index d3310ba1aad256026e07f9b6b3f47a32d8dce15a..19f283039c49debd9f96194e4d80f3dcbeb465e2 100644 (file)
--- a/index.php
+++ b/index.php
@@ -417,24 +417,8 @@ if (stristr( implode("",$_SESSION['sysmsg']), t('Permission denied'))) {
  *
  */
 
-/*if (x($_SESSION,'sysmsg')) {
-       $a->page['content'] = "<div id=\"sysmsg\" class=\"error-message\">{$_SESSION['sysmsg']}</div>\r\n"
-               . ((x($a->page,'content')) ? $a->page['content'] : '');
-       $_SESSION['sysmsg']="";
-       unset($_SESSION['sysmsg']);
-}
-if (x($_SESSION,'sysmsg_info')) {
-       $a->page['content'] = "<div id=\"sysmsg_info\" class=\"info-message\">{$_SESSION['sysmsg_info']}</div>\r\n"
-               . ((x($a->page,'content')) ? $a->page['content'] : '');
-       $_SESSION['sysmsg_info']="";
-       unset($_SESSION['sysmsg_info']);
-}*/
-
-
-
 call_hooks('page_end', $a->page['content']);
 
-
 /**
  *
  * Add the navigation (menu) template
@@ -482,6 +466,7 @@ if (isset($_GET["mode"]) AND (($_GET["mode"] == "raw") OR ($_GET["mode"] == "min
 
        $content = mb_convert_encoding($a->page["content"], 'HTML-ENTITIES', "UTF-8");
 
+       /// @TODO one day, kill those error-surpressing @ stuff, or PHP should ban it
        @$doc->loadHTML($content);
 
        $xpath = new DomXPath($doc);
@@ -489,7 +474,6 @@ if (isset($_GET["mode"]) AND (($_GET["mode"] == "raw") OR ($_GET["mode"] == "min
        $list = $xpath->query("//*[contains(@id,'tread-wrapper-')]");  /* */
 
        foreach ($list as $item) {
-
                $item = $target->importNode($item, true);
 
                // And then append it to the target
@@ -503,24 +487,22 @@ if (isset($_GET["mode"]) AND ($_GET["mode"] == "raw")) {
 
        echo substr($target->saveHTML(), 6, -8);
 
-       if (!$a->is_backend()) {
-               session_write_close();
-       }
-       exit;
-
+       killme();
 }
 
 $page    = $a->page;
 $profile = $a->profile;
 
-header("X-Friendica-Version: ".FRIENDICA_VERSION);
+header("X-Friendica-Version: " . FRIENDICA_VERSION);
 header("Content-type: text/html; charset=utf-8");
 
-// We use $_GET["mode"] for special page templates. So we will check if we have 
-// to load another page template than the default one
-// The page templates are located in /view/php/ or in the theme directory
+/*
+ * We use $_GET["mode"] for special page templates. So we will check if we have 
+ * to load another page template than the default one.
+ * The page templates are located in /view/php/ or in the theme directory.
+ */
 if (isset($_GET["mode"])) {
-               $template = theme_include($_GET["mode"].'.php');
+       $template = theme_include($_GET["mode"] . '.php');
 }
 
 // If there is no page template use the default page template
@@ -528,8 +510,7 @@ if (!$template) {
        $template = theme_include("default.php");
 }
 
-require_once($template);
+/// @TODO Looks unsafe (remote-inclusion), is maybe not but theme_include() uses file_exists() but does not escape anything
+require_once $template;
 
-if (!$a->is_backend())
-       session_write_close();
-exit;
+killme();