Make public index PHP so backend transformations are possible

This commit is contained in:
Robbie Antenesse 2018-07-01 13:37:30 -06:00
parent 07ca94fc3c
commit e6878fd9ec
3 changed files with 55 additions and 37 deletions

View File

@ -2,11 +2,11 @@
#
# RewriteRule ^view/([0-9]+)/([0-9]+)/?$ index.php?dict=$1&word=$2 [NC,L] # Handle word ids.
#
# RewriteRule ^([0-9]+)/([0-9]+)/?$ index.php?dict=$1&word=$2 [NC,L] # Handle word ids.
# RewriteRule ^([0-9]+)/([0-9]+)/?$ index.php?dict=$1&word=$2 [NC,L] # Handle word ids.
#
# RewriteRule ^view/([0-9]+)/?$ index.php?dict=$1 [NC,L] # Handle dictionary ids.
# RewriteRule ^view/([0-9]+)/?$ index.php?dict=$1 [NC,L] # Handle dictionary ids.
#
# RewriteRule ^([0-9]+)/?$ index.php?dict=$1 [NC,L] # Handle dictionary ids.
# RewriteRule ^([0-9]+)/?$ index.php?dict=$1 [NC,L] # Handle dictionary ids.
#
# RewriteRule ^issues/?$ https://gitlab.com/Alamantus/Lexiconga/issues [R=301,L] # Shorten issues url.
#

View File

@ -1,34 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Lexiconga Dictionary Builder</title>
<meta property="og:url" content="http://lexicon.ga">
<meta property="og:type" content=website>
<meta property="og:title" content="Lexiconga Dictionary Builder">
<meta property="og:description" content="Build lexicons for contructed languages or anything that you can think of!">
<meta property="og:image" content="http://lexicon.ga/images/logo.svg">
<meta property="Content-Security-Policy"
content="default-src 'self';
base-uri 'self';
sandbox 'self';
script-src 'self';
child-src 'none';
object-src 'none';
plugin-types 'none';
connect-src 'none';
font-src *;
img-src *;
media-src *;
style-src 'self';
worker-src 'self';
form-action 'none'">
<link rel="shortcut icon" href="./favicon.ico" />
</head>
<body>
<div id="site"></div>
<script src="lexiconga.js"></script>
</body>
</html>

52
public/index.php Normal file
View File

@ -0,0 +1,52 @@
<?php
$page_title = 'Lexiconga';
$domain = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]";
$sub_path = $_SERVER['HTTP_HOST'] == 'localhost' ? '/lexiconga' : '';
$actual_url = "$domain$_SERVER[REQUEST_URI]";
$dictionary_id = isset($_GET['dict']) ? $_GET['dict'] : false;
$word_id = isset($_GET['word']) ? $_GET['word'] : false;
if ($dictionary_id !== false) {
// Get dictionary details if public.
$page_title = 'Public Dictionary' . ' | ' . $page_title;
if ($word_id !== false) {
// Get specific word if public.
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $page_title; ?></title>
<meta property="og:url" content="<?php echo $actual_url; ?>">
<meta property="og:type" content="website">
<meta property="og:title" content="<?php echo $page_title; ?>">
<meta property="og:description" content="Quickly build lexicons, dictionaries, or word lists for contructed languages or anything that you can think of!">
<meta property="og:image" content="<?php echo $domain . $sub_path; ?>/images/logo.svg">
<meta property="Content-Security-Policy"
content="default-src 'self';
base-uri 'self';
sandbox 'self';
script-src 'self';
child-src 'none';
object-src 'none';
plugin-types 'none';
connect-src 'none';
font-src *;
img-src *;
media-src *;
style-src 'self';
worker-src 'self';
form-action 'none'">
<link rel="shortcut icon" href="<?php echo $domain . $sub_path; ?>/favicon.ico" />
</head>
<body>
<div id="site"></div>
<script src="lexiconga.js"></script>
</body>
</html>