function find_selected_page() { global $current_page; global $current_subject; if (isset($_GET["subject"])) { $current_subject = find_subject_by_id($_GET["subject"]); $current_page = find_default_page($current_subject["id"]); } elseif (isset($_GET["page"])) { $current_subject = null; $current_page = find_pages_by_id($_GET["page"]); } else { $current_page = null; $current_subject = null; } }
<?php require_once "../../includes/sessions.php"; require_once "../../includes/db_connect.php"; require_once "../../includes/functions.php"; include "../../includes/layouts/public_page_header.php"; find_default_page(); ?> <div id="main"> <div id="navigation"> <br /> <a href="/cms/index.php">« Home</a> <br /> <?php echo public_navigation($current_subject, $current_page); ?> </div> <div id="page"> <?php if ($current_page && $current_page["visible"] == 1) { $str_page_name = htmlentities(ucwords($current_page["page_name"])); $str_page_content = htmlentities($current_page["content"]); echo "<h2 style=\"text-align:center;\">" . $str_page_name . "</h2>"; echo "<table align=\"center\" width=90%> <tr> <td> <span style=\"text-align:center; color:#4CCCFF;\">" . nl2br($str_page_content) . "</span> </td> </tr> </table>"; } else { echo "<h2 style=\"text-align:center;\">Welcome!!!</h2>"; echo "<br />"; echo "<img style=\"display: block; margin-left: auto; margin-right: auto;\" src='/cms/images/welcome.jpg' height= 80%/>"; } ?>