created new App class to start up app and move off of index

This commit is contained in:
Ro 2021-04-21 22:46:56 -07:00
parent 9283a7f5b3
commit 444189e527
3 changed files with 43 additions and 28 deletions

40
brain/App.inc.php Normal file
View file

@ -0,0 +1,40 @@
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
use Slim\Views\Twig;
use Slim\Views\TwigMiddleware;
include "../brain/controller/RouteControl.inc.php";
include "../brain/data/Settings.inc.php";
include "../brain/data/Session.inc.php";
include "../brain/data/Member.inc.php";
include "../brain/data/Auth.inc.php";
include "../brain/data/Render.inc.php";
include "../brain/utility/StringTools.inc.php";
include "../brain/utility/FileUploader.inc.php";
include "../brain/utility/DocTools.inc.php";
include "../brain/utility/Sorting.inc.php";
class App
{
public function __construct()
{
$app = AppFactory::create();
$twig = Twig::create("../brain/views/");
$app->add(TwigMiddleware::create($app, $twig));
//set up routing
$app->get(
"/[{first}[/{second}[/{third}[/{fourth}]]]]",
"\RouteControl:get"
);
$app->post(
"/[{first}[/{second}[/{third}[/{fourth}]]]]",
"\RouteControl:post"
);
//start the app
$app->run();
}
}

View file

@ -150,7 +150,7 @@ class Book
//once saved, update menu
$body["path"] = $path;
Settings::updateMenu($body);
Settings::updateTags();
//Settings::updateTags();
} else {
$response = [
"message" => "Uh oh. File save problem. Don't panic",

View file

@ -1,29 +1,4 @@
<?php
require "../vendor/autoload.php";
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
use Slim\Views\Twig;
use Slim\Views\TwigMiddleware;
include "../brain/controller/RouteControl.inc.php";
include "../brain/data/Settings.inc.php";
include "../brain/data/Session.inc.php";
include "../brain/data/Member.inc.php";
include "../brain/data/Auth.inc.php";
include "../brain/data/Render.inc.php";
include "../brain/utility/StringTools.inc.php";
include "../brain/utility/FileUploader.inc.php";
include "../brain/utility/DocTools.inc.php";
include "../brain/utility/Sorting.inc.php";
$app = AppFactory::create();
$twig = Twig::create("../brain/views/");
$app->add(TwigMiddleware::create($app, $twig));
//set up routing
$app->get("/[{first}[/{second}[/{third}[/{fourth}]]]]", "\RouteControl:get");
$app->post("/[{first}[/{second}[/{third}[/{fourth}]]]]", "\RouteControl:post");
//start the app
$app->run();
include "../brain/App.inc.php";
new App();