You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.4 KiB
PHP
64 lines
1.4 KiB
PHP
<?php
|
|
|
|
use Slim\Views\Twig;
|
|
|
|
class SettingsAPI
|
|
{
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
public static function handleSettingsTask($request, $args, $body = null)
|
|
{
|
|
$task = $args["fourth"];
|
|
switch ($task) {
|
|
case "publish":
|
|
$render = new Render();
|
|
$render->renderTags();
|
|
$render->renderArchive();
|
|
$render->renderPages();
|
|
|
|
$result = [
|
|
"message" => "Site Rendered. GOOD EFFORT",
|
|
"type" => "TASK_NONE",
|
|
];
|
|
|
|
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",
|
|
];
|
|
break;
|
|
case "nav-sync":
|
|
Settings::navSync($body);
|
|
$result = [
|
|
"message" => "Navigation updated. Very slick!",
|
|
"type" => "menuUpdated",
|
|
];
|
|
break;
|
|
default:
|
|
$result = [
|
|
"message" => "Hm, no task. That's unfortunate",
|
|
"type" => "TASK_NONE",
|
|
];
|
|
break;
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
public static function createBackup()
|
|
{
|
|
$result = Maintenance::makeBackup();
|
|
return $result;
|
|
}
|
|
}
|