19 declare(strict_types=1);
44 public function __construct(
int $a_user_id,
string $a_token =
'')
48 $this->db = $DIC->database();
50 $this->
user = $a_user_id;
51 $this->token = $a_token;
55 public static function lookupAuthToken(
int $a_user_id,
int $a_selection,
int $a_calendar = 0): string
60 $query =
"SELECT * FROM cal_auth_token " .
61 "WHERE user_id = " .
$ilDB->quote($a_user_id,
'integer') .
' ' .
62 "AND selection = " .
$ilDB->quote($a_selection,
'integer') .
' ' .
63 "AND calendar = " .
$ilDB->quote($a_calendar,
'integer');
76 $query =
"SELECT * FROM cal_auth_token " .
77 "WHERE hash = " .
$ilDB->quote($a_token,
'text');
80 return (
int) $row->user_id;
97 $this->selection_type = $a_type;
130 'ical' => array(
'clob', $this->
getIcal()),
131 'c_time' => array(
'integer', time())
134 'user_id' => array(
'integer', $this->
getUserId()),
135 'hash' => array(
'text', $this->
getToken())
155 public function add(): string
158 $query =
"INSERT INTO cal_auth_token (user_id,hash,selection,calendar) " .
160 $this->db->quote($this->
getUserId(),
'integer') .
', ' .
161 $this->db->quote($this->
getToken(),
'text') .
', ' .
163 $this->db->quote($this->
getCalendar(),
'integer') .
' ' .
165 $this->db->manipulate($query);
171 $random = new \Random\Randomizer();
175 protected function read(): bool
178 $query =
"SELECT * FROM cal_auth_token " .
179 "WHERE user_id = " . $this->db->quote($this->
getUserId(),
'integer');
181 $query =
'SELECT * FROM cal_auth_token ' .
182 'WHERE user_id = ' . $this->db->quote($this->
getUserId(),
'integer') .
' ' .
183 'AND hash = ' . $this->db->quote($this->
getToken(),
'text');
186 $res = $this->db->query($query);
188 $this->token = (string) $row->hash;
189 $this->selection_type = (
int) $row->selection;
191 $this->ical = (
string) $row->ical;
192 $this->ical_ctime = (
int) $row->c_time;
calendar()
description: > Example for rendring a calendar glyph.
isIcalExpired()
Check if cache is disabled or expired.
__construct(int $a_user_id, string $a_token='')
static lookupAuthToken(int $a_user_id, int $a_selection, int $a_calendar=0)
setSelectionType(int $a_type)
static lookupUser(string $a_token)
Handles calendar authentication tokens for external calendar subscriptions.