X-Git-Url: https://git.bts.cx/cx.git/blobdiff_plain/523265c78f8f637ad002c997d22990a532bb9f08..b767acc63bfe4ecd297d6961d8187532f0759d56:/cx/lib/posts.php diff --git a/cx/lib/posts.php b/cx/lib/posts.php index f056c88..e46aa28 100644 --- a/cx/lib/posts.php +++ b/cx/lib/posts.php @@ -135,6 +135,7 @@ function cx_posts_get(int $limit = 0, int $offset = 0, bool $include_drafts = fa post_id, post_slug, post_date, + post_is_page, post_is_draft, post_title, post_data @@ -188,6 +189,7 @@ function cx_posts_find_post($post_id) { post_id, post_slug, post_date, + post_is_page, post_is_draft, post_title, post_data @@ -235,18 +237,25 @@ function cx_posts_find_page_id($post_slug) { return null; } -function cx_pages_get() { +function cx_pages_get(bool $include_drafts = false) { $sql = 'SELECT post_id, post_slug, post_date, + post_is_page, post_is_draft, post_title, post_data FROM posts - WHERE post_is_page == TRUE - AND post_is_draft == FALSE - ORDER BY post_creation_time DESC;'; + WHERE post_is_page == TRUE'; + + if ($include_drafts == false) { + $sql .= ' AND post_is_draft == FALSE'; + } + + $sql .= ' ORDER BY post_date ASC'; + + $sql .= ';'; foreach (cx_db_query($sql) as $post) { $p = new Post($post);