Voici une contribution qui permet de régler le temps de la session de l'admin, je ne l'ai pas encore testé (mais bientôt...).
(ce code provient de Creloaded US)
1. Faire une requete SQL:
INSERT INTO configuration VALUES ('', 'Session Lifetime', 'MYSESSION_LIFETIME', '3600', 'Length of time you can stay on one page in ADMIN, without a refresh, before you are required to log in. Measured in Seconds. (You may not set this to less than 60 seconds.)', 15, 8, '2005-01-19 03:43:31', '2005-01-19 03:30:25', NULL, NULL);
2. Dans: /admin/includes/functions/sessions.php
remplacer:
if (STORE_SESSIONS == 'mysql') {
if (defined('DIR_WS_ADMIN')) {
if (!$SESS_LIFE = (SESSION_TIMEOUT_ADMIN + 1440)) {
$SESS_LIFE = (SESSION_TIMEOUT_ADMIN + 1440);
}
} else {
if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) {
$SESS_LIFE = 9600;
}
}
par
if (STORE_SESSIONS == 'mysql') {
if (defined('DIR_WS_ADMIN')) {
if (!$SESS_LIFE = (SESSION_TIMEOUT_ADMIN + 1440)) {
$SESS_LIFE = (SESSION_TIMEOUT_ADMIN + 1440);
}
} else {
if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) {
$SESS_LIFE = 9600;
}
}
//Modified for admin control of admin session life//MRB
$SESS_LIFE = MYSESSION_LIFETIME;
//end modification
3. Dans: /admin/configuration.php
remplacer:
case 'save':
$configuration_value = $HTTP_POST_VARS['configuration_value'];
$cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);
if ($error == false) {
tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($configuration_value) . "', last_modified = now() where configuration_id = '" . (int)$cID . "'");
tep_redirect(tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cID));
}
break;
par:
case 'save':
$configuration_value = (int)$HTTP_POST_VARS['configuration_value'];
$cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);
// VJ admin session begin
$error = false;
$configuration_key = tep_db_prepare_input($HTTP_POST_VARS['configuration_key']);
// check if configuration key is admin session lifetime and greater than zero
if ($configuration_key == 'MYSESSION_LIFETIME') {
if ((int)$configuration_value < 60) {
$error = true;
$messageStack->add(CONFIG_ADMIN_SESSION_ERROR, 'error');
}
}
if ($error == false) {
tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($configuration_value) . "', last_modified = now() where configuration_id = '" . (int)$cID . "'");
tep_redirect(tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cID));
}
// VJ admin session end
break;
et remplacer:
$contents[] = array('text' => '<br><b>' . $cInfo->configuration_title . '</b><br>' . $cInfo->configuration_description . '<br>' . $value_field);
par:
$contents[] = array('text' => tep_draw_hidden_field('configuration_key', $cInfo->configuration_key) . '<br><b>' . $cInfo->configuration_title . '</b><br>' . $cInfo->configuration_description . '<br>' . $value_field); // VJ admin session changed
4. Dans: /admin/includes/languages/french/configuration.php
ajouter (n'importe où dans le fichier):
// VJ admin session added
define('CONFIG_ADMIN_SESSION_ERROR', 'Vous devez entrer une valeur supérieure ou égale à 60.');
5. Dans: /admin/includes/languages/english/configuration.php
ajouter (n'importe où dans le fichier):
define('CONFIG_ADMIN_SESSION_ERROR', 'You must enter a value above or equal to 60.');
+ les autres langues si besoin