Example #1
0
function isRssRequest()
{
    // the rss sections are starting from 50 to 100
    return $_GET['cid'] && $_GET['cid'] >= 50 && $_GET['cid'] <= 100;
}
/**
 * Checks whether we should load the blog instead of loading the main page of
 * the politics map.
 * @return {Boolean} True when we should load the blog.
 */
function shouldLoadBlog()
{
    return $_GET['cid'] && $_GET['cid'] == 16 || !$_GET['cid'] && $_GET['p'] || !$_GET['cid'] && $_GET['feed'];
    // the rss feed
}
if (!isRssRequest()) {
    if (shouldLoadBlog()) {
        /**
         * Tells WordPress to load the WordPress theme and output it.
         * TODO(vivi): I don't remember why this needs to be defined here.
         * @var bool
         */
        define('WP_USE_THEMES', true);
        // Loads the WordPress Environment and Template.
        require './wp-blog-header.php';
    } else {
        // If we're not loading the blog, just load our main page. Do load the
        // wp-config so that we can use the fact that the user is logged in.
        require_once './wp-config.php';
        // Loads the Politics Map front page that displays numbers and stuff.
        require './hp-index.php';
Example #2
0
<?php

require_once dirname(__FILE__) . '/config.php';
header("Content-Type: text/html; charset=utf-8", true);
// Shorten session length to 5 minutes, and set http only true
session_set_cookie_params(300, $siteWebRoot . '/', $_SERVER['HTTP_HOST'], false, true);
session_name('SimpleGallerySession');
session_start();
if (isRssRequest()) {
    if (!(feedCacheExists() && serveCachedFeed())) {
        ob_start();
        SimpleGallery::getInstance()->renderRss();
        require_once 'templates/rss.template.php';
        if (cacheFeedContents(ob_get_clean())) {
            serveCachedFeed();
        }
    }
} else {
    if (isIndexRequest()) {
        SimpleGallery::getInstance()->renderOverview();
        require_once 'templates/index.template.php';
    } else {
        if (isGalleryRequest()) {
            SimpleGallery::getInstance()->renderGallery();
            require_once 'templates/gallery.template.php';
        } else {
            if (isset($skipLandingPage) && $skipLandingPage) {
                if ($useNiceUrls) {
                    forwardTo($siteWebRoot . '/index/');
                } else {
                    forwardTo($siteWebRoot . '/?index=');