X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=index.php;h=c4de99fb67454e6704e3e79ca390c834c7f91709;hb=2342d41bcda2280f9e85bb26d0d80b930dc017c3;hp=a30c69d37d21f6d0796950993bad9796dbdbe4d5;hpb=2af943d7526703db4d5d2fb9dbd2f00600d8f1bb;p=friendica.git diff --git a/index.php b/index.php index a30c69d37d..c4de99fb67 100644 --- a/index.php +++ b/index.php @@ -15,7 +15,9 @@ 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); -require_once("session.php"); +if(! $install) + require_once("session.php"); + require_once("datetime.php"); date_default_timezone_set(($default_timezone) ? $default_timezone : 'UTC'); @@ -24,11 +26,14 @@ $a->init_pagehead(); session_start(); + if((x($_SESSION,'authenticated')) || (x($_POST['auth-params']))) require("auth.php"); if($install) $a->module = 'install'; +else + check_config($a); if(strlen($a->module)) { if(file_exists("mod/{$a->module}.php")) { @@ -36,23 +41,11 @@ if(strlen($a->module)) { $a->module_loaded = true; } else { - notice( t('Page not found' ) . EOL); + header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found')); + notice( t('Page not found.' ) . EOL); } } -// invoke module functions -// Important: Modules normally do not emit content, unless you need it for debugging. -// The module_init, module_post, and module_afterpost functions process URL parameters and POST processing. -// The module_content function returns content text to this function where it is included on the page. -// Modules emitting XML/Atom, etc. should do so in the _init function and promptly exit. -// "Most" HTML resides in the view directory as text templates with macro substitution. -// They look like HTML with PHP variables but only a couple pass through the PHP processor - those with .php extensions. -// The macro substitution is defined per page for the .tpl files. -// Information transfer between functions can be accomplished via the App session '$a' and its related variables. -// x() queries both a variable's existence and that it is "non-zero" or "non-empty" depending on how it is called. -// q() is the SQL query form. All string (%s) variables MUST be passed through dbesc(). -// All int values MUST be cast to integer using intval(); - if($a->module_loaded) { $a->page['page_title'] = $a->module; if(function_exists($a->module . '_init')) { @@ -77,7 +70,10 @@ if($a->module_loaded) { $a->page['content'] .= $func($a); } - footer($a); +} + +if(stristr($_SESSION['sysmsg'], t('Permission denied'))) { + header($_SERVER["SERVER_PROTOCOL"] . ' 403 ' . t('Permission denied.')); } // report anything important happening @@ -90,18 +86,26 @@ if(x($_SESSION,'sysmsg')) { // Feel free to comment out this line on production sites. $a->page['content'] .= $debug_text; - +$a->page['content'] .= '
'; // build page + // Navigation (menu) template -require_once("nav.php"); +if($a->module != 'install') + require_once("nav.php"); + +$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array( + '$stylesheet' => $a->get_baseurl() . '/view/theme/' + . ((x($_SESSION,'theme')) ? $_SESSION['theme'] : 'default') + . '/style.css' + )); $page = $a->page; $profile = $a->profile; header("Content-type: text/html; charset=utf-8"); + $template = "view/" - . ((x($a->page,'theme')) ? $a->page['theme'] . '/' : "" ) . ((x($a->page,'template')) ? $a->page['template'] : 'default' ) . ".php";