@@ -52,6 +52,7 @@ class User implements JsonSerializable {
52
52
protected $ options_bitmask ;
53
53
protected $ password_hash ;
54
54
protected $ password_salt ;
55
+ protected $ timezone ;
55
56
protected $ username ;
56
57
protected $ verified_datetime ;
57
58
@@ -64,6 +65,7 @@ public function __construct($data) {
64
65
$ this ->options_bitmask = null ;
65
66
$ this ->password_hash = null ;
66
67
$ this ->password_salt = null ;
68
+ $ this ->timezone = null ;
67
69
$ this ->username = null ;
68
70
$ this ->verified_datetime = null ;
69
71
$ this ->refresh ();
@@ -76,6 +78,7 @@ public function __construct($data) {
76
78
$ this ->options_bitmask = $ data ->options_bitmask ;
77
79
$ this ->password_hash = $ data ->password_hash ;
78
80
$ this ->password_salt = $ data ->password_salt ;
81
+ $ this ->timezone = $ data ->timezone ;
79
82
$ this ->username = $ data ->username ;
80
83
$ this ->verified_datetime = $ data ->verified_datetime ;
81
84
} else {
@@ -146,11 +149,11 @@ public static function create(
146
149
INSERT INTO `users` (
147
150
`id`, `email`, `username`, `display_name`, `created_datetime`,
148
151
`verified_datetime`, `password_hash`, `password_salt`,
149
- `options_bitmask`
152
+ `options_bitmask`, `timezone`
150
153
) VALUES (
151
154
NULL, :email, :username, :display_name, NOW(),
152
155
NULL, :password_hash, :password_salt,
153
- :options_bitmask
156
+ :options_bitmask, NULL
154
157
);
155
158
" );
156
159
$ stmt ->bindParam (":email " , $ email , PDO ::PARAM_STR );
@@ -286,6 +289,10 @@ public function getURI() {
286
289
);
287
290
}
288
291
292
+ public function getTimezone () {
293
+ return $ this ->timezone ;
294
+ }
295
+
289
296
public function getUsername () {
290
297
return $ this ->username ;
291
298
}
@@ -344,6 +351,7 @@ public function jsonSerialize() {
344
351
"created_datetime " => $ created_datetime ,
345
352
"id " => $ this ->getId (),
346
353
"name " => $ this ->getName (),
354
+ "timezone " => $ this ->getTimezone (),
347
355
"verified_datetime " => $ verified_datetime ,
348
356
];
349
357
}
@@ -364,6 +372,9 @@ protected static function normalize(StdClass &$data) {
364
372
if (!is_null ($ data ->password_salt ))
365
373
$ data ->password_salt = (string ) $ data ->password_salt ;
366
374
375
+ if (!is_null ($ data ->timezone ))
376
+ $ data ->timezone = (string ) $ data ->timezone ;
377
+
367
378
if (!is_null ($ data ->verified_datetime ))
368
379
$ data ->verified_datetime = (string ) $ data ->verified_datetime ;
369
380
@@ -381,6 +392,7 @@ public function refresh() {
381
392
$ this ->options_bitmask = $ cache_val ->options_bitmask ;
382
393
$ this ->password_hash = $ cache_val ->password_hash ;
383
394
$ this ->password_salt = $ cache_val ->password_salt ;
395
+ $ this ->timezone = $ cache_val ->timezone ;
384
396
$ this ->username = $ cache_val ->username ;
385
397
$ this ->verified_datetime = $ cache_val ->verified_datetime ;
386
398
return true ;
@@ -398,6 +410,7 @@ public function refresh() {
398
410
`options_bitmask`,
399
411
`password_hash`,
400
412
`password_salt`,
413
+ `timezone`,
401
414
`username`,
402
415
`verified_datetime`
403
416
FROM `users`
@@ -419,6 +432,7 @@ public function refresh() {
419
432
$ this ->options_bitmask = $ row ->options_bitmask ;
420
433
$ this ->password_hash = $ row ->password_hash ;
421
434
$ this ->password_salt = $ row ->password_salt ;
435
+ $ this ->timezone = $ row ->timezone ;
422
436
$ this ->username = $ row ->username ;
423
437
$ this ->verified_datetime = $ row ->verified_datetime ;
424
438
Common::$ cache ->set ($ cache_key , serialize ($ row ), 300 );
0 commit comments