372,10 → 372,8 |
return false; |
} |
|
function getLoggedInUser() |
{ |
if ($this->isLoggedIn()) |
{ |
function getLoggedInUser() { |
if ($this->isLoggedIn()) { |
$clist = explode('|~|', $_COOKIE['Tim32_Login']); |
return $this->getUserByUsername($clist[0]); |
} |
383,20 → 381,17 |
return false; |
} |
|
function getBlogPost($id) |
{ |
$results = $this->query('SELECT * FROM BlogPosts WHERE ID = "' . $id . '"'); |
foreach ($results as $row) { |
function getBlogPost($id) { |
foreach ($this->query("SELECT * FROM BlogPosts WHERE ID = ?", array($id)) as $row) { |
$post = new BlogPost; |
$post->ID = $row['ID']; |
if ($row['ParentID'] == -1) |
{ |
|
if ($row['ParentID'] == -1) { |
$post->parent = -1; |
} |
else |
{ |
} else { |
$post->parent = $this->getBlogPost($row['ParentID']); |
} |
|
$post->author = $this->getUserByID($row['AuthorID']); |
$post->user = $this->getUserByID($row['AuthorID']); // For some older pages |
$post->title = htmlspecialchars($row['Title']); |
411,10 → 406,8 |
$this->drawError('Cannot find blog post, #' . $id); |
} |
|
function getProject($id) |
{ |
$results = $this->query('SELECT * FROM Projects WHERE ID = "' . $id . '"'); |
foreach ($results as $row) { |
function getProject($id) { |
foreach ($this->query("SELECT * FROM Projects WHERE ID = ?", array($id)) as $row) { |
$project = new Project; |
|
$project->ID = $row['ID']; |
433,10 → 426,8 |
return false; |
} |
|
function getForumCategory($id) |
{ |
$results = $this->query('SELECT * FROM ForumCategories WHERE ID = "' . $id . '"'); |
foreach ($results as $row) { |
function getForumCategory($id) { |
foreach ($this->query("SELECT * FROM ForumCategories WHERE ID = ?", array($id)) as $row) { |
$f = new ForumCategory; |
|
$f->ID = $row['ID']; |
450,10 → 441,8 |
return false; |
} |
|
function getForumPost($id) |
{ |
$results = $this->query('SELECT * FROM ForumPosts WHERE ID = "' . $id . '"'); |
foreach ($results as $row) { |
function getForumPost($id) { |
foreach ($this->query("SELECT * FROM ForumPosts WHERE ID = ?", array($id)) as $row) { |
$f = new ForumPost; |
|
$f->ID = $row['ID']; |
471,22 → 460,17 |
return false; |
} |
|
function delBlogPost($id) |
{ |
$ids = $this->findIDs('BlogPosts', 'WHERE ParentID="' . $id . '"'); |
for ($i = 0; $i < count($ids); $i++) |
{ |
$this->delBlogPost($ids[$i]); |
function delBlogPost($id) { |
foreach ($this->findIDs("BlogPosts", "WHERE ParentID = ?", array($id)) as $i) { |
$this->delBlogPost($i); |
} |
|
$this->query('DELETE FROM BlogPosts WHERE ID="' . $id . '"'); |
|
$this->query("DELETE FROM BlogPosts WHERE ID = ?", array($id)); |
} |
|
function getGetID() |
{ |
function getGetID() { |
$id = $_GET['id']; |
if (empty($id)) |
{ |
if (empty($id)) { |
$id = 1; |
} |
|
493,11 → 477,9 |
return $id; |
} |
|
function getPostID() |
{ |
function getPostID() { |
$id = $_POST['id']; |
if (empty($id)) |
{ |
if (empty($id)) { |
$id = 1; |
} |
|