AdvertAccessSession
in package
FinalYes
Adverts for which the visitor has proven the password in this session (editing without an account).
The session holds them under the key accessibleAdverts as a list of [id, password hash, expiry];
Bazaar and Comcat share it (each in its own session section).
The session is an untrusted store (older format, manual tampering): entries() returns only well-formed rows and skips the rest.
Table of Contents
Constants
- KEY : mixed = 'accessibleAdverts'
Properties
- $section : SessionSection
Methods
- __construct() : mixed
- entries() : array<string|int, array{int, string, int}>
- find() : array{string, int}|null
- Returns the valid (unexpired) entry of the advert, or null.
- grant() : void
- Adds an access entry, replacing an older entry of the same advert.
- refresh() : void
- Refreshes hash and expiry of an existing entry only (after the password is changed by an edit).
- revoke() : void
Constants
KEY
private
mixed
KEY
= 'accessibleAdverts'
Properties
$section read-only
private
SessionSection
$section
Methods
__construct()
public
__construct(SessionSection $section) : mixed
Parameters
- $section : SessionSection
entries()
public
entries() : array<string|int, array{int, string, int}>
Return values
array<string|int, array{int, string, int}> —key = position in the session (for revoke())
find()
Returns the valid (unexpired) entry of the advert, or null.
public
find(int $advertId) : array{string, int}|null
Parameters
- $advertId : int
Return values
array{string, int}|null —[password hash, expiry]
grant()
Adds an access entry, replacing an older entry of the same advert.
public
grant(int $advertId, string $hash, int $expiresAt) : void
Parameters
- $advertId : int
- $hash : string
- $expiresAt : int
refresh()
Refreshes hash and expiry of an existing entry only (after the password is changed by an edit).
public
refresh(int $advertId, string $hash, int $expiresAt) : void
Parameters
- $advertId : int
- $hash : string
- $expiresAt : int
revoke()
public
revoke(int|string $key) : void
Parameters
- $key : int|string