/**
 * Figures out what is being accessed and calls the appropriate load function
 *
 * @return bool
 */
function zp_load_request()
{
    if ($success = zp_apply_filter('load_request', true)) {
        // filter allowed the load
        zp_load_page();
        if (isset($_GET['p'])) {
            $page = str_replace(array('/', '\\', '.'), '', sanitize($_GET['p']));
            switch ($page) {
                case 'search':
                    return zp_load_search();
                    break;
                case 'pages':
                    if (extensionEnabled('zenpage')) {
                        return load_zenpage_pages(sanitize(rtrim(@$_GET['title'], '/')));
                    }
                    break;
                case 'news':
                    if (extensionEnabled('zenpage')) {
                        return load_zenpage_news(sanitize($_GET));
                    }
                    break;
            }
        }
        //	may need image and album parameters processed
        list($album, $image) = rewrite_get_album_image('album', 'image');
        if (!empty($image)) {
            return zp_load_image($album, $image);
        } else {
            if (!empty($album)) {
                return zp_load_album($album);
            }
        }
    }
    return $success;
}
/**
 * If the titlelink is valid this will setup for the page
 * Returns true if page is setup and valid, otherwise returns false
 *
 * @param string $titlelink The page to setup
 *
 * @return bool
 */
function checkForPage($titlelink)
{
    if (!empty($titlelink)) {
        load_zenpage_pages($titlelink);
        return in_context(ZP_ZENPAGE_PAGE);
    }
    return false;
}
/**
 * If the titlelink is valid this will setup for the page
 * Returns true if page is setup and valid, otherwise returns false
 *
 * @param string $titlelink The page to setup
 *
 * @return bool
 */
function checkForPage($titlelink)
{
    global $_zp_CMS;
    if ($_zp_CMS->pages_enabled && !empty($titlelink)) {
        load_zenpage_pages($titlelink);
        return in_context(ZP_ZENPAGE_PAGE);
    }
    return false;
}