display per session status clean up

beta
Ro 4 years ago
parent 9cf0cbfbe4
commit bc6fc33592

@ -36,8 +36,6 @@ class APIControl
break;
}
//there's only one verion of the api for now
$result = [];
switch (isset($args["third"]) ? $args["third"] : "none") {
case "login":
$result = Auth::login($body);

@ -55,15 +55,15 @@ class DashControl
"status" => Session::active(),
];
} else {
header("Location: /dashboard");
die();
$pageOptions = [
"title" => "Fipamo | Create Page",
"mode" => $mode,
"status" => Session::active(),
];
}
} else {
$template = "dash/start.twig";
$pageOptions = [
"title" => "Welcome to Fipamo",
"status" => Session::active(),
];
header("Location: /dashboard");
die();
}
break;

@ -171,24 +171,22 @@ class Book
$writePath = "../content/pages/" . $path . "/" . $body["slug"] . ".md";
}
if ($task == "create") {
if (!is_dir("../content/pages/" . $path)) {
//Directory does not exist, so lets create it.
mkdir("../content/pages/" . $path, 0755, true);
}
file_put_contents($writePath, $write);
$status = DocTools::write($task, $path, $writePath, $write);
if ($status) {
$response = [
"message" => "File edited. Nice work",
"type" => $task == "write" ? "postUpdated" : "postAdded",
"id" => $uuid,
];
} else {
($new = fopen($writePath, "w")) or die("Unable to open file!");
fwrite($new, $write);
fclose($new);
$response = [
"message" => "Uh oh. File save problem. Don't panic",
"type" => "postError",
"id" => $uuid,
];
}
$response = [
"message" => "File edited. Nice work",
"type" => $task == "write" ? "postUpdated" : "postAdded",
"id" => $uuid,
];
return $response;
}

@ -0,0 +1,29 @@
<?php
class DocTools
{
public function __construct()
{
}
public static function write($task, $path, $fileLocation, $fileContents)
{
try {
if ($task == "create") {
if (!is_dir("../content/pages/" . $path)) {
//Directory does not exist, so lets create it.
mkdir("../content/pages/" . $path, 0755, true);
}
file_put_contents($fileLocation, $fileContents);
} else {
($new = fopen($fileLocation, "w")) or die("Unable to open file!");
fwrite($new, $fileContents);
fclose($new);
}
return true;
} catch (Error $error) {
return false;
}
}
}

@ -12,6 +12,7 @@ include "../brain/data/Auth.inc.php";
include "../brain/utility/StringTools.inc.php";
include "../brain/data/Session.inc.php";
include "../brain/utility/FileUploader.inc.php";
include "../brain/utility/DocTools.inc.php";
$app = AppFactory::create();
$twig = Twig::create("../brain/views/");

@ -93,6 +93,7 @@ export default class Base {
notify.alert(err, false);
});
}
/**
handleRestore(e) {
e.stopPropagation();
e.preventDefault();
@ -113,6 +114,7 @@ export default class Base {
notify.alert(err, false);
});
}
**/
handleOptions(e) {
e.stopPropagation();
e.preventDefault();

Loading…
Cancel
Save