|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
$function = null;
|
|
|
|
|
$signup_method = null;
|
|
|
|
|
$login_method = null;
|
|
|
|
|
if (isset($_SERVER['REDIRECT_URL'])) {
|
|
|
|
|
|
|
|
|
|
# process URI
|
|
|
|
@ -14,18 +14,18 @@ if (isset($_SERVER['REDIRECT_URL'])) {
|
|
|
|
|
die('Unexpected error');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# get the signup method from URL
|
|
|
|
|
# get the login method from URL
|
|
|
|
|
if (str_contains($args[1], ':')) {
|
|
|
|
|
$ps = explode(':', $args[1]);
|
|
|
|
|
$signup_method = $ps[0];
|
|
|
|
|
$login_method = $ps[0];
|
|
|
|
|
$function = $ps[1];
|
|
|
|
|
} else {
|
|
|
|
|
$signup_method = $args[1];
|
|
|
|
|
$login_method = $args[1];
|
|
|
|
|
$function = 'view';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!in_array($signup_method, ['mastodon'])) {
|
|
|
|
|
die('The given signup method does not exist');
|
|
|
|
|
if (!in_array($login_method, ['mastodon'])) {
|
|
|
|
|
die('The given login method does not exist');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!in_array($function, ['view', 'oauth'])) {
|
|
|
|
@ -40,10 +40,10 @@ if ($function === 'oauth') {
|
|
|
|
|
$ID = $_GET['id'] ?? '';
|
|
|
|
|
$code = $_GET['code'] ?? '';
|
|
|
|
|
if (empty($code) || empty($ID)) {
|
|
|
|
|
header('Location: /signup'); die;
|
|
|
|
|
header('Location: /login'); die;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch ($signup_method) {
|
|
|
|
|
switch ($login_method) {
|
|
|
|
|
case 'mastodon':
|
|
|
|
|
require '/src/action/oauth/mastodon.php';
|
|
|
|
|
break;
|
|
|
|
@ -55,7 +55,7 @@ if ($function === 'oauth') {
|
|
|
|
|
<?php require '/src/views/public/head.php' ?>
|
|
|
|
|
|
|
|
|
|
<main>
|
|
|
|
|
SIGNUP: <?php echo $signup_method ?>
|
|
|
|
|
LOGIN: <?php echo $login_method ?>
|
|
|
|
|
<br>
|
|
|
|
|
FUNCTION: <?php echo $function ?>
|
|
|
|
|
</main>
|