diff --git a/boost/boost.php b/boost/boost.php index 26ef7f8..eae4e30 100644 --- a/boost/boost.php +++ b/boost/boost.php @@ -19,7 +19,7 @@ * MA 02110-1301 USA */ $proper_name = 'Stories'; -$version = '1.6.1'; +$version = '1.6.2'; $register = false; $unregister = false; $import_sql = false; diff --git a/boost/update.php b/boost/update.php index cafb385..e730094 100644 --- a/boost/update.php +++ b/boost/update.php @@ -104,6 +104,8 @@ public function run() $this->update('1.6.0'); case $this->compare('1.6.1'): $this->update('1.6.1'); + case $this->compare('1.6.2'): + $this->update('1.6.2'); } return $this->content; } @@ -351,6 +353,12 @@ private function v1_6_1() $changes[] = 'Fixed bugs with publish date.'; $this->addContent('1.6.1', $changes); } + + private function v1_6_2() + { + $changes[] = 'Fixed bug with unpublished entry.'; + $this->addContent('1.6.2', $changes); + } private function addContent($version, array $changes) { diff --git a/class/Controller/Entry/Admin.php b/class/Controller/Entry/Admin.php index 35d16ba..255da3f 100644 --- a/class/Controller/Entry/Admin.php +++ b/class/Controller/Entry/Admin.php @@ -84,7 +84,7 @@ protected function deleteCommand(Request $request) protected function viewJsonCommand(Request $request) { $entry = $this->factory->load($this->id); - return array('entry' => $this->factory->data($entry)); + return array('entry' => $entry->getStringVars(true)); } protected function viewHtmlCommand(Request $request) diff --git a/class/Factory/EntryFactory.php b/class/Factory/EntryFactory.php index ec57dd7..bf6e9c4 100644 --- a/class/Factory/EntryFactory.php +++ b/class/Factory/EntryFactory.php @@ -639,14 +639,6 @@ public function shareData(Resource $entry) ['authorEmail', 'authorId', 'content', 'deleted', 'expirationDate', 'updateDate', 'createDateRelative', 'createDate', 'published']); } - public function data(Resource $entry, $publishOnly = true) - { - if ($publishOnly && (!$entry->published && $entry->publishDate < time())) { - return null; - } - return $entry->getStringVars(true); - } - /** * Flips the deleted flag on the entry. Tags are not touched as the * entry will not be pulled. Features will be purged however. diff --git a/class/View/EntryView.php b/class/View/EntryView.php index a282d5b..ddcac1a 100644 --- a/class/View/EntryView.php +++ b/class/View/EntryView.php @@ -73,7 +73,7 @@ public function form(Resource $entry, $new = false) $tagFactory = new TagFactory(); $sourceHttp = PHPWS_SOURCE_HTTP; - $status = $new ? 'Draft' : 'Last updated ' . $entry->relativeTime($entry->updateDate); + $status = $new || empty($entry->updateDate) ? 'Draft' : 'Last updated ' . $entry->relativeTime($entry->updateDate); $entryVars = $entry->getStringVars(); $entryVars['content'] = $this->prepareFormContent($entryVars['content']); $tags = $tagFactory->listTags(true); @@ -132,7 +132,6 @@ private function includeCards(Resource $entry) \Layout::addJSHeader($this->includeTwitterCards($entry)); } - /** * Medium editor insert doesn't initialize the Twitter embed. Has to be done * manually. The editor includes a script call to widgets BUT that is stripped @@ -196,10 +195,10 @@ public function inListView($id) \Layout::addJSHeader($this->mediumCSSOverride()); $entry = $this->factory->load($id); - $data = $this->factory->data($entry, !$this->isAdmin); - if (empty($data)) { - throw new ResourceNotFound($id); + if (!$this->isAdmin && (!$entry->published && $entry->publishDate < time())) { + return null; } + $data = $entry->getStringVars(true); $this->includeCards($entry); if ($entry->listView == 1) { @@ -216,7 +215,7 @@ public function inListView($id) } else { $data['summaryAnchor'] = ''; } - + $templateFile = 'Entry/SummaryListView.html'; } // Removed the summary break tag @@ -248,10 +247,10 @@ public function view($id) try { $this->includeCss(); $entry = $this->factory->load($id); - $data = $this->factory->data($entry, !$this->isAdmin); - if (empty($data)) { - throw new ResourceNotFound; + if (!$this->isAdmin && (!$entry->published && $entry->publishDate < time())) { + return null; } + $data = $entry->getStringVars(true); $this->includeCards($entry); if (stristr($entry->content, 'twitter')) { $this->loadTwitterScript(true);