summaryrefslogtreecommitdiff
path: root/includes/model
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-08-07 02:38:41 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-08-20 21:08:06 +0200
commitd93ace2eaef8d7077fe93f27a1528f936ffe1172 (patch)
tree58dbc82c9ae4da79f5d8eabff33c09273891d290 /includes/model
parentd6c8f1a61475fefa9594141aaf12a28d220bdaf8 (diff)
Prevent object serialization in session
Diffstat (limited to 'includes/model')
-rw-r--r--includes/model/ShiftsFilter.php30
1 files changed, 29 insertions, 1 deletions
diff --git a/includes/model/ShiftsFilter.php b/includes/model/ShiftsFilter.php
index 5ad7a9b3..fe3bfa56 100644
--- a/includes/model/ShiftsFilter.php
+++ b/includes/model/ShiftsFilter.php
@@ -48,7 +48,7 @@ class ShiftsFilter
* @param int[] $rooms
* @param int[] $types
*/
- public function __construct($user_shifts_admin, $rooms, $types)
+ public function __construct($user_shifts_admin = false, $rooms = [], $types = [])
{
$this->rooms = $rooms;
$this->types = $types;
@@ -63,6 +63,34 @@ class ShiftsFilter
}
/**
+ * @return array
+ */
+ public function sessionExport()
+ {
+ return [
+ 'userShiftsAdmin' => $this->userShiftsAdmin,
+ 'filled' => $this->filled,
+ 'rooms' => $this->rooms,
+ 'types' => $this->types,
+ 'startTime' => $this->startTime,
+ 'endTime' => $this->endTime,
+ ];
+ }
+
+ /**
+ * @param array $data
+ */
+ public function sessionImport($data)
+ {
+ $this->userShiftsAdmin = $data['userShiftsAdmin'];
+ $this->filled = $data['filled'];
+ $this->rooms = $data['rooms'];
+ $this->types = $data['types'];
+ $this->startTime = $data['startTime'];
+ $this->endTime = $data['endTime'];
+ }
+
+ /**
* @return int unix timestamp
*/
public function getStartTime()