You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
PHP
34 lines
1.0 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/.
|
|
*/
|
|
|
|
if (empty($VARS["id"])) {
|
|
$profile = $database->get("accounts", ["[>]authkeys" => ["accountid"]], ["publicid", "name", "username", "type", "verified", "bio"], ["key" => $VARS["key"]]);
|
|
} else {
|
|
if (!$database->has("accounts", ["publicid" => $VARS["id"]])) {
|
|
sendJsonResp($Strings->get("Could not find a matching account.", false), "ERROR");
|
|
}
|
|
|
|
$profile = $database->get("accounts", ["publicid", "name", "username", "type", "verified", "bio"], ["publicid" => $VARS["id"]]);
|
|
}
|
|
|
|
// Make sure the name field always has something useful
|
|
if (empty($profile["name"])) {
|
|
$profile["name"] = $profile["username"];
|
|
}
|
|
|
|
if (empty($profile["bio"])) {
|
|
$profile["bio"] = "";
|
|
}
|
|
|
|
$profile["verified"] = $profile["verified"] == 1;
|
|
|
|
exitWithJson([
|
|
"status" => "OK",
|
|
"profile" => $profile
|
|
]);
|