1
0
Fork 0
friendica_2020-09-1_sharedH.../index.php

116 lines
2.6 KiB
PHP
Raw Normal View History

2010-07-02 01:48:07 +02:00
<?php
require_once("boot.php");
$a = new App;
$debug_text = ''; // Debugging functions should never be used on production systems.
// Setup the database.
$install = ((file_exists('.htconfig.php')) ? false : true);
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
unset($db_host, $db_user, $db_pass, $db_data);
2010-08-16 06:49:29 +02:00
if(! $install)
require_once("session.php");
2010-07-02 01:48:07 +02:00
require_once("datetime.php");
date_default_timezone_set(($default_timezone) ? $default_timezone : 'UTC');
$a->init_pagehead();
session_start();
2010-08-16 14:23:26 +02:00
2010-07-02 01:48:07 +02:00
if((x($_SESSION,'authenticated')) || (x($_POST['auth-params'])))
require("auth.php");
if($install)
$a->module = 'install';
else
check_config($a);
2010-07-02 01:48:07 +02:00
if(strlen($a->module)) {
if(file_exists("mod/{$a->module}.php")) {
include("mod/{$a->module}.php");
$a->module_loaded = true;
}
else {
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
2010-09-09 05:14:17 +02:00
notice( t('Page not found.' ) . EOL);
2010-07-02 01:48:07 +02:00
}
}
if($a->module_loaded) {
$a->page['page_title'] = $a->module;
if(function_exists($a->module . '_init')) {
$func = $a->module . '_init';
$func($a);
}
if(($_SERVER['REQUEST_METHOD'] == 'POST') && (! $a->error)
&& (function_exists($a->module . '_post'))
&& (! x($_POST,'auth-params'))) {
$func = $a->module . '_post';
$func($a);
}
if((! $a->error) && (function_exists($a->module . '_afterpost'))) {
$func = $a->module . '_afterpost';
$func($a);
}
if((! $a->error) && (function_exists($a->module . '_content'))) {
$func = $a->module . '_content';
$a->page['content'] .= $func($a);
}
}
2010-09-09 05:14:17 +02:00
if(stristr($_SESSION['sysmsg'], t('Permission denied'))) {
header($_SERVER["SERVER_PROTOCOL"] . ' 403 ' . t('Permission denied.'));
}
2010-07-02 01:48:07 +02:00
// report anything important happening
if(x($_SESSION,'sysmsg')) {
2010-08-04 04:34:33 +02:00
$a->page['content'] = "<div id=\"sysmsg\" class=\"error-message\">{$_SESSION['sysmsg']}</div>\r\n"
2010-07-02 01:48:07 +02:00
. $a->page['content'];
unset($_SESSION['sysmsg']);
}
// Feel free to comment out this line on production sites.
$a->page['content'] .= $debug_text;
$a->page['content'] .= '<div id="pause"><img src="" alt="" /></div>';
2010-07-02 01:48:07 +02:00
// build page
2010-07-02 01:48:07 +02:00
// Navigation (menu) template
2010-08-16 06:49:29 +02:00
if($a->module != 'install')
require_once("nav.php");
2010-07-02 01:48:07 +02:00
2010-08-16 14:23:26 +02:00
$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array(
'$stylesheet' => $a->get_baseurl() . '/view/theme/'
. ((x($_SESSION,'theme')) ? $_SESSION['theme'] : 'default')
. '/style.css'
));
2010-07-02 01:48:07 +02:00
$page = $a->page;
$profile = $a->profile;
header("Content-type: text/html; charset=utf-8");
2010-08-16 14:23:26 +02:00
2010-07-02 01:48:07 +02:00
$template = "view/"
. ((x($a->page,'template')) ? $a->page['template'] : 'default' )
. ".php";
require_once($template);
session_write_close();
exit;