[svn r12476] Introduced config-file settable session cookie lifetime. Defaults to 100 hours. Can be changed in config file (not in DB because used before DB connection).

Updated install scripts as well to create variable in config file. Upgrade should work as well as there is a last-resort default value set in the code.
skala
Yannick Warnier 18 years ago
parent dbaf9dcc8b
commit 575a6c0aa4
  1. 15
      main/inc/lib/main_api.lib.php
  2. 2
      main/install/configuration.dist.php
  3. 54
      main/install/index.php
  4. 2
      main/install/install_upgrade.lib.php

@ -551,7 +551,12 @@ function api_store_result($result)
==============================================================================
*/
/**
* start the dokeos session
* Start the Dokeos session.
*
* The default lifetime for session is set here. It is not possible to have it
* as a database setting as it is used before the database connection has been made.
* It is taken from the configuration file, and if it doesn't exist there, it is set
* to 360000 seconds
*
* @author Olivier Brouckaert
* @param string variable - the variable name to save into the session
@ -559,8 +564,14 @@ function api_store_result($result)
function api_session_start($already_installed = true)
{
global $storeSessionInDb;
global $_configuration;
if($already_installed){
session_set_cookie_params(3600,api_get_path(REL_PATH));
$session_lifetime = 360000;
if(isset($_configuration['session_lifetime']))
{
$session_lifetime = $_configuration['session_lifetime'];
}
session_set_cookie_params($session_lifetime,api_get_path(REL_PATH));
}
if (is_null($storeSessionInDb))
{

@ -141,6 +141,8 @@ $_configuration['security_key'] = '{SECURITY_KEY}';
$userPasswordCrypted = {ENCRYPT_PASSWORD};
// You may have to restart your web server if you change this
$storeSessionInDb = false;
// Session lifetime
$_configuration['session_lifetime'] = {SESSION_LIFETIME};
$openoffice_conf = array();

@ -204,6 +204,7 @@ if(!isset($_GET['running']))
$enableTrackingForm=1;
$singleDbForm=0;
$encryptPassForm=1;
$session_lifetime=360000;
}
else
{
@ -349,6 +350,7 @@ elseif (!empty($_POST['step5']))
<input type="hidden" name="ShowEmailnotcheckedToStudent" value="<?php echo htmlentities($ShowEmailnotcheckedToStudent); ?>" />
<input type="hidden" name="userMailCanBeEmpty" value="<?php echo htmlentities($userMailCanBeEmpty); ?>" />
<input type="hidden" name="encryptPassForm" value="<?php echo htmlentities($encryptPassForm); ?>" />
<input type="hidden" name="session_lifetime" value="<?php echo htmlentities($session_lifetime); ?>" />
@ -403,52 +405,52 @@ elseif($_POST['step5'])
<h2><?php echo display_step_sequence().get_lang('LastCheck'); ?></h2>
<?php echo get_lang('HereAreTheValuesYouEntered');?>
<br>
<br/>
<b><?php echo get_lang('PrintThisPageToRememberPassAndOthers');?></b>
<blockquote>
<?php echo get_lang('MainLang').' : '.$languageForm; ?><br><br>
<?php echo get_lang('MainLang').' : '.$languageForm; ?><br/><br/>
<?php echo get_lang('DBHost').' : '.$dbHostForm; ?><br>
<?php echo get_lang('DBLogin').' : '.$dbUsernameForm; ?><br>
<?php echo get_lang('DBPassword').' : '.$dbPassForm; ?><br>
<?php if(!empty($dbPrefixForm)) echo get_lang('DbPrefixForm').' : '.$dbPrefixForm.'<br>'; ?>
<?php echo get_lang('MainDB').' : <b>'.$dbNameForm; ?></b><?php if($installType == 'new') echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)'; ?><br>
<?php echo get_lang('DBHost').' : '.$dbHostForm; ?><br/>
<?php echo get_lang('DBLogin').' : '.$dbUsernameForm; ?><br/>
<?php echo get_lang('DBPassword').' : '.$dbPassForm; ?><br/>
<?php if(!empty($dbPrefixForm)) echo get_lang('DbPrefixForm').' : '.$dbPrefixForm.'<br/>'; ?>
<?php echo get_lang('MainDB').' : <b>'.$dbNameForm; ?></b><?php if($installType == 'new') echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)'; ?><br/>
<?php if(!$singleDbForm) { ?>
<?php echo get_lang('StatDB').' : <b>'.$dbStatsForm; ?></b><?php if($installType == 'new') echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)'; ?><br>
<?php echo get_lang('ScormDB').' : <b>'.$dbScormForm; ?></b><?php if($installType == 'new') echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)'; ?><br>
<?php echo get_lang('UserDB').' : <b>'.$dbUserForm; ?></b><?php if($installType == 'new') echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)'; ?><br>
<?php echo get_lang('StatDB').' : <b>'.$dbStatsForm; ?></b><?php if($installType == 'new') echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)'; ?><br/>
<?php echo get_lang('ScormDB').' : <b>'.$dbScormForm; ?></b><?php if($installType == 'new') echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)'; ?><br/>
<?php echo get_lang('UserDB').' : <b>'.$dbUserForm; ?></b><?php if($installType == 'new') echo ' (<font color="#cc0033">'.get_lang('ReadWarningBelow').'</font>)'; ?><br/>
<?php } ?>
<?php echo get_lang('EnableTracking').' : '.($enableTrackingForm?$langYes:$langNo); ?><br>
<?php echo get_lang('SingleDb').' : '.($singleDbForm?$langOne:$langSeveral); ?><br><br>
<?php echo get_lang('EnableTracking').' : '.($enableTrackingForm?$langYes:$langNo); ?><br/>
<?php echo get_lang('SingleDb').' : '.($singleDbForm?$langOne:$langSeveral); ?><br/><br/>
<?php echo get_lang('AllowSelfReg').' : '.($allowSelfReg?$langYes:$langNo); ?><br>
<?php echo get_lang('EncryptUserPass').' : '.($encryptPassForm?$langYes:$langNo); ?><br><br>
<?php echo get_lang('AllowSelfReg').' : '.($allowSelfReg?$langYes:$langNo); ?><br/>
<?php echo get_lang('EncryptUserPass').' : '.($encryptPassForm?$langYes:$langNo); ?><br/><br/>
<?php echo get_lang('AdminEmail').' : '.$emailForm; ?><br>
<?php echo get_lang('AdminLastName').' : '.$adminLastName; ?><br>
<?php echo get_lang('AdminFirstName').' : '.$adminFirstName; ?><br>
<?php echo get_lang('AdminPhone').' : '.$adminPhoneForm; ?><br>
<?php echo get_lang('AdminEmail').' : '.$emailForm; ?><br/>
<?php echo get_lang('AdminLastName').' : '.$adminLastName; ?><br/>
<?php echo get_lang('AdminFirstName').' : '.$adminFirstName; ?><br/>
<?php echo get_lang('AdminPhone').' : '.$adminPhoneForm; ?><br/>
<?php if($installType == 'new'): ?>
<?php echo get_lang('AdminLogin').' : <b>'.$loginForm; ?></b><br>
<?php echo get_lang('AdminPass').' : <b>'.$passForm; ?></b><br><br>
<?php echo get_lang('AdminLogin').' : <b>'.$loginForm; ?></b><br/>
<?php echo get_lang('AdminPass').' : <b>'.$passForm; ?></b><br/><br/>
<?php else: ?>
<br>
<br/>
<?php endif; ?>
<?php echo get_lang('CampusName').' : '.$campusForm; ?><br>
<?php echo get_lang('InstituteShortName').' : '.$institutionForm; ?><br>
<?php echo get_lang('InstituteURL').' : '.$institutionUrlForm; ?><br>
<?php echo get_lang('DokeosURL').' : '.$urlForm; ?><br>
<?php echo get_lang('CampusName').' : '.$campusForm; ?><br/>
<?php echo get_lang('InstituteShortName').' : '.$institutionForm; ?><br/>
<?php echo get_lang('InstituteURL').' : '.$institutionUrlForm; ?><br/>
<?php echo get_lang('DokeosURL').' : '.$urlForm; ?><br/>
</blockquote>
<?php if($installType == 'new'): ?>
<div style="background-color:#FFFFFF">
<p align="center"><b><font color="red">
<?php echo get_lang('Warning');?> !<br>
<?php echo get_lang('Warning');?> !<br/>
<?php echo get_lang('TheInstallScriptWillEraseAllTables');?>
</font></b></p>
</div>

@ -175,6 +175,7 @@ function write_dokeos_config_file($path)
global $encryptPassForm;
global $installType;
global $updatePath;
global $session_lifetime;
$rootSys = realpath($pathForm).'/';
$garbageDir = realpath('../garbage/').'/';
//change paths if updating
@ -206,6 +207,7 @@ function write_dokeos_config_file($path)
$config['{PLATFORM_LANGUAGE}'] = $languageForm;
$config['{SECURITY_KEY}'] = md5(uniqid(rand().time()));
$config['{ENCRYPT_PASSWORD}'] = trueFalse($encryptPassForm);
$config['{SESSION_LIFETIME}'] = $session_lifetime;
foreach ($config as $key => $value)
{
$content = str_replace($key, $value, $content);

Loading…
Cancel
Save