Skip to content
Snippets Groups Projects
Commit b67fe685 authored by echicken's avatar echicken :chicken:
Browse files

Fix missing page title when defaulting to home.

Exit immediately if client attempting redirect to arbitrary external site. (This won't work for them anyway, but no need to run the rest of the script.)
Use js.exec() for components instead of load().
Use <? ... ?> instead of <?xjs ... ?> for XJS one-liners.
parent 92a32878
No related branches found
No related tags found
No related merge requests found
<?xjs
var page = typeof http_request.query.page == 'undefined' ? '000-home.xjs' : http_request.query.page[0];
if (page.search(/^http(s)*:\/\//) > -1) exit();
var settings = load('modopts.js', 'web') || { web_directory: web_root_dir + '/..' };
load(settings.web_directory + '/lib/init.js');
load(settings.web_lib + 'auth.js');
load(settings.web_lib + 'pages.js');
load(settings.web_lib + 'sidebar.js');
var page = typeof http_request.query.page == 'undefined' ? '000-home.xjs' : http_request.query.page[0];
if (page.search(/\.link$/) > -1) {
var loc = getExternalLink(page);
http_reply.status = '301 Moved Permanently';
......@@ -13,7 +15,10 @@
exit();
}
var pagePath = getPagePath(page);
if (pagePath == null) page = '000-home.xjs';
if (pagePath == null) {
page = '000-home.xjs';
pagePath = getPagePath('000-home.xjs');
}
var page_ctrl = getCtrlLine(pagePath);
?>
......@@ -27,11 +32,11 @@
return (function () {
const cdir = backslash(fullpath(settings.web_mods + 'components'));
if (file_isdir(cdir) && file_exists(cdir + fn)) {
load(xjs_compile(cdir + fn));
js.exec(xjs_compile(cdir + fn), new function () {});
return true;
}
if (file_exists(settings.web_components + fn)) {
load(xjs_compile(settings.web_components + fn));
js.exec(xjs_compile(settings.web_components + fn), new function () {});
return true;
}
return false;
......@@ -47,7 +52,7 @@
</style>
<script src="./js/jquery.min.js"></script>
<script type="text/javascript">
jQuery('html').addClass('hidden');
$('html').addClass('hidden');
</script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
......@@ -57,9 +62,9 @@
<link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="./css/offcanvas.css" rel="stylesheet">
<link href="./css/style.css" rel="stylesheet">
<?xjs if (settings.darkmode_allow) { ?>
<link href="./css/checkbox.css" rel="stylesheet">
<?xjs } ?>
<? if (settings.darkmode_allow) { ?>
<link href="./css/checkbox.css" rel="stylesheet">
<? } ?>
<? if (file_exists(settings.web_root + 'css/custom.css')) { ?>
<link href="./css/custom.css" rel="stylesheet">
<? } ?>
......@@ -76,13 +81,15 @@
loadComponent('navbar.xjs');
?>
<div class="container<?xjs if (settings.layout_full_width) write('-fluid'); ?>">
<div class="row row-offcanvas row-offcanvas-<?xjs write(settings.layout_sidebar_left ? 'left' : 'right'); ?>">
<div class="container<? if (settings.layout_full_width) write('-fluid'); ?>">
<div class="row row-offcanvas row-offcanvas-<? write(settings.layout_sidebar_left ? 'left' : 'right'); ?>">
<? if (settings.layout_sidebar_left) _sidebar(); ?>
<div class="col-xs-12 col-sm-<?xjs write(settings.layout_sidebar_off || page_ctrl.options.no_sidebar ? 12 : 9); ?>">
<div class="col-xs-12 col-sm-<? write(settings.layout_sidebar_off || page_ctrl.options.no_sidebar ? 12 : 9); ?>">
<div style="clear:both;">
<p class="pull-<?xjs write(settings.layout_sidebar_left ? 'left' : 'right'); ?> visible-xs">
<button title="Toggle sidebar" type="button" class="btn btn-primary btn-xs" data-toggle="offcanvas"><span class="glyphicon glyphicon-tasks"></span><?xjs write(locale.strings.main.label_sidebar); ?></button>
<p class="pull-<? write(settings.layout_sidebar_left ? 'left' : 'right'); ?> visible-xs">
<button title="Toggle sidebar" type="button" class="btn btn-primary btn-xs" data-toggle="offcanvas">
<span class="glyphicon glyphicon-tasks"></span><? write(locale.strings.main.label_sidebar); ?>
</button>
</p>
</div>
<? writePage(page); ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment