Update website
This commit is contained in:
parent
4413528994
commit
1d90fbf296
6865 changed files with 1091082 additions and 0 deletions
56
v.php
Normal file
56
v.php
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
require_once dirname(__FILE__).'/common.php';
|
||||
|
||||
function page_not_found() {
|
||||
http_response_code(404);
|
||||
include('not_found.php');
|
||||
die();
|
||||
}
|
||||
|
||||
$cwd = dirname(__FILE__);
|
||||
|
||||
if (empty($_GET['p'])) {
|
||||
if (!isset($_SERVER['PATH_INFO'])) {
|
||||
page_not_found();
|
||||
} else {
|
||||
if (empty($_SERVER['PATH_INFO'])) {
|
||||
page_not_found();
|
||||
}
|
||||
$path_info = explode('/', $_SERVER['PATH_INFO']);
|
||||
if (count($path_info) !== 2) {
|
||||
page_not_found();
|
||||
}
|
||||
if ($path_info[0] !== '') {
|
||||
page_not_found();
|
||||
}
|
||||
$page = $path_info[1];
|
||||
|
||||
}
|
||||
} else {
|
||||
$page = $_GET['p'];
|
||||
}
|
||||
|
||||
|
||||
$m = setup_mustache();
|
||||
|
||||
$tpl = $m->loadTemplate('public/generic');
|
||||
|
||||
$page_md = array();
|
||||
|
||||
$parser = new Doctrine\RST\Parser();
|
||||
|
||||
$fname = "{$cwd}/generic/{$page}.rst";
|
||||
if (!file_exists($fname)) {
|
||||
page_not_found();
|
||||
}
|
||||
$handle = fopen($fname, "r");
|
||||
$page_md['ROOT_URL'] = $iap_root;
|
||||
$page_md['content'] = $parser->parse(fread($handle, filesize($fname)))->render();
|
||||
$page_md['other_scripts'] = [WebpackBuiltFiles::$jsFiles['code']];
|
||||
//$page_md['boot_script'] = "gl.code.runCode();";
|
||||
fclose($handle);
|
||||
|
||||
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
echo $tpl->render($page_md);
|
Loading…
Add table
Add a link
Reference in a new issue