Add name/bio updating API
parent
8b349fd0ea
commit
f21a8baa1e
@ -0,0 +1,27 @@
|
||||
<?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/.
|
||||
*/
|
||||
|
||||
$profile = $database->get("accounts", ["[>]authkeys" => ["accountid"]], ["accounts.accountid","name", "bio"], ["key" => $VARS["key"]]);
|
||||
|
||||
if (!empty($VARS["name"])) {
|
||||
if (strlen($VARS["name"]) > 200) {
|
||||
sendJsonResp($Strings->get("Name is too long (max 200 characters)."), "ERROR");
|
||||
}
|
||||
$profile["name"] = htmlentities($VARS["name"]);
|
||||
}
|
||||
|
||||
if (!empty($VARS["bio"])) {
|
||||
$profile["bio"] = htmlentities($VARS["bio"]);
|
||||
}
|
||||
|
||||
$database->update("accounts", [
|
||||
"name" => $profile["name"],
|
||||
"bio" => $profile["bio"],
|
||||
], ["accountid" => $profile["accountid"]]);
|
||||
|
||||
sendJsonResp();
|
Loading…
Reference in New Issue