]> git.mxchange.org Git - friendica.git/blobdiff - index.php
quattro: add "view in context" link in search results
[friendica.git] / index.php
old mode 100644 (file)
new mode 100755 (executable)
index 3db8170..5f6d74a
--- a/index.php
+++ b/index.php
@@ -2,7 +2,7 @@
 
 /**
  *
- * Friendika
+ * Friendica
  *
  */
 
@@ -75,8 +75,6 @@ $a->timezone = (($default_timezone) ? $default_timezone : 'UTC');
 
 date_default_timezone_set($a->timezone);
 
-$a->init_pagehead();
-
 session_start();
 
 /**
@@ -84,8 +82,12 @@ session_start();
  * We have to do it here because the session was just now opened.
  */
 
-if(x($_POST,'system_language'))
-       $_SESSION['language'] = $_POST['system_language'];
+if(array_key_exists('system_language',$_POST)) {
+       if(strlen($_POST['system_language']))
+               $_SESSION['language'] = $_POST['system_language'];
+       else
+               unset($_SESSION['language']);
+}
 if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
        $lang = $_SESSION['language'];
        load_translation_table($lang);
@@ -111,6 +113,16 @@ if((x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module ==
 if(! x($_SESSION,'authenticated'))
        header('X-Account-Management-Status: none');
 
+
+/*
+ * Create the page head after setting the language
+ * and getting any auth credentials
+ */
+
+$a->init_pagehead();
+
+
+
 if(! x($_SESSION,'sysmsg'))
        $_SESSION['sysmsg'] = array();
 
@@ -129,6 +141,7 @@ if($install)
 else
        check_config($a);
 
+nav_set_selected('nothing');
 
 $arr = array('app_menu' => $a->apps);
 
@@ -136,7 +149,6 @@ call_hooks('app_menu', $arr);
 
 $a->apps = $arr['app_menu'];
 
-
 /**
  *
  * We have already parsed the server path into $a->argc and $a->argv
@@ -207,10 +219,20 @@ if(strlen($a->module)) {
 
                logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG);
                header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
-               notice( t('Page not found.' ) . EOL);
+               $tpl = get_markup_template("404.tpl");
+               $a->page['content'] = replace_macros($tpl, array(
+                       '$message' =>  t('Page not found.' )
+               ));
        }
 }
 
+/**
+ * load current theme info
+ */
+$theme_info_file = "view/theme/".current_theme()."/theme.php";
+if (file_exists($theme_info_file)){
+       require_once($theme_info_file);
+}
 
 
 /* initialise content region */