WIP: bring participo back - consistent use of bootstrap - formatting -

phpstan level 0 error free - fixes for kyu subpage - move mams into
participo framework - remove legacy `lib/db.php` usage - add attributer
admin function - add newsposter - fixing apiKey creation
This commit is contained in:
marko
2025-11-07 10:37:25 +01:00
parent 672eaccfc9
commit f28fa7b51b
96 changed files with 6152 additions and 6053 deletions

View File

@@ -1,54 +1,59 @@
<?php
require_once("inc/bootstrap.php");
require_once "bootstrap.php";
require_once("participoLib/shiai.php");
require_once "participoLib/shiai.php";
$method = $_SERVER['REQUEST_METHOD'];
$method = $_SERVER["REQUEST_METHOD"];
// Sending Response
// - we send a json-formatted response
header("Content-Type: application/json");
// - check if an valid api key was send
authorize();
// - depending on the method we perform different actions
switch($method){
// Create
case 'POST':
$postData = json_decode(file_get_contents('php://input'), true);
if(!$postData){
die(json_encode([
'error'=>$postData . " not valid json data!"
]));
}
die(json_encode(
Shiai::fromArray($postData)->asArray()
));
break;
// Read
case 'GET':
echo(json_encode(
Shiai::dbSelect()
));
break;
// Update
case 'PUT':
die(json_encode([
'success'=>false,
'reason'=>$method.".not supported yet."
]));
break;
// Delete
case 'DELETE':
die(json_encode([
'success'=>false,
'reason'=>$method.".not supported yet."
]));
break;
// all other methods not supported
default:
die(json_encode([
'success'=>false,
'reason'=>$method.".not supported."
]));
// - check if an valid api key was send
// authorize();
participo::authentificate();
// - depending on the method we perform different actions
switch ($method) {
// Create
case "POST":
$postData = json_decode(file_get_contents("php://input"), true);
if (!$postData) {
die(
json_encode([
"error" => $postData . " not valid json data!",
])
);
}
die(json_encode(Shiai::fromArray($postData)->asArray()));
break;
// Read
case "GET":
echo json_encode(Shiai::dbSelect());
break;
// Update
case "PUT":
die(
json_encode([
"success" => false,
"reason" => $method . ".not supported yet.",
])
);
break;
// Delete
case "DELETE":
die(
json_encode([
"success" => false,
"reason" => $method . ".not supported yet.",
])
);
break;
// all other methods not supported
default:
die(
json_encode([
"success" => false,
"reason" => $method . ".not supported.",
])
);
}
?>