X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=index.php;h=13c3f6318f815fd4923926836af04bca8abb8120;hb=b1999459afe1f955e7373f4b4894b44324b10e1e;hp=cde267cd19f3db07fa5160f9bccf84b668b384aa;hpb=c549ae939cd424c18052efd31f2d25ff9073f05f;p=friendica.git diff --git a/index.php b/index.php index cde267cd19..13c3f6318f 100644 --- a/index.php +++ b/index.php @@ -59,7 +59,8 @@ if(!$install) { if ($a->max_processes_reached() OR $a->maxload_reached()) { header($_SERVER["SERVER_PROTOCOL"].' 503 Service Temporarily Unavailable'); - header('Retry-After: 300'); + header('Retry-After: 120'); + header('Refresh: 120; url='.$a->get_baseurl()."/".$a->query_string); die("System is currently unavailable. Please try again later"); } @@ -108,7 +109,7 @@ if (x($_SESSION,'authenticated') && !x($_SESSION,'language')) { // we didn't loaded user data yet, but we need user language $r = q("SELECT language FROM user WHERE uid=%d", intval($_SESSION['uid'])); $_SESSION['language'] = $lang; - if (count($r)>0) $_SESSION['language'] = $r[0]['language']; + if (dbm::is_result($r)) $_SESSION['language'] = $r[0]['language']; } if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) { @@ -488,7 +489,8 @@ if (isset($_GET["mode"]) AND ($_GET["mode"] == "raw")) { echo substr($target->saveHTML(), 6, -8); - session_write_close(); + if (!$a->is_backend()) + session_write_close(); exit; } @@ -499,21 +501,20 @@ $profile = $a->profile; 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 +if (isset($_GET["mode"])) { + $template = theme_include($_GET["mode"].'.php'); +} -if (isset($_GET["mode"]) AND ($_GET["mode"] == "minimal")) { - //$page['content'] = substr($target->saveHTML(), 6, -8)."\n\n". - // '
'."\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)); +// If there is no page template use the default page template +if(!$template) { + $template = theme_include("default.php"); } -session_write_close(); +require_once($template); + +if (!$a->is_backend()) + session_write_close(); exit;