From: Ben Sherratt Date: Sat, 4 Jul 2026 11:33:52 +0000 (+0100) Subject: Admin fixes X-Git-Url: https://git.bts.cx/cx.git/commitdiff_plain/b767acc63bfe4ecd297d6961d8187532f0759d56 Admin fixes --- diff --git a/cx/lib/posts.php b/cx/lib/posts.php index d8f056d..e46aa28 100644 --- a/cx/lib/posts.php +++ b/cx/lib/posts.php @@ -237,7 +237,7 @@ 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, @@ -247,9 +247,15 @@ function cx_pages_get() { post_title, post_data FROM posts - WHERE post_is_page == TRUE - AND post_is_draft == FALSE - ORDER BY post_creation_time ASC;'; + 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); diff --git a/cx/templates/admin/main.php b/cx/templates/admin/main.php index 799db88..c0da49a 100644 --- a/cx/templates/admin/main.php +++ b/cx/templates/admin/main.php @@ -1,22 +1,34 @@

Posts

-