/** * destroy all form which are too old and unused * @param integer $life the number of second of a life of a form */ public static function clean($formSel = '', $life = 86400) { if (!isset($_SESSION['JFORMS'])) { return; } if ($formSel == '') { $t = time(); foreach ($_SESSION['JFORMS'] as $sel => $f) { // don't call clean itself, see bug #1154 foreach ($_SESSION['JFORMS'][$sel] as $id => $cont) { if ($t - $cont->updatetime > $life) { unset($_SESSION['JFORMS'][$sel][$id]); } } } } else { // normalize the selector to avoid conflict in session $sel = new jSelectorForm($formSel); $formSel = $sel->toString(); if (isset($_SESSION['JFORMS'][$formSel])) { $t = time(); foreach ($_SESSION['JFORMS'][$formSel] as $id => $cont) { if ($t - $cont->updatetime > $life) { unset($_SESSION['JFORMS'][$formSel][$id]); } } } } }
public static function clean($formSel = '', $life = 86400) { if (!isset($_SESSION['JFORMS'])) { return; } if ($formSel == '') { $t = time(); foreach ($_SESSION['JFORMS'] as $sel => $f) { foreach ($_SESSION['JFORMS'][$sel] as $id => $cont) { if ($t - $cont->updatetime > $life) { unset($_SESSION['JFORMS'][$sel][$id]); } } } } else { $sel = new jSelectorForm($formSel); $formSel = $sel->toString(); if (isset($_SESSION['JFORMS'][$formSel])) { $t = time(); foreach ($_SESSION['JFORMS'][$formSel] as $id => $cont) { if ($t - $cont->updatetime > $life) { unset($_SESSION['JFORMS'][$formSel][$id]); } } } } }