|
@@ 213-228 (lines=16) @@
|
| 210 |
|
return 1 === $stmt->rowCount(); |
| 211 |
|
} |
| 212 |
|
|
| 213 |
|
public function addCertificate($externalUserId, $commonName, $displayName, $validFrom, $validTo) |
| 214 |
|
{ |
| 215 |
|
$userId = $this->getUserId($externalUserId); |
| 216 |
|
$stmt = $this->db->prepare( |
| 217 |
|
'INSERT INTO certificates (common_name, user_id, display_name, valid_from, valid_to) VALUES(:common_name, :user_id, :display_name, :valid_from, :valid_to)' |
| 218 |
|
); |
| 219 |
|
$stmt->bindValue(':common_name', $commonName, PDO::PARAM_STR); |
| 220 |
|
$stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
| 221 |
|
$stmt->bindValue(':display_name', $displayName, PDO::PARAM_STR); |
| 222 |
|
$stmt->bindValue(':valid_from', $validFrom, PDO::PARAM_INT); |
| 223 |
|
$stmt->bindValue(':valid_to', $validTo, PDO::PARAM_INT); |
| 224 |
|
|
| 225 |
|
$stmt->execute(); |
| 226 |
|
|
| 227 |
|
return 1 === $stmt->rowCount(); |
| 228 |
|
} |
| 229 |
|
|
| 230 |
|
public function getCertificates($externalUserId) |
| 231 |
|
{ |
|
@@ 320-348 (lines=29) @@
|
| 317 |
|
return 1 === intval($stmt->fetchColumn()); |
| 318 |
|
} |
| 319 |
|
|
| 320 |
|
public function clientConnect($profileId, $commonName, $ip4, $ip6, $connectedAt) |
| 321 |
|
{ |
| 322 |
|
$stmt = $this->db->prepare( |
| 323 |
|
'INSERT INTO connection_log ( |
| 324 |
|
profile_id, |
| 325 |
|
common_name, |
| 326 |
|
ip4, |
| 327 |
|
ip6, |
| 328 |
|
connected_at |
| 329 |
|
) |
| 330 |
|
VALUES( |
| 331 |
|
:profile_id, |
| 332 |
|
:common_name, |
| 333 |
|
:ip4, |
| 334 |
|
:ip6, |
| 335 |
|
:connected_at |
| 336 |
|
)' |
| 337 |
|
); |
| 338 |
|
|
| 339 |
|
$stmt->bindValue(':profile_id', $profileId, PDO::PARAM_STR); |
| 340 |
|
$stmt->bindValue(':common_name', $commonName, PDO::PARAM_STR); |
| 341 |
|
$stmt->bindValue(':ip4', $ip4, PDO::PARAM_STR); |
| 342 |
|
$stmt->bindValue(':ip6', $ip6, PDO::PARAM_STR); |
| 343 |
|
$stmt->bindValue(':connected_at', $connectedAt, PDO::PARAM_INT); |
| 344 |
|
|
| 345 |
|
$stmt->execute(); |
| 346 |
|
|
| 347 |
|
return 1 === $stmt->rowCount(); |
| 348 |
|
} |
| 349 |
|
|
| 350 |
|
public function clientDisconnect($profileId, $commonName, $ip4, $ip6, $connectedAt, $disconnectedAt, $bytesTransferred) |
| 351 |
|
{ |