From ff9c6ec057f3ff04b82afec4825d181af691cda0 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 7 Jul 2009 23:49:43 +0000 Subject: [PATCH 02/25] BUGFIX: Improvement permission checking of postblog and BlogEntryForm --- code/BlogHolder.php | 20 +++++++++--- tests/BlogHolderFunctionalTest.php | 49 ++++++++++++++++++++++++++++++ tests/BlogHolderFunctionalTest.yml | 20 ++++++++++++ 3 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 tests/BlogHolderFunctionalTest.php create mode 100644 tests/BlogHolderFunctionalTest.yml diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 2bdc475..ec71169 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -166,6 +166,16 @@ class BlogHolder extends Page { } class BlogHolder_Controller extends Page_Controller { + + static $allowed_actions = array( + 'postblog' => 'BLOGMANAGEMENT', + 'post' => 'BLOGMANAGEMENT', + 'BlogEntryForm' => 'BLOGMANAGEMENT', + 'rss', + 'tag', + 'showarchive', + ); + function init() { parent::init(); @@ -258,9 +268,7 @@ class BlogHolder_Controller extends Page_Controller { * Post a new blog entry */ function post(){ - if(!Permission::check('ADMIN')){ - Security::permissionFailure($this, _t('BlogHolder.HAVENTPERM', 'Posting blogs is an administrator task. Please log in.')); - } + if(!Permission::check('BLOGMANAGEMENT')) return Security::permissionFailure(); $page = $this->customise(array( 'Content' => false, @@ -283,6 +291,8 @@ class BlogHolder_Controller extends Page_Controller { * A simple form for creating blog entries */ function BlogEntryForm() { + if(!Permission::check('BLOGMANAGEMENT')) return Security::permissionFailure(); + Requirements::javascript('jsparty/behaviour.js'); Requirements::javascript('jsparty/prototype.js'); Requirements::javascript('jsparty/scriptaculous/effects.js'); @@ -342,10 +352,12 @@ class BlogHolder_Controller extends Page_Controller { } function postblog($data, $form) { + if(!Permission::check('BLOGMANAGEMENT')) return Security::permissionFailure(); + Cookie::set("BlogHolder_Name", $data['Author']); $blogentry = false; - if($data['ID']) { + if(isset($data['ID']) && $data['ID']) { $blogentry = DataObject::get_by_id("BlogEntry", $data['ID']); } diff --git a/tests/BlogHolderFunctionalTest.php b/tests/BlogHolderFunctionalTest.php new file mode 100644 index 0000000..566cf00 --- /dev/null +++ b/tests/BlogHolderFunctionalTest.php @@ -0,0 +1,49 @@ +objFromFixture('BlogHolder', 'blogholder'); + $blogHolder->publish('Stage', 'LIve'); + $blogEntry = $this->objFromFixture('BlogEntry', 'entry1'); + $blogEntry->publish('Stage', 'LIve'); + } + + function testFrontendBlogPostRequiresPermission() { + // get valid SecurityID (from comments form, would usually be copy/pasted) + $blogEntry = $this->objFromFixture('BlogEntry', 'entry1'); + $response = $this->get($blogEntry->URLSegment); + $securityID = Session::get('SecurityID'); + + // without login + $data = array( + 'Title'=>'Disallowed', + 'Author'=>'Disallowed', + 'Content'=>'Disallowed', + 'action_postblog' => 'Post blog entry', + 'SecurityID' => $securityID + ); + $response = $this->post('blog/BlogEntryForm', $data); + $this->assertFalse(DataObject::get_one('BlogEntry', sprintf("Title = 'Disallowed'"))); + + // with login + $blogEditor = $this->objFromFixture('Member', 'blog_editor'); + $blogEditor->logIn(); + $data = array( + 'Title'=>'Allowed', + 'Author'=>'Allowed', + 'Content'=>'Allowed', + 'action_postblog' => 'Post blog entry', + 'SecurityID' => $securityID + ); + $response = $this->post('blog/BlogEntryForm', $data); + $this->assertType('BlogEntry', DataObject::get_one('BlogEntry', sprintf("Title = 'Allowed'"))); + } +} \ No newline at end of file diff --git a/tests/BlogHolderFunctionalTest.yml b/tests/BlogHolderFunctionalTest.yml new file mode 100644 index 0000000..561c1ba --- /dev/null +++ b/tests/BlogHolderFunctionalTest.yml @@ -0,0 +1,20 @@ +Permission: + blog_management: + Code: BLOGMANAGEMENT +Group: + blog_editors: + Code: blog-editors + Permissions: =>Permission.blog_management +Member: + blog_editor: + Email: blogeditor@test.com + Groups: =>Group.blog_editors +BlogHolder: + blogholder: + Title: Blog Holder + URLSegment: blog +BlogEntry: + entry1: + Title: Blog Entry + ProvideComments: 1 + Parent: =>BlogHolder.blogholder \ No newline at end of file From 26ad18d3854eeac45d0768197b544169f4b7339c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 8 Jul 2009 01:25:13 +0000 Subject: [PATCH 03/25] MINOR Merged from trunk --- tests/BlogHolderFunctionalTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/BlogHolderFunctionalTest.php b/tests/BlogHolderFunctionalTest.php index 566cf00..4137d27 100644 --- a/tests/BlogHolderFunctionalTest.php +++ b/tests/BlogHolderFunctionalTest.php @@ -11,9 +11,9 @@ class BlogHolderFunctionalTest extends FunctionalTest { parent::setUp(); $blogHolder = $this->objFromFixture('BlogHolder', 'blogholder'); - $blogHolder->publish('Stage', 'LIve'); + $blogHolder->publish('Stage', 'Live'); $blogEntry = $this->objFromFixture('BlogEntry', 'entry1'); - $blogEntry->publish('Stage', 'LIve'); + $blogEntry->publish('Stage', 'Live'); } function testFrontendBlogPostRequiresPermission() { From bcaea3eafb7ac0421715409a2473e12b4f49dd57 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 22 Dec 2009 21:07:44 +0000 Subject: [PATCH 06/25] BUGFIX Limiting BlogHolder->LandingPageFreshness to requests without a controller action only. Controller actions are not regarded as the "landing page", as they cause other views like 'tags' or 'rss', which shouldn't be filtered (from r96200) --- code/BlogTree.php | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 94e85de..7f55cc5 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -147,9 +147,10 @@ class BlogTree extends Page { * @param string tag Only get blog entries with this tag * @param string date Only get blog entries on this date - either a year, or a year-month eg '2008' or '2008-02' * @param callback retrieveCallback A function to call with pagetype, filter and limit for custom blog sorting or filtering + * @param string $where * @return DataObjectSet */ - public function Entries($limit = '', $tag = '', $date = '', $retrieveCallback = null) { + public function Entries($limit = '', $tag = '', $date = '', $retrieveCallback = null, $filter = '') { $tagCheck = ''; $dateCheck = ''; @@ -161,7 +162,7 @@ class BlogTree extends Page { $tagCheck = "AND `BlogEntry`.Tags LIKE '%$SQL_tag%'"; } } - + if ($date) { if(strpos($date, '-')) { $year = (int) substr($date, 0, strpos($date, '-')); @@ -185,14 +186,7 @@ class BlogTree extends Page { } } } - elseif ($this->LandingPageFreshness) { - if(defined('DB::USE_ANSI_SQL')) { - $dateCheck = "AND \"BlogEntry\".\"Date\" > NOW() - INTERVAL " . $this->LandingPageFreshness; - } else { - $dateCheck = "AND `BlogEntry`.Date > NOW() - INTERVAL " . $this->LandingPageFreshness; - } - } - + // Build a list of all IDs for BlogHolders that are children of us $holderIDs = $this->BlogHolderIDs(); @@ -200,10 +194,11 @@ class BlogTree extends Page { if (empty($holderIDs)) return false; // Otherwise, do the actual query + if($filter) $filter .= ' AND '; if(defined('DB::USE_ANSI_SQL')) { - $where = '"ParentID" IN (' . implode(',', $holderIDs) . ") $tagCheck $dateCheck"; + $filter .= '"ParentID" IN (' . implode(',', $holderIDs) . ") $tagCheck $dateCheck"; } else { - $where = 'ParentID IN (' . implode(',', $holderIDs) . ") $tagCheck $dateCheck"; + $filter .= '`ParentID` IN (' . implode(',', $holderIDs) . ") $tagCheck $dateCheck"; } if(defined('DB::USE_ANSI_SQL')) { @@ -213,8 +208,8 @@ class BlogTree extends Page { } // By specifying a callback, you can alter the SQL, or sort on something other than date. - if ($retrieveCallback) return call_user_func($retrieveCallback, 'BlogEntry', $where, $limit, $order); - else return DataObject::get('BlogEntry', $where, $order, '', $limit); + if ($retrieveCallback) return call_user_func($retrieveCallback, 'BlogEntry', $filter, $limit, $order); + else return DataObject::get('BlogEntry', $filter, $order, '', $limit); } } @@ -255,9 +250,20 @@ class BlogTree_Controller extends Page_Controller { function BlogEntries($limit = null) { if ($limit === null) $limit = BlogTree::$default_entries_limit; - + + // only use freshness if no action is present (might be displaying tags or rss) + if ($this->LandingPageFreshness && !$this->request->param('Action')) { + if(defined('DB::USE_ANSI_SQL')) { + $filter = "\"BlogEntry\".\"Date\" > NOW() - INTERVAL " . $this->LandingPageFreshness; + } else { + $filter = "`BlogEntry`.Date > NOW() - INTERVAL " . $this->LandingPageFreshness; + } + } else { + $filter = ''; + } + $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; - return $this->Entries("$start,$limit", BlogURL::tag(), BlogURL::date()); + return $this->Entries("$start,$limit", BlogURL::tag(), BlogURL::date(), null, $filter); } function IncludeBlogRSS() { @@ -323,3 +329,4 @@ class BlogTree_Controller extends Page_Controller { return parent::defaultAction($action); } } +?> \ No newline at end of file From c1f20717d1ba465faad68601b04df7acc492ba95 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Thu, 11 Mar 2010 01:28:37 +0000 Subject: [PATCH 08/25] BUGFIX: returns null when there's no blog IDs --- code/ArchiveWidget.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index 0746d11..d614db0 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -48,6 +48,8 @@ class ArchiveWidget extends Widget { $container = BlogTree::current(); $ids = $container->BlogHolderIDs(); + if(empty($ids)) return $results; + $stage = Versioned::current_stage(); $suffix = (!$stage || $stage == 'Stage') ? "" : "_$stage"; From 91bc0bc772231963b4495fed3dd050bdf1b00a23 Mon Sep 17 00:00:00 2001 From: Carlos Barberis Date: Fri, 19 Mar 2010 00:40:23 +0000 Subject: [PATCH 09/25] Changed module maintainer contact details --- README | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README b/README index 4e582d7..d0f98b3 100644 --- a/README +++ b/README @@ -3,8 +3,11 @@ Blog Module #################################################### # Maintainer Contact -Andrew O'Neil (Nickname: aoneil) - +Carlos Barberis (Nickname: carlos) + + +Phalkunz (Nickname: carlos) + # Requirements SilverStripe minimum version 2.3.0 From c925304eca30d4e19a9e871a4f7dfe0286b91d89 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Wed, 16 Jun 2010 22:40:02 +0000 Subject: [PATCH 11/25] BUGFIX: resolve locale issue when posting blog entry from the front-end --- code/BlogHolder.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index c458b0a..7de5558 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -273,8 +273,13 @@ class BlogHolder_Controller extends BlogTree_Controller { } $form->saveInto($blogentry); + $blogentry->ParentID = $this->ID; $blogentry->Content = $form->datafieldByName('BlogPost')->dataValue(); + + if(Object::hasExtension('Translatable')) { + $blogentry->Locale = $this->Locale; + } $blogentry->Status = "Published"; $blogentry->writeToStage("Stage"); From 965b81c0a31ce3f2691f41627bf0fdfeb99fde7e Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Fri, 20 Aug 2010 02:37:35 +0000 Subject: [PATCH 12/25] FEATURE: allow disabling of the built in RSS link generated to allow feedburner links etc to be used otherwise. MINOR: removed commented out code --- code/BlogTree.php | 45 ++++++++++----------------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 7f55cc5..571190d 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -13,6 +13,13 @@ class BlogTree extends Page { // Default number of blog entries to show static $default_entries_limit = 10; + /** + * @var bool Include an automatic link to the rss feed for + * the browser. Disabling this will allow you to include your + * own feedburner link + */ + static $include_rss_link = true; + static $db = array( 'Name' => 'Varchar', 'InheritSideBar' => 'Boolean', @@ -243,7 +250,9 @@ class BlogTree_Controller extends Page_Controller { function init() { parent::init(); - $this->IncludeBlogRSS(); + if(BlogTree::$include_rss_link) { + $this->IncludeBlogRSS(); + } Requirements::themedCSS("blog"); } @@ -271,40 +280,6 @@ class BlogTree_Controller extends Page_Controller { RSSFeed::linkToFeed($this->Link() . "rss", _t('BlogHolder.RSSFEED',"RSS feed of these blogs")); } - /* - * @todo: It doesn't look like these are used. Remove if no-one complains - Hamish - - /** - * Gets the archived blogs for a particular month or year, in the format /year/month/ eg: /2008/10/ - * / - function showarchive() { - $month = addslashes($this->urlParams['ID']); - return array( - "Children" => DataObject::get('SiteTree', "ParentID = $this->ID AND DATE_FORMAT(`BlogEntry`.`Date`, '%Y-%M') = '$month'"), - ); - } - - function ArchiveMonths() { - $months = DB::query("SELECT DISTINCT DATE_FORMAT(`BlogEntry`.`Date`, '%M') AS `Month`, DATE_FORMAT(`BlogEntry`.`Date`, '%Y') AS `Year` FROM `BlogEntry` ORDER BY `BlogEntry`.`Date` DESC"); - $output = new DataObjectSet(); - foreach($months as $month) { - $month['Link'] = $this->Link() . "showarchive/$month[Year]-$month[Month]"; - $output->push(new ArrayData($month)); - } - - return $output; - } - - function tag() { - if (Director::urlParam('Action') == 'tag') { - return array( - 'Tag' => Convert::raw2xml(Director::urlParam('ID')) - ); - } - return array(); - } - */ - /** * Get the rss feed for this blog holder's entries */ From 475a190112eeeb88ebda194668995885cedb883f Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 1 Sep 2010 20:52:19 +0000 Subject: [PATCH 13/25] BUGFIX: Fixed front end post entry form validation and its test (merged from r108801) --- code/BlogHolder.php | 2 +- tests/BlogHolderFunctionalTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 7de5558..09ed4cd 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -238,7 +238,7 @@ class BlogHolder_Controller extends BlogTree_Controller { $submitAction = new FormAction('postblog', _t('BlogHolder.POST', 'Post blog entry')); $actions = new FieldSet($submitAction); - $validator = new RequiredFields('Title','Content'); + $validator = new RequiredFields('Title','BlogPost'); $form = new Form($this, 'BlogEntryForm',$fields, $actions,$validator); diff --git a/tests/BlogHolderFunctionalTest.php b/tests/BlogHolderFunctionalTest.php index e229e0e..2367074 100644 --- a/tests/BlogHolderFunctionalTest.php +++ b/tests/BlogHolderFunctionalTest.php @@ -26,7 +26,7 @@ class BlogHolderFunctionalTest extends FunctionalTest { $data = array( 'Title'=>'Disallowed', 'Author'=>'Disallowed', - 'Content'=>'Disallowed', + 'BlogPost'=>'Disallowed', 'action_postblog' => 'Post blog entry', 'SecurityID' => $securityID ); @@ -40,7 +40,7 @@ class BlogHolderFunctionalTest extends FunctionalTest { $data = array( 'Title'=>'Allowed', 'Author'=>'Allowed', - 'Content'=>'Allowed', + 'BlogPost'=>'Allowed', 'action_postblog' => 'Post blog entry', 'SecurityID' => $securityID ); From a809722ddd9b4b3c9a0bca77d11fcc4f06b9217e Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Sun, 5 Sep 2010 23:35:54 +0000 Subject: [PATCH 14/25] MINOR: disable one of test cases in BlogHolderFunctionalTest temporarily since it doesn't work and we didn't change anything about it in our customized branch --- tests/BlogHolderFunctionalTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/BlogHolderFunctionalTest.php b/tests/BlogHolderFunctionalTest.php index 2367074..51fc19b 100644 --- a/tests/BlogHolderFunctionalTest.php +++ b/tests/BlogHolderFunctionalTest.php @@ -46,6 +46,6 @@ class BlogHolderFunctionalTest extends FunctionalTest { ); $response = $this->post('blog/BlogEntryForm', $data); - $this->assertType('BlogEntry', DataObject::get_one('BlogEntry', sprintf("\"Title\" = 'Allowed'"))); + //$this->assertType('BlogEntry', DataObject::get_one('BlogEntry', sprintf("\"Title\" = 'Allowed'"))); } } From 3b5fe68774fd26225d6cf4cb761a8b2557ed9ea3 Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Mon, 6 Sep 2010 04:22:50 +0000 Subject: [PATCH 15/25] MINOR: roll-back r110449 (disable one of test cases in BlogHolderFunctionalTest temporarily since it doesn't work and we didn't change anything about it in our customized branch) --- tests/BlogHolderFunctionalTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/BlogHolderFunctionalTest.php b/tests/BlogHolderFunctionalTest.php index 51fc19b..2367074 100644 --- a/tests/BlogHolderFunctionalTest.php +++ b/tests/BlogHolderFunctionalTest.php @@ -46,6 +46,6 @@ class BlogHolderFunctionalTest extends FunctionalTest { ); $response = $this->post('blog/BlogEntryForm', $data); - //$this->assertType('BlogEntry', DataObject::get_one('BlogEntry', sprintf("\"Title\" = 'Allowed'"))); + $this->assertType('BlogEntry', DataObject::get_one('BlogEntry', sprintf("\"Title\" = 'Allowed'"))); } } From 0b8e5d46fc55586b7f18bde7d00633a7693283ae Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Mon, 6 Sep 2010 06:24:05 +0000 Subject: [PATCH 16/25] BUGFIX: the unit test for BlogHolderFunctionalTest fail when a customized project has its own themes and the BlogHolder template has no blog entry form or the page has no PageComments section. So it needs to set the unit test session not use themes. --- tests/BlogHolderFunctionalTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/BlogHolderFunctionalTest.php b/tests/BlogHolderFunctionalTest.php index 2367074..e3da958 100644 --- a/tests/BlogHolderFunctionalTest.php +++ b/tests/BlogHolderFunctionalTest.php @@ -6,9 +6,12 @@ class BlogHolderFunctionalTest extends FunctionalTest { static $fixture_file = 'blog/tests/BlogHolderFunctionalTest.yml'; + static $origlThemes; function setUp() { parent::setUp(); + self::$origlThemes = SSViewer::current_theme(); + SSViewer::set_theme(null); $blogHolder = $this->objFromFixture('BlogHolder', 'blogholder'); $blogHolder->publish('Stage', 'Live'); @@ -16,6 +19,11 @@ class BlogHolderFunctionalTest extends FunctionalTest { $blogEntry->publish('Stage', 'Live'); } + function tearDown(){ + SSViewer::set_theme(self::$origlThemes); + parent::tearDown(); + } + function testFrontendBlogPostRequiresPermission() { // get valid SecurityID (from comments form, would usually be copy/pasted) $blogEntry = $this->objFromFixture('BlogEntry', 'entry1'); From a6734d3609cc9b785167560c71ff35695dc1b4ba Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Sun, 3 Oct 2010 21:40:01 +0000 Subject: [PATCH 17/25] BUGFIX Fixed XSS vulnerability in BlogTree? when filtering by tags --- code/BlogTree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 571190d..ab42af3 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -222,7 +222,7 @@ class BlogTree extends Page { class BlogURL { static function tag() { - if (Director::urlParam('Action') == 'tag') return Director::urlParam('ID'); + if (Director::urlParam('Action') == 'tag') return Convert::raw2xml(Director::urlParam('ID')); return ''; } From 4971fb473093e0ae27162ac267e829851161ac2d Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Sun, 3 Oct 2010 21:44:57 +0000 Subject: [PATCH 18/25] BUGFIX Fixed XSS vulnerability in BlogTree? when filtering by tags --- code/BlogTree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 135c43f..3f62ded 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -297,7 +297,7 @@ class BlogTree_Controller extends Page_Controller { * @return String */ function SelectedTag() { - return ($this->request->latestParam('Action') == 'tag') ? $this->request->latestParam('ID') : ''; + return ($this->request->latestParam('Action') == 'tag') ? Convert::raw2xml($this->request->latestParam('ID')) : ''; } /** From 658ca91eeb79d6ee98d1b7756c062d61ed048531 Mon Sep 17 00:00:00 2001 From: Carlos Barberis Date: Tue, 11 Jan 2011 22:12:18 +0000 Subject: [PATCH 19/25] MINOR: show in menus is true by default --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 5aace46..2c4a822 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -31,7 +31,7 @@ class BlogEntry extends Page { static $defaults = array( "ProvideComments" => true, - 'ShowInMenus' => false + 'ShowInMenus' => true ); static $extensions = array( From 938828cc3d5e4fb31202ebcb06aef4db2fe36a05 Mon Sep 17 00:00:00 2001 From: Carlos Barberis Date: Tue, 11 Jan 2011 22:19:33 +0000 Subject: [PATCH 20/25] MINOR: reverted show in menus true by default --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 2c4a822..5aace46 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -31,7 +31,7 @@ class BlogEntry extends Page { static $defaults = array( "ProvideComments" => true, - 'ShowInMenus' => true + 'ShowInMenus' => false ); static $extensions = array( From 6613739d92bce2113019409f3fa48a8714ad376c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 29 Mar 2013 10:00:09 +0100 Subject: [PATCH 21/25] Added composer.json --- composer.json | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..ae144b1 --- /dev/null +++ b/composer.json @@ -0,0 +1,21 @@ +{ + "name": "silverstripe/blog", + "description": "The blog module allows you to post blogs on your SilverStripe. It includes the ability to post blogs using a site front-end form. Blogs are summarised on the blog holder page type, with more detail viewable when a specific blog is clicked.", + "type": "silverstripe-module", + "keywords": ["silverstripe", "blog"], + "authors": [ + { + "name": "Saophalkun Ponlu", + "email": "phalkunz@silverstripe.com" + }, + { + "name": "Carlos Barberis", + "email": "carlos@silverstripe.com" + } + ], + + "require": + { + "silverstripe/cms": "~2.4" + } +} \ No newline at end of file From b24ebe2e66934ae3bdbe51e24f76c7b22ed13800 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 29 Mar 2013 10:00:57 +0100 Subject: [PATCH 22/25] Travis support --- .travis.yml | 17 +++++++++++++++++ README.md | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5724f12 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +# See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details + +language: php +php: + - 5.3 + +env: + - DB=MYSQL CORE_RELEASE=2.4 + - DB=PGSQL CORE_RELEASE=2.4 + +before_script: + - git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support + - php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss + - cd ~/builds/ss + +script: + - phpunit blog/tests/ \ No newline at end of file diff --git a/README.md b/README.md index 1d5e528..857edbb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Blog Module +[![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-blog.png?branch=0.5)](http://travis-ci.org/silverstripe/silverstripe-blog) + ## Introduction The blog module allows you to post blogs on your SilverStripe. It includes the ability to post blogs using a site front-end form. Blogs are summarised on the blog holder page type, with more detail viewable when a specific blog is clicked. From a15bc7a75df35b922e41b24571f4472bd4fb32dc Mon Sep 17 00:00:00 2001 From: madmatt Date: Mon, 29 Apr 2013 20:22:01 +1200 Subject: [PATCH 23/25] Fix PUT-221 - BlogEntryForm needs an explicit call to Requirements::javascript() when Requirements::set_suffix_requirements(true) is called. --- code/BlogHolder.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index b1862a0..4d69cf9 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -235,6 +235,8 @@ class BlogHolder_Controller extends BlogTree_Controller { if(BlogEntry::$allow_wysiwyg_editing) { $contentfield = new HtmlEditorField("BlogPost", _t("BlogEntry.CN")); + // Force tinymce to init - otherwise Requirements::set_suffix_requirements() stops the init() call + Requirements::customScript("tinyMCE.init(ssTinyMceConfig);", "blog_post_tinyMCE_config"); } else { $contentfield = new CompositeField( new LiteralField("BBCodeHelper",""._t("BlogEntry.BBH")."
" ), From eb7f7488f199ba4b17cf793a81b7bc6352bd2e55 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 17 Jul 2013 09:20:03 +0200 Subject: [PATCH 24/25] Check for if(class_exists('Widget')) in TagCloudWidget --- code/widgets/TagCloudWidget.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/code/widgets/TagCloudWidget.php b/code/widgets/TagCloudWidget.php index f52435e..3e27446 100644 --- a/code/widgets/TagCloudWidget.php +++ b/code/widgets/TagCloudWidget.php @@ -1,5 +1,5 @@ "Varchar", @@ -145,6 +145,4 @@ class TagCloudWidget extends Widget { return true; } } - - -?> +} From ad060cabf4e70e5f7e6638c47b3bdd3c4a93edb7 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Fri, 21 Feb 2014 16:52:13 +1300 Subject: [PATCH 25/25] BUG Fixes LandingPageFreshness parsing issue. fixes #13 --- code/BlogTree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 758d828..ca682fc 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -238,7 +238,7 @@ class BlogTree_Controller extends Page_Controller { // only use freshness if no action is present (might be displaying tags or rss) if ($this->LandingPageFreshness && !$this->request->param('Action')) { $d = new Zend_Date(SS_Datetime::now()->getValue()); - $d->sub($this->LandingPageFreshness); + $d->sub(intval($this->LandingPageFreshness), Zend_Date::MONTH); $date = $d->toString('YYYY-MM-dd'); $filter = "\"BlogEntry\".\"Date\" > '$date'";