From 4dd9e28f017d4d28789c5450332c4e70a5618062 Mon Sep 17 00:00:00 2001
From: Laurent Giovannoni <laurent.giovannoni@maarch.org>
Date: Wed, 5 Dec 2012 10:12:39 +0000
Subject: [PATCH] fix: #393 white page

---
 core/trunk/core/class/class_core_tools.php | 12 ++++++------
 core/trunk/core/init.php                   | 10 ++++------
 core/trunk/index.php                       |  5 ++---
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/core/trunk/core/class/class_core_tools.php b/core/trunk/core/class/class_core_tools.php
index e8a0a14d2b3..91e44bf489a 100644
--- a/core/trunk/core/class/class_core_tools.php
+++ b/core/trunk/core/class/class_core_tools.php
@@ -1288,7 +1288,7 @@ class core_tools extends functions
         <head>
             <title><?php  echo $title;?></title>
             <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-            <meta http-equiv="Content-Language" content="<?php  echo $_SESSION['config']['lang'];?>" />
+            <meta http-equiv="Content-Language" content="<?php echo $_SESSION['config']['lang'];?>" />
             <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
             <link rel="icon" type="image/png" href="<?php echo $_SESSION['config']['businessappurl'];?>static.php?filename=favicon.png"/>
             <link href="index.php?display&page=generate_search_xml" title="Maarch <?php 
@@ -1316,7 +1316,7 @@ class core_tools extends functions
     {
         ?>
         <link rel="stylesheet" type="text/css" href="<?php  echo $_SESSION['config']['businessappurl'].'merged_css.php'; ?>" media="screen" />
-        <!--[if lt IE 7.0]>  <link rel="stylesheet" type="text/css" href="<?php  echo $_SESSION['config']['businessappurl'].'merged_css.php?ie'; ?>" media="screen" />  <![endif]-->
+        <!--[if lt  IE 7.0]>  <link rel="stylesheet" type="text/css" href="<?php  echo $_SESSION['config']['businessappurl'].'merged_css.php?ie'; ?>" media="screen" />  <![endif]-->
         <!--[if gte IE 7.0]>  <link rel="stylesheet" type="text/css" href="<?php  echo $_SESSION['config']['businessappurl'].'merged_css.php?ie7'; ?>" media="screen" />  <![endif]-->
         <!--[if IE 8.0]>  <link rel="stylesheet" type="text/css" href="<?php  echo $_SESSION['config']['businessappurl'].'merged_css.php?ie8'; ?>" media="screen" />  <![endif]-->
         <!--[if gte IE 9.0]>  <link rel="stylesheet" type="text/css" href="<?php  echo $_SESSION['config']['businessappurl'].'merged_css.php?ie9'; ?>" media="screen" />  <![endif]-->
@@ -1857,14 +1857,14 @@ class core_tools extends functions
     public function get_session_time_expire()
     {
         $time = 0;
-        $ini_time = ((ini_get('session.gc_maxlifetime') / 60) - 1);
+        $ini_time = (ini_get('session.gc_maxlifetime') - 1) / 60;
         $maarch_time = $_SESSION['config']['cookietime'];
         
-        if ($maarch_time <= $ini_time)
+        if ($maarch_time <= $ini_time) {
             $time = $maarch_time;
-        else
+        } else {
             $time = $ini_time;
-        
+        }
         return $time;
     }
 
diff --git a/core/trunk/core/init.php b/core/trunk/core/init.php
index 4af9c0397b3..467d4e468f4 100644
--- a/core/trunk/core/init.php
+++ b/core/trunk/core/init.php
@@ -1,18 +1,16 @@
 <?php
 
 require_once dirname(__file__) . '/class/Url.php';
-
-session_name('maarch_entreprise_trunk');
+//dynamic session name
+session_name(base64_encode(dirname(__file__)));
 session_start();
 
-if (!isset($_SESSION['config'])) {
+if (!isset($_SESSION['config']) || !isset($_SESSION['businessapps'][0]['appid'])) {
     require_once('class/class_portal.php');
     $portal = new portal();
     $portal->unset_session();
     $portal->build_config();
 }
-
-
 if (isset($_SESSION['config']['default_timezone'])
     && ! empty($_SESSION['config']['default_timezone'])
 ) {
@@ -42,7 +40,7 @@ if (isset($_SESSION['custom_override_id'])
         . PATH_SEPARATOR . get_include_path()
     );
 } else if (isset($_SESSION['config']['corepath'])
-	&& ! empty($_SESSION['config']['corepath'])
+    && ! empty($_SESSION['config']['corepath'])
 ) {
     set_include_path(
         $_SESSION['config']['corepath'] . PATH_SEPARATOR . get_include_path()
diff --git a/core/trunk/index.php b/core/trunk/index.php
index ff8e2251aca..fc99ca6cc1e 100644
--- a/core/trunk/index.php
+++ b/core/trunk/index.php
@@ -40,10 +40,9 @@ if (!file_exists('installed.lck') && is_dir('install')) {
     header('location: install/index.php');
     exit;
 }
-if(isset($_GET['origin']) && $_GET['origin'] == 'scan')
-{
+if (isset($_GET['origin']) && $_GET['origin'] == 'scan') {
     header('location: apps/'.$_SESSION['businessapps'][0]['appid'].'/reopen.php');
-} elseif(count($_SESSION['businessapps'])== 1) {
+} else {
     $_SESSION['config']['app_id'] = $_SESSION['businessapps'][0]['appid'];
     /*header('location: apps/'.$_SESSION['config']['app_id']
         . '/index.php?display=true&page=login&coreurl='
-- 
GitLab