Esempio n. 1
0
function getBlogContent($path)
{
    $action = array_shift($path);
    if ($action == null) {
        $action = '1';
    }
    switch ($action) {
        case "post":
            global $title;
            $postId = array_shift($path);
            if (isValidId($postId, "posts")) {
                $title = fetchPostTitle($postId) . " (Post)" . $title;
                return getPost($postId);
            } else {
                return get404();
            }
            break;
        case "tags":
            global $currentTag;
            global $title;
            $currentTag = array_shift($path);
            if (isValidId($currentTag, "tags")) {
                $title = fetchTagName($currentTag) . " (Tag)" . $title;
                return getTag($currentTag);
            } else {
                return get404();
            }
            break;
        default:
            global $title;
            $validNumber = preg_match("/^[0-9]+\$/", $action, $matches);
            if (!$validNumber) {
                return get404();
            }
            if (getPageCount("posts") < $action) {
                return get404();
            }
            $title = "Blog" . $title;
            if ($action == 1) {
                $content = '<h1>Blog</h1><p>A small collection of thoughts and progress notes I thought the would would possibly what to know about. I try to keep my updates sparse but informative but I can\'t hold that promise.</p>';
            } else {
                $content = getPageLinks("You are viewing blog posts from a past time.<br>", $action, "/blog/", "posts");
            }
            return $content . getRecentPosts($action - 1) . getPageLinks("Page Selection<br>", $action, "/blog/", "posts");
            break;
    }
}
Esempio n. 2
0
<table cellspacing=0>
    <tr><td>Name:</td><td><input type="text" name="name"></td></tr>
    <tr><td>ID:</td><td><input type="text" name="id"></td></tr>
</table>
<br>
<input type="submit" value="Create">
</form>
<?php 
    } else {
        if ($second_resource === "edit") {
            ?>
<a href="/admin/tags">&lt;&lt;&lt; Back to Tag Management</a><br><br>
<form action="/admin/edittag" method="post">
<table cellspacing=0>
    <tr><td>Name:</td><td><input type="text" name="name" value="<?php 
            echo fetchTagName($third_resource);
            ?>
"></td></tr>
    <tr><td>ID:</td><td><input type="text" name="id" value="<?php 
            echo $third_resource;
            ?>
"></td></tr>
</table>
<br>
<input type="hidden" name="orig_id" value="<?php 
            echo $third_resource;
            ?>
">
<input type="submit" value="Modify">
</form>
<?php