83 lines
2.2 KiB
PHP
Executable File
83 lines
2.2 KiB
PHP
Executable File
<?php
|
|
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
|
|
require("$root/articles/config.php");
|
|
require("$root/articles/Article.php");
|
|
session_start();
|
|
ini_set('display_errors', 1);
|
|
ini_set('display_startup_errors', 1);
|
|
error_reporting(E_ALL);
|
|
include("$root/vendor/erusev/parsedown/Parsedown.php");
|
|
$Parsedown = new Parsedown();
|
|
|
|
function archive() {
|
|
global $root;
|
|
$results = array();
|
|
$data = Article::getList();
|
|
$results['articles'] = $data;
|
|
// $result['totalRows'] = $data['totalRows'];
|
|
$results['pageTitle'] = "Article Archive | Chiro - Canto";
|
|
require("$root/articles/archive.php");
|
|
}
|
|
|
|
function view() {
|
|
global $root;
|
|
global $Parsedown;
|
|
if (! isset($_GET['article']) || ! $_GET['article']) {
|
|
home();
|
|
return;
|
|
}
|
|
$results = array();
|
|
$results['articles'][] = Article::getById( (int)$_GET["article"] );
|
|
$results['pageTitle'] = $results['articles'][0]->title . " | Chiro - Canto";
|
|
require("$root/articles/view.php");
|
|
}
|
|
|
|
function home() {
|
|
global $Parsedown;
|
|
$results = array();
|
|
$data = Article::getList(HOMEPAGE_NUM_ARTICLES);
|
|
$results['articles'][] = $data[0];
|
|
// $results['totalRows'] = $data['totalRows'];
|
|
$results['pageTitle'] = "Articles | Chiro - Canto";
|
|
require("home.php");
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Articles | Chiro - Canto</title>
|
|
<link rel="stylesheet" type="text/css" href="/styles/style.css">
|
|
</head>
|
|
<?php
|
|
include("$root/analytics/matomo.php");
|
|
?>
|
|
<body>
|
|
<?php include("$root/menu.php");?>
|
|
<?php include("$root/header.php");?>
|
|
<section>
|
|
<?php
|
|
$action = isset($_GET['action']) ? $_GET['action'] : "";
|
|
switch ($action) {
|
|
case 'archive':
|
|
archive();
|
|
break;
|
|
case 'view':
|
|
view();
|
|
break;
|
|
default:
|
|
home();
|
|
}
|
|
?>
|
|
<h2>Articles</h2>
|
|
<article>
|
|
<h3></h3>
|
|
</article>
|
|
</section>
|
|
<?php include("$root/footer.php");?>
|
|
</body>
|
|
<script src="/scripts/script.js"></script>
|
|
</html>
|