<?php //include our blog functions require_once("../lib/blog/blog.lib.php"); //make our command list $request=explode('/',substr($_SERVER['PATH_INFO'], 1)); //bodge - fix this array_shift($request); //if we have something which might be a username start a blogs instance if ($request[0] != "" and $request[0] != "list"){ $blogsingle = new blogs(array_shift($request)); } //otherwise, or if there was no such user, start a bloglist instance if (!isset($blogsingle) || !isset($blogsingle->id)) { $bloglist = new bloglist(); $request = array("list"); } $blog = isset($bloglist) ? $bloglist : $blogsingle; if (isset($blog->userName)) { if ($session->username==$blog->userName) $smarty->assign("subselect", _("My Blog")); else $smarty->assign("subselect", $blog->userName._("'s Blog")); } ob_start(); $smarty->assign("title", $blog->title); $smarty->assign("extra_scripts", array("<script type=\"text/javascript\" src=\"$baseurl/js/xmlhttp.js\"></script>")); //check we have a valid username before offering a RSS feed if($blog->userName) { $smarty->assign("rss_url", "http://{$_SERVER['HTTP_HOST']}{$blog->httpPath}feed/rss/{$blog->userName}".(($request[0]=="category") ? "/category/".(int)$request[1]:"")); $smarty->assign("atom_url", "http://{$_SERVER['HTTP_HOST']}{$blog->httpPath}feed/atom/{$blog->userName}".(($request[0]=="category") ? "/category/".(int)$request[1]:"")); // echo " <link rel=\"alternate\" type=\"application/rss+xml\" title=\"{$blog->title}\" href=\"$rss_url\"/>\n"; // echo " <link rel=\"alternate\" type=\"application/atom+xml\" title=\"{$blog->title}\" href=\"$atom_url\"/>\n"; } ob_start(); $blog->menu(); // if there was an error, print it here if (isset($blogsingle) && !isset($blogsingle->id)) { error_exc($blogsingle); } //run the appropriate command switch (array_shift($request)) { case "entry": $blog->printEntryAndComments(array_shift($request)); break; case "category": $blog->printEntries(0,15,'and category = '.(int)array_shift($request)); break; case "postcomment": $blog->newComment((int)array_shift($request)) ; break; case "Archive": $blog->printArchive($request); if ($session->username == $blog->userName) $smarty->assign("subselect", _("My Archive")); else $smarty->assign("subselect", $blog->userName._("'s Archive")); break; case "list": $blog->listBlogs(); break; default: $blog->printEntries(); } ?> <div id="bottompanel"> <p><? echo _("Validate"); ?> : <a href="http://validator.w3.org/check?uri=referer">XHTML</a> / <a href="http://jigsaw.w3.org/css-validator/check/referer/">CSS</a> / <? if($blog->userName) { echo "<a href=\"http://feedvalidator.org/check.cgi?url=$rss_url\">RSS</a> / <a href=\"http://feedvalidator.org/check.cgi?url=$atom_url\">ATOM</a>"; } else { echo "RSS / ATOM"; } ?> </p> </div> <?php $page = ob_get_contents(); ob_end_clean(); $smarty->assign("body", $page); $smarty->assign("extra_styles", "/css/blog.css"); //display debuing info as required if($_SESSION[debug]){ echo "<div class=\"debug\"><h2>"._("Debug Info")."</h2><pre>\n"; echo "**"._("Session")."**\n"; print_r($_SESSION); echo "**"._("Request")."**\n"; print_r($_REQUEST); echo "**"._("Class")."**\n"; print_r($blog); echo "</pre></div>"; } ?>