summaryrefslogtreecommitdiff
path: root/src/web/config
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/web/config.php56
-rw-r--r--src/web/config/aesthetic.php83
-rw-r--r--src/web/config/routes.php12
3 files changed, 56 insertions, 95 deletions
diff --git a/src/web/config.php b/src/web/config.php
new file mode 100644
index 0000000..3ca2bbd
--- /dev/null
+++ b/src/web/config.php
@@ -0,0 +1,56 @@
+<?php /* Copyright (c) 2024 Freya Murphy */
+
+// CONFIG
+// config values needed across the website
+//
+// domain - the default domain for the website
+//
+// allowed_hosts - accepted domains to use for the website
+//
+// base_path - the base path the website is located at
+//
+// theme_color - html hex color used for browser metadata
+//
+// routes - array of regex keys that match the request path and
+// - place it with the value if it matches
+// - e.g. '' => 'home' sends / to /home
+//
+// style - single or list of css styles to load on specific routes
+//
+// js - single or list of js script to load on specific routes
+//
+// autoload - list of directories to autoload all PHP files in them
+//
+define('SITE_CONFIG', array(
+ /* core settings */
+ 'domain' => 'xssbook.com',
+ 'allowed_hosts' => ['xssbook.com'],
+ 'base_path' => '/',
+ 'theme_color' => '#1778f2',
+ /* route overides */
+ 'routes' => array(
+ 'manifest.json' => '_meta/manifest',
+ ),
+ /* css to load on each route */
+ 'style' => array(
+ '' => 'css/common.css',
+ 'home' => ['css/home.css', 'css/post.css'],
+ 'auth' => 'css/auth.css',
+ 'people' => 'css/people.css',
+ 'profile' => ['css/profile.css', 'css/people.css', 'css/post.css'],
+ 'settings' => 'css/settings.css',
+ 'error' => 'css/error.css',
+ ),
+ /* js to load on each route */
+ 'js' => array(
+ '' => ['js/thirdparty/jquery.min.js', 'js/lib.js', 'js/modal.js'],
+ 'home' => 'js/post.js',
+ 'profile' => 'js/post.js',
+ ),
+ /* directories to autoload php code */
+ 'autoload' => array('/lib'),
+));
+
+define('POST_PAGE_SIZE', 10);
+define('COMMENT_PAGE_SIZE', 5);
+define('PEOPLE_PAGE_SIZE', 24);
diff --git a/src/web/config/aesthetic.php b/src/web/config/aesthetic.php
deleted file mode 100644
index 5a66660..0000000
--- a/src/web/config/aesthetic.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php /* Copyright (c) 2024 Freya Murphy */
-class Aesthetic {
-
- private $config;
-
- function __construct() {
- $this->config = array(
- '_common' => array(
- 'js' => [
- 'js/thirdparty/jquery.min.js',
- 'js/lib.js',
- 'js/modal.js',
- ],
- 'css' => [
- 'css/common.css'
- ],
- ),
- 'error' => array(
- 'css' => [
- 'css/error.css'
- ],
- ),
- 'home' => array(
- 'js' => [
- 'js/post.js',
- ],
- 'css' => [
- 'css/home.css',
- 'css/post.css'
- ],
- ),
- 'auth' => array(
- 'css' => [
- 'css/auth.css'
- ],
- ),
- 'people' => array(
- 'css' => [
- 'css/people.css'
- ],
- ),
- 'profile' => array(
- 'js' => [
- 'js/post.js',
- ],
- 'css' => [
- 'css/profile.css',
- 'css/people.css',
- 'css/post.css'
- ],
- ),
- 'settings' => array(
- 'css' => [
- 'css/settings.css'
- ]
- ),
- );
- }
- /**
- * @param mixed $route
- * @return array<string,>
- */
- function get_files($route): array {
- $js_files = $this->config['_common']['js'];
- $css_files = $this->config['_common']['css'];
-
- if (array_key_exists($route, $this->config)) {
- $config = $this->config[$route];
- if (array_key_exists('js', $config)) {
- $js_files = array_merge($js_files, $config['js']);
- }
- if (array_key_exists('css', $config)) {
- $css_files = array_merge($css_files, $config['css']);
- }
- }
-
- return array(
- 'js_files' => $js_files,
- 'css_files' => $css_files,
- );
- }
-
-}
diff --git a/src/web/config/routes.php b/src/web/config/routes.php
deleted file mode 100644
index 20b499a..0000000
--- a/src/web/config/routes.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php /* Copyright (c) 2024 Freya Murphy */
-
-$routes = array();
-$routes['home'] = 'apps/home';
-$routes['error'] = 'apps/error';
-$routes['auth'] = 'apps/auth';
-$routes['people'] = 'apps/people';
-$routes['profile'] = 'apps/profile';
-$routes['settings'] = 'apps/settings';
-
-$routes[''] = '_index';
-$routes['manifest.json'] = '_meta/manifest';