|
@@ 199-214 (lines=16) @@
|
| 196 |
|
return 1 === $stmt->rowCount(); |
| 197 |
|
} |
| 198 |
|
|
| 199 |
|
public function addCertificate($externalUserId, $commonName, $displayName, $validFrom, $validTo) |
| 200 |
|
{ |
| 201 |
|
$userId = $this->getUserId($externalUserId); |
| 202 |
|
$stmt = $this->db->prepare( |
| 203 |
|
'INSERT INTO certificates (common_name, user_id, display_name, valid_from, valid_to) VALUES(:common_name, :user_id, :display_name, :valid_from, :valid_to)' |
| 204 |
|
); |
| 205 |
|
$stmt->bindValue(':common_name', $commonName, PDO::PARAM_STR); |
| 206 |
|
$stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
| 207 |
|
$stmt->bindValue(':display_name', $displayName, PDO::PARAM_STR); |
| 208 |
|
$stmt->bindValue(':valid_from', $validFrom, PDO::PARAM_INT); |
| 209 |
|
$stmt->bindValue(':valid_to', $validTo, PDO::PARAM_INT); |
| 210 |
|
|
| 211 |
|
$stmt->execute(); |
| 212 |
|
|
| 213 |
|
return 1 === $stmt->rowCount(); |
| 214 |
|
} |
| 215 |
|
|
| 216 |
|
public function getCertificates($externalUserId) |
| 217 |
|
{ |
|
@@ 306-334 (lines=29) @@
|
| 303 |
|
return 1 === intval($stmt->fetchColumn()); |
| 304 |
|
} |
| 305 |
|
|
| 306 |
|
public function clientConnect($profileId, $commonName, $ip4, $ip6, $connectedAt) |
| 307 |
|
{ |
| 308 |
|
$stmt = $this->db->prepare( |
| 309 |
|
'INSERT INTO connection_log ( |
| 310 |
|
profile_id, |
| 311 |
|
common_name, |
| 312 |
|
ip4, |
| 313 |
|
ip6, |
| 314 |
|
connected_at |
| 315 |
|
) |
| 316 |
|
VALUES( |
| 317 |
|
:profile_id, |
| 318 |
|
:common_name, |
| 319 |
|
:ip4, |
| 320 |
|
:ip6, |
| 321 |
|
:connected_at |
| 322 |
|
)' |
| 323 |
|
); |
| 324 |
|
|
| 325 |
|
$stmt->bindValue(':profile_id', $profileId, PDO::PARAM_STR); |
| 326 |
|
$stmt->bindValue(':common_name', $commonName, PDO::PARAM_STR); |
| 327 |
|
$stmt->bindValue(':ip4', $ip4, PDO::PARAM_STR); |
| 328 |
|
$stmt->bindValue(':ip6', $ip6, PDO::PARAM_STR); |
| 329 |
|
$stmt->bindValue(':connected_at', $connectedAt, PDO::PARAM_INT); |
| 330 |
|
|
| 331 |
|
$stmt->execute(); |
| 332 |
|
|
| 333 |
|
return 1 === $stmt->rowCount(); |
| 334 |
|
} |
| 335 |
|
|
| 336 |
|
public function clientDisconnect($profileId, $commonName, $ip4, $ip6, $connectedAt, $disconnectedAt, $bytesTransferred) |
| 337 |
|
{ |