parent
8beba0fe59
commit
51ff80a2c8
@ -0,0 +1,2 @@
|
||||
DirectoryIndex index.php index.html
|
||||
Options -Indexes
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 英文官网物理入口。宝塔 Nginx 未把 /en 交给 Laravel 时,可直接由 public/en/ 提供页面。
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
$eventSitePath = dirname(__DIR__).'/frontend/event-site-en.html';
|
||||
if (! is_file($eventSitePath)) {
|
||||
http_response_code(503);
|
||||
header('Content-Type: text/plain; charset=UTF-8');
|
||||
echo 'English event site is missing.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$html = (string) file_get_contents($eventSitePath);
|
||||
$assetBase = '/frontend/assets';
|
||||
$homeUrl = '/';
|
||||
$homeEnUrl = '/en';
|
||||
$participantLoginUrl = '/admin/c/hsxt/login';
|
||||
$audienceLoginUrl = '/admin/c/hsxt/audience/login';
|
||||
$participantLoginEnUrl = '/frontend/prototype/login-en.html?role=user';
|
||||
$audienceLoginEnUrl = '/frontend/prototype/login-en.html?role=audience';
|
||||
|
||||
$html = str_replace(
|
||||
[
|
||||
'url("assets/',
|
||||
"url('assets/",
|
||||
'src="assets/',
|
||||
"src='assets/",
|
||||
'href="event-site-en.html"',
|
||||
"href='event-site-en.html'",
|
||||
'href="event-site.html"',
|
||||
"href='event-site.html'",
|
||||
'href="login.html"',
|
||||
"href='login.html'",
|
||||
'href="prototype/login-en.html?role=user"',
|
||||
"href='prototype/login-en.html?role=user'",
|
||||
'href="prototype/login-en.html?role=audience"',
|
||||
"href='prototype/login-en.html?role=audience'",
|
||||
'href="login-en.html?role=user"',
|
||||
"href='login-en.html?role=user'",
|
||||
'href="login-en.html?role=audience"',
|
||||
"href='login-en.html?role=audience'",
|
||||
'href="layout.html?role=user&lang=en"',
|
||||
"href='layout.html?role=user&lang=en'",
|
||||
'href="layout.html?role=audience&lang=en"',
|
||||
"href='layout.html?role=audience&lang=en'",
|
||||
'href="layout.html?role=user&lang=en"',
|
||||
"href='layout.html?role=user&lang=en'",
|
||||
'href="layout.html?role=audience&lang=en"',
|
||||
"href='layout.html?role=audience&lang=en'",
|
||||
'href="layout.html?role=audience"',
|
||||
"href='layout.html?role=audience'",
|
||||
],
|
||||
[
|
||||
'url("'.$assetBase.'/',
|
||||
"url('".$assetBase.'/',
|
||||
'src="'.$assetBase.'/',
|
||||
"src='".$assetBase.'/',
|
||||
'href="'.$homeEnUrl.'"',
|
||||
"href='".$homeEnUrl."'",
|
||||
'href="'.$homeUrl.'"',
|
||||
"href='".$homeUrl."'",
|
||||
'href="'.$participantLoginUrl.'"',
|
||||
"href='".$participantLoginUrl."'",
|
||||
'href="'.$participantLoginEnUrl.'"',
|
||||
"href='".$participantLoginEnUrl."'",
|
||||
'href="'.$audienceLoginEnUrl.'"',
|
||||
"href='".$audienceLoginEnUrl."'",
|
||||
'href="'.$participantLoginEnUrl.'"',
|
||||
"href='".$participantLoginEnUrl."'",
|
||||
'href="'.$audienceLoginEnUrl.'"',
|
||||
"href='".$audienceLoginEnUrl."'",
|
||||
'href="'.$participantLoginEnUrl.'"',
|
||||
"href='".$participantLoginEnUrl."'",
|
||||
'href="'.$audienceLoginEnUrl.'"',
|
||||
"href='".$audienceLoginEnUrl."'",
|
||||
'href="'.$participantLoginEnUrl.'"',
|
||||
"href='".$participantLoginEnUrl."'",
|
||||
'href="'.$audienceLoginEnUrl.'"',
|
||||
"href='".$audienceLoginEnUrl."'",
|
||||
'href="'.$audienceLoginUrl.'"',
|
||||
"href='".$audienceLoginUrl."'",
|
||||
],
|
||||
$html
|
||||
);
|
||||
|
||||
$sourceCode = trim((string) ($_GET['src'] ?? ''));
|
||||
if (preg_match('/^[A-Za-z0-9_-]{2,64}$/', $sourceCode) === 1) {
|
||||
$script = '<script>try{localStorage.setItem("cxxfds_public_source_code",'.json_encode($sourceCode, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).');localStorage.setItem("cxxfds_public_source_checked_at",String(Date.now()));}catch(e){}</script>';
|
||||
$html = preg_replace('/<\/head>/i', $script."\n</head>", $html, 1) ?? ($html.$script);
|
||||
}
|
||||
|
||||
header('Content-Type: text/html; charset=UTF-8');
|
||||
echo $html;
|
||||
Loading…
Reference in new issue