function setupDemoIfNeeded()
{
    global $SETTINGS, $TABLE_PREFIX;
    // skip if not in demo mode
    if (!inDemoMode()) {
        return;
    }
    // error checking
    if (!isInstalled()) {
        die("You must install the software before you can use demoMode!");
    }
    // reset demo if needed
    if (@$_REQUEST['resetDemo']) {
        unset($_SESSION['demoCreatedTimeAsFloat']);
    }
    // change tableprefix for active demos
    $isActiveDemo = @$_SESSION['demoCreatedTimeAsFloat'] && $_SESSION['demoCreatedTimeAsFloat'] >= time() - MAX_DEMO_TIME;
    if ($isActiveDemo) {
        if (preg_match("/[^\\d\\.]/", $_SESSION['demoCreatedTimeAsFloat'])) {
            die("Invalid demo value in session!");
        }
        $TABLE_PREFIX = $SETTINGS['mysql']['tablePrefix'];
        $TABLE_PREFIX .= '(demo' . $_SESSION['demoCreatedTimeAsFloat'] . ')_';
        $TABLE_PREFIX = str_replace('.', '-', $TABLE_PREFIX);
        // . isn't allowed in tablenames
    } else {
        echo t("Creating demo (please wait a moment)...") . "<br/>\n";
        _removeOldDemos();
        $demoNum = _createNewDemo();
        $_SESSION['demoCreatedTimeAsFloat'] = $demoNum;
        $refreshUrl = @$_REQUEST['resetDemo'] ? '?' : thisPageUrl();
        printf(t("Done, <a href='%s'>click here to continue</a> or wait a moment while we redirect you."), $refreshUrl);
        print "<br/>\n<meta http-equiv='refresh' content='1;{$refreshUrl}' />";
        //
        showBuildInfo();
        exit;
    }
}
function showFooter()
{
    global $APP, $SETTINGS, $CURRENT_USER, $TABLE_PREFIX;
    if (applyFilters('ui_footer', TRUE)) {
        //
        include "lib/menus/footer.php";
    }
    // display license and build info
    # NOTE: Disabling or modifying licensing or registration code violates your license agreement and is willful copyright infringement.
    # NOTE: Copyright infringement can be very expensive: http://en.wikipedia.org/wiki/Statutory_damages_for_copyright_infringement
    # NOTE: Please do not steal our software.
    showBuildInfo();
}