.htaccess + more pages & routes

This commit is contained in:
2020-06-20 15:49:53 +02:00
parent abb8b07a02
commit b2cb0c4bf3
18 changed files with 244 additions and 25 deletions

View File

@@ -24,14 +24,15 @@ abstract class Document {
public function getBody() { return $this->body; }
public function getSQL() { return $this->user->getSQL(); }
public function getUser() { return $this->user; }
public function getView() { return $this->activeView; }
protected function sendHeaders() {
header("X-Frame-Options: DENY");
}
public function getView() : ?View {
public static function createSearchableDocument($documentClass, $user) {
return new $documentClass($user);
$file = getClassPath($this->activeView);
if(!file_exists($file) || !is_subclass_of($this->activeView, View::class)) {
return null;
}
return new $this->activeView($this);
}
function getCode() {
@@ -47,9 +48,10 @@ abstract class Document {
$body = $this->body->getCode();
$head = $this->head->getCode();
$lang = $this->user->getLanguage()->getShortCode();
$html = "<!DOCTYPE html>";
$html .= "<html>";
$html .= "<html lang=\"$lang\">";
$html .= $head;
$html .= $body;
$html .= "</html>";

View File

@@ -0,0 +1,16 @@
<?php
namespace Elements;
abstract class SimpleBody extends Body {
public function __construct($document) {
parent::__construct($document);
}
public function getCode() {
$content = $this->getContent();
return parent::getCode() . "<body>$content</body>";
}
protected abstract function getContent();
}

View File

@@ -83,7 +83,7 @@ abstract class View extends StaticView {
if($classes)
$iconClass .= " $classes";
return "<i class=\"$iconClass\"></i>";
return "<i class=\"$iconClass\" />";
}
protected function createErrorText($text, $id="", $hidden=false) {