From 2de972155e0355be47b7a7b825480f04d8e3d449 Mon Sep 17 00:00:00 2001
From: Laurent Giovannoni <laurent.giovannoni@maarch.org>
Date: Fri, 12 Aug 2011 16:27:41 +0000
Subject: [PATCH] evo : url

---
 core/trunk/core/init.php |  9 +++++++++
 core/trunk/index.php     | 20 +++++++++++++-------
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/core/trunk/core/init.php b/core/trunk/core/init.php
index cdb42cbb965..419dfb7f556 100644
--- a/core/trunk/core/init.php
+++ b/core/trunk/core/init.php
@@ -1,6 +1,15 @@
 <?php
 session_name('maarch_entreprise_trunk');
 session_start();
+
+if (!isset($_SESSION['config'])) {
+    require_once('class' . DIRECTORY_SEPARATOR . 'class_portal.php');
+    $portal = new portal();
+    $portal->unset_session();
+    $portal->build_config();
+}
+
+
 if (isset($_SESSION['config']['default_timezone']) 
     && ! empty($_SESSION['config']['default_timezone'])
 ) {
diff --git a/core/trunk/index.php b/core/trunk/index.php
index a2f07f7b0ca..d32036c8172 100644
--- a/core/trunk/index.php
+++ b/core/trunk/index.php
@@ -11,13 +11,14 @@
 * @author  Laurent Giovannoni  <dev@maarch.org>
 */
 
-include_once('core'.DIRECTORY_SEPARATOR.'init.php');
 require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_functions.php");
+include_once('core'.DIRECTORY_SEPARATOR.'init.php');
 require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_portal.php");
 require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_core_tools.php");
-$portal = new portal();
-$portal->unset_session();
-$portal->build_config();
+if (!isset($portal)) {
+    $portal = new portal();
+}
+#$portal->build_config();
 $func = new functions();
 $core = new core_tools();
 $_SESSION['custom_override_id'] = $core->get_custom_id();
@@ -25,20 +26,24 @@ $_SESSION['custom_override_id'] = $core->get_custom_id();
 /**** retrieve HTTP_REQUEST FROM SSO ****/
 $_SESSION['HTTP_REQUEST'] = $_REQUEST;
 
+/*
 if(isset($_SESSION['config']['defaultlang']) && !empty($_SESSION['config']['defaultlang']))
 {
 	include("portal".DIRECTORY_SEPARATOR.$_SESSION['config']['defaultlang'].'.php');
 }
-
+*/
 if(isset($_GET['origin']) && $_GET['origin'] == "scan")
 {
 	header("location: apps/".$_SESSION['businessapps'][0]['appid']."/reopen.php");
 }
 elseif(count($_SESSION['businessapps'])== 1)
 {
-	header("location: portal/launch_maarch.php?app=".$_SESSION['businessapps'][0]['appid']);
+	#header("location: portal/launch_maarch.php?app=".$_SESSION['businessapps'][0]['appid']);
+    $_SESSION['config']['app_id'] = $_SESSION['businessapps'][0]['appid'];
+    
+	header("location: apps/".$_SESSION['config']['app_id']."/index.php?display=true&page=login&coreurl=".$_SESSION['config']['coreurl']);
 }
-else
+/*else
 {
 ?>
     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -79,3 +84,4 @@ else
 <?php
 }
 ?>
+*/
-- 
GitLab