fipamo/brain/api/v1/PagesAPI.inc.php

32 lines
612 B
PHP

<?php
class PagesAPI
{
public function __construct()
{
}
public static function handlePageTask($request, $args)
{
$task = $args["fourth"];
switch ($task) {
case "delete":
case "create":
case "write":
$result = (new Book("../content/pages"))->editPage($task, $request);
break;
case "add-entry-image":
$result = ImagesAPI::uploadImage($request);
break;
default:
$result = [
"message" => "Hm, no task. That's unfortunate",
"type" => "TASK_NONE",
];
break;
}
return $result;
}
}