small fixes

This commit is contained in:
slawkens 2023-02-14 22:03:22 +01:00
parent d565b90736
commit 590fe0762d
2 changed files with 8 additions and 5 deletions

View File

@ -55,10 +55,9 @@ if (BASE_DIR !== '') {
define('URI', $uri); define('URI', $uri);
/** @var boolean $load_it */
if(!$load_it) { if(!$load_it) {
// ignore warnings in some functions/plugins // ignore warnings in some functions/plugins
// page is not loaded anyways // page is not loaded anyway
define('PAGE', ''); define('PAGE', '');
return; return;
@ -147,6 +146,10 @@ $found = true;
// old support for pages like /?subtopic=accountmanagement // old support for pages like /?subtopic=accountmanagement
$page = $_REQUEST['p'] ?? ($_REQUEST['subtopic'] ?? ''); $page = $_REQUEST['p'] ?? ($_REQUEST['subtopic'] ?? '');
if(!empty($page) && preg_match('/^[A-z0-9\-]+$/', $page)) { if(!empty($page) && preg_match('/^[A-z0-9\-]+$/', $page)) {
if (isset($_REQUEST['p'])) { // some plugins may require this
$_REQUEST['subtopic'] = $_REQUEST['p'];
}
if (config('backward_support')) { if (config('backward_support')) {
require SYSTEM . 'compat/pages.php'; require SYSTEM . 'compat/pages.php';
} }
@ -161,7 +164,6 @@ else {
switch ($routeInfo[0]) { switch ($routeInfo[0]) {
case FastRoute\Dispatcher::NOT_FOUND: case FastRoute\Dispatcher::NOT_FOUND:
// ... 404 Not Found // ... 404 Not Found
//var_dump('not found');
/** /**
* Fallback to load page from templates/ or system/pages/ directory * Fallback to load page from templates/ or system/pages/ directory
*/ */
@ -282,7 +284,8 @@ function getDatabasePages() {
return $ret; return $ret;
} }
function loadPageFromFileSystem($page, &$found) { function loadPageFromFileSystem($page, &$found): string
{
$file = SYSTEM . 'pages/' . $page . '.php'; $file = SYSTEM . 'pages/' . $page . '.php';
if (!is_file($file)) { if (!is_file($file)) {
// feature: convert camelCase to snake_case // feature: convert camelCase to snake_case

View File

@ -27,7 +27,7 @@ if(isset($config['boxes']))
var loginStatus="<?php echo ($logged ? 'true' : 'false'); ?>"; var loginStatus="<?php echo ($logged ? 'true' : 'false'); ?>";
<?php <?php
if(PAGE !== 'news') { if(PAGE !== 'news') {
if(strpos(URI, 'subtopic=') !== false) { if(isset($_REQUEST['subtopic'])) {
$tmp = $_REQUEST['subtopic']; $tmp = $_REQUEST['subtopic'];
if($tmp === 'accountmanagement') { if($tmp === 'accountmanagement') {
$tmp = 'accountmanage'; $tmp = 'accountmanage';