Base HTML for projects section completed
Signed-off-by: rodude123 <rodude123@gmail.com>
This commit is contained in:
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^ index.php [QSA,L]
|
||||
Vendored
+3
@@ -54,6 +54,8 @@ $app->get("/timelineData/{timeline}", function (Request $request, Response $resp
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// something went wrong
|
||||
$response->getBody()->write(json_encode(array("errorMessage" => "Error, timeline data not found")));
|
||||
return $response->withStatus(404);
|
||||
@@ -285,6 +287,7 @@ $app->post("/contact", function (Request $request, Response $response)
|
||||
{
|
||||
$response->getBody()->write(json_encode(array("errorMessage" => "Please fill out all the fields")));
|
||||
return $response->withStatus(400);
|
||||
|
||||
}
|
||||
|
||||
if (!filter_var($data["email"], FILTER_VALIDATE_EMAIL))
|
||||
|
||||
Vendored
+30
@@ -2,9 +2,14 @@
|
||||
// middleware
|
||||
namespace api;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
use Slim\App;
|
||||
use Selective\SameSiteCookie\SameSiteCookieConfiguration;
|
||||
use Selective\SameSiteCookie\SameSiteCookieMiddleware;
|
||||
use Slim\Exception\HttpMethodNotAllowedException;
|
||||
use Slim\Exception\HttpNotFoundException;
|
||||
use Slim\Psr7\Response;
|
||||
use Tuupola\Middleware\JwtAuthentication;
|
||||
use Tuupola\Middleware\JwtAuthentication\RequestMethodRule;
|
||||
use Tuupola\Middleware\JwtAuthentication\RequestPathRule;
|
||||
@@ -24,6 +29,7 @@ class middleware
|
||||
$this->baseMiddleware($app);
|
||||
$this->sameSiteConfig($app);
|
||||
$this->jwtAuth($app);
|
||||
$this->errorHandling($app);
|
||||
$this->returnAsJSON($app);
|
||||
}
|
||||
|
||||
@@ -86,7 +92,31 @@ class middleware
|
||||
return $response->withStatus(401);
|
||||
}
|
||||
]));
|
||||
}
|
||||
|
||||
function errorHandling(App $app): void
|
||||
{
|
||||
$app->add(function (ServerRequestInterface $request, RequestHandlerInterface $handler)
|
||||
{
|
||||
try
|
||||
{
|
||||
return $handler->handle($request);
|
||||
}
|
||||
catch (HttpNotFoundException $httpException)
|
||||
{
|
||||
$response = (new Response())->withStatus(404);
|
||||
$response->getBody()->write(json_encode(array("status" => "404", "message" => $request->getUri()->getPath() . " not found")));
|
||||
return $response;
|
||||
}
|
||||
catch (HttpMethodNotAllowedException $httpException)
|
||||
{
|
||||
$response = (new Response())->withStatus(405);
|
||||
$response->getBody()->write(json_encode(array("status" => "405", "message" => "Method not allowed")));
|
||||
return $response;
|
||||
}
|
||||
});
|
||||
$app->addErrorMiddleware(true, true, true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+1
-1
@@ -17,7 +17,7 @@ class projectData
|
||||
function getProjectData(): array
|
||||
{
|
||||
$conn = dbConn();
|
||||
$stmt = $conn->prepare("SELECT title, isMainProject, information, imgLocation, projectLink, githubLink FROM projects order by date LIMIT 4;");
|
||||
$stmt = $conn->prepare("SELECT title, isMainProject, information, imgLocation, projectLink, gitLink FROM projects order by date LIMIT 4;");
|
||||
$stmt->execute();
|
||||
|
||||
// set the resulting array to associative
|
||||
|
||||
Reference in New Issue
Block a user