From 1dadbb8bf2f6c5d74fbbfb83ae2646823cebcd9c Mon Sep 17 00:00:00 2001 From: Olaf Gleba Date: Tue, 11 Oct 2011 00:25:52 +0200 Subject: [PATCH] Setting pages draft to other field type (NULL) --- welcompose/admin/content/pages_edit.php | 2 +- welcompose/admin/content/pages_select.php | 3 ++- welcompose/core/content_classes/page.class.php | 18 +++++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/welcompose/admin/content/pages_edit.php b/welcompose/admin/content/pages_edit.php index 7c70b208..2445bf24 100644 --- a/welcompose/admin/content/pages_edit.php +++ b/welcompose/admin/content/pages_edit.php @@ -364,7 +364,7 @@ $sqlData['template_set'] = $FORM->exportValue('template_set'); $sqlData['index_page'] = $FORM->exportValue('index_page'); $sqlData['protect'] = $FORM->exportValue('protect'); - $sqlData['draft'] = (string)intval($FORM->exportValue('draft')); + $sqlData['draft'] = $FORM->exportValue('draft'); $sqlData['exclude'] = $FORM->exportValue('exclude'); $sqlData['no_follow'] = $FORM->exportValue('no_follow'); $sqlData['sitemap_changefreq'] = $FORM->exportValue('sitemap_changefreq'); diff --git a/welcompose/admin/content/pages_select.php b/welcompose/admin/content/pages_select.php index 0a582061..b0c0c3fb 100644 --- a/welcompose/admin/content/pages_select.php +++ b/welcompose/admin/content/pages_select.php @@ -134,7 +134,8 @@ foreach ($navigations as $_navigation) { $select_params = array( 'navigation' => (int)$_navigation['id'], - 'draft' => 1 + 'draft' => 1, + 'exclude' => 1 ); $page_arrays[$_navigation['id']] = $PAGE->selectPages($select_params); } diff --git a/welcompose/core/content_classes/page.class.php b/welcompose/core/content_classes/page.class.php index 3fccc2ee..04ae3f04 100644 --- a/welcompose/core/content_classes/page.class.php +++ b/welcompose/core/content_classes/page.class.php @@ -290,8 +290,8 @@ public function selectPage ($id) *
  • type, int, optional: Page type id
  • *
  • start, int, optional: row offset
  • *
  • limit, int, optional: amount of rows to return
  • - *
  • exclude, int, optional: if set exclude page from navigation
  • - *
  • draft, int, optional: if set include pages with param draft
  • + *
  • exclude, int, optional: if set exclude page from navigation (only internal use)
  • + *
  • draft, int, optional: if set include pages with param draft (only internal use)
  • *
  • protect, int, optional: if set exclude protected pages
  • * * @@ -437,14 +437,14 @@ public function selectPages ($params = array()) if (!empty($protect) && is_numeric($protect)) { $sql .= " AND `content_pages`.`protect` IS NULL "; } - // Include only visible pages - if (!empty($exclude) && is_numeric($exclude)) { + + // On default (var not set) include only visible pages + if (is_null($exclude)) { $sql .= " AND `content_pages`.`exclude` IS NULL "; - } - - // Include only result rows without drafts - if (is_null($draft) ) { - $sql .= " AND `content_pages`.`draft` = '0' "; + } + // On default (var not set) include only result rows without drafts + if (is_null($draft)) { + $sql .= " AND `content_pages`.`draft` IS NULL "; } // add sorting