Posts = $DB->query_fetchDB(" SELECT p.id, p.post_title, p.post_content, p.post_author, u.user_login, p.post_date, p.post_modified, p.post_url, p.post_comment_status, p.post_comments, p.post_views FROM ot_posts AS p INNER JOIN ot_users AS u WHERE p.post_status = 'gepubliceerd' AND p.post_type = 'post' AND u.id = p.post_author ORDER BY p.post_date DESC LIMIT " . CONF_POSTS_PAGE . " "); if($this->Posts) { return TRUE; } else { return FALSE; } } function post() { if(isset($_GET['post'])) { global $DB; if(is_numeric($_GET['post'])) { $this->Posts = $DB->query_fetchDB(" SELECT p.id, p.post_title, p.post_content, p.post_author, u.user_login, p.post_date, p.post_modified, p.post_url, p.post_comment_status, p.post_comments, p.post_views FROM ot_posts AS p INNER JOIN ot_users AS u WHERE p.id = '" . $_GET['post'] . "' AND p.post_status = 'gepubliceerd' AND p.post_type = 'post' AND u.id = p.post_author LIMIT 1 "); } elseif(isset($_GET['year']) && isset($_GET['month'])) { $this->Posts = $DB->query_fetchDB(" SELECT p.id, p.post_title, p.post_content, p.post_author, u.user_login, p.post_date, p.post_modified, p.post_url, p.post_comment_status, p.post_comments, p.post_views FROM ot_posts AS p INNER JOIN ot_users AS u WHERE p.post_url = '" . addslashes($_GET['post']) . "' AND YEAR(p.post_date) = '" . addslashes($_GET['year']) . "' AND MONTH(p.post_date) = '" . addslashes($_GET['month']) . "' AND p.post_status = 'gepubliceerd' AND p.post_type = 'post' AND u.id = p.post_author LIMIT 1 "); } else { return FALSE; } if($this->Posts) { $this->PostsCount++; $DB->query_execDB(" UPDATE ot_posts SET post_views = post_views + 1 WHERE id = '" . $this->Posts[$this->PostsCount]['id'] . "' "); $this->Posts[$this->PostsCount]['post_views']++; return TRUE; } else { return FALSE; } } else { if(CONF_POSTS_PAGE > $this->PostsCount + 1) { $this->PostsCount++; if(isset($this->Posts[$this->PostsCount])) { return TRUE; } else { return FALSE; } } else { return FALSE; } } } // Load page function page($Page) { global $DB; if(is_numeric($Page)) { if($Page != 0) { $this->Page = $DB->query_fetchDB(" SELECT p.id, p.post_title, p.post_content, p.post_author, u.user_login, p.post_date, p.post_modified, p.post_url, p.post_comment_status, p.post_comments, p.post_views FROM ot_posts AS p INNER JOIN ot_users AS u WHERE p.id = '" . $Page . "' AND p.post_status = 'gepubliceerd' AND p.post_type = 'page' AND u.id = p.post_author LIMIT 1 "); } else { return FALSE; } } else { $this->Page = $DB->query_fetchDB(" SELECT p.id, p.post_title, p.post_content, p.post_author, u.user_login, p.post_date, p.post_modified, p.post_url, p.post_comment_status, p.post_comments, p.post_views FROM ot_posts AS p INNER JOIN ot_users AS u WHERE p.post_url = '" . addslashes($Page) . "' AND p.post_status = 'gepubliceerd' AND p.post_type = 'page' AND u.id = p.post_author LIMIT 1 "); } if($this->Page) { $DB->query_execDB(" UPDATE ot_posts SET post_views = post_views + 1 WHERE id = '" . $this->Page['0']['id'] . "' "); $this->Page['0']['post_views']++; return TRUE; } else { return FALSE; } } // Load comments function comments($Post) { if(isset($Post)) { global $DB; $this->Comments = $DB->query_fetchDB(" SELECT id, comment_author_name, comment_author_url, comment_content, comment_date FROM ot_comments WHERE comment_post = '" . $Post . "' AND comment_status = 'yes' "); if($this->Comments) { return TRUE; } else { return FALSE; } } else { return FALSE; } } function comment() { $this->CommentsCount++; if(isset($this->Comments[$this->CommentsCount])) { return TRUE; } else { return FALSE; } } // Load category function category() { if(isset($_GET['category'])) { global $DB; if(isset($_GET['page'])) { if(is_numeric($_GET['page']) && ($_GET['page'] != 0)) { $Start = (($_GET['page'] - 1) * CONF_POSTS_PAGE); } else { $Start = 0; } } else { $Start = 0; } if(is_numeric($_GET['category'])) { $this->Category = $DB->query_fetchDB(" SELECT id, category_name, category_url FROM ot_categories WHERE id = '" . $_GET['category'] . "' AND category_status = 'yes' LIMIT 1 "); $this->Posts = $DB->query_fetchDB(" SELECT p.id, p.post_title, p.post_content, p.post_author, u.user_login, p.post_date, p.post_modified, p.post_url, p.post_comment_status, p.post_comments, p.post_views FROM ot_posts AS p INNER JOIN ot_post2category AS c INNER JOIN ot_users AS u WHERE c.category_id = '" . $_GET['category'] . "' AND p.id = c.post_id AND p.post_status = 'gepubliceerd' AND p.post_type = 'post' AND u.id = p.post_author ORDER BY p.post_date DESC LIMIT " . $Start . ", " . (CONF_POSTS_PAGE + 1) . " "); } else { $this->Category = $DB->query_fetchDB(" SELECT id, category_name, category_url FROM ot_categories WHERE category_url = '" . addslashes($_GET['category']) . "' AND category_status = 'yes' LIMIT 1 "); if($this->Category) { $this->Posts = $DB->query_fetchDB(" SELECT p.id, p.post_title, p.post_content, p.post_author, u.user_login, p.post_date, p.post_modified, p.post_url, p.post_comment_status, p.post_comments, p.post_views FROM ot_posts AS p INNER JOIN ot_post2category AS c INNER JOIN ot_users AS u WHERE c.category_id = '" . $this->Category['0']['id'] . "' AND p.id = c.post_id AND p.post_status = 'gepubliceerd' AND p.post_type = 'post' AND u.id = p.post_author ORDER BY p.post_date DESC LIMIT " . $Start . ", " . (CONF_POSTS_PAGE + 1) . " "); } else { return FALSE; } } if($this->Category && $this->Posts) { return TRUE; } else { return FALSE; } } else { return FALSE; } } } ?>