]> git.bts.cx Git - cx.git/blobdiff - cx/lib/posts.php
Admin fixes
[cx.git] / cx / lib / posts.php
index d8f056d970d74c73af96978283630d6124db4890..e46aa28cd6816f79a5827f5c7fe17a6f8fecd198 100644 (file)
@@ -237,7 +237,7 @@ function cx_posts_find_page_id($post_slug) {
        return null;
 }
 
        return null;
 }
 
-function cx_pages_get() {
+function cx_pages_get(bool $include_drafts = false) {
        $sql = 'SELECT
                post_id,
                post_slug,
        $sql = 'SELECT
                post_id,
                post_slug,
@@ -247,9 +247,15 @@ function cx_pages_get() {
                post_title,
                post_data
                FROM posts
                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);
 
        foreach (cx_db_query($sql) as $post) {
                $p = new Post($post);