1
0
app/index.php
2024-04-30 03:10:52 +03:00

151 lines
5.6 KiB
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
error_reporting(0);
ini_set('error_reporting', 0);
require_once __DIR__.'/system/libs/autoload.php';
if(substr(parse_url($_SERVER['REQUEST_URI'])['path'],-1) == '/'){
$file = __DIR__.'/system/pages/program.php';
} elseif(substr(parse_url($_SERVER['REQUEST_URI'])['path'],-1) != '/'){
if(pathinfo(parse_url($_SERVER['REQUEST_URI'])['path'])['filename'] == 'index' || pathinfo(parse_url($_SERVER['REQUEST_URI'])['path'])['filename'] == 'home'){
$file = __DIR__.'/system/pages/program.php';
} elseif (pathinfo(parse_url($_SERVER['REQUEST_URI'])['path'])['filename'] != '') {
$file = __DIR__.'/system/pages/'.pathinfo(parse_url($_SERVER['REQUEST_URI'])['path'])['filename'].'.php';
}
} else {
$file = __DIR__.'/system/pages/program.php';
}
if(file_exists($file)){
try {
require_once $file;
} catch (\Error $e) {
http_response_code(500);
}
} else {
http_response_code(404);
}
if(class_exists('Page')){
$page = new Page;
if(isset($page) && method_exists($page, 'header')){
$page->header();
}
}
?>
<!DOCTYPE html>
<html lang="fi">
<head>
<title>Satakunnan opiskelijaradio</title>
<!-- Meta -->
<meta name="subject" content="Satakunnan opiskelijaradio">
<meta name="description" content="Tehdään yhdessä satakuntalainen opiskelijaradio!">
<meta name="keywords" content="opiskelijaradio,satakunta,satakuntalainen">
<meta name="author" content="Satakunnan opiskelijaradio">
<meta name="copyright" content="Warén Group">
<meta name="language" content="fi">
<!-- Meta: Charset -->
<meta charset="UTF-8">
<!-- Meta: Viewport -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Meta: Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:title" content="Satakunnan opiskelijaradio">
<meta property="og:url" content="https://opiskelijaradio.fi/">
<meta property="og:description" content="Tehdään yhdessä satakuntalainen opiskelijaradio!">
<!-- Meta: Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:title" content="Satakunnan opiskelijaradio">
<meta property="twitter:url" content="https://opiskelijaradio.fi/">
<meta property="twitter:description" content="Tehdään yhdessä satakuntalainen opiskelijaradio!">
<meta property="twitter:site" content="@opiskelijaradio">
<meta property="twitter:creator" content="@opiskelijaradio">
<!-- Meta: Robots -->
<meta name="robots" content="noodp,noarchive">
<meta name="google" content="notranslate">
<!-- Link: Icon -->
<link rel="icon" type="image/svg+xml" href="assets/images/favicon.svg">
<link rel="icon" type="image/png" href="assets/images/favicon.png">
<!-- Link: WebApp -->
<link rel="manifest" href="pwa.json">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta content="yes" name="apple-touch-fullscreen" />
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- Link: Preconnect & DNS Prefetch & Preload -->
<link rel="preconnect" href="//cdn.cwinfo.net">
<link rel="dns-prefetch" href="//cdn.cwinfo.net">
<link rel="preload" as="style" href="https://cdn.cwinfo.net/frameworks/font-awesome/6.5.2/css/all.min.css" crossorigin="anonymous">
<link rel="preload" as="font" type="font/woff2" href="https://cdn.cwinfo.net/frameworks/font-awesome/6.5.2/webfonts/fa-solid-900.woff2" crossorigin="anonymous">
<link rel="preload" as="script" href="https://cdn.cwinfo.net/frameworks/jquery/3.7.1/jquery.min.js" crossorigin="anonymous">
<!-- JS -->
<script src="https://cdn.cwinfo.net/frameworks/jquery/3.7.1/jquery.min.js" crossorigin="anonymous"></script>
<!-- CSS -->
<link rel="stylesheet" href="https://cdn.cwinfo.net/frameworks/font-awesome/6.5.2/css/all.min.css" crossorigin="anonymous" media="screen">
<style>
/* MAIN.SCSS  START */
<?php
$scss = new ScssPhp\ScssPhp\Compiler();
$file = __DIR__."/assets/css/main.scss";
echo $scss->compile(file_get_contents($file));
?>
/* MAIN.SCSS END */
<?php
if(isset($page) && method_exists($page, 'style')) {
$page->style();
}
?>
</style>
<?php
if(isset($page) && method_exists($page, 'meta')) {
$page->meta();
}
?>
</head>
<body>
<header>
<a href="home"><img src="assets/images/logo.svg" title="Satakunnan opiskelijaradio" alt="Satakunnan opiskelijaradio"></a>
</header>
<nav>
</nav>
<main>
<?php
if(isset($page) && method_exists($page, 'content')) {
$page->content();
}
?>
</main>
<footer>
<a href="play"><i class="fas fa-play"></i> <span>Kuuntele</span></a>
<a href="program"><i class="fas fa-list"></i> <span>Ohjelmisto</span></a>
</footer>
<script>
/* JAVASCRIPTSUPPORT.JS  START */
<?php
$file = __DIR__."/assets/js/javascriptSupportCookie.js";
echo file_get_contents($file);
?>
/* JAVASCRIPTSUPPORT.JS END */
</script>
</body>
</html>