PGSql patch to properly detect isdraft state
authorgarvinhicking <garvinhicking>
Mon, 30 May 2005 07:53:12 +0000 (07:53 +0000)
committergarvinhicking <garvinhicking>
Mon, 30 May 2005 07:53:12 +0000 (07:53 +0000)
docs/NEWS
include/admin/entries.inc.php
include/functions_entries.inc.php

index b00b69aa9c531369ce6e0a311b0f72dd383cab06..6fb714d92eb37c06a963abf86bae1ba1d7533e1e 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,9 @@
 Version 0.9 ()
 ------------------------------------------------------------------------
 
+    * Fix editing a draft article to be properly displayed as draft
+      in PostgreSQL setups. Thanks to Penny Leach! (garvinhicking)
+
     * Localized the string "Reply" which occured inside some templates.
       (s/Reply/{$CONST.REPLY}/) (garvinhicking)
 
index bb98e4ea51551ef7935c87044af8848dd47ba9fc..0dbd19f8ba10290d3fe50969b86cb13a2d98be5b 100644 (file)
@@ -188,7 +188,7 @@ function serendipity_drawList() {
                 $entry_pre = '';
             }
 
-            if ($entry['isdraft'] == 'true') {
+            if (serendipity_db_bool($entry['isdraft'])) {
                 $entry_pre .= ' ' . DRAFT . ': ';
             }
 ?>
index de7df69a15169ae97a028460a1fb2e57474971c7..0c09c12e192e4bdc3e45eb3188ab0f418b63dc13 100644 (file)
@@ -1037,7 +1037,7 @@ function serendipity_updertEntry($entry) {
         return $res;
     }
 
-    if ($entry['isdraft'] == 'false') {
+    if (!serendipity_db_bool($entry['isdraft'])) {
         serendipity_plugin_api::hook_event('frontend_display', $entry, array('no_scramble' => true));
         serendipity_handle_references($entry['id'], $serendipity['blogTitle'], $entry['title'], $entry['body'] . $entry['extended'], $newEntry);
     }
@@ -1046,7 +1046,7 @@ function serendipity_updertEntry($entry) {
 
     // Send publish tags if either a new article has been inserted from scratch, or if the entry was previously
     // stored as draft and is now published
-    if ($entry['isdraft'] == 'false' && ($newEntry || $_entry['isdraft'] == 'true')) {
+    if (!serendipity_db_bool($entry['isdraft']) && ($newEntry || serendipity_db_bool($_entry['isdraft']))) {
         serendipity_plugin_api::hook_event('backend_publish', $entry, $newEntry);
     } else {
         serendipity_plugin_api::hook_event('backend_save', $entry, $newEntry);
@@ -1165,7 +1165,7 @@ function serendipity_printEntryForm($targetURL, $hiddens = array(), $entry = arr
 
     serendipity_plugin_api::hook_event('backend_entryform', $entry);
 
-    if ( (isset($entry['isdraft']) && $entry['isdraft'] == 'true') ||
+    if ( (isset($entry['isdraft']) && serendipity_db_bool($entry['isdraft'])) ||
          (!isset($entry['isdraft']) && $serendipity['publishDefault'] == 'draft') ) {
         $draftD = ' selected="selected"';
     } else {