2021-04-02 10:13:23 +02:00
|
|
|
<?php
|
|
|
|
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
|
|
|
|
require("$root/articles/config.php");
|
|
|
|
require("$root/articles/Article.php");
|
2021-04-05 15:37:12 +02:00
|
|
|
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();
|
2021-04-02 10:13:23 +02:00
|
|
|
|
|
|
|
function archive() {
|
2021-04-05 15:37:12 +02:00
|
|
|
global $root;
|
|
|
|
$results = array();
|
2021-04-02 10:13:23 +02:00
|
|
|
$data = Article::getList();
|
2021-04-05 15:37:12 +02:00
|
|
|
$results['articles'] = $data;
|
|
|
|
// $result['totalRows'] = $data['totalRows'];
|
|
|
|
$results['pageTitle'] = "Article Archive | Chiro - Canto";
|
2021-04-02 10:13:23 +02:00
|
|
|
require("$root/articles/archive.php");
|
|
|
|
}
|
|
|
|
|
|
|
|
function view() {
|
2021-04-05 15:37:12 +02:00
|
|
|
global $root;
|
|
|
|
global $Parsedown;
|
2021-04-02 10:13:23 +02:00
|
|
|
if (! isset($_GET['article']) || ! $_GET['article']) {
|
|
|
|
home();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$results = array();
|
2021-04-05 15:37:12 +02:00
|
|
|
$results['articles'][] = Article::getById( (int)$_GET["article"] );
|
|
|
|
$results['pageTitle'] = $results['articles'][0]->title . " | Chiro - Canto";
|
2021-04-02 10:13:23 +02:00
|
|
|
require("$root/articles/view.php");
|
|
|
|
}
|
|
|
|
|
|
|
|
function home() {
|
2021-04-05 15:37:12 +02:00
|
|
|
global $Parsedown;
|
2021-04-02 10:13:23 +02:00
|
|
|
$results = array();
|
|
|
|
$data = Article::getList(HOMEPAGE_NUM_ARTICLES);
|
2021-04-05 15:37:12 +02:00
|
|
|
$results['articles'][] = $data[0];
|
|
|
|
// $results['totalRows'] = $data['totalRows'];
|
2021-04-02 10:13:23 +02:00
|
|
|
$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>
|