Skip to content

Commit

Permalink
Fixed issue #8384: impossible to have survey session lifetime greater…
Browse files Browse the repository at this point in the history
… than default PHP value

Dev: Only display and use session lifetime setting when using a DB backend for sessions.
Dev: If using regular file-based sessions, it's up to the admin to change php ini values.
  • Loading branch information
Grapsus committed Nov 21, 2013
1 parent fa699d0 commit 00d94e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion application/controllers/survey/index.php
Expand Up @@ -38,7 +38,11 @@ function action()
global $clienttoken, $tokensexist, $token;
global $clang;
$clang = Yii::app()->lang;
@ini_set('session.gc_maxlifetime', Yii::app()->getConfig('iSessionExpirationTime'));
// only attempt to change session lifetime if using a DB backend
// with file based sessions, it's up to the admin to configure maxlifetime
if(isset(Yii::app()->session->connectionID)) {
@ini_set('session.gc_maxlifetime', Yii::app()->getConfig('iSessionExpirationTime'));
}

$this->_loadRequiredHelpersAndLibraries();

Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/globalSettings_view.php
Expand Up @@ -214,7 +214,7 @@
<?php echo $clang->gT("Server time:").' '.convertDateTimeFormat(date('Y-m-d H:i:s'),'Y-m-d H:i:s',$dateformatdata['phpdate'].' H:i')." - ". $clang->gT("Corrected time:").' '.convertDateTimeFormat(dateShift(date("Y-m-d H:i:s"), 'Y-m-d H:i:s', getGlobalSetting('timeadjust')),'Y-m-d H:i:s',$dateformatdata['phpdate'].' H:i'); ?>
</span></li>

<li><label for='iSessionExpirationTime'><?php $clang->eT("Session lifetime (seconds):"); ?></label>
<li <?php if( ! isset(Yii::app()->session->connectionID)) echo 'style="display: none"';?>><label for='iSessionExpirationTime'><?php $clang->eT("Session lifetime (seconds):"); ?></label>
<input type='text' size='10' id='iSessionExpirationTime' name='iSessionExpirationTime' value="<?php echo htmlspecialchars(getGlobalSetting('iSessionExpirationTime')); ?>" /></li>
<li><label for='ipInfoDbAPIKey'><?php $clang->eT("IP Info DB API Key:"); ?></label>
<input type='text' size='35' id='ipInfoDbAPIKey' name='ipInfoDbAPIKey' value="<?php echo htmlspecialchars(getGlobalSetting('ipInfoDbAPIKey')); ?>" /></li>
Expand Down

0 comments on commit 00d94e8

Please sign in to comment.