diff --git a/composer.json b/composer.json index 94a167d..b0e8dad 100644 --- a/composer.json +++ b/composer.json @@ -26,6 +26,10 @@ "app\\ic\\": [ "src/lib/ic", "src/handlers/ic" + ], + "app\\omnia\\": [ + "src/lib/omnia", + "src/handlers/omnia" ] } } diff --git a/config.yaml.example b/config.yaml.example index 222bd9d..31990d7 100644 --- a/config.yaml.example +++ b/config.yaml.example @@ -8,6 +8,8 @@ subdomains: dev: foreignone ic: ic icdev: ic + omnia: omnia + omniadev: omnia mysql: host: "127.0.0.1" diff --git a/deploy/static.sh b/deploy/static.sh index 21087c8..df8f636 100755 --- a/deploy/static.sh +++ b/deploy/static.sh @@ -22,7 +22,7 @@ while [ $# -gt 0 ]; do done [ -z "$OUTPUT_ROOT_DIR" ] && die "you must specify output directory" -for project in ic foreignone; do +for project in ic foreignone omnia; do "$SCRIPT_DIR"/util/build_css.sh -i "$APP_DIR/public/$project/scss" -o "$OUTPUT_ROOT_DIR/public/$project/dist-css" || die "build_css failed" "$SCRIPT_DIR"/util/build_js.sh -i "$APP_DIR/public/common/js" -o "$OUTPUT_ROOT_DIR/public/$project/dist-js" || die "build_js failed" $PHP "$SCRIPT_DIR"/util/gen_runtime_config.php \ diff --git a/deploy/util/gen_runtime_config.php b/deploy/util/gen_runtime_config.php index ff9c045..e2e4859 100644 --- a/deploy/util/gen_runtime_config.php +++ b/deploy/util/gen_runtime_config.php @@ -28,7 +28,7 @@ $hashes = [ 'assets' => [] ]; -foreach (['ic', 'foreignone'] as $project) { +foreach (['ic', 'foreignone', 'omnia'] as $project) { foreach (['js', 'css'] as $type) { $dist_dir = $app_root.'/public/'.$project.'/dist-'.$type; $entries = glob_recursive($dist_dir.'/*.'.$type); diff --git a/public/common/scss/app/head.scss b/public/common/scss/app/head.scss index e285211..3a69ac3 100644 --- a/public/common/scss/app/head.scss +++ b/public/common/scss/app/head.scss @@ -77,6 +77,7 @@ vertical-align: top; color: $dark-grey; // color of separators padding-top: 15px; + white-space: nowrap; } a.head-item { border: 1px $head-items-border solid; diff --git a/public/common/scss/app/mobile.scss b/public/common/scss/app/mobile.scss index ed1a804..86e0729 100644 --- a/public/common/scss/app/mobile.scss +++ b/public/common/scss/app/mobile.scss @@ -11,6 +11,9 @@ textarea { .head, .head-inner, .head-logo-wrap, .head-items, .head-logo { display: block; } +.head-items { + white-space: normal; +} .head { overflow: hidden; border-bottom: 1px $border-color solid; diff --git a/public/omnia/favicon.ico b/public/omnia/favicon.ico new file mode 100644 index 0000000..b797966 Binary files /dev/null and b/public/omnia/favicon.ico differ diff --git a/public/omnia/favicon.png b/public/omnia/favicon.png new file mode 100644 index 0000000..19e8f87 Binary files /dev/null and b/public/omnia/favicon.png differ diff --git a/public/omnia/scss/common.scss b/public/omnia/scss/common.scss new file mode 100644 index 0000000..e2e6cc6 --- /dev/null +++ b/public/omnia/scss/common.scss @@ -0,0 +1,3 @@ +@import "../../common/scss/app/common"; +@import "../../common/scss/app/head"; +@import "../../common/scss/app/foot"; diff --git a/public/omnia/scss/common@dark.scss b/public/omnia/scss/common@dark.scss new file mode 100644 index 0000000..31e4da2 --- /dev/null +++ b/public/omnia/scss/common@dark.scss @@ -0,0 +1,2 @@ +@import '../../common/scss/colors/dark'; +@import './common'; \ No newline at end of file diff --git a/public/omnia/scss/common@light.scss b/public/omnia/scss/common@light.scss new file mode 100644 index 0000000..55a7b3d --- /dev/null +++ b/public/omnia/scss/common@light.scss @@ -0,0 +1,2 @@ +@import '../../common/scss/colors/light'; +@import './common'; \ No newline at end of file diff --git a/public/omnia/scss/targets.txt b/public/omnia/scss/targets.txt new file mode 100644 index 0000000..c25b4dc --- /dev/null +++ b/public/omnia/scss/targets.txt @@ -0,0 +1,2 @@ +common +admin diff --git a/src/engine/http/RequestHandler.php b/src/engine/http/RequestHandler.php index 0156053..2434f6e 100644 --- a/src/engine/http/RequestHandler.php +++ b/src/engine/http/RequestHandler.php @@ -45,6 +45,7 @@ abstract class RequestHandler $router = router::getInstance(); $route = $router->find($uri); + if ($route === null) throw new NotFound('Route not found'); diff --git a/src/handlers/omnia/BaseHandler.php b/src/handlers/omnia/BaseHandler.php new file mode 100644 index 0000000..d9b1da5 --- /dev/null +++ b/src/handlers/omnia/BaseHandler.php @@ -0,0 +1,25 @@ +skin = new OmniaSkin(); + $this->skin->strings->load('omnia'); + $this->skin->addStatic( + 'css/common.css', + 'js/common.js' + ); + $this->skin->setGlobal([ + 'is_admin' => isAdmin(), + 'is_dev' => isDev() + ]); + } +} \ No newline at end of file diff --git a/src/handlers/omnia/MainHandler.php b/src/handlers/omnia/MainHandler.php new file mode 100644 index 0000000..9326e95 --- /dev/null +++ b/src/handlers/omnia/MainHandler.php @@ -0,0 +1,24 @@ +skin->meta->title = lang('meta_index_title'); + $this->skin->meta->description = lang('meta_index_description'); + $this->skin->meta->url = 'https://'.$_SERVER['HTTP_HOST'].'/'; + + $this->skin->options->isIndex = true; + + return $this->skin->renderPage('index.twig'); + } +} diff --git a/src/lib/foreignone/ForeignOneSkin.php b/src/lib/foreignone/ForeignOneSkin.php index e350a2c..90cfc7d 100644 --- a/src/lib/foreignone/ForeignOneSkin.php +++ b/src/lib/foreignone/ForeignOneSkin.php @@ -96,6 +96,7 @@ class ForeignOneSkin 'admin_email' => $config['admin_email'], 'script_html' => $this->getFooterScriptTags(), 'theme' => ThemesUtil::getUserTheme(), + 'omnia_url' => 'https://omnia'.(isDev() ? 'dev' : '').'.'.$config['domain'], ]; return $this->doRender('footer.twig', $footer_vars); } diff --git a/src/lib/omnia/OmniaSkin.php b/src/lib/omnia/OmniaSkin.php new file mode 100644 index 0000000..4c07463 --- /dev/null +++ b/src/lib/omnia/OmniaSkin.php @@ -0,0 +1,78 @@ +title) && $this->title ? $this->title : lang('site_title'); + if (!$this->options->isIndex) + $title = $title.' - Omnia'; + return $title; + } + + set(string $title) { + $this->title = $title; + } + } + + public function __construct() { + parent::__construct(); + $this->options = new OmniaSkinOptions(); + } + + protected function getTwigLoader(): LoaderInterface { + $twig_loader = new FilesystemLoader(APP_ROOT.'/src/skins/omnia', APP_ROOT); + return $twig_loader; + } + + protected function getCacheDir(): string { + global $config; + return $config['skin_cache_'.(isDev() ? 'dev' : 'prod').'_dir'].'/omnia'; + } + + protected function renderHeader(): string { + global $config; + + $vars = [ + 'title' => $this->title, + 'meta_html' => $this->meta->getHtml(), + 'static_html' => $this->getHeaderStaticTags(), + 'svg_html' => $this->getSVGTags(), + 'render_options' => $this->options->getOptions(), + 'home_url' => 'https://'.(isDev() ? 'dev.' : '').$config['domain'], + 'app_config' => [ + 'domain' => $config['domain'], + 'devMode' => isDev(), + 'cookieHost' => $config['cookie_host'], + ], + 'theme' => ThemesUtil::getUserTheme(), + ]; + + return $this->doRender('header.twig', $vars); + } + + protected function renderBody(string $template, array $vars): string { + return $this->doRender($template, $this->vars + $vars); + } + + protected function renderFooter(): string { + global $config; + $footer_vars = [ + 'exec_time' => getExecutionTime(), + 'render_options' => $this->options->getOptions(), + 'admin_email' => $config['admin_email'] ?? '', + 'script_html' => $this->getFooterScriptTags(), + 'theme' => ThemesUtil::getUserTheme(), + ]; + return $this->doRender('footer.twig', $footer_vars); + } +} \ No newline at end of file diff --git a/src/lib/omnia/OmniaSkinOptions.php b/src/lib/omnia/OmniaSkinOptions.php new file mode 100644 index 0000000..96bde67 --- /dev/null +++ b/src/lib/omnia/OmniaSkinOptions.php @@ -0,0 +1,9 @@ + 'tzo_part part=$(1)', ], ]; +})(), + +'omnia' => (function() { + return [ + 'Main' => [ + '/' => 'index', + ], + ]; })() ]; diff --git a/src/skins/error/notfound.twig b/src/skins/error/notfound.twig index 5254bf8..206b185 100644 --- a/src/skins/error/notfound.twig +++ b/src/skins/error/notfound.twig @@ -30,7 +30,7 @@ body { width: 220px; height: 220px; display: block; - background: url("/img/eagle.jpg") no-repeat center center; + background: url("https://4in1.ws/img/eagle.jpg") no-repeat center center; background-size: cover; border-radius: 50%; text-decoration: none; diff --git a/src/skins/foreignone/footer.twig b/src/skins/foreignone/footer.twig index 5a43b13..2230467 100644 --- a/src/skins/foreignone/footer.twig +++ b/src/skins/foreignone/footer.twig @@ -8,7 +8,8 @@
diff --git a/src/skins/foreignone/header.twig b/src/skins/foreignone/header.twig index a9e9d4b..86f8a7f 100644 --- a/src/skins/foreignone/header.twig +++ b/src/skins/foreignone/header.twig @@ -36,7 +36,13 @@ wiki about - + invisible college {{ svgInPlace('college_20') }} diff --git a/src/skins/omnia/footer.twig b/src/skins/omnia/footer.twig new file mode 100644 index 0000000..20ede7a --- /dev/null +++ b/src/skins/omnia/footer.twig @@ -0,0 +1,21 @@ + + + + + + +{{ script_html|raw }} + +