Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 120 → Rev 130

/blog/post.php
4,6 → 4,11
 
$page = new Taios_Page('Blog Posts', '../');
 
if (empty($_GET['id']))
{
$page->redirect('index.php');
}
 
$page->drawHeader();
$page->drawBlogCategoriesMenu();
$page->drawMiddle();
/blog/index.php
33,7 → 33,6
write('<br />');
}
 
 
$page->drawFooter();
 
?>
/blog/add-post.php
1,5 → 1,17
<?php
 
function getParentID()
{
if (isset($_GET['id']))
{
return $_GET['id'];
}
else
{
return -1;
}
}
 
require '../_taios.php';
 
$page = new Taios_Page('Blog Posts', '../');
6,42 → 18,44
 
$error = '';
 
$title = $_POST['title'];
$content = $_POST['content'];
$parentID = $_POST['parentID'];
$category = $_POST['category'];
if (isset($_POST['post']))
{
$title = $_POST['title'];
$content = $_POST['content'];
$parentID = $_POST['parentID'];
$category = $_POST['category'];
 
if (empty($title))
{
$error = "No Title Specified";
if (empty($title))
{
$error = "No Title Specified";
}
else if (empty($content))
{
$error = "No Content Specified";
}
else if (empty($parentID))
{
$error = "No Parent ID Specified";
}
else
{
$page->query('INSERT INTO BlogPosts VALUES(0, ' . $parentID . ', "' . $page->getLoggedInUser()->ID . '", "' . $title . '", "' . $content . '", NOW(), "' . $category . '", 0)');
$page->redirect('index.php');
}
}
else if (empty($content))
{
$error = "No Content Specified";
}
else if (empty($parentID))
{
$error = "No Parent ID Specified";
}
else
{
$page->query('INSERT INTO BlogPosts VALUES(0, ' . $parentID . ', "' . $page->getLoggedInUser()->ID . '", "' . $title . '", "' . $content . '", NOW(), "' . $category . '", 0)');
$page->redirect('index.php');
}
 
$page->drawHeader();
$page->drawBlogCategoriesMenu();
$page->drawMiddle();
 
if ($page->isUserGM($page->getLoggedInUser()))
if (!empty($error))
{
write('<p class="bold"><a href="add-post.php">Add Post</a></p>');
write('<br />');
$page->drawError($error, false);
}
 
?>
 
<form action="post-add.php" method="post">
<form action="add-post.php" method="post">
<table>
<tr>
<td class="bold">Title: </td>
49,7 → 63,7
</tr>
<tr>
<td class="bold">Content: </td>
<td><input type="text" name="content" /></td>
<td><textarea name="content" style="width: 500px; height: 300px;"></textarea></td>
</tr>
<tr>
<td class="bold">Catagory: </td>
56,8 → 70,10
<td><input type="text" name="category" /></td>
</tr>
 
<input type="hidden" name="post" value="yes" />
 
<?php
write('<input type="hidden" name="parentID" value="' . $_GET['id'] . '"/>');
write('<input type="hidden" name="parentID" value="' . getParentID() . '" />');
?>
 
<tr>