[ 'index', ], 'system' => [ 'index', ], 'error' => [ 'index', ], ]; // Select mode $category = isset($_GET['cat']) ? ( array_key_exists($_GET['cat'], $modes) ? $_GET['cat'] : 'error' ) : key($modes); $mode = isset($_GET['mode']) ? ( in_array($_GET['mode'], $modes[$category]) ? $_GET['mode'] : 'error' ) : $modes[$category][0]; // Override category if mode is error if ($mode == 'error') { $category = 'error'; $mode = key($modes[$category]); } // Add special variables switch ($category . '.' . $mode) { case 'system.index': $renderData = array_merge($renderData, [ 'uname' => [ 'osn' => php_uname('s'), 'osv' => php_uname('v'), 'host' => php_uname('n'), 'arch' => php_uname('m'), ], ]); break; } // Print page contents print Templates::render('pages/' . $mode . '.' . $category . '.tpl', $renderData);