浏览代码

Fixed Trac#300: each iTop instance now uses its own name for the cookie storing the session ID. Therefore several instances can coexist independently on the same server.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@913 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 年之前
父节点
当前提交
00c7bb1af3
共有 4 个文件被更改,包括 13 次插入0 次删除
  1. 1 0
      application/loginwebpage.class.inc.php
  2. 8 0
      core/config.class.inc.php
  3. 1 0
      pages/logoff.php
  4. 3 0
      setup/index.php

+ 1 - 0
application/loginwebpage.class.inc.php

@@ -339,6 +339,7 @@ EOF
 	static function DoLogin($bMustBeAdmin = false, $bIsAllowedToPortalUsers = false)
 	{
 		$operation = utils::ReadParam('loginop', '');
+		session_name(utils::GetConfig()->Get('session_name'));
 		session_start();
 
 		if ($operation == 'logoff')

+ 8 - 0
core/config.class.inc.php

@@ -110,6 +110,14 @@ class Config
 			'source_of_value' => '',
 			'show_in_conf_sample' => false,
 		),
+		'session_name' => array(
+			'type' => 'string',
+			'description' => 'The name of the cookie used to store the PHP session id',
+			'default' => 'iTop',
+			'value' => '',
+			'source_of_value' => '',
+			'show_in_conf_sample' => true,
+		),
 	);
 
 	public function IsProperty($sPropCode)

+ 1 - 0
pages/logoff.php

@@ -24,6 +24,7 @@ $currentOrganization = utils::ReadParam('org_id', '');
 $operation = utils::ReadParam('operation', '');
 
 require_once('../application/loginwebpage.class.inc.php');
+session_name(utils::GetConfig()->Get('session_name'));
 session_start();
 LoginWebPage::ResetSession();
 $oPage = new LoginWebPage();

+ 3 - 0
setup/index.php

@@ -1058,6 +1058,9 @@ function SetupFinished(SetupWebPage $oP, $aParamValues, $iCurrentStep, Config $o
 	$sAuthPwd = $aParamValues['auth_pwd'];
 	try
 	{
+		$sSessionName = sprintf('iTop-%x', rand());
+		$oConfig->Set('session_name', $sSessionName);
+		session_name($sSessionName);
 		session_start();
 		
 		// Write the final configuration file