Commit e0930188 authored by Miniontoby's avatar Miniontoby ✍🏻
Browse files

Updated some files

- config template change
- js folder
- class updated url thing
- manifest.js (created from manifest.php, using .htaccess)
- updated todo list
parent 948aa8b1
......@@ -8,6 +8,8 @@ RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule manifest.json manifest.php [L,NC]
#RewriteRule js/fb_config.js js/fb_config.php [L,NC]
RewriteRule ^([^/]+)$ index.php?page=$1 [L,NC]
#RewriteCond %{REQUEST_FILENAME} !-f
......
......@@ -4,12 +4,20 @@ A school roster project for yh4f
# Usage:
## Config
Make sure to edit the config.
Copy the template `cp public/config/config.template.ini public/config/config.ini`
And edit the copied file `public/config/config.ini`
## Setup
For apache2 make sure to have the directory block like this:
```
<Directory /var/www/>
Options Indexes FollowSymLinks
<Directory /folder/to/myschoolday/>
AllowOverride All
Require all granted
</Directory>
......
Todo:
# Design the database
# Design the functions for executing of database requests
# Create a list of functions "MySchoolDay" should have and how they should work.
# Create all templates
# Create WebApp
# Create Notifications
Done:
# Design the functions for executing of database requests
......@@ -6,4 +6,6 @@ db_name =
[application]
app_email =
app_url =
\ No newline at end of file
app_domain =
app_folder =
app_language = en_US
:root {
--bg-color:rgb(255, 210, 96);
--bg-color: #ffd260;
--font-color: #000;
--footer-bg: rgb(0, 255, 94);
--footer-bg: #00ff5e;
--footer-color: #000;
}
[data-theme="dark"] {
......
......@@ -11,8 +11,9 @@ class MySchoolDay {
exit;
}
$this->config = parse_ini_file(dirname(__DIR__, 1) . '/config/config.ini');
$this->url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? "https://" . $this->config['app_url'] . '/' : "http://" . $this->config['app_url'] . '/';
$this->url .= (__DIR__ == $_SERVER['DOCUMENT_ROOT']) ? $_SERVER['REQUEST_URI'] : basename($_SERVER['REQUEST_URI']);
$this->url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? "https://" : "http://";
$this->url .= $this->config['app_domain'] . $this->config['app_folder'];
$this->url .= ($_SERVER['REQUEST_URI'] == $this->config['app_folder']) ? '' : basename($_SERVER['REQUEST_URI']);
$this->db = new db($this->config['db_host'], $this->config['db_user'], $this->config['db_password'], $this->config['db_name']);
}
};
......
<?php
include('functions/class.php');
$app = new MySchoolDay();
if (isset($_GET['page']) && file_exists('templates/' . $_GET['page'] . '.php')){
$page_title = $_GET['page'];
$page_name = (isset($_GET['page'])) ? $_GET['page'] : 'home';
if (file_exists('templates/' . $page_name . '.php')){
$page_title = $page_name;
} else {
$page_title = '404 Not Found';
}
?>
<html>
<head>
<title><?php echo $page_title; ?> - MySchoolDay</title>
<title><?=$page_title?> - MySchoolDay</title>
<meta name="title" content="<?=$page_title?> - MySchoolDay">
<meta name="description" content="MySchoolDay WebApp">
<meta name="twitter:card" content="summary_large_image">
......@@ -21,17 +22,18 @@ if (isset($_GET['page']) && file_exists('templates/' . $_GET['page'] . '.php')){
<meta property="og:title" content="<?=$page_title?> - MySchoolDay">
<meta property="og:description" content="MySchoolDay WebApp">
<meta property="og:image" content="images/logo.png">
<meta property="twitter:domain" content="<?=$app->config['app_url']?>">
<meta property="twitter:domain" content="<?=$app->config['app_domain']?>">
<meta property="twitter:url" content="<?=$app->url?>">
<link rel="shortcut icon" type="image/ico" href="favicon.ico"/>
<link rel="stylesheet" href="css/style.css"/>
<link rel="manifest" href="manifest.json"/>
</head>
<body>
<?php
if (isset($_GET['page']) && file_exists('templates/' . $_GET['page'] . '.php')){
if (file_exists('templates/' . $page_name . '.php')){
echo "<br>";
include('templates/' . $_GET['page'] . '.php');
include('templates/' . $page_name . '.php');
echo "<br>";
} else {
?>
......@@ -44,9 +46,8 @@ if (isset($_GET['page']) && file_exists('templates/' . $_GET['page'] . '.php')){
<?php
}
?>
<br>
<nav>
<nav style="display: none">
<div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox">
<input id="checkbox" type="checkbox">
......@@ -55,19 +56,8 @@ if (isset($_GET['page']) && file_exists('templates/' . $_GET['page'] . '.php')){
<em>Enable Dark Mode!</em>
</div>
</nav>
<script>
const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]'), currentTheme = localStorage.getItem('theme');
if (currentTheme) { document.documentElement.setAttribute('data-theme', currentTheme); if (currentTheme === 'dark') { toggleSwitch.checked = true; } }
toggleSwitch.addEventListener('change', function(e) {
if (e.target.checked) {
document.documentElement.setAttribute('data-theme', 'dark');
localStorage.setItem('theme', 'dark');
} else {
document.documentElement.setAttribute('data-theme', 'light');
localStorage.setItem('theme', 'light');
}
}, false);
</script>
<noscript>Please Enable JavaScript For Some Features</noscript>
<script src="js/main.js"></script>
<footer>
<span class="copyright">© Copyright 2021 - TheDutchProgrammers</span>
</footer>
......
document.getElementsByTagName("nav")[0].style.display = 'block';
const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]'), currentTheme = localStorage.getItem('theme');
if (currentTheme) { document.documentElement.setAttribute('data-theme', currentTheme); if (currentTheme === 'dark') { toggleSwitch.checked = true; } }
toggleSwitch.addEventListener('change', function(e) {
if (e.target.checked) {
document.documentElement.setAttribute('data-theme', 'dark');
localStorage.setItem('theme', 'dark');
} else {
document.documentElement.setAttribute('data-theme', 'light');
localStorage.setItem('theme', 'light');
}
}, false);
\ No newline at end of file
<?php
include('functions/class.php');
$app = new MySchoolDay();
$url = ($_SERVER['REQUEST_URI'] == $app->config['app_folder']) ? '/' : $app->config['app_folder'];
?>
{
"name": "MySchoolDay",
"short_name": "MSD",
"description": "MySchoolDay Webapp with notifications",
"theme_color": "#ffd260",
"background_color": "#ffd260",
"display": "standalone",
"lang": "<?=$app->config['app_language']?>",
"icons": [
{"src": "images/icon.png", "sizes": "256x256", "type": "image/png"},
{"src": "images/logo.png", "sizes": "256x245", "type": "image/png"},
{"src": "images/LogoMint.png", "sizes": "48x48", "type": "image/png"},
{"src": "images/logo-removebg-preview__1_.png", "sizes": "256x245", "type": "image/png"}
],
"start_url": "index.php",
"scope": "<?=$url?>",
"prefer_related_applications": false
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment