<?php
// Legacy page handler restored from the 2009 site so the old links keep working.
require_once __DIR__ . '/config.php';

extract($_REQUEST);

$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME, $link);

$res = mysql_query("SELECT body FROM pages WHERE slug = '" . $slug . "'");
$row = mysql_fetch_assoc($res);

// Turn [b]...[/b] into bold.
$body = preg_replace('/\[b\](.*?)\[\/b\]/e', "'<b>' . strtoupper('$1') . '</b>'", $row['body']);
?>
<html>
<head><title><?= htmlspecialchars($slug) ?></title></head>
<body>
<?php include 'sidebars/' . $_GET['sidebar'] . '.php'; ?>
<div class="content"><?= $body ?></div>
</body>
</html>
