1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-11 17:24:46 +02:00

Various minor adjustments

This commit is contained in:
Ryan Cramer
2021-06-11 14:00:55 -04:00
parent 3229d2371e
commit c81aa1a82a
4 changed files with 31 additions and 13 deletions

View File

@@ -1477,18 +1477,25 @@ class Session extends Wire implements \IteratorAggregate {
// prevent multiple calls, just in case
$this->skipMaintenance = true;
$historyCnt = (int) $this->config->sessionHistory;
$config = $this->wire()->config;
$historyCnt = (int) ($config ? $config->sessionHistory : 0);
if($historyCnt) {
$sanitizer = $this->wire()->sanitizer;
$input = $this->wire()->input;
$page = $this->wire()->page;
if(!$sanitizer || !$input || !$page) return;
$history = $this->get('_user', 'history');
if(!is_array($history)) $history = array();
$item = array(
'time' => time(),
'url' => $this->wire('sanitizer')->entities($this->wire('input')->httpUrl()),
'page' => $this->wire('page')->id,
'url' => $sanitizer->entities($input->httpUrl()),
'page' => $page->id,
);
$cnt = count($history);