*/
require_once("include/dba.php");
-require_once("include/dbm.php");
if(!$install) {
$db = new dba($db_host, $db_user, $db_pass, $db_data, $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");
}
$stamp1 = microtime(true);
session_start();
$a->save_timestamp($stamp1, "parser");
+} else {
+ require_once "include/poller.php";
+
+ call_worker_if_idle();
}
/**
// 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)) {
echo substr($target->saveHTML(), 6, -8);
- session_write_close();
+ if (!$a->is_backend())
+ session_write_close();
exit;
}
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".
- // '<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));
+// 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;