/blog/index.php |
---|
4,8 → 4,8 |
$page = new Taios_Page('Blog Posts', '../'); |
$page->drawHeader(); |
write('<h3>Blog</h3>'); |
$page->drawMenuItem('Computing', 'index.php?cat=Computing'); |
$page->drawBlogCategoriesMenu(); |
$page->drawMiddle(); |
if ($page->isUserGM($page->getLoggedInUser())) |
14,7 → 14,14 |
write('<br />'); |
} |
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1'); |
$query = 'WHERE ParentID = -1'; |
if (isset($_GET['cat'])) |
{ |
$query = $query , ' AND Category = "' . $_GET['cat'] . '"'; |
} |
$ids = $page->findIDs('BlogPosts', $query); |
for ($i = 0; $i < count($ids); $i++) |
{ |
$id = $ids[$i]; |
/blog/post-add.php |
---|
6,13 → 6,12 |
if (isset($_POST['title']) && isset($_POST['content']) && isset($_POST['catagory']) && isset($_POST['parentID'])) |
{ |
$page->query('insert into BlogPosts VALUES(0, ' . $_POST['parentID'] . ', "' . $page->getLoggedInUser. '", "' . $_POST['title'] . '", "' . $_POST['content'] . '", NOW(), "' . $_POST['catagory'] . '", 0)'); |
$page->redirect("index.php"); |
$page->query('insert into BlogPosts VALUES(0, ' . $_POST['parentID'] . ', "' . $page->getLoggedInUser()->ID . '", "' . $_POST['title'] . '", "' . $_POST['content'] . '", NOW(), "' . $_POST['catagory'] . '", 0)'); |
$page->redirect('index.php'); |
} |
$page->drawHeader(); |
write('<h3>Blog</h3>'); |
$page->drawMenuItem('Computing', 'index.php?cat=Computing'); |
$page->drawBlogCategoriesMenu(); |
$page->drawMiddle(); |
if ($page->isUserGM($page->getLoggedInUser())) |
/blog/post.php |
---|
8,8 → 8,7 |
$page->redirect("index.php"); |
$page->drawHeader(); |
write('<h3>Blog</h3>'); |
$page->drawMenuItem('Computing', 'index.php?cat=Computing'); |
$page->drawBlogCategoriesMenu(); |
$page->drawMiddle(); |
if ($page->isUserGM($page->getLoggedInUser())) |
23,3 → 22,4 |
$page->drawFooter(); |
?> |
/_taios.php |
---|
126,8 → 126,28 |
$this->drawBlogPostTree($ids[$i]); |
write('</div>'); |
} |
} |
function drawBlogCategoriesMenu() |
{ |
$cats = array(); |
$ids = $this->findIDs('BlogPosts', 'WHERE ParentID = -1'); |
for ($i = 0; $i < count($ids); $i++) |
{ |
$cat = $this->getBlogPost($ids[$i])->category; |
if (!in_array($cat, $cats)) |
{ |
array_push($cats, $cat); |
} |
} |
write('<h3>Categories</h3>'); |
for ($i = 0; $i < count($cats); $i++) |
{ |
$this->drawMenuItem($cats[$i], $this->url . 'blog/index.php?cat=' . $cats[$i]); |
} |
} |
function redirect($url) |
{ |
/styles.css |
---|
111,6 → 111,6 |
} |
.indent { |
margin-left: 10px; |
margin-left: 14px; |
border-left: 1px solid #BBBBBB; |
} |