prep for js settings page
This commit is contained in:
parent
1e638b7688
commit
a1c503a416
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
|
||||
/*
|
||||
Alphaland 2021
|
||||
*/
|
||||
|
||||
//headers
|
||||
header("Access-Control-Allow-Origin: https://www.alphaland.cc");
|
||||
header("access-control-allow-credentials: true");
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$userid = $user->id;
|
||||
|
||||
//user info
|
||||
$userquery = $pdo->prepare('SELECT * FROM `users` WHERE id = :uid');
|
||||
$userquery->bindParam(':uid', $userid, PDO::PARAM_INT);
|
||||
$userquery->execute();
|
||||
$userquery = $userquery->fetch(PDO::FETCH_OBJ);
|
||||
|
||||
$username = getUsername($userquery->id);
|
||||
$blurb = $userquery->blurb;
|
||||
$email = obfuscate_email($userquery->email);
|
||||
$verified = (bool)$userquery->verified;
|
||||
$joinpref = $userquery->canJoin;
|
||||
$tradepref = null;
|
||||
$theme = $userquery->theme;
|
||||
|
||||
$userInfo = array (
|
||||
"userid" => $userid,
|
||||
"username" => $username,
|
||||
"email" => $email,
|
||||
"verified" => $verified,
|
||||
"blurb" => $blurb,
|
||||
"twofactorenabled" => is2FAInitialized($userid),
|
||||
"referralprogram" => inReferralProgram($userid),
|
||||
"joinpref" => $joinpref,
|
||||
"tradepref" => $tradepref,
|
||||
"theme" => $theme
|
||||
);
|
||||
// ...
|
||||
|
||||
die(json_encode($userInfo));
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
Alphaland 2021
|
||||
*/
|
||||
|
||||
//headers
|
||||
header("Access-Control-Allow-Origin: https://www.alphaland.cc");
|
||||
|
||||
header("access-control-allow-credentials: true");
|
||||
|
||||
$userid = $user->id;
|
||||
$data = json_decode(file_get_contents('php://input'));
|
||||
|
||||
if (!$data)
|
||||
{
|
||||
http_response_code(400);
|
||||
}
|
||||
else
|
||||
{
|
||||
$blurb = $data->blurb;
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array("success" => setBlurb($blurb)));
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
Alphaland 2021
|
||||
*/
|
||||
|
||||
//headers
|
||||
header("Access-Control-Allow-Origin: https://www.alphaland.cc");
|
||||
|
||||
header("access-control-allow-credentials: true");
|
||||
|
||||
$data = json_decode(file_get_contents('php://input'));
|
||||
|
||||
if (!$data)
|
||||
{
|
||||
http_response_code(400);
|
||||
}
|
||||
else
|
||||
{
|
||||
$privacy = $data->preference;
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array("success" => setCanJoinUser($privacy)));
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
Alphaland 2021
|
||||
*/
|
||||
|
||||
//headers
|
||||
header("Access-Control-Allow-Origin: https://www.alphaland.cc");
|
||||
header("access-control-allow-credentials: true");
|
||||
|
||||
$data = json_decode(file_get_contents('php://input'));
|
||||
|
||||
if (!$data)
|
||||
{
|
||||
http_response_code(400);
|
||||
}
|
||||
else
|
||||
{
|
||||
$theme = $data->theme;
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array("success" => setTheme($theme)));
|
||||
}
|
||||
Loading…
Reference in New Issue