function includeHeaderAndFooter() { global $_PATH, $_htmlHead; $contents = ob_get_clean(); // for some reason, without the absolute path, // the footer file can't be found // our cwd gets changed to the apache include $_PATH->get('Header', 'absolute'); echo $contents; include $_PATH->get('Footer', 'absolute'); } ob_start(); function autoloadFromClassDir($className) { // can implement something like fileExists here, // to look for alternative extensions. // but for now, just find className.php $search = __DIR__ . '/classes/' . $className . '.php'; if (is_file($search)) { include $search; } else { echo 'object ' . $className . ' not found<br>'; } } spl_autoload_register('autoloadFromClassDir'); session_start(); require 'Pathfinder.class.php'; $_PATH = new Pathfinder($_SESSION['Pathfinder']); $_htmlHead = array(); require $_PATH->get('Custom Functions'); require $_PATH->get('More Functions');
<?php session_start(); // set the root for initial file locations $_root = '..'; // load file locations require $_root . '/Code/pathfinder.class.php'; $_PATH = new Pathfinder(); // load configs require $_PATH->get('Parse'); $_CONFIG = Parse::fromConfig($_PATH->get('Config'), true); // load custom functions require $_PATH->get('Custom Functions'); require 'loginFunctions.php'; // declaring admin for first login if (!isset($_SESSION['admin'])) { $_SESSION['admin'] = array(); } $admin =& $_SESSION['admin']; // scanning for available tools require 'toolsFunctions.php'; $tools = getTools(); // return array of tools if (isset($_POST['tool'])) { // if they are asking for a tool if (isset($tools[$_POST['tool']])) { // if the tool being asked for exists $admin['tool'] = $_POST['tool']; // save tool selection $admin['heading'] = $_POST['tool']; }