file = substr($blogentry->file, strlen(POSTS_ROOT), -4); if (!(($posts = apcu_fetch('posts')) && isset($posts[$blogentry->file]) && $blogentry=$posts[$blogentry->file])) { //echo "[DBG] Regenerate meta info block..."; if (!isset($blogentry->file)) $blogentry->file = ""; if (!isset($blogentry->title)) $blogentry->title = "Untitled"; if (!isset($blogentry->description)) $blogentry->description = $blogentry->title; if (!isset($blogentry->author)) $blogentry->author = "Anonymous"; if (!isset($blogentry->status)) $blogentry->status = "private"; if (!isset($blogentry->ctime)) $blogentry->ctime = time(); if (!isset($blogentry->tags)) $blogentry->tags = "untagged"; $blogentry->tags = explode(',', $blogentry->tags); sort($blogentry->tags); $blogentry->permalink = getServerUrl() . "/?p=blog&b=" . str_replace("/", POSTS_DIR_SEP, $blogentry->file); $blogentry->isVisible = ($blogentry->ctime <= time()) && (($blogentry->status == "released") || ($blogentry->status == "unlisted")); $blogentry->isPublic = ($blogentry->status == "released") && $blogentry->isVisible; } $renderIt = $CMS_INDEXING || $blogentry->isVisible; if ($renderIt && !isset($CMS_RSS)) { if (isset($postUrl) && !$CMS_INDEXING) { // Set meta information $pageTitle = $blogentry->title; $htmlHead .= ' tags) . '"> '; } echo ""; //echo '

permalink\">$blogentry->title

' . date("l, F jS Y, H:i", $blogentry->ctime) . "
"; echo '' . $blogentry->author . ' | ctime) . '" class="date">'; if (isset($blogentry->utime)) { echo "Updated " . date("l, F jS Y, H:i", $blogentry->utime); } else { echo date("l, F jS Y, H:i", $blogentry->ctime); } echo ""; } return $renderIt; } function renderFooter() { global $CMS_SINGLE_POST; global $counters; global $meta; $i = 1; $renderExt = isset($CMS_SINGLE_POST) && $CMS_SINGLE_POST; if ($renderExt && $counters['sources'] > 1) { echo '

Sources:
'; foreach ($meta['sources'] as $v) { echo '    [' . $i++ . ']: ' . $v . '
'; } echo '


'; } global $blogentry; echo '

Tags: '; foreach ($blogentry->tags as $v) { echo '' . $v . ' '; } echo "

"; } function extended() { global $CMS_SINGLE_POST; global $blogentry; $renderExt = isset($CMS_SINGLE_POST) && $CMS_SINGLE_POST; if ($renderExt) { echo ''; } else { echo '

→ Click here to continue reading ←

'; } return $renderExt; } function password($pw) { global $userPassword; if ("$userPassword" == "$pw") { echo ''; return true; } else { echo "

"; if ($userPassword == "") echo "This section is protected. To view it, enter the correct password."; else echo "The password you entered is incorrect! Please try again."; ?>

$object){ ob_start(); // These ob_lines will prevent output of actual HTML (the function already does this?!) require "$file"; $blogentry->includeFile = $file; //echo "
"; ob_end_clean(); // Enable output, drop cached //array_push($posts, $blogentry); $posts[$blogentry->file] = $blogentry; } # Create list of columns relevant for sorting $sort = array(); foreach($posts as $k=>$v) { $sort['ctime'][$k] = $v->ctime;; // $sort['author'][$k] = $v->author; } // Now sort the entries // Multiple keys: array_multisort($sort['author'], SORT_ASC, $sort['title'], SORT_ASC,$posts); array_multisort($sort['ctime'], SORT_DESC, $posts); } // Store to cache apcu_store('posts', $posts, CACHE_POSTS_TTL); $CMS_INDEXING = false; } if (isset($CMS_SITEMAP)) { foreach($posts as $k=>$v) { if ($v->isPublic) { echo "\n\t" . htmlspecialchars($v->permalink) . "\n\n"; } } return; } if (!isset($CMS_RSS)) echo ""; if (isset($postUrl)) { // Display post $CMS_SINGLE_POST = true; echo '
'; // Header is rendered in renderPost() require $postUrl; // This will render the body if ($blogentry->isVisible) { // Render the blog footer //echo "

Written by $blogentry->author

"; renderFooter(); } else { echo("

Private Post

"); echo("

This post has not yet been made public by the publisher. Please check back again later. Thank you.

"); } echo '
'; } else { //echo "

Blog posts

"; if (isset($tagSearch)) { echo "

"; if (RSS_ENABLED) { echo ''; } echo '
Archive for '$tagSearch'

'; $pageTitle = "Archive for '$tagSearch'"; } if (isset($CMS_RSS) && RSS_SHOW_FULL) { $CMS_SINGLE_POST = true; } $i = 0; $morePosts = 0; $firstRendered = 0; foreach($posts as $k=>$v) { if ($v->isPublic) { if (!isset($tagSearch) || in_array($tagSearch, $v->tags)) { if ($i++ >= $postsSkip) { if ($morePosts == 0) { if (isset($CMS_RSS)) { if (!isset($latestDisplayedPost)) { $latestDisplayedPost = $v->ctime; } echo ' ' . $v->title . ' includeFile; renderFooter(); echo ']]> permalink . ']]> permalink . ']]> ' . date(RSS_DATE_FORMAT, $v->ctime) . ' ' . $v->author . ' '; } else { if ($firstRendered) { echo '
'; } $firstRendered = 1; echo '
'; require $v->includeFile; renderFooter(); echo "
"; } } if (($i % POSTS_PAGE_SIZE) == 0) { $morePosts = 1; } else { if ($morePosts == 1) { $morePosts = 2; break; } else { $morePosts = 0; } } } } } } if (!isset($CMS_RSS)) { if ($morePosts == 2 || $postsSkip > 0) echo "

"; if ($morePosts == 2) echo ''; if ($postsSkip > 0) echo ''; if ($morePosts == 2|| $postsSkip > 0) echo "
<< Older postsNewer posts >>

"; } } if (!isset($CMS_RSS)) echo "
"; ?>