2021-04-16 07:19:59 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Slim\Views\Twig;
|
|
|
|
|
|
|
|
class SettingsAPI
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-04-17 01:15:47 +02:00
|
|
|
public static function handleSettingsTask($request, $args, $body = null)
|
2021-04-16 07:19:59 +02:00
|
|
|
{
|
|
|
|
$task = $args["fourth"];
|
|
|
|
switch ($task) {
|
|
|
|
case "publish":
|
2021-04-22 03:41:32 +02:00
|
|
|
$render = new Render();
|
2021-04-24 05:54:56 +02:00
|
|
|
$render->renderTags();
|
|
|
|
$render->renderArchive();
|
2021-04-23 01:04:43 +02:00
|
|
|
$render->renderPages();
|
2021-04-16 07:19:59 +02:00
|
|
|
|
|
|
|
$result = [
|
2021-04-23 01:04:43 +02:00
|
|
|
"message" => "Site Rendered. GOOD EFFORT",
|
2021-04-16 07:19:59 +02:00
|
|
|
"type" => "TASK_NONE",
|
|
|
|
];
|
|
|
|
|
2021-04-17 01:15:47 +02:00
|
|
|
break;
|
|
|
|
case "add-avatar":
|
|
|
|
$result = ImagesAPI::uploadImage($request, "avatar");
|
|
|
|
break;
|
|
|
|
case "add-feature-background":
|
|
|
|
$result = ImagesAPI::uploadImage($request, "background");
|
|
|
|
break;
|
|
|
|
case "sync":
|
|
|
|
Settings::sync($body);
|
|
|
|
$result = [
|
|
|
|
"message" => "Settings Synced. You're doing great!",
|
|
|
|
"type" => "settingsUpdated",
|
|
|
|
];
|
2021-04-18 02:32:45 +02:00
|
|
|
break;
|
|
|
|
case "nav-sync":
|
|
|
|
Settings::navSync($body);
|
|
|
|
$result = [
|
|
|
|
"message" => "Navigation updated. Very slick!",
|
|
|
|
"type" => "menuUpdated",
|
|
|
|
];
|
2021-04-16 07:19:59 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$result = [
|
|
|
|
"message" => "Hm, no task. That's unfortunate",
|
|
|
|
"type" => "TASK_NONE",
|
|
|
|
];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
2021-04-26 00:48:46 +02:00
|
|
|
|
|
|
|
public static function createBackup()
|
|
|
|
{
|
|
|
|
$result = Settings::makeBackup();
|
|
|
|
return $result;
|
|
|
|
}
|
2021-04-16 07:19:59 +02:00
|
|
|
}
|