43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
|
<?php
|
||
|
|
||
|
/*
|
||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||
|
*/
|
||
|
|
||
|
$fp = trim(strtoupper($VARS["fingerprint"]));
|
||
|
|
||
|
$where = [];
|
||
|
|
||
|
if (strlen($fp) == 8) {
|
||
|
$where = ["fingerprint_tiny" => $fp];
|
||
|
} else if (strlen($fp) == 16) {
|
||
|
$where = ["fingerprint_short" => $fp];
|
||
|
} else {
|
||
|
$where = ["fingerprint[~]" => "%$fp"];
|
||
|
}
|
||
|
|
||
|
$results = $database->select("notary_registry", '*', $where);
|
||
|
|
||
|
$out = [];
|
||
|
|
||
|
foreach ($results as $r) {
|
||
|
$out[] = [
|
||
|
"fingerprint" => $r["fingerprint"],
|
||
|
"name" => $r["name"],
|
||
|
"email" => $r["email"],
|
||
|
"location" => $r["location"],
|
||
|
"commissionexpires" => (is_null($r["commissionexpires"]) ? null : strtotime($r["commissionexpires"])),
|
||
|
"idnumber" => $r["idnumber"],
|
||
|
"state" => $r["state"],
|
||
|
"publickey" => $r["publickey"]
|
||
|
];
|
||
|
}
|
||
|
|
||
|
exitWithJson([
|
||
|
"status" => "OK",
|
||
|
"query" => $fp,
|
||
|
"count" => count($results),
|
||
|
"results" => $out
|
||
|
]);
|