Пример #1
0
<?php

$gb_handle_request = true;
require 'gitblog/gitblog.php';
class smisk
{
    public static $stable_version = '1.1.6';
    public static $main_repo_url = 'git://github.com/rsms/smisk.git';
    public static $pgp_key = '431B61D0';
}
# this overrides some or all values if smisk::
GBPage::find('config')->body();
# / defaults to about page
if ($gb_request_uri === '') {
    gb::$is_page = true;
    gb::$is_posts = false;
    $gb_request_uri = 'about';
    $post = GBPage::find('about');
}
function selected($startswith)
{
    global $gb_request_uri;
    if (strpos($gb_request_uri, $startswith) === 0) {
        return 'class="selected"';
    }
    return '';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
Пример #2
0
        } else {
            # page
            if ($preview_pathspec !== null) {
                $post = GBPage::findByName($preview_pathspec, $version);
            } else {
                $post = GBPage::find(urldecode($gb_request_uri), $version);
            }
            if ($post === false) {
                gb::$is_404 = true;
            } else {
                gb::$title[] = $post->title;
            }
            gb::$is_page = true;
        }
        # post 404?
        if (isset($post) && $post && gb::$is_preview === false && ($post->draft === true || $post->published->time > time())) {
            gb::$is_404 = true;
        }
    } else {
        # posts
        $postspage = GBPost::pageByPageno(isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 0);
        gb::$is_posts = true;
        gb::$is_404 = $postspage === false;
    }
    # unset temporary variables (not polluting global namespace)
    unset($preview_pathspec);
    unset($strptime);
    unset($version);
    gb::event('will-handle-request');
    # from here on, the caller will have to do the rest
}