From bbd2815316a37c5e51afe891ab2d80f6f07021eb Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Thu, 6 Sep 2007 22:33:58 +0000 Subject: [PATCH 001/250] Move blog to open source path --- _config.php | 8 + code/ArchiveWidget.php | 78 +++++++++ code/BlogEntry.php | 132 +++++++++++++++ code/BlogHolder.php | 231 +++++++++++++++++++++++++++ code/BlogManagementWidget.php | 56 +++++++ code/RSSWidget.php | 44 +++++ code/TagCloudWidget.php | 150 +++++++++++++++++ code/import/TypoImport.php | 152 ++++++++++++++++++ css/archivewidget.css | 9 ++ css/bbcodehelp.css | 32 ++++ css/blog.css | 11 ++ css/flickrwidget.css | 3 + css/tagcloud.css | 6 + images/blogholder-file.gif | Bin 0 -> 297 bytes images/blogpage-file.gif | Bin 0 -> 189 bytes javascript/bbcodehelp.js | 12 ++ templates/ArchiveWidget.ss | 21 +++ templates/BlogManagementWidget.ss | 5 + templates/Includes/BlogPagination.ss | 21 +++ templates/Includes/BlogSideBar.ss | 3 + templates/Includes/BlogSummary.ss | 14 ++ templates/Layout/BlogEntry.ss | 23 +++ templates/Layout/BlogHolder.ss | 23 +++ templates/Layout/BlogHolder_post.ss | 12 ++ templates/RSSWidget.ss | 7 + templates/TagCloudWidget.ss | 5 + 26 files changed, 1058 insertions(+) create mode 100644 _config.php create mode 100644 code/ArchiveWidget.php create mode 100644 code/BlogEntry.php create mode 100644 code/BlogHolder.php create mode 100644 code/BlogManagementWidget.php create mode 100644 code/RSSWidget.php create mode 100644 code/TagCloudWidget.php create mode 100644 code/import/TypoImport.php create mode 100644 css/archivewidget.css create mode 100644 css/bbcodehelp.css create mode 100644 css/blog.css create mode 100644 css/flickrwidget.css create mode 100644 css/tagcloud.css create mode 100644 images/blogholder-file.gif create mode 100644 images/blogpage-file.gif create mode 100644 javascript/bbcodehelp.js create mode 100644 templates/ArchiveWidget.ss create mode 100644 templates/BlogManagementWidget.ss create mode 100644 templates/Includes/BlogPagination.ss create mode 100644 templates/Includes/BlogSideBar.ss create mode 100644 templates/Includes/BlogSummary.ss create mode 100644 templates/Layout/BlogEntry.ss create mode 100644 templates/Layout/BlogHolder.ss create mode 100644 templates/Layout/BlogHolder_post.ss create mode 100644 templates/RSSWidget.ss create mode 100644 templates/TagCloudWidget.ss diff --git a/_config.php b/_config.php new file mode 100644 index 0000000..f2abe24 --- /dev/null +++ b/_config.php @@ -0,0 +1,8 @@ + diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php new file mode 100644 index 0000000..bcee029 --- /dev/null +++ b/code/ArchiveWidget.php @@ -0,0 +1,78 @@ + "Varchar" + ); + + static $defaults = array( + "DisplayMode" => "month" + ); + + static $title = "Archive"; + static $cmsTitle = "Blog Archive"; + static $description = "Show a list of months or years in which there are blog posts, and provide links to them."; + + function getBlogHolder() { + $page = Director::currentPage(); + + if($page->is_a("BlogHolder")) { + return $page; + } else if($page->is_a("BlogEntry") && $page->getParent()->is_a("BlogHolder")) { + return $page->getParent(); + } else { + return DataObject::get_one("BlogHolder"); + } + } + + function getCMSFields() { + return new FieldSet( + new OptionsetField("DisplayMode","Display by",array("month"=>"month","year"=>"year")) + ); + } + + function Dates() { + Requirements::css("blog/css/archivewidget.css"); + $results = new DataObjectSet(); + $blogHolder = $this->getBlogHolder(); + $id = $blogHolder->ID; + + if($this->DisplayMode == "month"){ + $sqlResults = DB::query("SELECT DISTINCT MONTH(`Date`) AS `Month`, YEAR(`Date`) AS `Year` FROM `SiteTree` NATURAL JOIN `BlogEntry` WHERE `ParentID` = $id ORDER BY `Date` DESC"); + }else{ + $sqlResults = DB::query("SELECT DISTINCT YEAR(`Date`) AS `Year` FROM `SiteTree` NATURAL JOIN `BlogEntry` WHERE `ParentID` = $id ORDER BY `Date` DESC"); + } + + + + foreach($sqlResults as $sqlResult) { + $date = new Date("Date"); + + + + $month = ($this->DisplayMode == "month") ? (int)$sqlResult['Month'] : 1; + + $date->setValue(array( + "Day" => 1, + "Month" => $month, + "Year" => (int)$sqlResult['Year'] + )); + + if($this->DisplayMode == "month"){ + $link = $blogHolder->Link() . $sqlResult['Year']. '/' . sprintf("%'02d", $sqlResult['Month']); + } + else{ + $link = $blogHolder->Link() . $sqlResult['Year']; + } + + $results->push(new ArrayData(array( + "Date" => $date, + "Link" => $link + ))); + } + + return $results; + } +} + +?> \ No newline at end of file diff --git a/code/BlogEntry.php b/code/BlogEntry.php new file mode 100644 index 0000000..35449cf --- /dev/null +++ b/code/BlogEntry.php @@ -0,0 +1,132 @@ + "Datetime", + "Author" => "Text", + "Tags" => "Text" + ); + + static $casting = array( + "Date" => "Date" + ); + + static $defaults = array( + "ProvideComments" => true + ); + + static $allowed_children = "none"; + + /** + * overload so that the default date is today. + */ + public function populateDefaults(){ + parent::populateDefaults(); + $this->Date = date("d/m/Y H:i:s",time()); + } + + /** + * Ensures the most recent article edited on the same day is shown first. + */ + public function setDate($val){ + $datepart = date("Y-m-d",strtotime($val)); + $minutepart = date("H:i:s",time()); + $date = $datepart . " " . $minutepart; + return $this->setField("Date",$date); + } + + function getCMSFields() { + Requirements::javascript('blog/javascript/bbcodehelp.js'); + Requirements::css('blog/css/bbcodehelp.css'); + $firstName = Member::CurrentMember() ? Member::currentMember()->FirstName : ''; + $codeparser = new BBCodeParser(); + + $fields = parent::getCMSFields(); + $fields->removeFieldFromTab("Root.Content.Main","Content"); + $fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", "Content", 20)); + $fields->addFieldToTab("Root.Content.Main", new CalendarDateField("Date", "Date"),"Content"); + $fields->addFieldToTab("Root.Content.Main", new TextField("Author", "Author", $firstName),"Content"); + + $fields->addFieldToTab("Root.Content.Main", new LiteralField("BBCodeHelper", "
" . + "BBCode help" . + "
")); + + $fields->addFieldToTab("Root.Content.Main", new TextField("Tags", "Tags (comma sep.)"),"Content"); + return $fields; + } + + function Tags() { + $theseTags = split(" *, *", trim($this->Tags)); + + $output = new DataObjectSet(); + foreach($theseTags as $tag) { + $output->push(new ArrayData(array( + "Tag" => $tag, + "Link" => $this->getParent()->Link() . '?tag=' . urlencode($tag) + ))); + } + if($this->Tags){ + return $output; + } + } + + + function SideBar() { + return $this->getParent()->SideBar(); + } + + function ParagraphSummary(){ + $content = new Text('Content'); + $content->value = Convert::raw2xml($this->Content); + $parser = new BBCodeParser($content->FirstParagraph()); + return $parser->parse(); + } + + function ParsedContent() { + $parser = new BBCodeParser($this->Content); + $content = new Text('Content'); + $content->value =$parser->parse(); + return $content; + } + + function EditURL(){ + return $this->getParent()->Link('post')."/".$this->ID."/"; + } + +} + +class BlogEntry_Controller extends Page_Controller { + function init() { + parent::init(); + Requirements::themedCSS("blog"); + } + + function unpublishPost(){ + if(!Permission::check('ADMIN')){ + Security::permissionFailure($this, + "Unpublishing blogs is an administrator task. Please log in."); + } + else{ + $SQL_id = Convert::raw2sql($this->ID); + + $page = DataObject::get_by_id("SiteTree", $SQL_id); + $page->deleteFromStage('Live'); + $page->flushCache(); + + $page = DataObject::get_by_id("SiteTree", $SQL_id); + $page->Status = "Unpublished"; + + Director::redirect($this->getParent()->Link()); + } + } + +} + +?> \ No newline at end of file diff --git a/code/BlogHolder.php b/code/BlogHolder.php new file mode 100644 index 0000000..c8f94db --- /dev/null +++ b/code/BlogHolder.php @@ -0,0 +1,231 @@ + "WidgetArea" + ); + + static $allowed_children = array( + 'BlogEntry' + ); + + function getCMSFields() { + $fields = parent::getCMSFields(); + $fields->removeFieldFromTab("Root.Content.Main","Content"); + $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("SideBar")); + + return $fields; + } + + public function BlogEntries($limit = 10) { + $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; + $tagCheck = ''; + $dateCheck = ""; + + if(isset($_GET['tag'])) { + $tag = addslashes($_GET['tag']); + $tag = str_replace(array("\\",'_','%',"'"), array("\\\\","\\_","\\%","\\'"), $tag); + $tagCheck = "AND `BlogEntry`.Tags LIKE '%$tag%'"; + } + + + if(Director::urlParams()){ + + $year = Director::urlParam('Action'); + $month = Director::urlParam('ID'); + + if(is_numeric($month) && is_numeric($month)){ + $dateCheck = "AND Date BETWEEN '$year-$month-1' AND '$year-$month-31'"; + } + else if(isset($year)){ + $dateCheck = "AND Date BETWEEN '$year-1-1' AND '$year-12-31'"; + } + } + + return DataObject::get("Page","`ParentID` = $this->ID AND ShowInMenus = 1 $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$start, $limit"); + } + + function Tag() { + return isset($_GET['tag']) ? $_GET['tag'] : false; + } + + function BlogEntryForm(){ + Requirements::javascript('jsparty/behaviour.js'); + Requirements::javascript('jsparty/prototype.js'); + Requirements::javascript('jsparty/scriptaculous/effects.js'); + Requirements::javascript('cms/javascript/PageCommentInterface.js'); + Requirements::javascript('blog/javascript/bbcodehelp.js'); + + $id = 0; + if(Director::urlParam('ID')){ + $id = Director::urlParam('ID'); + } + + $codeparser = new BBCodeParser(); + $membername = Member::currentMember() ? Member::currentMember()->getName() : ""; + + $fields = new FieldSet( + new HiddenField("ParentID", "ParentID", $this->ID), + new HiddenField("ID","ID"), + new HiddenField("Date","Date"), + new TextField("Title","Subject"), + new TextField("Author","Author",$membername), + new CompositeField( + new LiteralField("BBCodeHelper","BBCode help
" ), + new TextareaField("Content", "Content",20), + new LiteralField("BBCodeTags","") + ), + new TextField("Tags","Tags"), + new LiteralField("Tagsnote"," ") + ); + + $submitAction = new FormAction('postblog', 'Post blog entry'); + $actions = new FieldSet($submitAction); + $validator = new RequiredFields('Title','Content'); + + $form = new BlogEntry_Form($this, 'BlogEntryForm',$fields, $actions,$validator); + + if($id != 0){ + $form->loadNonBlankDataFrom(DataObject::get_by_id('BlogEntry',$id)); + }else{ + $form->loadNonBlankDataFrom(array("Author" => Cookie::get("BlogHolder_Name"))); + } + + return $form; + } + + function isPost(){ + return Director::urlParam('Action') == 'post'; + } + + function postURL(){ + return $this->Link('post'); + } + + function requireDefaultRecords() { + parent::requireDefaultRecords(); + + if(!DataObject::get_one('BlogHolder')) { + $blogholder = new BlogHolder(); + $blogholder->Title = "Blog"; + $blogholder->URLSegment = "blog"; + $blogholder->Status = "Published"; + + $widgetarea = new WidgetArea(); + $widgetarea->write(); + + $blogholder->SideBarID = $widgetarea->ID; + $blogholder->write(); + $blogholder->publish("Stage", "Live"); + + $managementwidget = new BlogManagementWidget(); + $managementwidget->ParentID = $widgetarea->ID; + $managementwidget->write(); + + $tagcloudwidget = new TagCloudWidget(); + $tagcloudwidget->ParentID = $widgetarea->ID; + $tagcloudwidget->write(); + + $archivewidget = new ArchiveWidget(); + $archivewidget->ParentID = $widgetarea->ID; + $archivewidget->write(); + + $widgetarea->write(); + + $blog = new BlogEntry(); + $blog->Title = "SilverStripe blog module successfully installed"; + $blog->URLSegment = 'sample-blog-entry'; + $blog->setDate(date("Y-m-d H:i:s",time())); + $blog->Tags = "silverstripe, blog"; + $blog->Content = "Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in [url=admin]the CMS[/url]."; + $blog->Status = "Published"; + $blog->ParentID = $blogholder->ID; + $blog->write(); + $blog->publish("Stage", "Live"); + + Database::alteration_message("Blog page created","created"); + } + } +} + +class BlogHolder_Controller extends Page_Controller { + function init() { + parent::init(); + + // This will create a tag point to the RSS feed + RSSFeed::linkToFeed($this->Link() . "rss", "RSS feed of this blog"); + Requirements::themedCSS("blog"); + Requirements::themedCSS("bbcodehelp"); + + } + + 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 rss() { + global $project; + $rss = new RSSFeed($this->Children(), $this->Link(), $project . " blog", "", "Title", "ParsedContent"); + $rss->outputToBrowser(); + } + + function BBTags() { + return BBCodeParser::usable_tags(); + } + + function post(){ + if(!Permission::check('ADMIN')){ + Security::permissionFailure($this, + "Posting blogs is an administrator task. Please log in."); + } + return array(); + } + +} + + +class BlogEntry_Form extends Form { + function postblog($data) { + Cookie::set("BlogHolder_Name", $data['Author']); + $blogentry = new BlogEntry(); + $this->saveInto($blogentry); + + if($data['ID'] != 0){ //new post + $blogentry = DataObject::get_by_id("BlogEntry",$data['ID']); + $this->saveInto($blogentry); + $blogentry->setDate($data['Date']); + }else{ + $blogentry->setDate(date("Y-m-d H:i:s",time())); + $blogentry->URLSegment = $data['Title']; + } + + $blogentry->Status = "Published"; + $blogentry->writeToStage("Stage"); + $blogentry->publish("Stage", "Live"); + + Director::redirect(Director::currentURLSegment()); + + } +} + +?> \ No newline at end of file diff --git a/code/BlogManagementWidget.php b/code/BlogManagementWidget.php new file mode 100644 index 0000000..a680699 --- /dev/null +++ b/code/BlogManagementWidget.php @@ -0,0 +1,56 @@ +value(); + if($unmoderatedcount == 1) { + return "You have 1 unmoderated comment"; + } else if($unmoderatedcount > 1) { + return "You have $unmoderatedcount unmoderated comments"; + } else { + return "Comment administration"; + } + } + + function CommentLink() { + $unmoderatedcount = DB::query("SELECT COUNT(*) FROM PageComment WHERE NeedsModeration=1")->value(); + + if($unmoderatedcount > 0) { + return "admin/comments/unmoderated"; + } else { + return "admin/comments"; + } + } + + function WidgetHolder() { + if(Permission::check("ADMIN")) { + return $this->renderWith("WidgetHolder"); + } + } + + function PostLink() { + $blogholder = $this->getBlogHolder(); + + return $blogholder->Link('post'); + } + + function getBlogHolder() { + $page = Director::currentPage(); + + if($page->is_a("BlogHolder")) { + return $page; + } else if($page->is_a("BlogEntry") && $page->getParent()->is_a("BlogHolder")) { + return $page->getParent(); + } else { + return DataObject::get_one("BlogHolder"); + } + } +} + +?> \ No newline at end of file diff --git a/code/RSSWidget.php b/code/RSSWidget.php new file mode 100644 index 0000000..c81f150 --- /dev/null +++ b/code/RSSWidget.php @@ -0,0 +1,44 @@ + "Text", + "RssUrl" => "Text", + "NumberToShow" => "Int", + ); + + static $defaults = array( + "NumberToShow" => 10 + ); + + static $title = "RSS Feed"; + static $cmsTitle = "RSS Feed"; + static $description = "Shows the latest entries of a RSS feed."; + + function getCMSFields() { + return new FieldSet( + new TextField("CustomTitle","Custom title for the feed"), + new TextField("RssUrl", "URL of RSS Feed"), + new NumericField("NumberToShow", "Number of Items to show") + ); + } + + function Title() { + $this->feed = new SimplePie($this->RssUrl); + $this->feed->init(); + return ($this->CustomTitle) ? $this->CustomTitle : $this->feed->get_feed_title(); + } + + function FeedItems() { + $output = new DataObjectSet(); + foreach($this->feed->get_items(0, $this->NumberToShow) as $item) { + $output->push(new ArrayData(array( + "Title" => $item->get_title(), + "Link" => $item->get_link() + ))); + } + return $output; + } +} + +?> \ No newline at end of file diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php new file mode 100644 index 0000000..05e9a19 --- /dev/null +++ b/code/TagCloudWidget.php @@ -0,0 +1,150 @@ + "Int", + "Sortby" => "Varchar" + ); + + static $defaults = array( + "Limit" => "0", + "Sortby" => "alphabet" + ); + + static $title = "Tags"; + static $cmsTitle = "Tag Cloud"; + static $description = "Shows a tag cloud of tags on your blog."; + + function getBlogHolder() { + $page = Director::currentPage(); + + if($page->is_a("BlogHolder")) { + return $page; + } else if($page->is_a("BlogEntry") && $page->getParent()->is_a("BlogHolder")) { + return $page->getParent(); + } else { + return DataObject::get_one("BlogHolder"); + } + } + + + function getCMSFields() { + return new FieldSet( + new TextField("Limit", "Limit number of tags"), + new OptionsetField("Sortby","Sort by",array("alphabet"=>"alphabet","frequency"=>"frequency")) + ); + } + + function Tags() { + Requirements::css("blog/css/tagcloud.css"); + + $allTags = array(); + $max = 0; + $blogHolder = $this->getBlogHolder(); + + $entries = $blogHolder->Children(); + + if($entries) { + foreach($entries as $entry) { + $theseTags = split(" *, *", trim($entry->Tags)); + foreach($theseTags as $tag) { + $allTags[$tag] = isset($allTags[$tag]) ? $allTags[$tag] + 1 : 1; //getting the count into key => value map + $max = ($allTags[$tag] > $max) ? $allTags[$tag] : $max; + } + } + + if($allTags) { + + //TODO: move some or all of the sorts to the database for more efficiency + + if($this->Limit > 0){ + uasort($allTags, "column_sort_by_popularity"); //sort by popularity + $allTags = array_slice($allTags, 0, $this->Limit); + } + if($this->Sortby == "alphabet"){ + natksort($allTags); + } + + $sizes = array(); + foreach($allTags as $tag => $count){ + $sizes[$count] = true; + } + $numsizes = count($sizes)-1; //Work out the number of different sizes + if($numsizes > 5){$numsizes = 5;} + + foreach($allTags as $tag => $count) { + $popularity = floor($count / $max * $numsizes); + + switch($popularity) { + case 0: + $class = "not-popular"; + break; + case 1: + $class = "not-very-popular"; + break; + case 2: + $class = "somewhat-popular"; + break; + case 3: + $class = "popular"; + break; + case 4: + $class = "very-popular"; + break; + case 5: + $class = "ultra-popular"; + break; + default: + $class = "broken"; + break; + } + + $allTags[$tag] = array( + "Tag" => $tag, + "Count" => $count, + "Class" => $class, + "Link" => $blogHolder->Link() . '?tag=' . urlencode($tag) + ); + + } + + } + + $output = new DataObjectSet(); + foreach($allTags as $tag => $fields) { + $output->push(new ArrayData($fields)); + } + return $output; + } + + return; + } +} + +function column_sort_by_popularity($a, $b){ + + if($a == $b) { + $result = 0; + } + else { + $result = $b - $a; + } + + return $result; +} + +function natksort(&$aToBeSorted) + { + $aResult = array(); + $aKeys = array_keys($aToBeSorted); + natcasesort($aKeys); + foreach ($aKeys as $sKey) + { + $aResult[$sKey] = $aToBeSorted[$sKey]; + } + $aToBeSorted = $aResult; + + return true; + } + +?> \ No newline at end of file diff --git a/code/import/TypoImport.php b/code/import/TypoImport.php new file mode 100644 index 0000000..11e264d --- /dev/null +++ b/code/import/TypoImport.php @@ -0,0 +1,152 @@ +Title = "imported blog"; + + // write it! + $bholder->write(); + $bholder->publish("Stage", "Live"); + + // get the typo articles + $result = pg_query($dbconn, "SELECT * FROM contents WHERE type='Article'"); + + while ($row = pg_fetch_row($result)) { + + // title [1] + // author [2] + // body [3] + // body_html [4] (type rendered and cached the html here. This is the preferred blog entry content for migration) + // keywords (space separated) [7] (tags table is just a list of the unique variants of these keywords) + // created_at [8] + // permalink [12] (this is like the url in sitetree, prolly not needed) + // email [18] (address of the commenter) + // url [19] (url of the commenter) + + $title = $row[1]; + $author = $row[2]; + $blog_entry = $row[4]; + $keywords = $row[7]; + $created_at = $row[8]; + + // sometimes it's empty. If it is, grab the body + if ($blog_entry == ""){ + // use "body" + $blog_entry = $row[3]; + } + echo "blog_entry: $blog_entry"; + echo "
\n"; + + // put the typo blog entry in the SS database + $newEntry = new BlogEntry(); + $newEntry->Title = $title; + $newEntry->Author = $author; + $newEntry->Content = $blog_entry; + $newEntry->Tags = $keywords; + $newEntry->Date = $created_at; + + // tie each blog entry back to the blogholder we created initially + $newEntry->ParentID = $bholder->ID; + + // write it! + $newEntry->write(); + $newEntry->publish("Stage", "Live"); + + // grab the id so we can get the comments + $old_article_id = $row[0]; + + // get the comments + $result2 = pg_query($dbconn, "SELECT * FROM contents WHERE type = 'Comment' AND article_id = $old_article_id"); + + while ($row2 = pg_fetch_row($result2)) { + // grab the body_html + $comment = $row2[4]; + + // sometimes it's empty. If it is, grab the body + if ($comment == ""){ + // use "body" + $comment = $row2[3]; + } + + + + + $Cauthor = $row2[2]; + $Ccreated_at = $row2[8]; + + // put the typo blog comment in the SS database + $newCEntry = new PageComment(); + $newCEntry->Name = $Cauthor; + $newCEntry->Comment = $comment; + $newCEntry->Created = $created_at; + + // need to grab the newly inserted blog entry's id + $newCEntry->ParentID = $newEntry->ID; + + // write it! + $newCEntry->write(); + + echo "comment: $comment"; + echo "
\n"; + } + + $newEntry->flushCache(); + + // fix up the specialchars + pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"×\", \"x\")"); + pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"’\", \"’\")"); + pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"‘\", \"‘\")"); + pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"—\", \"—\")"); + pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"“\", \"“\")"); + pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"”\", \"”\")"); + pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"–\", \"–\")"); + pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"—\", \"—\")"); + pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"…\", \"…\")"); + pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"™\", \"™\")"); + pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"&\", \"&\")"); + + pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"×\", \"x\")"); + pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"’\", \"’\")"); + pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"‘\", \"‘\")"); + pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"—\", \"—\")"); + pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"“\", \"“\")"); + pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"”\", \"”\")"); + pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"–\", \"–\")"); + pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"—\", \"—\")"); + pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"…\", \"…\")"); + pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"™\", \"™\")"); + pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"&\", \"&\")"); + + + } + + pg_close($dbconn); + + } // end function + +} // end class +?> diff --git a/css/archivewidget.css b/css/archivewidget.css new file mode 100644 index 0000000..0018f54 --- /dev/null +++ b/css/archivewidget.css @@ -0,0 +1,9 @@ +.archiveMonths{ + +} + +ul.archiveYears li{ + display: inline; + font-size: 1.2em !important; + margin:0 !important; +} \ No newline at end of file diff --git a/css/bbcodehelp.css b/css/bbcodehelp.css new file mode 100644 index 0000000..05db9a7 --- /dev/null +++ b/css/bbcodehelp.css @@ -0,0 +1,32 @@ +/* + Foundational BBHelper formatting +*/ + +ul.bbcodeExamples li { + list-style-type:none; + font-size: 1em; +} +ul.bbcodeExamples li.last { + border: none; +} + +ul.bbcodeExamples li span.example { + +} + +#BBTagsHolder{ + color: #777; + padding: 5px; + width: 270px; + background-color: #fff; + font-size:0.8em; +} + +.bbcodeExamples{ + margin: 0 !important; + padding: 0; +} + +#BBCodeHint{ + cursor: pointer; +} \ No newline at end of file diff --git a/css/blog.css b/css/blog.css new file mode 100644 index 0000000..691205f --- /dev/null +++ b/css/blog.css @@ -0,0 +1,11 @@ +.BlogError { + text-align: center; +} + +.BlogError p { + color: #fff; + display: inline; + background-color: #f77; + padding: 7px; + font-weight:bold; +} \ No newline at end of file diff --git a/css/flickrwidget.css b/css/flickrwidget.css new file mode 100644 index 0000000..ef16f0a --- /dev/null +++ b/css/flickrwidget.css @@ -0,0 +1,3 @@ +div.flickrwidget { + text-align: center; +} \ No newline at end of file diff --git a/css/tagcloud.css b/css/tagcloud.css new file mode 100644 index 0000000..464952f --- /dev/null +++ b/css/tagcloud.css @@ -0,0 +1,6 @@ +.tagcloud .not-popular { font-size: 1em; } +.tagcloud .not-very-popular { font-size: 1.3em; } +.tagcloud .somewhat-popular { font-size: 1.6em; } +.tagcloud .popular { font-size: 1.9em; } +.tagcloud .very-popular { font-size: 2.2em; } +.tagcloud .ultra-popular { font-size: 2.5em; } \ No newline at end of file diff --git a/images/blogholder-file.gif b/images/blogholder-file.gif new file mode 100644 index 0000000000000000000000000000000000000000..4b5b00fdd4c286bedec36c920126ac71b1932e86 GIT binary patch literal 297 zcmZ?wbhEHb6k-r!I3mfAALrGS8@7IO@qZvVGczT?eqLL~=j~Mt3=GDqatD_*xSQ)- zT;F1BZ2a=*%rj?ZKHA-TW@ehEti+i!XBvD=&Tj1Xw=+sJHlA9a1T+As3k@j#WMO1r zkYvySiG%EPU|p7=)|X<*#48{m@L0egFtj1_e)ANQlR+$9?k;Hxyaqgn6w?+2=rNr+ zU}5M{vWNA6fu^KXLYu|6iqI}4=T?P)BOGBaPK|QD25lTJl7pO%)k zW5*7l8U`3p{K>+|z`(pGzuHB6jN4xSg@NXRZo<1!G@oU49H$%7@&lE*x8!K}3noX5_{`DQ$0 j`u#JR`H56x&ZU`rpPU$(MOh`1qJ?Z3IXZef1R1OW-K9t# literal 0 HcmV?d00001 diff --git a/javascript/bbcodehelp.js b/javascript/bbcodehelp.js new file mode 100644 index 0000000..a035b0f --- /dev/null +++ b/javascript/bbcodehelp.js @@ -0,0 +1,12 @@ +Behaviour.register({ + '#BBCodeHint': { + onclick: function() { + if($('BBTagsHolder').style.display == "none") { + Effect.BlindDown('BBTagsHolder'); + } else{ + Effect.BlindUp('BBTagsHolder'); + } + return false; + } + } +}); diff --git a/templates/ArchiveWidget.ss b/templates/ArchiveWidget.ss new file mode 100644 index 0000000..198fc53 --- /dev/null +++ b/templates/ArchiveWidget.ss @@ -0,0 +1,21 @@ +<% if DisplayMode == month %> + +<% else %> + +<% end_if %> \ No newline at end of file diff --git a/templates/BlogManagementWidget.ss b/templates/BlogManagementWidget.ss new file mode 100644 index 0000000..fdd8682 --- /dev/null +++ b/templates/BlogManagementWidget.ss @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/templates/Includes/BlogPagination.ss b/templates/Includes/BlogPagination.ss new file mode 100644 index 0000000..3322029 --- /dev/null +++ b/templates/Includes/BlogPagination.ss @@ -0,0 +1,21 @@ +<% if BlogEntries.MoreThanOnePage %> +
+ <% if BlogEntries.NotLastPage %> + + <% end_if %> + + <% if BlogEntries.NotFirstPage %> + + <% end_if %> + + + <% control BlogEntries.Pages %> + <% if CurrentBool %> + $PageNum + <% else %> + $PageNum + <% end_if %> + <% end_control %> + +
+<% end_if %> \ No newline at end of file diff --git a/templates/Includes/BlogSideBar.ss b/templates/Includes/BlogSideBar.ss new file mode 100644 index 0000000..ebd57aa --- /dev/null +++ b/templates/Includes/BlogSideBar.ss @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/templates/Includes/BlogSummary.ss b/templates/Includes/BlogSummary.ss new file mode 100644 index 0000000..98c7b16 --- /dev/null +++ b/templates/Includes/BlogSummary.ss @@ -0,0 +1,14 @@ +
+

$MenuTitle

+

Posted by $Author.XML on $Date.Long | $Comments.Count Comments

+ <% if Tags %> +

+ Tags: + <% control Tags %> + $Tag<% if Last %><% else %>,<% end_if %> + <% end_control %> +

+ <% end_if %> +

$ParagraphSummary

+

$Comments.Count comments | Read the full post

+
\ No newline at end of file diff --git a/templates/Layout/BlogEntry.ss b/templates/Layout/BlogEntry.ss new file mode 100644 index 0000000..84a384e --- /dev/null +++ b/templates/Layout/BlogEntry.ss @@ -0,0 +1,23 @@ +<% include BlogSideBar %> +
+ <% include BreadCrumbs %> + +
+

$Title

+

Posted by $Author.XML on $Date.Long | $Comments.Count Comments

+ <% if Tags %> +

+ Tags: + <% control Tags %> + $Tag<% if Last %><% else %>,<% end_if %> + <% end_control %> +

+ <% end_if %> +

$Content.Parse(BBCodeParser)

+
+
+ <% if CurrentMember %>

Edit this post | Unpublish this post

<% end_if %> + + $PageComments + +
\ No newline at end of file diff --git a/templates/Layout/BlogHolder.ss b/templates/Layout/BlogHolder.ss new file mode 100644 index 0000000..36720a3 --- /dev/null +++ b/templates/Layout/BlogHolder.ss @@ -0,0 +1,23 @@ +<% include BlogSideBar %> + +
+ + <% include BreadCrumbs %> + + $Content + + <% if Tag %> +

Viewing entries tagged with '$Tag'

+ <% end_if %> + + <% if BlogEntries %> + <% control BlogEntries %> + <% include BlogSummary %> + <% end_control %> + <% else %> +

There are no blog entries

+ <% end_if %> + + <% include BlogPagination %> + +
\ No newline at end of file diff --git a/templates/Layout/BlogHolder_post.ss b/templates/Layout/BlogHolder_post.ss new file mode 100644 index 0000000..f901d62 --- /dev/null +++ b/templates/Layout/BlogHolder_post.ss @@ -0,0 +1,12 @@ +<% include BlogSideBar %> + +
+ + <% include BreadCrumbs %> + + <% if isPost %> + + $BlogEntryForm + + <% end_if %> +
\ No newline at end of file diff --git a/templates/RSSWidget.ss b/templates/RSSWidget.ss new file mode 100644 index 0000000..1cf1089 --- /dev/null +++ b/templates/RSSWidget.ss @@ -0,0 +1,7 @@ +
    + <% control FeedItems %> +
  • + $Title +
  • + <% end_control %> +
\ No newline at end of file diff --git a/templates/TagCloudWidget.ss b/templates/TagCloudWidget.ss new file mode 100644 index 0000000..14939d6 --- /dev/null +++ b/templates/TagCloudWidget.ss @@ -0,0 +1,5 @@ +

+ <% control Tags %> + $Tag + <% end_control %> +

\ No newline at end of file From fc03f9f329ed8ecf11497d34b42a33f4cdf86122 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 11 Sep 2007 06:38:05 +0000 Subject: [PATCH 002/250] check if the method exists before jumping into the foreach loop. was causing problems in some situations --- code/RSSWidget.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/code/RSSWidget.php b/code/RSSWidget.php index c81f150..79bb2e8 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -31,13 +31,15 @@ class RSSWidget extends Widget { function FeedItems() { $output = new DataObjectSet(); - foreach($this->feed->get_items(0, $this->NumberToShow) as $item) { - $output->push(new ArrayData(array( - "Title" => $item->get_title(), - "Link" => $item->get_link() - ))); + if($items = $this->feed->get_items(0, $this->NumberToShow)) { + foreach($items as $item) { + $output->push(new ArrayData(array( + "Title" => $item->get_title(), + "Link" => $item->get_link() + ))); + } + return $output; } - return $output; } } From aae55078db281ce094d7c7ccf72a028ccbc1fd60 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Mon, 17 Sep 2007 10:14:28 +0000 Subject: [PATCH 003/250] Use short tags --- code/BlogEntry.php | 2 +- code/BlogHolder.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 35449cf..df442ea 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -1,4 +1,4 @@ - Date: Mon, 17 Sep 2007 10:20:36 +0000 Subject: [PATCH 004/250] We don't provide an area to add content in the CMS, so dont display it on the blog holder --- templates/Layout/BlogHolder.ss | 2 -- 1 file changed, 2 deletions(-) diff --git a/templates/Layout/BlogHolder.ss b/templates/Layout/BlogHolder.ss index 36720a3..79f6276 100644 --- a/templates/Layout/BlogHolder.ss +++ b/templates/Layout/BlogHolder.ss @@ -4,8 +4,6 @@ <% include BreadCrumbs %> - $Content - <% if Tag %>

Viewing entries tagged with '$Tag'

<% end_if %> From acd6e1a6c51928cff55e737c6f1fef2b5b356887 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Thu, 1 Nov 2007 21:56:44 +0000 Subject: [PATCH 005/250] #1500 - Infinite loop in Blog's RSS widget --- code/BlogHolder.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index a147e72..7c03bfa 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -201,6 +201,15 @@ class BlogHolder_Controller extends Page_Controller { return array(); } + function defaultAction($action) { + // Protection against infinite loops when an RSS widget pointing to this page is added to this page + if(stristr($_SERVER['HTTP_USER_AGENT'], 'SimplePie')) { + return $this->rss(); + } + + return parent::defaultAction($action); + } + } @@ -228,4 +237,4 @@ class BlogEntry_Form extends Form { } } -?> \ No newline at end of file +?> From 408cf5c8bbacbfd9dd8858b09aa9ba8060ca0dbf Mon Sep 17 00:00:00 2001 From: Jeremy Shipman Date: Wed, 14 Nov 2007 01:15:40 +0000 Subject: [PATCH 006/250] Commenting blog --- code/BlogEntry.php | 26 +++++++++++++++++++++++++- code/BlogHolder.php | 45 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 4 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index df442ea..a7596c0 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -1,5 +1,12 @@ Tags)); @@ -77,11 +87,16 @@ class BlogEntry extends Page { } } - + /** + * Get the sidebar + */ function SideBar() { return $this->getParent()->SideBar(); } + /** + * Get a bbcode parsed summary of the blog entry + */ function ParagraphSummary(){ $content = new Text('Content'); $content->value = Convert::raw2xml($this->Content); @@ -89,6 +104,9 @@ class BlogEntry extends Page { return $parser->parse(); } + /** + * Get the bbcode parsed content + */ function ParsedContent() { $parser = new BBCodeParser($this->Content); $content = new Text('Content'); @@ -96,6 +114,9 @@ class BlogEntry extends Page { return $content; } + /** + * Link for editing this blog entry + */ function EditURL(){ return $this->getParent()->Link('post')."/".$this->ID."/"; } @@ -108,6 +129,9 @@ class BlogEntry_Controller extends Page_Controller { Requirements::themedCSS("blog"); } + /** + * Gets a link to unpublish the blog entry + */ function unpublishPost(){ if(!Permission::check('ADMIN')){ Security::permissionFailure($this, diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 7c03bfa..c506f96 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -1,5 +1,13 @@ ID AND ShowInMenus = 1 $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$start, $limit"); } + /** + * Only display the blog entries that have the specified tag + */ function Tag() { return isset($_GET['tag']) ? $_GET['tag'] : false; } + /** + * A simple form for creating blog entries + */ function BlogEntryForm(){ Requirements::javascript('jsparty/behaviour.js'); Requirements::javascript('jsparty/prototype.js'); @@ -101,14 +118,23 @@ class BlogHolder extends Page { return $form; } + /** + * Check if url has "/post" + */ function isPost(){ return Director::urlParam('Action') == 'post'; } + /** + * Link for creating a new blog entry + */ function postURL(){ return $this->Link('post'); } + /** + * Create default blog setup + */ function requireDefaultRecords() { parent::requireDefaultRecords(); @@ -157,8 +183,7 @@ class BlogHolder extends Page { class BlogHolder_Controller extends Page_Controller { function init() { - parent::init(); - + parent::init(); // This will create a tag point to the RSS feed RSSFeed::linkToFeed($this->Link() . "rss", "RSS feed of this blog"); Requirements::themedCSS("blog"); @@ -166,6 +191,9 @@ class BlogHolder_Controller extends Page_Controller { } + /** + * Get 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( @@ -183,16 +211,25 @@ class BlogHolder_Controller extends Page_Controller { return $output; } + /** + * Get the rss fee for this blog holder's entries + */ function rss() { global $project; $rss = new RSSFeed($this->Children(), $this->Link(), $project . " blog", "", "Title", "ParsedContent"); $rss->outputToBrowser(); } + /** + * Return list of usable tags for help + */ function BBTags() { return BBCodeParser::usable_tags(); } + /** + * Post a new blog entry + */ function post(){ if(!Permission::check('ADMIN')){ Security::permissionFailure($this, @@ -212,7 +249,9 @@ class BlogHolder_Controller extends Page_Controller { } - +/** + * Blog entry form + */ class BlogEntry_Form extends Form { function postblog($data) { Cookie::set("BlogHolder_Name", $data['Author']); From 5786b6d6a0a45883bcba73a41f8233ce5c9c90e3 Mon Sep 17 00:00:00 2001 From: Jeremy Shipman Date: Wed, 14 Nov 2007 01:16:13 +0000 Subject: [PATCH 007/250] Commenting blog --- code/BlogHolder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index c506f96..3e7c7dd 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -10,7 +10,7 @@ class BlogHolder extends Page { - static $icon = "blog/images/blogholder"; + static $icon = "blog/images/blogholder"; static $db = array( ); From 4adb7674b93b6c39cf62aa6098994cbe777a0638 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Fri, 23 Nov 2007 07:50:27 +0000 Subject: [PATCH 008/250] Don't set the url segment, as it capitalises --- code/BlogHolder.php | 1 - 1 file changed, 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 3e7c7dd..43ca703 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -264,7 +264,6 @@ class BlogEntry_Form extends Form { $blogentry->setDate($data['Date']); }else{ $blogentry->setDate(date("Y-m-d H:i:s",time())); - $blogentry->URLSegment = $data['Title']; } $blogentry->Status = "Published"; From 9daebb0fb0ff1f05e0e83bcc70f373bea9d70e3c Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Fri, 23 Nov 2007 08:35:49 +0000 Subject: [PATCH 009/250] support for rel-tag microformat --- code/BlogEntry.php | 4 ++-- code/BlogHolder.php | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index a7596c0..25065f2 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -79,7 +79,7 @@ class BlogEntry extends Page { foreach($theseTags as $tag) { $output->push(new ArrayData(array( "Tag" => $tag, - "Link" => $this->getParent()->Link() . '?tag=' . urlencode($tag) + "Link" => $this->getParent()->Link() . 'tag/' . urlencode($tag) ))); } if($this->Tags){ @@ -153,4 +153,4 @@ class BlogEntry_Controller extends Page_Controller { } -?> \ No newline at end of file +?> diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 43ca703..3f58b17 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -47,15 +47,20 @@ class BlogHolder extends Page { if(Director::urlParams()){ - - $year = Director::urlParam('Action'); - $month = Director::urlParam('ID'); + if(Director::urlParam('Action') == 'tag') { + $tag = addslashes(Director::urlParam('ID')); + $tag = str_replace(array("\\",'_','%',"'"), array("\\\\","\\_","\\%","\\'"), $tag); + $tagCheck = "AND `BlogEntry`.Tags LIKE '%$tag%'"; + } else { + $year = Director::urlParam('Action'); + $month = Director::urlParam('ID'); - if(is_numeric($month) && is_numeric($month)){ - $dateCheck = "AND Date BETWEEN '$year-$month-1' AND '$year-$month-31'"; - } - else if(isset($year)){ - $dateCheck = "AND Date BETWEEN '$year-1-1' AND '$year-12-31'"; + if(is_numeric($month) && is_numeric($month)){ + $dateCheck = "AND Date BETWEEN '$year-$month-1' AND '$year-$month-31'"; + } + else if(isset($year)){ + $dateCheck = "AND Date BETWEEN '$year-1-1' AND '$year-12-31'"; + } } } From 85ded9d76bb2209474b0a1ae5b344cd3976a6f4d Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Fri, 23 Nov 2007 08:38:14 +0000 Subject: [PATCH 010/250] Support for rel-tag microformat --- templates/Includes/BlogSummary.ss | 4 ++-- templates/Layout/BlogEntry.ss | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/Includes/BlogSummary.ss b/templates/Includes/BlogSummary.ss index 98c7b16..5d91392 100644 --- a/templates/Includes/BlogSummary.ss +++ b/templates/Includes/BlogSummary.ss @@ -5,10 +5,10 @@

Tags: <% control Tags %> - $Tag<% if Last %><% else %>,<% end_if %> + <% if Last %><% else %>,<% end_if %> <% end_control %>

<% end_if %>

$ParagraphSummary

$Comments.Count comments | Read the full post

- \ No newline at end of file + diff --git a/templates/Layout/BlogEntry.ss b/templates/Layout/BlogEntry.ss index 84a384e..3755e4f 100644 --- a/templates/Layout/BlogEntry.ss +++ b/templates/Layout/BlogEntry.ss @@ -9,7 +9,7 @@

Tags: <% control Tags %> - $Tag<% if Last %><% else %>,<% end_if %> + <% if Last %><% else %>,<% end_if %> <% end_control %>

<% end_if %> @@ -20,4 +20,4 @@ $PageComments - \ No newline at end of file + From 641d35c942b87affbefccf1253a9152a7769b70e Mon Sep 17 00:00:00 2001 From: Jeremy Shipman Date: Sun, 2 Dec 2007 22:32:28 +0000 Subject: [PATCH 011/250] ambiguous SQL fix --- code/BlogHolder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 3f58b17..2cb5f1e 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -56,10 +56,10 @@ class BlogHolder extends Page { $month = Director::urlParam('ID'); if(is_numeric($month) && is_numeric($month)){ - $dateCheck = "AND Date BETWEEN '$year-$month-1' AND '$year-$month-31'"; + $dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-$month-1' AND '$year-$month-31'"; } else if(isset($year)){ - $dateCheck = "AND Date BETWEEN '$year-1-1' AND '$year-12-31'"; + $dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-1-1' AND '$year-12-31'"; } } } From 104301e42d7300e9024524c47c53013ad66af0d4 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 11 Dec 2007 22:13:19 +0000 Subject: [PATCH 012/250] Added BlogEntry::allow_wysiwyg_editing() for people who don't want to use BBCode --- code/BlogEntry.php | 55 ++++++++++++++++++++++++++--------- templates/Layout/BlogEntry.ss | 2 +- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 25065f2..9f59529 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -30,7 +30,12 @@ class BlogEntry extends Page { ); static $allowed_children = "none"; - + + /** + * Is WYSIWYG editing allowed? + */ + static $allow_wysiwyg_editing = false; + /** * overload so that the default date is today. */ @@ -56,14 +61,20 @@ class BlogEntry extends Page { $codeparser = new BBCodeParser(); $fields = parent::getCMSFields(); - $fields->removeFieldFromTab("Root.Content.Main","Content"); - $fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", "Content", 20)); + + if(!self::$allow_wysiwyg_editing) { + $fields->removeFieldFromTab("Root.Content.Main","Content"); + $fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", "Content", 20)); + } + $fields->addFieldToTab("Root.Content.Main", new CalendarDateField("Date", "Date"),"Content"); $fields->addFieldToTab("Root.Content.Main", new TextField("Author", "Author", $firstName),"Content"); - $fields->addFieldToTab("Root.Content.Main", new LiteralField("BBCodeHelper", "
" . - "BBCode help" . - "
")); + if(!self::$allow_wysiwyg_editing) { + $fields->addFieldToTab("Root.Content.Main", new LiteralField("BBCodeHelper", "
" . + "BBCode help" . + "
")); + } $fields->addFieldToTab("Root.Content.Main", new TextField("Tags", "Tags (comma sep.)"),"Content"); return $fields; @@ -98,20 +109,28 @@ class BlogEntry extends Page { * Get a bbcode parsed summary of the blog entry */ function ParagraphSummary(){ - $content = new Text('Content'); - $content->value = Convert::raw2xml($this->Content); - $parser = new BBCodeParser($content->FirstParagraph()); - return $parser->parse(); + if(self::$allow_wysiwyg_editing) { + return $this->obj('Content')->FirstParagraph(); + } else { + $content = new Text('Content'); + $content->value = Convert::raw2xml($this->Content); + $parser = new BBCodeParser($content->FirstParagraph()); + return $parser->parse(); + } } /** * Get the bbcode parsed content */ function ParsedContent() { - $parser = new BBCodeParser($this->Content); - $content = new Text('Content'); - $content->value =$parser->parse(); - return $content; + if(self::$allow_wysiwyg_editing) { + return $this->Content; + } else { + $parser = new BBCodeParser($this->Content); + $content = new Text('Content'); + $content->value =$parser->parse(); + return $content; + } } /** @@ -121,6 +140,14 @@ class BlogEntry extends Page { return $this->getParent()->Link('post')."/".$this->ID."/"; } + + /** + * Call this to enable WYSIWYG editing on your blog entries. + * By default the blog uses BBCode + */ + static function allow_wysiwyg_editing() { + self::$allow_wysiwyg_editing = true; + } } class BlogEntry_Controller extends Page_Controller { diff --git a/templates/Layout/BlogEntry.ss b/templates/Layout/BlogEntry.ss index 3755e4f..ecaff0e 100644 --- a/templates/Layout/BlogEntry.ss +++ b/templates/Layout/BlogEntry.ss @@ -13,7 +13,7 @@ <% end_control %>

<% end_if %> -

$Content.Parse(BBCodeParser)

+

$ParsedContent


<% if CurrentMember %>

Edit this post | Unpublish this post

<% end_if %> From d10e859d1b22291edc966889c7de86ba934a396e Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Thu, 13 Dec 2007 22:40:31 +0000 Subject: [PATCH 013/250] --- code/ArchiveWidget.php | 2 +- code/BlogHolder.php | 1 + code/TagCloudWidget.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index bcee029..a04a788 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -9,7 +9,7 @@ class ArchiveWidget extends Widget { "DisplayMode" => "month" ); - static $title = "Archive"; + static $title = "Browse by Date"; static $cmsTitle = "Blog Archive"; static $description = "Show a list of months or years in which there are blog posts, and provide links to them."; diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 2cb5f1e..7a481b5 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -213,6 +213,7 @@ class BlogHolder_Controller extends Page_Controller { $month['Link'] = $this->Link() . "showarchive/$month[Year]-$month[Month]"; $output->push(new ArrayData($month)); } + Debug::show($output); return $output; } diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index 05e9a19..7e8b08b 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -11,7 +11,7 @@ class TagCloudWidget extends Widget { "Sortby" => "alphabet" ); - static $title = "Tags"; + static $title = "Browse by Tag"; static $cmsTitle = "Tag Cloud"; static $description = "Shows a tag cloud of tags on your blog."; From acb5d1abaeaf8bb56440b78e2e917b3ee497e421 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Fri, 14 Dec 2007 00:54:53 +0000 Subject: [PATCH 014/250] Added newsletter sign up and confirm functionality (as required) and templates --- _config.php | 15 +-- code/BlogHolder.php | 4 + code/BlogRole.php | 15 +++ code/ConfirmNewsletterSignup.php | 68 +++++++++++++ code/NewsletterSignupForm.php | 99 +++++++++++++++++++ .../email/ConfirmNewsletterSignup_Email.ss | 14 +++ templates/email/NewsletterSignupForm_Email.ss | 19 ++++ 7 files changed, 228 insertions(+), 6 deletions(-) create mode 100755 code/BlogRole.php create mode 100755 code/ConfirmNewsletterSignup.php create mode 100755 code/NewsletterSignupForm.php create mode 100755 templates/email/ConfirmNewsletterSignup_Email.ss create mode 100755 templates/email/NewsletterSignupForm_Email.ss diff --git a/_config.php b/_config.php index f2abe24..9f3f73d 100644 --- a/_config.php +++ b/_config.php @@ -1,8 +1,11 @@ 'ConfirmNewsletterSignup' +)); + ?> diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 7a481b5..04b6122 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -217,6 +217,10 @@ class BlogHolder_Controller extends Page_Controller { return $output; } + function NewsletterSignupForm() { + return new NewsletterSignupForm($this, 'NewsletterSignupForm'); + } + /** * Get the rss fee for this blog holder's entries */ diff --git a/code/BlogRole.php b/code/BlogRole.php new file mode 100755 index 0000000..536cf39 --- /dev/null +++ b/code/BlogRole.php @@ -0,0 +1,15 @@ + array( + 'Hash' => 'Varchar(32)' + ), + ); + } + +} + +?> diff --git a/code/ConfirmNewsletterSignup.php b/code/ConfirmNewsletterSignup.php new file mode 100755 index 0000000..6de0157 --- /dev/null +++ b/code/ConfirmNewsletterSignup.php @@ -0,0 +1,68 @@ +Error: No member identification was given.

"; + } else { + // Check if a member exists with the hash given from ID param. + if(!$member = DataObject::get_one('Member', "Hash = '$hash'")) { + $content = "

Error: Member does not exist by given parameters.

"; + } else { + // Check if a group was passed in and exists. + if($groupCode = NewsletterSignupForm::get_group_code()) { + // Check if the member is in this group. + if($group = DataObject::get_one('Group', "Code = '$groupCode'")) { + if($member->inGroup($group->ID)) { + $content = "

$member->Email is already signed up.

"; + } else { + // Member is not in the group, so add the member to the group. + $member->Groups()->add($group); + + // Send an email welcoming the member. + $email = new ConfirmNewsletterSignup_Email($member); + $email->to = $member->Email; + $email->from = Email::getAdminEmail(); + $email->subject = 'Welcome to the mailing list'; + $email->populateTemplate(array( + 'Member' => $member + )); + $email->send(); + + $content = "

$member->Email has been signed up successfully. A welcome email has been sent.

"; + } + } + } + } + } + + // Render these variables into the template. Pass in the message from previous logic. + $this->customise(array( + 'Content' => $content + )); + + // Render with a chosen template. + return $this->renderWith(array( + 'ConfirmNewsletterSignup_member', + 'Page' + )); + } + +} + +class ConfirmNewsletterSignup_Email extends Email_Template { + + protected $ss_template = 'ConfirmNewsletterSignup_Email'; + +} + +?> \ No newline at end of file diff --git a/code/NewsletterSignupForm.php b/code/NewsletterSignupForm.php new file mode 100755 index 0000000..0280459 --- /dev/null +++ b/code/NewsletterSignupForm.php @@ -0,0 +1,99 @@ +inGroup($group->ID)) { + $form->sessionMessage('You are already subscribed.', 'warning'); + Director::redirectBack(); + } + } + } + } else { + // Create a new member, as this is a new subscriber. + $member = new Member(); + } + + // Save the data into the member. + $form->saveInto($member); + + // Hash the email of the subscriber and microtime, write the member. + $member->Hash = md5(microtime() . $member->Email); + $member->write(); + + // Create an array with data to populate in the email. + $populateArray = array(); + $populateArray['Member'] = $member; + // If there is a group, populate a confirm link. + if(self::get_group_code()) { + $populateArray['ConfirmLink'] = Director::absoluteBaseURL() . 'confirm-subscription/member/' . $member->Hash; + } + + // Send off a confirmation email to the subscriber. + $email = new NewsletterSignupForm_Email(); + $email->to = $member->Email; + $email->from = Email::getAdminEmail(); + $email->subject = 'Thank you for subscribing'; + $email->populateTemplate($populateArray); + $email->send(); + + // Display message, and redirect back. + $form->sessionMessage('You have been sent an email to confirm your subscription.', 'good'); + Director::redirectBack(); + } +} + +class NewsletterSignupForm_Email extends Email_Template { + + protected $ss_template = 'NewsletterSignupForm_Email'; + +} + +?> \ No newline at end of file diff --git a/templates/email/ConfirmNewsletterSignup_Email.ss b/templates/email/ConfirmNewsletterSignup_Email.ss new file mode 100755 index 0000000..fcdd44c --- /dev/null +++ b/templates/email/ConfirmNewsletterSignup_Email.ss @@ -0,0 +1,14 @@ + + + + $Subject + + +

$Subject

+ +

Hello $Member.FirstName,

+ +

Welcome to the mailing list.

+ + \ No newline at end of file diff --git a/templates/email/NewsletterSignupForm_Email.ss b/templates/email/NewsletterSignupForm_Email.ss new file mode 100755 index 0000000..3fc45a7 --- /dev/null +++ b/templates/email/NewsletterSignupForm_Email.ss @@ -0,0 +1,19 @@ + + + + $Subject + + +

$Subject

+ +

Hello $Member.FirstName,

+ +

This email confirms you signed up to the site.

+ + <% if ConfirmLink %> +

Please visit this link to confirm you would like to sign up:

+

$ConfirmLink

+ <% end_if %> + + \ No newline at end of file From 2c6edcf0df3246ca29bafcc20137e0407d6a5c86 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Sat, 15 Dec 2007 22:47:20 +0000 Subject: [PATCH 015/250] Newsletter changes for blogholders --- code/BlogHolder.php | 16 ++++++++++- code/BlogRole.php | 3 ++- code/ConfirmNewsletterSignup.php | 4 +-- code/NewsletterSignupForm.php | 46 +++++++++++++++++--------------- 4 files changed, 43 insertions(+), 26 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 04b6122..c428f6c 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -16,7 +16,8 @@ class BlogHolder extends Page { ); static $has_one = array( - "SideBar" => "WidgetArea" + "SideBar" => "WidgetArea", + 'Newsletter' => 'NewsletterType' ); static $allowed_children = array( @@ -27,10 +28,23 @@ class BlogHolder extends Page { $fields = parent::getCMSFields(); $fields->removeFieldFromTab("Root.Content.Main","Content"); $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("SideBar")); + + // Add a dropdown to display all newsletter types. + if($groups = $this->getNewsletters()) { + $groupsMap = $groups->toDropdownMap('ID', 'Title'); + $fields->addFieldToTab('Root.Content.Main', new DropdownField('NewsletterID', 'Subscription newsletter type', $groupsMap, '', '', '(Select one)')); + } return $fields; } + /** + * Get all newsletter type instances. + */ + function getNewsletters() { + return DataObject::get('NewsletterType'); + } + /** * The DataObject of blog entries */ diff --git a/code/BlogRole.php b/code/BlogRole.php index 536cf39..8e7cc4d 100755 --- a/code/BlogRole.php +++ b/code/BlogRole.php @@ -5,7 +5,8 @@ class BlogRole extends DataObjectDecorator { function extraDBFields() { return array( 'db' => array( - 'Hash' => 'Varchar(32)' + 'Hash' => 'Varchar(32)', + 'GroupCode' => 'Varchar(255)' ), ); } diff --git a/code/ConfirmNewsletterSignup.php b/code/ConfirmNewsletterSignup.php index 6de0157..e80d977 100755 --- a/code/ConfirmNewsletterSignup.php +++ b/code/ConfirmNewsletterSignup.php @@ -19,7 +19,7 @@ class ConfirmNewsletterSignup extends Controller { $content = "

Error: Member does not exist by given parameters.

"; } else { // Check if a group was passed in and exists. - if($groupCode = NewsletterSignupForm::get_group_code()) { + if($groupCode = $member->GroupCode) { // Check if the member is in this group. if($group = DataObject::get_one('Group', "Code = '$groupCode'")) { if($member->inGroup($group->ID)) { @@ -29,7 +29,7 @@ class ConfirmNewsletterSignup extends Controller { $member->Groups()->add($group); // Send an email welcoming the member. - $email = new ConfirmNewsletterSignup_Email($member); + $email = new ConfirmNewsletterSignup_Email(); $email->to = $member->Email; $email->from = Email::getAdminEmail(); $email->subject = 'Welcome to the mailing list'; diff --git a/code/NewsletterSignupForm.php b/code/NewsletterSignupForm.php index 0280459..b6492c1 100755 --- a/code/NewsletterSignupForm.php +++ b/code/NewsletterSignupForm.php @@ -3,25 +3,20 @@ class NewsletterSignupForm extends Form { /** - * Code of a group. + * Gets a NewsletterType which is associated with the BlogHolder, the + * controller of this sign up form. It then uses the relationship getter + * to find the Group of a NewsletterType. */ - protected static $groupCode; - - /** - * Set a group for sign up. Must be a code value of an instance of Group. - * Members who sign up will be added to this group. - */ - public static function set_group_code($code) { - self::$groupCode = $code; + function get_group_code() { + if($controller = $this->controller) { + if($controller->ClassName == 'BlogHolder') { + if($controller->Newsletter()) { + return $controller->Newsletter()->Group()->Code; + } + } + } } - /** - * Get the group used for sign ups. - */ - public static function get_group_code() { - return self::$groupCode; - } - function __construct($controller, $name) { $fields = new FieldSet( @@ -31,10 +26,9 @@ class NewsletterSignupForm extends Form { ); $validator = new RequiredFields(array( - 'FirstName', - 'Email' - ) - ); + 'FirstName', + 'Email' + )); $actions = new FieldSet( new FormAction('subscribe', 'Subscribe') @@ -48,7 +42,7 @@ class NewsletterSignupForm extends Form { // Check if there is a current member of given email in data. Check if in group. if($member = DataObject::get_one('Member', "`Member`.`Email` = '$SQL_email'")) { - if($groupCode = self::get_group_code()) { + if($groupCode = $this->get_group_code()) { if($group = DataObject::get_one('Group', "Code = '$groupCode'")) { if($member->inGroup($group->ID)) { $form->sessionMessage('You are already subscribed.', 'warning'); @@ -66,13 +60,21 @@ class NewsletterSignupForm extends Form { // Hash the email of the subscriber and microtime, write the member. $member->Hash = md5(microtime() . $member->Email); + + // If there is a group code found, add it to a field on the member for + // later use (when a member confirms to be added). + if($groupCode = $this->get_group_code()) { + $member->GroupCode = $groupCode; + } + + // Write the member to the database. $member->write(); // Create an array with data to populate in the email. $populateArray = array(); $populateArray['Member'] = $member; // If there is a group, populate a confirm link. - if(self::get_group_code()) { + if($this->get_group_code()) { $populateArray['ConfirmLink'] = Director::absoluteBaseURL() . 'confirm-subscription/member/' . $member->Hash; } From 6229b8960dcce8d15e32313ebd75d624d321932b Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 18 Dec 2007 01:41:51 +0000 Subject: [PATCH 016/250] v.golev: #1982 - Blog module i18n patch --- code/ArchiveWidget.php | 2 +- code/BlogEntry.php | 14 ++++---- code/BlogHolder.php | 54 ++++++++++++++++--------------- code/BlogManagementWidget.php | 6 ++-- code/RSSWidget.php | 6 ++-- code/TagCloudWidget.php | 4 +-- lang/_manifest_exclude | 0 lang/en_US.php | 47 +++++++++++++++++++++++++++ lang/ru_RU.php | 47 +++++++++++++++++++++++++++ templates/BlogManagementWidget.ss | 4 +-- templates/Includes/BlogSummary.ss | 4 +-- templates/Layout/BlogEntry.ss | 8 ++--- templates/Layout/BlogHolder.ss | 6 ++-- 13 files changed, 149 insertions(+), 53 deletions(-) create mode 100644 lang/_manifest_exclude create mode 100644 lang/en_US.php create mode 100644 lang/ru_RU.php diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index a04a788..4c77715 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -27,7 +27,7 @@ class ArchiveWidget extends Widget { function getCMSFields() { return new FieldSet( - new OptionsetField("DisplayMode","Display by",array("month"=>"month","year"=>"year")) + new OptionsetField("DisplayMode",_t('ArchiveWidget.DispBY', "Display by"),array("month"=>_t('ArchiveWidget.MONTH',"month"),"year"=>_t('ArchiveWidget.YEAR', "year"))) ); } diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 9f59529..2ae8b5c 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -3,7 +3,7 @@ /** * @package blog */ - + /** * An individual blog entry page to show a blog entry in full */ @@ -64,19 +64,19 @@ class BlogEntry extends Page { if(!self::$allow_wysiwyg_editing) { $fields->removeFieldFromTab("Root.Content.Main","Content"); - $fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", "Content", 20)); + $fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", _t("BlogEntry.CN", "Content"), 20)); } - $fields->addFieldToTab("Root.Content.Main", new CalendarDateField("Date", "Date"),"Content"); - $fields->addFieldToTab("Root.Content.Main", new TextField("Author", "Author", $firstName),"Content"); + $fields->addFieldToTab("Root.Content.Main", new CalendarDateField("Date", _t("BlogEntry.DT", "Date")),"Content"); + $fields->addFieldToTab("Root.Content.Main", new TextField("Author", _t("BlogEntry.AU", "Author"), $firstName),"Content"); if(!self::$allow_wysiwyg_editing) { $fields->addFieldToTab("Root.Content.Main", new LiteralField("BBCodeHelper", "
" . - "BBCode help" . + "" . _t("BlogEntry.BBH", "BBCode help") / "" . "
")); } - $fields->addFieldToTab("Root.Content.Main", new TextField("Tags", "Tags (comma sep.)"),"Content"); + $fields->addFieldToTab("Root.Content.Main", new TextField("Tags", _t("BlogEntry.TS", "Tags (comma sep.)")),"Content"); return $fields; } @@ -134,7 +134,7 @@ class BlogEntry extends Page { } /** - * Link for editing this blog entry + * Link for editing this blog entry */ function EditURL(){ return $this->getParent()->Link('post')."/".$this->ID."/"; diff --git a/code/BlogHolder.php b/code/BlogHolder.php index c428f6c..914a537 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -3,11 +3,11 @@ /** * @package blog */ - + /** * Blog holder to display summarised blog entries */ - + class BlogHolder extends Page { static $icon = "blog/images/blogholder"; @@ -43,7 +43,7 @@ class BlogHolder extends Page { */ function getNewsletters() { return DataObject::get('NewsletterType'); - } + } /** * The DataObject of blog entries @@ -68,12 +68,11 @@ class BlogHolder extends Page { } else { $year = Director::urlParam('Action'); $month = Director::urlParam('ID'); - + if(is_numeric($month) && is_numeric($month)){ $dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-$month-1' AND '$year-$month-31'"; - } - else if(isset($year)){ - $dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-1-1' AND '$year-12-31'"; + } else if(isset($year)){ + $dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-1-1' AND '$year-12-31'"; } } } @@ -85,6 +84,9 @@ class BlogHolder extends Page { * Only display the blog entries that have the specified tag */ function Tag() { + if(Director::urlParam('Action') == 'tag') { + return Director::urlParam('ID'); + } return isset($_GET['tag']) ? $_GET['tag'] : false; } @@ -110,19 +112,19 @@ class BlogHolder extends Page { new HiddenField("ParentID", "ParentID", $this->ID), new HiddenField("ID","ID"), new HiddenField("Date","Date"), - new TextField("Title","Subject"), - new TextField("Author","Author",$membername), + new TextField("Title",_t('BlogHolder.SJ', "Subject")), + new TextField("Author",_t('BlogEntry.AU'),$membername), new CompositeField( - new LiteralField("BBCodeHelper","BBCode help
" ), - new TextareaField("Content", "Content",20), + new LiteralField("BBCodeHelper",""._t("BlogEntry.BBH")."
" ), + new TextareaField("Content", _t("BlogEntry.CN"),20), new LiteralField("BBCodeTags","") ), new TextField("Tags","Tags"), - new LiteralField("Tagsnote"," ") + new LiteralField("Tagsnote"," ") ); - $submitAction = new FormAction('postblog', 'Post blog entry'); + $submitAction = new FormAction('postblog', _t('BlogHolder.POST', 'Post blog entry')); $actions = new FieldSet($submitAction); $validator = new RequiredFields('Title','Content'); @@ -136,7 +138,7 @@ class BlogHolder extends Page { return $form; } - + /** * Check if url has "/post" */ @@ -150,7 +152,7 @@ class BlogHolder extends Page { function postURL(){ return $this->Link('post'); } - + /** * Create default blog setup */ @@ -185,11 +187,11 @@ class BlogHolder extends Page { $widgetarea->write(); $blog = new BlogEntry(); - $blog->Title = "SilverStripe blog module successfully installed"; + $blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed"); $blog->URLSegment = 'sample-blog-entry'; $blog->setDate(date("Y-m-d H:i:s",time())); - $blog->Tags = "silverstripe, blog"; - $blog->Content = "Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in [url=admin]the CMS[/url]."; + $blog->Tags = _t('BlogHolder.SUCTAGS',"silverstripe, blog"); + $blog->Content = _t('BlogHolder.SUCCONTENT',"Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in [url=admin]the CMS[/url]."); $blog->Status = "Published"; $blog->ParentID = $blogholder->ID; $blog->write(); @@ -202,16 +204,17 @@ class BlogHolder extends Page { class BlogHolder_Controller extends Page_Controller { function init() { - parent::init(); + parent::init(); + // This will create a tag point to the RSS feed - RSSFeed::linkToFeed($this->Link() . "rss", "RSS feed of this blog"); + RSSFeed::linkToFeed($this->Link() . "rss", _t('BlogHolder.RSSFEED',"RSS feed of this blog")); Requirements::themedCSS("blog"); Requirements::themedCSS("bbcodehelp"); } - + /** - * Get the archived blogs for a particular month or year, in the format /year/month/ eg: /2008/10/ + * 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']); @@ -236,7 +239,7 @@ class BlogHolder_Controller extends Page_Controller { } /** - * Get the rss fee for this blog holder's entries + * Get the rss feed for this blog holder's entries */ function rss() { global $project; @@ -257,7 +260,7 @@ class BlogHolder_Controller extends Page_Controller { function post(){ if(!Permission::check('ADMIN')){ Security::permissionFailure($this, - "Posting blogs is an administrator task. Please log in."); + _t('BlogHolder.HAVENTPERM',"Posting blogs is an administrator task. Please log in.")); } return array(); } @@ -270,7 +273,6 @@ class BlogHolder_Controller extends Page_Controller { return parent::defaultAction($action); } - } /** diff --git a/code/BlogManagementWidget.php b/code/BlogManagementWidget.php index a680699..0fbb41e 100644 --- a/code/BlogManagementWidget.php +++ b/code/BlogManagementWidget.php @@ -10,11 +10,11 @@ class BlogManagementWidget extends Widget { function CommentText() { $unmoderatedcount = DB::query("SELECT COUNT(*) FROM PageComment WHERE NeedsModeration=1")->value(); if($unmoderatedcount == 1) { - return "You have 1 unmoderated comment"; + return _t("BlogManagementWidget.UNM1", "You have 1 unmoderated comment"); } else if($unmoderatedcount > 1) { - return "You have $unmoderatedcount unmoderated comments"; + return sprintf(_t("BlogManagementWidget.UNMM", "You have %i unmoderated comments"), $unmoderatedcount); } else { - return "Comment administration"; + return _t("BlogManagementWidget.COMADM", "Comment administration"); } } diff --git a/code/RSSWidget.php b/code/RSSWidget.php index 79bb2e8..b17e97d 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -17,9 +17,9 @@ class RSSWidget extends Widget { function getCMSFields() { return new FieldSet( - new TextField("CustomTitle","Custom title for the feed"), - new TextField("RssUrl", "URL of RSS Feed"), - new NumericField("NumberToShow", "Number of Items to show") + new TextField("CustomTitle", _t('RSSWidget.CT', "Custom title for the feed")), + new TextField("RssUrl", _t('RSSWidget.URL', "URL of RSS Feed")), + new NumericField("NumberToShow", _t('RSSWidget.NTS', "Number of Items to show")) ); } diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index 7e8b08b..ebacb13 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -30,8 +30,8 @@ class TagCloudWidget extends Widget { function getCMSFields() { return new FieldSet( - new TextField("Limit", "Limit number of tags"), - new OptionsetField("Sortby","Sort by",array("alphabet"=>"alphabet","frequency"=>"frequency")) + new TextField("Limit", _t("TagCloudWidget.LIMIT", "Limit number of tags")), + new OptionsetField("Sortby",_t("TagCloudWidget.SORTBY","Sort by"),array("alphabet"=>_t("TagCloudWidget.SBAL", "alphabet"),"frequency"=>_t("TagCloudWidget.SBFREQ", "frequency"))) ); } diff --git a/lang/_manifest_exclude b/lang/_manifest_exclude new file mode 100644 index 0000000..e69de29 diff --git a/lang/en_US.php b/lang/en_US.php new file mode 100644 index 0000000..929ecd6 --- /dev/null +++ b/lang/en_US.php @@ -0,0 +1,47 @@ + diff --git a/lang/ru_RU.php b/lang/ru_RU.php new file mode 100644 index 0000000..bd15a69 --- /dev/null +++ b/lang/ru_RU.php @@ -0,0 +1,47 @@ + diff --git a/templates/BlogManagementWidget.ss b/templates/BlogManagementWidget.ss index fdd8682..c2e6a6a 100644 --- a/templates/BlogManagementWidget.ss +++ b/templates/BlogManagementWidget.ss @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/templates/Includes/BlogSummary.ss b/templates/Includes/BlogSummary.ss index 5d91392..df2e045 100644 --- a/templates/Includes/BlogSummary.ss +++ b/templates/Includes/BlogSummary.ss @@ -1,6 +1,6 @@
-

$MenuTitle

-

Posted by $Author.XML on $Date.Long | $Comments.Count Comments

+

$MenuTitle

+

<% _t('BlogEntry.ss.POSTEDBY') %> $Author.XML <% _t('BlogEntry.ss.POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('BlogEntry.ss.COMMENTS', 'Comments') %>

<% if Tags %>

Tags: diff --git a/templates/Layout/BlogEntry.ss b/templates/Layout/BlogEntry.ss index ecaff0e..260958f 100644 --- a/templates/Layout/BlogEntry.ss +++ b/templates/Layout/BlogEntry.ss @@ -4,19 +4,19 @@

$Title

-

Posted by $Author.XML on $Date.Long | $Comments.Count Comments

+

<% _t('POSTEDBY', 'Posted by') %> $Author.XML <% _t('POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('COMMENTS', 'Comments') %>

<% if Tags %>

- Tags: + <% _t('TAGS', 'Tags:') %> <% control Tags %> - <% if Last %><% else %>,<% end_if %> + <% if Last %><% else %>,<% end_if %> <% end_control %>

<% end_if %>

$ParsedContent


- <% if CurrentMember %>

Edit this post | Unpublish this post

<% end_if %> + <% if CurrentMember %>

<% _t('EDITTHIS', 'Edit this post') %> | <% _t('UNPUBLISHTHIS', 'Unpublish this post') %>

<% end_if %> $PageComments diff --git a/templates/Layout/BlogHolder.ss b/templates/Layout/BlogHolder.ss index 79f6276..d0d3eec 100644 --- a/templates/Layout/BlogHolder.ss +++ b/templates/Layout/BlogHolder.ss @@ -5,7 +5,7 @@ <% include BreadCrumbs %> <% if Tag %> -

Viewing entries tagged with '$Tag'

+

<% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$Tag'

<% end_if %> <% if BlogEntries %> @@ -13,9 +13,9 @@ <% include BlogSummary %> <% end_control %> <% else %> -

There are no blog entries

+

<% _t('NOENTRIES', 'There are no blog entries') %>

<% end_if %> <% include BlogPagination %> -
\ No newline at end of file + From abcb9518374993c3922abc0db8375c7756845426 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 18 Dec 2007 02:10:44 +0000 Subject: [PATCH 017/250] use microformat style tags in tagcloud --- code/TagCloudWidget.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index ebacb13..0ea5b95 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -103,7 +103,7 @@ class TagCloudWidget extends Widget { "Tag" => $tag, "Count" => $count, "Class" => $class, - "Link" => $blogHolder->Link() . '?tag=' . urlencode($tag) + "Link" => $blogHolder->Link() . 'tag/' . urlencode($tag) ); } @@ -147,4 +147,4 @@ function natksort(&$aToBeSorted) return true; } -?> \ No newline at end of file +?> From fbe55590083ce0e51e7011d03c84345cd594f6ac Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 18 Dec 2007 02:38:07 +0000 Subject: [PATCH 018/250] fix incorrect usage of _t --- templates/Includes/BlogSummary.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/Includes/BlogSummary.ss b/templates/Includes/BlogSummary.ss index df2e045..5b2207b 100644 --- a/templates/Includes/BlogSummary.ss +++ b/templates/Includes/BlogSummary.ss @@ -1,6 +1,6 @@

$MenuTitle

-

<% _t('BlogEntry.ss.POSTEDBY') %> $Author.XML <% _t('BlogEntry.ss.POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('BlogEntry.ss.COMMENTS', 'Comments') %>

+

<% _t('POSTEDBY') %> $Author.XML <% _t('POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('COMMENTS', 'Comments') %>

<% if Tags %>

Tags: From 1058c98081bb2153edb6f5cca1b75058d50842f4 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 18 Dec 2007 02:42:52 +0000 Subject: [PATCH 019/250] Added return false otherwise it won't redirect --- code/NewsletterSignupForm.php | 1 + 1 file changed, 1 insertion(+) diff --git a/code/NewsletterSignupForm.php b/code/NewsletterSignupForm.php index b6492c1..1704b71 100755 --- a/code/NewsletterSignupForm.php +++ b/code/NewsletterSignupForm.php @@ -47,6 +47,7 @@ class NewsletterSignupForm extends Form { if($member->inGroup($group->ID)) { $form->sessionMessage('You are already subscribed.', 'warning'); Director::redirectBack(); + return false; } } } From 5668169744ce2c0f0ef2074ea1e4ae5bc717067a Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 18 Dec 2007 03:21:47 +0000 Subject: [PATCH 020/250] We don't need to escape the summary before parsing bbcode, as the parser does that for us --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 2ae8b5c..ec2103c 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -113,7 +113,7 @@ class BlogEntry extends Page { return $this->obj('Content')->FirstParagraph(); } else { $content = new Text('Content'); - $content->value = Convert::raw2xml($this->Content); + $content->value = $this->Content; $parser = new BBCodeParser($content->FirstParagraph()); return $parser->parse(); } From 3117340cc52f1ed9c47157ce937512bc0d806ddc Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 20 Dec 2007 02:23:20 +0000 Subject: [PATCH 021/250] Moved NewsletterSignupForm to the object, made a link to this from the blogentry page --- code/BlogEntry.php | 10 +++++++++- code/BlogHolder.php | 11 +++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index ec2103c..643f50f 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -140,6 +140,14 @@ class BlogEntry extends Page { return $this->getParent()->Link('post')."/".$this->ID."/"; } + /** + * Return the NewsletterSignupForm from the parent (BlogHolder). + */ + function NewsletterSignupForm() { + if(isset($this->Parent->ID) && $this->Parent->NewsletterSignupForm()) { + return $this->Parent->NewsletterSignupForm(); + } + } /** * Call this to enable WYSIWYG editing on your blog entries. @@ -177,7 +185,7 @@ class BlogEntry_Controller extends Page_Controller { Director::redirect($this->getParent()->Link()); } } - + } ?> diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 914a537..c6aa5b2 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -90,6 +90,13 @@ class BlogHolder extends Page { return isset($_GET['tag']) ? $_GET['tag'] : false; } + /** + * Return a new instance of NewsletterSignupForm. + */ + function NewsletterSignupForm() { + return new NewsletterSignupForm($this, 'NewsletterSignupForm'); + } + /** * A simple form for creating blog entries */ @@ -234,10 +241,6 @@ class BlogHolder_Controller extends Page_Controller { return $output; } - function NewsletterSignupForm() { - return new NewsletterSignupForm($this, 'NewsletterSignupForm'); - } - /** * Get the rss feed for this blog holder's entries */ From 57bde0bfc30e3d6350186debe8e21456fd1d1b35 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 20 Dec 2007 02:49:50 +0000 Subject: [PATCH 022/250] Added RSS feed icon to blog module --- images/feed-icon-14x14.png | Bin 0 -> 689 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 images/feed-icon-14x14.png diff --git a/images/feed-icon-14x14.png b/images/feed-icon-14x14.png new file mode 100755 index 0000000000000000000000000000000000000000..b3c949d2244f2c0c81d65e74719af2a1b56d06a3 GIT binary patch literal 689 zcmV;i0#5yjP)(tky!*UETcH-TCU7SrqEjJM#?B`_A)!p7(kFf9-P@=@15kkTkGK zgFusyy#KECqZzRdBLb=P?$(kUP;>kYTDeG&{|a+iOiRbI6nbQ)j#7bOf>iF=C+|_py<&Fo1F5cC*iEM?zZGC{ejNg4LWYp=S$L6Qaby6y zp$+F`250{%tU{Lg$5*ROH}y!1UKJS4*xqd7P(Y3JQF?lrnf?yerr%&6yGXLG1ur*B z{$&R1@Oj)yl@%rY5rh?j(j10Yz_DBs`AKFU_QnB;)(aqQmGi&ieOS|21^NP9UMpa< zU&p!f6RZ6Owp^X!EXA=0SbN&h?CrQK%Q3(=YBqqHD^9ZUM0Hxt-6-KT;>lf@j?Z+v zHm(}`>85I&E<7e}oz?6UwjAogowzGO8kSN7+2`b^$Az9L{K5*ko87EV45LT-`_##3 z>d3AGh@>=mbg34|6}+-gT9N+6Dr@44VEl44O&{&|w=qpbzC#iWMKa?5)>tI+KLQK@ Xq0QFqn(9Yl00000NkvXXu0mjfZ8t Date: Thu, 20 Dec 2007 03:26:20 +0000 Subject: [PATCH 023/250] Instead of directly checking ClassName, check if an instance instead --- code/NewsletterSignupForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/NewsletterSignupForm.php b/code/NewsletterSignupForm.php index 1704b71..48ca29a 100755 --- a/code/NewsletterSignupForm.php +++ b/code/NewsletterSignupForm.php @@ -9,7 +9,7 @@ class NewsletterSignupForm extends Form { */ function get_group_code() { if($controller = $this->controller) { - if($controller->ClassName == 'BlogHolder') { + if($controller instanceof BlogHolder) { if($controller->Newsletter()) { return $controller->Newsletter()->Group()->Code; } From d1c6825941b2242fcdcd2384556713ce3f7245c4 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 20 Dec 2007 03:31:38 +0000 Subject: [PATCH 024/250] Don't show the NewsletterSignupForm unless there is a newsletter related to a BlogHolder that exists --- code/BlogHolder.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index c6aa5b2..7fa6f6b 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -92,9 +92,12 @@ class BlogHolder extends Page { /** * Return a new instance of NewsletterSignupForm. + * If there is no related Newsletter, then don't show it. */ function NewsletterSignupForm() { - return new NewsletterSignupForm($this, 'NewsletterSignupForm'); + if($this->Newsletter() && $this->Newsletter()->ID) { + return new NewsletterSignupForm($this, 'NewsletterSignupForm'); + } } /** From d971db30d0041b447957e94ad571fa0c37b0fc9f Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 20 Dec 2007 03:39:03 +0000 Subject: [PATCH 025/250] Added ConfirmNewsletterSignup_member.ss as an example how to customise, added themedCSS requirements to controller --- code/ConfirmNewsletterSignup.php | 11 +++++++++++ templates/Layout/ConfirmNewsletterSignup_member.ss | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100755 templates/Layout/ConfirmNewsletterSignup_member.ss diff --git a/code/ConfirmNewsletterSignup.php b/code/ConfirmNewsletterSignup.php index e80d977..cb1adb6 100755 --- a/code/ConfirmNewsletterSignup.php +++ b/code/ConfirmNewsletterSignup.php @@ -2,6 +2,17 @@ class ConfirmNewsletterSignup extends Controller { + /** + * Add theme CSS requirements to make this look controller look a bit prettier. + * If these aren't here, the page looks like a mess to users. + */ + function init() { + parent::init(); + Requirements::themedCSS('layout'); + Requirements::themedCSS('typography'); + Requirements::themedCSS('form'); + } + /** * Action for signing up a member to a given group in NewsletterSignupForm. * Used as mysite.com/confirm-subscription/member/123 (where 123 is a md5 hash to find the member) diff --git a/templates/Layout/ConfirmNewsletterSignup_member.ss b/templates/Layout/ConfirmNewsletterSignup_member.ss new file mode 100755 index 0000000..e1db78a --- /dev/null +++ b/templates/Layout/ConfirmNewsletterSignup_member.ss @@ -0,0 +1,8 @@ +

+
+

Confirm newsletter signup

+ $Content +
+
+ + From fe23b0cef9287f2a18bacaa7a0452ea9cd0a6634 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 20 Dec 2007 04:32:01 +0000 Subject: [PATCH 026/250] Abstracted fields onto BlogRole from subscribe form, added some documentation about what it does --- code/BlogRole.php | 24 +++++++++++++++++++++ code/ConfirmNewsletterSignup.php | 2 +- code/NewsletterSignupForm.php | 37 ++++++++++++++++++-------------- 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/code/BlogRole.php b/code/BlogRole.php index 8e7cc4d..a22ba17 100755 --- a/code/BlogRole.php +++ b/code/BlogRole.php @@ -2,6 +2,9 @@ class BlogRole extends DataObjectDecorator { + /** + * Extend the member table with some extra fields. + */ function extraDBFields() { return array( 'db' => array( @@ -10,6 +13,27 @@ class BlogRole extends DataObjectDecorator { ), ); } + + /** + * These fields are used for the newsletter subscription form. + */ + function subscribeFields() { + return new FieldSet( + new TextField('FirstName', 'Your first name'), + new TextField('Surname', 'Your surname'), + new EmailField('Email', 'Your email') + ); + } + + /** + * These are the required fields for the newsletter subscription form. + */ + function subscribeRequiredFields() { + return new RequiredFields(array( + 'FirstName', + 'Email' + )); + } } diff --git a/code/ConfirmNewsletterSignup.php b/code/ConfirmNewsletterSignup.php index cb1adb6..da3f86f 100755 --- a/code/ConfirmNewsletterSignup.php +++ b/code/ConfirmNewsletterSignup.php @@ -12,7 +12,7 @@ class ConfirmNewsletterSignup extends Controller { Requirements::themedCSS('typography'); Requirements::themedCSS('form'); } - + /** * Action for signing up a member to a given group in NewsletterSignupForm. * Used as mysite.com/confirm-subscription/member/123 (where 123 is a md5 hash to find the member) diff --git a/code/NewsletterSignupForm.php b/code/NewsletterSignupForm.php index 48ca29a..961120c 100755 --- a/code/NewsletterSignupForm.php +++ b/code/NewsletterSignupForm.php @@ -3,9 +3,8 @@ class NewsletterSignupForm extends Form { /** - * Gets a NewsletterType which is associated with the BlogHolder, the - * controller of this sign up form. It then uses the relationship getter - * to find the Group of a NewsletterType. + * Get the group code of the newsletter associated with the + * BlogHolder instance that this form was created from. */ function get_group_code() { if($controller = $this->controller) { @@ -17,26 +16,32 @@ class NewsletterSignupForm extends Form { } } + /** + * Create the NewsletterSignupForm. + * Take the fields and required fields from the extension role. + */ function __construct($controller, $name) { + $member = singleton('Member'); + + $fields = $member->subscribeFields(); + + $validator = $member->subscribeRequiredFields(); - $fields = new FieldSet( - new TextField('FirstName', 'Your first name'), - new TextField('Surname', 'Your surname'), - new EmailField('Email', 'Your email') - ); - - $validator = new RequiredFields(array( - 'FirstName', - 'Email' - )); - $actions = new FieldSet( new FormAction('subscribe', 'Subscribe') ); - + parent::__construct($controller, $name, $fields, $actions, $validator); } - + + /** + * NewsletterSignupForm action. + * Requires that the email address be submitted in the form. + * + * Checks if there is a member in the system by submitted email, and checks if + * that member has already signed up. If member has, then form gives message and + * redirects back. If not, then it carries on with the process. + */ function subscribe($data, $form) { $SQL_email = $data['Email']; From 1dca7415c5d680c00813e407e91d53249f637a77 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Sun, 6 Jan 2008 22:48:49 +0000 Subject: [PATCH 027/250] Fix typo --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 643f50f..372a2be 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -72,7 +72,7 @@ class BlogEntry extends Page { if(!self::$allow_wysiwyg_editing) { $fields->addFieldToTab("Root.Content.Main", new LiteralField("BBCodeHelper", "")); } From 9590b3558f1d813c1e77faca950f07ebc0eed45e Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Mon, 7 Jan 2008 01:49:29 +0000 Subject: [PATCH 028/250] Remove debug message --- code/BlogHolder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 7fa6f6b..97683ab 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -240,7 +240,7 @@ class BlogHolder_Controller extends Page_Controller { $month['Link'] = $this->Link() . "showarchive/$month[Year]-$month[Month]"; $output->push(new ArrayData($month)); } - Debug::show($output); + return $output; } From 43fd90621e72235bbca034a598496521738da031 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Mon, 7 Jan 2008 19:40:36 +0000 Subject: [PATCH 029/250] Fix RSS feed when using WYSIWYG editing --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 372a2be..05e1e9e 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -124,7 +124,7 @@ class BlogEntry extends Page { */ function ParsedContent() { if(self::$allow_wysiwyg_editing) { - return $this->Content; + return $this->obj('Content'); } else { $parser = new BBCodeParser($this->Content); $content = new Text('Content'); From b819135fe52032cb9514d183766c0ff360bcab0e Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Sun, 13 Jan 2008 20:16:27 +0000 Subject: [PATCH 030/250] simon_w: #2123 - Blog RSS sorted by date --- code/BlogHolder.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 97683ab..3c618fd 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -249,7 +249,9 @@ class BlogHolder_Controller extends Page_Controller { */ function rss() { global $project; - $rss = new RSSFeed($this->Children(), $this->Link(), $project . " blog", "", "Title", "ParsedContent"); + $children = $this->Children(); + $children->sort('Date', 'DESC'); + $rss = new RSSFeed($children, $this->Link(), $project . " blog", "", "Title", "ParsedContent"); $rss->outputToBrowser(); } From 36a6d0342b7f8069172dc56ca5f69f9b39cf2075 Mon Sep 17 00:00:00 2001 From: Jeremy Shipman Date: Mon, 14 Jan 2008 02:19:53 +0000 Subject: [PATCH 031/250] Date format bug #1941 --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 05e1e9e..29a3199 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -41,7 +41,7 @@ class BlogEntry extends Page { */ public function populateDefaults(){ parent::populateDefaults(); - $this->Date = date("d/m/Y H:i:s",time()); + $this->Date = date("Y-m-d H:i:s",time()); } /** From 3505c315c5afad34cc7aa584328b7b447412ea9d Mon Sep 17 00:00:00 2001 From: Jeremy Shipman Date: Mon, 14 Jan 2008 02:41:27 +0000 Subject: [PATCH 032/250] fixed pagination bug --- templates/Includes/BlogPagination.ss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/Includes/BlogPagination.ss b/templates/Includes/BlogPagination.ss index 3322029..29a3c25 100644 --- a/templates/Includes/BlogPagination.ss +++ b/templates/Includes/BlogPagination.ss @@ -1,11 +1,11 @@ <% if BlogEntries.MoreThanOnePage %>
<% if BlogEntries.NotLastPage %> - + <% end_if %> <% if BlogEntries.NotFirstPage %> - + <% end_if %> From 5d10b7589c5f2ddc5f961e73fc6815bbc836c938 Mon Sep 17 00:00:00 2001 From: Jeremy Shipman Date: Mon, 14 Jan 2008 03:34:47 +0000 Subject: [PATCH 033/250] Fixed date ranges for archive blogs --- code/BlogHolder.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 3c618fd..b206b9b 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -69,10 +69,13 @@ class BlogHolder extends Page { $year = Director::urlParam('Action'); $month = Director::urlParam('ID'); - if(is_numeric($month) && is_numeric($month)){ - $dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-$month-1' AND '$year-$month-31'"; + if(is_numeric($month) && is_numeric($month)){ + $nextyear = ($month==12) ? $year + 1 : $year; + $nextmonth = $month % 12 + 1; + $dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-$month-1' AND '$nextyear-$nextmonth-1'"; } else if(isset($year)){ - $dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-1-1' AND '$year-12-31'"; + $nextyear = $year + 1; + $dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-1-1' AND '".$nextyear."-1-1'"; } } } From 4423407f48281462221772eb469a4c82505a6ea4 Mon Sep 17 00:00:00 2001 From: Matt Peel Date: Tue, 22 Jan 2008 03:44:44 +0000 Subject: [PATCH 034/250] --- code/BlogEntry.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 29a3199..3ca53ba 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -110,12 +110,12 @@ class BlogEntry extends Page { */ function ParagraphSummary(){ if(self::$allow_wysiwyg_editing) { - return $this->obj('Content')->FirstParagraph(); + return $this->obj('Content')->FirstParagraph('html'); } else { - $content = new Text('Content'); - $content->value = $this->Content; - $parser = new BBCodeParser($content->FirstParagraph()); - return $parser->parse(); + $parser = new BBCodeParser($this->Content); + $html = new HTMLText('Content'); + $html->setValue($parser->parse()); + return $html->FirstParagraph('html'); } } From 33471e39263e4e8ab8ae9bc5215fe2c31c1b08e6 Mon Sep 17 00:00:00 2001 From: Matt Peel Date: Wed, 23 Jan 2008 22:56:22 +0000 Subject: [PATCH 035/250] Changed Tag Cloud site name to Tag Cloud. --- code/TagCloudWidget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index 0ea5b95..29f35da 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -11,7 +11,7 @@ class TagCloudWidget extends Widget { "Sortby" => "alphabet" ); - static $title = "Browse by Tag"; + static $title = "Tag Cloud"; static $cmsTitle = "Tag Cloud"; static $description = "Shows a tag cloud of tags on your blog."; From 99b3127e70ed492e7c2e9a07967680c516b50227 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sun, 24 Feb 2008 08:19:24 +0000 Subject: [PATCH 036/250] --- code/RSSWidget.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/code/RSSWidget.php b/code/RSSWidget.php index b17e97d..56a2809 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -23,14 +23,10 @@ class RSSWidget extends Widget { ); } - function Title() { - $this->feed = new SimplePie($this->RssUrl); - $this->feed->init(); - return ($this->CustomTitle) ? $this->CustomTitle : $this->feed->get_feed_title(); - } - function FeedItems() { $output = new DataObjectSet(); + $this->feed = new SimplePie($this->RssUrl); + $this->feed->init(); if($items = $this->feed->get_items(0, $this->NumberToShow)) { foreach($items as $item) { $output->push(new ArrayData(array( From 293dd54f6453b58e73e0356cee5bb88d0e7bc213 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sun, 24 Feb 2008 08:23:04 +0000 Subject: [PATCH 037/250] Removed custom title and method in favour of using defaults --- code/RSSWidget.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/code/RSSWidget.php b/code/RSSWidget.php index 56a2809..84ca5d3 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -2,22 +2,21 @@ class RSSWidget extends Widget { static $db = array( - "CustomTitle" => "Text", + "Title" => "Text", "RssUrl" => "Text", "NumberToShow" => "Int", ); static $defaults = array( - "NumberToShow" => 10 + "NumberToShow" => 10, + "Title" => 'RSS Feed' ); - - static $title = "RSS Feed"; static $cmsTitle = "RSS Feed"; static $description = "Shows the latest entries of a RSS feed."; function getCMSFields() { return new FieldSet( - new TextField("CustomTitle", _t('RSSWidget.CT', "Custom title for the feed")), + new TextField("Title", _t('RSSWidget.CT', "Custom title for the feed")), new TextField("RssUrl", _t('RSSWidget.URL', "URL of RSS Feed")), new NumericField("NumberToShow", _t('RSSWidget.NTS', "Number of Items to show")) ); From 9da8415588a0c5399e79c4c8265c5a406646ed2e Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Mon, 25 Feb 2008 08:48:33 +0000 Subject: [PATCH 038/250] now I see why you need that title function. So added it back --- code/RSSWidget.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/code/RSSWidget.php b/code/RSSWidget.php index 84ca5d3..1b1ebf5 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -2,25 +2,28 @@ class RSSWidget extends Widget { static $db = array( - "Title" => "Text", + "RSSTitle" => "Text", "RssUrl" => "Text", - "NumberToShow" => "Int", + "NumberToShow" => "Int" ); static $defaults = array( "NumberToShow" => 10, - "Title" => 'RSS Feed' + "RSSTitle" => 'RSS Feed' ); static $cmsTitle = "RSS Feed"; static $description = "Shows the latest entries of a RSS feed."; function getCMSFields() { return new FieldSet( - new TextField("Title", _t('RSSWidget.CT', "Custom title for the feed")), + new TextField("RSSTitle", _t('RSSWidget.CT', "Custom title for the feed")), new TextField("RssUrl", _t('RSSWidget.URL', "URL of RSS Feed")), new NumericField("NumberToShow", _t('RSSWidget.NTS', "Number of Items to show")) ); } + function Title() { + return ($this->RSSTitle) ? $this->RSSTitle : 'RSS Feed'; + } function FeedItems() { $output = new DataObjectSet(); From 60e4f4c3b2c808a3d475d2debf17888ff6955aa6 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 11 Mar 2008 00:42:51 +0000 Subject: [PATCH 039/250] updated en_US master entities --- lang/en_US.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lang/en_US.php b/lang/en_US.php index 929ecd6..d72da4f 100644 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -2,7 +2,7 @@ global $lang; -$lang['en_US']['ArchiveWidget']['DISPBY'] = 'Display by'; +$lang['en_US']['ArchiveWidget']['DispBY'] = 'Display by'; $lang['en_US']['ArchiveWidget']['MONTH'] = 'month'; $lang['en_US']['ArchiveWidget']['YEAR'] = 'year'; $lang['en_US']['BlogEntry']['CN'] = 'Content'; @@ -12,7 +12,7 @@ $lang['en_US']['BlogEntry']['BBH'] = 'BBCode help'; $lang['en_US']['BlogEntry']['TS'] = 'Tags (comma sep.)'; $lang['en_US']['BlogHolder']['SJ'] = 'Subject'; $lang['en_US']['BlogHolder']['TE'] = 'For example: sport, personal, science fiction'; -$lang['en_US']['BlogHolder']['SPuC'] = 'Please separate tags using commas.'; +$lang['en_US']['BlogHolder']['SPUC'] = 'Please separate tags using commas.'; $lang['en_US']['BlogHolder']['POST'] = 'Post blog entry'; $lang['en_US']['BlogHolder']['SUCTITLE'] = 'SilverStripe blog module successfully installed'; $lang['en_US']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; @@ -44,4 +44,4 @@ $lang['en_US']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Unpublish this post'; $lang['en_US']['BlogHolder.ss']['VIEWINGTAGGED'] = 'Viewing entries tagged with'; $lang['en_US']['BlogHolder.ss']['NOENTRIES'] = 'There are no blog entries'; -?> +?> \ No newline at end of file From 6a3225df22ad718b12b0d19633a3fc7de714ff21 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 8 Apr 2008 23:09:11 +0000 Subject: [PATCH 040/250] Added editable Title field to TagCloudWidget --- code/BlogEntry.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 3ca53ba..e10e84d 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -18,7 +18,9 @@ class BlogEntry extends Page { static $db = array( "Date" => "Datetime", "Author" => "Text", - "Tags" => "Text" + "Tags" => "Text", + "ShowOnHomepage" => "Boolean", + "RedirectionURL" => "Varchar(255)", ); static $casting = array( @@ -26,7 +28,8 @@ class BlogEntry extends Page { ); static $defaults = array( - "ProvideComments" => true + "ProvideComments" => true, + "ShowOnHomepage" => 1, ); static $allowed_children = "none"; @@ -77,6 +80,8 @@ class BlogEntry extends Page { } $fields->addFieldToTab("Root.Content.Main", new TextField("Tags", _t("BlogEntry.TS", "Tags (comma sep.)")),"Content"); + $fields->addFieldToTab("Root.Content.Main", new CheckboxField("ShowOnHomepage", _t("BlogEntry.SHOWONHOMEPAGE", "Show on homepage?")),"Content"); + $fields->addFieldToTab("Root.Content.Main", new TextField("RedirectionURL", _t("BlogEntry.REDIRECTIONURL", "Redirect straight to this URL")),"Content"); return $fields; } @@ -161,6 +166,10 @@ class BlogEntry extends Page { class BlogEntry_Controller extends Page_Controller { function init() { parent::init(); + if($this->RedirectionURL) { + Director::redirect($this->RedirectionURL); + return; + } Requirements::themedCSS("blog"); } From e3eeffafc90389c9d723658decb1c051dd956dff Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 8 Apr 2008 23:21:13 +0000 Subject: [PATCH 041/250] Reverted previous change --- code/BlogEntry.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index e10e84d..3ca53ba 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -18,9 +18,7 @@ class BlogEntry extends Page { static $db = array( "Date" => "Datetime", "Author" => "Text", - "Tags" => "Text", - "ShowOnHomepage" => "Boolean", - "RedirectionURL" => "Varchar(255)", + "Tags" => "Text" ); static $casting = array( @@ -28,8 +26,7 @@ class BlogEntry extends Page { ); static $defaults = array( - "ProvideComments" => true, - "ShowOnHomepage" => 1, + "ProvideComments" => true ); static $allowed_children = "none"; @@ -80,8 +77,6 @@ class BlogEntry extends Page { } $fields->addFieldToTab("Root.Content.Main", new TextField("Tags", _t("BlogEntry.TS", "Tags (comma sep.)")),"Content"); - $fields->addFieldToTab("Root.Content.Main", new CheckboxField("ShowOnHomepage", _t("BlogEntry.SHOWONHOMEPAGE", "Show on homepage?")),"Content"); - $fields->addFieldToTab("Root.Content.Main", new TextField("RedirectionURL", _t("BlogEntry.REDIRECTIONURL", "Redirect straight to this URL")),"Content"); return $fields; } @@ -166,10 +161,6 @@ class BlogEntry extends Page { class BlogEntry_Controller extends Page_Controller { function init() { parent::init(); - if($this->RedirectionURL) { - Director::redirect($this->RedirectionURL); - return; - } Requirements::themedCSS("blog"); } From 9289d6ed0428d08fd0b4e77f8b7b6306a6dc86e4 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 8 Apr 2008 23:22:08 +0000 Subject: [PATCH 042/250] Added editable Title field to TagCloudWidget --- code/TagCloudWidget.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index 29f35da..0664674 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -2,16 +2,17 @@ class TagCloudWidget extends Widget { static $db = array( + "Title" => "Varchar", "Limit" => "Int", "Sortby" => "Varchar" ); static $defaults = array( + "Title" => "Tag Cloud", "Limit" => "0", "Sortby" => "alphabet" ); - static $title = "Tag Cloud"; static $cmsTitle = "Tag Cloud"; static $description = "Shows a tag cloud of tags on your blog."; @@ -30,11 +31,16 @@ class TagCloudWidget extends Widget { function getCMSFields() { return new FieldSet( + new TextField("Title", _t("TagCloudWidget.TILE", "Title")), new TextField("Limit", _t("TagCloudWidget.LIMIT", "Limit number of tags")), new OptionsetField("Sortby",_t("TagCloudWidget.SORTBY","Sort by"),array("alphabet"=>_t("TagCloudWidget.SBAL", "alphabet"),"frequency"=>_t("TagCloudWidget.SBFREQ", "frequency"))) ); } + function Title() { + return $this->Title ? $this->Title : 'Tag Cloud'; + } + function Tags() { Requirements::css("blog/css/tagcloud.css"); From 80974881a124541b3a93e3e927a1da3a8e797999 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 8 Apr 2008 23:34:28 +0000 Subject: [PATCH 043/250] Added LandingPageFreshness variable to blog holder, which lets authors choose which entries to show on the landing page --- code/BlogHolder.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index b206b9b..e93a79a 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -13,6 +13,7 @@ class BlogHolder extends Page { static $icon = "blog/images/blogholder"; static $db = array( + "LandingPageFreshness" => "Varchar", ); static $has_one = array( @@ -24,10 +25,30 @@ class BlogHolder extends Page { 'BlogEntry' ); + static $defaults = array( + "LandingPageFreshness" => "3 MONTH", + ); + function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeFieldFromTab("Root.Content.Main","Content"); $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("SideBar")); + + $fields->addFieldToTab('Root.Content.Main', new DropdownField('LandingPageFreshness', 'When you first open the blog, how many entries should I show', array( + "" => "All entries", + "1 MONTH" => "Last month's entries", + "2 MONTH" => "Last 2 months' entries", + "3 MONTH" => "Last 3 months' entries", + "4 MONTH" => "Last 4 months' entries", + "5 MONTH" => "Last 5 months' entries", + "6 MONTH" => "Last 6 months' entries", + "7 MONTH" => "Last 7 months' entries", + "8 MONTH" => "Last 8 months' entries", + "9 MONTH" => "Last 9 months' entries", + "10 MONTH" => "Last 10 months' entries", + "11 MONTH" => "Last 11 months' entries", + "12 MONTH" => "Last year's entries", + ))); // Add a dropdown to display all newsletter types. if($groups = $this->getNewsletters()) { @@ -76,6 +97,8 @@ class BlogHolder extends Page { } else if(isset($year)){ $nextyear = $year + 1; $dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-1-1' AND '".$nextyear."-1-1'"; + } else if($this->LandingPageFreshness) { + $dateCheck = "AND `BlogEntry`.Date > NOW() - INTERVAL " . $this->LandingPageFreshness; } } } From b1e4d27b4258b553427787fb18f68fae92497c44 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Tue, 22 Apr 2008 00:30:40 +0000 Subject: [PATCH 044/250] browse by tag was not working. --- code/TagCloudWidget.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index 0664674..c5b945a 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -58,7 +58,7 @@ class TagCloudWidget extends Widget { $max = ($allTags[$tag] > $max) ? $allTags[$tag] : $max; } } - + if($allTags) { //TODO: move some or all of the sorts to the database for more efficiency @@ -77,8 +77,8 @@ class TagCloudWidget extends Widget { } $numsizes = count($sizes)-1; //Work out the number of different sizes if($numsizes > 5){$numsizes = 5;} - foreach($allTags as $tag => $count) { + $popularity = floor($count / $max * $numsizes); switch($popularity) { @@ -111,7 +111,7 @@ class TagCloudWidget extends Widget { "Class" => $class, "Link" => $blogHolder->Link() . 'tag/' . urlencode($tag) ); - + Debug::show($allTags[$tag]); } } From 55e1174884542e7b0f8b9a0605f4dd84927a3468 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Tue, 22 Apr 2008 01:20:59 +0000 Subject: [PATCH 045/250] fixed the show by tag --- code/BlogHolder.php | 11 ++++++++++- code/TagCloudWidget.php | 19 ++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index e93a79a..d9e484b 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -109,7 +109,7 @@ class BlogHolder extends Page { /** * Only display the blog entries that have the specified tag */ - function Tag() { + function ShowTag() { if(Director::urlParam('Action') == 'tag') { return Director::urlParam('ID'); } @@ -269,6 +269,15 @@ class BlogHolder_Controller extends Page_Controller { return $output; } + function tag() { + if($this->ShowTag()) { + return array( + 'Tag' => $this->ShowTag() + ); + } else { + return array(); + } + } /** * Get the rss feed for this blog holder's entries diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index c5b945a..36beea9 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -2,10 +2,10 @@ class TagCloudWidget extends Widget { static $db = array( - "Title" => "Varchar", - "Limit" => "Int", - "Sortby" => "Varchar" - ); + "Title" => "Varchar", + "Limit" => "Int", + "Sortby" => "Varchar" + ); static $defaults = array( "Title" => "Tag Cloud", @@ -111,7 +111,6 @@ class TagCloudWidget extends Widget { "Class" => $class, "Link" => $blogHolder->Link() . 'tag/' . urlencode($tag) ); - Debug::show($allTags[$tag]); } } @@ -139,18 +138,16 @@ function column_sort_by_popularity($a, $b){ return $result; } -function natksort(&$aToBeSorted) - { +function natksort(&$aToBeSorted) { $aResult = array(); $aKeys = array_keys($aToBeSorted); natcasesort($aKeys); - foreach ($aKeys as $sKey) - { + foreach ($aKeys as $sKey) { $aResult[$sKey] = $aToBeSorted[$sKey]; - } + } $aToBeSorted = $aResult; return true; - } +} ?> From 4df0def63b6a5f2509813e77d8b145bcd76776fc Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 12 Jun 2008 23:39:47 +0000 Subject: [PATCH 047/250] Merged revisions 56170 via svnmerge from svn://svn.silverstripe.com/silverstripe/modules/blog/branches/trunk-dnc ........ r56170 | ischommer | 2008-06-13 11:25:35 +1200 (Fri, 13 Jun 2008) | 1 line BUGFIX Adding getAbsoluteRssURL() to RSSWidget to avoid SimplePie confusion on relative URLs (causes timeouts) ........ --- code/RSSWidget.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/code/RSSWidget.php b/code/RSSWidget.php index 1b1ebf5..306865c 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -14,6 +14,23 @@ class RSSWidget extends Widget { static $cmsTitle = "RSS Feed"; static $description = "Shows the latest entries of a RSS feed."; + /** + * If the RssUrl is relative, convert it to absolute with the + * current baseURL to avoid confusing simplepie. + * Passing relative URLs to simplepie will result + * in strange DNS lookups and request timeouts. + * + * @return string + */ + function getAbsoluteRssUrl() { + $urlParts = parse_url($this->RssUrl); + if(!isset($urlParts['host']) || !$urlParts['host']) { + return Director::absoluteBaseURL() . $this->RssUrl; + } else { + return $this->RssUrl; + } + } + function getCMSFields() { return new FieldSet( new TextField("RSSTitle", _t('RSSWidget.CT', "Custom title for the feed")), @@ -27,7 +44,7 @@ class RSSWidget extends Widget { function FeedItems() { $output = new DataObjectSet(); - $this->feed = new SimplePie($this->RssUrl); + $this->feed = new SimplePie($this->AbsoluteRssUrl); $this->feed->init(); if($items = $this->feed->get_items(0, $this->NumberToShow)) { foreach($items as $item) { From b02d83c7bec1f7b889b4d2ecf65de8961d5bff83 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 18 Jun 2008 21:51:21 +0000 Subject: [PATCH 050/250] MINOR Updated language master table --- lang/en_US.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lang/en_US.php b/lang/en_US.php index d72da4f..cb75943 100644 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -25,6 +25,7 @@ $lang['en_US']['BlogManagementWidget']['COMADM'] = 'Comment administration'; $lang['en_US']['RSSWidget']['CT'] = 'Custom title for the feed'; $lang['en_US']['RSSWidget']['URL'] = 'URL of RSS Feed'; $lang['en_US']['RSSWidget']['NTS'] = 'Number of Items to show'; +$lang['en_US']['TagCloudWidget']['TILE'] = 'Title'; $lang['en_US']['TagCloudWidget']['LIMIT'] = 'Limit number of tags'; $lang['en_US']['TagCloudWidget']['SORTBY'] = 'Sort by'; $lang['en_US']['TagCloudWidget']['SBAL'] = 'alphabet'; From 0f0e473c7fcaa7ba1df841b5936c2b57f4efc504 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 17 Jul 2008 21:08:35 +0000 Subject: [PATCH 051/250] FEATURE (by simon_w) Add LeftAndMain::require_css()/require_javascript/require_themed_css() for easier customization in CMS (patch from #2636) ENHANCEMENT Applied LeftAndMain::require_javascript() to blog bbcodehelp.js --- _config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/_config.php b/_config.php index 9f3f73d..067789b 100644 --- a/_config.php +++ b/_config.php @@ -8,4 +8,5 @@ Director::addRules(50, array( 'confirm-subscription/$Action/$ID' => 'ConfirmNewsletterSignup' )); +LeftAndMain::require_javascript('blog/javascript/bbcodehelp.js'); ?> From 359446212a8501e30a3e03cb6deb38c533fca81a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 20 Jul 2008 07:45:55 +0000 Subject: [PATCH 052/250] API CHANGE Changed BlogEntry->Tags() to TagsCollection() to avoid confusion with the property "Tags" which is of DBField type "Text" (not DataObjectSet) - necessary to adjust to changed DataObject-write() behaviour of using DBField instances to write the value (rather than directly editing the SQL manipulation). See r52927 for details. --- code/BlogEntry.php | 2 +- templates/Includes/BlogSummary.ss | 4 ++-- templates/Layout/BlogEntry.ss | 4 ++-- templates/TagCloudWidget.ss | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 3ca53ba..06b5f33 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -83,7 +83,7 @@ class BlogEntry extends Page { /** * Returns the tags added to this blog entry */ - function Tags() { + function TagsCollection() { $theseTags = split(" *, *", trim($this->Tags)); $output = new DataObjectSet(); diff --git a/templates/Includes/BlogSummary.ss b/templates/Includes/BlogSummary.ss index 5b2207b..ff838fa 100644 --- a/templates/Includes/BlogSummary.ss +++ b/templates/Includes/BlogSummary.ss @@ -1,10 +1,10 @@

$MenuTitle

<% _t('POSTEDBY') %> $Author.XML <% _t('POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('COMMENTS', 'Comments') %>

- <% if Tags %> + <% if TagsCollection %>

Tags: - <% control Tags %> + <% control TagsCollection %> <% if Last %><% else %>,<% end_if %> <% end_control %>

diff --git a/templates/Layout/BlogEntry.ss b/templates/Layout/BlogEntry.ss index 260958f..cb10b23 100644 --- a/templates/Layout/BlogEntry.ss +++ b/templates/Layout/BlogEntry.ss @@ -5,10 +5,10 @@

$Title

<% _t('POSTEDBY', 'Posted by') %> $Author.XML <% _t('POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('COMMENTS', 'Comments') %>

- <% if Tags %> + <% if TagsCollection %>

<% _t('TAGS', 'Tags:') %> - <% control Tags %> + <% control TagsCollection %> <% if Last %><% else %>,<% end_if %> <% end_control %>

diff --git a/templates/TagCloudWidget.ss b/templates/TagCloudWidget.ss index 14939d6..773987c 100644 --- a/templates/TagCloudWidget.ss +++ b/templates/TagCloudWidget.ss @@ -1,5 +1,5 @@

- <% control Tags %> + <% control TagsCollection %> $Tag <% end_control %>

\ No newline at end of file From 9c004b468c15b4b66284da1871f1609bd1bccecb Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 24 Jul 2008 05:04:46 +0000 Subject: [PATCH 054/250] Only call LeftAndMain::require_javascript() if that method exists - allows blog module compatibility with 2.2.2 --- _config.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_config.php b/_config.php index 067789b..98e96b2 100644 --- a/_config.php +++ b/_config.php @@ -8,5 +8,7 @@ Director::addRules(50, array( 'confirm-subscription/$Action/$ID' => 'ConfirmNewsletterSignup' )); -LeftAndMain::require_javascript('blog/javascript/bbcodehelp.js'); +if(method_exists('LeftAndMain', 'require_javascript')) { + LeftAndMain::require_javascript('blog/javascript/bbcodehelp.js'); +} ?> From 6256c6d871bffa3eb5a69dab5dc09e2f6aae7866 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Mon, 28 Jul 2008 04:12:16 +0000 Subject: [PATCH 055/250] API CHANGE Removed Newsletter references in blog module. This shouldn't be in here because it's easy enough to create one on a per-project basis --- _config.php | 8 -- code/BlogEntry.php | 9 -- code/BlogHolder.php | 26 +---- code/BlogRole.php | 40 ------- code/ConfirmNewsletterSignup.php | 79 ------------- code/NewsletterSignupForm.php | 107 ------------------ .../Layout/ConfirmNewsletterSignup_member.ss | 8 -- .../email/ConfirmNewsletterSignup_Email.ss | 14 --- templates/email/NewsletterSignupForm_Email.ss | 19 ---- 9 files changed, 1 insertion(+), 309 deletions(-) delete mode 100755 code/BlogRole.php delete mode 100755 code/ConfirmNewsletterSignup.php delete mode 100755 code/NewsletterSignupForm.php delete mode 100755 templates/Layout/ConfirmNewsletterSignup_member.ss delete mode 100755 templates/email/ConfirmNewsletterSignup_Email.ss delete mode 100755 templates/email/NewsletterSignupForm_Email.ss diff --git a/_config.php b/_config.php index 98e96b2..eed5db5 100644 --- a/_config.php +++ b/_config.php @@ -1,13 +1,5 @@ 'ConfirmNewsletterSignup' -)); - if(method_exists('LeftAndMain', 'require_javascript')) { LeftAndMain::require_javascript('blog/javascript/bbcodehelp.js'); } diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 06b5f33..2bab80c 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -140,15 +140,6 @@ class BlogEntry extends Page { return $this->getParent()->Link('post')."/".$this->ID."/"; } - /** - * Return the NewsletterSignupForm from the parent (BlogHolder). - */ - function NewsletterSignupForm() { - if(isset($this->Parent->ID) && $this->Parent->NewsletterSignupForm()) { - return $this->Parent->NewsletterSignupForm(); - } - } - /** * Call this to enable WYSIWYG editing on your blog entries. * By default the blog uses BBCode diff --git a/code/BlogHolder.php b/code/BlogHolder.php index d9e484b..dd69676 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -17,8 +17,7 @@ class BlogHolder extends Page { ); static $has_one = array( - "SideBar" => "WidgetArea", - 'Newsletter' => 'NewsletterType' + "SideBar" => "WidgetArea" ); static $allowed_children = array( @@ -50,22 +49,9 @@ class BlogHolder extends Page { "12 MONTH" => "Last year's entries", ))); - // Add a dropdown to display all newsletter types. - if($groups = $this->getNewsletters()) { - $groupsMap = $groups->toDropdownMap('ID', 'Title'); - $fields->addFieldToTab('Root.Content.Main', new DropdownField('NewsletterID', 'Subscription newsletter type', $groupsMap, '', '', '(Select one)')); - } - return $fields; } - /** - * Get all newsletter type instances. - */ - function getNewsletters() { - return DataObject::get('NewsletterType'); - } - /** * The DataObject of blog entries */ @@ -116,16 +102,6 @@ class BlogHolder extends Page { return isset($_GET['tag']) ? $_GET['tag'] : false; } - /** - * Return a new instance of NewsletterSignupForm. - * If there is no related Newsletter, then don't show it. - */ - function NewsletterSignupForm() { - if($this->Newsletter() && $this->Newsletter()->ID) { - return new NewsletterSignupForm($this, 'NewsletterSignupForm'); - } - } - /** * A simple form for creating blog entries */ diff --git a/code/BlogRole.php b/code/BlogRole.php deleted file mode 100755 index a22ba17..0000000 --- a/code/BlogRole.php +++ /dev/null @@ -1,40 +0,0 @@ - array( - 'Hash' => 'Varchar(32)', - 'GroupCode' => 'Varchar(255)' - ), - ); - } - - /** - * These fields are used for the newsletter subscription form. - */ - function subscribeFields() { - return new FieldSet( - new TextField('FirstName', 'Your first name'), - new TextField('Surname', 'Your surname'), - new EmailField('Email', 'Your email') - ); - } - - /** - * These are the required fields for the newsletter subscription form. - */ - function subscribeRequiredFields() { - return new RequiredFields(array( - 'FirstName', - 'Email' - )); - } - -} - -?> diff --git a/code/ConfirmNewsletterSignup.php b/code/ConfirmNewsletterSignup.php deleted file mode 100755 index da3f86f..0000000 --- a/code/ConfirmNewsletterSignup.php +++ /dev/null @@ -1,79 +0,0 @@ -Error: No member identification was given.

"; - } else { - // Check if a member exists with the hash given from ID param. - if(!$member = DataObject::get_one('Member', "Hash = '$hash'")) { - $content = "

Error: Member does not exist by given parameters.

"; - } else { - // Check if a group was passed in and exists. - if($groupCode = $member->GroupCode) { - // Check if the member is in this group. - if($group = DataObject::get_one('Group', "Code = '$groupCode'")) { - if($member->inGroup($group->ID)) { - $content = "

$member->Email is already signed up.

"; - } else { - // Member is not in the group, so add the member to the group. - $member->Groups()->add($group); - - // Send an email welcoming the member. - $email = new ConfirmNewsletterSignup_Email(); - $email->to = $member->Email; - $email->from = Email::getAdminEmail(); - $email->subject = 'Welcome to the mailing list'; - $email->populateTemplate(array( - 'Member' => $member - )); - $email->send(); - - $content = "

$member->Email has been signed up successfully. A welcome email has been sent.

"; - } - } - } - } - } - - // Render these variables into the template. Pass in the message from previous logic. - $this->customise(array( - 'Content' => $content - )); - - // Render with a chosen template. - return $this->renderWith(array( - 'ConfirmNewsletterSignup_member', - 'Page' - )); - } - -} - -class ConfirmNewsletterSignup_Email extends Email_Template { - - protected $ss_template = 'ConfirmNewsletterSignup_Email'; - -} - -?> \ No newline at end of file diff --git a/code/NewsletterSignupForm.php b/code/NewsletterSignupForm.php deleted file mode 100755 index 961120c..0000000 --- a/code/NewsletterSignupForm.php +++ /dev/null @@ -1,107 +0,0 @@ -controller) { - if($controller instanceof BlogHolder) { - if($controller->Newsletter()) { - return $controller->Newsletter()->Group()->Code; - } - } - } - } - - /** - * Create the NewsletterSignupForm. - * Take the fields and required fields from the extension role. - */ - function __construct($controller, $name) { - $member = singleton('Member'); - - $fields = $member->subscribeFields(); - - $validator = $member->subscribeRequiredFields(); - - $actions = new FieldSet( - new FormAction('subscribe', 'Subscribe') - ); - - parent::__construct($controller, $name, $fields, $actions, $validator); - } - - /** - * NewsletterSignupForm action. - * Requires that the email address be submitted in the form. - * - * Checks if there is a member in the system by submitted email, and checks if - * that member has already signed up. If member has, then form gives message and - * redirects back. If not, then it carries on with the process. - */ - function subscribe($data, $form) { - $SQL_email = $data['Email']; - - // Check if there is a current member of given email in data. Check if in group. - if($member = DataObject::get_one('Member', "`Member`.`Email` = '$SQL_email'")) { - if($groupCode = $this->get_group_code()) { - if($group = DataObject::get_one('Group', "Code = '$groupCode'")) { - if($member->inGroup($group->ID)) { - $form->sessionMessage('You are already subscribed.', 'warning'); - Director::redirectBack(); - return false; - } - } - } - } else { - // Create a new member, as this is a new subscriber. - $member = new Member(); - } - - // Save the data into the member. - $form->saveInto($member); - - // Hash the email of the subscriber and microtime, write the member. - $member->Hash = md5(microtime() . $member->Email); - - // If there is a group code found, add it to a field on the member for - // later use (when a member confirms to be added). - if($groupCode = $this->get_group_code()) { - $member->GroupCode = $groupCode; - } - - // Write the member to the database. - $member->write(); - - // Create an array with data to populate in the email. - $populateArray = array(); - $populateArray['Member'] = $member; - // If there is a group, populate a confirm link. - if($this->get_group_code()) { - $populateArray['ConfirmLink'] = Director::absoluteBaseURL() . 'confirm-subscription/member/' . $member->Hash; - } - - // Send off a confirmation email to the subscriber. - $email = new NewsletterSignupForm_Email(); - $email->to = $member->Email; - $email->from = Email::getAdminEmail(); - $email->subject = 'Thank you for subscribing'; - $email->populateTemplate($populateArray); - $email->send(); - - // Display message, and redirect back. - $form->sessionMessage('You have been sent an email to confirm your subscription.', 'good'); - Director::redirectBack(); - } -} - -class NewsletterSignupForm_Email extends Email_Template { - - protected $ss_template = 'NewsletterSignupForm_Email'; - -} - -?> \ No newline at end of file diff --git a/templates/Layout/ConfirmNewsletterSignup_member.ss b/templates/Layout/ConfirmNewsletterSignup_member.ss deleted file mode 100755 index e1db78a..0000000 --- a/templates/Layout/ConfirmNewsletterSignup_member.ss +++ /dev/null @@ -1,8 +0,0 @@ -
-
-

Confirm newsletter signup

- $Content -
-
- - diff --git a/templates/email/ConfirmNewsletterSignup_Email.ss b/templates/email/ConfirmNewsletterSignup_Email.ss deleted file mode 100755 index fcdd44c..0000000 --- a/templates/email/ConfirmNewsletterSignup_Email.ss +++ /dev/null @@ -1,14 +0,0 @@ - - - - $Subject - - -

$Subject

- -

Hello $Member.FirstName,

- -

Welcome to the mailing list.

- - \ No newline at end of file diff --git a/templates/email/NewsletterSignupForm_Email.ss b/templates/email/NewsletterSignupForm_Email.ss deleted file mode 100755 index 3fc45a7..0000000 --- a/templates/email/NewsletterSignupForm_Email.ss +++ /dev/null @@ -1,19 +0,0 @@ - - - - $Subject - - -

$Subject

- -

Hello $Member.FirstName,

- -

This email confirms you signed up to the site.

- - <% if ConfirmLink %> -

Please visit this link to confirm you would like to sign up:

-

$ConfirmLink

- <% end_if %> - - \ No newline at end of file From 2b64a33fda5f95b202c6e7f956e7dbcad994e93e Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 29 Jul 2008 04:03:57 +0000 Subject: [PATCH 056/250] --- templates/Layout/BlogHolder_post.ss | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templates/Layout/BlogHolder_post.ss b/templates/Layout/BlogHolder_post.ss index f901d62..12532d6 100644 --- a/templates/Layout/BlogHolder_post.ss +++ b/templates/Layout/BlogHolder_post.ss @@ -1,4 +1,7 @@ -<% include BlogSideBar %> +
+ <% include MainMenu %> + $SideBar +
From ccd3bc1a49fea0541f1e8a01d4a91d26a3ccac34 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 29 Jul 2008 04:17:34 +0000 Subject: [PATCH 057/250] BUGFIX Renamed Tags in TagCloudWidget->Tags() to TagsCollection() which is less confusing and now renders the tags correctly --- code/TagCloudWidget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index 36beea9..a2d84dd 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -41,7 +41,7 @@ class TagCloudWidget extends Widget { return $this->Title ? $this->Title : 'Tag Cloud'; } - function Tags() { + function TagsCollection() { Requirements::css("blog/css/tagcloud.css"); $allTags = array(); From 54f0af86ba5e3e904befecf0922dbc6b040d0c20 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 21 Aug 2008 01:30:04 +0000 Subject: [PATCH 058/250] MINOR whitespace --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 2bab80c..a175017 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -13,7 +13,7 @@ class BlogEntry extends Page { static $can_be_root = false; - static $icon = "blog/images/blogpage"; + static $icon = "blog/images/blogpage"; static $db = array( "Date" => "Datetime", From 237dd4564f1c693eba085a27f9c2ad410553160c Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 21 Aug 2008 01:37:37 +0000 Subject: [PATCH 059/250] MINOR invalid use of single quotes as HTML MINOR whitespace in PHP cleanup --- code/BlogHolder.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index dd69676..17ca732 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -105,13 +105,13 @@ class BlogHolder extends Page { /** * A simple form for creating blog entries */ - function BlogEntryForm(){ + function BlogEntryForm() { Requirements::javascript('jsparty/behaviour.js'); Requirements::javascript('jsparty/prototype.js'); Requirements::javascript('jsparty/scriptaculous/effects.js'); Requirements::javascript('cms/javascript/PageCommentInterface.js'); Requirements::javascript('blog/javascript/bbcodehelp.js'); - + $id = 0; if(Director::urlParam('ID')){ $id = Director::urlParam('ID'); @@ -127,9 +127,9 @@ class BlogHolder extends Page { new TextField("Title",_t('BlogHolder.SJ', "Subject")), new TextField("Author",_t('BlogEntry.AU'),$membername), new CompositeField( - new LiteralField("BBCodeHelper",""._t("BlogEntry.BBH")."
" ), + new LiteralField("BBCodeHelper",""._t("BlogEntry.BBH")."
" ), new TextareaField("Content", _t("BlogEntry.CN"),20), - new LiteralField("BBCodeTags","") + new LiteralField("BBCodeTags","
".$codeparser->useable_tagsHTML()."
") ), new TextField("Tags","Tags"), new LiteralField("Tagsnote","
- <% if CurrentMember %>

<% _t('EDITTHIS', 'Edit this post') %> | <% _t('UNPUBLISHTHIS', 'Unpublish this post') %>

<% end_if %> + + <% if CurrentMember %>

<% _t('EDITTHIS', 'Edit this post') %> | <% _t('UNPUBLISHTHIS', 'Unpublish this post') %>

<% end_if %> $PageComments -
From 9d959c64c0331bee4bae71065ee3d12fa57b4a69 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 21 Aug 2008 01:38:04 +0000 Subject: [PATCH 061/250] MINOR More whitespace cleanup --- templates/Layout/BlogHolder_post.ss | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/templates/Layout/BlogHolder_post.ss b/templates/Layout/BlogHolder_post.ss index 12532d6..283e85c 100644 --- a/templates/Layout/BlogHolder_post.ss +++ b/templates/Layout/BlogHolder_post.ss @@ -4,12 +4,8 @@
- <% include BreadCrumbs %> - - <% if isPost %> - - $BlogEntryForm - + <% if isPost %> + $BlogEntryForm <% end_if %>
\ No newline at end of file From c8448e70814e1afc855e7c57ff4a8ea522f93ccf Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 21 Aug 2008 01:39:04 +0000 Subject: [PATCH 062/250] MINOR fixed template messup in BlogHolder_post.ss --- templates/Layout/BlogHolder_post.ss | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/templates/Layout/BlogHolder_post.ss b/templates/Layout/BlogHolder_post.ss index 283e85c..c9d40a0 100644 --- a/templates/Layout/BlogHolder_post.ss +++ b/templates/Layout/BlogHolder_post.ss @@ -1,7 +1,4 @@ -
- <% include MainMenu %> - $SideBar -
+<% include BlogSideBar %>
<% include BreadCrumbs %> From 5fe008c89933356fa3fce1d28139fdcde01e20e8 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 21 Aug 2008 01:39:51 +0000 Subject: [PATCH 063/250] MINOR more and more whitespace cleanup --- templates/Layout/BlogHolder_post.ss | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/Layout/BlogHolder_post.ss b/templates/Layout/BlogHolder_post.ss index c9d40a0..09961da 100644 --- a/templates/Layout/BlogHolder_post.ss +++ b/templates/Layout/BlogHolder_post.ss @@ -2,6 +2,7 @@
<% include BreadCrumbs %> + <% if isPost %> $BlogEntryForm <% end_if %> From c4e0905ab45bdb9014ee0e47c056e962097a7413 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 21 Aug 2008 21:59:54 +0000 Subject: [PATCH 064/250] --- templates/Includes/BlogSummary.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/Includes/BlogSummary.ss b/templates/Includes/BlogSummary.ss index ff838fa..414ea2c 100644 --- a/templates/Includes/BlogSummary.ss +++ b/templates/Includes/BlogSummary.ss @@ -9,6 +9,6 @@ <% end_control %>

<% end_if %> -

$ParagraphSummary

+ $ParagraphSummary

$Comments.Count comments | Read the full post

From 203acb4ab7382ebad6fb9a8385b9da8ac4bdb648 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Fri, 29 Aug 2008 04:32:36 +0000 Subject: [PATCH 065/250] BUGFIX BlogEntry ParsedContent had doubled up paragraph tags --- templates/Layout/BlogEntry.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/Layout/BlogEntry.ss b/templates/Layout/BlogEntry.ss index bafbab2..97aca53 100644 --- a/templates/Layout/BlogEntry.ss +++ b/templates/Layout/BlogEntry.ss @@ -13,7 +13,7 @@ <% end_control %>

<% end_if %> -

$ParsedContent

+ $ParsedContent
From fffc4d6b77364cef3dfcc563a8fe2eea979f72d8 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 3 Sep 2008 23:57:40 +0000 Subject: [PATCH 066/250] ENHANCEMENT Allow Blog RSS feed to be named by CMS field on BlogHolder. If it's not set, then fall back to using "mysite blog" or whatever the global $project variable is set to --- code/BlogHolder.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 17ca732..9817ae4 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -14,6 +14,7 @@ class BlogHolder extends Page { static $db = array( "LandingPageFreshness" => "Varchar", + "Name" => "Varchar" ); static $has_one = array( @@ -32,7 +33,8 @@ class BlogHolder extends Page { $fields = parent::getCMSFields(); $fields->removeFieldFromTab("Root.Content.Main","Content"); $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("SideBar")); - + $fields->addFieldToTab("Root.Content.Main", new TextField("Name", "Name of blog")); + $fields->addFieldToTab('Root.Content.Main', new DropdownField('LandingPageFreshness', 'When you first open the blog, how many entries should I show', array( "" => "All entries", "1 MONTH" => "Last month's entries", @@ -260,9 +262,13 @@ class BlogHolder_Controller extends Page_Controller { */ function rss() { global $project; + + $blogName = $this->Name; + $altBlogName = $project . ' blog'; + $children = $this->Children(); $children->sort('Date', 'DESC'); - $rss = new RSSFeed($children, $this->Link(), $project . " blog", "", "Title", "ParsedContent"); + $rss = new RSSFeed($children, $this->Link(), ($blogName ? $blogName : $altBlogName), "", "Title", "ParsedContent"); $rss->outputToBrowser(); } From 25735591bdfe5929ab29715e4f4bfa85ef6a6a0c Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 4 Sep 2008 00:02:09 +0000 Subject: [PATCH 067/250] ENHANCEMENT Added default english text for POSTEDBY language entity --- templates/Includes/BlogSummary.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/Includes/BlogSummary.ss b/templates/Includes/BlogSummary.ss index 414ea2c..7904a6b 100644 --- a/templates/Includes/BlogSummary.ss +++ b/templates/Includes/BlogSummary.ss @@ -1,6 +1,6 @@

$MenuTitle

-

<% _t('POSTEDBY') %> $Author.XML <% _t('POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('COMMENTS', 'Comments') %>

+

<% _t('POSTEDBY', 'Posted by') %> $Author.XML <% _t('POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('COMMENTS', 'Comments') %>

<% if TagsCollection %>

Tags: From f9aa8d9ab2ea50cfc7266d1671e335c9eecb9948 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Thu, 11 Sep 2008 23:36:15 +0000 Subject: [PATCH 068/250] Use MONTH() and YEAR() SQL functions to check date on entries. Refactored BlogEntries() to be more testable. Added tests for Entries(). --- code/BlogHolder.php | 76 ++++++++++++++++++++++++++-------------- tests/BlogHolderTest.php | 57 ++++++++++++++++++++++++++++++ tests/BlogTest.yml | 28 +++++++++++++++ 3 files changed, 135 insertions(+), 26 deletions(-) create mode 100644 tests/BlogHolderTest.php create mode 100644 tests/BlogTest.yml diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 9817ae4..07ef73f 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -55,43 +55,39 @@ class BlogHolder extends Page { } /** - * The DataObject of blog entries + * Get entries in this blog. + * @param string limit A clause to insert into the limit clause. + * @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' + * @return DataObjectSet */ - public function BlogEntries($limit = 10) { - $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; + public function Entries($limit = '', $tag = '', $date = '') { $tagCheck = ''; - $dateCheck = ""; + $dateCheck = ''; - if(isset($_GET['tag'])) { - $tag = addslashes($_GET['tag']); - $tag = str_replace(array("\\",'_','%',"'"), array("\\\\","\\_","\\%","\\'"), $tag); + if($tag) { + $SQL_tag = addslashes($tag); + $SQL_tag = str_replace(array("\\",'_','%',"'"), array("\\\\","\\_","\\%","\\'"), $tag); $tagCheck = "AND `BlogEntry`.Tags LIKE '%$tag%'"; } - - if(Director::urlParams()){ - if(Director::urlParam('Action') == 'tag') { - $tag = addslashes(Director::urlParam('ID')); - $tag = str_replace(array("\\",'_','%',"'"), array("\\\\","\\_","\\%","\\'"), $tag); - $tagCheck = "AND `BlogEntry`.Tags LIKE '%$tag%'"; - } else { - $year = Director::urlParam('Action'); - $month = Director::urlParam('ID'); + if($date) { + if(strpos($date, '-')) { + $year = (int) substr($date, 0, strpos($date, '-')); + $month = (int) substr($date, strpos($date, '-') + 1); - if(is_numeric($month) && is_numeric($month)){ - $nextyear = ($month==12) ? $year + 1 : $year; - $nextmonth = $month % 12 + 1; - $dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-$month-1' AND '$nextyear-$nextmonth-1'"; - } else if(isset($year)){ - $nextyear = $year + 1; - $dateCheck = "AND `BlogEntry`.Date BETWEEN '$year-1-1' AND '".$nextyear."-1-1'"; - } else if($this->LandingPageFreshness) { - $dateCheck = "AND `BlogEntry`.Date > NOW() - INTERVAL " . $this->LandingPageFreshness; + if($year && $month) { + $dateCheck = "AND MONTH(`BlogEntry`.Date) = $month AND YEAR(`BlogEntry`.Date) = $year"; + } + } else { + $year = (int) $date; + if($year) { + $dateCheck = "AND YEAR(`BlogEntry`.Date) = $year"; } } } - return DataObject::get("Page","`ParentID` = $this->ID AND ShowInMenus = 1 $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$start, $limit"); + return DataObject::get("Page","`ParentID` = $this->ID AND ShowInMenus = 1 $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$limit"); } /** @@ -227,6 +223,34 @@ class BlogHolder_Controller extends Page_Controller { } + function BlogEntries($limit = 10) { + $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; + $tag = ''; + $date = ''; + + if(isset($_GET['tag'])) { + $tag = $_GET['tag']; + } + + + if(Director::urlParams()){ + if(Director::urlParam('Action') == 'tag') { + $tag = Director::urlParam('ID'); + } else { + $year = Director::urlParam('Action'); + $month = Director::urlParam('ID'); + + if($month && is_numeric($month) && $month >= 1 && $month <= 12 && is_numeric($year)) { + $date = "$year-$month"; + } else if(is_numeric($year)) { + $date = $year; + } + } + } + + return $this->Entries(array('start' => $start, 'limit' => $limit), $tag, $date); + } + /** * Gets the archived blogs for a particular month or year, in the format /year/month/ eg: /2008/10/ */ diff --git a/tests/BlogHolderTest.php b/tests/BlogHolderTest.php new file mode 100644 index 0000000..fe2c179 --- /dev/null +++ b/tests/BlogHolderTest.php @@ -0,0 +1,57 @@ +fixture->objFromFixture('BlogHolder', 'mainblog'); + + $this->assertEquals($mainblog->Entries()->Count(), 3); + } + + function testEntriesByMonth() { + $mainblog = $this->fixture->objFromFixture('BlogHolder', 'mainblog'); + + $entries = $mainblog->Entries('', '', '2008-01'); + $this->assertEquals($entries->Count(), 2); + $expectedEntries = array( + 'test-post-2', + 'test-post-3' + ); + + foreach($entries as $entry) { + $this->assertContains($entry->URLSegment, $expectedEntries); + } + } + + function textEntriesByYear() { + $mainblog = $this->fixture->objFromFixture('BlogHolder', 'mainblog'); + + $entries = $mainblog->Entries('', '', '2007'); + $this->assertEquals($entries->Count(), 1); + $expectedEntries = array( + 'test-post' + ); + + foreach($entries as $entry) { + $this->assertContains($entry->URLSegment, $expectedEntries); + } + } + + function testEntriesByTag() { + $mainblog = $this->fixture->objFromFixture('BlogHolder', 'mainblog'); + + $entries = $mainblog->Entries('', 'tag1'); + $this->assertEquals($entries->Count(), 2); + $expectedEntries = array( + 'test-post', + 'test-post-3' + ); + + foreach($entries as $entry) { + $this->assertContains($entry->URLSegment, $expectedEntries); + } + } +} + +?> diff --git a/tests/BlogTest.yml b/tests/BlogTest.yml new file mode 100644 index 0000000..1d49fe6 --- /dev/null +++ b/tests/BlogTest.yml @@ -0,0 +1,28 @@ +BlogHolder: + mainblog: + Title: Main Blog + otherblog: + Title: Other Blog + +BlogEntry: + testpost: + Title: Test Post + URLSegment: test-post + Date: 2007-02-17 18:45:00 + Parent: =>BlogHolder.mainblog + Tags: tag1,tag2 + testpost2: + Title: Test Post 2 + URLSegment: test-post-2 + Date: 2008-01-31 20:48:00 + Parent: =>BlogHolder.mainblog + Tags: tag2,tag3 + testpost3: + Title: Test Post 3 + URLSegment: test-post-3 + Date: 2008-01-17 18:45:00 + Parent: =>BlogHolder.mainblog + Tags: tag1,tag2,tag3 + + + From b05a3a2cc6ea816c215a9f3266dd6b83d92dbf39 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Fri, 12 Sep 2008 02:09:13 +0000 Subject: [PATCH 069/250] FEATURE: Added receiving of TrackPack pings --- code/BlogEntry.php | 5 ++- code/BlogHolder.php | 2 +- code/TrackBackDecorator.php | 53 ++++++++++++++++++++++++++++++++ code/TrackBackPing.php | 16 ++++++++++ templates/Includes/TrackBacks.ss | 15 +++++++++ templates/Layout/BlogEntry.ss | 3 +- templates/TrackBackPingReturn.ss | 5 +++ templates/TrackBackRdf.ss | 3 ++ 8 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 code/TrackBackDecorator.php create mode 100644 code/TrackBackPing.php create mode 100644 templates/Includes/TrackBacks.ss create mode 100644 templates/TrackBackPingReturn.ss create mode 100644 templates/TrackBackRdf.ss diff --git a/code/BlogEntry.php b/code/BlogEntry.php index a175017..e3fa3de 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -8,7 +8,6 @@ * An individual blog entry page to show a blog entry in full */ class BlogEntry extends Page { - static $default_parent = array('BlogHolder'); static $can_be_root = false; @@ -28,6 +27,10 @@ class BlogEntry extends Page { static $defaults = array( "ProvideComments" => true ); + + static $extensions = array( + 'TrackBackDecorator' + ); static $allowed_children = "none"; diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 07ef73f..04b04e6 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -248,7 +248,7 @@ class BlogHolder_Controller extends Page_Controller { } } - return $this->Entries(array('start' => $start, 'limit' => $limit), $tag, $date); + return $this->Entries("$start,$limit", $tag, $date); } /** diff --git a/code/TrackBackDecorator.php b/code/TrackBackDecorator.php new file mode 100644 index 0000000..436a48b --- /dev/null +++ b/code/TrackBackDecorator.php @@ -0,0 +1,53 @@ + array( + 'TrackBacks' => 'TrackBackPing' + ) + ); + } + + function updateMetaTags(&$tags) { + $tags .= $this->owner->renderWith('TrackBackRdf'); + } + + function TrackBackPingLink() { + return $this->owner->AbsoluteLink() . 'trackbackping'; + } + + function trackbackping() { + $error = 0; + $message = ''; + + if(!(isset($_POST['url']) && $_POST['url'])) { + $error = 1; + $message = 'Missing required POST parameter \'url\'.'; + } else { + $trackbackping = new TrackBackPing(); + $trackbackping->Url = $_POST['url']; + if(isset($_POST['title']) && $_POST['title']) { + $trackbackping->Title = $_POST['title']; + } + if(isset($_POST['excerpt']) && $_POST['excerpt']) { + $trackbackping->Excerpt = $_POST['excerpt']; + } + if(isset($_POST['blog_name']) && $_POST['blog_name']) { + $trackbackping->BlogName = $_POST['blog_name']; + } + $trackbackping->PageID = $this->owner->ID; + $trackbackping->write(); + } + + $returnData = new ArrayData(array( + 'Error' => $error, + 'Message' => $message + )); + + return $returnData->renderWith('TrackBackPingReturn'); + } +} + + +?> diff --git a/code/TrackBackPing.php b/code/TrackBackPing.php new file mode 100644 index 0000000..900a50a --- /dev/null +++ b/code/TrackBackPing.php @@ -0,0 +1,16 @@ + 'Varchar', + 'Excerpt' => 'Text', + 'Url' => 'Varchar', + 'BlogName' => 'Varchar' + ); + + static $has_one = array( + 'Page' => 'Page' + ); +} + +?> diff --git a/templates/Includes/TrackBacks.ss b/templates/Includes/TrackBacks.ss new file mode 100644 index 0000000..7ae6e7d --- /dev/null +++ b/templates/Includes/TrackBacks.ss @@ -0,0 +1,15 @@ +<% if TrackBacks %> +

+

TrackBacks

+ + + +
+<% end_if %> diff --git a/templates/Layout/BlogEntry.ss b/templates/Layout/BlogEntry.ss index 97aca53..9551141 100644 --- a/templates/Layout/BlogEntry.ss +++ b/templates/Layout/BlogEntry.ss @@ -18,6 +18,7 @@
<% if CurrentMember %>

<% _t('EDITTHIS', 'Edit this post') %> | <% _t('UNPUBLISHTHIS', 'Unpublish this post') %>

<% end_if %> - + + <% include TrackBacks %> $PageComments
diff --git a/templates/TrackBackPingReturn.ss b/templates/TrackBackPingReturn.ss new file mode 100644 index 0000000..b31f395 --- /dev/null +++ b/templates/TrackBackPingReturn.ss @@ -0,0 +1,5 @@ + + + $Error + <% if Message %>$Message<% end_if %> + diff --git a/templates/TrackBackRdf.ss b/templates/TrackBackRdf.ss new file mode 100644 index 0000000..62c73b6 --- /dev/null +++ b/templates/TrackBackRdf.ss @@ -0,0 +1,3 @@ + + + From 0e38bbc1cda717d221f137bdcc876f300f212ee6 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Fri, 12 Sep 2008 02:13:49 +0000 Subject: [PATCH 070/250] Show TrackBack ping URL --- templates/Includes/TrackBacks.ss | 35 ++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/templates/Includes/TrackBacks.ss b/templates/Includes/TrackBacks.ss index 7ae6e7d..77210c5 100644 --- a/templates/Includes/TrackBacks.ss +++ b/templates/Includes/TrackBacks.ss @@ -1,15 +1,20 @@ -<% if TrackBacks %> -
-

TrackBacks

- - - -
-<% end_if %> +
+

TrackBacks

+ + <% if TrackBacks %> + + <% else %> +

No TrackBacks have been submitted for this page.

+ <% end_if %> + + Trackback URL for this page. + +
+ From e6c0d70d994dee85e41aa5fa790702ded476cae8 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Mon, 15 Sep 2008 03:59:39 +0000 Subject: [PATCH 071/250] BUGFIX Missing Hierarchy and Versioned extensions because of overloaded $extensions variable --- code/BlogEntry.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index e3fa3de..1b8bbcd 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -29,7 +29,9 @@ class BlogEntry extends Page { ); static $extensions = array( - 'TrackBackDecorator' + 'Hierarchy', + 'TrackBackDecorator', + "Versioned('Stage', 'Live')" ); static $allowed_children = "none"; From 7143e2753d92263d58baeb5b6e611c4f3674c36c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 16 Sep 2008 22:59:59 +0000 Subject: [PATCH 072/250] MINOR Added or updated README information (mostly with maintainer contact) --- README | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 README diff --git a/README b/README new file mode 100644 index 0000000..4e45cdf --- /dev/null +++ b/README @@ -0,0 +1,19 @@ +#################################################### +Blog Moudle +#################################################### + +# Maintainer Contact +Andrew O'Neil (Nickname: aoneil) + + +# Requirements +... + +# Documentation +http://doc.silverstripe.com/doku.php?id=modules:blog + +# Installation Instructions +... + +# Usage Overview +... \ No newline at end of file From c17a1ffb2849982d7f531370aa6b8e27724977d0 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 8 Oct 2008 14:03:01 +0000 Subject: [PATCH 073/250] MINOR Updated language master table --- lang/en_US.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lang/en_US.php b/lang/en_US.php index cb75943..94058f6 100644 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -33,6 +33,7 @@ $lang['en_US']['TagCloudWidget']['SBFREQ'] = 'frequency'; $lang['en_US']['BlogManagementWidget.ss']['POSTNEW'] = 'Post a new blog entry'; $lang['en_US']['BlogManagementWidget.ss']['LOGOUT'] = 'Logout'; $lang['en_US']['BlogSummary.ss']['VIEWFULL'] = 'View full post titled -'; +$lang['en_US']['BlogSummary.ss']['POSTEDBY'] = 'Posted by'; $lang['en_US']['BlogSummary.ss']['POSTEDON'] = 'on'; $lang['en_US']['BlogSummary.ss']['COMMENTS'] = 'Comments'; $lang['en_US']['BlogEntry.ss']['POSTEDBY'] = 'Posted by'; From 7798cd0afba15a237cdd96d4267fe373152d93dc Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 8 Oct 2008 15:15:23 +0000 Subject: [PATCH 074/250] MINOR Updated entities from translate.silverstripe.com --- lang/ar_SA.php | 62 +++++++++++++++++++++++++++++++ lang/bg_BG.php | 62 +++++++++++++++++++++++++++++++ lang/da_DK.php | 61 ++++++++++++++++++++++++++++++ lang/de_DE.php | 61 ++++++++++++++++++++++++++++++ lang/en_GB.php | 62 +++++++++++++++++++++++++++++++ lang/es_419.php | 20 ++++++++++ lang/es_ES.php | 39 +++++++++++++++++++ lang/es_MX.php | 62 +++++++++++++++++++++++++++++++ lang/et_EE.php | 62 +++++++++++++++++++++++++++++++ lang/fr_FR.php | 62 +++++++++++++++++++++++++++++++ lang/hr_HR.php | 56 ++++++++++++++++++++++++++++ lang/is_IS.php | 63 +++++++++++++++++++++++++++++++ lang/it_IT.php | 32 ++++++++++++++++ lang/nl_NL.php | 37 ++++++++++++++++++ lang/pl_PL.php | 62 +++++++++++++++++++++++++++++++ lang/pt_PT.php | 40 ++++++++++++++++++++ lang/ru_RU.php | 99 ++++++++++++++++++++++++++++--------------------- lang/sr_RS.php | 58 +++++++++++++++++++++++++++++ lang/tr_TR.php | 62 +++++++++++++++++++++++++++++++ 19 files changed, 1020 insertions(+), 42 deletions(-) create mode 100644 lang/ar_SA.php create mode 100644 lang/bg_BG.php create mode 100644 lang/da_DK.php create mode 100644 lang/de_DE.php create mode 100644 lang/en_GB.php create mode 100644 lang/es_419.php create mode 100644 lang/es_ES.php create mode 100644 lang/es_MX.php create mode 100644 lang/et_EE.php create mode 100644 lang/fr_FR.php create mode 100644 lang/hr_HR.php create mode 100644 lang/is_IS.php create mode 100644 lang/it_IT.php create mode 100644 lang/nl_NL.php create mode 100644 lang/pl_PL.php create mode 100644 lang/pt_PT.php create mode 100644 lang/sr_RS.php create mode 100644 lang/tr_TR.php diff --git a/lang/ar_SA.php b/lang/ar_SA.php new file mode 100644 index 0000000..b9fc088 --- /dev/null +++ b/lang/ar_SA.php @@ -0,0 +1,62 @@ + \ No newline at end of file diff --git a/lang/bg_BG.php b/lang/bg_BG.php new file mode 100644 index 0000000..72f9d65 --- /dev/null +++ b/lang/bg_BG.php @@ -0,0 +1,62 @@ + \ No newline at end of file diff --git a/lang/da_DK.php b/lang/da_DK.php new file mode 100644 index 0000000..0ce46e3 --- /dev/null +++ b/lang/da_DK.php @@ -0,0 +1,61 @@ + \ No newline at end of file diff --git a/lang/de_DE.php b/lang/de_DE.php new file mode 100644 index 0000000..5803db9 --- /dev/null +++ b/lang/de_DE.php @@ -0,0 +1,61 @@ + \ No newline at end of file diff --git a/lang/en_GB.php b/lang/en_GB.php new file mode 100644 index 0000000..671fb1a --- /dev/null +++ b/lang/en_GB.php @@ -0,0 +1,62 @@ + \ No newline at end of file diff --git a/lang/es_419.php b/lang/es_419.php new file mode 100644 index 0000000..27d8ebb --- /dev/null +++ b/lang/es_419.php @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/lang/es_ES.php b/lang/es_ES.php new file mode 100644 index 0000000..6f2645d --- /dev/null +++ b/lang/es_ES.php @@ -0,0 +1,39 @@ + \ No newline at end of file diff --git a/lang/es_MX.php b/lang/es_MX.php new file mode 100644 index 0000000..915a34d --- /dev/null +++ b/lang/es_MX.php @@ -0,0 +1,62 @@ + \ No newline at end of file diff --git a/lang/et_EE.php b/lang/et_EE.php new file mode 100644 index 0000000..c0dd740 --- /dev/null +++ b/lang/et_EE.php @@ -0,0 +1,62 @@ + \ No newline at end of file diff --git a/lang/fr_FR.php b/lang/fr_FR.php new file mode 100644 index 0000000..1f66042 --- /dev/null +++ b/lang/fr_FR.php @@ -0,0 +1,62 @@ + \ No newline at end of file diff --git a/lang/hr_HR.php b/lang/hr_HR.php new file mode 100644 index 0000000..cde02fb --- /dev/null +++ b/lang/hr_HR.php @@ -0,0 +1,56 @@ + \ No newline at end of file diff --git a/lang/is_IS.php b/lang/is_IS.php new file mode 100644 index 0000000..26e5236 --- /dev/null +++ b/lang/is_IS.php @@ -0,0 +1,63 @@ + \ No newline at end of file diff --git a/lang/it_IT.php b/lang/it_IT.php new file mode 100644 index 0000000..020d24f --- /dev/null +++ b/lang/it_IT.php @@ -0,0 +1,32 @@ + \ No newline at end of file diff --git a/lang/nl_NL.php b/lang/nl_NL.php new file mode 100644 index 0000000..35afd06 --- /dev/null +++ b/lang/nl_NL.php @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/lang/pl_PL.php b/lang/pl_PL.php new file mode 100644 index 0000000..2c6a555 --- /dev/null +++ b/lang/pl_PL.php @@ -0,0 +1,62 @@ + \ No newline at end of file diff --git a/lang/pt_PT.php b/lang/pt_PT.php new file mode 100644 index 0000000..63eae9b --- /dev/null +++ b/lang/pt_PT.php @@ -0,0 +1,40 @@ + \ No newline at end of file diff --git a/lang/ru_RU.php b/lang/ru_RU.php index bd15a69..5f4ac94 100644 --- a/lang/ru_RU.php +++ b/lang/ru_RU.php @@ -1,47 +1,62 @@ +$lang['ru_RU']['ArchiveWidget']['DispBY'] = 'Группировать по'; +$lang['ru_RU']['ArchiveWidget']['MONTH'] = 'меÑÑцу'; +$lang['ru_RU']['ArchiveWidget']['YEAR'] = 'году'; +$lang['ru_RU']['BlogEntry']['AU'] = 'Ðвтор'; +$lang['ru_RU']['BlogEntry']['BBH'] = 'ПодÑказка по BBCode'; +$lang['ru_RU']['BlogEntry']['CN'] = 'Содержимое'; +$lang['ru_RU']['BlogEntry']['DT'] = 'Дата'; +$lang['ru_RU']['BlogEntry.ss']['COMMENTS'] = 'Комментарии'; +$lang['ru_RU']['BlogEntry.ss']['EDITTHIS'] = 'Редакт. Ñту запиÑÑŒ'; +$lang['ru_RU']['BlogEntry.ss']['POSTEDBY'] = 'Ðвтор: '; +$lang['ru_RU']['BlogEntry.ss']['POSTEDON'] = ':'; +$lang['ru_RU']['BlogEntry.ss']['TAGS'] = 'Метки:'; +$lang['ru_RU']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Убрать запиÑÑŒ Ñ Ð¾Ð¿ÑƒÐ±Ð»Ð¸ÐºÐ¾Ð². Ñайта'; +$lang['ru_RU']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Смотреть вÑе запиÑи Ñ Ð¼ÐµÑ‚ÐºÐ°Ð¼Ð¸'; +$lang['ru_RU']['BlogEntry']['TS'] = 'Метки (раздел. запÑÑ‚.)'; +$lang['ru_RU']['BlogHolder']['HAVENTPERM'] = 'ÐŸÑƒÐ±Ð»Ð¸ÐºÐ°Ñ†Ð¸Ñ Ð·Ð°Ð¿Ð¸Ñей в блоге доÑтупна только админиÑтратору. ПожалуйÑта, войдите.'; +$lang['ru_RU']['BlogHolder']['POST'] = 'Опубликовать запиÑÑŒ в блоге'; +$lang['ru_RU']['BlogHolder']['RSSFEED'] = 'RSS подпиÑка на Ñтот блог'; +$lang['ru_RU']['BlogHolder']['SJ'] = 'Тема'; +$lang['ru_RU']['BlogHolder']['SPUC'] = 'РазделÑйте метки запÑтыми.'; +$lang['ru_RU']['BlogHolder.ss']['NOENTRIES'] = 'Ð’ блоге нет запиÑей'; +$lang['ru_RU']['BlogHolder.ss']['VIEWINGTAGGED'] = 'ПроÑмотр запиÑей Ñ Ð¼ÐµÑ‚ÐºÐ°Ð¼Ð¸ '; +$lang['ru_RU']['BlogHolder']['SUCCONTENT'] = 'ПоздравлÑем, модуль блога SilverStripe был уÑпешно уÑтановлен. Эта запиÑÑŒ в блоге может быть удалена. Ð’Ñ‹ можете наÑтроить вид блога (например, отображение виджетов в боковой панели) в [url=admin]СиÑтеме Ð£Ð¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¡Ð¾Ð´ÐµÑ€Ð¶Ð¸Ð¼Ñ‹Ð¼[/url].'; +$lang['ru_RU']['BlogHolder']['SUCTAGS'] = 'silverstripe, блог'; +$lang['ru_RU']['BlogHolder']['SUCTITLE'] = 'Модуль блога SilverStripe уÑпешно уÑтановлен'; +$lang['ru_RU']['BlogHolder']['TE'] = 'Ðапример, Ñпорт, личное, фантаÑтика'; +$lang['ru_RU']['BlogManagementWidget']['COMADM'] = 'Управление комментариÑми'; +$lang['ru_RU']['BlogManagementWidget.ss']['LOGOUT'] = 'Выход'; +$lang['ru_RU']['BlogManagementWidget.ss']['POSTNEW'] = 'Опубликовать новую запиÑÑŒ'; +$lang['ru_RU']['BlogManagementWidget']['UNM1'] = 'У Ð²Ð°Ñ 1 непроверенный комментарий'; +$lang['ru_RU']['BlogManagementWidget']['UNMM'] = 'У Ð²Ð°Ñ %i непроверенных комментариев'; +$lang['ru_RU']['BlogSummary.ss']['COMMENTS'] = 'Комментарии'; +$lang['ru_RU']['BlogSummary.ss']['POSTEDON'] = ':'; +$lang['ru_RU']['BlogSummary.ss']['VIEWFULL'] = 'См. полноÑтью запиÑÑŒ под названием: '; +$lang['ru_RU']['RSSWidget']['CT'] = 'СобÑтвенное название ленты новоÑтей'; +$lang['ru_RU']['RSSWidget']['NTS'] = 'Показывать кол-во запиÑей'; +$lang['ru_RU']['RSSWidget']['URL'] = 'URL ленты RSS'; +$lang['ru_RU']['TagCloudWidget']['LIMIT'] = 'Ограничить кол-во меток'; +$lang['ru_RU']['TagCloudWidget']['SBAL'] = 'алфавиту'; +$lang['ru_RU']['TagCloudWidget']['SBFREQ'] = 'чаÑтоте'; +$lang['ru_RU']['TagCloudWidget']['SORTBY'] = 'Сортировать по'; +$lang['ru_RU']['TagCloudWidget']['TILE'] = 'Ðазвание'; + +?> \ No newline at end of file diff --git a/lang/sr_RS.php b/lang/sr_RS.php new file mode 100644 index 0000000..e11b271 --- /dev/null +++ b/lang/sr_RS.php @@ -0,0 +1,58 @@ + \ No newline at end of file diff --git a/lang/tr_TR.php b/lang/tr_TR.php new file mode 100644 index 0000000..0244791 --- /dev/null +++ b/lang/tr_TR.php @@ -0,0 +1,62 @@ + \ No newline at end of file From 4f7c9b34d2d2208942e3000ecdf5ab18549bf7b0 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 16 Oct 2008 08:45:38 +0000 Subject: [PATCH 075/250] MINOR Misc deprecation fixes --- code/BlogHolder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 04b04e6..58acc8a 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -345,7 +345,7 @@ class BlogEntry_Form extends Form { $blogentry->writeToStage("Stage"); $blogentry->publish("Stage", "Live"); - Director::redirect(Director::currentURLSegment()); + Director::redirect($this->controller->Link()); } } From d3c7ad41fdd30b5718bb010737408b7aca33ca01 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 16 Oct 2008 13:46:59 +0000 Subject: [PATCH 076/250] BUGFIX Fixing usage of deprecated APIs --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 1b8bbcd..4464925 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -15,7 +15,7 @@ class BlogEntry extends Page { static $icon = "blog/images/blogpage"; static $db = array( - "Date" => "Datetime", + "Date" => "SSDatetime", "Author" => "Text", "Tags" => "Text" ); From 16736e25a4d728b324552eb2f758d941584275d4 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 23 Oct 2008 23:07:19 +0000 Subject: [PATCH 077/250] BUGFIX Check if SimplePie exists before attempting to create a new instance of it, since it's a 3rd party class --- code/RSSWidget.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/code/RSSWidget.php b/code/RSSWidget.php index 306865c..77be619 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -44,16 +44,19 @@ class RSSWidget extends Widget { function FeedItems() { $output = new DataObjectSet(); - $this->feed = new SimplePie($this->AbsoluteRssUrl); - $this->feed->init(); - if($items = $this->feed->get_items(0, $this->NumberToShow)) { - foreach($items as $item) { - $output->push(new ArrayData(array( - "Title" => $item->get_title(), - "Link" => $item->get_link() - ))); + + if(class_exists('SimplePie')) { + $this->feed = new SimplePie($this->AbsoluteRssUrl); + $this->feed->init(); + if($items = $this->feed->get_items(0, $this->NumberToShow)) { + foreach($items as $item) { + $output->push(new ArrayData(array( + "Title" => $item->get_title(), + "Link" => $item->get_link() + ))); + } + return $output; } - return $output; } } } From c3331581ee44afba573226bd0321d33a385d99c6 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Fri, 24 Oct 2008 00:05:01 +0000 Subject: [PATCH 078/250] MINOR whitespace change --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 4464925..dfdd743 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -133,7 +133,7 @@ class BlogEntry extends Page { } else { $parser = new BBCodeParser($this->Content); $content = new Text('Content'); - $content->value =$parser->parse(); + $content->value = $parser->parse(); return $content; } } From 8f037c46283b11866abf83127e04eaab7a4e3172 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Mon, 27 Oct 2008 07:06:39 +0000 Subject: [PATCH 079/250] BUGFIX: default child needs to be a string rather then an array --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index dfdd743..a89c3b7 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -8,7 +8,7 @@ * An individual blog entry page to show a blog entry in full */ class BlogEntry extends Page { - static $default_parent = array('BlogHolder'); + static $default_parent = 'BlogHolder'; static $can_be_root = false; From d8cb2aee29e6cb3488f458925ca9c18a0ace0442 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 1 Nov 2008 15:25:39 +0000 Subject: [PATCH 080/250] MINOR Collecting entities for language master table with new i18nTextCollector functionality. The table is now sorted alphabetically by namespace and entity. Entities now include more translatable statics from DataObject subclasses like $db, $has_one etc. --- lang/en_US.php | 214 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 182 insertions(+), 32 deletions(-) diff --git a/lang/en_US.php b/lang/en_US.php index 94058f6..ee9d696 100644 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -4,46 +4,196 @@ global $lang; $lang['en_US']['ArchiveWidget']['DispBY'] = 'Display by'; $lang['en_US']['ArchiveWidget']['MONTH'] = 'month'; +$lang['en_US']['ArchiveWidget']['PLURALNAME'] = array( + 'Archive Widgets', + 50, + 'Pural name of the object, used in dropdowns and to generally identify a collection of this object in the interface' +); +$lang['en_US']['ArchiveWidget']['SINGULARNAME'] = array( + 'Archive Widget', + 50, + 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' +); $lang['en_US']['ArchiveWidget']['YEAR'] = 'year'; -$lang['en_US']['BlogEntry']['CN'] = 'Content'; -$lang['en_US']['BlogEntry']['DT'] = 'Date'; +$lang['en_US']['ArchiveWidget']['db_DisplayMode'] = array( + 'DisplayMode', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); $lang['en_US']['BlogEntry']['AU'] = 'Author'; $lang['en_US']['BlogEntry']['BBH'] = 'BBCode help'; +$lang['en_US']['BlogEntry']['CN'] = 'Content'; +$lang['en_US']['BlogEntry']['DT'] = 'Date'; +$lang['en_US']['BlogEntry']['PLURALNAME'] = array( + 'Blog Entries', + 50, + 'Pural name of the object, used in dropdowns and to generally identify a collection of this object in the interface' +); +$lang['en_US']['BlogEntry']['SINGULARNAME'] = array( + 'Blog Entry', + 50, + 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' +); $lang['en_US']['BlogEntry']['TS'] = 'Tags (comma sep.)'; -$lang['en_US']['BlogHolder']['SJ'] = 'Subject'; -$lang['en_US']['BlogHolder']['TE'] = 'For example: sport, personal, science fiction'; -$lang['en_US']['BlogHolder']['SPUC'] = 'Please separate tags using commas.'; -$lang['en_US']['BlogHolder']['POST'] = 'Post blog entry'; -$lang['en_US']['BlogHolder']['SUCTITLE'] = 'SilverStripe blog module successfully installed'; -$lang['en_US']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; -$lang['en_US']['BlogHolder']['SUCCONTENT'] = 'Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in [url=admin]the CMS[/url].'; -$lang['en_US']['BlogHolder']['RSSFEED'] = 'RSS feed of this blog'; -$lang['en_US']['BlogHolder']['HAVENTPERM'] = 'Posting blogs is an administrator task. Please log in.'; -$lang['en_US']['BlogManagementWidget']['UNM1'] = 'You have 1 unmoderated comment'; -$lang['en_US']['BlogManagementWidget']['UNMM'] = 'You have %i unmoderated comments'; -$lang['en_US']['BlogManagementWidget']['COMADM'] = 'Comment administration'; -$lang['en_US']['RSSWidget']['CT'] = 'Custom title for the feed'; -$lang['en_US']['RSSWidget']['URL'] = 'URL of RSS Feed'; -$lang['en_US']['RSSWidget']['NTS'] = 'Number of Items to show'; -$lang['en_US']['TagCloudWidget']['TILE'] = 'Title'; -$lang['en_US']['TagCloudWidget']['LIMIT'] = 'Limit number of tags'; -$lang['en_US']['TagCloudWidget']['SORTBY'] = 'Sort by'; -$lang['en_US']['TagCloudWidget']['SBAL'] = 'alphabet'; -$lang['en_US']['TagCloudWidget']['SBFREQ'] = 'frequency'; -$lang['en_US']['BlogManagementWidget.ss']['POSTNEW'] = 'Post a new blog entry'; -$lang['en_US']['BlogManagementWidget.ss']['LOGOUT'] = 'Logout'; -$lang['en_US']['BlogSummary.ss']['VIEWFULL'] = 'View full post titled -'; -$lang['en_US']['BlogSummary.ss']['POSTEDBY'] = 'Posted by'; -$lang['en_US']['BlogSummary.ss']['POSTEDON'] = 'on'; -$lang['en_US']['BlogSummary.ss']['COMMENTS'] = 'Comments'; +$lang['en_US']['BlogEntry']['db_Author'] = array( + 'Author', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['BlogEntry']['db_Date'] = array( + 'Date', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['BlogEntry']['db_Tags'] = array( + 'Tags', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['BlogEntry.ss']['COMMENTS'] = 'Comments'; +$lang['en_US']['BlogEntry.ss']['EDITTHIS'] = 'Edit this post'; $lang['en_US']['BlogEntry.ss']['POSTEDBY'] = 'Posted by'; $lang['en_US']['BlogEntry.ss']['POSTEDON'] = 'on'; -$lang['en_US']['BlogEntry.ss']['COMMENTS'] = 'Comments'; $lang['en_US']['BlogEntry.ss']['TAGS'] = 'Tags:'; -$lang['en_US']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'View all posts tagged'; -$lang['en_US']['BlogEntry.ss']['EDITTHIS'] = 'Edit this post'; $lang['en_US']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Unpublish this post'; -$lang['en_US']['BlogHolder.ss']['VIEWINGTAGGED'] = 'Viewing entries tagged with'; +$lang['en_US']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'View all posts tagged'; +$lang['en_US']['BlogHolder']['HAVENTPERM'] = 'Posting blogs is an administrator task. Please log in.'; +$lang['en_US']['BlogHolder']['PLURALNAME'] = array( + 'Blog Holders', + 50, + 'Pural name of the object, used in dropdowns and to generally identify a collection of this object in the interface' +); +$lang['en_US']['BlogHolder']['POST'] = 'Post blog entry'; +$lang['en_US']['BlogHolder']['RSSFEED'] = 'RSS feed of this blog'; +$lang['en_US']['BlogHolder']['SINGULARNAME'] = array( + 'Blog Holder', + 50, + 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' +); +$lang['en_US']['BlogHolder']['SJ'] = 'Subject'; +$lang['en_US']['BlogHolder']['SPUC'] = 'Please separate tags using commas.'; +$lang['en_US']['BlogHolder']['SUCCONTENT'] = 'Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in [url=admin]the CMS[/url].'; +$lang['en_US']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; +$lang['en_US']['BlogHolder']['SUCTITLE'] = 'SilverStripe blog module successfully installed'; +$lang['en_US']['BlogHolder']['TE'] = 'For example: sport, personal, science fiction'; +$lang['en_US']['BlogHolder']['db_LandingPageFreshness'] = array( + 'LandingPageFreshness', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['BlogHolder']['db_Name'] = array( + 'Name', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); $lang['en_US']['BlogHolder.ss']['NOENTRIES'] = 'There are no blog entries'; +$lang['en_US']['BlogHolder.ss']['VIEWINGTAGGED'] = 'Viewing entries tagged with'; +$lang['en_US']['BlogManagementWidget']['COMADM'] = 'Comment administration'; +$lang['en_US']['BlogManagementWidget']['PLURALNAME'] = array( + 'Blog Management Widgets', + 50, + 'Pural name of the object, used in dropdowns and to generally identify a collection of this object in the interface' +); +$lang['en_US']['BlogManagementWidget']['SINGULARNAME'] = array( + 'Blog Management Widget', + 50, + 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' +); +$lang['en_US']['BlogManagementWidget']['UNM1'] = 'You have 1 unmoderated comment'; +$lang['en_US']['BlogManagementWidget']['UNMM'] = 'You have %i unmoderated comments'; +$lang['en_US']['BlogManagementWidget.ss']['LOGOUT'] = 'Logout'; +$lang['en_US']['BlogManagementWidget.ss']['POSTNEW'] = 'Post a new blog entry'; +$lang['en_US']['BlogSummary.ss']['COMMENTS'] = 'Comments'; +$lang['en_US']['BlogSummary.ss']['POSTEDBY'] = 'Posted by'; +$lang['en_US']['BlogSummary.ss']['POSTEDON'] = 'on'; +$lang['en_US']['BlogSummary.ss']['VIEWFULL'] = 'View full post titled -'; +$lang['en_US']['RSSWidget']['CT'] = 'Custom title for the feed'; +$lang['en_US']['RSSWidget']['NTS'] = 'Number of Items to show'; +$lang['en_US']['RSSWidget']['PLURALNAME'] = array( + 'R S S Widgets', + 50, + 'Pural name of the object, used in dropdowns and to generally identify a collection of this object in the interface' +); +$lang['en_US']['RSSWidget']['SINGULARNAME'] = array( + 'R S S Widget', + 50, + 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' +); +$lang['en_US']['RSSWidget']['URL'] = 'URL of RSS Feed'; +$lang['en_US']['RSSWidget']['db_NumberToShow'] = array( + 'NumberToShow', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['RSSWidget']['db_RSSTitle'] = array( + 'RSSTitle', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['RSSWidget']['db_RssUrl'] = array( + 'RssUrl', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['TagCloudWidget']['LIMIT'] = 'Limit number of tags'; +$lang['en_US']['TagCloudWidget']['PLURALNAME'] = array( + 'Tag Cloud Widgets', + 50, + 'Pural name of the object, used in dropdowns and to generally identify a collection of this object in the interface' +); +$lang['en_US']['TagCloudWidget']['SBAL'] = 'alphabet'; +$lang['en_US']['TagCloudWidget']['SBFREQ'] = 'frequency'; +$lang['en_US']['TagCloudWidget']['SINGULARNAME'] = array( + 'Tag Cloud Widget', + 50, + 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' +); +$lang['en_US']['TagCloudWidget']['SORTBY'] = 'Sort by'; +$lang['en_US']['TagCloudWidget']['TILE'] = 'Title'; +$lang['en_US']['TagCloudWidget']['db_Limit'] = array( + 'Limit', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['TagCloudWidget']['db_Sortby'] = array( + 'Sortby', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['TagCloudWidget']['db_Title'] = array( + 'Title', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['TrackBackPing']['PLURALNAME'] = array( + 'Track Back Pings', + 50, + 'Pural name of the object, used in dropdowns and to generally identify a collection of this object in the interface' +); +$lang['en_US']['TrackBackPing']['SINGULARNAME'] = array( + 'Track Back Ping', + 50, + 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' +); +$lang['en_US']['TrackBackPing']['db_BlogName'] = array( + 'BlogName', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['TrackBackPing']['db_Excerpt'] = array( + 'Excerpt', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['TrackBackPing']['db_Title'] = array( + 'Title', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); +$lang['en_US']['TrackBackPing']['db_Url'] = array( + 'Url', + 50, + 'Name of the object property, mainly used for automatically generating forms' +); ?> \ No newline at end of file From 095d410af4c91cf4516f140c19639d6155a04fbb Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 2 Nov 2008 20:09:19 +0000 Subject: [PATCH 081/250] MINOR Updated master language tables --- lang/en_US.php | 80 -------------------------------------------------- 1 file changed, 80 deletions(-) diff --git a/lang/en_US.php b/lang/en_US.php index ee9d696..00a64b6 100644 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -15,11 +15,6 @@ $lang['en_US']['ArchiveWidget']['SINGULARNAME'] = array( 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' ); $lang['en_US']['ArchiveWidget']['YEAR'] = 'year'; -$lang['en_US']['ArchiveWidget']['db_DisplayMode'] = array( - 'DisplayMode', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); $lang['en_US']['BlogEntry']['AU'] = 'Author'; $lang['en_US']['BlogEntry']['BBH'] = 'BBCode help'; $lang['en_US']['BlogEntry']['CN'] = 'Content'; @@ -35,21 +30,6 @@ $lang['en_US']['BlogEntry']['SINGULARNAME'] = array( 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' ); $lang['en_US']['BlogEntry']['TS'] = 'Tags (comma sep.)'; -$lang['en_US']['BlogEntry']['db_Author'] = array( - 'Author', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); -$lang['en_US']['BlogEntry']['db_Date'] = array( - 'Date', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); -$lang['en_US']['BlogEntry']['db_Tags'] = array( - 'Tags', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); $lang['en_US']['BlogEntry.ss']['COMMENTS'] = 'Comments'; $lang['en_US']['BlogEntry.ss']['EDITTHIS'] = 'Edit this post'; $lang['en_US']['BlogEntry.ss']['POSTEDBY'] = 'Posted by'; @@ -76,16 +56,6 @@ $lang['en_US']['BlogHolder']['SUCCONTENT'] = 'Congratulations, the SilverStripe $lang['en_US']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; $lang['en_US']['BlogHolder']['SUCTITLE'] = 'SilverStripe blog module successfully installed'; $lang['en_US']['BlogHolder']['TE'] = 'For example: sport, personal, science fiction'; -$lang['en_US']['BlogHolder']['db_LandingPageFreshness'] = array( - 'LandingPageFreshness', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); -$lang['en_US']['BlogHolder']['db_Name'] = array( - 'Name', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); $lang['en_US']['BlogHolder.ss']['NOENTRIES'] = 'There are no blog entries'; $lang['en_US']['BlogHolder.ss']['VIEWINGTAGGED'] = 'Viewing entries tagged with'; $lang['en_US']['BlogManagementWidget']['COMADM'] = 'Comment administration'; @@ -120,21 +90,6 @@ $lang['en_US']['RSSWidget']['SINGULARNAME'] = array( 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' ); $lang['en_US']['RSSWidget']['URL'] = 'URL of RSS Feed'; -$lang['en_US']['RSSWidget']['db_NumberToShow'] = array( - 'NumberToShow', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); -$lang['en_US']['RSSWidget']['db_RSSTitle'] = array( - 'RSSTitle', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); -$lang['en_US']['RSSWidget']['db_RssUrl'] = array( - 'RssUrl', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); $lang['en_US']['TagCloudWidget']['LIMIT'] = 'Limit number of tags'; $lang['en_US']['TagCloudWidget']['PLURALNAME'] = array( 'Tag Cloud Widgets', @@ -150,21 +105,6 @@ $lang['en_US']['TagCloudWidget']['SINGULARNAME'] = array( ); $lang['en_US']['TagCloudWidget']['SORTBY'] = 'Sort by'; $lang['en_US']['TagCloudWidget']['TILE'] = 'Title'; -$lang['en_US']['TagCloudWidget']['db_Limit'] = array( - 'Limit', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); -$lang['en_US']['TagCloudWidget']['db_Sortby'] = array( - 'Sortby', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); -$lang['en_US']['TagCloudWidget']['db_Title'] = array( - 'Title', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); $lang['en_US']['TrackBackPing']['PLURALNAME'] = array( 'Track Back Pings', 50, @@ -175,25 +115,5 @@ $lang['en_US']['TrackBackPing']['SINGULARNAME'] = array( 50, 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' ); -$lang['en_US']['TrackBackPing']['db_BlogName'] = array( - 'BlogName', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); -$lang['en_US']['TrackBackPing']['db_Excerpt'] = array( - 'Excerpt', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); -$lang['en_US']['TrackBackPing']['db_Title'] = array( - 'Title', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); -$lang['en_US']['TrackBackPing']['db_Url'] = array( - 'Url', - 50, - 'Name of the object property, mainly used for automatically generating forms' -); ?> \ No newline at end of file From c3c97201d4f28f1a9e66fcccc2d9bf3f7a6f19da Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 6 Nov 2008 00:35:10 +0000 Subject: [PATCH 082/250] BUGFIX Fixed possible Member::currentUser() problem with inconsistent function names --- code/BlogEntry.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index a89c3b7..6e67cdf 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -62,8 +62,9 @@ class BlogEntry extends Page { function getCMSFields() { Requirements::javascript('blog/javascript/bbcodehelp.js'); Requirements::css('blog/css/bbcodehelp.css'); - $firstName = Member::CurrentMember() ? Member::currentMember()->FirstName : ''; - $codeparser = new BBCodeParser(); + + $firstName = Member::currentUser() ? Member::currentUser()->FirstName : ''; + $codeparser = new BBCodeParser(); $fields = parent::getCMSFields(); @@ -141,7 +142,7 @@ class BlogEntry extends Page { /** * Link for editing this blog entry */ - function EditURL(){ + function EditURL() { return $this->getParent()->Link('post')."/".$this->ID."/"; } From 224fe02c3b03cfe20dd6037e4d42306126fa86f5 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 6 Nov 2008 00:36:58 +0000 Subject: [PATCH 083/250] BUGFIX Fixed some potential security issues in BlogHolder page type --- code/BlogHolder.php | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 58acc8a..c3027af 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -53,7 +53,7 @@ class BlogHolder extends Page { return $fields; } - + /** * Get entries in this blog. * @param string limit A clause to insert into the limit clause. @@ -66,9 +66,8 @@ class BlogHolder extends Page { $dateCheck = ''; if($tag) { - $SQL_tag = addslashes($tag); - $SQL_tag = str_replace(array("\\",'_','%',"'"), array("\\\\","\\_","\\%","\\'"), $tag); - $tagCheck = "AND `BlogEntry`.Tags LIKE '%$tag%'"; + $SQL_tag = Convert::raw2sql($tag); + $tagCheck = "AND `BlogEntry`.Tags LIKE '%$SQL_tag%'"; } if($date) { @@ -95,9 +94,8 @@ class BlogHolder extends Page { */ function ShowTag() { if(Director::urlParam('Action') == 'tag') { - return Director::urlParam('ID'); + return Convert::raw2xml(Director::urlParam('ID')); } - return isset($_GET['tag']) ? $_GET['tag'] : false; } /** @@ -111,10 +109,10 @@ class BlogHolder extends Page { Requirements::javascript('blog/javascript/bbcodehelp.js'); $id = 0; - if(Director::urlParam('ID')){ - $id = Director::urlParam('ID'); + if(Director::urlParam('ID')) { + $id = (int) Director::urlParam('ID'); } - + $codeparser = new BBCodeParser(); $membername = Member::currentMember() ? Member::currentMember()->getName() : ""; @@ -140,10 +138,10 @@ class BlogHolder extends Page { $form = new BlogEntry_Form($this, 'BlogEntryForm',$fields, $actions,$validator); - if($id != 0){ - $form->loadNonBlankDataFrom(DataObject::get_by_id('BlogEntry',$id)); - }else{ - $form->loadNonBlankDataFrom(array("Author" => Cookie::get("BlogHolder_Name"))); + if($id != 0) { + $form->loadNonBlankDataFrom(DataObject::get_by_id('BlogEntry', $id)); + } else { + $form->loadNonBlankDataFrom(array("Author" => Cookie::get("BlogHolder_Name"))); } return $form; @@ -152,7 +150,7 @@ class BlogHolder extends Page { /** * Check if url has "/post" */ - function isPost(){ + function isPost() { return Director::urlParam('Action') == 'post'; } @@ -160,7 +158,7 @@ class BlogHolder extends Page { * Link for creating a new blog entry */ function postURL(){ - return $this->Link('post'); + return $this->Link('post'); } /** @@ -224,16 +222,11 @@ class BlogHolder_Controller extends Page_Controller { } function BlogEntries($limit = 10) { - $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; + $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; $tag = ''; $date = ''; - if(isset($_GET['tag'])) { - $tag = $_GET['tag']; - } - - - if(Director::urlParams()){ + if(Director::urlParams()) { if(Director::urlParam('Action') == 'tag') { $tag = Director::urlParam('ID'); } else { @@ -271,6 +264,7 @@ class BlogHolder_Controller extends Page_Controller { return $output; } + function tag() { if($this->ShowTag()) { return array( From 4501f30ed919d45610827fe21f354f8e5c0157bd Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 20 Nov 2008 23:59:03 +0000 Subject: [PATCH 084/250] Removed no longer necessary LeftAndMain::require_javascript() call. --- _config.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/_config.php b/_config.php index eed5db5..b3d9bbc 100644 --- a/_config.php +++ b/_config.php @@ -1,6 +1 @@ From cbf39d1ec82f32287f1b2948b3ae4dae5fcf6d40 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 25 Nov 2008 04:24:51 +0000 Subject: [PATCH 085/250] ENHANCEMENT Added empty relationship statics so BlogEntry can be decorated by a DataObjectDecorator --- code/BlogEntry.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 6e67cdf..14becec 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -8,6 +8,7 @@ * An individual blog entry page to show a blog entry in full */ class BlogEntry extends Page { + static $default_parent = 'BlogHolder'; static $can_be_root = false; @@ -20,6 +21,15 @@ class BlogEntry extends Page { "Tags" => "Text" ); + static $has_one = array( + ); + + static $has_many = array( + ); + + static $many_many = array( + ); + static $casting = array( "Date" => "Date" ); From bccb236a40f116d0dc93aad0acfc9993910fd977 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 25 Nov 2008 05:01:20 +0000 Subject: [PATCH 086/250] ENHANCEMENT Added empty statics to BlogHolder to allow for decoration of BlogHolder --- code/BlogHolder.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index c3027af..837a46a 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -21,6 +21,12 @@ class BlogHolder extends Page { "SideBar" => "WidgetArea" ); + static $has_many = array( + ); + + static $many_many = array( + ); + static $allowed_children = array( 'BlogEntry' ); From d2969a7fa4188247baf0c0585878982c680badcb Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 27 Nov 2008 01:43:22 +0000 Subject: [PATCH 087/250] BUGFIX If WYSIWYG editing enabled, don't attempt to parse the content, just return the HTML instead MINOR HTML code formatting in BlogEntry.ss --- templates/Layout/BlogEntry.ss | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/templates/Layout/BlogEntry.ss b/templates/Layout/BlogEntry.ss index 9551141..d5c2bfb 100644 --- a/templates/Layout/BlogEntry.ss +++ b/templates/Layout/BlogEntry.ss @@ -3,18 +3,22 @@ <% include BreadCrumbs %>
-

$Title

-

<% _t('POSTEDBY', 'Posted by') %> $Author.XML <% _t('POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('COMMENTS', 'Comments') %>

- <% if TagsCollection %> -

- <% _t('TAGS', 'Tags:') %> - <% control TagsCollection %> - <% if Last %><% else %>,<% end_if %> - <% end_control %> -

- <% end_if %> +

$Title

+

<% _t('POSTEDBY', 'Posted by') %> $Author.XML <% _t('POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('COMMENTS', 'Comments') %>

+ <% if TagsCollection %> +

+ <% _t('TAGS', 'Tags:') %> + <% control TagsCollection %> + <% if Last %><% else %>,<% end_if %> + <% end_control %> +

+ <% end_if %> + <% if IsWYSIWYGEnabled %> + $Content + <% else %> $ParsedContent -
+ <% end_if %> +
<% if CurrentMember %>

<% _t('EDITTHIS', 'Edit this post') %> | <% _t('UNPUBLISHTHIS', 'Unpublish this post') %>

<% end_if %> From 8e74406b431f0570ca26a8f3063ee17613fea864 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 27 Nov 2008 01:43:55 +0000 Subject: [PATCH 088/250] ENHANCEMENT Added IsWYSIWYGEnabled() to check if it's enabled or not, used for templates to determine whether to return parsed content or just standard HTML --- code/BlogEntry.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 14becec..6d1c2a3 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -48,9 +48,20 @@ class BlogEntry extends Page { /** * Is WYSIWYG editing allowed? + * @var boolean */ static $allow_wysiwyg_editing = false; + /** + * Is WYSIWYG editing enabled? + * Used in templates. + * + * @return boolean + */ + public function IsWYSIWYGEnabled() { + return self::$allow_wysiwyg_editing; + } + /** * overload so that the default date is today. */ From efbe5242cec64899fd5d5414b8771a65f1077a82 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Tue, 2 Dec 2008 01:53:52 +0000 Subject: [PATCH 089/250] Added LegacyID. Used for blog migration --- code/BlogEntry.php | 1 + 1 file changed, 1 insertion(+) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 6d1c2a3..ede4f62 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -16,6 +16,7 @@ class BlogEntry extends Page { static $icon = "blog/images/blogpage"; static $db = array( + "LegacyID" => "Varchar(5)", // used for blog migration only "Date" => "SSDatetime", "Author" => "Text", "Tags" => "Text" From 0ba0c52553fe56baa86b31a7fc12c9f28b9c4688 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Tue, 2 Dec 2008 02:46:42 +0000 Subject: [PATCH 090/250] Moved LegacyIDs from BlogEntry and File to Decorators --- code/BlogEntry.php | 1 - code/BlogHolder.php | 34 ++++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index ede4f62..6d1c2a3 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -16,7 +16,6 @@ class BlogEntry extends Page { static $icon = "blog/images/blogpage"; static $db = array( - "LegacyID" => "Varchar(5)", // used for blog migration only "Date" => "SSDatetime", "Author" => "Text", "Tags" => "Text" diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 837a46a..4ad88ca 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -67,9 +67,10 @@ class BlogHolder extends Page { * @param string date Only get blog entries on this date - either a year, or a year-month eg '2008' or '2008-02' * @return DataObjectSet */ - public function Entries($limit = '', $tag = '', $date = '') { + public function Entries($limit = '', $tag = '', $date = '', $author = '') { $tagCheck = ''; $dateCheck = ''; + $authorCheck = ''; if($tag) { $SQL_tag = Convert::raw2sql($tag); @@ -92,7 +93,11 @@ class BlogHolder extends Page { } } - return DataObject::get("Page","`ParentID` = $this->ID AND ShowInMenus = 1 $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$limit"); + if($author) { + $authorCheck = "AND Author = '{$author}'"; + } + + return DataObject::get("Page","`ParentID` = $this->ID AND ShowInMenus = 1 $authorCheck $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$limit"); } /** @@ -228,6 +233,7 @@ class BlogHolder_Controller extends Page_Controller { } function BlogEntries($limit = 10) { + $author = isset($_GET['author']) ? $_GET['author'] : ''; $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; $tag = ''; $date = ''; @@ -247,7 +253,7 @@ class BlogHolder_Controller extends Page_Controller { } } - return $this->Entries("$start,$limit", $tag, $date); + return $this->Entries("$start,$limit", $tag, $date, $author); } /** @@ -286,13 +292,25 @@ class BlogHolder_Controller extends Page_Controller { */ function rss() { global $project; - - $blogName = $this->Name; - $altBlogName = $project . ' blog'; + $limit=10; + $authorCheck = ''; + + $author = isset($_GET['author']) ? $_GET['author'] : ''; + $blogName = $this->Name; + $altBlogName = "$this->Title » SilverStripe.com"; + + if($author) { + $authorCheck = "AND Author = '{$author}'"; + } + + $children = DataObject::get("Page","`ParentID` = $this->ID AND ShowInMenus = 1 $authorCheck","`BlogEntry`.Date DESC",'', "$limit"); + + if($author AND $children) { + $altBlogName = ucwords($author) . "'s blog » SilverStripe.com"; + } - $children = $this->Children(); - $children->sort('Date', 'DESC'); $rss = new RSSFeed($children, $this->Link(), ($blogName ? $blogName : $altBlogName), "", "Title", "ParsedContent"); + $rss->outputToBrowser(); } From bda7fd1cd7a9ca7be84767109216cdbb7a996169 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 2 Dec 2008 02:58:14 +0000 Subject: [PATCH 091/250] Reverted changes that shouldnt be in core --- code/BlogHolder.php | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 4ad88ca..837a46a 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -67,10 +67,9 @@ class BlogHolder extends Page { * @param string date Only get blog entries on this date - either a year, or a year-month eg '2008' or '2008-02' * @return DataObjectSet */ - public function Entries($limit = '', $tag = '', $date = '', $author = '') { + public function Entries($limit = '', $tag = '', $date = '') { $tagCheck = ''; $dateCheck = ''; - $authorCheck = ''; if($tag) { $SQL_tag = Convert::raw2sql($tag); @@ -93,11 +92,7 @@ class BlogHolder extends Page { } } - if($author) { - $authorCheck = "AND Author = '{$author}'"; - } - - return DataObject::get("Page","`ParentID` = $this->ID AND ShowInMenus = 1 $authorCheck $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$limit"); + return DataObject::get("Page","`ParentID` = $this->ID AND ShowInMenus = 1 $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$limit"); } /** @@ -233,7 +228,6 @@ class BlogHolder_Controller extends Page_Controller { } function BlogEntries($limit = 10) { - $author = isset($_GET['author']) ? $_GET['author'] : ''; $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; $tag = ''; $date = ''; @@ -253,7 +247,7 @@ class BlogHolder_Controller extends Page_Controller { } } - return $this->Entries("$start,$limit", $tag, $date, $author); + return $this->Entries("$start,$limit", $tag, $date); } /** @@ -292,25 +286,13 @@ class BlogHolder_Controller extends Page_Controller { */ function rss() { global $project; - $limit=10; - $authorCheck = ''; - - $author = isset($_GET['author']) ? $_GET['author'] : ''; + $blogName = $this->Name; - $altBlogName = "$this->Title » SilverStripe.com"; - - if($author) { - $authorCheck = "AND Author = '{$author}'"; - } - - $children = DataObject::get("Page","`ParentID` = $this->ID AND ShowInMenus = 1 $authorCheck","`BlogEntry`.Date DESC",'', "$limit"); - - if($author AND $children) { - $altBlogName = ucwords($author) . "'s blog » SilverStripe.com"; - } + $altBlogName = $project . ' blog'; + $children = $this->Children(); + $children->sort('Date', 'DESC'); $rss = new RSSFeed($children, $this->Link(), ($blogName ? $blogName : $altBlogName), "", "Title", "ParsedContent"); - $rss->outputToBrowser(); } From cb0ca458e3ede8d17e5f9b3673694fbdebb4366d Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Thu, 4 Dec 2008 03:13:32 +0000 Subject: [PATCH 092/250] MINOR: tidied up blog pagination template --- templates/Includes/BlogPagination.ss | 32 +++++++++++++++------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/templates/Includes/BlogPagination.ss b/templates/Includes/BlogPagination.ss index 29a3c25..e43a2e6 100644 --- a/templates/Includes/BlogPagination.ss +++ b/templates/Includes/BlogPagination.ss @@ -1,21 +1,23 @@ <% if BlogEntries.MoreThanOnePage %>
- <% if BlogEntries.NotLastPage %> - - <% end_if %> +

+ <% if BlogEntries.NotFirstPage %> + + <% end_if %> - <% if BlogEntries.NotFirstPage %> - - <% end_if %> + + <% control BlogEntries.Pages %> + <% if CurrentBool %> + $PageNum + <% else %> + $PageNum + <% end_if %> + <% end_control %> + - - <% control BlogEntries.Pages %> - <% if CurrentBool %> - $PageNum - <% else %> - $PageNum - <% end_if %> - <% end_control %> - + <% if BlogEntries.NotLastPage %> + + <% end_if %> +

<% end_if %> \ No newline at end of file From 3f50a8e36c46d5eda25d9fb74cbf91b0503fc721 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Thu, 4 Dec 2008 21:34:49 +0000 Subject: [PATCH 093/250] MINOR: comment improvements and fixes --- code/TagCloudWidget.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index a2d84dd..1805403 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -52,17 +52,17 @@ class TagCloudWidget extends Widget { if($entries) { foreach($entries as $entry) { - $theseTags = split(" *, *", trim($entry->Tags)); + $theseTags = split(" *, *", strtolower(trim($entry->Tags))); foreach($theseTags as $tag) { - $allTags[$tag] = isset($allTags[$tag]) ? $allTags[$tag] + 1 : 1; //getting the count into key => value map - $max = ($allTags[$tag] > $max) ? $allTags[$tag] : $max; + if($tag != "") { + $allTags[$tag] = isset($allTags[$tag]) ? $allTags[$tag] + 1 : 1; //getting the count into key => value map + $max = ($allTags[$tag] > $max) ? $allTags[$tag] : $max; + } } } if($allTags) { - //TODO: move some or all of the sorts to the database for more efficiency - if($this->Limit > 0){ uasort($allTags, "column_sort_by_popularity"); //sort by popularity $allTags = array_slice($allTags, 0, $this->Limit); @@ -112,7 +112,6 @@ class TagCloudWidget extends Widget { "Link" => $blogHolder->Link() . 'tag/' . urlencode($tag) ); } - } $output = new DataObjectSet(); @@ -126,15 +125,19 @@ class TagCloudWidget extends Widget { } } +/** + * Helper method to compare 2 Vars to work out the results. + * @param mixed + * @param mixed + * @return int + */ function column_sort_by_popularity($a, $b){ - if($a == $b) { $result = 0; } else { $result = $b - $a; } - return $result; } From 72b1473afa09c9a7cf5dde48b2c44aa2be91d413 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Mon, 8 Dec 2008 09:26:40 +0000 Subject: [PATCH 094/250] Use pagination summary function --- templates/Includes/BlogPagination.ss | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/Includes/BlogPagination.ss b/templates/Includes/BlogPagination.ss index e43a2e6..9a34e6a 100644 --- a/templates/Includes/BlogPagination.ss +++ b/templates/Includes/BlogPagination.ss @@ -6,11 +6,15 @@ <% end_if %> - <% control BlogEntries.Pages %> + <% control BlogEntries.PaginationSummary(4) %> <% if CurrentBool %> $PageNum <% else %> - $PageNum + <% if PageNum = --- %> + ... + <% else %> + $PageNum + <% end_if %> <% end_if %> <% end_control %> From 11243352ee0c1cfe7e90fac1aaea54be1c8e258f Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Tue, 9 Dec 2008 00:36:21 +0000 Subject: [PATCH 095/250] Changed ... to html entiries … PaginationSummary return all pages by default --- templates/Includes/BlogPagination.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/Includes/BlogPagination.ss b/templates/Includes/BlogPagination.ss index 9a34e6a..f0e4bd5 100644 --- a/templates/Includes/BlogPagination.ss +++ b/templates/Includes/BlogPagination.ss @@ -11,7 +11,7 @@ $PageNum <% else %> <% if PageNum = --- %> - ... + … <% else %> $PageNum <% end_if %> From 733cce22906efbc587bd987fa973b19d3407faea Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 9 Dec 2008 21:48:37 +0000 Subject: [PATCH 096/250] BUGFIX Adjusted blog pagination to new PaginationSummary syntax (see r67984) --- templates/Includes/BlogPagination.ss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/Includes/BlogPagination.ss b/templates/Includes/BlogPagination.ss index f0e4bd5..220aab3 100644 --- a/templates/Includes/BlogPagination.ss +++ b/templates/Includes/BlogPagination.ss @@ -10,10 +10,10 @@ <% if CurrentBool %> $PageNum <% else %> - <% if PageNum = --- %> - … - <% else %> + <% if Link %> $PageNum + <% else %> + … <% end_if %> <% end_if %> <% end_control %> From 01b48e74b7e40029c964437e5d90c01e26c1f5aa Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 9 Dec 2008 23:15:11 +0000 Subject: [PATCH 097/250] BUGFIX Fix RSS feeds in RSSWidget not working. Since SimplePie has manifest_excluse, we need to include the SimplePie.php file manually in order to use the SimplePie class for RSSWidget->FeedItems() --- code/RSSWidget.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/code/RSSWidget.php b/code/RSSWidget.php index 77be619..be20c9f 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -45,18 +45,18 @@ class RSSWidget extends Widget { function FeedItems() { $output = new DataObjectSet(); - if(class_exists('SimplePie')) { - $this->feed = new SimplePie($this->AbsoluteRssUrl); - $this->feed->init(); - if($items = $this->feed->get_items(0, $this->NumberToShow)) { - foreach($items as $item) { - $output->push(new ArrayData(array( - "Title" => $item->get_title(), - "Link" => $item->get_link() - ))); - } - return $output; + include_once(Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/SimplePie.php')); + + $this->feed = new SimplePie($this->AbsoluteRssUrl); + $this->feed->init(); + if($items = $this->feed->get_items(0, $this->NumberToShow)) { + foreach($items as $item) { + $output->push(new ArrayData(array( + "Title" => $item->get_title(), + "Link" => $item->get_link() + ))); } + return $output; } } } From dcb23d6cc3af16d494cbf30068e7dca74a3342f0 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 10 Dec 2008 00:58:17 +0000 Subject: [PATCH 098/250] ENHANCEMENT Addition of Date, so date can be used in the RSS feed ENHANCEMENT Allow casting of Date and Title so can be modified in template --- code/RSSWidget.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/code/RSSWidget.php b/code/RSSWidget.php index be20c9f..7f167ac 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -51,9 +51,19 @@ class RSSWidget extends Widget { $this->feed->init(); if($items = $this->feed->get_items(0, $this->NumberToShow)) { foreach($items as $item) { + + // Cast the Date + $date = new Date('Date'); + $date->setValue($item->get_date()); + + // Cast the Title + $title = new Text('Title'); + $title->setValue($item->get_title()); + $output->push(new ArrayData(array( - "Title" => $item->get_title(), - "Link" => $item->get_link() + 'Title' => $title, + 'Date' => $date, + 'Link' => $item->get_link() ))); } return $output; From 684287e11d19c5da9b354ba7edf83e2b543d2acc Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 10 Dec 2008 06:48:34 +0000 Subject: [PATCH 099/250] MINOR Added RSS feed icon 28x28 for general purpose --- images/feed-icon-28x28.png | Bin 0 -> 1737 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 images/feed-icon-28x28.png diff --git a/images/feed-icon-28x28.png b/images/feed-icon-28x28.png new file mode 100644 index 0000000000000000000000000000000000000000..d64c669c7589d3a886682dbd1f3c83b716a420f5 GIT binary patch literal 1737 zcmV;)1~&PLP)sAF&N>2z!Fdr4Imm26om*2a>%jE0(;Kv%yf78|JB{oGfPNxX8x(_?yCCg`;V_$ zXsz+vi(@PROR2wt+9on+`tt9tz79KlSO2H>IyGO>#kRR$cU=`Hmyc#J&lVDyanqor z1tA1LcZEeQ^@U{`(^^*e%-kna7Wft+z>JVkoMv=$6&UWDkQ$<2lKHssGAf!lTvqVr4)B+FQFUkn06c#WX1OxA_5 z;;t4x27iQdkQg)F7+O{!f8h`chd+YqxfC)gbK_tz9fLAfFeIEn@r7e^t8mW`EtHtl zf~sX-Ks>w(zD$JfL<}?-ObbNSqyoSo8EhI@Me*$0_W}BkY=u=l5_at*Bqz>Bs-YQ{ zos4mvG?H^x!JY63{2$(dmAw(OgDBN4r@D?n>1$kSvMo%1n@ne~L*#Ej+@`@-enjuF z&(K|SKhjN0k!f56nXE1WtNKQG3pT>t|2pJAM+hc@!uQ#Vl>I(@D{D3pxKswlb>~tD zb^TOW4Rc`CjDzjiNDWa)=dPf5=zVl-eHJ}`?5*&!96k~1@ekpr?gI+6@IV)I-%YZ1 z=-v+aWGLp%CKUe#s$sz;wpp^;mX)Y(TnOzI;dNa_{>&cebNk>B1K00F_Tam4Z(qQO zd23_Pq2no`*2DW|3GJHdIgFd8T4NJhnrn;yjGBaL&ff6-AOJ$zP&E^gesm2|&uoXB zvj$EwiHzuj`}0P$f4kO{ObL|Si{@9rxo7|l7_S!?%oAqFYC^>-3Q9eduY7-u)FfIoCHc?ZV)@-|{<8PO#m0!q@K`h=j&~-o;Qk3aNwz=j=|n zt*@f@(}n2RJRjZ1wpX$pMoIGICP*h?K<~6}fS2ozSx$Zo7}Z$8j=^Jwto#h>^+V-5 z;CNj~*)B4qf2rJg3h)YcC8lmRCX=+ze4R)W{Rjv-OrYtP6i`tkW#ZBZo zAquzQ)1pNRc%A~zt)gVgBrSNqe~I>8uMwtO7Oxi|M?C$Fs^Ts74UpfJM^h3sV?wMW0WJehh2{~g4ogxB$XB+z3 zj>dqsQ-JDmG0PG|RvIr$F{C4kCg$jP$}HFbr*4{YjY!qNUc40!F-=kycOU+QnB?Mx z8|Kk4n-6^So&Tjm@IeU{f$7jOq0(5vX+iOD$&HEn>6Ln&9A*v|n??7|MdU7@C{vjR z$f_|A5hO^O4ut*#ZxgtJGkT`cL-*i%v!F$w>{{>2ab(X< zB7{67ze4nP(?WE=r;}pbYUptK=i7b_Vo0DObgB4h*)ZMw#4Moef;n1P)m$$SapFyk zgn28|VG$Q8#!==OS!68?6Qk&A<31f;^D`aBP}NOF+u83;43FmqXr@XA^@G5zL#R|Z z-6OEbB$o=0VUJMXVpoM`Q5^X>w^j&dHb$?C`9O1za}2k1oIVYauA>==_^=F>L6=L^ zy)3G=Vq5~I&uoz(IUI+sizYAj3Qn3MPY>NxTc2EAJ9P$ Date: Wed, 10 Dec 2008 06:49:06 +0000 Subject: [PATCH 100/250] ENHANCEMENT Added SubscribeRSSWidget for linking directly to blog RSS from the BlogHolder --- code/SubscribeRSSWidget.php | 56 +++++++++++++++++++++++++++++++++ css/subscribersswidget.css | 4 +++ templates/SubscribeRSSWidget.ss | 5 +++ 3 files changed, 65 insertions(+) create mode 100644 code/SubscribeRSSWidget.php create mode 100644 css/subscribersswidget.css create mode 100644 templates/SubscribeRSSWidget.ss diff --git a/code/SubscribeRSSWidget.php b/code/SubscribeRSSWidget.php new file mode 100644 index 0000000..72dc229 --- /dev/null +++ b/code/SubscribeRSSWidget.php @@ -0,0 +1,56 @@ + 'Varchar' + ); + + static $title = 'Subscribe via RSS'; + + static $cmsTitle = 'Subscribe via RSS widget'; + + static $description = 'Shows a link allowing a user to subscribe to this blog via RSS.'; + + /** + * Get the BlogHolder instance that this widget + * is located on. + * + * @return BlogHolder + */ + function getBlogHolder() { + $page = Director::currentPage(); + + if($page instanceof BlogHolder) { + return $page; + } elseif(($page instanceof BlogEntry) && ($page->getParent() instanceof BlogHolder)) { + return $page->getParent(); + } else { + return DataObject::get_one('BlogHolder'); + } + } + + /** + * Return an absolute URL based on the BlogHolder + * that this widget is located on. + * + * @return string + */ + function RSSLink() { + Requirements::themedCSS('subscribersswidget'); + $blogHolder = $this->getBlogHolder(); + if($blogHolder) { + return $blogHolder->Link() . 'rss'; + } + } + +} + +?> \ No newline at end of file diff --git a/css/subscribersswidget.css b/css/subscribersswidget.css new file mode 100644 index 0000000..9613397 --- /dev/null +++ b/css/subscribersswidget.css @@ -0,0 +1,4 @@ +.subscribeLink { + background: url(../images/feed-icon-14x14.png) no-repeat left center; + padding-left: 20px; +} \ No newline at end of file diff --git a/templates/SubscribeRSSWidget.ss b/templates/SubscribeRSSWidget.ss new file mode 100644 index 0000000..cc29b1e --- /dev/null +++ b/templates/SubscribeRSSWidget.ss @@ -0,0 +1,5 @@ +

+ +

\ No newline at end of file From 3e8754e50df000d03b9bed1b9012db2a69407cd8 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 10 Dec 2008 06:58:28 +0000 Subject: [PATCH 101/250] MINOR Tidy up of ArchiveWidget ENHANCEMENT Use of instanceof instead of is_a() so BlogHolder and BlogEntry subclasses still work properly --- code/ArchiveWidget.php | 68 ++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index 4c77715..be17cac 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -1,78 +1,88 @@ "Varchar" + 'DisplayMode' => 'Varchar' ); static $defaults = array( - "DisplayMode" => "month" + 'DisplayMode' => 'month' ); - static $title = "Browse by Date"; - static $cmsTitle = "Blog Archive"; - static $description = "Show a list of months or years in which there are blog posts, and provide links to them."; + static $title = 'Browse by Date'; + + static $cmsTitle = 'Blog Archive'; + + static $description = 'Show a list of months or years in which there are blog posts, and provide links to them.'; function getBlogHolder() { $page = Director::currentPage(); - if($page->is_a("BlogHolder")) { + if($page instanceof BlogHolder) { return $page; - } else if($page->is_a("BlogEntry") && $page->getParent()->is_a("BlogHolder")) { + } elseif(($page instanceof BlogEntry) && ($page->getParent() instanceof BlogHolder)) { return $page->getParent(); } else { - return DataObject::get_one("BlogHolder"); + return DataObject::get_one('BlogHolder'); } } - function getCMSFields() { + function getCMSFields() { return new FieldSet( - new OptionsetField("DisplayMode",_t('ArchiveWidget.DispBY', "Display by"),array("month"=>_t('ArchiveWidget.MONTH',"month"),"year"=>_t('ArchiveWidget.YEAR', "year"))) + new OptionsetField( + 'DisplayMode', + _t('ArchiveWidget.DispBY', 'Display by'), + array( + 'month' => _t('ArchiveWidget.MONTH', 'month'), + 'year' => _t('ArchiveWidget.YEAR', 'year') + ) + ) ); } function Dates() { - Requirements::css("blog/css/archivewidget.css"); + Requirements::themedCSS('archivewidget'); + $results = new DataObjectSet(); $blogHolder = $this->getBlogHolder(); $id = $blogHolder->ID; - if($this->DisplayMode == "month"){ + if($this->DisplayMode == 'month') { $sqlResults = DB::query("SELECT DISTINCT MONTH(`Date`) AS `Month`, YEAR(`Date`) AS `Year` FROM `SiteTree` NATURAL JOIN `BlogEntry` WHERE `ParentID` = $id ORDER BY `Date` DESC"); - }else{ + } else { $sqlResults = DB::query("SELECT DISTINCT YEAR(`Date`) AS `Year` FROM `SiteTree` NATURAL JOIN `BlogEntry` WHERE `ParentID` = $id ORDER BY `Date` DESC"); } - + if(!$sqlResults) return new DataObjectSet(); foreach($sqlResults as $sqlResult) { - $date = new Date("Date"); - - - - $month = ($this->DisplayMode == "month") ? (int)$sqlResult['Month'] : 1; + $date = new Date('Date'); + $month = ($this->DisplayMode == 'month') ? (int)$sqlResult['Month'] : 1; $date->setValue(array( - "Day" => 1, - "Month" => $month, - "Year" => (int)$sqlResult['Year'] + 'Day' => 1, + 'Month' => $month, + 'Year' => (int) $sqlResult['Year'] )); - if($this->DisplayMode == "month"){ + if($this->DisplayMode == 'month') { $link = $blogHolder->Link() . $sqlResult['Year']. '/' . sprintf("%'02d", $sqlResult['Month']); - } - else{ + } else { $link = $blogHolder->Link() . $sqlResult['Year']; } $results->push(new ArrayData(array( - "Date" => $date, - "Link" => $link + 'Date' => $date, + 'Link' => $link ))); } return $results; } } - ?> \ No newline at end of file From bf70b7e7bc5d096e16acb30362602f76dd5c166b Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 10 Dec 2008 07:01:06 +0000 Subject: [PATCH 102/250] MINOR phpDoc for BlogEntry BUGFIX Unncessary use of Convert::raw2sql() in BlogEntry_Controller->unpublishPost() for making an integer SQL safe, just use (int) instead to cast it --- code/BlogEntry.php | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 6d1c2a3..6889862 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -1,12 +1,9 @@ ID); + function unpublishPost() { + if(!Permission::check('ADMIN')) { + Security::permissionFailure( + $this, + 'Unpublishing blogs is an administrator task. Please log in.' + ); + } else { + $SQL_id = (int) $this->ID; - $page = DataObject::get_by_id("SiteTree", $SQL_id); + $page = DataObject::get_by_id('SiteTree', $SQL_id); $page->deleteFromStage('Live'); $page->flushCache(); - $page = DataObject::get_by_id("SiteTree", $SQL_id); - $page->Status = "Unpublished"; + $page = DataObject::get_by_id('SiteTree', $SQL_id); + $page->Status = 'Unpublished'; Director::redirect($this->getParent()->Link()); } } } - -?> +?> \ No newline at end of file From 475b41bbda33daa02a038c4d022c07ce7857b0db Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 10 Dec 2008 07:05:18 +0000 Subject: [PATCH 103/250] ENHANCEMENT Use of themedCSS() in BlogEntry instead of relative paths to css files MINOR Code cleanup on BlogEntry class --- code/BlogEntry.php | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 6889862..bdc9b53 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -41,8 +41,6 @@ class BlogEntry extends Page { "Versioned('Stage', 'Live')" ); - static $allowed_children = "none"; - /** * Is WYSIWYG editing allowed? * @var boolean @@ -60,26 +58,28 @@ class BlogEntry extends Page { } /** - * overload so that the default date is today. + * Overload so that the default date is today. */ public function populateDefaults(){ parent::populateDefaults(); - $this->Date = date("Y-m-d H:i:s",time()); + + $this->Date = date('Y-m-d H:i:s', time()); } /** * Ensures the most recent article edited on the same day is shown first. */ - public function setDate($val){ - $datepart = date("Y-m-d",strtotime($val)); - $minutepart = date("H:i:s",time()); - $date = $datepart . " " . $minutepart; - return $this->setField("Date",$date); + public function setDate($val) { + $datepart = date('Y-m-d', strtotime($val)); + $minutepart = date('H:i:s', time()); + $date = $datepart . " " . $minutepart; + + return $this->setField('Date', $date); } function getCMSFields() { Requirements::javascript('blog/javascript/bbcodehelp.js'); - Requirements::css('blog/css/bbcodehelp.css'); + Requirements::themedCSS('bbcodehelp'); $firstName = Member::currentUser() ? Member::currentUser()->FirstName : ''; $codeparser = new BBCodeParser(); @@ -108,22 +108,23 @@ class BlogEntry extends Page { * Returns the tags added to this blog entry */ function TagsCollection() { - $theseTags = split(" *, *", trim($this->Tags)); - + $tags = split(" *, *", trim($this->Tags)); $output = new DataObjectSet(); - foreach($theseTags as $tag) { + + foreach($tags as $tag) { $output->push(new ArrayData(array( - "Tag" => $tag, - "Link" => $this->getParent()->Link() . 'tag/' . urlencode($tag) + 'Tag' => $tag, + 'Link' => $this->getParent()->Link() . 'tag/' . urlencode($tag) ))); } - if($this->Tags){ + + if($this->Tags) { return $output; } } /** - * Get the sidebar + * Get the sidebar from the BlogHolder. */ function SideBar() { return $this->getParent()->SideBar(); @@ -153,6 +154,7 @@ class BlogEntry extends Page { $parser = new BBCodeParser($this->Content); $content = new Text('Content'); $content->value = $parser->parse(); + return $content; } } @@ -161,7 +163,7 @@ class BlogEntry extends Page { * Link for editing this blog entry */ function EditURL() { - return $this->getParent()->Link('post')."/".$this->ID."/"; + return $this->getParent()->Link('post') . '/' . $this->ID . '/'; } /** @@ -174,9 +176,11 @@ class BlogEntry extends Page { } class BlogEntry_Controller extends Page_Controller { + function init() { parent::init(); - Requirements::themedCSS("blog"); + + Requirements::themedCSS('blog'); } /** From d556d052c0b37e1ce6c29d37b5cf2143324ab128 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 10 Dec 2008 07:13:59 +0000 Subject: [PATCH 104/250] MINOR Removed useless $db array in SubscribeRSSWidget since it's not being used --- code/SubscribeRSSWidget.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/code/SubscribeRSSWidget.php b/code/SubscribeRSSWidget.php index 72dc229..e3f8c07 100644 --- a/code/SubscribeRSSWidget.php +++ b/code/SubscribeRSSWidget.php @@ -9,10 +9,6 @@ */ class SubscribeRSSWidget extends Widget { - static $db = array( - 'Title' => 'Varchar' - ); - static $title = 'Subscribe via RSS'; static $cmsTitle = 'Subscribe via RSS widget'; From 968b9ff4674cd152a4d40508ccaf9ec285f74115 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Fri, 12 Dec 2008 23:14:47 +0000 Subject: [PATCH 105/250] Fixed blog RSS caching --- code/RSSWidget.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/RSSWidget.php b/code/RSSWidget.php index 7f167ac..ed9282e 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -47,7 +47,8 @@ class RSSWidget extends Widget { include_once(Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/SimplePie.php')); - $this->feed = new SimplePie($this->AbsoluteRssUrl); + $t1 = microtime(true); + $this->feed = new SimplePie($this->AbsoluteRssUrl, TEMP_FOLDER); $this->feed->init(); if($items = $this->feed->get_items(0, $this->NumberToShow)) { foreach($items as $item) { From e3a21012fbcddd3df97d97d4e5f3f0b32ab48d75 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 16 Dec 2008 04:25:35 +0000 Subject: [PATCH 106/250] BUGFIX: Fix not being able to post from frontend, change posting code to be more SilverStripey --- code/ArchiveWidget.php | 2 +- code/BlogEntry.php | 24 +---- code/BlogHolder.php | 147 ++++++++++++++-------------- templates/Layout/BlogHolder_post.ss | 9 -- 4 files changed, 81 insertions(+), 101 deletions(-) delete mode 100644 templates/Layout/BlogHolder_post.ss diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index be17cac..f5cb756 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -85,4 +85,4 @@ class ArchiveWidget extends Widget { return $results; } } -?> \ No newline at end of file +?> diff --git a/code/BlogEntry.php b/code/BlogEntry.php index bdc9b53..d7254d4 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -27,12 +27,9 @@ class BlogEntry extends Page { static $many_many = array( ); - static $casting = array( - "Date" => "Date" - ); - static $defaults = array( - "ProvideComments" => true + "ProvideComments" => true, + 'ShowInMenus' => false ); static $extensions = array( @@ -63,20 +60,9 @@ class BlogEntry extends Page { public function populateDefaults(){ parent::populateDefaults(); - $this->Date = date('Y-m-d H:i:s', time()); + $this->setField('Date', date('Y-m-d H:i:s', strtotime('now'))); } - /** - * Ensures the most recent article edited on the same day is shown first. - */ - public function setDate($val) { - $datepart = date('Y-m-d', strtotime($val)); - $minutepart = date('H:i:s', time()); - $date = $datepart . " " . $minutepart; - - return $this->setField('Date', $date); - } - function getCMSFields() { Requirements::javascript('blog/javascript/bbcodehelp.js'); Requirements::themedCSS('bbcodehelp'); @@ -91,7 +77,7 @@ class BlogEntry extends Page { $fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", _t("BlogEntry.CN", "Content"), 20)); } - $fields->addFieldToTab("Root.Content.Main", new CalendarDateField("Date", _t("BlogEntry.DT", "Date")),"Content"); + $fields->addFieldToTab("Root.Content.Main", new PopupDateTimeField("Date", _t("BlogEntry.DT", "Date")),"Content"); $fields->addFieldToTab("Root.Content.Main", new TextField("Author", _t("BlogEntry.AU", "Author"), $firstName),"Content"); if(!self::$allow_wysiwyg_editing) { @@ -207,4 +193,4 @@ class BlogEntry_Controller extends Page_Controller { } } -?> \ No newline at end of file +?> diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 837a46a..beb6b43 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -92,7 +92,7 @@ class BlogHolder extends Page { } } - return DataObject::get("Page","`ParentID` = $this->ID AND ShowInMenus = 1 $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$limit"); + return DataObject::get("Page","`ParentID` = $this->ID $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$limit"); } /** @@ -104,55 +104,6 @@ class BlogHolder extends Page { } } - /** - * A simple form for creating blog entries - */ - function BlogEntryForm() { - Requirements::javascript('jsparty/behaviour.js'); - Requirements::javascript('jsparty/prototype.js'); - Requirements::javascript('jsparty/scriptaculous/effects.js'); - Requirements::javascript('cms/javascript/PageCommentInterface.js'); - Requirements::javascript('blog/javascript/bbcodehelp.js'); - - $id = 0; - if(Director::urlParam('ID')) { - $id = (int) Director::urlParam('ID'); - } - - $codeparser = new BBCodeParser(); - $membername = Member::currentMember() ? Member::currentMember()->getName() : ""; - - $fields = new FieldSet( - new HiddenField("ParentID", "ParentID", $this->ID), - new HiddenField("ID","ID"), - new HiddenField("Date","Date"), - new TextField("Title",_t('BlogHolder.SJ', "Subject")), - new TextField("Author",_t('BlogEntry.AU'),$membername), - new CompositeField( - new LiteralField("BBCodeHelper",""._t("BlogEntry.BBH")."
" ), - new TextareaField("Content", _t("BlogEntry.CN"),20), - new LiteralField("BBCodeTags","
".$codeparser->useable_tagsHTML()."
") - ), - new TextField("Tags","Tags"), - new LiteralField("Tagsnote"," ") - ); - - $submitAction = new FormAction('postblog', _t('BlogHolder.POST', 'Post blog entry')); - $actions = new FieldSet($submitAction); - $validator = new RequiredFields('Title','Content'); - - $form = new BlogEntry_Form($this, 'BlogEntryForm',$fields, $actions,$validator); - - if($id != 0) { - $form->loadNonBlankDataFrom(DataObject::get_by_id('BlogEntry', $id)); - } else { - $form->loadNonBlankDataFrom(array("Author" => Cookie::get("BlogHolder_Name"))); - } - - return $form; - } - /** * Check if url has "/post" */ @@ -308,10 +259,15 @@ class BlogHolder_Controller extends Page_Controller { */ function post(){ if(!Permission::check('ADMIN')){ - Security::permissionFailure($this, - _t('BlogHolder.HAVENTPERM',"Posting blogs is an administrator task. Please log in.")); + Security::permissionFailure($this, _t('BlogHolder.HAVENTPERM', 'Posting blogs is an administrator task. Please log in.')); } - return array(); + + $page = $this->customise(array( + 'Content' => false, + 'Form' => $this->BlogEntryForm() + )); + + return $page->renderWith('Page'); } function defaultAction($action) { @@ -322,32 +278,79 @@ class BlogHolder_Controller extends Page_Controller { return parent::defaultAction($action); } -} - -/** - * Blog entry form - */ -class BlogEntry_Form extends Form { - function postblog($data) { - Cookie::set("BlogHolder_Name", $data['Author']); - $blogentry = new BlogEntry(); - $this->saveInto($blogentry); - - if($data['ID'] != 0){ //new post - $blogentry = DataObject::get_by_id("BlogEntry",$data['ID']); - $this->saveInto($blogentry); - $blogentry->setDate($data['Date']); - }else{ - $blogentry->setDate(date("Y-m-d H:i:s",time())); + + /** + * A simple form for creating blog entries + */ + function BlogEntryForm() { + Requirements::javascript('jsparty/behaviour.js'); + Requirements::javascript('jsparty/prototype.js'); + Requirements::javascript('jsparty/scriptaculous/effects.js'); + Requirements::javascript('cms/javascript/PageCommentInterface.js'); + Requirements::javascript('blog/javascript/bbcodehelp.js'); + + $id = 0; + if(Director::urlParam('ID')) { + $id = (int) Director::urlParam('ID'); } + $codeparser = new BBCodeParser(); + $membername = Member::currentMember() ? Member::currentMember()->getName() : ""; + + $fields = new FieldSet( + new HiddenField("ID", "ID"), + new TextField("Title",_t('BlogHolder.SJ', "Subject")), + new TextField("Author",_t('BlogEntry.AU'),$membername), + new CompositeField( + new LiteralField("BBCodeHelper",""._t("BlogEntry.BBH")."
" ), + new TextareaField("BlogPost", _t("BlogEntry.CN"),20), // This is called BlogPost as the id #Content is generally used already + new LiteralField("BBCodeTags","
".$codeparser->useable_tagsHTML()."
") + ), + new TextField("Tags","Tags"), + new LiteralField("Tagsnote"," ") + ); + + $submitAction = new FormAction('postblog', _t('BlogHolder.POST', 'Post blog entry')); + $actions = new FieldSet($submitAction); + $validator = new RequiredFields('Title','Content'); + + $form = new Form($this, 'BlogEntryForm',$fields, $actions,$validator); + + if($id != 0) { + $entry = DataObject::get_by_id('BlogEntry', $id); + $form->loadNonBlankDataFrom($entry); + $form->datafieldByName('BlogPost')->setValue($entry->Content); + } else { + $form->loadNonBlankDataFrom(array("Author" => Cookie::get("BlogHolder_Name"))); + } + + return $form; + } + + function postblog($data, $form) { + Cookie::set("BlogHolder_Name", $data['Author']); + $blogentry = false; + + if($data['ID']) { + $blogentry = DataObject::get_by_id("BlogEntry", $data['ID']); + } + + if(!$blogentry) { + $blogentry = new BlogEntry(); + } + + $form->saveInto($blogentry); + $blogentry->ParentID = $this->ID; + $blogentry->Content = $form->datafieldByName('BlogPost')->dataValue(); + $blogentry->Status = "Published"; $blogentry->writeToStage("Stage"); $blogentry->publish("Stage", "Live"); - - Director::redirect($this->controller->Link()); + Director::redirect($this->Link()); } } + ?> diff --git a/templates/Layout/BlogHolder_post.ss b/templates/Layout/BlogHolder_post.ss deleted file mode 100644 index 09961da..0000000 --- a/templates/Layout/BlogHolder_post.ss +++ /dev/null @@ -1,9 +0,0 @@ -<% include BlogSideBar %> - -
- <% include BreadCrumbs %> - - <% if isPost %> - $BlogEntryForm - <% end_if %> -
\ No newline at end of file From 1298e15c0732602680b5405b961989b385358b4c Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 16 Dec 2008 04:29:34 +0000 Subject: [PATCH 107/250] BUGFIX: Fix trackbacks --- code/BlogEntry.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index d7254d4..b15fc60 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -162,6 +162,10 @@ class BlogEntry extends Page { } class BlogEntry_Controller extends Page_Controller { + static $allowed_actions = array( + 'trackbackping', + 'unpublishPost' + ); function init() { parent::init(); From bbba843ba5ffb880f9b7fff8ef14297f2f1ee408 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 16 Dec 2008 04:31:06 +0000 Subject: [PATCH 108/250] BUGFIX: Fix tag cloud --- code/TagCloudWidget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index 1805403..1f836ae 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -48,7 +48,7 @@ class TagCloudWidget extends Widget { $max = 0; $blogHolder = $this->getBlogHolder(); - $entries = $blogHolder->Children(); + $entries = $blogHolder->Entries(); if($entries) { foreach($entries as $entry) { From 2bcbb8ee7dd7b6ae6b6cf709c1f6eb565586d551 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 16 Dec 2008 04:35:28 +0000 Subject: [PATCH 109/250] BUGFIX: #1709 - Archive widgets shows months and years for unpublished posts --- code/ArchiveWidget.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index f5cb756..93227b4 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -52,10 +52,14 @@ class ArchiveWidget extends Widget { $blogHolder = $this->getBlogHolder(); $id = $blogHolder->ID; + $stage = Versioned::current_stage(); + $suffix = (!$stage || $stage == 'Stage') ? "" : "_$stage"; + + if($this->DisplayMode == 'month') { - $sqlResults = DB::query("SELECT DISTINCT MONTH(`Date`) AS `Month`, YEAR(`Date`) AS `Year` FROM `SiteTree` NATURAL JOIN `BlogEntry` WHERE `ParentID` = $id ORDER BY `Date` DESC"); + $sqlResults = DB::query("SELECT DISTINCT MONTH(`Date`) AS `Month`, YEAR(`Date`) AS `Year` FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` WHERE `ParentID` = $id ORDER BY `Date` DESC"); } else { - $sqlResults = DB::query("SELECT DISTINCT YEAR(`Date`) AS `Year` FROM `SiteTree` NATURAL JOIN `BlogEntry` WHERE `ParentID` = $id ORDER BY `Date` DESC"); + $sqlResults = DB::query("SELECT DISTINCT YEAR(`Date`) AS `Year` FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` WHERE `ParentID` = $id ORDER BY `Date` DESC"); } if(!$sqlResults) return new DataObjectSet(); From fe9afc2e361361899a7dc18dbfbc229f939407e5 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 16 Dec 2008 04:49:52 +0000 Subject: [PATCH 110/250] #2774 - Functions in tag cloud widget out of place --- code/TagCloudWidget.php | 58 +++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index 1f836ae..46e42d1 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -64,11 +64,11 @@ class TagCloudWidget extends Widget { if($allTags) { //TODO: move some or all of the sorts to the database for more efficiency if($this->Limit > 0){ - uasort($allTags, "column_sort_by_popularity"); //sort by popularity + uasort($allTags, array($this, "column_sort_by_popularity")); //sort by popularity $allTags = array_slice($allTags, 0, $this->Limit); } if($this->Sortby == "alphabet"){ - natksort($allTags); + $this->natksort($allTags); } $sizes = array(); @@ -122,35 +122,37 @@ class TagCloudWidget extends Widget { } return; - } -} - -/** - * Helper method to compare 2 Vars to work out the results. - * @param mixed - * @param mixed - * @return int - */ -function column_sort_by_popularity($a, $b){ - if($a == $b) { - $result = 0; - } - else { - $result = $b - $a; } - return $result; + + /** + * Helper method to compare 2 Vars to work out the results. + * @param mixed + * @param mixed + * @return int + */ + private function column_sort_by_popularity($a, $b){ + if($a == $b) { + $result = 0; + } + else { + $result = $b - $a; + } + return $result; + } + + private function natksort(&$aToBeSorted) { + $aResult = array(); + $aKeys = array_keys($aToBeSorted); + natcasesort($aKeys); + foreach ($aKeys as $sKey) { + $aResult[$sKey] = $aToBeSorted[$sKey]; + } + $aToBeSorted = $aResult; + + return true; + } } -function natksort(&$aToBeSorted) { - $aResult = array(); - $aKeys = array_keys($aToBeSorted); - natcasesort($aKeys); - foreach ($aKeys as $sKey) { - $aResult[$sKey] = $aToBeSorted[$sKey]; - } - $aToBeSorted = $aResult; - return true; -} ?> From 18f2639e517eefe9ab376feabd69203243b6cb9f Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 16 Dec 2008 20:37:14 +0000 Subject: [PATCH 111/250] Add PageComments to allowed_actions --- code/BlogEntry.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index b15fc60..878b792 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -164,7 +164,8 @@ class BlogEntry extends Page { class BlogEntry_Controller extends Page_Controller { static $allowed_actions = array( 'trackbackping', - 'unpublishPost' + 'unpublishPost', + 'PageComments' ); function init() { From 3443ff9f60b02a4cec3e4e4921cfb5c53da1e775 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 16 Dec 2008 21:27:05 +0000 Subject: [PATCH 112/250] BUGFIX: SetDate doesn't need to be called, as the date is automatically set the the current time --- code/BlogHolder.php | 1 - 1 file changed, 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index beb6b43..afb3a2f 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -154,7 +154,6 @@ class BlogHolder extends Page { $blog = new BlogEntry(); $blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed"); $blog->URLSegment = 'sample-blog-entry'; - $blog->setDate(date("Y-m-d H:i:s",time())); $blog->Tags = _t('BlogHolder.SUCTAGS',"silverstripe, blog"); $blog->Content = _t('BlogHolder.SUCCONTENT',"Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in [url=admin]the CMS[/url]."); $blog->Status = "Published"; From 8e708d98a7d8a6ab821e3e3d9b5dfc462b34b06e Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 16 Dec 2008 22:35:32 +0000 Subject: [PATCH 113/250] FEATURE: Enable disabling of TrackBacks --- code/BlogEntry.php | 15 +++++++++++++++ code/BlogHolder.php | 13 ++++++------- templates/Layout/BlogEntry.ss | 4 +++- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 878b792..abe4468 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -151,6 +151,21 @@ class BlogEntry extends Page { function EditURL() { return $this->getParent()->Link('post') . '/' . $this->ID . '/'; } + + /** + * Check to see if trackbacks are enabled. + */ + function TrackBacksEnabled() { + return $this->getParent()->TrackBacksEnabled; + } + + function trackbackping() { + if($this->TrackBacksEnabled()) { + return $this->extInstance('TrackBackDecorator')->trackbackping(); + } else { + Director::redirect($this->Link()); + } + } /** * Call this to enable WYSIWYG editing on your blog entries. diff --git a/code/BlogHolder.php b/code/BlogHolder.php index afb3a2f..a3fe938 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -13,8 +13,9 @@ class BlogHolder extends Page { static $icon = "blog/images/blogholder"; static $db = array( - "LandingPageFreshness" => "Varchar", - "Name" => "Varchar" + 'LandingPageFreshness' => 'Varchar', + 'Name' => 'Varchar', + 'TrackBacksEnabled' => 'Boolean' ); static $has_one = array( @@ -31,10 +32,6 @@ class BlogHolder extends Page { 'BlogEntry' ); - static $defaults = array( - "LandingPageFreshness" => "3 MONTH", - ); - function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeFieldFromTab("Root.Content.Main","Content"); @@ -54,8 +51,10 @@ class BlogHolder extends Page { "9 MONTH" => "Last 9 months' entries", "10 MONTH" => "Last 10 months' entries", "11 MONTH" => "Last 11 months' entries", - "12 MONTH" => "Last year's entries", + "12 MONTH" => "Last year's entries" ))); + + $fields->addFieldToTab('Root.Content.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks')); return $fields; } diff --git a/templates/Layout/BlogEntry.ss b/templates/Layout/BlogEntry.ss index d5c2bfb..cc37068 100644 --- a/templates/Layout/BlogEntry.ss +++ b/templates/Layout/BlogEntry.ss @@ -23,6 +23,8 @@ <% if CurrentMember %>

<% _t('EDITTHIS', 'Edit this post') %> | <% _t('UNPUBLISHTHIS', 'Unpublish this post') %>

<% end_if %> - <% include TrackBacks %> + <% if TrackBacksEnabled %> + <% include TrackBacks %> + <% end_if %> $PageComments
From 4c5f0e1075a77fc892287d36b6c668503bc1e3c7 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 16 Dec 2008 22:44:55 +0000 Subject: [PATCH 114/250] FEATURE: Allow use of tiny mce on front end --- _config.php | 2 ++ code/BlogHolder.php | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/_config.php b/_config.php index b3d9bbc..62a2de0 100644 --- a/_config.php +++ b/_config.php @@ -1 +1,3 @@ diff --git a/code/BlogHolder.php b/code/BlogHolder.php index a3fe938..98f11b4 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -295,15 +295,21 @@ class BlogHolder_Controller extends Page_Controller { $codeparser = new BBCodeParser(); $membername = Member::currentMember() ? Member::currentMember()->getName() : ""; + if(BlogEntry::$allow_wysiwyg_editing) { + $contentfield = new HtmlEditorField("BlogPost", _t("BlogEntry.CN")); + } else { + $contentfield = new CompositeField( + new LiteralField("BBCodeHelper",""._t("BlogEntry.BBH")."
" ), + new TextareaField("BlogPost", _t("BlogEntry.CN"),20), // This is called BlogPost as the id #Content is generally used already + new LiteralField("BBCodeTags","
".$codeparser->useable_tagsHTML()."
") + ); + } + $fields = new FieldSet( new HiddenField("ID", "ID"), new TextField("Title",_t('BlogHolder.SJ', "Subject")), new TextField("Author",_t('BlogEntry.AU'),$membername), - new CompositeField( - new LiteralField("BBCodeHelper",""._t("BlogEntry.BBH")."
" ), - new TextareaField("BlogPost", _t("BlogEntry.CN"),20), // This is called BlogPost as the id #Content is generally used already - new LiteralField("BBCodeTags","
".$codeparser->useable_tagsHTML()."
") - ), + $contentfield, new TextField("Tags","Tags"), new LiteralField("Tagsnote"," ") From f636f90fae369902005afafaed2f93bdd0101023 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Wed, 17 Dec 2008 03:59:02 +0000 Subject: [PATCH 115/250] BUGFIX: Fix rss feed --- code/BlogHolder.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 98f11b4..2bdc475 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -239,10 +239,12 @@ class BlogHolder_Controller extends Page_Controller { $blogName = $this->Name; $altBlogName = $project . ' blog'; - $children = $this->Children(); - $children->sort('Date', 'DESC'); - $rss = new RSSFeed($children, $this->Link(), ($blogName ? $blogName : $altBlogName), "", "Title", "ParsedContent"); - $rss->outputToBrowser(); + $entries = $this->Entries(20); + + if($entries) { + $rss = new RSSFeed($entries, $this->Link(), ($blogName ? $blogName : $altBlogName), "", "Title", "ParsedContent"); + $rss->outputToBrowser(); + } } /** @@ -305,12 +307,19 @@ class BlogHolder_Controller extends Page_Controller { ); } + if(class_exists('TagField')) { + $tagfield = new TagField('Tags', null, null, 'BlogEntry'); + $tagfield->setSeparator(', '); + } else { + $tagfield = new TextField('Tags'); + } + $fields = new FieldSet( new HiddenField("ID", "ID"), new TextField("Title",_t('BlogHolder.SJ', "Subject")), new TextField("Author",_t('BlogEntry.AU'),$membername), $contentfield, - new TextField("Tags","Tags"), + $tagfield, new LiteralField("Tagsnote"," ") ); From 8abe20a92da9357c2477eab910ac534052a6e2c2 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Wed, 17 Dec 2008 04:04:42 +0000 Subject: [PATCH 116/250] Prepare for 0.2-rc1 --- ChangeLog | 42 ++++++++++++++++++++++++++++++++++++++++++ README | 8 ++------ 2 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 ChangeLog diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..90e5c8a --- /dev/null +++ b/ChangeLog @@ -0,0 +1,42 @@ +ChangeLog + +0.2.0 + +Features + - Blogs can now be configured to use HTML instead of BBCode + - Tags now follow the rel-tag microformat standard + - Blog module is now translatable + - The entries shown on the BlogHolder when not browsing by date/tag can now be restricted to only show entries that are younger than a user specified age + - The RSS feed name can now be changed in the CMS + - Added support for receiving trackback pings + - Added SubscribeRSSWidget for linking directly to the blog RSS feed + - Tag widget title is now editable + - Added empty relationship statics so BlogEntry and BlogHolder can be decorated by a DataObjectDecorator + - Use pagination summary, so a full list of pages isnt generated + - Added Date variable to RSSWidget feed items, so Date can be used in template if wanted + - Cast Title variable on RSSWidget feed items, so Title can have Text functions called in the template if wanted + +Bugfixes + - Removed deprecated calls to sapphire, and made other fixes to support sapphire 2.3.0 + - Don't use PHP short tags + - Don't display $Content on a BlogHolder, as it isnt editable in the CMS + - Prevent infinite loops when an RSSWidget on a blog points to itself + - Fix URL segment generation + - RSS feed is now sorted by date, newest first + - Fixed pagination + - Fixed summaries on BlogHolder + - Fixed issues with display by month when blog post is on last month of the day + - BlogEntry::Tags() was renamed to TagsCollection() to prevent conflicts with the database fields called Tags + - Fixed invalid use of single quotes in BlogEntryForm HTML + - Fixed extra

tags around blog content + - Default parent needs to be a string instead of an array + - Fixed escaping in BlogHolder + - Use themedCSS instead of hardlinking paths + - Fixed rss feed caching + - Fixed archive widget showing months and years for unpublished posts + - SetDate doesn't need to be called, as the date is automatically set + + +0.1 + +Initial release diff --git a/README b/README index 4e45cdf..4e582d7 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ #################################################### -Blog Moudle +Blog Module #################################################### # Maintainer Contact @@ -7,13 +7,9 @@ Andrew O'Neil (Nickname: aoneil) # Requirements -... +SilverStripe minimum version 2.3.0 # Documentation http://doc.silverstripe.com/doku.php?id=modules:blog -# Installation Instructions -... -# Usage Overview -... \ No newline at end of file From 3c8df2e6236cccba325c7689d277ec5263a319ce Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Thu, 18 Dec 2008 05:26:43 +0000 Subject: [PATCH 117/250] MINOR: added seperate URLTag element so you can use the tag segment for something else --- code/BlogEntry.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index abe4468..85e051b 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -100,7 +100,8 @@ class BlogEntry extends Page { foreach($tags as $tag) { $output->push(new ArrayData(array( 'Tag' => $tag, - 'Link' => $this->getParent()->Link() . 'tag/' . urlencode($tag) + 'Link' => $this->getParent()->Link() . 'tag/' . urlencode($tag), + 'URLTag' => urlencode($tag) ))); } From ff4a95ec26c52b306fa4b246836e73088d0b0ca1 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 12 Jan 2009 04:35:57 +0000 Subject: [PATCH 118/250] MINOR Updated translations --- lang/ar_SA.php | 1 + lang/bg_BG.php | 1 + lang/de_DE.php | 2 ++ lang/fr_FR.php | 1 + lang/is_IS.php | 1 + lang/it_IT.php | 31 +++++++++++++++++++++++++++++++ lang/nl_NL.php | 26 ++++++++++++++++++++++++++ lang/pl_PL.php | 1 + lang/ru_RU.php | 3 ++- lang/tr_TR.php | 1 + 10 files changed, 67 insertions(+), 1 deletion(-) diff --git a/lang/ar_SA.php b/lang/ar_SA.php index b9fc088..ad29c13 100644 --- a/lang/ar_SA.php +++ b/lang/ar_SA.php @@ -48,6 +48,7 @@ $lang['ar_SA']['BlogManagementWidget.ss']['POSTNEW'] = 'نشر تدوينة جد $lang['ar_SA']['BlogManagementWidget']['UNM1'] = 'يوجد تعليق واحد لا يحتاج إلى مواÙقة'; $lang['ar_SA']['BlogManagementWidget']['UNMM'] = 'يوجد %i تعليقات لا تحتاج إلى مواÙقة'; $lang['ar_SA']['BlogSummary.ss']['COMMENTS'] = 'التعليقات'; +$lang['ar_SA']['BlogSummary.ss']['POSTEDBY'] = 'بواسطة'; $lang['ar_SA']['BlogSummary.ss']['POSTEDON'] = 'ÙÙŠ'; $lang['ar_SA']['BlogSummary.ss']['VIEWFULL'] = 'عرض كامل التدوينة'; $lang['ar_SA']['RSSWidget']['CT'] = 'العنوان المخصص للخلاصة'; diff --git a/lang/bg_BG.php b/lang/bg_BG.php index 72f9d65..9015a77 100644 --- a/lang/bg_BG.php +++ b/lang/bg_BG.php @@ -48,6 +48,7 @@ $lang['bg_BG']['BlogManagementWidget.ss']['POSTNEW'] = 'Публикувайте $lang['bg_BG']['BlogManagementWidget']['UNM1'] = 'Вие имате 1 непрегледан коментар'; $lang['bg_BG']['BlogManagementWidget']['UNMM'] = 'Вие имате %i непрегледани коментара'; $lang['bg_BG']['BlogSummary.ss']['COMMENTS'] = 'Коментари'; +$lang['bg_BG']['BlogSummary.ss']['POSTEDBY'] = 'Публикувано от'; $lang['bg_BG']['BlogSummary.ss']['POSTEDON'] = 'на'; $lang['bg_BG']['BlogSummary.ss']['VIEWFULL'] = 'Разгледай цÑлата ÑтатиÑ'; $lang['bg_BG']['RSSWidget']['CT'] = 'СобÑтвено заглавие за емиÑиÑта'; diff --git a/lang/de_DE.php b/lang/de_DE.php index 5803db9..c189964 100644 --- a/lang/de_DE.php +++ b/lang/de_DE.php @@ -48,7 +48,9 @@ $lang['de_DE']['BlogManagementWidget.ss']['POSTNEW'] = 'Neuen Eintrag schreiben' $lang['de_DE']['BlogManagementWidget']['UNM1'] = 'Sie haben 1 noch nicht moderierten Kommentar'; $lang['de_DE']['BlogManagementWidget']['UNMM'] = 'Sie haben %i noch nicht moderierte Kommentare'; $lang['de_DE']['BlogSummary.ss']['COMMENTS'] = 'Kommentare'; +$lang['de_DE']['BlogSummary.ss']['POSTEDBY'] = 'Verfasst von'; $lang['de_DE']['BlogSummary.ss']['POSTEDON'] = 'am'; +$lang['de_DE']['BlogSummary.ss']['VIEWFULL'] = 'Detaillierte Ansicht von dem Titel --'; $lang['de_DE']['RSSWidget']['CT'] = 'Eigener Titel für den feed'; $lang['de_DE']['RSSWidget']['NTS'] = 'Anzahl der angezeigten Items'; $lang['de_DE']['RSSWidget']['URL'] = 'URL des RSS Feed'; diff --git a/lang/fr_FR.php b/lang/fr_FR.php index 1f66042..05b9c55 100644 --- a/lang/fr_FR.php +++ b/lang/fr_FR.php @@ -48,6 +48,7 @@ $lang['fr_FR']['BlogManagementWidget.ss']['POSTNEW'] = 'Publier une nouvelle ent $lang['fr_FR']['BlogManagementWidget']['UNM1'] = 'Vous avez 1 commentaire non modéré'; $lang['fr_FR']['BlogManagementWidget']['UNMM'] = 'Vous avez %i commentaires non modérés'; $lang['fr_FR']['BlogSummary.ss']['COMMENTS'] = 'Commentaires'; +$lang['fr_FR']['BlogSummary.ss']['POSTEDBY'] = 'Posté par'; $lang['fr_FR']['BlogSummary.ss']['POSTEDON'] = 'sur'; $lang['fr_FR']['BlogSummary.ss']['VIEWFULL'] = 'Voir le titre du post en entier -'; $lang['fr_FR']['RSSWidget']['CT'] = 'Titre personnalisé pour le flux'; diff --git a/lang/is_IS.php b/lang/is_IS.php index 26e5236..d679a2f 100644 --- a/lang/is_IS.php +++ b/lang/is_IS.php @@ -49,6 +49,7 @@ $lang['is_IS']['BlogManagementWidget.ss']['POSTNEW'] = 'Birta nýju blogg færsl $lang['is_IS']['BlogManagementWidget']['UNM1'] = 'Þú átt 1 óskoðaða athugasemd'; $lang['is_IS']['BlogManagementWidget']['UNMM'] = 'Þú átt %i óskoðaða athugasemd'; $lang['is_IS']['BlogSummary.ss']['COMMENTS'] = 'Athugasemdir'; +$lang['is_IS']['BlogSummary.ss']['POSTEDBY'] = 'Skráð af'; $lang['is_IS']['BlogSummary.ss']['POSTEDON'] = 'á'; $lang['is_IS']['BlogSummary.ss']['VIEWFULL'] = 'Skoða alla færslu -'; $lang['is_IS']['RSSWidget']['CT'] = 'Titill fyrir þjónustuna'; diff --git a/lang/it_IT.php b/lang/it_IT.php index 020d24f..c7469b5 100644 --- a/lang/it_IT.php +++ b/lang/it_IT.php @@ -16,14 +16,45 @@ if(array_key_exists('it_IT', $lang) && is_array($lang['it_IT'])) { $lang['it_IT'] = $lang['en_US']; } +$lang['it_IT']['ArchiveWidget']['DispBY'] = 'Visualizzato da'; $lang['it_IT']['ArchiveWidget']['MONTH'] = 'mese'; $lang['it_IT']['ArchiveWidget']['YEAR'] = 'anno'; $lang['it_IT']['BlogEntry']['AU'] = 'Autore'; +$lang['it_IT']['BlogEntry']['BBH'] = 'Aiuto BBCode'; +$lang['it_IT']['BlogEntry']['CN'] = 'Contenuto'; $lang['it_IT']['BlogEntry']['DT'] = 'Data'; $lang['it_IT']['BlogEntry.ss']['COMMENTS'] = 'Commenti'; +$lang['it_IT']['BlogEntry.ss']['EDITTHIS'] = 'Modifica questo post'; +$lang['it_IT']['BlogEntry.ss']['POSTEDBY'] = 'Inserito da'; +$lang['it_IT']['BlogEntry.ss']['POSTEDON'] = 'su'; +$lang['it_IT']['BlogEntry.ss']['TAGS'] = 'Etichette:'; +$lang['it_IT']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Non pubblicare questo post'; +$lang['it_IT']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Visualizza tutti i post con etichetta'; +$lang['it_IT']['BlogEntry']['TS'] = 'Etichette (separate da virgola)'; +$lang['it_IT']['BlogHolder']['HAVENTPERM'] = 'Scrivere nel blog è un\'attività dell\'amministratore. Accedi come amministratore.'; +$lang['it_IT']['BlogHolder']['POST'] = 'Salva il post nel blog'; +$lang['it_IT']['BlogHolder']['RSSFEED'] = 'RSS feed di questo blog'; $lang['it_IT']['BlogHolder']['SJ'] = 'Soggetto'; +$lang['it_IT']['BlogHolder']['SPUC'] = 'Per favore separa le etichette usando virgole.'; +$lang['it_IT']['BlogHolder.ss']['NOENTRIES'] = 'Non ci sono voci nel blog'; +$lang['it_IT']['BlogHolder.ss']['VIEWINGTAGGED'] = 'Visualizza voci con etichetta'; +$lang['it_IT']['BlogHolder']['SUCCONTENT'] = 'Congratulazioni, il blog SilverStripe è stato installato correttamente. Questo messaggio del blog può essere eliminato. Puoi configurare l\'aspetto del tuo blog (come la visualizzazione dei widgets nella sidebar) in [url=admin] del CMS[/url]'; $lang['it_IT']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; +$lang['it_IT']['BlogHolder']['SUCTITLE'] = 'Modulo blog SilverStripe installato correttamente'; +$lang['it_IT']['BlogHolder']['TE'] = 'Ad esempio: sport, personale, fantascienza'; +$lang['it_IT']['BlogManagementWidget']['COMADM'] = 'Amministrazione commenti'; +$lang['it_IT']['BlogManagementWidget.ss']['LOGOUT'] = 'Esci'; +$lang['it_IT']['BlogManagementWidget.ss']['POSTNEW'] = 'Inserisci un nuovo post'; +$lang['it_IT']['BlogManagementWidget']['UNM1'] = 'Hai 1 commento da moderare'; +$lang['it_IT']['BlogManagementWidget']['UNMM'] = 'Hai %i commenti non approvati'; $lang['it_IT']['BlogSummary.ss']['COMMENTS'] = 'Commenti'; +$lang['it_IT']['BlogSummary.ss']['POSTEDBY'] = 'Inserito da'; +$lang['it_IT']['BlogSummary.ss']['POSTEDON'] = 'su'; +$lang['it_IT']['BlogSummary.ss']['VIEWFULL'] = 'Visualizza post intitolato - '; +$lang['it_IT']['RSSWidget']['CT'] = 'Titolo del feed'; +$lang['it_IT']['RSSWidget']['NTS'] = 'Numero di argomenti da visualizzare'; +$lang['it_IT']['RSSWidget']['URL'] = 'URL per il Feed RSS'; +$lang['it_IT']['TagCloudWidget']['LIMIT'] = 'Limitare il numero dei tag a'; $lang['it_IT']['TagCloudWidget']['SBAL'] = 'alfabeto'; $lang['it_IT']['TagCloudWidget']['SBFREQ'] = 'frequenza'; $lang['it_IT']['TagCloudWidget']['SORTBY'] = 'Ordina per'; diff --git a/lang/nl_NL.php b/lang/nl_NL.php index 35afd06..8df768c 100644 --- a/lang/nl_NL.php +++ b/lang/nl_NL.php @@ -16,6 +16,13 @@ if(array_key_exists('nl_NL', $lang) && is_array($lang['nl_NL'])) { $lang['nl_NL'] = $lang['en_US']; } +$lang['nl_NL']['ArchiveWidget']['DispBY'] = 'Tonen door'; +$lang['nl_NL']['ArchiveWidget']['MONTH'] = 'maand'; +$lang['nl_NL']['ArchiveWidget']['YEAR'] = 'jaar'; +$lang['nl_NL']['BlogEntry']['AU'] = 'Auteur'; +$lang['nl_NL']['BlogEntry']['BBH'] = 'BBCode hulp'; +$lang['nl_NL']['BlogEntry']['CN'] = 'Inhoud'; +$lang['nl_NL']['BlogEntry']['DT'] = 'Datum'; $lang['nl_NL']['BlogEntry.ss']['COMMENTS'] = 'Reacties'; $lang['nl_NL']['BlogEntry.ss']['EDITTHIS'] = 'Bewerk dit post'; $lang['nl_NL']['BlogEntry.ss']['POSTEDBY'] = 'Auteur'; @@ -23,15 +30,34 @@ $lang['nl_NL']['BlogEntry.ss']['POSTEDON'] = 'Aan'; $lang['nl_NL']['BlogEntry.ss']['TAGS'] = 'Tags:'; $lang['nl_NL']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'onpubliceer dit post'; $lang['nl_NL']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Bekijk alle posten getiteld'; +$lang['nl_NL']['BlogEntry']['TS'] = 'Tags (Komma gescheiden)'; +$lang['nl_NL']['BlogHolder']['HAVENTPERM'] = 'Het plaatsen van blogartikelen is een beheerder taak. Log aub in.'; +$lang['nl_NL']['BlogHolder']['POST'] = 'Blogartikel plaatsen'; +$lang['nl_NL']['BlogHolder']['RSSFEED'] = 'RSS-feed van deze blog'; +$lang['nl_NL']['BlogHolder']['SJ'] = 'Onderwerp'; +$lang['nl_NL']['BlogHolder']['SPUC'] = 'Scheid de tags met behulp van komma\'s.'; $lang['nl_NL']['BlogHolder.ss']['NOENTRIES'] = 'Er zijn geen blog entrees '; $lang['nl_NL']['BlogHolder.ss']['VIEWINGTAGGED'] = 'U bekijkt entrees tagged met'; +$lang['nl_NL']['BlogHolder']['SUCCONTENT'] = 'Gefeliciteerd, de SilverStripe blog module is met succes geïnstalleerd. Dit blogartikel kan veilig worden verwijderd. U kunt aspecten van uw blog (zoals de widgets weergegeven in de zijbalk) in [url=admin]het CMS[/url] veranderen.'; +$lang['nl_NL']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; +$lang['nl_NL']['BlogHolder']['SUCTITLE'] = 'SilverStripe blog module met succes geïnstalleerd'; +$lang['nl_NL']['BlogHolder']['TE'] = 'Bijvoorbeeld: sport, persoonlijke, science fiction'; +$lang['nl_NL']['BlogManagementWidget']['COMADM'] = 'Opmerking administratie'; $lang['nl_NL']['BlogManagementWidget.ss']['LOGOUT'] = 'Afmelden'; $lang['nl_NL']['BlogManagementWidget.ss']['POSTNEW'] = 'Publiceer een nieuw blog entree'; +$lang['nl_NL']['BlogManagementWidget']['UNM1'] = 'U heeft 1 niet gecontroleerde opmerking'; +$lang['nl_NL']['BlogManagementWidget']['UNMM'] = 'U heeft %i niet gecontroleerde opmerkingen'; $lang['nl_NL']['BlogSummary.ss']['COMMENTS'] = 'Reacties'; +$lang['nl_NL']['BlogSummary.ss']['POSTEDBY'] = 'Geplaatst door'; $lang['nl_NL']['BlogSummary.ss']['POSTEDON'] = 'Aan'; $lang['nl_NL']['BlogSummary.ss']['VIEWFULL'] = 'Bekijk het gehele post getitled'; +$lang['nl_NL']['RSSWidget']['CT'] = 'Aangepaste titel voor de RSS-feed'; +$lang['nl_NL']['RSSWidget']['NTS'] = 'Aantal objecten tonen'; +$lang['nl_NL']['RSSWidget']['URL'] = 'URL van de RSS-feed'; +$lang['nl_NL']['TagCloudWidget']['LIMIT'] = 'Beperk aantal tags'; $lang['nl_NL']['TagCloudWidget']['SBAL'] = 'alfabet'; $lang['nl_NL']['TagCloudWidget']['SBFREQ'] = 'frequentie'; $lang['nl_NL']['TagCloudWidget']['SORTBY'] = 'Sorteer bij'; +$lang['nl_NL']['TagCloudWidget']['TILE'] = 'Titel'; ?> \ No newline at end of file diff --git a/lang/pl_PL.php b/lang/pl_PL.php index 2c6a555..187889c 100644 --- a/lang/pl_PL.php +++ b/lang/pl_PL.php @@ -48,6 +48,7 @@ $lang['pl_PL']['BlogManagementWidget.ss']['POSTNEW'] = 'Dodaj nowy wpis'; $lang['pl_PL']['BlogManagementWidget']['UNM1'] = 'Masz 1 niesprawdzony komentarz'; $lang['pl_PL']['BlogManagementWidget']['UNMM'] = 'Masz %i niesprawdzonych komentarzy'; $lang['pl_PL']['BlogSummary.ss']['COMMENTS'] = 'Komentarze'; +$lang['pl_PL']['BlogSummary.ss']['POSTEDBY'] = 'Napisane przez'; $lang['pl_PL']['BlogSummary.ss']['POSTEDON'] = 'w'; $lang['pl_PL']['BlogSummary.ss']['VIEWFULL'] = 'Zobacz peÅ‚ny post zatytuÅ‚owany - '; $lang['pl_PL']['RSSWidget']['CT'] = 'TytuÅ‚ dla kanaÅ‚u'; diff --git a/lang/ru_RU.php b/lang/ru_RU.php index 5f4ac94..11a5347 100644 --- a/lang/ru_RU.php +++ b/lang/ru_RU.php @@ -41,13 +41,14 @@ $lang['ru_RU']['BlogHolder.ss']['VIEWINGTAGGED'] = 'ПроÑмотр Ð·Ð°Ð¿Ð¸Ñ $lang['ru_RU']['BlogHolder']['SUCCONTENT'] = 'ПоздравлÑем, модуль блога SilverStripe был уÑпешно уÑтановлен. Эта запиÑÑŒ в блоге может быть удалена. Ð’Ñ‹ можете наÑтроить вид блога (например, отображение виджетов в боковой панели) в [url=admin]СиÑтеме Ð£Ð¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¡Ð¾Ð´ÐµÑ€Ð¶Ð¸Ð¼Ñ‹Ð¼[/url].'; $lang['ru_RU']['BlogHolder']['SUCTAGS'] = 'silverstripe, блог'; $lang['ru_RU']['BlogHolder']['SUCTITLE'] = 'Модуль блога SilverStripe уÑпешно уÑтановлен'; -$lang['ru_RU']['BlogHolder']['TE'] = 'Ðапример, Ñпорт, личное, фантаÑтика'; +$lang['ru_RU']['BlogHolder']['TE'] = 'Ðапример - Ñпорт, личное, фантаÑтика'; $lang['ru_RU']['BlogManagementWidget']['COMADM'] = 'Управление комментариÑми'; $lang['ru_RU']['BlogManagementWidget.ss']['LOGOUT'] = 'Выход'; $lang['ru_RU']['BlogManagementWidget.ss']['POSTNEW'] = 'Опубликовать новую запиÑÑŒ'; $lang['ru_RU']['BlogManagementWidget']['UNM1'] = 'У Ð²Ð°Ñ 1 непроверенный комментарий'; $lang['ru_RU']['BlogManagementWidget']['UNMM'] = 'У Ð²Ð°Ñ %i непроверенных комментариев'; $lang['ru_RU']['BlogSummary.ss']['COMMENTS'] = 'Комментарии'; +$lang['ru_RU']['BlogSummary.ss']['POSTEDBY'] = 'Ðвтор:'; $lang['ru_RU']['BlogSummary.ss']['POSTEDON'] = ':'; $lang['ru_RU']['BlogSummary.ss']['VIEWFULL'] = 'См. полноÑтью запиÑÑŒ под названием: '; $lang['ru_RU']['RSSWidget']['CT'] = 'СобÑтвенное название ленты новоÑтей'; diff --git a/lang/tr_TR.php b/lang/tr_TR.php index 0244791..15cbbc7 100644 --- a/lang/tr_TR.php +++ b/lang/tr_TR.php @@ -48,6 +48,7 @@ $lang['tr_TR']['BlogManagementWidget.ss']['POSTNEW'] = 'Yeni bir blog girdisi ol $lang['tr_TR']['BlogManagementWidget']['UNM1'] = '1 adet onay bekleyen yorumunuz var'; $lang['tr_TR']['BlogManagementWidget']['UNMM'] = '%i adet onay bekleyen yorumunuz var'; $lang['tr_TR']['BlogSummary.ss']['COMMENTS'] = 'Yorumlar'; +$lang['tr_TR']['BlogSummary.ss']['POSTEDBY'] = 'Gönderen: '; $lang['tr_TR']['BlogSummary.ss']['POSTEDON'] = 'üzerinde'; $lang['tr_TR']['BlogSummary.ss']['VIEWFULL'] = 'Postun tamamını görüntüle -'; $lang['tr_TR']['RSSWidget']['CT'] = 'Besleme için özel baÅŸlık'; From 4340fb91dba6cc3740efbd0da09c2846309dd1ad Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 12 Jan 2009 04:58:29 +0000 Subject: [PATCH 119/250] MINOR Updated language master tables --- lang/en_US.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lang/en_US.php b/lang/en_US.php index 00a64b6..6609931 100644 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -90,6 +90,18 @@ $lang['en_US']['RSSWidget']['SINGULARNAME'] = array( 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' ); $lang['en_US']['RSSWidget']['URL'] = 'URL of RSS Feed'; +$lang['en_US']['SubscribeRSSWidget']['PLURALNAME'] = array( + 'Subscribe R S S Widgets', + 50, + 'Pural name of the object, used in dropdowns and to generally identify a collection of this object in the interface' +); +$lang['en_US']['SubscribeRSSWidget']['SINGULARNAME'] = array( + 'Subscribe R S S Widget', + 50, + 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' +); +$lang['en_US']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Subscribe'; +$lang['en_US']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Subscribe to this blog via RSS'; $lang['en_US']['TagCloudWidget']['LIMIT'] = 'Limit number of tags'; $lang['en_US']['TagCloudWidget']['PLURALNAME'] = array( 'Tag Cloud Widgets', From 94391c22d7f68e0d1d5e143c74dbf893f1afce53 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Mon, 12 Jan 2009 22:27:05 +0000 Subject: [PATCH 120/250] BUGFIX Allow SearchForm URL action for default SS search on BlogEntry --- code/BlogEntry.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 85e051b..2239fe7 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -181,7 +181,8 @@ class BlogEntry_Controller extends Page_Controller { static $allowed_actions = array( 'trackbackping', 'unpublishPost', - 'PageComments' + 'PageComments', + 'SearchForm' ); function init() { From c18af6c47322eb206e5419438b5044971261a41a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 13 Jan 2009 22:03:27 +0000 Subject: [PATCH 121/250] MINOR Updated translations --- lang/tr_TR.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lang/tr_TR.php b/lang/tr_TR.php index 15cbbc7..24d4b57 100644 --- a/lang/tr_TR.php +++ b/lang/tr_TR.php @@ -18,11 +18,15 @@ if(array_key_exists('tr_TR', $lang) && is_array($lang['tr_TR'])) { $lang['tr_TR']['ArchiveWidget']['DispBY'] = 'Görüntüle'; $lang['tr_TR']['ArchiveWidget']['MONTH'] = 'ay'; +$lang['tr_TR']['ArchiveWidget']['PLURALNAME'] = 'ArÅŸiv Zımbırtıları'; +$lang['tr_TR']['ArchiveWidget']['SINGULARNAME'] = 'ArÅŸiv Zımbırtısı'; $lang['tr_TR']['ArchiveWidget']['YEAR'] = 'yıl'; $lang['tr_TR']['BlogEntry']['AU'] = 'Yazar'; $lang['tr_TR']['BlogEntry']['BBH'] = 'BBCode yardımı'; $lang['tr_TR']['BlogEntry']['CN'] = 'İçerik'; $lang['tr_TR']['BlogEntry']['DT'] = 'Tarih'; +$lang['tr_TR']['BlogEntry']['PLURALNAME'] = 'Blog Girdileri'; +$lang['tr_TR']['BlogEntry']['SINGULARNAME'] = 'Blog Girdisi'; $lang['tr_TR']['BlogEntry.ss']['COMMENTS'] = 'Yorumlar'; $lang['tr_TR']['BlogEntry.ss']['EDITTHIS'] = 'Bu girdiyi yeniden düzenle'; $lang['tr_TR']['BlogEntry.ss']['POSTEDBY'] = 'Gönderen '; @@ -32,8 +36,10 @@ $lang['tr_TR']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Bu girdiyi yayından kaldır' $lang['tr_TR']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Etiketlenen tüm girdileri görüntüle'; $lang['tr_TR']['BlogEntry']['TS'] = 'Etiketler (virgülle ayrılmış)'; $lang['tr_TR']['BlogHolder']['HAVENTPERM'] = 'Sadece yöneticiler blog girebilirler. Lütfen oturum açın.'; +$lang['tr_TR']['BlogHolder']['PLURALNAME'] = 'Blog Sahipleri'; $lang['tr_TR']['BlogHolder']['POST'] = 'Blog girdisi gönderin'; $lang['tr_TR']['BlogHolder']['RSSFEED'] = 'Bu blog\'un RSS beslemesi'; +$lang['tr_TR']['BlogHolder']['SINGULARNAME'] = 'Blog Sahibi'; $lang['tr_TR']['BlogHolder']['SJ'] = 'Konu'; $lang['tr_TR']['BlogHolder']['SPUC'] = 'Lüfen etiketleri virgülle ayırın.'; $lang['tr_TR']['BlogHolder.ss']['NOENTRIES'] = 'Blog girdileri mevcut deÄŸil'; @@ -43,6 +49,8 @@ $lang['tr_TR']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; $lang['tr_TR']['BlogHolder']['SUCTITLE'] = 'SilverStripe blog modülü baÅŸarıyla kuruldu'; $lang['tr_TR']['BlogHolder']['TE'] = 'ÖrneÄŸin: spor, kiÅŸisel, bilim kurgu'; $lang['tr_TR']['BlogManagementWidget']['COMADM'] = 'Yorum yönetimi'; +$lang['tr_TR']['BlogManagementWidget']['PLURALNAME'] = 'Blog Yönetim Zımbırtıları'; +$lang['tr_TR']['BlogManagementWidget']['SINGULARNAME'] = 'Blog Yönetim Zımbırtısı'; $lang['tr_TR']['BlogManagementWidget.ss']['LOGOUT'] = 'Oturumu kapat'; $lang['tr_TR']['BlogManagementWidget.ss']['POSTNEW'] = 'Yeni bir blog girdisi oluÅŸtur'; $lang['tr_TR']['BlogManagementWidget']['UNM1'] = '1 adet onay bekleyen yorumunuz var'; @@ -53,11 +61,21 @@ $lang['tr_TR']['BlogSummary.ss']['POSTEDON'] = 'üzerinde'; $lang['tr_TR']['BlogSummary.ss']['VIEWFULL'] = 'Postun tamamını görüntüle -'; $lang['tr_TR']['RSSWidget']['CT'] = 'Besleme için özel baÅŸlık'; $lang['tr_TR']['RSSWidget']['NTS'] = 'Görüntülenecek öğe adedi'; +$lang['tr_TR']['RSSWidget']['PLURALNAME'] = 'R S S Zımbırtıları'; +$lang['tr_TR']['RSSWidget']['SINGULARNAME'] = 'R S S Zımbırtısı'; $lang['tr_TR']['RSSWidget']['URL'] = 'RSS beslemesi\'nin URL\'i'; +$lang['tr_TR']['SubscribeRSSWidget']['PLURALNAME'] = 'R S S Zımbırtılarına abone ol'; +$lang['tr_TR']['SubscribeRSSWidget']['SINGULARNAME'] = 'R S S Zımbırtısına abone ol'; +$lang['tr_TR']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Abone Ol'; +$lang['tr_TR']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Bu bloÄŸa RSS ile abone ol'; $lang['tr_TR']['TagCloudWidget']['LIMIT'] = 'Etiket sayısini sınırla'; +$lang['tr_TR']['TagCloudWidget']['PLURALNAME'] = 'Etiket Bulutu Zımbırtıları'; $lang['tr_TR']['TagCloudWidget']['SBAL'] = 'alfabe'; $lang['tr_TR']['TagCloudWidget']['SBFREQ'] = 'frekans'; +$lang['tr_TR']['TagCloudWidget']['SINGULARNAME'] = 'Etiket Bulutu Zımbırtısı'; $lang['tr_TR']['TagCloudWidget']['SORTBY'] = 'Sıralama'; $lang['tr_TR']['TagCloudWidget']['TILE'] = 'BaÅŸlık'; +$lang['tr_TR']['TrackBackPing']['PLURALNAME'] = 'Geri Ä°z Yoklamaları'; +$lang['tr_TR']['TrackBackPing']['SINGULARNAME'] = 'Geri Ä°z Yoklaması'; ?> \ No newline at end of file From 32f4579718ee2c38caa58982748a4520102bc759 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Tue, 20 Jan 2009 04:01:45 +0000 Subject: [PATCH 122/250] MINOR: added empty statics to blog --- code/ArchiveWidget.php | 8 ++++++++ code/BlogEntry.php | 11 +++++------ code/BlogHolder.php | 10 ++++++---- code/BlogManagementWidget.php | 16 +++++++++++++++- code/RSSWidget.php | 7 +++++++ code/TagCloudWidget.php | 8 ++++++++ code/TrackBackPing.php | 6 ++++++ 7 files changed, 55 insertions(+), 11 deletions(-) diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index 93227b4..7e5db71 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -6,9 +6,17 @@ * @package blog */ class ArchiveWidget extends Widget { + static $db = array( 'DisplayMode' => 'Varchar' ); + static $has_one = array(); + + static $has_many = array(); + + static $many_many = array(); + + static $belongs_many_many = array(); static $defaults = array( 'DisplayMode' => 'month' diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 2239fe7..8a36c12 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -18,14 +18,13 @@ class BlogEntry extends Page { "Tags" => "Text" ); - static $has_one = array( - ); + static $has_one = array(); - static $has_many = array( - ); + static $has_many = array(); - static $many_many = array( - ); + static $many_many = array(); + + static $belongs_many_many = array(); static $defaults = array( "ProvideComments" => true, diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 2bdc475..5cccf10 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -22,11 +22,13 @@ class BlogHolder extends Page { "SideBar" => "WidgetArea" ); - static $has_many = array( - ); + static $has_many = array(); - static $many_many = array( - ); + static $many_many = array(); + + static $belongs_many_many = array(); + + static $defaults = array(); static $allowed_children = array( 'BlogEntry' diff --git a/code/BlogManagementWidget.php b/code/BlogManagementWidget.php index 0fbb41e..57be2bd 100644 --- a/code/BlogManagementWidget.php +++ b/code/BlogManagementWidget.php @@ -1,8 +1,22 @@ "Text", "NumberToShow" => "Int" ); + static $has_one = array(); + + static $has_many = array(); + + static $many_many = array(); + + static $belongs_many_many = array(); static $defaults = array( "NumberToShow" => 10, diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index 46e42d1..6500c3b 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -7,6 +7,14 @@ class TagCloudWidget extends Widget { "Sortby" => "Varchar" ); + static $has_one = array(); + + static $has_many = array(); + + static $many_many = array(); + + static $belongs_many_many = array(); + static $defaults = array( "Title" => "Tag Cloud", "Limit" => "0", diff --git a/code/TrackBackPing.php b/code/TrackBackPing.php index 900a50a..899346e 100644 --- a/code/TrackBackPing.php +++ b/code/TrackBackPing.php @@ -11,6 +11,12 @@ class TrackBackPing extends DataObject { static $has_one = array( 'Page' => 'Page' ); + + static $has_many = array(); + + static $many_many = array(); + + static $belongs_many_many = array() } ?> From 058a3c393c7b1d4dbc712775a564b7da2bc45a2d Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Tue, 20 Jan 2009 04:37:44 +0000 Subject: [PATCH 123/250] BUGFIX: added missing semi colon --- code/TrackBackPing.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/TrackBackPing.php b/code/TrackBackPing.php index 899346e..a38771a 100644 --- a/code/TrackBackPing.php +++ b/code/TrackBackPing.php @@ -16,7 +16,7 @@ class TrackBackPing extends DataObject { static $many_many = array(); - static $belongs_many_many = array() + static $belongs_many_many = array(); } ?> From 94601547aff8347d2d3ebfaf39549c7a281ec9e6 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sat, 7 Feb 2009 02:19:27 +0000 Subject: [PATCH 124/250] FEATURE: added userblog support. Thanks simon_w - #3463 --- code/BlogEntry.php | 5 ++++- code/BlogHolder.php | 35 ++++++++++++++++++++++++------- code/BlogManagementWidget.php | 8 +++++-- templates/BlogManagementWidget.ss | 4 ++-- templates/Layout/BlogEntry.ss | 2 +- 5 files changed, 41 insertions(+), 13 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 8a36c12..bb73f93 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -167,6 +167,9 @@ class BlogEntry extends Page { } } + function IsOwner() { + return $this->Parent()->IsOwner(); + } /** * Call this to enable WYSIWYG editing on your blog entries. * By default the blog uses BBCode @@ -194,7 +197,7 @@ class BlogEntry_Controller extends Page_Controller { * Gets a link to unpublish the blog entry */ function unpublishPost() { - if(!Permission::check('ADMIN')) { + if(!$this->IsOwner()) { Security::permissionFailure( $this, 'Unpublishing blogs is an administrator task. Please log in.' diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 5cccf10..8a166a3 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -15,11 +15,13 @@ class BlogHolder extends Page { static $db = array( 'LandingPageFreshness' => 'Varchar', 'Name' => 'Varchar', - 'TrackBacksEnabled' => 'Boolean' + 'TrackBacksEnabled' => 'Boolean', + 'AllowCustomAuthors' => 'Boolean', ); static $has_one = array( - "SideBar" => "WidgetArea" + "SideBar" => "WidgetArea", + 'Owner' => 'Member', ); static $has_many = array(); @@ -57,6 +59,8 @@ class BlogHolder extends Page { ))); $fields->addFieldToTab('Root.Content.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks')); + $fields->addFieldToTab('Root.Content.Main', new DropdownField('OwnerID', 'Blog owner', DataObject::get('Member')->toDropDownMap('ID', 'Name', 'None'))); + $fields->addFieldToTab('Root.Content.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field')); return $fields; } @@ -119,6 +123,15 @@ class BlogHolder extends Page { return $this->Link('post'); } + /** + * Returns true if the current user is an admin, or is the owner of this blog + * + * @return Boolean + */ + function IsOwner() { + return Permission::check('ADMIN') || (Member::CurrentMember() && Member::CurrentMember()->ID == $this->OwnerID); + } + /** * Create default blog setup */ @@ -260,7 +273,7 @@ class BlogHolder_Controller extends Page_Controller { * Post a new blog entry */ function post(){ - if(!Permission::check('ADMIN')){ + if(!$this->IsOwner()){ Security::permissionFailure($this, _t('BlogHolder.HAVENTPERM', 'Posting blogs is an administrator task. Please log in.')); } @@ -315,11 +328,14 @@ class BlogHolder_Controller extends Page_Controller { } else { $tagfield = new TextField('Tags'); } - + $field = 'TextField'; + if(!$this->AllowCustomAuthors && !Permission::check('ADMIN')) { + $field = 'ReadonlyField'; + } $fields = new FieldSet( new HiddenField("ID", "ID"), new TextField("Title",_t('BlogHolder.SJ', "Subject")), - new TextField("Author",_t('BlogEntry.AU'),$membername), + new $field("Author",_t('BlogEntry.AU'),$membername), $contentfield, $tagfield, new LiteralField("Tagsnote","

\ No newline at end of file + diff --git a/templates/Layout/BlogEntry.ss b/templates/Layout/BlogEntry.ss index cc37068..fffc930 100644 --- a/templates/Layout/BlogEntry.ss +++ b/templates/Layout/BlogEntry.ss @@ -21,7 +21,7 @@
- <% if CurrentMember %>

<% _t('EDITTHIS', 'Edit this post') %> | <% _t('UNPUBLISHTHIS', 'Unpublish this post') %>

<% end_if %> + <% if IsOwner %>

<% _t('EDITTHIS', 'Edit this post') %> | <% _t('UNPUBLISHTHIS', 'Unpublish this post') %>

<% end_if %> <% if TrackBacksEnabled %> <% include TrackBacks %> From 0adb9da4665a6fce7023eeb46adad1fb59ef2bbd Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 25 Feb 2009 06:55:58 +0000 Subject: [PATCH 125/250] ENHANCEMENT Added 'rss' suffix to BlogHolder->rss() to point back to the feed properly (was causing feed validation errors) --- code/BlogHolder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 8a166a3..58eee37 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -257,7 +257,7 @@ class BlogHolder_Controller extends Page_Controller { $entries = $this->Entries(20); if($entries) { - $rss = new RSSFeed($entries, $this->Link(), ($blogName ? $blogName : $altBlogName), "", "Title", "ParsedContent"); + $rss = new RSSFeed($entries, $this->Link() . 'rss', ($blogName ? $blogName : $altBlogName), "", "Title", "ParsedContent"); $rss->outputToBrowser(); } } From baa470dd10e9522e266a50564938bc2c931a2a18 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Tue, 21 Apr 2009 23:06:12 +0000 Subject: [PATCH 126/250] Added css class to blog post titles --- templates/Includes/BlogSummary.ss | 2 +- templates/Layout/BlogEntry.ss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/Includes/BlogSummary.ss b/templates/Includes/BlogSummary.ss index 7904a6b..07a149c 100644 --- a/templates/Includes/BlogSummary.ss +++ b/templates/Includes/BlogSummary.ss @@ -1,5 +1,5 @@
-

$MenuTitle

+

$MenuTitle

<% _t('POSTEDBY', 'Posted by') %> $Author.XML <% _t('POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('COMMENTS', 'Comments') %>

<% if TagsCollection %>

diff --git a/templates/Layout/BlogEntry.ss b/templates/Layout/BlogEntry.ss index fffc930..524c538 100644 --- a/templates/Layout/BlogEntry.ss +++ b/templates/Layout/BlogEntry.ss @@ -3,7 +3,7 @@ <% include BreadCrumbs %>

-

$Title

+

$Title

<% _t('POSTEDBY', 'Posted by') %> $Author.XML <% _t('POSTEDON', 'on') %> $Date.Long | $Comments.Count <% _t('COMMENTS', 'Comments') %>

<% if TagsCollection %>

From 05b0992f7e803879327188ce42b9af2a771cfaf7 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Sun, 26 Apr 2009 23:52:14 +0000 Subject: [PATCH 127/250] MINOR: Show BlogManagementWidget if the user has permissions to post --- code/BlogManagementWidget.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/BlogManagementWidget.php b/code/BlogManagementWidget.php index 0ba2669..eca72ec 100644 --- a/code/BlogManagementWidget.php +++ b/code/BlogManagementWidget.php @@ -46,7 +46,7 @@ class BlogManagementWidget extends Widget { } function WidgetHolder() { - if($this->getBlogHolder()->IsOwner()) { + if($this->getBlogHolder()->canEdit()) { return $this->renderWith('WidgetHolder'); } return ''; @@ -71,4 +71,4 @@ class BlogManagementWidget extends Widget { } } -?> \ No newline at end of file +?> From 16c7b2d431932fd12c193151e23f926b5c61948f Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Thu, 30 Apr 2009 22:05:54 +0000 Subject: [PATCH 128/250] FEATURE: Add an additional level of blog container, called the tree. You can now use blogs in the previous manner (holder has many entries) or as a deep tree of many holders. Viewing a level up the tree will show all blog entries within that tree. @todo: More Tests Better documentation --- code/ArchiveWidget.php | 34 ++--- code/BlogHolder.php | 167 ++------------------- code/BlogManagementWidget.php | 23 +-- code/BlogTree.php | 268 ++++++++++++++++++++++++++++++++++ code/SubscribeRSSWidget.php | 24 +-- code/TagCloudWidget.php | 19 +-- tests/BlogTreeTest.php | 30 ++++ tests/BlogTreeTest.yml | 53 +++++++ 8 files changed, 392 insertions(+), 226 deletions(-) create mode 100644 code/BlogTree.php create mode 100644 tests/BlogTreeTest.php create mode 100644 tests/BlogTreeTest.yml diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index 7e5db71..7cec3ae 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -28,18 +28,6 @@ class ArchiveWidget extends Widget { static $description = 'Show a list of months or years in which there are blog posts, and provide links to them.'; - function getBlogHolder() { - $page = Director::currentPage(); - - if($page instanceof BlogHolder) { - return $page; - } elseif(($page instanceof BlogEntry) && ($page->getParent() instanceof BlogHolder)) { - return $page->getParent(); - } else { - return DataObject::get_one('BlogHolder'); - } - } - function getCMSFields() { return new FieldSet( new OptionsetField( @@ -57,17 +45,27 @@ class ArchiveWidget extends Widget { Requirements::themedCSS('archivewidget'); $results = new DataObjectSet(); - $blogHolder = $this->getBlogHolder(); - $id = $blogHolder->ID; + $container = BlogTree::current(); + $ids = $container->BlogHolderIDs(); $stage = Versioned::current_stage(); $suffix = (!$stage || $stage == 'Stage') ? "" : "_$stage"; if($this->DisplayMode == 'month') { - $sqlResults = DB::query("SELECT DISTINCT MONTH(`Date`) AS `Month`, YEAR(`Date`) AS `Year` FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` WHERE `ParentID` = $id ORDER BY `Date` DESC"); + $sqlResults = DB::query(" + SELECT DISTINCT MONTH(`Date`) AS `Month`, YEAR(`Date`) AS `Year` + FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` + WHERE `ParentID` in (".implode(', ',$ids).") + ORDER BY `Date` DESC" + ); } else { - $sqlResults = DB::query("SELECT DISTINCT YEAR(`Date`) AS `Year` FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` WHERE `ParentID` = $id ORDER BY `Date` DESC"); + $sqlResults = DB::query(" + SELECT DISTINCT YEAR(`Date`) AS `Year` + FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` + WHERE `ParentID` in (".implode(', ',$ids).") + ORDER BY `Date` DESC" + ); } if(!$sqlResults) return new DataObjectSet(); @@ -83,9 +81,9 @@ class ArchiveWidget extends Widget { )); if($this->DisplayMode == 'month') { - $link = $blogHolder->Link() . $sqlResult['Year']. '/' . sprintf("%'02d", $sqlResult['Month']); + $link = $container->Link() . $sqlResult['Year']. '/' . sprintf("%'02d", $sqlResult['Month']); } else { - $link = $blogHolder->Link() . $sqlResult['Year']; + $link = $container->Link() . $sqlResult['Year']; } $results->push(new ArrayData(array( diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 58eee37..e766729 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -5,59 +5,34 @@ */ /** - * Blog holder to display summarised blog entries + * Blog holder to display summarised blog entries. + * + * A blog holder is the leaf end of a BlogTree, but can also be used standalone in simpler circumstances. + * BlogHolders can only hold BlogEntries, BlogTrees can only hold BlogTrees and BlogHolders + * BlogHolders have a form on them for easy posting, and an owner that can post to them, BlogTrees don't */ - -class BlogHolder extends Page { +class BlogHolder extends BlogTree { static $icon = "blog/images/blogholder"; static $db = array( - 'LandingPageFreshness' => 'Varchar', 'Name' => 'Varchar', 'TrackBacksEnabled' => 'Boolean', 'AllowCustomAuthors' => 'Boolean', ); static $has_one = array( - "SideBar" => "WidgetArea", 'Owner' => 'Member', ); - static $has_many = array(); - - static $many_many = array(); - - static $belongs_many_many = array(); - - static $defaults = array(); - static $allowed_children = array( 'BlogEntry' ); function getCMSFields() { $fields = parent::getCMSFields(); - $fields->removeFieldFromTab("Root.Content.Main","Content"); - $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("SideBar")); $fields->addFieldToTab("Root.Content.Main", new TextField("Name", "Name of blog")); - - $fields->addFieldToTab('Root.Content.Main', new DropdownField('LandingPageFreshness', 'When you first open the blog, how many entries should I show', array( - "" => "All entries", - "1 MONTH" => "Last month's entries", - "2 MONTH" => "Last 2 months' entries", - "3 MONTH" => "Last 3 months' entries", - "4 MONTH" => "Last 4 months' entries", - "5 MONTH" => "Last 5 months' entries", - "6 MONTH" => "Last 6 months' entries", - "7 MONTH" => "Last 7 months' entries", - "8 MONTH" => "Last 8 months' entries", - "9 MONTH" => "Last 9 months' entries", - "10 MONTH" => "Last 10 months' entries", - "11 MONTH" => "Last 11 months' entries", - "12 MONTH" => "Last year's entries" - ))); - + $fields->addFieldToTab('Root.Content.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks')); $fields->addFieldToTab('Root.Content.Main', new DropdownField('OwnerID', 'Blog owner', DataObject::get('Member')->toDropDownMap('ID', 'Name', 'None'))); $fields->addFieldToTab('Root.Content.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field')); @@ -65,41 +40,14 @@ class BlogHolder extends Page { return $fields; } - /** - * Get entries in this blog. - * @param string limit A clause to insert into the limit clause. - * @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' - * @return DataObjectSet - */ - public function Entries($limit = '', $tag = '', $date = '') { - $tagCheck = ''; - $dateCheck = ''; - - if($tag) { - $SQL_tag = Convert::raw2sql($tag); - $tagCheck = "AND `BlogEntry`.Tags LIKE '%$SQL_tag%'"; - } - - if($date) { - if(strpos($date, '-')) { - $year = (int) substr($date, 0, strpos($date, '-')); - $month = (int) substr($date, strpos($date, '-') + 1); - - if($year && $month) { - $dateCheck = "AND MONTH(`BlogEntry`.Date) = $month AND YEAR(`BlogEntry`.Date) = $year"; - } - } else { - $year = (int) $date; - if($year) { - $dateCheck = "AND YEAR(`BlogEntry`.Date) = $year"; - } - } - } - - return DataObject::get("Page","`ParentID` = $this->ID $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$limit"); + public function BlogHolderIDs() { + return array( $this->ID ); } - + + /* + * @todo: These next few functions don't really belong in the model. Can we remove them? + */ + /** * Only display the blog entries that have the specified tag */ @@ -180,88 +128,12 @@ class BlogHolder extends Page { } } -class BlogHolder_Controller extends Page_Controller { +class BlogHolder_Controller extends BlogTree_Controller { function init() { parent::init(); - - // This will create a tag point to the RSS feed - RSSFeed::linkToFeed($this->Link() . "rss", _t('BlogHolder.RSSFEED',"RSS feed of this blog")); - Requirements::themedCSS("blog"); Requirements::themedCSS("bbcodehelp"); - } - - function BlogEntries($limit = 10) { - $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; - $tag = ''; - $date = ''; - if(Director::urlParams()) { - if(Director::urlParam('Action') == 'tag') { - $tag = Director::urlParam('ID'); - } else { - $year = Director::urlParam('Action'); - $month = Director::urlParam('ID'); - - if($month && is_numeric($month) && $month >= 1 && $month <= 12 && is_numeric($year)) { - $date = "$year-$month"; - } else if(is_numeric($year)) { - $date = $year; - } - } - } - - return $this->Entries("$start,$limit", $tag, $date); - } - - /** - * 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($this->ShowTag()) { - return array( - 'Tag' => $this->ShowTag() - ); - } else { - return array(); - } - } - - /** - * Get the rss feed for this blog holder's entries - */ - function rss() { - global $project; - - $blogName = $this->Name; - $altBlogName = $project . ' blog'; - - $entries = $this->Entries(20); - - if($entries) { - $rss = new RSSFeed($entries, $this->Link() . 'rss', ($blogName ? $blogName : $altBlogName), "", "Title", "ParsedContent"); - $rss->outputToBrowser(); - } - } - /** * Return list of usable tags for help */ @@ -284,16 +156,7 @@ class BlogHolder_Controller extends Page_Controller { return $page->renderWith('Page'); } - - function defaultAction($action) { - // Protection against infinite loops when an RSS widget pointing to this page is added to this page - if(stristr($_SERVER['HTTP_USER_AGENT'], 'SimplePie')) { - return $this->rss(); - } - return parent::defaultAction($action); - } - /** * A simple form for creating blog entries */ diff --git a/code/BlogManagementWidget.php b/code/BlogManagementWidget.php index eca72ec..67503e6 100644 --- a/code/BlogManagementWidget.php +++ b/code/BlogManagementWidget.php @@ -46,28 +46,15 @@ class BlogManagementWidget extends Widget { } function WidgetHolder() { - if($this->getBlogHolder()->canEdit()) { - return $this->renderWith('WidgetHolder'); - } + $container = BlogTree::current(); + + if ($container && $container instanceof BlogHolder && $container->canEdit()) return $this->renderWith('WidgetHolder'); return ''; } function PostLink() { - $blogholder = $this->getBlogHolder(); - - return $blogholder->Link('post'); - } - - function getBlogHolder() { - $page = Director::currentPage(); - - if($page->is_a("BlogHolder")) { - return $page; - } else if($page->is_a("BlogEntry") && $page->getParent()->is_a("BlogHolder")) { - return $page->getParent(); - } else { - return DataObject::get_one("BlogHolder"); - } + $container = BlogTree::current(); + if ($container) return $container->Link('post'); } } diff --git a/code/BlogTree.php b/code/BlogTree.php new file mode 100644 index 0000000..a5f0dfe --- /dev/null +++ b/code/BlogTree.php @@ -0,0 +1,268 @@ + 'Boolean', + 'LandingPageFreshness' => 'Varchar', + ); + + static $defaults = array( + 'InheritSideBar' => True + ); + + static $has_one = array( + "SideBar" => "WidgetArea", + ); + + static $allowed_children = array( + 'BlogTree', 'BlogHolder' + ); + + /* + * Finds the BlogTree object most related to the current page. + * - If this page is a BlogTree, use that + * - If this page is a BlogEntry, use the parent Holder + * - Otherwise, try and find a 'top-level' BlogTree + */ + static function current() { + $page = Director::currentPage(); + + // If we _are_ a BlogTree, use us + if ($page instanceof BlogTree) return $page; + + // Or, if we a a BlogEntry underneath a BlogTree, use our parent + if ($page->is_a("BlogEntry")) { + $parent = $page->getParent(); + if ($parent instanceof BlogTree) return $parent; + } + + // Try to find a top-level BlogTree + $top = DataObject::get_one('BlogTree','ParentId = 0'); + if ($top) return $top; + + // Try to find any BlogTree that is not inside another BlogTree + foreach(DataObject::get('BlogTree') as $tree) { + if (!($tree->getParent() instanceof BlogTree)) return $tree; + } + + // This shouldn't be possible, but assuming the above fails, just return anything you can get + return DataObject::get_one('BlogTree'); + } + + /* ----------- ACCESSOR OVERRIDES -------------- */ + + public function getLandingPageFreshness() { + $freshness = $this->getField('LandingPageFreshness'); + // If we want to inherit freshness, try that first + if ($freshness = "INHERIT" && $this->getParent()) $freshness = $this->getParent()->LandingPageFreshness; + // If we don't have a parent, or the inherited result was still inherit, use default + if ($freshness = "INHERIT") $freshness = ''; + + return $freshness; + } + + function SideBar() { + if ($this->InheritSideBar && $this->getParent()) return $this->getParent()->SideBar() ; + return $this->getComponent('SideBar'); + } + + /* ----------- CMS CONTROL -------------- */ + + function getCMSFields() { + $fields = parent::getCMSFields(); + $fields->addFieldToTab('Root.Content.Main', new DropdownField('LandingPageFreshness', 'When you first open the blog, how many entries should I show', array( + "" => "All entries", + "1 MONTH" => "Last month's entries", + "2 MONTH" => "Last 2 months' entries", + "3 MONTH" => "Last 3 months' entries", + "4 MONTH" => "Last 4 months' entries", + "5 MONTH" => "Last 5 months' entries", + "6 MONTH" => "Last 6 months' entries", + "7 MONTH" => "Last 7 months' entries", + "8 MONTH" => "Last 8 months' entries", + "9 MONTH" => "Last 9 months' entries", + "10 MONTH" => "Last 10 months' entries", + "11 MONTH" => "Last 11 months' entries", + "12 MONTH" => "Last year's entries", + "INHERIT" => "Take value from parent Blog Tree" + ))); + + $fields->addFieldToTab("Root.Content.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent')); + $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("SideBar")); + + return $fields; + } + + /* ----------- New accessors -------------- */ + + public function loadDescendantBlogHolderIDListInto(&$idList) { + if ($children = $this->AllChildren()) { + foreach($children as $child) { + if (in_array($child->ID, $idList)) continue; + + if ($child instanceof BlogHolder) $idList[] = $child->ID; + else $child->loadDescendantBlogHolderIDListInto($idList); + } + } + } + + // Build a list of all IDs for BlogHolders that are children of us + public function BlogHolderIDs() { + $holderIDs = array(); + $this->loadDescendantBlogHolderIDListInto($holderIDs); + return $holderIDs; + } + + /** + * Get entries in this blog. + * @param string limit A clause to insert into the limit clause. + * @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 + * @return DataObjectSet + */ + public function Entries($limit = '', $tag = '', $date = '', $retrieveCallback = null) { + $tagCheck = ''; + $dateCheck = ''; + + if ($tag) { + $SQL_tag = Convert::raw2sql($tag); + $tagCheck = "AND `BlogEntry`.Tags LIKE '%$SQL_tag%'"; + } + + if ($date) { + if(strpos($date, '-')) { + $year = (int) substr($date, 0, strpos($date, '-')); + $month = (int) substr($date, strpos($date, '-') + 1); + + if($year && $month) { + $dateCheck = "AND MONTH(`BlogEntry`.Date) = $month AND YEAR(`BlogEntry`.Date) = $year"; + } + } else { + $year = (int) $date; + if($year) { + $dateCheck = "AND YEAR(`BlogEntry`.Date) = $year"; + } + } + } + elseif ($this->LandingPageFreshness) { + $dateCheck = "AND `BlogEntry`.Date > NOW() - INTERVAL " . $this->LandingPageFreshness; + } + + // Build a list of all IDs for BlogHolders that are children of us + $holderIDs = $this->BlogHolderIDs(); + + // If no BlogHolders, no BlogEntries. So return false + if (empty($holderIDs)) return false; + + // Otherwise, do the actual query + $where = 'ParentID IN ('.implode(',', $holderIDs).") $tagCheck $dateCheck"; + + // 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); + else return DataObject::get('BlogEntry', $where, '`BlogEntry`.`Date` DESC', '', $limit); + } +} + +class BlogURL { + static function tag() { + if (Director::urlParam('Action') == 'tag') return Director::urlParam('ID'); + return ''; + } + + static function date() { + $year = Director::urlParam('Action'); + $month = Director::urlParam('ID'); + + if ($month && is_numeric($month) && $month >= 1 && $month <= 12 && is_numeric($year)) { + return "$year-$month"; + } + elseif (is_numeric($year)) { + return $year; + } + + return ''; + } +} + +class BlogTree_Controller extends Page_Controller { + function init() { + parent::init(); + + // This will create a tag point to the RSS feed + RSSFeed::linkToFeed($this->Link() . "rss", _t('BlogHolder.RSSFEED',"RSS feed of these blogs")); + Requirements::themedCSS("blog"); + } + + function BlogEntries($limit = 10) { + $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; + return $this->Entries("$start,$limit", BlogURL::tag(), BlogURL::date()); + } + + /* + * @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 + */ + function rss() { + global $project; + + $blogName = $this->Name; + $altBlogName = $project . ' blog'; + + $entries = $this->Entries(20); + + if($entries) { + $rss = new RSSFeed($entries, $this->Link(), ($blogName ? $blogName : $altBlogName), "", "Title", "ParsedContent"); + $rss->outputToBrowser(); + } + } + + function defaultAction($action) { + // Protection against infinite loops when an RSS widget pointing to this page is added to this page + if(stristr($_SERVER['HTTP_USER_AGENT'], 'SimplePie')) return $this->rss(); + + return parent::defaultAction($action); + } +} diff --git a/code/SubscribeRSSWidget.php b/code/SubscribeRSSWidget.php index e3f8c07..f2725e2 100644 --- a/code/SubscribeRSSWidget.php +++ b/code/SubscribeRSSWidget.php @@ -15,24 +15,6 @@ class SubscribeRSSWidget extends Widget { static $description = 'Shows a link allowing a user to subscribe to this blog via RSS.'; - /** - * Get the BlogHolder instance that this widget - * is located on. - * - * @return BlogHolder - */ - function getBlogHolder() { - $page = Director::currentPage(); - - if($page instanceof BlogHolder) { - return $page; - } elseif(($page instanceof BlogEntry) && ($page->getParent() instanceof BlogHolder)) { - return $page->getParent(); - } else { - return DataObject::get_one('BlogHolder'); - } - } - /** * Return an absolute URL based on the BlogHolder * that this widget is located on. @@ -41,10 +23,8 @@ class SubscribeRSSWidget extends Widget { */ function RSSLink() { Requirements::themedCSS('subscribersswidget'); - $blogHolder = $this->getBlogHolder(); - if($blogHolder) { - return $blogHolder->Link() . 'rss'; - } + $container = BlogTree::current(); + if ($container) return $container->Link() . 'rss'; } } diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index 6500c3b..e6925bb 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -24,19 +24,6 @@ class TagCloudWidget extends Widget { static $cmsTitle = "Tag Cloud"; static $description = "Shows a tag cloud of tags on your blog."; - function getBlogHolder() { - $page = Director::currentPage(); - - if($page->is_a("BlogHolder")) { - return $page; - } else if($page->is_a("BlogEntry") && $page->getParent()->is_a("BlogHolder")) { - return $page->getParent(); - } else { - return DataObject::get_one("BlogHolder"); - } - } - - function getCMSFields() { return new FieldSet( new TextField("Title", _t("TagCloudWidget.TILE", "Title")), @@ -54,9 +41,9 @@ class TagCloudWidget extends Widget { $allTags = array(); $max = 0; - $blogHolder = $this->getBlogHolder(); + $container = BlogTree::current(); - $entries = $blogHolder->Entries(); + $entries = $container->Entries(); if($entries) { foreach($entries as $entry) { @@ -117,7 +104,7 @@ class TagCloudWidget extends Widget { "Tag" => $tag, "Count" => $count, "Class" => $class, - "Link" => $blogHolder->Link() . 'tag/' . urlencode($tag) + "Link" => $container->Link() . 'tag/' . urlencode($tag) ); } } diff --git a/tests/BlogTreeTest.php b/tests/BlogTreeTest.php new file mode 100644 index 0000000..bb6349e --- /dev/null +++ b/tests/BlogTreeTest.php @@ -0,0 +1,30 @@ +fixture->objFromFixture('BlogTree', 'root'); + $this->assertEquals($node->Entries()->Count(), 3); + + $node = $this->fixture->objFromFixture('BlogTree', 'levela'); + $this->assertEquals($node->Entries()->Count(), 2); + + $node = $this->fixture->objFromFixture('BlogTree', 'levelaa'); + $this->assertEquals($node->Entries()->Count(), 2); + + $node = $this->fixture->objFromFixture('BlogTree', 'levelab'); + $this->assertNull($node->Entries()); + + $node = $this->fixture->objFromFixture('BlogTree', 'levelb'); + $this->assertEquals($node->Entries()->Count(), 1); + + $node = $this->fixture->objFromFixture('BlogTree', 'levelba'); + $this->assertEquals($node->Entries()->Count(), 1); + } + + + +} + +?> diff --git a/tests/BlogTreeTest.yml b/tests/BlogTreeTest.yml new file mode 100644 index 0000000..3112d40 --- /dev/null +++ b/tests/BlogTreeTest.yml @@ -0,0 +1,53 @@ +BlogTree: + root: + Title: Root BlogTree + levela: + Title: Level A + Parent: =>BlogTree.root + levelb: + Title: Level B + Parent: =>BlogTree.root + levelaa: + Title: Level AA + Parent: =>BlogTree.levela + levelab: + Title: Level AB + Parent: =>BlogTree.levela + levelba: + Title: Level BA + Parent: =>BlogTree.levelb +BlogHolder: + levelaa_blog1: + Title: Level AA Blog 1 + Parent: =>BlogTree.levelaa + levelaa_blog2: + Title: Level AA Blog 2 + Parent: =>BlogTree.levelaa + levelab_blog: + Title: Level AB Blog + Parent: =>BlogTree.levelab + levelba_blog: + Title: Level BA Blog + Parent: =>BlogTree.levelba +BlogEntry: + testpost: + Title: Test Post + URLSegment: test-post + Date: 2007-02-17 18:45:00 + Parent: =>BlogHolder.levelaa_blog1 + Tags: tag1,tag2 + testpost2: + Title: Test Post 2 + URLSegment: test-post-2 + Date: 2008-01-31 20:48:00 + Parent: =>BlogHolder.levelaa_blog2 + Tags: tag2,tag3 + testpost3: + Title: Test Post 3 + URLSegment: test-post-3 + Date: 2008-01-17 18:45:00 + Parent: =>BlogHolder.levelba_blog + Tags: tag1,tag2,tag3 + + + From 37a60707143903e109346fc5cd5d769d44a32f35 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Wed, 6 May 2009 05:00:54 +0000 Subject: [PATCH 129/250] BUGFIX: Check owner with less complex logic --- code/BlogHolder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index e766729..ce31665 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -77,7 +77,7 @@ class BlogHolder extends BlogTree { * @return Boolean */ function IsOwner() { - return Permission::check('ADMIN') || (Member::CurrentMember() && Member::CurrentMember()->ID == $this->OwnerID); + return Permission::check('ADMIN') || (Member::currentUserID() == $this->OwnerID); } /** From 2d1eb07478ade34f2e04131a8cb93ac876f15a17 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Wed, 6 May 2009 05:01:28 +0000 Subject: [PATCH 130/250] BUGFIX: Use parent->canAddChildren, not parent->canEdit to determine if this user can add children to parent blog holder --- code/BlogManagementWidget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogManagementWidget.php b/code/BlogManagementWidget.php index 67503e6..206897b 100644 --- a/code/BlogManagementWidget.php +++ b/code/BlogManagementWidget.php @@ -48,7 +48,7 @@ class BlogManagementWidget extends Widget { function WidgetHolder() { $container = BlogTree::current(); - if ($container && $container instanceof BlogHolder && $container->canEdit()) return $this->renderWith('WidgetHolder'); + if ($container && $container instanceof BlogHolder && $container->canAddChildren()) return $this->renderWith('WidgetHolder'); return ''; } From 58775ea256361d08c7748ddb96c091c4f66a867f Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Wed, 6 May 2009 05:02:01 +0000 Subject: [PATCH 131/250] ENHANCEMENT: Allow specifying the class buckets to assign tags into based on popularity --- code/TagCloudWidget.php | 50 ++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index e6925bb..8d6e8be 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -23,6 +23,8 @@ class TagCloudWidget extends Widget { static $cmsTitle = "Tag Cloud"; static $description = "Shows a tag cloud of tags on your blog."; + + static $popularities = array( 'not-popular', 'not-very-popular', 'somewhat-popular', 'popular', 'very-popular', 'ultra-popular' ); function getCMSFields() { return new FieldSet( @@ -67,38 +69,24 @@ class TagCloudWidget extends Widget { } $sizes = array(); - foreach($allTags as $tag => $count){ - $sizes[$count] = true; - } - $numsizes = count($sizes)-1; //Work out the number of different sizes - if($numsizes > 5){$numsizes = 5;} - foreach($allTags as $tag => $count) { + foreach ($allTags as $tag => $count) $sizes[$count] = true; - $popularity = floor($count / $max * $numsizes); - - switch($popularity) { - case 0: - $class = "not-popular"; - break; - case 1: - $class = "not-very-popular"; - break; - case 2: - $class = "somewhat-popular"; - break; - case 3: - $class = "popular"; - break; - case 4: - $class = "very-popular"; - break; - case 5: - $class = "ultra-popular"; - break; - default: - $class = "broken"; - break; - } + $offset = 0; + $numsizes = count($sizes)-1; //Work out the number of different sizes + $buckets = count(self::$popularities)-1; + + // If there are more frequencies then buckets, divide frequencies into buckets + if ($numsizes > $buckets) { + $numsizes = $buckets; + } + // Otherwise center use central buckets + else { + $offset = round(($buckets-$numsizes)/2); + } + + foreach($allTags as $tag => $count) { + $popularity = round($count / $max * $numsizes) + $offset; $popularity=min($buckets,$popularity); + $class = self::$popularities[$popularity]; $allTags[$tag] = array( "Tag" => $tag, From 23591eec35afd4bd74a030bbcaba03ac813e1a6a Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Mon, 11 May 2009 02:48:24 +0000 Subject: [PATCH 132/250] BUGFIX Fixed BlogTree, ArchiveWidget SQL queries to work with ANSI and non-ANSI compatible queries --- code/ArchiveWidget.php | 43 ++++++++++++++++++++++++++------------ code/BlogTree.php | 47 +++++++++++++++++++++++++++++++++++------- 2 files changed, 69 insertions(+), 21 deletions(-) diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index 7cec3ae..7cf20df 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -51,21 +51,38 @@ class ArchiveWidget extends Widget { $stage = Versioned::current_stage(); $suffix = (!$stage || $stage == 'Stage') ? "" : "_$stage"; - if($this->DisplayMode == 'month') { - $sqlResults = DB::query(" - SELECT DISTINCT MONTH(`Date`) AS `Month`, YEAR(`Date`) AS `Year` - FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` - WHERE `ParentID` in (".implode(', ',$ids).") - ORDER BY `Date` DESC" - ); + if(defined('Database::USE_ANSI_SQL')) { + $sqlResults = DB::query(" + SELECT DISTINCT MONTH(\"Date\") AS \"Month\", YEAR(\"Date\") AS \"Year\", \"Date\" + FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\" ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\" + WHERE \"ParentID\" IN (" . implode(', ', $ids) . ") + ORDER BY \"Date\" DESC" + ); + } else { + $sqlResults = DB::query(" + SELECT DISTINCT MONTH(`Date`) AS `Month`, YEAR(`Date`) AS `Year` + FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` + WHERE `ParentID` IN (" . implode(', ', $ids) . ") + ORDER BY `Date` DESC" + ); + } } else { - $sqlResults = DB::query(" - SELECT DISTINCT YEAR(`Date`) AS `Year` - FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` - WHERE `ParentID` in (".implode(', ',$ids).") - ORDER BY `Date` DESC" - ); + if(defined('Database::USE_ANSI_SQL')) { + $sqlResults = DB::query(" + SELECT DISTINCT YEAR(\"Date\") AS \"Year\", \"Date\" + FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\" ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\" + WHERE \"ParentID\" IN (" . implode(', ', $ids) . ") + ORDER BY \"Date\" DESC" + ); + } else { + $sqlResults = DB::query(" + SELECT DISTINCT YEAR(`Date`) AS `Year` + FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` + WHERE `ParentID` in (".implode(', ',$ids).") + ORDER BY `Date` DESC" + ); + } } if(!$sqlResults) return new DataObjectSet(); diff --git a/code/BlogTree.php b/code/BlogTree.php index a5f0dfe..0137385 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -46,7 +46,12 @@ class BlogTree extends Page { } // Try to find a top-level BlogTree - $top = DataObject::get_one('BlogTree','ParentId = 0'); + if(defined('Database::USE_ANSI_SQL')) { + $top = DataObject::get_one('BlogTree', "\"ParentID\" = '0'"); + } else { + $top = DataObject::get_one('BlogTree', 'ParentID = 0'); + } + if ($top) return $top; // Try to find any BlogTree that is not inside another BlogTree @@ -136,7 +141,11 @@ class BlogTree extends Page { if ($tag) { $SQL_tag = Convert::raw2sql($tag); - $tagCheck = "AND `BlogEntry`.Tags LIKE '%$SQL_tag%'"; + if(defined('Database::USE_ANSI_SQL')) { + $tagCheck = "AND \"BlogEntry\".\"Tags\" LIKE '%$SQL_tag%'"; + } else { + $tagCheck = "AND `BlogEntry`.Tags LIKE '%$SQL_tag%'"; + } } if ($date) { @@ -145,17 +154,29 @@ class BlogTree extends Page { $month = (int) substr($date, strpos($date, '-') + 1); if($year && $month) { - $dateCheck = "AND MONTH(`BlogEntry`.Date) = $month AND YEAR(`BlogEntry`.Date) = $year"; + if(defined('Database::USE_ANSI_SQL')) { + $dateCheck = "AND MONTH(\"BlogEntry\".\"Date\") = '$month' AND YEAR(\"BlogEntry\".\"Date\") = '$year'"; + } else { + $dateCheck = "AND MONTH(`BlogEntry`.Date) = $month AND YEAR(`BlogEntry`.Date) = $year"; + } } } else { $year = (int) $date; if($year) { - $dateCheck = "AND YEAR(`BlogEntry`.Date) = $year"; + if(defined('Database::USE_ANSI_SQL')) { + $dateCheck = "AND YEAR(\"BlogEntry\".\"Date\") = '$year'"; + } else { + $dateCheck = "AND YEAR(`BlogEntry`.Date) = $year"; + } } } } - elseif ($this->LandingPageFreshness) { - $dateCheck = "AND `BlogEntry`.Date > NOW() - INTERVAL " . $this->LandingPageFreshness; + elseif ($this->LandingPageFreshness) { + if(defined('Database::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 @@ -165,11 +186,21 @@ class BlogTree extends Page { if (empty($holderIDs)) return false; // Otherwise, do the actual query - $where = 'ParentID IN ('.implode(',', $holderIDs).") $tagCheck $dateCheck"; + if(defined('Database::USE_ANSI_SQL')) { + $where = '"ParentID" IN (' . implode(',', $holderIDs) . ") $tagCheck $dateCheck"; + } else { + $where = 'ParentID IN (' . implode(',', $holderIDs) . ") $tagCheck $dateCheck"; + } + + if(defined('Database::USE_ANSI_SQL')) { + $order = '"BlogEntry"."Date" DESC'; + } else { + $order = '`BlogEntry`.`Date` DESC'; + } // 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); - else return DataObject::get('BlogEntry', $where, '`BlogEntry`.`Date` DESC', '', $limit); + else return DataObject::get('BlogEntry', $where, $order, '', $limit); } } From 05cf841808441fd17a47a40b5bb6392be26d86b5 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Fri, 15 May 2009 03:46:49 +0000 Subject: [PATCH 133/250] BUGFIX: Segfault on BlogTree#Sidebar calling getComponent. Fix by directly getting sidebar for now. --- code/BlogTree.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 0137385..d829397 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -77,7 +77,8 @@ class BlogTree extends Page { function SideBar() { if ($this->InheritSideBar && $this->getParent()) return $this->getParent()->SideBar() ; - return $this->getComponent('SideBar'); + return DataObject::get_by_id('WidgetArea', $this->SideBarID); + // @todo: This segfaults - investigate why then fix: return $this->getComponent('SideBar'); } /* ----------- CMS CONTROL -------------- */ From 61a2cc2332106c5d382850232910dd005132aaf1 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Wed, 20 May 2009 02:18:48 +0000 Subject: [PATCH 134/250] MINOR: move Name field from BlogHolder to BlogTree --- code/BlogHolder.php | 2 -- code/BlogTree.php | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index ce31665..62a1749 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -16,7 +16,6 @@ class BlogHolder extends BlogTree { static $icon = "blog/images/blogholder"; static $db = array( - 'Name' => 'Varchar', 'TrackBacksEnabled' => 'Boolean', 'AllowCustomAuthors' => 'Boolean', ); @@ -31,7 +30,6 @@ class BlogHolder extends BlogTree { function getCMSFields() { $fields = parent::getCMSFields(); - $fields->addFieldToTab("Root.Content.Main", new TextField("Name", "Name of blog")); $fields->addFieldToTab('Root.Content.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks')); $fields->addFieldToTab('Root.Content.Main', new DropdownField('OwnerID', 'Blog owner', DataObject::get('Member')->toDropDownMap('ID', 'Name', 'None'))); diff --git a/code/BlogTree.php b/code/BlogTree.php index d829397..6f146fb 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -11,6 +11,7 @@ class BlogTree extends Page { static $db = array( + 'Name' => 'Varchar', 'InheritSideBar' => 'Boolean', 'LandingPageFreshness' => 'Varchar', ); @@ -85,6 +86,7 @@ class BlogTree extends Page { function getCMSFields() { $fields = parent::getCMSFields(); + $fields->addFieldToTab("Root.Content.Main", new TextField("Name", "Name of blog")); $fields->addFieldToTab('Root.Content.Main', new DropdownField('LandingPageFreshness', 'When you first open the blog, how many entries should I show', array( "" => "All entries", "1 MONTH" => "Last month's entries", From 488319ceb54b6ae57ebb835474aefc87475f7d7b Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Wed, 20 May 2009 02:34:57 +0000 Subject: [PATCH 135/250] MINOR: change blog alternative name to use global project_name variable --- code/BlogTree.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 6f146fb..2293ccf 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -280,10 +280,10 @@ class BlogTree_Controller extends Page_Controller { * Get the rss feed for this blog holder's entries */ function rss() { - global $project; + global $project_name; $blogName = $this->Name; - $altBlogName = $project . ' blog'; + $altBlogName = $project_name . ' blog'; $entries = $this->Entries(20); From dfb9e17c2c074372d229c6282a2664ccf91e1eac Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 20 May 2009 05:00:32 +0000 Subject: [PATCH 136/250] BUGFIX Fixed call to deprecated function Form::loadNonBlankDataFrom() on BlogHolder, replacing it with Form::loadDataFrom() --- code/BlogHolder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 62a1749..216059c 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -212,11 +212,11 @@ class BlogHolder_Controller extends BlogTree_Controller { if($id != 0) { $entry = DataObject::get_by_id('BlogEntry', $id); if($entry->IsOwner()) { - $form->loadNonBlankDataFrom($entry); + $form->loadDataFrom($entry); $form->datafieldByName('BlogPost')->setValue($entry->Content); } } else { - $form->loadNonBlankDataFrom(array("Author" => Cookie::get("BlogHolder_Name"))); + $form->loadDataFrom(array("Author" => Cookie::get("BlogHolder_Name"))); } return $form; From 43118ecb033645327106532b2608fb489f9e8ad3 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 20 May 2009 05:37:30 +0000 Subject: [PATCH 137/250] MINOR Renamed deprecated extraDBFields() function on TrackBackDecorator to extraStatics() --- code/TrackBackDecorator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/TrackBackDecorator.php b/code/TrackBackDecorator.php index 436a48b..abe6bca 100644 --- a/code/TrackBackDecorator.php +++ b/code/TrackBackDecorator.php @@ -1,7 +1,7 @@ array( 'TrackBacks' => 'TrackBackPing' From 1b7de7e092ea8d8c7aac511556e1180e060723c4 Mon Sep 17 00:00:00 2001 From: Julian Seidenberg Date: Thu, 21 May 2009 04:07:53 +0000 Subject: [PATCH 138/250] ENHANCEMENT: allow administators to make it possible for non-admin users to view blog management widget --- code/BlogManagementWidget.php | 51 ++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/code/BlogManagementWidget.php b/code/BlogManagementWidget.php index 206897b..dedc59c 100644 --- a/code/BlogManagementWidget.php +++ b/code/BlogManagementWidget.php @@ -3,24 +3,24 @@ * Blog Management Widget * @package blog */ -class BlogManagementWidget extends Widget { - +class BlogManagementWidget extends Widget implements PermissionProvider { + static $db = array(); - + static $has_one = array(); - + static $has_many = array(); - + static $many_many = array(); - + static $belongs_many_many = array(); - + static $defaults = array(); - + static $title = "Blog Management"; static $cmsTitle = "Blog Management"; static $description = "Provide a number of links useful for administering a blog. Only shown if the user is an admin."; - + function CommentText() { $unmoderatedcount = DB::query("SELECT COUNT(*) FROM PageComment WHERE NeedsModeration=1")->value(); if($unmoderatedcount == 1) { @@ -31,31 +31,46 @@ class BlogManagementWidget extends Widget { return _t("BlogManagementWidget.COMADM", "Comment administration"); } } - + function CommentLink() { if(!Permission::check('ADMIN')) { return false; } $unmoderatedcount = DB::query("SELECT COUNT(*) FROM PageComment WHERE NeedsModeration=1")->value(); - + if($unmoderatedcount > 0) { return "admin/comments/unmoderated"; } else { return "admin/comments"; } } - - function WidgetHolder() { - $container = BlogTree::current(); - - if ($container && $container instanceof BlogHolder && $container->canAddChildren()) return $this->renderWith('WidgetHolder'); - return ''; + + function providePermissions() { + return array("BLOGMANAGEMENTWIDGET_VIEW" => "View blog management widget"); } - + + function WidgetHolder() { + if(Permission::check("BLOGMANAGEMENTWIDGET_VIEW")) { + return $this->renderWith("WidgetHolder"); + } + } + function PostLink() { $container = BlogTree::current(); if ($container) return $container->Link('post'); } + + function getBlogHolder() { + $page = Director::currentPage(); + + if($page->is_a("BlogHolder")) { + return $page; + } else if($page->is_a("BlogEntry") && $page->getParent()->is_a("BlogHolder")) { + return $page->getParent(); + } else { + return DataObject::get_one("BlogHolder"); + } + } } ?> From b088e1ff8ce5a5c23eeb11603afe1683b6f30ffb Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 21 May 2009 04:16:18 +0000 Subject: [PATCH 139/250] MINOR Removed unused getBlogHolder() method from BlogManagementWidget.php --- code/BlogManagementWidget.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/code/BlogManagementWidget.php b/code/BlogManagementWidget.php index dedc59c..2874682 100644 --- a/code/BlogManagementWidget.php +++ b/code/BlogManagementWidget.php @@ -60,17 +60,5 @@ class BlogManagementWidget extends Widget implements PermissionProvider { if ($container) return $container->Link('post'); } - function getBlogHolder() { - $page = Director::currentPage(); - - if($page->is_a("BlogHolder")) { - return $page; - } else if($page->is_a("BlogEntry") && $page->getParent()->is_a("BlogHolder")) { - return $page->getParent(); - } else { - return DataObject::get_one("BlogHolder"); - } - } } - -?> +?> \ No newline at end of file From 5755d3e67964a728c7955a2e2a8a2d9aaa8ebb54 Mon Sep 17 00:00:00 2001 From: James Kirkus-Lamont Date: Mon, 25 May 2009 22:30:10 +0000 Subject: [PATCH 140/250] BUGFIX: check if the parent of the blog holder has a method called 'SideBar' before calling it --- code/BlogTree.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 2293ccf..fc327c1 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -77,7 +77,9 @@ class BlogTree extends Page { } function SideBar() { - if ($this->InheritSideBar && $this->getParent()) return $this->getParent()->SideBar() ; + if ($this->InheritSideBar && $this->getParent()) { + if (method_exists($this->getParent(), 'SideBar')) return $this->getParent()->SideBar(); + } return DataObject::get_by_id('WidgetArea', $this->SideBarID); // @todo: This segfaults - investigate why then fix: return $this->getComponent('SideBar'); } From 038cad9b636c0ad96a0b1152ef5acac87dbf53e8 Mon Sep 17 00:00:00 2001 From: Julian Seidenberg Date: Wed, 27 May 2009 01:26:34 +0000 Subject: [PATCH 141/250] BUGFIX: fixed permissions to allow non-admin user to post and manage blog entries --- code/BlogHolder.php | 99 ++++++++++++++++++----------------- code/BlogManagementWidget.php | 6 +-- 2 files changed, 55 insertions(+), 50 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 216059c..d6f9786 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -5,47 +5,47 @@ */ /** - * Blog holder to display summarised blog entries. - * + * Blog holder to display summarised blog entries. + * * A blog holder is the leaf end of a BlogTree, but can also be used standalone in simpler circumstances. * BlogHolders can only hold BlogEntries, BlogTrees can only hold BlogTrees and BlogHolders * BlogHolders have a form on them for easy posting, and an owner that can post to them, BlogTrees don't */ -class BlogHolder extends BlogTree { - +class BlogHolder extends BlogTree implements PermissionProvider { + static $icon = "blog/images/blogholder"; - + static $db = array( 'TrackBacksEnabled' => 'Boolean', 'AllowCustomAuthors' => 'Boolean', ); - + static $has_one = array( 'Owner' => 'Member', ); - + static $allowed_children = array( 'BlogEntry' ); - + function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Content.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks')); $fields->addFieldToTab('Root.Content.Main', new DropdownField('OwnerID', 'Blog owner', DataObject::get('Member')->toDropDownMap('ID', 'Name', 'None'))); $fields->addFieldToTab('Root.Content.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field')); - + return $fields; } public function BlogHolderIDs() { return array( $this->ID ); } - + /* * @todo: These next few functions don't really belong in the model. Can we remove them? */ - + /** * Only display the blog entries that have the specified tag */ @@ -54,63 +54,64 @@ class BlogHolder extends BlogTree { return Convert::raw2xml(Director::urlParam('ID')); } } - + /** * Check if url has "/post" */ function isPost() { return Director::urlParam('Action') == 'post'; } - + /** * Link for creating a new blog entry */ function postURL(){ return $this->Link('post'); } - + /** * Returns true if the current user is an admin, or is the owner of this blog * * @return Boolean */ function IsOwner() { - return Permission::check('ADMIN') || (Member::currentUserID() == $this->OwnerID); + return (Permission::check('BLOGMANAGEMENT') || Permission::check('ADMIN')); + //return Permission::check('ADMIN') || (Member::currentUserID() == $this->OwnerID); } - + /** * Create default blog setup */ function requireDefaultRecords() { parent::requireDefaultRecords(); - + if(!DataObject::get_one('BlogHolder')) { $blogholder = new BlogHolder(); $blogholder->Title = "Blog"; $blogholder->URLSegment = "blog"; $blogholder->Status = "Published"; - + $widgetarea = new WidgetArea(); $widgetarea->write(); - + $blogholder->SideBarID = $widgetarea->ID; $blogholder->write(); $blogholder->publish("Stage", "Live"); - + $managementwidget = new BlogManagementWidget(); $managementwidget->ParentID = $widgetarea->ID; $managementwidget->write(); - + $tagcloudwidget = new TagCloudWidget(); $tagcloudwidget->ParentID = $widgetarea->ID; $tagcloudwidget->write(); - + $archivewidget = new ArchiveWidget(); $archivewidget->ParentID = $widgetarea->ID; $archivewidget->write(); - + $widgetarea->write(); - + $blog = new BlogEntry(); $blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed"); $blog->URLSegment = 'sample-blog-entry'; @@ -120,7 +121,7 @@ class BlogHolder extends BlogTree { $blog->ParentID = $blogholder->ID; $blog->write(); $blog->publish("Stage", "Live"); - + Database::alteration_message("Blog page created","created"); } } @@ -131,30 +132,34 @@ class BlogHolder_Controller extends BlogTree_Controller { parent::init(); Requirements::themedCSS("bbcodehelp"); } - + /** * Return list of usable tags for help */ function BBTags() { return BBCodeParser::usable_tags(); } - + + function providePermissions() { + return array("BLOGMANAGEMENT" => "Blog management"); + } + /** * Post a new blog entry */ function post(){ if(!$this->IsOwner()){ - Security::permissionFailure($this, _t('BlogHolder.HAVENTPERM', 'Posting blogs is an administrator task. Please log in.')); + Security::permissionFailure($this, _t('BlogHolder.HAVENTPERM', 'You do not have sufficient permissions to post blog entries. Please log in.')); } - + $page = $this->customise(array( 'Content' => false, 'Form' => $this->BlogEntryForm() )); - + return $page->renderWith('Page'); } - + /** * A simple form for creating blog entries */ @@ -164,25 +169,25 @@ class BlogHolder_Controller extends BlogTree_Controller { Requirements::javascript('jsparty/scriptaculous/effects.js'); Requirements::javascript('cms/javascript/PageCommentInterface.js'); Requirements::javascript('blog/javascript/bbcodehelp.js'); - + $id = 0; if(Director::urlParam('ID')) { $id = (int) Director::urlParam('ID'); } - + $codeparser = new BBCodeParser(); $membername = Member::currentMember() ? Member::currentMember()->getName() : ""; - + if(BlogEntry::$allow_wysiwyg_editing) { $contentfield = new HtmlEditorField("BlogPost", _t("BlogEntry.CN")); } else { - $contentfield = new CompositeField( + $contentfield = new CompositeField( new LiteralField("BBCodeHelper",""._t("BlogEntry.BBH")."

" ), new TextareaField("BlogPost", _t("BlogEntry.CN"),20), // This is called BlogPost as the id #Content is generally used already new LiteralField("BBCodeTags","
".$codeparser->useable_tagsHTML()."
") ); } - + if(class_exists('TagField')) { $tagfield = new TagField('Tags', null, null, 'BlogEntry'); $tagfield->setSeparator(', '); @@ -201,14 +206,14 @@ class BlogHolder_Controller extends BlogTree_Controller { $tagfield, new LiteralField("Tagsnote"," ") - ); - + ); + $submitAction = new FormAction('postblog', _t('BlogHolder.POST', 'Post blog entry')); $actions = new FieldSet($submitAction); $validator = new RequiredFields('Title','Content'); - + $form = new Form($this, 'BlogEntryForm',$fields, $actions,$validator); - + if($id != 0) { $entry = DataObject::get_by_id('BlogEntry', $id); if($entry->IsOwner()) { @@ -218,33 +223,33 @@ class BlogHolder_Controller extends BlogTree_Controller { } else { $form->loadDataFrom(array("Author" => Cookie::get("BlogHolder_Name"))); } - + return $form; } - + function postblog($data, $form) { Cookie::set("BlogHolder_Name", $data['Author']); $blogentry = false; - + if($data['ID']) { $blogentry = DataObject::get_by_id("BlogEntry", $data['ID']); if(!$blogentry->IsOwner()) { unset($blogentry); } } - + if(!$blogentry) { $blogentry = new BlogEntry(); } - + $form->saveInto($blogentry); $blogentry->ParentID = $this->ID; $blogentry->Content = $form->datafieldByName('BlogPost')->dataValue(); - + $blogentry->Status = "Published"; $blogentry->writeToStage("Stage"); $blogentry->publish("Stage", "Live"); - + Director::redirect($this->Link()); } } diff --git a/code/BlogManagementWidget.php b/code/BlogManagementWidget.php index 2874682..9cafcf9 100644 --- a/code/BlogManagementWidget.php +++ b/code/BlogManagementWidget.php @@ -33,7 +33,7 @@ class BlogManagementWidget extends Widget implements PermissionProvider { } function CommentLink() { - if(!Permission::check('ADMIN')) { + if(!Permission::check('BLOGMANAGEMENT')) { return false; } $unmoderatedcount = DB::query("SELECT COUNT(*) FROM PageComment WHERE NeedsModeration=1")->value(); @@ -46,11 +46,11 @@ class BlogManagementWidget extends Widget implements PermissionProvider { } function providePermissions() { - return array("BLOGMANAGEMENTWIDGET_VIEW" => "View blog management widget"); + return array("BLOGMANAGEMENT" => "Blog management"); } function WidgetHolder() { - if(Permission::check("BLOGMANAGEMENTWIDGET_VIEW")) { + if(Permission::check("BLOGMANAGEMENT")) { return $this->renderWith("WidgetHolder"); } } From d55d5e21c2942c2ec7f49c8b378860d017bf95c5 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 28 May 2009 04:38:57 +0000 Subject: [PATCH 142/250] ENHANCEMENT Added language files --- lang/ar_SA.php | 18 ++++++++++++++++++ lang/de_DE.php | 18 ++++++++++++++++++ lang/en_GB.php | 16 ++++++++++++++++ lang/es_ES.php | 13 +++++++++++++ lang/es_MX.php | 19 +++++++++++++++++++ lang/et_EE.php | 19 +++++++++++++++++++ lang/fr_FR.php | 14 ++++++++++++++ lang/is_IS.php | 6 ++++-- lang/ms_MY.php | 34 ++++++++++++++++++++++++++++++++++ lang/nl_NL.php | 22 ++++++++++++++++++---- lang/pt_PT.php | 1 + 11 files changed, 174 insertions(+), 6 deletions(-) create mode 100644 lang/ms_MY.php diff --git a/lang/ar_SA.php b/lang/ar_SA.php index ad29c13..98a6f0b 100644 --- a/lang/ar_SA.php +++ b/lang/ar_SA.php @@ -18,11 +18,15 @@ if(array_key_exists('ar_SA', $lang) && is_array($lang['ar_SA'])) { $lang['ar_SA']['ArchiveWidget']['DispBY'] = 'استعراض بواسطة'; $lang['ar_SA']['ArchiveWidget']['MONTH'] = 'شهر'; +$lang['ar_SA']['ArchiveWidget']['PLURALNAME'] = 'مربعات الأرشيÙ'; +$lang['ar_SA']['ArchiveWidget']['SINGULARNAME'] = 'مربع الأرشيÙ'; $lang['ar_SA']['ArchiveWidget']['YEAR'] = 'سنة'; $lang['ar_SA']['BlogEntry']['AU'] = 'الكاتب'; $lang['ar_SA']['BlogEntry']['BBH'] = 'مساعدة BBCode'; $lang['ar_SA']['BlogEntry']['CN'] = 'المحتوى'; $lang['ar_SA']['BlogEntry']['DT'] = 'تاريخ'; +$lang['ar_SA']['BlogEntry']['PLURALNAME'] = 'تدوينات المدونة'; +$lang['ar_SA']['BlogEntry']['SINGULARNAME'] = 'تدوينة المدونة'; $lang['ar_SA']['BlogEntry.ss']['COMMENTS'] = 'التعليقات'; $lang['ar_SA']['BlogEntry.ss']['EDITTHIS'] = 'تحرير التدوينة'; $lang['ar_SA']['BlogEntry.ss']['POSTEDBY'] = 'نشرت بواسطة'; @@ -32,8 +36,10 @@ $lang['ar_SA']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'عدم نشر التدوين $lang['ar_SA']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'عرض جميع التدوينات'; $lang['ar_SA']['BlogEntry']['TS'] = 'وسوم (Ùاصلة,بين,الوسوم)'; $lang['ar_SA']['BlogHolder']['HAVENTPERM'] = 'تدوين المدونات يعتبر مهمة إدارية. Ùضلاً قم بتسجيل الدخول'; +$lang['ar_SA']['BlogHolder']['PLURALNAME'] = 'حاويات المدونة'; $lang['ar_SA']['BlogHolder']['POST'] = 'Post blog entry'; $lang['ar_SA']['BlogHolder']['RSSFEED'] = 'RSS لهذه المدونة'; +$lang['ar_SA']['BlogHolder']['SINGULARNAME'] = 'حاوية المدونة'; $lang['ar_SA']['BlogHolder']['SJ'] = 'الموضوع'; $lang['ar_SA']['BlogHolder']['SPUC'] = 'Ùضلاً اÙصل بين الوسوم بÙاصلة'; $lang['ar_SA']['BlogHolder.ss']['NOENTRIES'] = 'لا يوجد مدخلات'; @@ -43,6 +49,8 @@ $lang['ar_SA']['BlogHolder']['SUCTAGS'] = 'ÙŽsilverstripe , blog'; $lang['ar_SA']['BlogHolder']['SUCTITLE'] = 'تم تركيب SilverStripe Blog بنجاح'; $lang['ar_SA']['BlogHolder']['TE'] = 'مثال:رياضة,شخصية,علمية'; $lang['ar_SA']['BlogManagementWidget']['COMADM'] = 'إدارة التعليقات'; +$lang['ar_SA']['BlogManagementWidget']['PLURALNAME'] = 'مربعات إدارة المدونة'; +$lang['ar_SA']['BlogManagementWidget']['SINGULARNAME'] = 'مربع إدارة المدونة'; $lang['ar_SA']['BlogManagementWidget.ss']['LOGOUT'] = 'خروج'; $lang['ar_SA']['BlogManagementWidget.ss']['POSTNEW'] = 'نشر تدوينة جديدة'; $lang['ar_SA']['BlogManagementWidget']['UNM1'] = 'يوجد تعليق واحد لا يحتاج إلى مواÙقة'; @@ -53,11 +61,21 @@ $lang['ar_SA']['BlogSummary.ss']['POSTEDON'] = 'ÙÙŠ'; $lang['ar_SA']['BlogSummary.ss']['VIEWFULL'] = 'عرض كامل التدوينة'; $lang['ar_SA']['RSSWidget']['CT'] = 'العنوان المخصص للخلاصة'; $lang['ar_SA']['RSSWidget']['NTS'] = 'عدد العناصر لعرضها'; +$lang['ar_SA']['RSSWidget']['PLURALNAME'] = 'مربعات الخلاصات RSS'; +$lang['ar_SA']['RSSWidget']['SINGULARNAME'] = 'مربع الخلاصات RSS'; $lang['ar_SA']['RSSWidget']['URL'] = 'رابط الخلاصة'; +$lang['ar_SA']['SubscribeRSSWidget']['PLURALNAME'] = 'مربعات الاشتراك ÙÙŠ الخلاصات RSS'; +$lang['ar_SA']['SubscribeRSSWidget']['SINGULARNAME'] = 'مربع الاشتراك ÙÙŠ الخلاصات RSS'; +$lang['ar_SA']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'اشتراك'; +$lang['ar_SA']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'الاشتراك ÙÙŠ المدونة عن طريق الخلاصات RSS'; $lang['ar_SA']['TagCloudWidget']['LIMIT'] = 'العدد المحدد للوسوم'; +$lang['ar_SA']['TagCloudWidget']['PLURALNAME'] = 'مربعات الوسوم السحابية'; $lang['ar_SA']['TagCloudWidget']['SBAL'] = 'هجائي'; $lang['ar_SA']['TagCloudWidget']['SBFREQ'] = 'تكرار'; +$lang['ar_SA']['TagCloudWidget']['SINGULARNAME'] = 'مربع الوسوم السحابيةَ'; $lang['ar_SA']['TagCloudWidget']['SORTBY'] = 'ترتيب'; $lang['ar_SA']['TagCloudWidget']['TILE'] = 'العنوان'; +$lang['ar_SA']['TrackBackPing']['PLURALNAME'] = 'تنبيهات التعقيبات'; +$lang['ar_SA']['TrackBackPing']['SINGULARNAME'] = 'تنبيه التعقيبات'; ?> \ No newline at end of file diff --git a/lang/de_DE.php b/lang/de_DE.php index c189964..09e58d8 100644 --- a/lang/de_DE.php +++ b/lang/de_DE.php @@ -18,11 +18,15 @@ if(array_key_exists('de_DE', $lang) && is_array($lang['de_DE'])) { $lang['de_DE']['ArchiveWidget']['DispBY'] = 'Anzeige nach'; $lang['de_DE']['ArchiveWidget']['MONTH'] = 'Monat'; +$lang['de_DE']['ArchiveWidget']['PLURALNAME'] = 'Archiv-Widgets'; +$lang['de_DE']['ArchiveWidget']['SINGULARNAME'] = 'Archiv-Widget'; $lang['de_DE']['ArchiveWidget']['YEAR'] = 'Jahr'; $lang['de_DE']['BlogEntry']['AU'] = 'Autor'; $lang['de_DE']['BlogEntry']['BBH'] = 'BBCode Hilfe'; $lang['de_DE']['BlogEntry']['CN'] = 'Inhalt'; $lang['de_DE']['BlogEntry']['DT'] = 'Datum'; +$lang['de_DE']['BlogEntry']['PLURALNAME'] = 'Blog-Einträge'; +$lang['de_DE']['BlogEntry']['SINGULARNAME'] = 'Blog-Eintrag'; $lang['de_DE']['BlogEntry.ss']['COMMENTS'] = 'Kommentare'; $lang['de_DE']['BlogEntry.ss']['EDITTHIS'] = 'Eintrag bearbeiten'; $lang['de_DE']['BlogEntry.ss']['POSTEDBY'] = 'Eintrag von'; @@ -32,8 +36,10 @@ $lang['de_DE']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Eintrag zurückziehen'; $lang['de_DE']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Alle Beiträge mit Tag'; $lang['de_DE']['BlogEntry']['TS'] = 'Tags (Komma getrennt)'; $lang['de_DE']['BlogHolder']['HAVENTPERM'] = 'Beiträge können nur von Administratoren eingestellt werden. Bitte einloggen.'; +$lang['de_DE']['BlogHolder']['PLURALNAME'] = 'Blog-Besitzer'; $lang['de_DE']['BlogHolder']['POST'] = 'Eintrag senden'; $lang['de_DE']['BlogHolder']['RSSFEED'] = 'RSS feed von diesem Blog'; +$lang['de_DE']['BlogHolder']['SINGULARNAME'] = 'Blog-Besitzer'; $lang['de_DE']['BlogHolder']['SJ'] = 'Betreff'; $lang['de_DE']['BlogHolder']['SPUC'] = 'Bitte Tags mit Kommata trennen.'; $lang['de_DE']['BlogHolder.ss']['NOENTRIES'] = 'Es gibt keine Blog Einträge'; @@ -43,6 +49,8 @@ $lang['de_DE']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; $lang['de_DE']['BlogHolder']['SUCTITLE'] = 'SilverStripe Blog Module erfolgreich installiert'; $lang['de_DE']['BlogHolder']['TE'] = 'Zum Beispiel: sport, musik, video'; $lang['de_DE']['BlogManagementWidget']['COMADM'] = 'Kommentare bearbeiten'; +$lang['de_DE']['BlogManagementWidget']['PLURALNAME'] = 'Blog-Verwaltungs-Widgets'; +$lang['de_DE']['BlogManagementWidget']['SINGULARNAME'] = 'Blog-Verwaltungs-Widget'; $lang['de_DE']['BlogManagementWidget.ss']['LOGOUT'] = 'Logout'; $lang['de_DE']['BlogManagementWidget.ss']['POSTNEW'] = 'Neuen Eintrag schreiben'; $lang['de_DE']['BlogManagementWidget']['UNM1'] = 'Sie haben 1 noch nicht moderierten Kommentar'; @@ -53,11 +61,21 @@ $lang['de_DE']['BlogSummary.ss']['POSTEDON'] = 'am'; $lang['de_DE']['BlogSummary.ss']['VIEWFULL'] = 'Detaillierte Ansicht von dem Titel --'; $lang['de_DE']['RSSWidget']['CT'] = 'Eigener Titel für den feed'; $lang['de_DE']['RSSWidget']['NTS'] = 'Anzahl der angezeigten Items'; +$lang['de_DE']['RSSWidget']['PLURALNAME'] = 'RSS-Widgets'; +$lang['de_DE']['RSSWidget']['SINGULARNAME'] = 'RSS-Widget'; $lang['de_DE']['RSSWidget']['URL'] = 'URL des RSS Feed'; +$lang['de_DE']['SubscribeRSSWidget']['PLURALNAME'] = 'RSS-Abonnier-Widgets'; +$lang['de_DE']['SubscribeRSSWidget']['SINGULARNAME'] = 'RSS-Abonnier-Widget'; +$lang['de_DE']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Abonnieren'; +$lang['de_DE']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Abonniere diesen Blog per RSS'; $lang['de_DE']['TagCloudWidget']['LIMIT'] = 'Anzahl der erlaubten Tags'; +$lang['de_DE']['TagCloudWidget']['PLURALNAME'] = 'Tag-Cloud-Widgets'; $lang['de_DE']['TagCloudWidget']['SBAL'] = 'Alphabet'; $lang['de_DE']['TagCloudWidget']['SBFREQ'] = 'Häufigkeit'; +$lang['de_DE']['TagCloudWidget']['SINGULARNAME'] = 'Tag-Cloud-Widget'; $lang['de_DE']['TagCloudWidget']['SORTBY'] = 'Sortiert nach'; $lang['de_DE']['TagCloudWidget']['TILE'] = 'Titel'; +$lang['de_DE']['TrackBackPing']['PLURALNAME'] = 'Ping-Verfolgung'; +$lang['de_DE']['TrackBackPing']['SINGULARNAME'] = 'Ping-Verfolgung'; ?> \ No newline at end of file diff --git a/lang/en_GB.php b/lang/en_GB.php index 671fb1a..54a1d22 100644 --- a/lang/en_GB.php +++ b/lang/en_GB.php @@ -18,11 +18,15 @@ if(array_key_exists('en_GB', $lang) && is_array($lang['en_GB'])) { $lang['en_GB']['ArchiveWidget']['DispBY'] = 'Display by'; $lang['en_GB']['ArchiveWidget']['MONTH'] = 'month'; +$lang['en_GB']['ArchiveWidget']['PLURALNAME'] = 'Archive Widgets'; +$lang['en_GB']['ArchiveWidget']['SINGULARNAME'] = 'Archive Widget'; $lang['en_GB']['ArchiveWidget']['YEAR'] = 'year'; $lang['en_GB']['BlogEntry']['AU'] = 'Author'; $lang['en_GB']['BlogEntry']['BBH'] = 'BBCode help'; $lang['en_GB']['BlogEntry']['CN'] = 'Content'; $lang['en_GB']['BlogEntry']['DT'] = 'Date'; +$lang['en_GB']['BlogEntry']['PLURALNAME'] = 'Blog Entries'; +$lang['en_GB']['BlogEntry']['SINGULARNAME'] = 'Blog Entry'; $lang['en_GB']['BlogEntry.ss']['COMMENTS'] = 'Comments'; $lang['en_GB']['BlogEntry.ss']['EDITTHIS'] = 'Edit this post'; $lang['en_GB']['BlogEntry.ss']['POSTEDBY'] = 'Posted by'; @@ -32,8 +36,10 @@ $lang['en_GB']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Unpublish this post'; $lang['en_GB']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'View all posts tagged'; $lang['en_GB']['BlogEntry']['TS'] = 'Tags (comma sep.)'; $lang['en_GB']['BlogHolder']['HAVENTPERM'] = 'Posting blogs is an administrator task. Please log in.'; +$lang['en_GB']['BlogHolder']['PLURALNAME'] = 'Blog Holders'; $lang['en_GB']['BlogHolder']['POST'] = 'Post blog entry'; $lang['en_GB']['BlogHolder']['RSSFEED'] = 'RSS feed of this blog'; +$lang['en_GB']['BlogHolder']['SINGULARNAME'] = 'Blog Holder'; $lang['en_GB']['BlogHolder']['SJ'] = 'Subject'; $lang['en_GB']['BlogHolder']['SPUC'] = 'Please separate tags using commas.'; $lang['en_GB']['BlogHolder.ss']['NOENTRIES'] = 'There are no blog entries'; @@ -43,6 +49,8 @@ $lang['en_GB']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; $lang['en_GB']['BlogHolder']['SUCTITLE'] = 'SilverStripe blog module successfully installed'; $lang['en_GB']['BlogHolder']['TE'] = 'For example: sport, personal, science fiction'; $lang['en_GB']['BlogManagementWidget']['COMADM'] = 'Comment administration'; +$lang['en_GB']['BlogManagementWidget']['PLURALNAME'] = 'Blog Management Widgets'; +$lang['en_GB']['BlogManagementWidget']['SINGULARNAME'] = 'Blog Management Widget'; $lang['en_GB']['BlogManagementWidget.ss']['LOGOUT'] = 'Logout'; $lang['en_GB']['BlogManagementWidget.ss']['POSTNEW'] = 'Post a new blog entry'; $lang['en_GB']['BlogManagementWidget']['UNM1'] = 'You have 1 unmoderated comment'; @@ -52,11 +60,19 @@ $lang['en_GB']['BlogSummary.ss']['POSTEDON'] = 'on'; $lang['en_GB']['BlogSummary.ss']['VIEWFULL'] = 'View full post titled -'; $lang['en_GB']['RSSWidget']['CT'] = 'Custom title for the feed'; $lang['en_GB']['RSSWidget']['NTS'] = 'Number of Items to show'; +$lang['en_GB']['RSSWidget']['PLURALNAME'] = 'RSS Widgets'; +$lang['en_GB']['RSSWidget']['SINGULARNAME'] = 'RSS Widget'; $lang['en_GB']['RSSWidget']['URL'] = 'URL of RSS Feed'; +$lang['en_GB']['SubscribeRSSWidget']['PLURALNAME'] = 'Subscript to RSS Widgets'; +$lang['en_GB']['SubscribeRSSWidget']['SINGULARNAME'] = 'Subscript to an RSS Widget'; $lang['en_GB']['TagCloudWidget']['LIMIT'] = 'Limit number of tags'; +$lang['en_GB']['TagCloudWidget']['PLURALNAME'] = 'Tag Cloud Widgets'; $lang['en_GB']['TagCloudWidget']['SBAL'] = 'alphabet'; $lang['en_GB']['TagCloudWidget']['SBFREQ'] = 'frequency'; +$lang['en_GB']['TagCloudWidget']['SINGULARNAME'] = 'Tag Cloud Widget'; $lang['en_GB']['TagCloudWidget']['SORTBY'] = 'Sort by'; $lang['en_GB']['TagCloudWidget']['TILE'] = 'Title'; +$lang['en_GB']['TrackBackPing']['PLURALNAME'] = 'Track Back Pings'; +$lang['en_GB']['TrackBackPing']['SINGULARNAME'] = 'Track Back Ping'; ?> \ No newline at end of file diff --git a/lang/es_ES.php b/lang/es_ES.php index 6f2645d..0783464 100644 --- a/lang/es_ES.php +++ b/lang/es_ES.php @@ -17,11 +17,15 @@ if(array_key_exists('es_ES', $lang) && is_array($lang['es_ES'])) { } $lang['es_ES']['ArchiveWidget']['MONTH'] = 'mes'; +$lang['es_ES']['ArchiveWidget']['PLURALNAME'] = 'Archivar Widgets'; +$lang['es_ES']['ArchiveWidget']['SINGULARNAME'] = 'Archivar Widget'; $lang['es_ES']['ArchiveWidget']['YEAR'] = 'año'; $lang['es_ES']['BlogEntry']['AU'] = 'Autor'; $lang['es_ES']['BlogEntry']['BBH'] = 'BBCode ayuda'; $lang['es_ES']['BlogEntry']['CN'] = 'Contenido'; $lang['es_ES']['BlogEntry']['DT'] = 'Fecha'; +$lang['es_ES']['BlogEntry']['PLURALNAME'] = 'Entradas del Blog'; +$lang['es_ES']['BlogEntry']['SINGULARNAME'] = 'Entrada del Blog'; $lang['es_ES']['BlogEntry.ss']['COMMENTS'] = 'Comentarios'; $lang['es_ES']['BlogEntry.ss']['POSTEDBY'] = 'Publicado por'; $lang['es_ES']['BlogEntry.ss']['TAGS'] = 'Etiquetas:'; @@ -29,8 +33,17 @@ $lang['es_ES']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Ver todas las publicacion $lang['es_ES']['BlogEntry']['TS'] = 'Etiquetas (separados por comas)'; $lang['es_ES']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; $lang['es_ES']['BlogHolder']['TE'] = 'Por ejemplo: deporte, cine, tecnología'; +$lang['es_ES']['BlogManagementWidget']['PLURALNAME'] = 'Widgets de gestión del Blog'; +$lang['es_ES']['BlogManagementWidget']['SINGULARNAME'] = 'Widget de gestión del Blog'; $lang['es_ES']['BlogManagementWidget.ss']['LOGOUT'] = 'Salir'; $lang['es_ES']['BlogSummary.ss']['COMMENTS'] = 'Comentarios'; +$lang['es_ES']['BlogSummary.ss']['POSTEDBY'] = 'Publicado por'; +$lang['es_ES']['RSSWidget']['PLURALNAME'] = 'Widgets RSS'; +$lang['es_ES']['RSSWidget']['SINGULARNAME'] = 'Widget RSS'; +$lang['es_ES']['SubscribeRSSWidget']['PLURALNAME'] = 'Suscribir a Widgets RSS'; +$lang['es_ES']['SubscribeRSSWidget']['SINGULARNAME'] = 'Suscribir a Widget RSS'; +$lang['es_ES']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Suscribir'; +$lang['es_ES']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Suscribirse a este blog vía RSS'; $lang['es_ES']['TagCloudWidget']['SBAL'] = 'alfabeto'; $lang['es_ES']['TagCloudWidget']['SBFREQ'] = 'frecuencia'; $lang['es_ES']['TagCloudWidget']['SORTBY'] = 'Ordenar por'; diff --git a/lang/es_MX.php b/lang/es_MX.php index 915a34d..31d04dc 100644 --- a/lang/es_MX.php +++ b/lang/es_MX.php @@ -18,11 +18,15 @@ if(array_key_exists('es_MX', $lang) && is_array($lang['es_MX'])) { $lang['es_MX']['ArchiveWidget']['DispBY'] = 'Mostrar por'; $lang['es_MX']['ArchiveWidget']['MONTH'] = 'mes'; +$lang['es_MX']['ArchiveWidget']['PLURALNAME'] = 'Archivos de Widgets'; +$lang['es_MX']['ArchiveWidget']['SINGULARNAME'] = 'Archivo de Widget'; $lang['es_MX']['ArchiveWidget']['YEAR'] = 'año'; $lang['es_MX']['BlogEntry']['AU'] = 'Autor'; $lang['es_MX']['BlogEntry']['BBH'] = 'Ayuda de BBCode'; $lang['es_MX']['BlogEntry']['CN'] = 'Contenido'; $lang['es_MX']['BlogEntry']['DT'] = 'Fecha'; +$lang['es_MX']['BlogEntry']['PLURALNAME'] = 'Entradas del Blog'; +$lang['es_MX']['BlogEntry']['SINGULARNAME'] = 'Entrada del BLog'; $lang['es_MX']['BlogEntry.ss']['COMMENTS'] = 'Comentarios'; $lang['es_MX']['BlogEntry.ss']['EDITTHIS'] = 'Editar este mensaje'; $lang['es_MX']['BlogEntry.ss']['POSTEDBY'] = 'Enviado por'; @@ -32,8 +36,10 @@ $lang['es_MX']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Ocultar este mensaje'; $lang['es_MX']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Ver todos los mensajes marcados con la etiqueta'; $lang['es_MX']['BlogEntry']['TS'] = 'Etiquetas (separadas por coma)'; $lang['es_MX']['BlogHolder']['HAVENTPERM'] = 'La corrección de la bitácora es tarea del administrador. Por favor ingresa como tal.'; +$lang['es_MX']['BlogHolder']['PLURALNAME'] = 'Titulares del Blog'; $lang['es_MX']['BlogHolder']['POST'] = 'Enviar entrada a la bitácora'; $lang['es_MX']['BlogHolder']['RSSFEED'] = 'Alimentar al RSS con esta bitácora'; +$lang['es_MX']['BlogHolder']['SINGULARNAME'] = 'Titular del Blog'; $lang['es_MX']['BlogHolder']['SJ'] = 'Asunto'; $lang['es_MX']['BlogHolder']['SPUC'] = 'Por favor separa etiquetas utilizando comas.'; $lang['es_MX']['BlogHolder.ss']['NOENTRIES'] = 'Bitácora vacía'; @@ -43,20 +49,33 @@ $lang['es_MX']['BlogHolder']['SUCTAGS'] = 'bitácora, silverstripe'; $lang['es_MX']['BlogHolder']['SUCTITLE'] = 'El Módulo bitácora Silverstripe se ha instalado satisfactoriamente.'; $lang['es_MX']['BlogHolder']['TE'] = 'Por ejemplo: deportes, personal. ciencia ficción'; $lang['es_MX']['BlogManagementWidget']['COMADM'] = 'Administración de comentarios'; +$lang['es_MX']['BlogManagementWidget']['PLURALNAME'] = 'Widget para la Gestión de Blogs'; +$lang['es_MX']['BlogManagementWidget']['SINGULARNAME'] = 'Wisdget para la Gestion del Blog'; $lang['es_MX']['BlogManagementWidget.ss']['LOGOUT'] = 'Salir'; $lang['es_MX']['BlogManagementWidget.ss']['POSTNEW'] = 'Enviar nueva entrada a la bitácora'; $lang['es_MX']['BlogManagementWidget']['UNM1'] = 'Tienes 1 comentario pendiente de moderación'; $lang['es_MX']['BlogManagementWidget']['UNMM'] = 'Tienes %i comentarios pendientes de moderación'; $lang['es_MX']['BlogSummary.ss']['COMMENTS'] = 'Comentarios'; +$lang['es_MX']['BlogSummary.ss']['POSTEDBY'] = 'Enviado por'; $lang['es_MX']['BlogSummary.ss']['POSTEDON'] = 'en'; $lang['es_MX']['BlogSummary.ss']['VIEWFULL'] = 'Ver completo el mensaje titulado -'; $lang['es_MX']['RSSWidget']['CT'] = 'Título personalizado para el alimentador'; $lang['es_MX']['RSSWidget']['NTS'] = 'Número de elementos a mostrar:'; +$lang['es_MX']['RSSWidget']['PLURALNAME'] = 'Widgets R S S'; +$lang['es_MX']['RSSWidget']['SINGULARNAME'] = 'Widget R S S'; $lang['es_MX']['RSSWidget']['URL'] = 'URL del RSS alimentado'; +$lang['es_MX']['SubscribeRSSWidget']['PLURALNAME'] = 'Widgets para Suscripción R S S'; +$lang['es_MX']['SubscribeRSSWidget']['SINGULARNAME'] = 'Widget para Suscrición R S S'; +$lang['es_MX']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Suscribe'; +$lang['es_MX']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Suscribirme a este blog vía RSS'; $lang['es_MX']['TagCloudWidget']['LIMIT'] = 'Limitar el número de etiquetas'; +$lang['es_MX']['TagCloudWidget']['PLURALNAME'] = 'Widgets de Nube de Etiquetas'; $lang['es_MX']['TagCloudWidget']['SBAL'] = 'alfabeto'; $lang['es_MX']['TagCloudWidget']['SBFREQ'] = 'frecuencia'; +$lang['es_MX']['TagCloudWidget']['SINGULARNAME'] = 'Widget Nube de Etiquetas'; $lang['es_MX']['TagCloudWidget']['SORTBY'] = 'Ordenar por'; $lang['es_MX']['TagCloudWidget']['TILE'] = 'Título'; +$lang['es_MX']['TrackBackPing']['PLURALNAME'] = 'Volver a la Pista de Pings'; +$lang['es_MX']['TrackBackPing']['SINGULARNAME'] = 'Volver a la Pista de Pings'; ?> \ No newline at end of file diff --git a/lang/et_EE.php b/lang/et_EE.php index c0dd740..ad25fa7 100644 --- a/lang/et_EE.php +++ b/lang/et_EE.php @@ -18,11 +18,15 @@ if(array_key_exists('et_EE', $lang) && is_array($lang['et_EE'])) { $lang['et_EE']['ArchiveWidget']['DispBY'] = 'Kuva'; $lang['et_EE']['ArchiveWidget']['MONTH'] = 'kuu'; +$lang['et_EE']['ArchiveWidget']['PLURALNAME'] = 'Arhiveeri vidinad'; +$lang['et_EE']['ArchiveWidget']['SINGULARNAME'] = 'Arhiveeri vidin'; $lang['et_EE']['ArchiveWidget']['YEAR'] = 'aasta'; $lang['et_EE']['BlogEntry']['AU'] = 'Autor'; $lang['et_EE']['BlogEntry']['BBH'] = 'BBCode spikker'; $lang['et_EE']['BlogEntry']['CN'] = 'Sisu'; $lang['et_EE']['BlogEntry']['DT'] = 'Kuupäev'; +$lang['et_EE']['BlogEntry']['PLURALNAME'] = 'Blogi sisu'; +$lang['et_EE']['BlogEntry']['SINGULARNAME'] = 'Blogi sisu'; $lang['et_EE']['BlogEntry.ss']['COMMENTS'] = 'Kommentaarid'; $lang['et_EE']['BlogEntry.ss']['EDITTHIS'] = 'Muuda seda postitust'; $lang['et_EE']['BlogEntry.ss']['POSTEDBY'] = 'Autori'; @@ -32,8 +36,10 @@ $lang['et_EE']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Muuda see postitus avaldamatu $lang['et_EE']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Vaata kõiki postitusi siltidega'; $lang['et_EE']['BlogEntry']['TS'] = 'Sildid (komaga eraldatud)'; $lang['et_EE']['BlogHolder']['HAVENTPERM'] = 'Blogi postitamine on administraatori ülesanne. Palun logi sisse.'; +$lang['et_EE']['BlogHolder']['PLURALNAME'] = 'Blogi omanikud'; $lang['et_EE']['BlogHolder']['POST'] = 'Postita blogi sissekanne'; $lang['et_EE']['BlogHolder']['RSSFEED'] = 'Selle blogi RSS voog'; +$lang['et_EE']['BlogHolder']['SINGULARNAME'] = 'Blogi omanik'; $lang['et_EE']['BlogHolder']['SJ'] = 'Teema'; $lang['et_EE']['BlogHolder']['SPUC'] = 'Palun eralda sildid komadega.'; $lang['et_EE']['BlogHolder.ss']['NOENTRIES'] = 'Blogi sissekanded puuduvad'; @@ -43,20 +49,33 @@ $lang['et_EE']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; $lang['et_EE']['BlogHolder']['SUCTITLE'] = 'SilverStripe blogimoodul edukalt installeeritud'; $lang['et_EE']['BlogHolder']['TE'] = 'Näiteks: sport, isiklik, teaduslik fantastika'; $lang['et_EE']['BlogManagementWidget']['COMADM'] = 'Kommentaaride haldamine'; +$lang['et_EE']['BlogManagementWidget']['PLURALNAME'] = 'Blogi Muudatuse vidinad'; +$lang['et_EE']['BlogManagementWidget']['SINGULARNAME'] = 'Blogi muudatuste vidin'; $lang['et_EE']['BlogManagementWidget.ss']['LOGOUT'] = 'Logi välja'; $lang['et_EE']['BlogManagementWidget.ss']['POSTNEW'] = 'Postita uus blogi sissekanne'; $lang['et_EE']['BlogManagementWidget']['UNM1'] = 'Sul on 1 üle vaatamata kommentaar'; $lang['et_EE']['BlogManagementWidget']['UNMM'] = 'Sul on %i üle vaatamata kommentaari'; $lang['et_EE']['BlogSummary.ss']['COMMENTS'] = 'Kommentaarid'; +$lang['et_EE']['BlogSummary.ss']['POSTEDBY'] = 'Postitas'; $lang['et_EE']['BlogSummary.ss']['POSTEDON'] = '-'; $lang['et_EE']['BlogSummary.ss']['VIEWFULL'] = 'Vaata tervet postitust pealkirjaga - '; $lang['et_EE']['RSSWidget']['CT'] = 'Kohandatud pealkiri voole'; $lang['et_EE']['RSSWidget']['NTS'] = 'Kuvatavate sissekannete arv'; +$lang['et_EE']['RSSWidget']['PLURALNAME'] = 'RSS vidinad'; +$lang['et_EE']['RSSWidget']['SINGULARNAME'] = 'RSS vidin'; $lang['et_EE']['RSSWidget']['URL'] = 'URL või RSS voog'; +$lang['et_EE']['SubscribeRSSWidget']['PLURALNAME'] = 'Telli RSS Vidinad'; +$lang['et_EE']['SubscribeRSSWidget']['SINGULARNAME'] = 'Telli RSS Vidin'; +$lang['et_EE']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Telli'; +$lang['et_EE']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Telli blogi RSS kaudu'; $lang['et_EE']['TagCloudWidget']['LIMIT'] = 'Piira siltide arvu'; +$lang['et_EE']['TagCloudWidget']['PLURALNAME'] = 'Lipikute pilve vidinad'; $lang['et_EE']['TagCloudWidget']['SBAL'] = 'tähestikuliselt'; $lang['et_EE']['TagCloudWidget']['SBFREQ'] = 'sageduse järgi'; +$lang['et_EE']['TagCloudWidget']['SINGULARNAME'] = 'Lipikute pilve vidin'; $lang['et_EE']['TagCloudWidget']['SORTBY'] = 'Sorteeri'; $lang['et_EE']['TagCloudWidget']['TILE'] = 'Pealkiri'; +$lang['et_EE']['TrackBackPing']['PLURALNAME'] = 'Pingid'; +$lang['et_EE']['TrackBackPing']['SINGULARNAME'] = 'Ping'; ?> \ No newline at end of file diff --git a/lang/fr_FR.php b/lang/fr_FR.php index 05b9c55..c424f1c 100644 --- a/lang/fr_FR.php +++ b/lang/fr_FR.php @@ -18,11 +18,15 @@ if(array_key_exists('fr_FR', $lang) && is_array($lang['fr_FR'])) { $lang['fr_FR']['ArchiveWidget']['DispBY'] = 'Afficher par'; $lang['fr_FR']['ArchiveWidget']['MONTH'] = 'mois'; +$lang['fr_FR']['ArchiveWidget']['PLURALNAME'] = 'Widgets Archive'; +$lang['fr_FR']['ArchiveWidget']['SINGULARNAME'] = 'Widget Archive'; $lang['fr_FR']['ArchiveWidget']['YEAR'] = 'années'; $lang['fr_FR']['BlogEntry']['AU'] = 'Auteur'; $lang['fr_FR']['BlogEntry']['BBH'] = 'Aide BBCode'; $lang['fr_FR']['BlogEntry']['CN'] = 'Contenu'; $lang['fr_FR']['BlogEntry']['DT'] = 'Date'; +$lang['fr_FR']['BlogEntry']['PLURALNAME'] = 'Billets de blog'; +$lang['fr_FR']['BlogEntry']['SINGULARNAME'] = 'Billet de blog'; $lang['fr_FR']['BlogEntry.ss']['COMMENTS'] = 'Commentaires'; $lang['fr_FR']['BlogEntry.ss']['EDITTHIS'] = 'Modifier ce message'; $lang['fr_FR']['BlogEntry.ss']['POSTEDBY'] = 'Posté par'; @@ -32,8 +36,10 @@ $lang['fr_FR']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Dépublier ce message'; $lang['fr_FR']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Voir tous les messages marqués'; $lang['fr_FR']['BlogEntry']['TS'] = 'Tags (Séparer par une virgule)'; $lang['fr_FR']['BlogHolder']['HAVENTPERM'] = 'L\'envoi de blog est réservé aux administrateurs. Loggez vous s\'il vous plaît.'; +$lang['fr_FR']['BlogHolder']['PLURALNAME'] = 'Conteneurs Blogs'; $lang['fr_FR']['BlogHolder']['POST'] = 'Poster une entrée sur le blog'; $lang['fr_FR']['BlogHolder']['RSSFEED'] = 'Flux RSS de ce blog'; +$lang['fr_FR']['BlogHolder']['SINGULARNAME'] = 'Conteneur Blog'; $lang['fr_FR']['BlogHolder']['SJ'] = 'Sujet'; $lang['fr_FR']['BlogHolder']['SPUC'] = 'Veuillez séparer les tags en utilisant une virgule'; $lang['fr_FR']['BlogHolder.ss']['NOENTRIES'] = 'Il n\'y a aucune entrée dans le blog'; @@ -43,6 +49,8 @@ $lang['fr_FR']['BlogHolder']['SUCTAGS'] = 'blog, silverStripe'; $lang['fr_FR']['BlogHolder']['SUCTITLE'] = 'Le module de blog SilverStripe a été installé avec succès'; $lang['fr_FR']['BlogHolder']['TE'] = 'Par exemple: sport, personnel, science fiction'; $lang['fr_FR']['BlogManagementWidget']['COMADM'] = 'Administration des commentaires'; +$lang['fr_FR']['BlogManagementWidget']['PLURALNAME'] = 'Widgets de Management Blog'; +$lang['fr_FR']['BlogManagementWidget']['SINGULARNAME'] = 'Widget de Management Blog'; $lang['fr_FR']['BlogManagementWidget.ss']['LOGOUT'] = 'Déconnexion'; $lang['fr_FR']['BlogManagementWidget.ss']['POSTNEW'] = 'Publier une nouvelle entrée dans le blog'; $lang['fr_FR']['BlogManagementWidget']['UNM1'] = 'Vous avez 1 commentaire non modéré'; @@ -53,7 +61,13 @@ $lang['fr_FR']['BlogSummary.ss']['POSTEDON'] = 'sur'; $lang['fr_FR']['BlogSummary.ss']['VIEWFULL'] = 'Voir le titre du post en entier -'; $lang['fr_FR']['RSSWidget']['CT'] = 'Titre personnalisé pour le flux'; $lang['fr_FR']['RSSWidget']['NTS'] = 'Nombre d\'éléments à afficher'; +$lang['fr_FR']['RSSWidget']['PLURALNAME'] = 'Widgets de flux RSS'; +$lang['fr_FR']['RSSWidget']['SINGULARNAME'] = 'Widget de flux RSS'; $lang['fr_FR']['RSSWidget']['URL'] = 'URL du flux RSS'; +$lang['fr_FR']['SubscribeRSSWidget']['PLURALNAME'] = 'Widgets d\'abonnement RSS'; +$lang['fr_FR']['SubscribeRSSWidget']['SINGULARNAME'] = 'Widget d\'abonnement RSS'; +$lang['fr_FR']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Souscrire'; +$lang['fr_FR']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Souscrire à ce blog par RSS'; $lang['fr_FR']['TagCloudWidget']['LIMIT'] = 'Nombre limite des tags'; $lang['fr_FR']['TagCloudWidget']['SBAL'] = 'alphabet'; $lang['fr_FR']['TagCloudWidget']['SBFREQ'] = 'fréquence'; diff --git a/lang/is_IS.php b/lang/is_IS.php index d679a2f..f058f2f 100644 --- a/lang/is_IS.php +++ b/lang/is_IS.php @@ -23,6 +23,8 @@ $lang['is_IS']['BlogEntry']['AU'] = 'Höfundur'; $lang['is_IS']['BlogEntry']['BBH'] = 'BBCode hjálp'; $lang['is_IS']['BlogEntry']['CN'] = 'Efni'; $lang['is_IS']['BlogEntry']['DT'] = 'Dags'; +$lang['is_IS']['BlogEntry']['PLURALNAME'] = 'Blogg færslur'; +$lang['is_IS']['BlogEntry']['SINGULARNAME'] = 'Blogg færsla'; $lang['is_IS']['BlogEntry.ss']['COMMENTS'] = 'Athugasemdir'; $lang['is_IS']['BlogEntry.ss']['EDITTHIS'] = 'Breyta þessari færslu'; $lang['is_IS']['BlogEntry.ss']['POSTEDBY'] = 'Birt af'; @@ -43,9 +45,9 @@ $lang['is_IS']['BlogHolder']['SUCCONTENT'] = 'Til hamingju, uppsetningin á Silv $lang['is_IS']['BlogHolder']['SUCTAGS'] = 'silverstripe, blogg'; $lang['is_IS']['BlogHolder']['SUCTITLE'] = 'Uppsetning á SilverStripe blogg einingunni tókst'; $lang['is_IS']['BlogHolder']['TE'] = 'Til dæmis: íþróttir, persónulegt, vísindasögur'; -$lang['is_IS']['BlogManagementWidget']['COMADM'] = 'Athugasemdir stjórnanda'; +$lang['is_IS']['BlogManagementWidget']['COMADM'] = 'Athugasemda stjórnun'; $lang['is_IS']['BlogManagementWidget.ss']['LOGOUT'] = 'Útskrá'; -$lang['is_IS']['BlogManagementWidget.ss']['POSTNEW'] = 'Birta nýju blogg færsluna'; +$lang['is_IS']['BlogManagementWidget.ss']['POSTNEW'] = 'Skrifa nýja færslu'; $lang['is_IS']['BlogManagementWidget']['UNM1'] = 'Þú átt 1 óskoðaða athugasemd'; $lang['is_IS']['BlogManagementWidget']['UNMM'] = 'Þú átt %i óskoðaða athugasemd'; $lang['is_IS']['BlogSummary.ss']['COMMENTS'] = 'Athugasemdir'; diff --git a/lang/ms_MY.php b/lang/ms_MY.php new file mode 100644 index 0000000..13312e7 --- /dev/null +++ b/lang/ms_MY.php @@ -0,0 +1,34 @@ + \ No newline at end of file diff --git a/lang/nl_NL.php b/lang/nl_NL.php index 8df768c..4fa06df 100644 --- a/lang/nl_NL.php +++ b/lang/nl_NL.php @@ -18,31 +18,39 @@ if(array_key_exists('nl_NL', $lang) && is_array($lang['nl_NL'])) { $lang['nl_NL']['ArchiveWidget']['DispBY'] = 'Tonen door'; $lang['nl_NL']['ArchiveWidget']['MONTH'] = 'maand'; +$lang['nl_NL']['ArchiveWidget']['PLURALNAME'] = 'Archief-widgets'; +$lang['nl_NL']['ArchiveWidget']['SINGULARNAME'] = 'Archief-widget'; $lang['nl_NL']['ArchiveWidget']['YEAR'] = 'jaar'; $lang['nl_NL']['BlogEntry']['AU'] = 'Auteur'; $lang['nl_NL']['BlogEntry']['BBH'] = 'BBCode hulp'; $lang['nl_NL']['BlogEntry']['CN'] = 'Inhoud'; $lang['nl_NL']['BlogEntry']['DT'] = 'Datum'; +$lang['nl_NL']['BlogEntry']['PLURALNAME'] = 'Blog Artikelen'; +$lang['nl_NL']['BlogEntry']['SINGULARNAME'] = 'Blog Artikel'; $lang['nl_NL']['BlogEntry.ss']['COMMENTS'] = 'Reacties'; -$lang['nl_NL']['BlogEntry.ss']['EDITTHIS'] = 'Bewerk dit post'; +$lang['nl_NL']['BlogEntry.ss']['EDITTHIS'] = 'Bewerk deze post'; $lang['nl_NL']['BlogEntry.ss']['POSTEDBY'] = 'Auteur'; $lang['nl_NL']['BlogEntry.ss']['POSTEDON'] = 'Aan'; $lang['nl_NL']['BlogEntry.ss']['TAGS'] = 'Tags:'; -$lang['nl_NL']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'onpubliceer dit post'; +$lang['nl_NL']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'onpubliceer deze post'; $lang['nl_NL']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Bekijk alle posten getiteld'; $lang['nl_NL']['BlogEntry']['TS'] = 'Tags (Komma gescheiden)'; $lang['nl_NL']['BlogHolder']['HAVENTPERM'] = 'Het plaatsen van blogartikelen is een beheerder taak. Log aub in.'; +$lang['nl_NL']['BlogHolder']['PLURALNAME'] = 'Blog Houders'; $lang['nl_NL']['BlogHolder']['POST'] = 'Blogartikel plaatsen'; $lang['nl_NL']['BlogHolder']['RSSFEED'] = 'RSS-feed van deze blog'; +$lang['nl_NL']['BlogHolder']['SINGULARNAME'] = 'Blog Houder'; $lang['nl_NL']['BlogHolder']['SJ'] = 'Onderwerp'; $lang['nl_NL']['BlogHolder']['SPUC'] = 'Scheid de tags met behulp van komma\'s.'; -$lang['nl_NL']['BlogHolder.ss']['NOENTRIES'] = 'Er zijn geen blog entrees '; -$lang['nl_NL']['BlogHolder.ss']['VIEWINGTAGGED'] = 'U bekijkt entrees tagged met'; +$lang['nl_NL']['BlogHolder.ss']['NOENTRIES'] = 'Er zijn geen blog artikelen'; +$lang['nl_NL']['BlogHolder.ss']['VIEWINGTAGGED'] = 'U bekijkt artikelen getagged met'; $lang['nl_NL']['BlogHolder']['SUCCONTENT'] = 'Gefeliciteerd, de SilverStripe blog module is met succes geïnstalleerd. Dit blogartikel kan veilig worden verwijderd. U kunt aspecten van uw blog (zoals de widgets weergegeven in de zijbalk) in [url=admin]het CMS[/url] veranderen.'; $lang['nl_NL']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; $lang['nl_NL']['BlogHolder']['SUCTITLE'] = 'SilverStripe blog module met succes geïnstalleerd'; $lang['nl_NL']['BlogHolder']['TE'] = 'Bijvoorbeeld: sport, persoonlijke, science fiction'; $lang['nl_NL']['BlogManagementWidget']['COMADM'] = 'Opmerking administratie'; +$lang['nl_NL']['BlogManagementWidget']['PLURALNAME'] = 'Blog Management Widgets'; +$lang['nl_NL']['BlogManagementWidget']['SINGULARNAME'] = 'Blog Management Widgets'; $lang['nl_NL']['BlogManagementWidget.ss']['LOGOUT'] = 'Afmelden'; $lang['nl_NL']['BlogManagementWidget.ss']['POSTNEW'] = 'Publiceer een nieuw blog entree'; $lang['nl_NL']['BlogManagementWidget']['UNM1'] = 'U heeft 1 niet gecontroleerde opmerking'; @@ -53,7 +61,13 @@ $lang['nl_NL']['BlogSummary.ss']['POSTEDON'] = 'Aan'; $lang['nl_NL']['BlogSummary.ss']['VIEWFULL'] = 'Bekijk het gehele post getitled'; $lang['nl_NL']['RSSWidget']['CT'] = 'Aangepaste titel voor de RSS-feed'; $lang['nl_NL']['RSSWidget']['NTS'] = 'Aantal objecten tonen'; +$lang['nl_NL']['RSSWidget']['PLURALNAME'] = 'RSS-widget'; +$lang['nl_NL']['RSSWidget']['SINGULARNAME'] = 'R S S Widget'; $lang['nl_NL']['RSSWidget']['URL'] = 'URL van de RSS-feed'; +$lang['nl_NL']['SubscribeRSSWidget']['PLURALNAME'] = 'Abonneer R S S Widgets'; +$lang['nl_NL']['SubscribeRSSWidget']['SINGULARNAME'] = 'Abonneer R S S Widget'; +$lang['nl_NL']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Inschrijven'; +$lang['nl_NL']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Inschrijven om dit weblog via RSS te volgen'; $lang['nl_NL']['TagCloudWidget']['LIMIT'] = 'Beperk aantal tags'; $lang['nl_NL']['TagCloudWidget']['SBAL'] = 'alfabet'; $lang['nl_NL']['TagCloudWidget']['SBFREQ'] = 'frequentie'; diff --git a/lang/pt_PT.php b/lang/pt_PT.php index 63eae9b..5e4c9bc 100644 --- a/lang/pt_PT.php +++ b/lang/pt_PT.php @@ -16,6 +16,7 @@ if(array_key_exists('pt_PT', $lang) && is_array($lang['pt_PT'])) { $lang['pt_PT'] = $lang['en_US']; } +$lang['pt_PT']['BlogEntry']['PLURALNAME'] = 'Posts no Blog'; $lang['pt_PT']['BlogEntry.ss']['COMMENTS'] = 'Comentários'; $lang['pt_PT']['BlogEntry.ss']['EDITTHIS'] = 'Editar este post'; $lang['pt_PT']['BlogEntry.ss']['POSTEDBY'] = 'Inserido por'; From 517df83ae2389ca7ab8543d1e29ccff27d54ad4f Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 9 Jun 2009 00:46:38 +0000 Subject: [PATCH 143/250] BUGFIX: Prevent infinite loops in RSSWidget. ENHANCEMENT: Improve the word of the RSSWidget text. --- code/RSSWidget.php | 9 +++++++-- lang/en_US.php | 16 +++++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/code/RSSWidget.php b/code/RSSWidget.php index 3209965..99d60c0 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -19,7 +19,7 @@ class RSSWidget extends Widget { "RSSTitle" => 'RSS Feed' ); static $cmsTitle = "RSS Feed"; - static $description = "Shows the latest entries of a RSS feed."; + static $description = "Downloads another page's RSS feed and displays items in a list."; /** * If the RssUrl is relative, convert it to absolute with the @@ -41,7 +41,7 @@ class RSSWidget extends Widget { function getCMSFields() { return new FieldSet( new TextField("RSSTitle", _t('RSSWidget.CT', "Custom title for the feed")), - new TextField("RssUrl", _t('RSSWidget.URL', "URL of RSS Feed")), + new TextField("RssUrl", _t('RSSWidget.URL', "URL of the other page's RSS feed. Please make sure this URL points to an RSS feed.")), new NumericField("NumberToShow", _t('RSSWidget.NTS', "Number of Items to show")) ); } @@ -51,6 +51,11 @@ class RSSWidget extends Widget { function FeedItems() { $output = new DataObjectSet(); + + // Protection against infinite loops when an RSS widget pointing to this page is added to this page + if(stristr($_SERVER['HTTP_USER_AGENT'], 'SimplePie')) { + return $output; + } include_once(Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/SimplePie.php')); diff --git a/lang/en_US.php b/lang/en_US.php index 6609931..5d5acf7 100644 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -37,14 +37,14 @@ $lang['en_US']['BlogEntry.ss']['POSTEDON'] = 'on'; $lang['en_US']['BlogEntry.ss']['TAGS'] = 'Tags:'; $lang['en_US']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Unpublish this post'; $lang['en_US']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'View all posts tagged'; -$lang['en_US']['BlogHolder']['HAVENTPERM'] = 'Posting blogs is an administrator task. Please log in.'; +$lang['en_US']['BlogHolder']['HAVENTPERM'] = 'You do not have sufficient permissions to post blog entries. Please log in.'; $lang['en_US']['BlogHolder']['PLURALNAME'] = array( 'Blog Holders', 50, 'Pural name of the object, used in dropdowns and to generally identify a collection of this object in the interface' ); $lang['en_US']['BlogHolder']['POST'] = 'Post blog entry'; -$lang['en_US']['BlogHolder']['RSSFEED'] = 'RSS feed of this blog'; +$lang['en_US']['BlogHolder']['RSSFEED'] = 'RSS feed of these blogs'; $lang['en_US']['BlogHolder']['SINGULARNAME'] = array( 'Blog Holder', 50, @@ -77,6 +77,16 @@ $lang['en_US']['BlogSummary.ss']['COMMENTS'] = 'Comments'; $lang['en_US']['BlogSummary.ss']['POSTEDBY'] = 'Posted by'; $lang['en_US']['BlogSummary.ss']['POSTEDON'] = 'on'; $lang['en_US']['BlogSummary.ss']['VIEWFULL'] = 'View full post titled -'; +$lang['en_US']['BlogTree']['PLURALNAME'] = array( + 'Blog Tres', + 50, + 'Pural name of the object, used in dropdowns and to generally identify a collection of this object in the interface' +); +$lang['en_US']['BlogTree']['SINGULARNAME'] = array( + 'Blog Tree', + 50, + 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' +); $lang['en_US']['RSSWidget']['CT'] = 'Custom title for the feed'; $lang['en_US']['RSSWidget']['NTS'] = 'Number of Items to show'; $lang['en_US']['RSSWidget']['PLURALNAME'] = array( @@ -89,7 +99,7 @@ $lang['en_US']['RSSWidget']['SINGULARNAME'] = array( 50, 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' ); -$lang['en_US']['RSSWidget']['URL'] = 'URL of RSS Feed'; +$lang['en_US']['RSSWidget']['URL'] = 'URL of the other page\'s RSS Feed. Please make sure this URL points to an RSS feed.'; $lang['en_US']['SubscribeRSSWidget']['PLURALNAME'] = array( 'Subscribe R S S Widgets', 50, From 0122ac9e3766b63f24009f2fbedf399960df2856 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 17 Jun 2009 23:13:03 +0000 Subject: [PATCH 144/250] MINOR: Fixed newlines and set svn:eol-style to native --- css/archivewidget.css | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/css/archivewidget.css b/css/archivewidget.css index 0018f54..b1cdd13 100644 --- a/css/archivewidget.css +++ b/css/archivewidget.css @@ -1,9 +1,9 @@ -.archiveMonths{ - -} - -ul.archiveYears li{ - display: inline; - font-size: 1.2em !important; - margin:0 !important; +.archiveMonths{ + +} + +ul.archiveYears li{ + display: inline; + font-size: 1.2em !important; + margin:0 !important; } \ No newline at end of file From f41973b838dd960471093961b7b9d28475b6d377 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 1 Jul 2009 04:24:42 +0000 Subject: [PATCH 145/250] BUGFIX If IsOwner method doesn't exist on parent object in BlogEntry::IsOwner(), don't attempt to call it --- code/BlogEntry.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index bb73f93..c2fbf8e 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -168,8 +168,11 @@ class BlogEntry extends Page { } function IsOwner() { - return $this->Parent()->IsOwner(); + if(method_exists($this->Parent(), 'IsOwner')) { + return $this->Parent()->IsOwner(); + } } + /** * Call this to enable WYSIWYG editing on your blog entries. * By default the blog uses BBCode From 1e809afc65221d50d68686b87c7982594b9eca6a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 7 Jul 2009 22:11:11 +0000 Subject: [PATCH 146/250] BUGFIX Using $allowed_actions in BlogHolder, permission checks on BlogHoder_Controller->postblog() --- code/BlogHolder.php | 13 +++++--- tests/BlogHolderFunctionalTest.php | 49 ++++++++++++++++++++++++++++++ tests/BlogHolderFunctionalTest.yml | 20 ++++++++++++ 3 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 tests/BlogHolderFunctionalTest.php create mode 100644 tests/BlogHolderFunctionalTest.yml diff --git a/code/BlogHolder.php b/code/BlogHolder.php index d6f9786..c7311cc 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -128,6 +128,13 @@ class BlogHolder extends BlogTree implements PermissionProvider { } class BlogHolder_Controller extends BlogTree_Controller { + + static $allowed_actions = array( + 'postblog' => 'BLOGMANAGEMENT', + 'post' => 'BLOGMANAGEMENT', + 'BlogEntryForm' => 'BLOGMANAGEMENT', + ); + function init() { parent::init(); Requirements::themedCSS("bbcodehelp"); @@ -148,10 +155,6 @@ class BlogHolder_Controller extends BlogTree_Controller { * Post a new blog entry */ function post(){ - if(!$this->IsOwner()){ - Security::permissionFailure($this, _t('BlogHolder.HAVENTPERM', 'You do not have sufficient permissions to post blog entries. Please log in.')); - } - $page = $this->customise(array( 'Content' => false, 'Form' => $this->BlogEntryForm() @@ -231,7 +234,7 @@ class BlogHolder_Controller extends BlogTree_Controller { 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']); if(!$blogentry->IsOwner()) { unset($blogentry); 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 d0ee014aa575457787b907c019cc2528b817a366 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 7 Jul 2009 23:04:02 +0000 Subject: [PATCH 147/250] BUGFIX: Improve r81254 to fix blog/rss and subclasses of BlogHolder_Controller --- code/BlogHolder.php | 6 ++++++ code/BlogTree.php | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index c7311cc..ea38740 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -155,6 +155,8 @@ class BlogHolder_Controller extends BlogTree_Controller { * Post a new blog entry */ function post(){ + if(!Permission::check('BLOGMANAGEMENT')) return Security::permissionFailure(); + $page = $this->customise(array( 'Content' => false, 'Form' => $this->BlogEntryForm() @@ -167,6 +169,8 @@ class BlogHolder_Controller extends BlogTree_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'); @@ -231,6 +235,8 @@ class BlogHolder_Controller extends BlogTree_Controller { } function postblog($data, $form) { + if(!Permission::check('BLOGMANAGEMENT')) return Security::permissionFailure(); + Cookie::set("BlogHolder_Name", $data['Author']); $blogentry = false; diff --git a/code/BlogTree.php b/code/BlogTree.php index fc327c1..cefe9a1 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -231,6 +231,10 @@ class BlogURL { } class BlogTree_Controller extends Page_Controller { + static $allowed_actions = array( + 'rss' => true, + ); + function init() { parent::init(); From 076eeaa2a82e2203f99c5f39438fb671967e5cc9 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 7 Jul 2009 23:15:12 +0000 Subject: [PATCH 148/250] BUGFIX: Updated rss allowed_action to not use 'true' as a value because this has a bug in 2.3.2 --- code/BlogTree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index cefe9a1..27cb6eb 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -232,7 +232,7 @@ class BlogURL { class BlogTree_Controller extends Page_Controller { static $allowed_actions = array( - 'rss' => true, + 'rss', ); function init() { From 814b76ede9e8e8600c4880ea8925a4a7713d8475 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 8 Jul 2009 00:28:29 +0000 Subject: [PATCH 149/250] MINOR Using $this->objFromFixture() instead of referring to deprecated $this->fixture --- tests/BlogHolderTest.php | 8 ++++---- tests/BlogTreeTest.php | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/BlogHolderTest.php b/tests/BlogHolderTest.php index fe2c179..68a533b 100644 --- a/tests/BlogHolderTest.php +++ b/tests/BlogHolderTest.php @@ -4,13 +4,13 @@ class BlogHolderTest extends SapphireTest { static $fixture_file = 'blog/tests/BlogTest.yml'; function testGetAllBlogEntries() { - $mainblog = $this->fixture->objFromFixture('BlogHolder', 'mainblog'); + $mainblog = $this->objFromFixture('BlogHolder', 'mainblog'); $this->assertEquals($mainblog->Entries()->Count(), 3); } function testEntriesByMonth() { - $mainblog = $this->fixture->objFromFixture('BlogHolder', 'mainblog'); + $mainblog = $this->objFromFixture('BlogHolder', 'mainblog'); $entries = $mainblog->Entries('', '', '2008-01'); $this->assertEquals($entries->Count(), 2); @@ -25,7 +25,7 @@ class BlogHolderTest extends SapphireTest { } function textEntriesByYear() { - $mainblog = $this->fixture->objFromFixture('BlogHolder', 'mainblog'); + $mainblog = $this->objFromFixture('BlogHolder', 'mainblog'); $entries = $mainblog->Entries('', '', '2007'); $this->assertEquals($entries->Count(), 1); @@ -39,7 +39,7 @@ class BlogHolderTest extends SapphireTest { } function testEntriesByTag() { - $mainblog = $this->fixture->objFromFixture('BlogHolder', 'mainblog'); + $mainblog = $this->objFromFixture('BlogHolder', 'mainblog'); $entries = $mainblog->Entries('', 'tag1'); $this->assertEquals($entries->Count(), 2); diff --git a/tests/BlogTreeTest.php b/tests/BlogTreeTest.php index bb6349e..69daa82 100644 --- a/tests/BlogTreeTest.php +++ b/tests/BlogTreeTest.php @@ -4,22 +4,22 @@ class BlogTreeTest extends SapphireTest { static $fixture_file = 'blog/tests/BlogTreeTest.yml'; function testGetAllBlogEntries() { - $node = $this->fixture->objFromFixture('BlogTree', 'root'); + $node = $this->objFromFixture('BlogTree', 'root'); $this->assertEquals($node->Entries()->Count(), 3); - $node = $this->fixture->objFromFixture('BlogTree', 'levela'); + $node = $this->objFromFixture('BlogTree', 'levela'); $this->assertEquals($node->Entries()->Count(), 2); - $node = $this->fixture->objFromFixture('BlogTree', 'levelaa'); + $node = $this->objFromFixture('BlogTree', 'levelaa'); $this->assertEquals($node->Entries()->Count(), 2); - $node = $this->fixture->objFromFixture('BlogTree', 'levelab'); + $node = $this->objFromFixture('BlogTree', 'levelab'); $this->assertNull($node->Entries()); - $node = $this->fixture->objFromFixture('BlogTree', 'levelb'); + $node = $this->objFromFixture('BlogTree', 'levelb'); $this->assertEquals($node->Entries()->Count(), 1); - $node = $this->fixture->objFromFixture('BlogTree', 'levelba'); + $node = $this->objFromFixture('BlogTree', 'levelba'); $this->assertEquals($node->Entries()->Count(), 1); } From 098ae9b32c5bf3a803463fb2d6061cf60db258ef Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 8 Jul 2009 00:33:31 +0000 Subject: [PATCH 150/250] MINOR Fixed spelling in BlogHolderFunctionalTest --- 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 2e585539407a211a796643d08b4918c2a2de9685 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 16 Jul 2009 03:18:55 +0000 Subject: [PATCH 151/250] BUGFIX Ensure that a BlogHolder record doesn't exist properly by checking if the record has an ID --- code/BlogHolder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index ea38740..62aff3b 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -85,7 +85,8 @@ class BlogHolder extends BlogTree implements PermissionProvider { function requireDefaultRecords() { parent::requireDefaultRecords(); - if(!DataObject::get_one('BlogHolder')) { + $blogHolder = DataObject::get_one('BlogHolder'); + if(!($blogHolder && $blogHolder->exists())) { $blogholder = new BlogHolder(); $blogholder->Title = "Blog"; $blogholder->URLSegment = "blog"; From 8589682b7ec2b4ae9159be6b302599313e0d8cdf Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Sun, 19 Jul 2009 21:24:45 +0000 Subject: [PATCH 152/250] BUGFIX: BlogTree always got LandingPageFreshness value from its parent --- code/BlogTree.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 27cb6eb..96d1d62 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -69,10 +69,9 @@ class BlogTree extends Page { public function getLandingPageFreshness() { $freshness = $this->getField('LandingPageFreshness'); // If we want to inherit freshness, try that first - if ($freshness = "INHERIT" && $this->getParent()) $freshness = $this->getParent()->LandingPageFreshness; + if ($freshness == "INHERIT" && $this->getParent()) $freshness = $this->getParent()->LandingPageFreshness; // If we don't have a parent, or the inherited result was still inherit, use default - if ($freshness = "INHERIT") $freshness = ''; - + if ($freshness == "INHERIT") $freshness = ''; return $freshness; } From a91d0eeb6894d4847bcbd71901e273a11243d36b Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Mon, 20 Jul 2009 02:29:10 +0000 Subject: [PATCH 153/250] Applied an urgent hack to work new blog archive link (e.g 2009/05) --- code/BlogHolder.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 62aff3b..fb126fe 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -140,6 +140,17 @@ class BlogHolder_Controller extends BlogTree_Controller { parent::init(); Requirements::themedCSS("bbcodehelp"); } + + /** + * TODO: this is an urgent fix to work with archive link (e.g. 2009/04) for Nelsoncc project. Replace this with something better. + */ + function checkAccessAction($action) { + if (preg_match('/[0-9]{4}/', $action)) + { + return true; + } + return parent::checkAccessAction($action); + } /** * Return list of usable tags for help From 6d0f161cf4d2dff02afe08b3b4efd337d96f5486 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Mon, 20 Jul 2009 04:02:12 +0000 Subject: [PATCH 154/250] MINOR: Added sorting argument to callback function --- code/BlogTree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 96d1d62..ef63809 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -203,7 +203,7 @@ 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); + if ($retrieveCallback) return call_user_func($retrieveCallback, 'BlogEntry', $where, $limit, $order); else return DataObject::get('BlogEntry', $where, $order, '', $limit); } } From 6eebbb217c8ab27166e794917e43503ae0878055 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Mon, 20 Jul 2009 06:40:44 +0000 Subject: [PATCH 155/250] ENHANCEMENT: Allow configuration of the default number of entries to show on lists --- code/BlogTree.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index ef63809..9007673 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -10,6 +10,9 @@ class BlogTree extends Page { + // Default number of blog entries to show + static $default_entries_limit = 10; + static $db = array( 'Name' => 'Varchar', 'InheritSideBar' => 'Boolean', @@ -242,7 +245,9 @@ class BlogTree_Controller extends Page_Controller { Requirements::themedCSS("blog"); } - function BlogEntries($limit = 10) { + function BlogEntries($limit = null) { + if ($limit === null) $limit = BlogTree::$default_entries_limit; + $start = isset($_GET['start']) ? (int) $_GET['start'] : 0; return $this->Entries("$start,$limit", BlogURL::tag(), BlogURL::date()); } From 67d8a8b4231cd68536f39766534a4d19748fe138 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Wed, 22 Jul 2009 03:16:06 +0000 Subject: [PATCH 156/250] Added unit test for BlogHolder_Controller's custom checkAccessAction function --- code/BlogHolder.php | 2 +- tests/BlogHolderTest.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index fb126fe..9b05833 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -142,7 +142,7 @@ class BlogHolder_Controller extends BlogTree_Controller { } /** - * TODO: this is an urgent fix to work with archive link (e.g. 2009/04) for Nelsoncc project. Replace this with something better. + * TODO: this is an urgent fix to work with archive link (e.g. page_url/2009/04). Replace this with something better. */ function checkAccessAction($action) { if (preg_match('/[0-9]{4}/', $action)) diff --git a/tests/BlogHolderTest.php b/tests/BlogHolderTest.php index 68a533b..99a9096 100644 --- a/tests/BlogHolderTest.php +++ b/tests/BlogHolderTest.php @@ -52,6 +52,18 @@ class BlogHolderTest extends SapphireTest { $this->assertContains($entry->URLSegment, $expectedEntries); } } + + function testcheckAccessAction() { + $blogHolder = new BlogHolder_Controller(); + + $this->assertTrue($blogHolder->checkAccessAction('2009')); + $this->assertTrue($blogHolder->checkAccessAction('0001')); + $this->assertTrue($blogHolder->checkAccessAction('12345')); + + $this->assertFalse($blogHolder->checkAccessAction('209')); + $this->assertFalse($blogHolder->checkAccessAction('123A')); + $this->assertFalse($blogHolder->checkAccessAction('ab01a')); + } } ?> From c438757b28c9ded425d28d026d789b9d1acce79e Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Mon, 27 Jul 2009 02:52:42 +0000 Subject: [PATCH 157/250] BUGFIX Fixed checking for correct day, month and year values before setting the Date value in ArchiveWidget --- code/ArchiveWidget.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index 7cf20df..13fa279 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -85,20 +85,21 @@ class ArchiveWidget extends Widget { } } - if(!$sqlResults) return new DataObjectSet(); - - foreach($sqlResults as $sqlResult) { - $date = new Date('Date'); - $month = ($this->DisplayMode == 'month') ? (int)$sqlResult['Month'] : 1; + if($sqlResults) foreach($sqlResults as $sqlResult) { + $isMonthDisplay = $this->DisplayMode == 'month'; - $date->setValue(array( + $monthVal = ($sqlResult['Month']) ? (int) $sqlResult['Month'] : 1; + $month = ($isMonthDisplay) ? $monthVal : 1; + $year = ($sqlResult['Year']) ? (int) $sqlResult['Year'] : date('Y'); + + $date = DBField::create('Date', array( 'Day' => 1, - 'Month' => $month, - 'Year' => (int) $sqlResult['Year'] + 'Month' => $month, + 'Year' => $year )); - if($this->DisplayMode == 'month') { - $link = $container->Link() . $sqlResult['Year']. '/' . sprintf("%'02d", $sqlResult['Month']); + if($isMonthDisplay) { + $link = $container->Link() . $sqlResult['Year']. '/' . sprintf("%'02d", $monthVal); } else { $link = $container->Link() . $sqlResult['Year']; } @@ -111,5 +112,5 @@ class ArchiveWidget extends Widget { return $results; } -} -?> + +} \ No newline at end of file From af3b9127494d5f8c7607d334d4f5a6ea88720fbf Mon Sep 17 00:00:00 2001 From: Geoff Munn Date: Tue, 28 Jul 2009 04:17:38 +0000 Subject: [PATCH 158/250] COMMENT: in some cases, this might not be correctly triggered --- code/BlogHolder.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 9b05833..9ea1e14 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -86,7 +86,8 @@ class BlogHolder extends BlogTree implements PermissionProvider { parent::requireDefaultRecords(); $blogHolder = DataObject::get_one('BlogHolder'); - if(!($blogHolder && $blogHolder->exists())) { + //TODO: This does not check for whether this blogholder is an orphan or not + if(!$blogHolder) { $blogholder = new BlogHolder(); $blogholder->Title = "Blog"; $blogholder->URLSegment = "blog"; From a41cf18c23bc564bbc4bb5d6ee37ed166e4431be Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Tue, 28 Jul 2009 05:33:22 +0000 Subject: [PATCH 159/250] BUGFIX: trackbackping generated an exception. getExtensionInstance returns an instance with NULL owner so TrackBackDecorator->owner->ID was always unavailable --- code/BlogEntry.php | 4 ++-- code/TrackBackDecorator.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index c2fbf8e..dc70217 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -160,8 +160,8 @@ class BlogEntry extends Page { } function trackbackping() { - if($this->TrackBacksEnabled()) { - return $this->extInstance('TrackBackDecorator')->trackbackping(); + if($this->TrackBacksEnabled() && $this->hasExtension('TrackBackDecorator')) { + return $this->decoratedTrackbackping(); } else { Director::redirect($this->Link()); } diff --git a/code/TrackBackDecorator.php b/code/TrackBackDecorator.php index abe6bca..73c1a1d 100644 --- a/code/TrackBackDecorator.php +++ b/code/TrackBackDecorator.php @@ -17,7 +17,7 @@ class TrackBackDecorator extends DataObjectDecorator { return $this->owner->AbsoluteLink() . 'trackbackping'; } - function trackbackping() { + function decoratedTrackbackping() { $error = 0; $message = ''; From 7fe8c11f999a67837d6eaef0ca9d99c2ef45d317 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 3 Aug 2009 04:18:35 +0000 Subject: [PATCH 160/250] --- tests/BlogHolderTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/BlogHolderTest.php b/tests/BlogHolderTest.php index 99a9096..1941258 100644 --- a/tests/BlogHolderTest.php +++ b/tests/BlogHolderTest.php @@ -5,7 +5,8 @@ class BlogHolderTest extends SapphireTest { function testGetAllBlogEntries() { $mainblog = $this->objFromFixture('BlogHolder', 'mainblog'); - + + $this->assertNotNull($mainblog->Entries()); $this->assertEquals($mainblog->Entries()->Count(), 3); } From 1a2e2a1d985182f7649d00cbe6cec4e728d9f262 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Mon, 3 Aug 2009 23:37:03 +0000 Subject: [PATCH 161/250] BUGFIX: prevet calling loadDescendantBlogHolderIDListInto() on BlogPage and its subclass --- code/BlogTree.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 9007673..74a608c 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -121,8 +121,12 @@ class BlogTree extends Page { foreach($children as $child) { if (in_array($child->ID, $idList)) continue; - if ($child instanceof BlogHolder) $idList[] = $child->ID; - else $child->loadDescendantBlogHolderIDListInto($idList); + if ($child instanceof BlogHolder) { + $idList[] = $child->ID; + } + else if ($child instanceof BlogTree) { + $child->loadDescendantBlogHolderIDListInto($idList); + } } } } From 56be6ad6fae7b1ed05e840287aef633e10d08848 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 4 Aug 2009 02:18:38 +0000 Subject: [PATCH 162/250] MINOR Fixed undefined Month in ArchiveWidget --- code/ArchiveWidget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index 13fa279..0d7da8a 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -88,7 +88,7 @@ class ArchiveWidget extends Widget { if($sqlResults) foreach($sqlResults as $sqlResult) { $isMonthDisplay = $this->DisplayMode == 'month'; - $monthVal = ($sqlResult['Month']) ? (int) $sqlResult['Month'] : 1; + $monthVal = (isset($sqlResult['Month'])) ? (int) $sqlResult['Month'] : 1; $month = ($isMonthDisplay) ? $monthVal : 1; $year = ($sqlResult['Year']) ? (int) $sqlResult['Year'] : date('Y'); From acbce1d50781e1a07a9496247bc9502b15eec3f4 Mon Sep 17 00:00:00 2001 From: Geoff Munn Date: Wed, 5 Aug 2009 02:38:32 +0000 Subject: [PATCH 163/250] MINOR FIX: instances where no SideBarID exists are now avoided --- code/BlogTree.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 74a608c..06871ee 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -82,8 +82,11 @@ class BlogTree extends Page { if ($this->InheritSideBar && $this->getParent()) { if (method_exists($this->getParent(), 'SideBar')) return $this->getParent()->SideBar(); } - return DataObject::get_by_id('WidgetArea', $this->SideBarID); - // @todo: This segfaults - investigate why then fix: return $this->getComponent('SideBar'); + + if($this->SideBarID){ + return DataObject::get_by_id('WidgetArea', $this->SideBarID); + // @todo: This segfaults - investigate why then fix: return $this->getComponent('SideBar'); + } } /* ----------- CMS CONTROL -------------- */ From 1a566114171eebac3c0eab53f5283f8323f4fac5 Mon Sep 17 00:00:00 2001 From: Geoff Munn Date: Wed, 5 Aug 2009 03:38:23 +0000 Subject: [PATCH 164/250] MINOR FIX: query changed to remove duplicate results --- code/ArchiveWidget.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index 0d7da8a..50c78c7 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -54,33 +54,33 @@ class ArchiveWidget extends Widget { if($this->DisplayMode == 'month') { if(defined('Database::USE_ANSI_SQL')) { $sqlResults = DB::query(" - SELECT DISTINCT MONTH(\"Date\") AS \"Month\", YEAR(\"Date\") AS \"Year\", \"Date\" + SELECT DISTINCT MONTH(\"Date\") AS \"Month\", YEAR(\"Date\") AS \"Year\" FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\" ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\" WHERE \"ParentID\" IN (" . implode(', ', $ids) . ") - ORDER BY \"Date\" DESC" + ORDER BY \"Year\" DESC, \"Month\" DESC;" ); } else { $sqlResults = DB::query(" SELECT DISTINCT MONTH(`Date`) AS `Month`, YEAR(`Date`) AS `Year` FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` WHERE `ParentID` IN (" . implode(', ', $ids) . ") - ORDER BY `Date` DESC" + ORDER BY `Year` DESC, `Month` DESC;" ); } } else { if(defined('Database::USE_ANSI_SQL')) { $sqlResults = DB::query(" - SELECT DISTINCT YEAR(\"Date\") AS \"Year\", \"Date\" + SELECT DISTINCT YEAR(\"Date\") AS \"Year\" FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\" ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\" WHERE \"ParentID\" IN (" . implode(', ', $ids) . ") - ORDER BY \"Date\" DESC" + ORDER BY \"Year\" DESC" ); } else { $sqlResults = DB::query(" SELECT DISTINCT YEAR(`Date`) AS `Year` FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` WHERE `ParentID` in (".implode(', ',$ids).") - ORDER BY `Date` DESC" + ORDER BY `Year` DESC" ); } } From c37785c07b250e225a7330dd8a225f20a9e2ea58 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 6 Aug 2009 21:59:43 +0000 Subject: [PATCH 165/250] BUGFIX Fixed "tag" action not allowed on BlogHolder_Controller --- code/BlogHolder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 9ea1e14..1d5e1ee 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -132,6 +132,7 @@ class BlogHolder extends BlogTree implements PermissionProvider { class BlogHolder_Controller extends BlogTree_Controller { static $allowed_actions = array( + 'tag', 'postblog' => 'BLOGMANAGEMENT', 'post' => 'BLOGMANAGEMENT', 'BlogEntryForm' => 'BLOGMANAGEMENT', From 53bd0feb59406cd7ad60978f40a474fbd20ec724 Mon Sep 17 00:00:00 2001 From: Carlos Barberis Date: Thu, 27 Aug 2009 01:23:17 +0000 Subject: [PATCH 166/250] Added true in array_slice to fix problem displaying tags --- code/TagCloudWidget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index 8d6e8be..9cfee70 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -62,7 +62,7 @@ class TagCloudWidget extends Widget { //TODO: move some or all of the sorts to the database for more efficiency if($this->Limit > 0){ uasort($allTags, array($this, "column_sort_by_popularity")); //sort by popularity - $allTags = array_slice($allTags, 0, $this->Limit); + $allTags = array_slice($allTags, 0, $this->Limit,true); } if($this->Sortby == "alphabet"){ $this->natksort($allTags); From 9462d240b584b42fae0a3c5ba4e9c6711ec3ccd6 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 10 Sep 2009 04:04:34 +0000 Subject: [PATCH 167/250] MINOR Updated master language tables --- lang/en_US.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lang/en_US.php b/lang/en_US.php index 5d5acf7..1496f5b 100644 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -37,7 +37,6 @@ $lang['en_US']['BlogEntry.ss']['POSTEDON'] = 'on'; $lang['en_US']['BlogEntry.ss']['TAGS'] = 'Tags:'; $lang['en_US']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Unpublish this post'; $lang['en_US']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'View all posts tagged'; -$lang['en_US']['BlogHolder']['HAVENTPERM'] = 'You do not have sufficient permissions to post blog entries. Please log in.'; $lang['en_US']['BlogHolder']['PLURALNAME'] = array( 'Blog Holders', 50, @@ -99,7 +98,7 @@ $lang['en_US']['RSSWidget']['SINGULARNAME'] = array( 50, 'Singular name of the object, used in dropdowns and to generally identify a single object in the interface' ); -$lang['en_US']['RSSWidget']['URL'] = 'URL of the other page\'s RSS Feed. Please make sure this URL points to an RSS feed.'; +$lang['en_US']['RSSWidget']['URL'] = 'URL of the other page\'s RSS feed. Please make sure this URL points to an RSS feed.'; $lang['en_US']['SubscribeRSSWidget']['PLURALNAME'] = array( 'Subscribe R S S Widgets', 50, From 26622686cc7b49da210dd8f96419575e912e2cbf Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 10 Sep 2009 06:08:22 +0000 Subject: [PATCH 168/250] MINOR Added 'index' to $allowed_actions on BlogHolder, BlogTree, BlogEntry to comply to new RequestHandler API --- code/BlogEntry.php | 1 + code/BlogHolder.php | 1 + code/BlogTree.php | 1 + 3 files changed, 3 insertions(+) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index dc70217..0b4ec1b 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -184,6 +184,7 @@ class BlogEntry extends Page { class BlogEntry_Controller extends Page_Controller { static $allowed_actions = array( + 'index', 'trackbackping', 'unpublishPost', 'PageComments', diff --git a/code/BlogHolder.php b/code/BlogHolder.php index 1d5e1ee..a9aa426 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -132,6 +132,7 @@ class BlogHolder extends BlogTree implements PermissionProvider { class BlogHolder_Controller extends BlogTree_Controller { static $allowed_actions = array( + 'index', 'tag', 'postblog' => 'BLOGMANAGEMENT', 'post' => 'BLOGMANAGEMENT', diff --git a/code/BlogTree.php b/code/BlogTree.php index 06871ee..791ea08 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -241,6 +241,7 @@ class BlogURL { class BlogTree_Controller extends Page_Controller { static $allowed_actions = array( + 'index', 'rss', ); From b4b1c5ff26ca94a3549dc20f10018ea68aee2c01 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 10 Sep 2009 07:04:40 +0000 Subject: [PATCH 169/250] MINOR More robust login mocking in BlogHolderFunctionalTest --- tests/BlogHolderFunctionalTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/BlogHolderFunctionalTest.php b/tests/BlogHolderFunctionalTest.php index 4137d27..c8b56d4 100644 --- a/tests/BlogHolderFunctionalTest.php +++ b/tests/BlogHolderFunctionalTest.php @@ -35,7 +35,9 @@ class BlogHolderFunctionalTest extends FunctionalTest { // with login $blogEditor = $this->objFromFixture('Member', 'blog_editor'); - $blogEditor->logIn(); + $this->session()->inst_set('loggedInAs', $blogEditor->ID); + Permission::flush_permission_cache(); + $data = array( 'Title'=>'Allowed', 'Author'=>'Allowed', @@ -44,6 +46,7 @@ class BlogHolderFunctionalTest extends FunctionalTest { 'SecurityID' => $securityID ); $response = $this->post('blog/BlogEntryForm', $data); + $this->assertType('BlogEntry', DataObject::get_one('BlogEntry', sprintf("Title = 'Allowed'"))); } } \ No newline at end of file From 549603e459232b25c5ede8d787eacc7e3ef345cf Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Wed, 23 Sep 2009 08:28:46 +0000 Subject: [PATCH 170/250] MINOR: wrap current page number in SPAN tag for easy staling --- templates/Includes/BlogPagination.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/Includes/BlogPagination.ss b/templates/Includes/BlogPagination.ss index 220aab3..da6c838 100644 --- a/templates/Includes/BlogPagination.ss +++ b/templates/Includes/BlogPagination.ss @@ -8,7 +8,7 @@ <% control BlogEntries.PaginationSummary(4) %> <% if CurrentBool %> - $PageNum + $PageNum <% else %> <% if Link %> $PageNum From c9200459338b0c31de7437e8e0dc9e6b93e5c232 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 24 Sep 2009 23:10:54 +0000 Subject: [PATCH 171/250] ENHANCEMENT Allow BlogEntry::getCMSFields() fields to be manipulated on decorators --- code/BlogEntry.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 0b4ec1b..8099135 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -86,6 +86,9 @@ class BlogEntry extends Page { } $fields->addFieldToTab("Root.Content.Main", new TextField("Tags", _t("BlogEntry.TS", "Tags (comma sep.)")),"Content"); + + $this->extend('updateCMSFields', $fields); + return $fields; } From e688e0687e1f78ddae3665a0d494d40ec718bf62 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 6 Oct 2009 03:13:00 +0000 Subject: [PATCH 172/250] BUGFIX: Fix updateCMSFields() being called twice on BlogEntries --- code/BlogEntry.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 8099135..1516988 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -68,8 +68,10 @@ class BlogEntry extends Page { $firstName = Member::currentUser() ? Member::currentUser()->FirstName : ''; $codeparser = new BBCodeParser(); - + + SiteTree::disableCMSFieldsExtensions(); $fields = parent::getCMSFields(); + SiteTree::enableCMSFieldsExtensions(); if(!self::$allow_wysiwyg_editing) { $fields->removeFieldFromTab("Root.Content.Main","Content"); From fea6a124721660c8ff1ac8395b4a327d6a99ffd7 Mon Sep 17 00:00:00 2001 From: James Kirkus-Lamont Date: Tue, 20 Oct 2009 23:17:35 +0000 Subject: [PATCH 173/250] MINOR: moved rss feed link to its own function to allow extensions to override --- code/BlogTree.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 791ea08..2c15c9d 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -248,8 +248,8 @@ class BlogTree_Controller extends Page_Controller { function init() { parent::init(); - // This will create a tag point to the RSS feed - RSSFeed::linkToFeed($this->Link() . "rss", _t('BlogHolder.RSSFEED',"RSS feed of these blogs")); + $this->IncludeBlogRSS(); + Requirements::themedCSS("blog"); } @@ -260,6 +260,11 @@ class BlogTree_Controller extends Page_Controller { return $this->Entries("$start,$limit", BlogURL::tag(), BlogURL::date()); } + function IncludeBlogRSS() { + // This will create a tag point to the RSS feed + 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 From 9545d4f87c7da0bfb6b5bfbad3cc8f6b9089960e Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 26 Oct 2009 22:03:52 +0000 Subject: [PATCH 174/250] BUGFIX: Updated blog module to support 2.4 API changes --- code/ArchiveWidget.php | 4 ++-- code/BlogEntry.php | 2 +- code/BlogHolder.php | 3 ++- code/BlogTree.php | 14 +++++++------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index 50c78c7..886e4af 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -52,7 +52,7 @@ class ArchiveWidget extends Widget { $suffix = (!$stage || $stage == 'Stage') ? "" : "_$stage"; if($this->DisplayMode == 'month') { - if(defined('Database::USE_ANSI_SQL')) { + if(defined('DB::USE_ANSI_SQL')) { $sqlResults = DB::query(" SELECT DISTINCT MONTH(\"Date\") AS \"Month\", YEAR(\"Date\") AS \"Year\" FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\" ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\" @@ -68,7 +68,7 @@ class ArchiveWidget extends Widget { ); } } else { - if(defined('Database::USE_ANSI_SQL')) { + if(defined('DB::USE_ANSI_SQL')) { $sqlResults = DB::query(" SELECT DISTINCT YEAR(\"Date\") AS \"Year\" FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\" ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\" diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 1516988..50f2b70 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -13,7 +13,7 @@ class BlogEntry extends Page { static $icon = "blog/images/blogpage"; static $db = array( - "Date" => "SSDatetime", + "Date" => "Datetime", "Author" => "Text", "Tags" => "Text" ); diff --git a/code/BlogHolder.php b/code/BlogHolder.php index a9aa426..b6a4512 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -124,7 +124,8 @@ class BlogHolder extends BlogTree implements PermissionProvider { $blog->write(); $blog->publish("Stage", "Live"); - Database::alteration_message("Blog page created","created"); + // 2.3/2.4 dual compatibility + if(method_exists('DB', 'alteration_message')) DB::alteration_message("Blog page created","created"); } } } diff --git a/code/BlogTree.php b/code/BlogTree.php index 2c15c9d..94e85de 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -50,7 +50,7 @@ class BlogTree extends Page { } // Try to find a top-level BlogTree - if(defined('Database::USE_ANSI_SQL')) { + if(defined('DB::USE_ANSI_SQL')) { $top = DataObject::get_one('BlogTree', "\"ParentID\" = '0'"); } else { $top = DataObject::get_one('BlogTree', 'ParentID = 0'); @@ -155,7 +155,7 @@ class BlogTree extends Page { if ($tag) { $SQL_tag = Convert::raw2sql($tag); - if(defined('Database::USE_ANSI_SQL')) { + if(defined('DB::USE_ANSI_SQL')) { $tagCheck = "AND \"BlogEntry\".\"Tags\" LIKE '%$SQL_tag%'"; } else { $tagCheck = "AND `BlogEntry`.Tags LIKE '%$SQL_tag%'"; @@ -168,7 +168,7 @@ class BlogTree extends Page { $month = (int) substr($date, strpos($date, '-') + 1); if($year && $month) { - if(defined('Database::USE_ANSI_SQL')) { + if(defined('DB::USE_ANSI_SQL')) { $dateCheck = "AND MONTH(\"BlogEntry\".\"Date\") = '$month' AND YEAR(\"BlogEntry\".\"Date\") = '$year'"; } else { $dateCheck = "AND MONTH(`BlogEntry`.Date) = $month AND YEAR(`BlogEntry`.Date) = $year"; @@ -177,7 +177,7 @@ class BlogTree extends Page { } else { $year = (int) $date; if($year) { - if(defined('Database::USE_ANSI_SQL')) { + if(defined('DB::USE_ANSI_SQL')) { $dateCheck = "AND YEAR(\"BlogEntry\".\"Date\") = '$year'"; } else { $dateCheck = "AND YEAR(`BlogEntry`.Date) = $year"; @@ -186,7 +186,7 @@ class BlogTree extends Page { } } elseif ($this->LandingPageFreshness) { - if(defined('Database::USE_ANSI_SQL')) { + if(defined('DB::USE_ANSI_SQL')) { $dateCheck = "AND \"BlogEntry\".\"Date\" > NOW() - INTERVAL " . $this->LandingPageFreshness; } else { $dateCheck = "AND `BlogEntry`.Date > NOW() - INTERVAL " . $this->LandingPageFreshness; @@ -200,13 +200,13 @@ class BlogTree extends Page { if (empty($holderIDs)) return false; // Otherwise, do the actual query - if(defined('Database::USE_ANSI_SQL')) { + if(defined('DB::USE_ANSI_SQL')) { $where = '"ParentID" IN (' . implode(',', $holderIDs) . ") $tagCheck $dateCheck"; } else { $where = 'ParentID IN (' . implode(',', $holderIDs) . ") $tagCheck $dateCheck"; } - if(defined('Database::USE_ANSI_SQL')) { + if(defined('DB::USE_ANSI_SQL')) { $order = '"BlogEntry"."Date" DESC'; } else { $order = '`BlogEntry`.`Date` DESC'; From 1af9fafdd73f0da839b99d51390b7efe24dd786e Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 27 Oct 2009 03:13:33 +0000 Subject: [PATCH 175/250] BUGFIX: Fix tag links when blog is on home pages --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 50f2b70..07a685a 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -104,7 +104,7 @@ class BlogEntry extends Page { foreach($tags as $tag) { $output->push(new ArrayData(array( 'Tag' => $tag, - 'Link' => $this->getParent()->Link() . 'tag/' . urlencode($tag), + 'Link' => $this->getParent()->Link('tag') . '/' . urlencode($tag), 'URLTag' => urlencode($tag) ))); } From 42beb23f42e9301322556f7d7909f70c972b1bf3 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Thu, 29 Oct 2009 03:15:01 +0000 Subject: [PATCH 176/250] BUGFIX: fix archive links --- code/ArchiveWidget.php | 6 +++--- code/TagCloudWidget.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index 886e4af..0746d11 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -99,9 +99,9 @@ class ArchiveWidget extends Widget { )); if($isMonthDisplay) { - $link = $container->Link() . $sqlResult['Year']. '/' . sprintf("%'02d", $monthVal); + $link = $container->Link($sqlResult['Year']) . '/' . sprintf("%'02d", $monthVal); } else { - $link = $container->Link() . $sqlResult['Year']; + $link = $container->Link($sqlResult['Year']); } $results->push(new ArrayData(array( @@ -113,4 +113,4 @@ class ArchiveWidget extends Widget { return $results; } -} \ No newline at end of file +} diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index 9cfee70..1bc7757 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -92,7 +92,7 @@ class TagCloudWidget extends Widget { "Tag" => $tag, "Count" => $count, "Class" => $class, - "Link" => $container->Link() . 'tag/' . urlencode($tag) + "Link" => $container->Link('tag') . '/' . urlencode($tag) ); } } From c14ff3851bb83a104be4f0a325bedef6bba8874a Mon Sep 17 00:00:00 2001 From: Luke Hudson Date: Wed, 11 Nov 2009 23:11:32 +0000 Subject: [PATCH 177/250] Updates to blog to work with Sapphire 2.4 --- code/BlogTree.php | 2 +- code/RSSWidget.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 94e85de..c977ddc 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -38,7 +38,7 @@ class BlogTree extends Page { * - Otherwise, try and find a 'top-level' BlogTree */ static function current() { - $page = Director::currentPage(); + $page = Director::get_current_page(); // If we _are_ a BlogTree, use us if ($page instanceof BlogTree) return $page; diff --git a/code/RSSWidget.php b/code/RSSWidget.php index 99d60c0..6578411 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -60,9 +60,9 @@ class RSSWidget extends Widget { include_once(Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/SimplePie.php')); $t1 = microtime(true); - $this->feed = new SimplePie($this->AbsoluteRssUrl, TEMP_FOLDER); - $this->feed->init(); - if($items = $this->feed->get_items(0, $this->NumberToShow)) { + $feed = new SimplePie($this->AbsoluteRssUrl, TEMP_FOLDER); + $feed->init(); + if($items = $feed->get_items(0, $this->NumberToShow)) { foreach($items as $item) { // Cast the Date @@ -84,4 +84,4 @@ class RSSWidget extends Widget { } } -?> \ No newline at end of file +?> From dd632af9fab4439a5f0e9aa879cc09748925f78e Mon Sep 17 00:00:00 2001 From: Luke Hudson Date: Thu, 12 Nov 2009 02:48:47 +0000 Subject: [PATCH 178/250] Updated language packs to fixed versions --- lang/ar_SA.php | 4 ++-- lang/bg_BG.php | 4 ++-- lang/da_DK.php | 4 ++-- lang/de_DE.php | 8 ++++---- lang/en_GB.php | 7 +++++-- lang/es_ES.php | 33 +++++++++++++++++++++++++++++++-- lang/es_MX.php | 4 ++-- lang/et_EE.php | 4 ++-- lang/fr_FR.php | 6 ++++-- lang/hr_HR.php | 4 ++-- lang/is_IS.php | 20 ++++++++++++++++---- lang/it_IT.php | 24 ++++++++++++++++++++++-- lang/ms_MY.php | 4 ++-- lang/nl_NL.php | 8 ++++++-- lang/pl_PL.php | 16 ++++++++++++---- lang/pt_PT.php | 4 ++-- lang/ru_RU.php | 4 ++-- lang/sr_RS.php | 4 ++-- lang/tr_TR.php | 4 ++-- 19 files changed, 122 insertions(+), 44 deletions(-) diff --git a/lang/ar_SA.php b/lang/ar_SA.php index 98a6f0b..0f5d23c 100644 --- a/lang/ar_SA.php +++ b/lang/ar_SA.php @@ -2,11 +2,11 @@ /** * Arabic (Saudi Arabia) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; diff --git a/lang/bg_BG.php b/lang/bg_BG.php index 9015a77..0b903e6 100644 --- a/lang/bg_BG.php +++ b/lang/bg_BG.php @@ -2,11 +2,11 @@ /** * Bulgarian (Bulgaria) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; diff --git a/lang/da_DK.php b/lang/da_DK.php index 0ce46e3..99a4318 100644 --- a/lang/da_DK.php +++ b/lang/da_DK.php @@ -2,11 +2,11 @@ /** * Danish (Denmark) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; diff --git a/lang/de_DE.php b/lang/de_DE.php index 09e58d8..3e4ff0b 100644 --- a/lang/de_DE.php +++ b/lang/de_DE.php @@ -2,11 +2,11 @@ /** * German (Germany) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; @@ -38,7 +38,7 @@ $lang['de_DE']['BlogEntry']['TS'] = 'Tags (Komma getrennt)'; $lang['de_DE']['BlogHolder']['HAVENTPERM'] = 'Beiträge können nur von Administratoren eingestellt werden. Bitte einloggen.'; $lang['de_DE']['BlogHolder']['PLURALNAME'] = 'Blog-Besitzer'; $lang['de_DE']['BlogHolder']['POST'] = 'Eintrag senden'; -$lang['de_DE']['BlogHolder']['RSSFEED'] = 'RSS feed von diesem Blog'; +$lang['de_DE']['BlogHolder']['RSSFEED'] = 'RSS Feed dieser Blogs'; $lang['de_DE']['BlogHolder']['SINGULARNAME'] = 'Blog-Besitzer'; $lang['de_DE']['BlogHolder']['SJ'] = 'Betreff'; $lang['de_DE']['BlogHolder']['SPUC'] = 'Bitte Tags mit Kommata trennen.'; @@ -63,7 +63,7 @@ $lang['de_DE']['RSSWidget']['CT'] = 'Eigener Titel für den feed'; $lang['de_DE']['RSSWidget']['NTS'] = 'Anzahl der angezeigten Items'; $lang['de_DE']['RSSWidget']['PLURALNAME'] = 'RSS-Widgets'; $lang['de_DE']['RSSWidget']['SINGULARNAME'] = 'RSS-Widget'; -$lang['de_DE']['RSSWidget']['URL'] = 'URL des RSS Feed'; +$lang['de_DE']['RSSWidget']['URL'] = 'URL des RSS Feed der anderen Seite. Bitte vergewissern Sie sich, dass diese URL auf einen RSS Feed verweist.'; $lang['de_DE']['SubscribeRSSWidget']['PLURALNAME'] = 'RSS-Abonnier-Widgets'; $lang['de_DE']['SubscribeRSSWidget']['SINGULARNAME'] = 'RSS-Abonnier-Widget'; $lang['de_DE']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Abonnieren'; diff --git a/lang/en_GB.php b/lang/en_GB.php index 54a1d22..486f993 100644 --- a/lang/en_GB.php +++ b/lang/en_GB.php @@ -2,11 +2,11 @@ /** * English (United Kingdom) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; @@ -56,6 +56,7 @@ $lang['en_GB']['BlogManagementWidget.ss']['POSTNEW'] = 'Post a new blog entry'; $lang['en_GB']['BlogManagementWidget']['UNM1'] = 'You have 1 unmoderated comment'; $lang['en_GB']['BlogManagementWidget']['UNMM'] = 'You have %i unmoderated comments'; $lang['en_GB']['BlogSummary.ss']['COMMENTS'] = 'Comments'; +$lang['en_GB']['BlogSummary.ss']['POSTEDBY'] = 'Posted by'; $lang['en_GB']['BlogSummary.ss']['POSTEDON'] = 'on'; $lang['en_GB']['BlogSummary.ss']['VIEWFULL'] = 'View full post titled -'; $lang['en_GB']['RSSWidget']['CT'] = 'Custom title for the feed'; @@ -65,6 +66,8 @@ $lang['en_GB']['RSSWidget']['SINGULARNAME'] = 'RSS Widget'; $lang['en_GB']['RSSWidget']['URL'] = 'URL of RSS Feed'; $lang['en_GB']['SubscribeRSSWidget']['PLURALNAME'] = 'Subscript to RSS Widgets'; $lang['en_GB']['SubscribeRSSWidget']['SINGULARNAME'] = 'Subscript to an RSS Widget'; +$lang['en_GB']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Subscribe'; +$lang['en_GB']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Subscribe to this blog via RSS'; $lang['en_GB']['TagCloudWidget']['LIMIT'] = 'Limit number of tags'; $lang['en_GB']['TagCloudWidget']['PLURALNAME'] = 'Tag Cloud Widgets'; $lang['en_GB']['TagCloudWidget']['SBAL'] = 'alphabet'; diff --git a/lang/es_ES.php b/lang/es_ES.php index 0783464..adac8b6 100644 --- a/lang/es_ES.php +++ b/lang/es_ES.php @@ -2,11 +2,11 @@ /** * Spanish (Spain) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; @@ -16,6 +16,7 @@ if(array_key_exists('es_ES', $lang) && is_array($lang['es_ES'])) { $lang['es_ES'] = $lang['en_US']; } +$lang['es_ES']['ArchiveWidget']['DispBY'] = 'Mostrar por'; $lang['es_ES']['ArchiveWidget']['MONTH'] = 'mes'; $lang['es_ES']['ArchiveWidget']['PLURALNAME'] = 'Archivar Widgets'; $lang['es_ES']['ArchiveWidget']['SINGULARNAME'] = 'Archivar Widget'; @@ -27,26 +28,54 @@ $lang['es_ES']['BlogEntry']['DT'] = 'Fecha'; $lang['es_ES']['BlogEntry']['PLURALNAME'] = 'Entradas del Blog'; $lang['es_ES']['BlogEntry']['SINGULARNAME'] = 'Entrada del Blog'; $lang['es_ES']['BlogEntry.ss']['COMMENTS'] = 'Comentarios'; +$lang['es_ES']['BlogEntry.ss']['EDITTHIS'] = 'Editar esta entrada'; $lang['es_ES']['BlogEntry.ss']['POSTEDBY'] = 'Publicado por'; +$lang['es_ES']['BlogEntry.ss']['POSTEDON'] = 'en'; $lang['es_ES']['BlogEntry.ss']['TAGS'] = 'Etiquetas:'; +$lang['es_ES']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Retirar esta entrada'; $lang['es_ES']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Ver todas las publicaciones etiquetadas'; $lang['es_ES']['BlogEntry']['TS'] = 'Etiquetas (separados por comas)'; +$lang['es_ES']['BlogHolder']['HAVENTPERM'] = 'Escribir en el blog es una tarea del administrador. Por favor, identifícate.'; +$lang['es_ES']['BlogHolder']['PLURALNAME'] = 'Contenedores de Blog'; +$lang['es_ES']['BlogHolder']['POST'] = 'Entrada del blog'; +$lang['es_ES']['BlogHolder']['RSSFEED'] = 'RSS feed de este blog'; +$lang['es_ES']['BlogHolder']['SINGULARNAME'] = 'Contenedor de Blog'; +$lang['es_ES']['BlogHolder']['SJ'] = 'Asunto'; +$lang['es_ES']['BlogHolder']['SPUC'] = 'Por favor, separa las etiquetas mediante comas.'; +$lang['es_ES']['BlogHolder.ss']['NOENTRIES'] = 'No hay entradas'; +$lang['es_ES']['BlogHolder.ss']['VIEWINGTAGGED'] = 'Ver entrada etiquetadas como'; +$lang['es_ES']['BlogHolder']['SUCCONTENT'] = 'Felicitaciones, el módulo de blog de SilverStripe ha sido instalado correctamente. Esta entrada puede ser eliminada. Puedes configurar aspectos de tu blog (como los widgets mostrados en la barra lateral) en [url=admin]el CMS[/url].'; $lang['es_ES']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; +$lang['es_ES']['BlogHolder']['SUCTITLE'] = 'El módulo de blog de SilverStripe ha sido instalado correctamente'; $lang['es_ES']['BlogHolder']['TE'] = 'Por ejemplo: deporte, cine, tecnología'; +$lang['es_ES']['BlogManagementWidget']['COMADM'] = 'Administración de comentarios'; $lang['es_ES']['BlogManagementWidget']['PLURALNAME'] = 'Widgets de gestión del Blog'; $lang['es_ES']['BlogManagementWidget']['SINGULARNAME'] = 'Widget de gestión del Blog'; $lang['es_ES']['BlogManagementWidget.ss']['LOGOUT'] = 'Salir'; +$lang['es_ES']['BlogManagementWidget.ss']['POSTNEW'] = 'Escribir una nueva entrada del blog'; +$lang['es_ES']['BlogManagementWidget']['UNM1'] = 'Tienes 1 comentario sin moderar'; +$lang['es_ES']['BlogManagementWidget']['UNMM'] = 'Tienes %i comentarios sin moderar'; $lang['es_ES']['BlogSummary.ss']['COMMENTS'] = 'Comentarios'; $lang['es_ES']['BlogSummary.ss']['POSTEDBY'] = 'Publicado por'; +$lang['es_ES']['BlogSummary.ss']['POSTEDON'] = 'en'; +$lang['es_ES']['BlogSummary.ss']['VIEWFULL'] = 'Ver completo el post titulado -'; +$lang['es_ES']['RSSWidget']['CT'] = 'Título personalizado para el feed'; +$lang['es_ES']['RSSWidget']['NTS'] = 'Número de registros para mostrar'; $lang['es_ES']['RSSWidget']['PLURALNAME'] = 'Widgets RSS'; $lang['es_ES']['RSSWidget']['SINGULARNAME'] = 'Widget RSS'; +$lang['es_ES']['RSSWidget']['URL'] = 'URL del RSS Feed'; $lang['es_ES']['SubscribeRSSWidget']['PLURALNAME'] = 'Suscribir a Widgets RSS'; $lang['es_ES']['SubscribeRSSWidget']['SINGULARNAME'] = 'Suscribir a Widget RSS'; $lang['es_ES']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Suscribir'; $lang['es_ES']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Suscribirse a este blog vía RSS'; +$lang['es_ES']['TagCloudWidget']['LIMIT'] = 'Limitar el número de etiquetas'; +$lang['es_ES']['TagCloudWidget']['PLURALNAME'] = 'Nube de Etiquetas de Widgets'; $lang['es_ES']['TagCloudWidget']['SBAL'] = 'alfabeto'; $lang['es_ES']['TagCloudWidget']['SBFREQ'] = 'frecuencia'; +$lang['es_ES']['TagCloudWidget']['SINGULARNAME'] = 'Nube de Etiquetas de Widget'; $lang['es_ES']['TagCloudWidget']['SORTBY'] = 'Ordenar por'; $lang['es_ES']['TagCloudWidget']['TILE'] = 'Título'; +$lang['es_ES']['TrackBackPing']['PLURALNAME'] = 'Notificaciones de Trackback'; +$lang['es_ES']['TrackBackPing']['SINGULARNAME'] = 'Notificación de Trackback'; ?> \ No newline at end of file diff --git a/lang/es_MX.php b/lang/es_MX.php index 31d04dc..2bb2f6a 100644 --- a/lang/es_MX.php +++ b/lang/es_MX.php @@ -2,11 +2,11 @@ /** * Spanish (Mexico) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; diff --git a/lang/et_EE.php b/lang/et_EE.php index ad25fa7..5870825 100644 --- a/lang/et_EE.php +++ b/lang/et_EE.php @@ -2,11 +2,11 @@ /** * Estonian (Estonia) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; diff --git a/lang/fr_FR.php b/lang/fr_FR.php index c424f1c..3b94edd 100644 --- a/lang/fr_FR.php +++ b/lang/fr_FR.php @@ -2,11 +2,11 @@ /** * French (France) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; @@ -69,8 +69,10 @@ $lang['fr_FR']['SubscribeRSSWidget']['SINGULARNAME'] = 'Widget d\'abonnement RSS $lang['fr_FR']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Souscrire'; $lang['fr_FR']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Souscrire à ce blog par RSS'; $lang['fr_FR']['TagCloudWidget']['LIMIT'] = 'Nombre limite des tags'; +$lang['fr_FR']['TagCloudWidget']['PLURALNAME'] = 'Widgets Nuage de Tags'; $lang['fr_FR']['TagCloudWidget']['SBAL'] = 'alphabet'; $lang['fr_FR']['TagCloudWidget']['SBFREQ'] = 'fréquence'; +$lang['fr_FR']['TagCloudWidget']['SINGULARNAME'] = 'Widget Nuage de Tags'; $lang['fr_FR']['TagCloudWidget']['SORTBY'] = 'Trier par'; $lang['fr_FR']['TagCloudWidget']['TILE'] = 'Titre'; diff --git a/lang/hr_HR.php b/lang/hr_HR.php index cde02fb..b0d42dd 100644 --- a/lang/hr_HR.php +++ b/lang/hr_HR.php @@ -2,11 +2,11 @@ /** * Croatian (Croatia) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; diff --git a/lang/is_IS.php b/lang/is_IS.php index f058f2f..1da4b68 100644 --- a/lang/is_IS.php +++ b/lang/is_IS.php @@ -2,11 +2,11 @@ /** * Icelandic (Iceland) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; @@ -27,25 +27,29 @@ $lang['is_IS']['BlogEntry']['PLURALNAME'] = 'Blogg færslur'; $lang['is_IS']['BlogEntry']['SINGULARNAME'] = 'Blogg færsla'; $lang['is_IS']['BlogEntry.ss']['COMMENTS'] = 'Athugasemdir'; $lang['is_IS']['BlogEntry.ss']['EDITTHIS'] = 'Breyta þessari færslu'; -$lang['is_IS']['BlogEntry.ss']['POSTEDBY'] = 'Birt af'; +$lang['is_IS']['BlogEntry.ss']['POSTEDBY'] = 'Skrifað af'; $lang['is_IS']['BlogEntry.ss']['POSTEDON'] = 'á'; $lang['is_IS']['BlogEntry.ss']['TAGS'] = 'Tög:'; $lang['is_IS']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Hætta birtingu þessarar færslu'; $lang['is_IS']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Birta allar taggaðar færslur'; $lang['is_IS']['BlogEntry']['TS'] = 'Tög (komma til aðskilnaðar)'; $lang['is_IS']['BlogHolder']['HAVENTPERM'] = 'Birting bloggs er hlutverk stjórnanda. Vinsamlegast innskráðu þig.'; +$lang['is_IS']['BlogHolder']['PLURALNAME'] = 'Blogg umhverfi'; $lang['is_IS']['BlogHolder']['POST'] = 'Birta blogg færslu'; $lang['is_IS']['BlogHolder']['RSSFEED'] = 'RSS þjónusta fyrir þetta blogg'; +$lang['is_IS']['BlogHolder']['SINGULARNAME'] = 'Blogg umhverfi'; $lang['is_IS']['BlogHolder']['SJ'] = 'Málefni'; $lang['is_IS']['BlogHolder']['SPUC'] = 'Vinsamlegast notaðu kommu til að aðskilja tögin'; $lang['is_IS']['BlogHolder.ss']['NOENTRIES'] = 'Það eru engar blogg færslur'; $lang['is_IS']['BlogHolder.ss']['VIEWINGTAGGED'] = 'Skoða færslur sem eru taggaðar með'; $lang['is_IS']['BlogHolder']['SUCCONTENT'] = 'Til hamingju, uppsetningin á SilverStripe blogg einingunni tókst. -Þessari blogg færslu er hægt að eyða á örugganhátt. Þú getur stillt útlit blogsins þíns (svo sem widgets) i [url=admin] CMS[/url].'; +Þessari blogg færslu er hægt að eyða á örugganhátt. Þú getur stillt útlit blogsins þíns (svo sem widgets) i [url=admin] kefinu[/url].'; $lang['is_IS']['BlogHolder']['SUCTAGS'] = 'silverstripe, blogg'; $lang['is_IS']['BlogHolder']['SUCTITLE'] = 'Uppsetning á SilverStripe blogg einingunni tókst'; $lang['is_IS']['BlogHolder']['TE'] = 'Til dæmis: íþróttir, persónulegt, vísindasögur'; $lang['is_IS']['BlogManagementWidget']['COMADM'] = 'Athugasemda stjórnun'; +$lang['is_IS']['BlogManagementWidget']['PLURALNAME'] = 'Blogg stjórnunar aukahlutur'; +$lang['is_IS']['BlogManagementWidget']['SINGULARNAME'] = 'Blogg stjórnunar aukahlutur'; $lang['is_IS']['BlogManagementWidget.ss']['LOGOUT'] = 'Útskrá'; $lang['is_IS']['BlogManagementWidget.ss']['POSTNEW'] = 'Skrifa nýja færslu'; $lang['is_IS']['BlogManagementWidget']['UNM1'] = 'Þú átt 1 óskoðaða athugasemd'; @@ -56,10 +60,18 @@ $lang['is_IS']['BlogSummary.ss']['POSTEDON'] = 'á'; $lang['is_IS']['BlogSummary.ss']['VIEWFULL'] = 'Skoða alla færslu -'; $lang['is_IS']['RSSWidget']['CT'] = 'Titill fyrir þjónustuna'; $lang['is_IS']['RSSWidget']['NTS'] = 'Fjöldi hluta til að sýna'; +$lang['is_IS']['RSSWidget']['PLURALNAME'] = 'RSS aukahlutur'; +$lang['is_IS']['RSSWidget']['SINGULARNAME'] = 'RSS aukahlutur'; $lang['is_IS']['RSSWidget']['URL'] = 'Slóð á RSS þjónustuna'; +$lang['is_IS']['SubscribeRSSWidget']['PLURALNAME'] = 'Ãskriftar RSS aukahlutur'; +$lang['is_IS']['SubscribeRSSWidget']['SINGULARNAME'] = 'Ãskriftar RSS aukahlutur'; +$lang['is_IS']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Gerast áskrifandi'; +$lang['is_IS']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Gerast áskrifandi að þessu bloggi í gegnum RSS'; $lang['is_IS']['TagCloudWidget']['LIMIT'] = 'Takmarka fjölda tag'; +$lang['is_IS']['TagCloudWidget']['PLURALNAME'] = 'Tag ský aukahlutur'; $lang['is_IS']['TagCloudWidget']['SBAL'] = 'stafróf'; $lang['is_IS']['TagCloudWidget']['SBFREQ'] = 'tíðni'; +$lang['is_IS']['TagCloudWidget']['SINGULARNAME'] = 'Tag ský aukahlutur'; $lang['is_IS']['TagCloudWidget']['SORTBY'] = 'Raða eftir'; $lang['is_IS']['TagCloudWidget']['TILE'] = 'Titill'; diff --git a/lang/it_IT.php b/lang/it_IT.php index c7469b5..3591dd8 100644 --- a/lang/it_IT.php +++ b/lang/it_IT.php @@ -2,11 +2,11 @@ /** * Italian (Italy) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; @@ -18,11 +18,15 @@ if(array_key_exists('it_IT', $lang) && is_array($lang['it_IT'])) { $lang['it_IT']['ArchiveWidget']['DispBY'] = 'Visualizzato da'; $lang['it_IT']['ArchiveWidget']['MONTH'] = 'mese'; +$lang['it_IT']['ArchiveWidget']['PLURALNAME'] = 'Widget Archiviazione'; +$lang['it_IT']['ArchiveWidget']['SINGULARNAME'] = 'Widget Archiviazione'; $lang['it_IT']['ArchiveWidget']['YEAR'] = 'anno'; $lang['it_IT']['BlogEntry']['AU'] = 'Autore'; $lang['it_IT']['BlogEntry']['BBH'] = 'Aiuto BBCode'; $lang['it_IT']['BlogEntry']['CN'] = 'Contenuto'; $lang['it_IT']['BlogEntry']['DT'] = 'Data'; +$lang['it_IT']['BlogEntry']['PLURALNAME'] = 'Registrazioni blog'; +$lang['it_IT']['BlogEntry']['SINGULARNAME'] = 'Registrazione blog'; $lang['it_IT']['BlogEntry.ss']['COMMENTS'] = 'Commenti'; $lang['it_IT']['BlogEntry.ss']['EDITTHIS'] = 'Modifica questo post'; $lang['it_IT']['BlogEntry.ss']['POSTEDBY'] = 'Inserito da'; @@ -32,8 +36,10 @@ $lang['it_IT']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Non pubblicare questo post'; $lang['it_IT']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Visualizza tutti i post con etichetta'; $lang['it_IT']['BlogEntry']['TS'] = 'Etichette (separate da virgola)'; $lang['it_IT']['BlogHolder']['HAVENTPERM'] = 'Scrivere nel blog è un\'attività dell\'amministratore. Accedi come amministratore.'; +$lang['it_IT']['BlogHolder']['PLURALNAME'] = 'Proprietari blog'; $lang['it_IT']['BlogHolder']['POST'] = 'Salva il post nel blog'; $lang['it_IT']['BlogHolder']['RSSFEED'] = 'RSS feed di questo blog'; +$lang['it_IT']['BlogHolder']['SINGULARNAME'] = 'Proprietario blog'; $lang['it_IT']['BlogHolder']['SJ'] = 'Soggetto'; $lang['it_IT']['BlogHolder']['SPUC'] = 'Per favore separa le etichette usando virgole.'; $lang['it_IT']['BlogHolder.ss']['NOENTRIES'] = 'Non ci sono voci nel blog'; @@ -43,6 +49,8 @@ $lang['it_IT']['BlogHolder']['SUCTAGS'] = 'silverstripe, blog'; $lang['it_IT']['BlogHolder']['SUCTITLE'] = 'Modulo blog SilverStripe installato correttamente'; $lang['it_IT']['BlogHolder']['TE'] = 'Ad esempio: sport, personale, fantascienza'; $lang['it_IT']['BlogManagementWidget']['COMADM'] = 'Amministrazione commenti'; +$lang['it_IT']['BlogManagementWidget']['PLURALNAME'] = 'Widget di amministrazione blog'; +$lang['it_IT']['BlogManagementWidget']['SINGULARNAME'] = 'Widget di amministrazione blog'; $lang['it_IT']['BlogManagementWidget.ss']['LOGOUT'] = 'Esci'; $lang['it_IT']['BlogManagementWidget.ss']['POSTNEW'] = 'Inserisci un nuovo post'; $lang['it_IT']['BlogManagementWidget']['UNM1'] = 'Hai 1 commento da moderare'; @@ -51,13 +59,25 @@ $lang['it_IT']['BlogSummary.ss']['COMMENTS'] = 'Commenti'; $lang['it_IT']['BlogSummary.ss']['POSTEDBY'] = 'Inserito da'; $lang['it_IT']['BlogSummary.ss']['POSTEDON'] = 'su'; $lang['it_IT']['BlogSummary.ss']['VIEWFULL'] = 'Visualizza post intitolato - '; +$lang['it_IT']['BlogTree']['PLURALNAME'] = 'Alberi dei blog'; +$lang['it_IT']['BlogTree']['SINGULARNAME'] = 'Albero del blog'; $lang['it_IT']['RSSWidget']['CT'] = 'Titolo del feed'; $lang['it_IT']['RSSWidget']['NTS'] = 'Numero di argomenti da visualizzare'; +$lang['it_IT']['RSSWidget']['PLURALNAME'] = 'Widget RSS'; +$lang['it_IT']['RSSWidget']['SINGULARNAME'] = 'Widget RSS'; $lang['it_IT']['RSSWidget']['URL'] = 'URL per il Feed RSS'; +$lang['it_IT']['SubscribeRSSWidget']['PLURALNAME'] = 'Sottoscrivi Widget RSS'; +$lang['it_IT']['SubscribeRSSWidget']['SINGULARNAME'] = 'Sottoscrivi Widget RSS'; +$lang['it_IT']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Sottoscrivi'; +$lang['it_IT']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Sottoscrivi questo blog via RSS'; $lang['it_IT']['TagCloudWidget']['LIMIT'] = 'Limitare il numero dei tag a'; +$lang['it_IT']['TagCloudWidget']['PLURALNAME'] = 'Widget Nuvola di Tag'; $lang['it_IT']['TagCloudWidget']['SBAL'] = 'alfabeto'; $lang['it_IT']['TagCloudWidget']['SBFREQ'] = 'frequenza'; +$lang['it_IT']['TagCloudWidget']['SINGULARNAME'] = 'Widget Nuvola di Tag'; $lang['it_IT']['TagCloudWidget']['SORTBY'] = 'Ordina per'; $lang['it_IT']['TagCloudWidget']['TILE'] = 'Titolo'; +$lang['it_IT']['TrackBackPing']['PLURALNAME'] = 'Rileva Ping'; +$lang['it_IT']['TrackBackPing']['SINGULARNAME'] = 'Rileva Ping'; ?> \ No newline at end of file diff --git a/lang/ms_MY.php b/lang/ms_MY.php index 13312e7..b24eb12 100644 --- a/lang/ms_MY.php +++ b/lang/ms_MY.php @@ -2,11 +2,11 @@ /** * Malay (Malaysia) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; diff --git a/lang/nl_NL.php b/lang/nl_NL.php index 4fa06df..294fe4a 100644 --- a/lang/nl_NL.php +++ b/lang/nl_NL.php @@ -2,11 +2,11 @@ /** * Dutch (Netherlands) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; @@ -69,9 +69,13 @@ $lang['nl_NL']['SubscribeRSSWidget']['SINGULARNAME'] = 'Abonneer R S S Widget'; $lang['nl_NL']['SubscribeRSSWidget.ss']['SUBSCRIBETEXT'] = 'Inschrijven'; $lang['nl_NL']['SubscribeRSSWidget.ss']['SUBSCRIBETITLE'] = 'Inschrijven om dit weblog via RSS te volgen'; $lang['nl_NL']['TagCloudWidget']['LIMIT'] = 'Beperk aantal tags'; +$lang['nl_NL']['TagCloudWidget']['PLURALNAME'] = 'Tag Cloud Widgets'; $lang['nl_NL']['TagCloudWidget']['SBAL'] = 'alfabet'; $lang['nl_NL']['TagCloudWidget']['SBFREQ'] = 'frequentie'; +$lang['nl_NL']['TagCloudWidget']['SINGULARNAME'] = 'Tag Cloud Widget'; $lang['nl_NL']['TagCloudWidget']['SORTBY'] = 'Sorteer bij'; $lang['nl_NL']['TagCloudWidget']['TILE'] = 'Titel'; +$lang['nl_NL']['TrackBackPing']['PLURALNAME'] = 'Track Back Pings'; +$lang['nl_NL']['TrackBackPing']['SINGULARNAME'] = 'Track Back Ping'; ?> \ No newline at end of file diff --git a/lang/pl_PL.php b/lang/pl_PL.php index 187889c..b1c9e2e 100644 --- a/lang/pl_PL.php +++ b/lang/pl_PL.php @@ -2,11 +2,11 @@ /** * Polish (Poland) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; @@ -23,17 +23,21 @@ $lang['pl_PL']['BlogEntry']['AU'] = 'Autor'; $lang['pl_PL']['BlogEntry']['BBH'] = 'Pomoc BBCode'; $lang['pl_PL']['BlogEntry']['CN'] = 'Zawartość'; $lang['pl_PL']['BlogEntry']['DT'] = 'Data'; +$lang['pl_PL']['BlogEntry']['PLURALNAME'] = 'Wpisy bloga'; +$lang['pl_PL']['BlogEntry']['SINGULARNAME'] = 'Wpis bloga'; $lang['pl_PL']['BlogEntry.ss']['COMMENTS'] = 'Komentarze'; $lang['pl_PL']['BlogEntry.ss']['EDITTHIS'] = 'Edytuj ten post'; $lang['pl_PL']['BlogEntry.ss']['POSTEDBY'] = 'Dodane przez'; -$lang['pl_PL']['BlogEntry.ss']['POSTEDON'] = 'w'; +$lang['pl_PL']['BlogEntry.ss']['POSTEDON'] = 'Opublikowano'; $lang['pl_PL']['BlogEntry.ss']['TAGS'] = 'Tagi:'; $lang['pl_PL']['BlogEntry.ss']['UNPUBLISHTHIS'] = 'Cofnij publikacjÄ™ tego postu'; $lang['pl_PL']['BlogEntry.ss']['VIEWALLPOSTTAGGED'] = 'Zobacz wszystkie posty otagowane jako'; $lang['pl_PL']['BlogEntry']['TS'] = 'Tagi (oddziel przecinkami)'; $lang['pl_PL']['BlogHolder']['HAVENTPERM'] = 'Tylko administrator może publikować wpisy na blogu. Zaloguj siÄ™.'; +$lang['pl_PL']['BlogHolder']['PLURALNAME'] = 'Blog Listy'; $lang['pl_PL']['BlogHolder']['POST'] = 'Publikuj wpis'; $lang['pl_PL']['BlogHolder']['RSSFEED'] = 'Subskrybuj wpisy na tym blogu przez RSS'; +$lang['pl_PL']['BlogHolder']['SINGULARNAME'] = 'Blog Lista'; $lang['pl_PL']['BlogHolder']['SJ'] = 'Temat'; $lang['pl_PL']['BlogHolder']['SPUC'] = 'Oddziel tagi używajÄ…c przecinków.'; $lang['pl_PL']['BlogHolder.ss']['NOENTRIES'] = 'Nie ma żadnych wpisów na blogu'; @@ -49,11 +53,15 @@ $lang['pl_PL']['BlogManagementWidget']['UNM1'] = 'Masz 1 niesprawdzony komentarz $lang['pl_PL']['BlogManagementWidget']['UNMM'] = 'Masz %i niesprawdzonych komentarzy'; $lang['pl_PL']['BlogSummary.ss']['COMMENTS'] = 'Komentarze'; $lang['pl_PL']['BlogSummary.ss']['POSTEDBY'] = 'Napisane przez'; -$lang['pl_PL']['BlogSummary.ss']['POSTEDON'] = 'w'; +$lang['pl_PL']['BlogSummary.ss']['POSTEDON'] = 'Opublikowano'; $lang['pl_PL']['BlogSummary.ss']['VIEWFULL'] = 'Zobacz peÅ‚ny post zatytuÅ‚owany - '; $lang['pl_PL']['RSSWidget']['CT'] = 'TytuÅ‚ dla kanaÅ‚u'; $lang['pl_PL']['RSSWidget']['NTS'] = 'Ilość pokazywanych wpisów'; +$lang['pl_PL']['RSSWidget']['PLURALNAME'] = 'Widżety RSS'; +$lang['pl_PL']['RSSWidget']['SINGULARNAME'] = 'Widżet RSS'; $lang['pl_PL']['RSSWidget']['URL'] = 'URL RSS'; +$lang['pl_PL']['SubscribeRSSWidget']['PLURALNAME'] = 'Subksrybuj widżety RSS'; +$lang['pl_PL']['SubscribeRSSWidget']['SINGULARNAME'] = 'Subksrybuj widżet RSS'; $lang['pl_PL']['TagCloudWidget']['LIMIT'] = 'Limit tagów'; $lang['pl_PL']['TagCloudWidget']['SBAL'] = 'alfabetu'; $lang['pl_PL']['TagCloudWidget']['SBFREQ'] = 'czÄ™stoÅ›ci wystÄ™powania'; diff --git a/lang/pt_PT.php b/lang/pt_PT.php index 5e4c9bc..2cd2943 100644 --- a/lang/pt_PT.php +++ b/lang/pt_PT.php @@ -2,11 +2,11 @@ /** * Portuguese (Portugal) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; diff --git a/lang/ru_RU.php b/lang/ru_RU.php index 11a5347..e6215c5 100644 --- a/lang/ru_RU.php +++ b/lang/ru_RU.php @@ -2,11 +2,11 @@ /** * Russian (Russia) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; diff --git a/lang/sr_RS.php b/lang/sr_RS.php index e11b271..758d1e3 100644 --- a/lang/sr_RS.php +++ b/lang/sr_RS.php @@ -2,11 +2,11 @@ /** * Serbian (Serbia) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; diff --git a/lang/tr_TR.php b/lang/tr_TR.php index 24d4b57..23d9564 100644 --- a/lang/tr_TR.php +++ b/lang/tr_TR.php @@ -2,11 +2,11 @@ /** * Turkish (Turkey) language pack - * @package modules: blog + * @package blog * @subpackage i18n */ -i18n::include_locale_file('modules: blog', 'en_US'); +i18n::include_locale_file('blog', 'en_US'); global $lang; From a2b9e2f00cbc6c2f9602237098e43575829a1f49 Mon Sep 17 00:00:00 2001 From: Carlos Barberis Date: Wed, 18 Nov 2009 03:00:40 +0000 Subject: [PATCH 179/250] BUGFIX: using Controller::curr instead Director::get_current_page to work with 2.3 and 2.4 --- code/BlogTree.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index c977ddc..a75f676 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -38,7 +38,9 @@ class BlogTree extends Page { * - Otherwise, try and find a 'top-level' BlogTree */ static function current() { - $page = Director::get_current_page(); + + $controller = Controller::curr(); + if($controller) $page = $controller->data(); // If we _are_ a BlogTree, use us if ($page instanceof BlogTree) return $page; From 10d15e1dddb75345ea2ae52a8efcb5d900f8d574 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Mon, 30 Nov 2009 08:18:56 +0000 Subject: [PATCH 180/250] APICHANGE: Drop 2.3 support - 0.3 will be 2.4 only --- code/ArchiveWidget.php | 49 +++++--------- code/BlogEntry.php | 13 ++-- code/BlogHolder.php | 17 ++--- code/BlogManagementWidget.php | 3 +- code/BlogTree.php | 118 ++++++++-------------------------- code/RSSWidget.php | 1 + code/SubscribeRSSWidget.php | 3 +- code/TagCloudWidget.php | 4 +- code/TrackBackDecorator.php | 1 - 9 files changed, 61 insertions(+), 148 deletions(-) diff --git a/code/ArchiveWidget.php b/code/ArchiveWidget.php index 0746d11..a423a49 100644 --- a/code/ArchiveWidget.php +++ b/code/ArchiveWidget.php @@ -6,10 +6,10 @@ * @package blog */ class ArchiveWidget extends Widget { - static $db = array( 'DisplayMode' => 'Varchar' ); + static $has_one = array(); static $has_many = array(); @@ -52,37 +52,19 @@ class ArchiveWidget extends Widget { $suffix = (!$stage || $stage == 'Stage') ? "" : "_$stage"; if($this->DisplayMode == 'month') { - if(defined('DB::USE_ANSI_SQL')) { - $sqlResults = DB::query(" - SELECT DISTINCT MONTH(\"Date\") AS \"Month\", YEAR(\"Date\") AS \"Year\" - FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\" ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\" - WHERE \"ParentID\" IN (" . implode(', ', $ids) . ") - ORDER BY \"Year\" DESC, \"Month\" DESC;" - ); - } else { - $sqlResults = DB::query(" - SELECT DISTINCT MONTH(`Date`) AS `Month`, YEAR(`Date`) AS `Year` - FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` - WHERE `ParentID` IN (" . implode(', ', $ids) . ") - ORDER BY `Year` DESC, `Month` DESC;" - ); - } + $sqlResults = DB::query(" + SELECT DISTINCT MONTH(\"Date\") AS \"Month\", YEAR(\"Date\") AS \"Year\" + FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\" ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\" + WHERE \"ParentID\" IN (" . implode(', ', $ids) . ") + ORDER BY \"Year\" DESC, \"Month\" DESC;" + ); } else { - if(defined('DB::USE_ANSI_SQL')) { - $sqlResults = DB::query(" - SELECT DISTINCT YEAR(\"Date\") AS \"Year\" - FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\" ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\" - WHERE \"ParentID\" IN (" . implode(', ', $ids) . ") - ORDER BY \"Year\" DESC" - ); - } else { - $sqlResults = DB::query(" - SELECT DISTINCT YEAR(`Date`) AS `Year` - FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` - WHERE `ParentID` in (".implode(', ',$ids).") - ORDER BY `Year` DESC" - ); - } + $sqlResults = DB::query(" + SELECT DISTINCT YEAR(\"Date\") AS \"Year\" + FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\" ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\" + WHERE \"ParentID\" IN (" . implode(', ', $ids) . ") + ORDER BY \"Year\" DESC" + ); } if($sqlResults) foreach($sqlResults as $sqlResult) { @@ -111,6 +93,7 @@ class ArchiveWidget extends Widget { } return $results; - } - + } } + +?> diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 07a685a..6688932 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -5,19 +5,18 @@ * @package blog */ class BlogEntry extends Page { - - static $default_parent = 'BlogHolder'; - - static $can_be_root = false; - - static $icon = "blog/images/blogpage"; - static $db = array( "Date" => "Datetime", "Author" => "Text", "Tags" => "Text" ); + static $default_parent = 'BlogHolder'; + + static $can_be_root = false; + + static $icon = "blog/images/blogpage"; + static $has_one = array(); static $has_many = array(); diff --git a/code/BlogHolder.php b/code/BlogHolder.php index b6a4512..f08a76b 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -12,7 +12,6 @@ * BlogHolders have a form on them for easy posting, and an owner that can post to them, BlogTrees don't */ class BlogHolder extends BlogTree implements PermissionProvider { - static $icon = "blog/images/blogholder"; static $db = array( @@ -76,7 +75,6 @@ class BlogHolder extends BlogTree implements PermissionProvider { */ function IsOwner() { return (Permission::check('BLOGMANAGEMENT') || Permission::check('ADMIN')); - //return Permission::check('ADMIN') || (Member::currentUserID() == $this->OwnerID); } /** @@ -118,20 +116,18 @@ class BlogHolder extends BlogTree implements PermissionProvider { $blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed"); $blog->URLSegment = 'sample-blog-entry'; $blog->Tags = _t('BlogHolder.SUCTAGS',"silverstripe, blog"); - $blog->Content = _t('BlogHolder.SUCCONTENT',"Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in [url=admin]the CMS[/url]."); + $blog->Content = _t('BlogHolder.SUCCONTENT',"

Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in the CMS.

"); $blog->Status = "Published"; $blog->ParentID = $blogholder->ID; $blog->write(); $blog->publish("Stage", "Live"); - // 2.3/2.4 dual compatibility - if(method_exists('DB', 'alteration_message')) DB::alteration_message("Blog page created","created"); + DB::alteration_message("Blog page created","created"); } } } class BlogHolder_Controller extends BlogTree_Controller { - static $allowed_actions = array( 'index', 'tag', @@ -149,10 +145,10 @@ class BlogHolder_Controller extends BlogTree_Controller { * TODO: this is an urgent fix to work with archive link (e.g. page_url/2009/04). Replace this with something better. */ function checkAccessAction($action) { - if (preg_match('/[0-9]{4}/', $action)) - { + if(preg_match('/[0-9]{4}/', $action)) { return true; } + return parent::checkAccessAction($action); } @@ -217,14 +213,15 @@ class BlogHolder_Controller extends BlogTree_Controller { } else { $tagfield = new TextField('Tags'); } + $field = 'TextField'; if(!$this->AllowCustomAuthors && !Permission::check('ADMIN')) { $field = 'ReadonlyField'; } $fields = new FieldSet( new HiddenField("ID", "ID"), - new TextField("Title",_t('BlogHolder.SJ', "Subject")), - new $field("Author",_t('BlogEntry.AU'),$membername), + new TextField("Title", _t('BlogHolder.SJ', "Subject")), + new $field("Author", _t('BlogEntry.AU'), $membername), $contentfield, $tagfield, new LiteralField("Tagsnote","
<% if IsOwner %>

<% _t('EDITTHIS', 'Edit this post') %> | <% _t('UNPUBLISHTHIS', 'Unpublish this post') %>

<% end_if %> diff --git a/tests/BlogEntryTest.php b/tests/BlogEntryTest.php new file mode 100644 index 0000000..845d4e9 --- /dev/null +++ b/tests/BlogEntryTest.php @@ -0,0 +1,26 @@ +objFromFixture('BlogEntry', 'testpost'); + $entry->Content = "[url=admin]the CMS[/url]"; + + $this->assertEquals('

the CMS

', $entry->Content()->value); + BlogEntry::$allow_wysiwyg_editing = $tmpFlag; + } + + function testContent() { + $tmpFlag = BlogEntry::$allow_wysiwyg_editing; + BlogEntry::$allow_wysiwyg_editing = true; + + $entry = $this->objFromFixture('BlogEntry', 'testpost'); + $entry->Content = 'the CMS'; + + $this->assertEquals('the CMS', $entry->Content()); + BlogEntry::$allow_wysiwyg_editing = $tmpFlag; + } +} \ No newline at end of file From dc879cb49fea4f8e029c31a101e2ef2d2a8319c5 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Sun, 20 Jun 2010 00:56:08 +0000 Subject: [PATCH 223/250] MINOR: add unit test for receiving trackback --- tests/BlogEntryTest.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/BlogEntryTest.php b/tests/BlogEntryTest.php index 845d4e9..22f0a7b 100644 --- a/tests/BlogEntryTest.php +++ b/tests/BlogEntryTest.php @@ -1,4 +1,8 @@ assertEquals('the CMS', $entry->Content()); BlogEntry::$allow_wysiwyg_editing = $tmpFlag; } + + function testTrackback() { + $blog = $this->objFromFixture('BlogHolder', 'mainblog'); + $blog->TrackBacksEnabled = true; + $blog->write(); + + $entry = $this->objFromFixture('BlogEntry', 'testpost'); + $response = $entry->trackbackping(); + + $this->assertContains("1", $response); + + $_POST['url'] = 'test trackback post url'; + $_POST['title'] = 'test trackback post title'; + $_POST['excerpt'] = 'test trackback post excerpt'; + $_POST['blog_name'] = 'test trackback blog name'; + + $response = $entry->trackbackping(); + $this->assertContains("0", $response); + + $trackback = DataObject::get_one('TrackBackPing'); + $this->assertEquals('test trackback post url', $trackback->Url); + $this->assertEquals('test trackback post title', $trackback->Title); + $this->assertEquals('test trackback post excerpt', $trackback->Excerpt); + $this->assertEquals('test trackback blog name', $trackback->BlogName); + + unset($_POST); + } } \ No newline at end of file From 68df5406157b655528469365382a24c313301fd9 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Tue, 22 Jun 2010 01:13:10 +0000 Subject: [PATCH 224/250] FEATURE: Add send trackback notification --- code/BlogEntry.php | 1 - code/TrackBackDecorator.php | 101 +++++++++++++++++++++++++++++++++- tests/BlogEntryTest.php | 26 --------- tests/BlogTrackbackTest.php | 107 ++++++++++++++++++++++++++++++++++++ 4 files changed, 207 insertions(+), 28 deletions(-) create mode 100644 tests/BlogTrackbackTest.php diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 97cffcc..4f137ee 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -265,4 +265,3 @@ class BlogEntry_Controller extends Page_Controller { } } -?> diff --git a/code/TrackBackDecorator.php b/code/TrackBackDecorator.php index 67dd5d8..8bc2dec 100644 --- a/code/TrackBackDecorator.php +++ b/code/TrackBackDecorator.php @@ -1,13 +1,84 @@ array( + 'TrackbackURL' => 'Varchar(2048)', + 'PungTrackbackURL' => 'Varchar(2048)' + ), 'has_many' => array( 'TrackBacks' => 'TrackBackPing' ) ); } + + function updateCMSFields($fields) { + // Trackback URL field + if($this->owner->TrackBacksEnabled()) { + $fields->addFieldToTab("Root.Content.Main", new TextField("TrackbackURL", _t("BlogEntry.TRACKBACKURL", "Trackback URL")), "Content"); + } + else { + $fields->addFieldToTab("Root.Content.Main", new ReadonlyField("TrackbackURLReadOnly", _t("BlogEntry.TRACKBACKURL", "Trackback URL"), _t("BlogEntry.TRACKBACKURL_DISABLED", "To use this feature, please check 'Enable TrackBacks' check box on the blog holder.")), "Content"); + } + } + + function onBeforePublish() { + $owner = $this->owner; + + if(!empty($owner->TrackbackURL) && $owner->TrackBacksEnabled() && $owner->ShouldTrackbackNotify()) { + + if($this->trackbackNotify()) { + $owner->PungTrackbackURL = $owner->TrackbackURL; + $owner->write(); + } + } + } + + /** + * Trackback notify the specified trackback url + * @param boolean | true on success, otherwise false + */ + function trackbackNotify() { + $owner = $this->owner; + + $content = new HTMLText('Content'); + $content->setValue($owner->Content); + $excerpt = $content->FirstParagraph(); + + if($owner->Parent() && $owner->ParentID > 0) { + $blogName = $owner->Parent()->Title; + } + else { + $blogName = ""; + } + + $postData = array( + 'url' => $owner->AbsoluteLink(), + 'title' => $owner->Title, + 'excerpt' => $excerpt, + 'blog_name' => $blogName + ); + + $controller = Object::create(self::$trackback_server_class); + $response = $controller->request($owner->TrackbackURL, $postData); + + if($response->getStatusCode() == '200' && stripos($response->getBody(), "0") !== false) { + return true; + } + + return false; + + } + + function ShouldTrackbackNotify() { + return (trim($this->owner->TrackbackURL) != '' && $this->owner->TrackbackURL != $this->owner->PungTrackbackURL); + } function updateMetaTags(&$tags) { $tags .= $this->owner->renderWith('TrackBackRdf'); @@ -49,4 +120,32 @@ class TrackBackDecorator extends DataObjectDecorator { } } +/** + * Example: + * $controller = Object::create('TrackbackHTTPClient'); + * $response = $controller->request(new SS_HTTPRequest('POST', $url, null, $postData)); + */ +class TrackbackHTTPServer { + + function __construct() {} + + /** + * @param string + * @param array + * @return SS_HTTPResponse + */ + function request($url, $data) { + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + $response = curl_exec($ch); + $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + + curl_close($ch); + + return new SS_HTTPResponse($response, $statusCode); + } +} + ?> diff --git a/tests/BlogEntryTest.php b/tests/BlogEntryTest.php index 22f0a7b..b1a3411 100644 --- a/tests/BlogEntryTest.php +++ b/tests/BlogEntryTest.php @@ -28,30 +28,4 @@ class BlogEntryTest extends SapphireTest { BlogEntry::$allow_wysiwyg_editing = $tmpFlag; } - function testTrackback() { - $blog = $this->objFromFixture('BlogHolder', 'mainblog'); - $blog->TrackBacksEnabled = true; - $blog->write(); - - $entry = $this->objFromFixture('BlogEntry', 'testpost'); - $response = $entry->trackbackping(); - - $this->assertContains("1", $response); - - $_POST['url'] = 'test trackback post url'; - $_POST['title'] = 'test trackback post title'; - $_POST['excerpt'] = 'test trackback post excerpt'; - $_POST['blog_name'] = 'test trackback blog name'; - - $response = $entry->trackbackping(); - $this->assertContains("0", $response); - - $trackback = DataObject::get_one('TrackBackPing'); - $this->assertEquals('test trackback post url', $trackback->Url); - $this->assertEquals('test trackback post title', $trackback->Title); - $this->assertEquals('test trackback post excerpt', $trackback->Excerpt); - $this->assertEquals('test trackback blog name', $trackback->BlogName); - - unset($_POST); - } } \ No newline at end of file diff --git a/tests/BlogTrackbackTest.php b/tests/BlogTrackbackTest.php new file mode 100644 index 0000000..7fa6745 --- /dev/null +++ b/tests/BlogTrackbackTest.php @@ -0,0 +1,107 @@ +objFromFixture('BlogHolder', 'mainblog'); + $blog->TrackBacksEnabled = true; + $blog->write(); + + $entry = $this->objFromFixture('BlogEntry', 'testpost'); + $response = $entry->trackbackping(); + + $this->assertContains("1", $response); + + $_POST['url'] = 'test trackback post url'; + $_POST['title'] = 'test trackback post title'; + $_POST['excerpt'] = 'test trackback post excerpt'; + $_POST['blog_name'] = 'test trackback blog name'; + + $response = $entry->trackbackping(); + $this->assertContains("0", $response); + + $trackback = DataObject::get_one('TrackBackPing'); + $this->assertEquals('test trackback post url', $trackback->Url); + $this->assertEquals('test trackback post title', $trackback->Title); + $this->assertEquals('test trackback post excerpt', $trackback->Excerpt); + $this->assertEquals('test trackback blog name', $trackback->BlogName); + + unset($_POST); + } + + function testShouldTrackbackNotify() { + $blog = $this->objFromFixture('BlogHolder', 'mainblog'); + $blog->TrackBacksEnabled = true; + + $entry = $this->objFromFixture('BlogEntry', 'testpost'); + $this->assertFalse($entry->ShouldTrackbackNotify()); + + $entry = $this->objFromFixture('BlogEntry', 'testpost'); + $entry->TrackbackURL = ' '; + $this->assertFalse($entry->ShouldTrackbackNotify()); + + $entry = $this->objFromFixture('BlogEntry', 'testpost'); + $entry->TrackbackURL = 'someurl'; + $this->assertTrue($entry->ShouldTrackbackNotify()); + } + + function testTrackbackNotify() { + $tmpServerClass = TrackBackDecorator::$trackback_server_class; + TrackBackDecorator::$trackback_server_class = "TestTrackbackHTTPServer"; + + $blog = $this->objFromFixture('BlogHolder', 'mainblog'); + $blog->TrackBacksEnabled = true; + + $entry = $this->objFromFixture('BlogEntry', 'testpost'); + $entry->TrackbackURL = 'testGoodTrackbackURL'; + $this->assertTrue($entry->trackbackNotify()); + + $entry->TrackbackURL = 'testBadTrackbackURL'; + $this->assertFalse($entry->trackbackNotify()); + + $entry->TrackbackURL = 'testNonExistingTrackbackURL'; + $this->assertFalse($entry->trackbackNotify()); + + TrackBackDecorator::$trackback_server_class = $tmpServerClass; + } +} + +class TestTrackbackHTTPServer extends TrackbackHTTPServer implements TestOnly { + + function request($url, $data) { + if($url == 'testGoodTrackbackURL') { + $response = $this->goodTrackback(); + $statusCode = '200'; + } + else if($url == 'testBadTrackbackURL') { + $response = $this->badTrackback(); + $statusCode = '200'; + } + else { + $response = $this->badTrackback(); + $statusCode = '404'; + } + + return new SS_HTTPResponse($response, $statusCode); + } + + private function goodTrackback() { + return " + + 0 + + "; + } + + private function badTrackback() { + return " + + 1 + Some error text + "; + } +} \ No newline at end of file From 834b6d8f91ce9ebc47ad34e3e9b42475fb1333a6 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Wed, 23 Jun 2010 05:50:02 +0000 Subject: [PATCH 225/250] ENHANCEMENT: Allow notifying multiple trackback urls per blog entry APICHANGE: TrackBackDecorator::trackbackNotify() allow one parameter APICHANGE: remove TrackBackDecorator::ShouldTrackbackNotify() --- code/TrackBackDecorator.php | 67 ++++++++++++++++++---------------- code/TrackBackURL.php | 54 +++++++++++++++++++++++++++ tests/BlogTrackbackTest.php | 73 +++++++++++++++++++++++-------------- tests/BlogTrackbackTest.yml | 38 +++++++++++++++++++ 4 files changed, 173 insertions(+), 59 deletions(-) create mode 100644 code/TrackBackURL.php create mode 100644 tests/BlogTrackbackTest.yml diff --git a/code/TrackBackDecorator.php b/code/TrackBackDecorator.php index 8bc2dec..5356fd9 100644 --- a/code/TrackBackDecorator.php +++ b/code/TrackBackDecorator.php @@ -1,6 +1,6 @@ array( - 'TrackbackURL' => 'Varchar(2048)', - 'PungTrackbackURL' => 'Varchar(2048)' - ), 'has_many' => array( + 'TrackBackURLs' => 'TrackBackURL', 'TrackBacks' => 'TrackBackPing' ) ); @@ -21,63 +18,67 @@ class TrackBackDecorator extends DataObjectDecorator { function updateCMSFields($fields) { // Trackback URL field if($this->owner->TrackBacksEnabled()) { - $fields->addFieldToTab("Root.Content.Main", new TextField("TrackbackURL", _t("BlogEntry.TRACKBACKURL", "Trackback URL")), "Content"); + $trackbackURLTable = new ComplexTableField( + $this, + 'TrackBackURLs', + 'TrackBackURL', + array( + 'URL' => 'URL', + 'IsPung' => 'Pung?' + ), + 'getCMSFields_forPopup', + '', + 'ID' + ); + $fields->addFieldToTab("Root.Content.Main", $trackbackURLTable); } else { - $fields->addFieldToTab("Root.Content.Main", new ReadonlyField("TrackbackURLReadOnly", _t("BlogEntry.TRACKBACKURL", "Trackback URL"), _t("BlogEntry.TRACKBACKURL_DISABLED", "To use this feature, please check 'Enable TrackBacks' check box on the blog holder.")), "Content"); + $fields->addFieldToTab("Root.Content.Main", new ReadonlyField("TrackBackURLsReadOnly", _t("BlogEntry.TrackbackURLs", "Trackback URLs"), _t("BlogEntry.TrackbackURLs_DISABLED", "To use this feature, please check 'Enable TrackBacks' check box on the blog holder."))); } } function onBeforePublish() { - $owner = $this->owner; - - if(!empty($owner->TrackbackURL) && $owner->TrackBacksEnabled() && $owner->ShouldTrackbackNotify()) { - - if($this->trackbackNotify()) { - $owner->PungTrackbackURL = $owner->TrackbackURL; - $owner->write(); + if(!$this->owner->TrackBacksEnabled() && !$this->owner->TrackBackURLs()) return; + + foreach($this->owner->TrackBackURLs() as $trackBackURL) { + if(!$trackBackURL->Pung && $this->trackbackNotify($trackBackURL->URL)) { + $trackBackURL->Pung = true; + $trackBackURL->write(); } - } + } } /** * Trackback notify the specified trackback url * @param boolean | true on success, otherwise false */ - function trackbackNotify() { - $owner = $this->owner; - + function trackbackNotify($url) { $content = new HTMLText('Content'); - $content->setValue($owner->Content); + $content->setValue($this->owner->Content); $excerpt = $content->FirstParagraph(); - - if($owner->Parent() && $owner->ParentID > 0) { - $blogName = $owner->Parent()->Title; + + if($this->owner->Parent() && $this->owner->ParentID > 0) { + $blogName = $this->owner->Parent()->Title; } else { $blogName = ""; } - + $postData = array( - 'url' => $owner->AbsoluteLink(), - 'title' => $owner->Title, + 'url' => $this->owner->AbsoluteLink(), + 'title' => $this->owner->Title, 'excerpt' => $excerpt, 'blog_name' => $blogName ); - + $controller = Object::create(self::$trackback_server_class); - $response = $controller->request($owner->TrackbackURL, $postData); + $response = $controller->request($url, $postData); if($response->getStatusCode() == '200' && stripos($response->getBody(), "0") !== false) { return true; } return false; - - } - - function ShouldTrackbackNotify() { - return (trim($this->owner->TrackbackURL) != '' && $this->owner->TrackbackURL != $this->owner->PungTrackbackURL); } function updateMetaTags(&$tags) { @@ -136,6 +137,8 @@ class TrackbackHTTPServer { */ function request($url, $data) { $ch = curl_init($url); + + curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); diff --git a/code/TrackBackURL.php b/code/TrackBackURL.php new file mode 100644 index 0000000..c2b112c --- /dev/null +++ b/code/TrackBackURL.php @@ -0,0 +1,54 @@ + 'Varchar(2048)', + 'Pung' => 'Boolean(0)' + ); + + static $has_one = array( + 'BlogEntry' => 'BlogEntry' + ); + + function getCMSFields_forPopup() { + return new FieldSet( + new TextField('URL'), + new ReadonlyField('Pung', 'Pung?') + ); + } + + /** + * Return a human-reable string indicate whether the url has been pung or not + * Also update the url if it's duplicate + * @return string - 'Yes' or 'No' + */ + function IsPung() { + if($this->Pung) return _t('TrackBackULR.YES', 'Yes'); + + if($this->isDuplicate(true)) { + $this->Pung = true; + $this->write(); + + return _t('TrackBackULR.YES', 'Yes'); + } + + return _t('TrackBackULR.NO', 'No'); + } + + /** + * Check if there is a duplication, based on the associcated blog entry and the url. + * If onPung is set, it returns true only when the duplicated record that has Pung = true + * @param boolean + * @return boolean + */ + function isDuplicate($onPung = false) { + $where = "\"BlogEntryID\" = {$this->BlogEntryID} AND \"URL\" = '{$this->URL}' AND TrackBackURL.ID <> {$this->ID}"; + if($onPung) $where .= " AND Pung IS TRUE"; + + if(DataObject::get_one($this->ClassName, $where)) { + return true; + } + + return false; + } +} \ No newline at end of file diff --git a/tests/BlogTrackbackTest.php b/tests/BlogTrackbackTest.php index 7fa6745..cf9550e 100644 --- a/tests/BlogTrackbackTest.php +++ b/tests/BlogTrackbackTest.php @@ -4,7 +4,7 @@ * @subpackage tests */ class BlogTrackbackTest extends SapphireTest { - static $fixture_file = 'blog/tests/BlogTest.yml'; + static $fixture_file = 'blog/tests/BlogTrackbackTest.yml'; function testTrackback() { $blog = $this->objFromFixture('BlogHolder', 'mainblog'); @@ -33,47 +33,66 @@ class BlogTrackbackTest extends SapphireTest { unset($_POST); } - function testShouldTrackbackNotify() { - $blog = $this->objFromFixture('BlogHolder', 'mainblog'); - $blog->TrackBacksEnabled = true; - - $entry = $this->objFromFixture('BlogEntry', 'testpost'); - $this->assertFalse($entry->ShouldTrackbackNotify()); - - $entry = $this->objFromFixture('BlogEntry', 'testpost'); - $entry->TrackbackURL = ' '; - $this->assertFalse($entry->ShouldTrackbackNotify()); - - $entry = $this->objFromFixture('BlogEntry', 'testpost'); - $entry->TrackbackURL = 'someurl'; - $this->assertTrue($entry->ShouldTrackbackNotify()); - } - function testTrackbackNotify() { $tmpServerClass = TrackBackDecorator::$trackback_server_class; TrackBackDecorator::$trackback_server_class = "TestTrackbackHTTPServer"; - + $blog = $this->objFromFixture('BlogHolder', 'mainblog'); $blog->TrackBacksEnabled = true; + $blog->write(); $entry = $this->objFromFixture('BlogEntry', 'testpost'); - $entry->TrackbackURL = 'testGoodTrackbackURL'; - $this->assertTrue($entry->trackbackNotify()); - - $entry->TrackbackURL = 'testBadTrackbackURL'; - $this->assertFalse($entry->trackbackNotify()); - - $entry->TrackbackURL = 'testNonExistingTrackbackURL'; - $this->assertFalse($entry->trackbackNotify()); + $this->assertTrue($entry->trackbackNotify('testGoodTrackbackURL')); + $this->assertFalse($entry->trackbackNotify('testBadTrackbackURL')); + $this->assertFalse($entry->trackbackNotify('testNonExistingTrackbackURL')); TrackBackDecorator::$trackback_server_class = $tmpServerClass; } + + function testOnBeforePublish() { + $tmpServerClass = TrackBackDecorator::$trackback_server_class; + TrackBackDecorator::$trackback_server_class = "TestTrackbackHTTPServer"; + + $blog = $this->objFromFixture('BlogHolder', 'mainblog'); + $blog->TrackBacksEnabled = true; + $blog->write(); + + $entry1 = $this->objFromFixture('BlogEntry', 'testpost'); + $entry1->doPublish(); + $this->assertEquals(2, $entry1->TrackBackURLs()->Count()); + $this->assertEquals(array('testGoodTrackbackURL' => 1), $entry1->TrackBackURLs()->map('URL', 'Pung')); + + $entry2 = $this->objFromFixture('BlogEntry', 'testpost2'); + $entry2->doPublish(); + $this->assertEquals(4, $entry2->TrackBackURLs()->Count()); + $this->assertEquals(array('testBadTrackbackURL' => 0, 'testGoodTrackbackURL2' => 1, 'noneExistingURL' => 0, 'testGoodTrackbackURL3' => 1), $entry2->TrackBackURLs()->map('URL', 'Pung')); + + TrackBackDecorator::$trackback_server_class = $tmpServerClass; + } + + function testDuplicateIsTrackBackURL() { + $url1 = $this->objFromFixture('TrackBackURL', 'goodTrackBackURL1'); + $urlDup = $this->objFromFixture('TrackBackURL', 'dupTrackBackURL'); + + $url2 = $this->objFromFixture('TrackBackURL', 'goodTrackBackURL2'); + $this->assertFalse($url2->isDuplicate()); + $this->assertFalse($url2->isDuplicate(true)); + + $this->assertTrue($urlDup->isDuplicate()); + $this->assertFalse($urlDup->isDuplicate(true)); + + $url1->Pung = true; + $url1->write(); + $this->assertTrue($urlDup->isDuplicate(true)); + + + } } class TestTrackbackHTTPServer extends TrackbackHTTPServer implements TestOnly { function request($url, $data) { - if($url == 'testGoodTrackbackURL') { + if(in_array($url, array('testGoodTrackbackURL', 'testGoodTrackbackURL2', 'testGoodTrackbackURL3'))) { $response = $this->goodTrackback(); $statusCode = '200'; } diff --git a/tests/BlogTrackbackTest.yml b/tests/BlogTrackbackTest.yml new file mode 100644 index 0000000..586b7b1 --- /dev/null +++ b/tests/BlogTrackbackTest.yml @@ -0,0 +1,38 @@ +TrackBackURL: + goodTrackBackURL1: + URL: testGoodTrackbackURL + goodTrackBackURL2: + URL: testGoodTrackbackURL2 + goodTrackBackURL3: + URL: testGoodTrackbackURL3 + badTrackBackURL: + URL: testBadTrackbackURL + noneTrackBackURL: + URL: noneExistingURL + dupTrackBackURL: + URL: testGoodTrackbackURL + +BlogHolder: + mainblog: + Title: Main Blog + +BlogEntry: + testpost: + Title: Test Post + URLSegment: test-post + Date: 2007-02-17 18:45:00 + Parent: =>BlogHolder.mainblog + Tags: tag1,tag2 + TrackBackURLs: =>TrackBackURL.goodTrackBackURL1, =>TrackBackURL.dupTrackBackURL + testpost2: + Title: Test Post 2 + URLSegment: test-post-2 + Parent: =>BlogHolder.mainblog + TrackBackURLs: =>TrackBackURL.badTrackBackURL,=>TrackBackURL.goodTrackBackURL2,=>TrackBackURL.noneTrackBackURL,=>TrackBackURL.goodTrackBackURL3 + + + + + + + From 20ad8dfbbc8183fd64c28552e77e647976174825 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sat, 26 Jun 2010 04:47:15 +0000 Subject: [PATCH 226/250] BUGFIX: getParent() may return null. Prevent calling function on null (esp when running tests) --- code/BlogEntry.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 4f137ee..53a9124 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -163,14 +163,14 @@ class BlogEntry extends Page { * Link for editing this blog entry */ function EditURL() { - return $this->getParent()->Link('post') . '/' . $this->ID . '/'; + return ($this->getParent()) ? $this->getParent()->Link('post') . '/' . $this->ID . '/' : false; } /** * Check to see if trackbacks are enabled. */ function TrackBacksEnabled() { - return $this->getParent()->TrackBacksEnabled; + return ($this->getParent()) ? $this->getParent()->TrackBacksEnabled : false; } function trackbackping() { From 3bf8ebc49c575407d562374fddb5e2bf0c155cc6 Mon Sep 17 00:00:00 2001 From: Andreas Piening Date: Mon, 28 Jun 2010 00:30:10 +0000 Subject: [PATCH 227/250] MINOR: fixed malformed sql query --- code/TrackBackURL.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/TrackBackURL.php b/code/TrackBackURL.php index c2b112c..0959903 100644 --- a/code/TrackBackURL.php +++ b/code/TrackBackURL.php @@ -43,7 +43,7 @@ class TrackBackURL extends DataObject { */ function isDuplicate($onPung = false) { $where = "\"BlogEntryID\" = {$this->BlogEntryID} AND \"URL\" = '{$this->URL}' AND TrackBackURL.ID <> {$this->ID}"; - if($onPung) $where .= " AND Pung IS TRUE"; + if($onPung) $where .= " AND \"Pung\" = 1"; if(DataObject::get_one($this->ClassName, $where)) { return true; From d75c402999de9ad74378550ea8aafdb5a364be14 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 28 Jun 2010 01:10:17 +0000 Subject: [PATCH 228/250] MINOR Fixed TrackbackURL->isDuplicate() with ANSI compliant SQL (see r106984 and r107129) --- code/TrackBackURL.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/TrackBackURL.php b/code/TrackBackURL.php index 0959903..7cf0903 100644 --- a/code/TrackBackURL.php +++ b/code/TrackBackURL.php @@ -42,7 +42,7 @@ class TrackBackURL extends DataObject { * @return boolean */ function isDuplicate($onPung = false) { - $where = "\"BlogEntryID\" = {$this->BlogEntryID} AND \"URL\" = '{$this->URL}' AND TrackBackURL.ID <> {$this->ID}"; + $where = "\"BlogEntryID\" = {$this->BlogEntryID} AND \"URL\" = '{$this->URL}' AND \"TrackBackURL\".\"ID\" <> {$this->ID}"; if($onPung) $where .= " AND \"Pung\" = 1"; if(DataObject::get_one($this->ClassName, $where)) { From 9cfd303ecf61fa334670b0973afcfa32257c56f6 Mon Sep 17 00:00:00 2001 From: Carlos Barberis Date: Thu, 1 Jul 2010 21:49:58 +0000 Subject: [PATCH 229/250] BUGFIX: Got rid of link to post new entry in the front end on a BlogTree (method does not exist on BlogTree). Thanks smurkas (#4692) --- code/widgets/BlogManagementWidget.php | 2 +- templates/BlogManagementWidget.ss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/widgets/BlogManagementWidget.php b/code/widgets/BlogManagementWidget.php index eb9f4ec..964d7bc 100644 --- a/code/widgets/BlogManagementWidget.php +++ b/code/widgets/BlogManagementWidget.php @@ -60,7 +60,7 @@ class BlogManagementWidget_Controller extends Widget_Controller { function PostLink() { $container = BlogTree::current(); - if ($container) return $container->Link('post'); + return ($container && $container->ClassName != "BlogTree") ? $container->Link('post') : false; } } ?> diff --git a/templates/BlogManagementWidget.ss b/templates/BlogManagementWidget.ss index 29f4b4a..430d27b 100644 --- a/templates/BlogManagementWidget.ss +++ b/templates/BlogManagementWidget.ss @@ -1,5 +1,5 @@ From d491c442dcdfbb60ff51530398eb5f96cfa8f61a Mon Sep 17 00:00:00 2001 From: Carlos Barberis Date: Thu, 1 Jul 2010 23:30:13 +0000 Subject: [PATCH 230/250] ENHANCEMENT: Added option to view archives just by year (ticket #5667) ENHANCEMENT: added action on BlogTree --- code/BlogTree.php | 26 +++++++++++++++++++++----- templates/Layout/BlogHolder.ss | 2 +- templates/Layout/BlogTree.ss | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 889b465..b6d4533 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -210,7 +210,8 @@ class BlogTree_Controller extends Page_Controller { static $allowed_actions = array( 'index', 'rss', - 'tag' + 'tag', + 'date' ); function init() { @@ -255,7 +256,7 @@ class BlogTree_Controller extends Page_Controller { $date = $this->SelectedDate(); - return $this->Entries("$start,$limit", $this->SelectedTag(), ($date) ? $date->Format('Y-m') : '', null, $filter); + return $this->Entries("$start,$limit", $this->SelectedTag(), ($date) ? $date : '', null, $filter); } /** @@ -311,13 +312,28 @@ class BlogTree_Controller extends Page_Controller { $month = $this->request->latestParam('OtherID'); if(is_numeric($year) && is_numeric($month) && $month < 13) { - $date = new Date(); - $date->setValue($year .'-'. $month); - + + $date = $year .'-'. $month; return $date; + + } else { + + if(is_numeric($year)) return $year; } } return false; } + + function SelectedNiceDate(){ + $date = $this->SelectedDate(); + + if(strpos($date, '-')) { + $date = explode("-",$date); + return date("F", mktime(0, 0, 0, $date[1], 1, date('Y'))). " " .date("Y", mktime(0, 0, 0, date('m'), 1, $date[0])); + + } else { + return date("Y", mktime(0, 0, 0, date('m'), 1, $date)); + } + } } \ No newline at end of file diff --git a/templates/Layout/BlogHolder.ss b/templates/Layout/BlogHolder.ss index e8e7779..0ce2595 100644 --- a/templates/Layout/BlogHolder.ss +++ b/templates/Layout/BlogHolder.ss @@ -7,7 +7,7 @@ <% if SelectedTag %>

<% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'

<% else_if SelectedDate %> -

<% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedDate.Month $SelectedDate.Year

+

<% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate

<% end_if %> <% if BlogEntries %> diff --git a/templates/Layout/BlogTree.ss b/templates/Layout/BlogTree.ss index 59ee03a..8c64613 100644 --- a/templates/Layout/BlogTree.ss +++ b/templates/Layout/BlogTree.ss @@ -7,7 +7,7 @@ <% if SelectedTag %>

<% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'

<% else_if SelectedDate %> -

<% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedDate.Month $SelectedDate.Year

+

<% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate

<% end_if %> <% if BlogEntries %> From d7bb8a6d74e44c8c6c92c67a499b6d3a4d897660 Mon Sep 17 00:00:00 2001 From: Carlos Barberis Date: Tue, 3 Aug 2010 00:44:30 +0000 Subject: [PATCH 231/250] BUGFIX: Fixed front end post entry form validation and its test --- 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 e4aff3a..b50d830 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 92c09ee62fb62bc99bcc0080f57a6dbef19a0d0f Mon Sep 17 00:00:00 2001 From: Paul Clarke Date: Sun, 22 Aug 2010 23:26:49 +0000 Subject: [PATCH 232/250] Blog styling --- css/tagcloud.css | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/css/tagcloud.css b/css/tagcloud.css index 464952f..3fb67e0 100644 --- a/css/tagcloud.css +++ b/css/tagcloud.css @@ -1,6 +1,6 @@ -.tagcloud .not-popular { font-size: 1em; } -.tagcloud .not-very-popular { font-size: 1.3em; } -.tagcloud .somewhat-popular { font-size: 1.6em; } -.tagcloud .popular { font-size: 1.9em; } -.tagcloud .very-popular { font-size: 2.2em; } -.tagcloud .ultra-popular { font-size: 2.5em; } \ No newline at end of file +.tagcloud .not-popular { font-size: .9em; } +.tagcloud .not-very-popular { font-size: 1em; } +.tagcloud .somewhat-popular { font-size: 1.3em; } +.tagcloud .popular { font-size: 1.6em; } +.tagcloud .very-popular { font-size: 1.9em; } +.tagcloud .ultra-popular { font-size: 2.2em; } \ No newline at end of file From 3593f03f7e793ba42cea45af046a5bf4143dcfde Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 3 Oct 2010 20:02:43 +0000 Subject: [PATCH 233/250] 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 b6d4533..01ad118 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -298,7 +298,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 1a6bb1482c7b3d0d05e9fad887b382f865e98180 Mon Sep 17 00:00:00 2001 From: Carlos Barberis Date: Thu, 7 Oct 2010 22:31:04 +0000 Subject: [PATCH 234/250] BUGFIX: TagCloudWidget uses themedCSS instead css (ticket 6059, thanks artyom) --- code/widgets/TagCloudWidget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/widgets/TagCloudWidget.php b/code/widgets/TagCloudWidget.php index 2fe130a..ed51693 100644 --- a/code/widgets/TagCloudWidget.php +++ b/code/widgets/TagCloudWidget.php @@ -43,7 +43,7 @@ class TagCloudWidget extends Widget { } function TagsCollection() { - Requirements::css("blog/css/tagcloud.css"); + Requirements::themedCSS("tagcloud"); $allTags = array(); $max = 0; From 438feba01e6941deb1eff15c38e08418ac2e18ab Mon Sep 17 00:00:00 2001 From: Carlos Barberis Date: Fri, 8 Oct 2010 03:28:11 +0000 Subject: [PATCH 235/250] BUGFIX: TagCloudWidget sorts by frecuency even with limit equal 0, see ticket 6060 --- code/widgets/TagCloudWidget.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/widgets/TagCloudWidget.php b/code/widgets/TagCloudWidget.php index ed51693..4a2874a 100644 --- a/code/widgets/TagCloudWidget.php +++ b/code/widgets/TagCloudWidget.php @@ -64,13 +64,13 @@ class TagCloudWidget extends Widget { if($allTags) { //TODO: move some or all of the sorts to the database for more efficiency - if($this->Limit > 0){ - uasort($allTags, array($this, "column_sort_by_popularity")); //sort by popularity - $allTags = array_slice($allTags, 0, $this->Limit,true); - } - if($this->Sortby == "alphabet"){ + if($this->Limit > 0) $allTags = array_slice($allTags, 0, $this->Limit, true); + + if($this->Sortby == "alphabet"){ $this->natksort($allTags); - } + } else{ + uasort($allTags, array($this, "column_sort_by_popularity")); // sort by frequency + } $sizes = array(); foreach ($allTags as $tag => $count) $sizes[$count] = true; @@ -79,7 +79,7 @@ class TagCloudWidget extends Widget { $numsizes = count($sizes)-1; //Work out the number of different sizes $buckets = count(self::$popularities)-1; - // If there are more frequencies then buckets, divide frequencies into buckets + // If there are more frequencies than buckets, divide frequencies into buckets if ($numsizes > $buckets) { $numsizes = $buckets; } From eb527139547052c5289ca368d32d4af2ff33834a Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Fri, 10 Dec 2010 03:20:26 +0000 Subject: [PATCH 236/250] MINOR: Allow decorating db and cms fields of widgets in one decorator. Thanks to smurkas --- code/widgets/ArchiveWidget.php | 20 ++++++++++++-------- code/widgets/RSSWidget.php | 12 ++++++++---- code/widgets/TagCloudWidget.php | 12 ++++++++---- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/code/widgets/ArchiveWidget.php b/code/widgets/ArchiveWidget.php index 1186fb7..77b2c7b 100644 --- a/code/widgets/ArchiveWidget.php +++ b/code/widgets/ArchiveWidget.php @@ -29,15 +29,19 @@ class ArchiveWidget extends Widget { static $description = 'Show a list of months or years in which there are blog posts, and provide links to them.'; function getCMSFields() { - $fields = new FieldSet( - new OptionsetField( - 'DisplayMode', - _t('ArchiveWidget.DispBY', 'Display by'), - array( - 'month' => _t('ArchiveWidget.MONTH', 'month'), - 'year' => _t('ArchiveWidget.YEAR', 'year') + $fields = parent::getCMSFields(); + + $fields->merge( + new FieldSet( + new OptionsetField( + 'DisplayMode', + _t('ArchiveWidget.DispBY', 'Display by'), + array( + 'month' => _t('ArchiveWidget.MONTH', 'month'), + 'year' => _t('ArchiveWidget.YEAR', 'year') + ) ) - ) + ) ); $this->extend('updateCMSFields', $fields); diff --git a/code/widgets/RSSWidget.php b/code/widgets/RSSWidget.php index 5209c42..17f8bc9 100644 --- a/code/widgets/RSSWidget.php +++ b/code/widgets/RSSWidget.php @@ -40,10 +40,14 @@ class RSSWidget extends Widget { } function getCMSFields() { - $fields = new FieldSet( - new TextField("RSSTitle", _t('RSSWidget.CT', "Custom title for the feed")), - new TextField("RssUrl", _t('RSSWidget.URL', "URL of the other page's RSS feed. Please make sure this URL points to an RSS feed.")), - new NumericField("NumberToShow", _t('RSSWidget.NTS', "Number of Items to show")) + $fields = parent::getCMSFields(); + + $fields->merge( + new FieldSet( + new TextField("RSSTitle", _t('RSSWidget.CT', "Custom title for the feed")), + new TextField("RssUrl", _t('RSSWidget.URL', "URL of the other page's RSS feed. Please make sure this URL points to an RSS feed.")), + new NumericField("NumberToShow", _t('RSSWidget.NTS', "Number of Items to show")) + ) ); $this->extend('updateCMSFields', $fields); diff --git a/code/widgets/TagCloudWidget.php b/code/widgets/TagCloudWidget.php index 4a2874a..960c007 100644 --- a/code/widgets/TagCloudWidget.php +++ b/code/widgets/TagCloudWidget.php @@ -27,10 +27,14 @@ class TagCloudWidget extends Widget { static $popularities = array( 'not-popular', 'not-very-popular', 'somewhat-popular', 'popular', 'very-popular', 'ultra-popular' ); function getCMSFields() { - $fields = new FieldSet( - new TextField("Title", _t("TagCloudWidget.TILE", "Title")), - new TextField("Limit", _t("TagCloudWidget.LIMIT", "Limit number of tags")), - new OptionsetField("Sortby",_t("TagCloudWidget.SORTBY","Sort by"),array("alphabet"=>_t("TagCloudWidget.SBAL", "alphabet"),"frequency"=>_t("TagCloudWidget.SBFREQ", "frequency"))) + $fields = parent::getCMSFields(); + + $fields->merge( + new FieldSet( + new TextField("Title", _t("TagCloudWidget.TILE", "Title")), + new TextField("Limit", _t("TagCloudWidget.LIMIT", "Limit number of tags")), + new OptionsetField("Sortby",_t("TagCloudWidget.SORTBY","Sort by"),array("alphabet"=>_t("TagCloudWidget.SBAL", "alphabet"),"frequency"=>_t("TagCloudWidget.SBFREQ", "frequency"))) + ) ); $this->extend('updateCMSFields', $fields); From 66f7263f8ad8caaa20ba2b9a66934de146ae5620 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 16 Dec 2010 01:36:08 +0000 Subject: [PATCH 237/250] MINOR Added BlogEntry_Controller->PageComments() as a temporary workaround to avoid deprecation warnings from new 'comments' module --- code/BlogEntry.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 53a9124..b81ab42 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -263,5 +263,16 @@ class BlogEntry_Controller extends Page_Controller { Director::redirect($this->getParent()->Link()); } } + + /** + * Temporary workaround for compatibility with 'comments' module + * (has been extracted from sapphire/trunk in 12/2010). + * + * @return Form + */ + function PageComments() { + if($this->hasMethod('CommentsForm')) return $this->CommentsForm(); + else return parent::PageComments(); + } } From c4dde4bccd7f6ef8eb230f146e87bd04dcf43cc9 Mon Sep 17 00:00:00 2001 From: Carlos Barberis Date: Tue, 11 Jan 2011 22:15:52 +0000 Subject: [PATCH 238/250] MINOR: Show in menus is true now by default --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index b81ab42..1a7671e 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -27,7 +27,7 @@ class BlogEntry extends Page { static $defaults = array( "ProvideComments" => true, - 'ShowInMenus' => false + 'ShowInMenus' => true ); static $extensions = array( From 40a52b8cfdaca10c872936412bd69a206d6fc15b Mon Sep 17 00:00:00 2001 From: Carlos Barberis Date: Tue, 11 Jan 2011 22:18:26 +0000 Subject: [PATCH 239/250] 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 1a7671e..b81ab42 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -27,7 +27,7 @@ class BlogEntry extends Page { static $defaults = array( "ProvideComments" => true, - 'ShowInMenus' => true + 'ShowInMenus' => false ); static $extensions = array( From c3415b66971e45881cec633e725b49430a654a0f Mon Sep 17 00:00:00 2001 From: phalkun Date: Fri, 14 Jan 2011 14:07:54 +1300 Subject: [PATCH 240/250] MINOR: Move documentation from http://doc.silverstripe.org MINOR: Update README to Markdown format --- README | 17 ----------------- README.md | 18 ++++++++++++++++++ docs/Install.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 17 deletions(-) delete mode 100644 README create mode 100644 README.md create mode 100644 docs/Install.md diff --git a/README b/README deleted file mode 100644 index b81ef97..0000000 --- a/README +++ /dev/null @@ -1,17 +0,0 @@ -#################################################### -Blog Module -#################################################### - -# Maintainer Contact -Saophalkun Ponlu (Nickname: aoneil) - -Carlos Barberis - - -# Requirements -SilverStripe minimum version 2.4.0 - -# Documentation -http://doc.silverstripe.com/doku.php?id=modules:blog - - diff --git a/README.md b/README.md new file mode 100644 index 0000000..b8be84a --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# Blog Module + +## Maintainer Contact + +- Saophalkun Ponlu +- Carlos Barberis + +## Requirements + +SilverStripe minimum version 2.4.0 + +## Installation + +See docs/Install.md + +## Usage + +See doc/Install.md diff --git a/docs/Install.md b/docs/Install.md new file mode 100644 index 0000000..a7faed3 --- /dev/null +++ b/docs/Install.md @@ -0,0 +1,45 @@ +# Blog Module + +## 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. + +## Feature Overview + +- Front-end blog post form +- Posts allow bbcode +- RSS feed for blog and also feeds for comments on posts +- Easily customizable +- Tag cloud widget +- Archive widget +- Blog management widget +- RSS widget (will likely move in future) + +## Page types + +We have chosen to go with the following page types to include with the blog module: + +- **BlogTree** This is a holder of BlogHolder. If your site has only one blog holder, you won't need this page type. +- **BlogHolder** The BlogHolder shows BlogEntries, and provides a way to search etc.It would also contain methods to post new blogs. +- BlogEntry: This is simply an entry/post for the blog. + +## View Archived Blogs + +Blog archives can be viewed by `year/month` by appending the year, followed by a forward slash, then the numerical month, to the end of the BlogHolder URL. Alternately, just the year can be appended to view entries for that year. + +for example: + +- `mysite/blog/2007/6` would show blog entries for June 2007 +- `mysite/blog/2007` would show blog entries for 2007 + +## Comments and Spam Protection + +See [PageComment](http://doc.silverstripe.org/pagecomment). + +## Widgets + +See [Widgets](http://doc.silverstripe.org/widgets). + +## Working with the theme + +The blog comes set up to use the `\themes\blackcandy_blog\` directory by default. See [themes](http://doc.silverstripe.org/themes). From 2cd7216f2ad9e8363de9d486178cb145925fb7de Mon Sep 17 00:00:00 2001 From: Fred Condo Date: Mon, 17 Jan 2011 13:02:45 +0100 Subject: [PATCH 241/250] BUGFIX: #6118 Remove Debug::log call. --- code/MetaWeblogController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/code/MetaWeblogController.php b/code/MetaWeblogController.php index 0b4041e..f890a75 100644 --- a/code/MetaWeblogController.php +++ b/code/MetaWeblogController.php @@ -9,7 +9,6 @@ require_once(BASE_PATH . '/blog/thirdparty/xmlrpc/xmlrpc_wrappers.php'); */ class MetaWeblogController extends Controller { function index($request) { - Debug::log(Debug::text($request)); // Create an xmlrpc server, and set up the method calls $service = new xmlrpc_server(array( From e2f088e1e80e61a412c1e8d4cdec2bff6e7b0c12 Mon Sep 17 00:00:00 2001 From: phalkunz Date: Thu, 20 Jan 2011 13:38:28 +1300 Subject: [PATCH 242/250] MINOR: Blog tag now supports multibyte chars in the front-end. Thanks to hex0id. --- code/widgets/TagCloudWidget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/widgets/TagCloudWidget.php b/code/widgets/TagCloudWidget.php index 960c007..ed1bbe0 100644 --- a/code/widgets/TagCloudWidget.php +++ b/code/widgets/TagCloudWidget.php @@ -57,7 +57,7 @@ class TagCloudWidget extends Widget { if($entries) { foreach($entries as $entry) { - $theseTags = split(" *, *", strtolower(trim($entry->Tags))); + $theseTags = split(" *, *", mb_strtolower(trim($entry->Tags))); foreach($theseTags as $tag) { if($tag != "") { $allTags[$tag] = isset($allTags[$tag]) ? $allTags[$tag] + 1 : 1; //getting the count into key => value map From db45cb9b49f859de3af74b7830fd366df3db3840 Mon Sep 17 00:00:00 2001 From: phalkunz Date: Fri, 21 Jan 2011 15:48:47 +1300 Subject: [PATCH 243/250] MINOR: Make use of Link()'s parameter --- code/BlogTree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 01ad118..4d2533c 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -263,7 +263,7 @@ class BlogTree_Controller extends Page_Controller { * This will create a tag point to the RSS feed */ function IncludeBlogRSS() { - RSSFeed::linkToFeed($this->Link() . "rss", _t('BlogHolder.RSSFEED',"RSS feed of these blogs")); + RSSFeed::linkToFeed($this->Link('rss'), _t('BlogHolder.RSSFEED',"RSS feed of these blogs")); } /** From 8ccd23db5a55bb6b62a3838ae0c88e123cd1ddbe Mon Sep 17 00:00:00 2001 From: phalkunz Date: Fri, 21 Jan 2011 15:49:36 +1300 Subject: [PATCH 244/250] MINOR: Fix RSS validator warning. Thanks to tim. --- code/BlogTree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 4d2533c..30d2ce4 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -278,7 +278,7 @@ class BlogTree_Controller extends Page_Controller { $entries = $this->Entries(20); if($entries) { - $rss = new RSSFeed($entries, $this->Link(), ($blogName ? $blogName : $altBlogName), "", "Title", "RSSContent"); + $rss = new RSSFeed($entries, $this->Link('rss'), ($blogName ? $blogName : $altBlogName), "", "Title", "RSSContent"); $rss->outputToBrowser(); } } From eef7d57b80cac4e70be01fb2f7cf36abd5b073b4 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 12 Feb 2011 12:54:06 +1300 Subject: [PATCH 245/250] MINOR Migrated content from doc.ss.org --- README.md | 81 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 72 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b8be84a..1d5e528 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,81 @@ # Blog Module -## Maintainer Contact +## Introduction -- Saophalkun Ponlu -- Carlos Barberis +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. -## Requirements +## Maintainer Contact ## -SilverStripe minimum version 2.4.0 + * Saophalkun Ponlu (phalkunz at silverstripe dot com) + * Carlos Barberis (carlos at silverstripe dot com) -## Installation +## Feature Overview -See docs/Install.md +* Front-end blog post form +* Posts allow bbcode +* RSS feed for blog and also feeds for comments on posts +* Easily customizable +* Tag cloud widget +* Archive widget +* Blog management widget +* RSS widget (will likely move in future) -## Usage +## Configuration Options -See doc/Install.md +### Use WYSIWYG editing instead of bbcode + +Out of the box the blog module uses bbcode, just like the forum module. If you want to go back to using the standard page editing toolbar you need to add the following code to your mysite/_config.php file + + :::php + BlogEntry::allow_wysiwyg_editing(); + + +## Page types + +We have chosen to go with the following page types to include with the blog module: + +* BlogHolder: The BlogHolder shows BlogEntrys, and provides a way to search etc.It would also contain methods to post new blogs. + +* BlogEntry: This is simply an entry/post for the blog. + + +## Simple form for adding a post + +There is a blog management widget, that includes a link "Post new blog entry", which takes the user to [site/CurrentBlogHolder]/post (this is a good url to bookmark if you will be using it to blog regularly). This shows a blog entry form, which requires a subject and some content at the least. Clicking "Post blog entry" takes the user back to the blog. A login form will show if the user is not logged in. The entered author name is stored in a cookie. Initially the shown name will be the user's name. + +#### BBcode support + +* BBCode can be entered into the form. + +* A bbcode tags help box shows when the "BBCode help" link is clicked. Javascript is required for this to work. + +See [:PEAR:BBCodeParser](/PEAR/BBCodeParser) for more details. + +#### Modifying the blog entry form + +You may want to add or remove certain fields from the blog entry form. This can be done in **BlogHolder.php**. You will need to modify the $fields FieldSet object in the BlogEntryForm function. [tutorial 3](tutorial/3-forms#creating_the_form) shows you how to do this. + +You will likely need to play around with the form and associated css to get the form looking how you want it. + +## View Archived Blogs + +Blog archives can be viewed by year/month by appending the year, followed by a forward slash, then the numerical month, to the end of the blogholder URL. Alternately, just the year can be appended to view entries for that year. + +for example: mysite/blog/2007/6 would show blog entries for June 2007 + +or: mysite/blog/2007 would show blog entries for 2007 + +## Comments and Spam Protection + +See [:pagecomment](/pagecomment) for creating Askimet-protected comments for every page. + +## Widgets + +See [widgets](/widgets) + + +## Working with the theme + +The blog comes set up to use the `\themes\blackcandy_blog\` directory by default. + + * See [:themes](/themes) \ No newline at end of file From 1ed87c004e93dd18d8e7fbe0e36a3c14b2d6f525 Mon Sep 17 00:00:00 2001 From: John Clarke Date: Thu, 5 May 2011 10:59:10 +0200 Subject: [PATCH 246/250] BUGFIX: support for legacy installations for the date based blog entry listing using slashes rather than dashes. PATCH via jcinteractive. (#5) --- code/BlogTree.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/code/BlogTree.php b/code/BlogTree.php index 30d2ce4..758d828 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -162,9 +162,17 @@ class BlogTree extends Page { } if($date) { - if(strpos($date, '-')) { - $year = (int) substr($date, 0, strpos($date, '-')); - $month = (int) substr($date, strpos($date, '-') + 1); + // Some systems still use the / seperator for date presentation + if( strpos($date, '-') ) $seperator = '-'; + elseif( strpos($date, '/') ) $seperator = '/'; + + if(isset($seperator) && !empty($seperator)) { + // The 2 in the explode argument will tell it to only create 2 elements + // i.e. in this instance the $year and $month fields respectively + list($year,$month) = explode( $seperator, $date, 2); + + $year = (int)$year; + $month = (int)$month; if($year && $month) { if(method_exists(DB::getConn(), 'formattedDatetimeClause')) { From 9796265e7cfb53e63e69ffbc848f2a435621602d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gra=C3=9Fl?= Date: Sun, 8 Jan 2012 15:03:00 +0100 Subject: [PATCH 247/250] Use SS_Datetime instead of Datetime. Allows the usage of Object::useCustomClass('SS_Datetime', 'LocalDatetime'); --- code/BlogEntry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index b81ab42..b4138b5 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -6,7 +6,7 @@ */ class BlogEntry extends Page { static $db = array( - "Date" => "Datetime", + "Date" => "SS_Datetime", "Author" => "Text", "Tags" => "Text" ); From 836f745ef3bbd4e5e287760975adb60502346e0a Mon Sep 17 00:00:00 2001 From: Matt Gunn Date: Sat, 24 Mar 2012 13:36:45 +1300 Subject: [PATCH 248/250] fixing for ss3 (parentid) --- code/BlogEntry.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index b4138b5..862b07c 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -31,9 +31,7 @@ class BlogEntry extends Page { ); static $extensions = array( - 'Hierarchy', - 'TrackBackDecorator', - "Versioned('Stage', 'Live')" + 'TrackBackDecorator' ); /** From 8b58156211b0ede5e0dd72e577df4d2870b95373 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 12 Apr 2012 13:53:32 +1200 Subject: [PATCH 249/250] BUGFIX Initial fixes to support at least building the blog module on SS3 --- code/BlogEntry.php | 11 +++++------ code/BlogHolder.php | 30 ++++++++++++++---------------- code/BlogTree.php | 6 +++--- code/TrackBackDecorator.php | 6 +++--- code/widgets/ArchiveWidget.php | 4 ++-- code/widgets/RSSWidget.php | 4 ++-- code/widgets/TagCloudWidget.php | 6 +++--- tests/BlogTrackbackTest.php | 4 ++-- 8 files changed, 34 insertions(+), 37 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index 862b07c..f882b50 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -49,7 +49,7 @@ class BlogEntry extends Page { $this->setField('Date', date('Y-m-d H:i:s', strtotime('now'))); } - function getCMSFields() { + function getCMSFields($params = null) { Requirements::javascript('blog/javascript/bbcodehelp.js'); Requirements::themedCSS('bbcodehelp'); @@ -57,7 +57,7 @@ class BlogEntry extends Page { $codeparser = new BBCodeParser(); SiteTree::disableCMSFieldsExtensions(); - $fields = parent::getCMSFields(); + $fields = parent::getCMSFields($params); SiteTree::enableCMSFieldsExtensions(); if(!self::$allow_wysiwyg_editing) { @@ -87,8 +87,8 @@ class BlogEntry extends Page { * Returns the tags added to this blog entry */ function TagsCollection() { - $tags = split(" *, *", trim($this->Tags)); - $output = new DataObjectSet(); + $tags = preg_split('/ *, */', trim($this->Tags)); + $output = new ArrayList(); $link = $this->getParent() ? $this->getParent()->Link('tag') : ''; @@ -270,7 +270,6 @@ class BlogEntry_Controller extends Page_Controller { */ function PageComments() { if($this->hasMethod('CommentsForm')) return $this->CommentsForm(); - else return parent::PageComments(); } - + } diff --git a/code/BlogHolder.php b/code/BlogHolder.php index b50d830..d0053a3 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -27,15 +27,15 @@ class BlogHolder extends BlogTree implements PermissionProvider { 'BlogEntry' ); - function getCMSFields() { + function getCMSFields($params = null) { $blogOwners = $this->blogOwners(); SiteTree::disableCMSFieldsExtensions(); - $fields = parent::getCMSFields(); + $fields = parent::getCMSFields($params); SiteTree::enableCMSFieldsExtensions(); $fields->addFieldToTab('Root.Content.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks')); - $fields->addFieldToTab('Root.Content.Main', new DropdownField('OwnerID', 'Blog owner', $blogOwners->toDropDownMap('ID', 'Name', 'None'))); + $fields->addFieldToTab('Root.Content.Main', new DropdownField('OwnerID', 'Blog owner', $blogOwners->map('ID', 'Name'))); $fields->addFieldToTab('Root.Content.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field')); $this->extend('updateCMSFields', $fields); @@ -49,15 +49,15 @@ class BlogHolder extends BlogTree implements PermissionProvider { function blogOwners($sort = 'Name', $direction = "ASC") { $adminMembers = Permission::get_members_by_permission('ADMIN'); $blogOwners = Permission::get_members_by_permission('BLOGMANAGEMENT'); - - if(!$adminMembers) $adminMembers = new DataObjectSet(); - if(!$blogOwners) $blogOwners = new DataObjectSet(); - + + if(!$adminMembers) $adminMembers = new ArrayList(); + if(!$blogOwners) $blogOwners = new ArrayList(); + $blogOwners->merge($adminMembers); $blogOwners->sort($sort, $direction); - + $this->extend('extendBlogOwners', $blogOwners); - + return $blogOwners; } @@ -204,7 +204,7 @@ class BlogHolder_Controller extends BlogTree_Controller { } $codeparser = new BBCodeParser(); - $membername = Member::currentMember() ? Member::currentMember()->getName() : ""; + $membername = Member::currentUser() ? Member::currentUser()->getName() : ""; if(BlogEntry::$allow_wysiwyg_editing) { $contentfield = new HtmlEditorField("BlogPost", _t("BlogEntry.CN")); @@ -226,7 +226,7 @@ class BlogHolder_Controller extends BlogTree_Controller { if(!$this->AllowCustomAuthors && !Permission::check('ADMIN')) { $field = 'ReadonlyField'; } - $fields = new FieldSet( + $fields = new FieldList( new HiddenField("ID", "ID"), new TextField("Title", _t('BlogHolder.SJ', "Subject")), new $field("Author", _t('BlogEntry.AU'), $membername), @@ -237,7 +237,7 @@ class BlogHolder_Controller extends BlogTree_Controller { ); $submitAction = new FormAction('postblog', _t('BlogHolder.POST', 'Post blog entry')); - $actions = new FieldSet($submitAction); + $actions = new FieldList($submitAction); $validator = new RequiredFields('Title','BlogPost'); $form = new Form($this, 'BlogEntryForm',$fields, $actions,$validator); @@ -246,7 +246,7 @@ class BlogHolder_Controller extends BlogTree_Controller { $entry = DataObject::get_by_id('BlogEntry', $id); if($entry->IsOwner()) { $form->loadDataFrom($entry); - $form->datafieldByName('BlogPost')->setValue($entry->Content); + $form->Fields()->dataFieldByName('BlogPost')->setValue($entry->Content); } } else { $form->loadDataFrom(array("Author" => Cookie::get("BlogHolder_Name"))); @@ -274,7 +274,7 @@ class BlogHolder_Controller extends BlogTree_Controller { $form->saveInto($blogentry); $blogentry->ParentID = $this->ID; - $blogentry->Content = str_replace("\r\n", "\n", $form->datafieldByName('BlogPost')->dataValue()); + $blogentry->Content = str_replace("\r\n", "\n", $form->Fields()->dataFieldByName('BlogPost')->dataValue()); if(Object::has_extension($this->ClassName, 'Translatable')) { $blogentry->Locale = $this->Locale; @@ -288,5 +288,3 @@ class BlogHolder_Controller extends BlogTree_Controller { } } - -?> diff --git a/code/BlogTree.php b/code/BlogTree.php index 758d828..9ba3dff 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -93,8 +93,8 @@ class BlogTree extends Page { /* ----------- CMS CONTROL -------------- */ - function getCMSFields() { - $fields = parent::getCMSFields(); + function getCMSFields($params = null) { + $fields = parent::getCMSFields($params); $fields->addFieldToTab("Root.Content.Main", new TextField("Name", "Name of blog")); $fields->addFieldToTab('Root.Content.Main', new DropdownField('LandingPageFreshness', 'When you first open the blog, how many entries should I show', array( "" => "All entries", @@ -344,4 +344,4 @@ class BlogTree_Controller extends Page_Controller { return date("Y", mktime(0, 0, 0, date('m'), 1, $date)); } } -} \ No newline at end of file +} diff --git a/code/TrackBackDecorator.php b/code/TrackBackDecorator.php index 5356fd9..57a71a5 100644 --- a/code/TrackBackDecorator.php +++ b/code/TrackBackDecorator.php @@ -2,11 +2,11 @@ /** * Add trackback (receive and send) feature blog entry */ -class TrackBackDecorator extends DataObjectDecorator { +class TrackBackDecorator extends DataExtension { static $trackback_server_class = 'TrackbackHTTPServer'; - function extraStatics() { + function extraStatics($class = null, $extension = null) { return array( 'has_many' => array( 'TrackBackURLs' => 'TrackBackURL', @@ -15,7 +15,7 @@ class TrackBackDecorator extends DataObjectDecorator { ); } - function updateCMSFields($fields) { + function updateCMSFields(FieldList $fields) { // Trackback URL field if($this->owner->TrackBacksEnabled()) { $trackbackURLTable = new ComplexTableField( diff --git a/code/widgets/ArchiveWidget.php b/code/widgets/ArchiveWidget.php index 77b2c7b..9dfb3f5 100644 --- a/code/widgets/ArchiveWidget.php +++ b/code/widgets/ArchiveWidget.php @@ -28,8 +28,8 @@ class ArchiveWidget extends Widget { static $description = 'Show a list of months or years in which there are blog posts, and provide links to them.'; - function getCMSFields() { - $fields = parent::getCMSFields(); + function getCMSFields($params = null) { + $fields = parent::getCMSFields($params); $fields->merge( new FieldSet( diff --git a/code/widgets/RSSWidget.php b/code/widgets/RSSWidget.php index 17f8bc9..4640bbf 100644 --- a/code/widgets/RSSWidget.php +++ b/code/widgets/RSSWidget.php @@ -39,8 +39,8 @@ class RSSWidget extends Widget { } } - function getCMSFields() { - $fields = parent::getCMSFields(); + function getCMSFields($params = null) { + $fields = parent::getCMSFields($params); $fields->merge( new FieldSet( diff --git a/code/widgets/TagCloudWidget.php b/code/widgets/TagCloudWidget.php index ed1bbe0..7d47a1c 100644 --- a/code/widgets/TagCloudWidget.php +++ b/code/widgets/TagCloudWidget.php @@ -26,9 +26,9 @@ class TagCloudWidget extends Widget { static $popularities = array( 'not-popular', 'not-very-popular', 'somewhat-popular', 'popular', 'very-popular', 'ultra-popular' ); - function getCMSFields() { - $fields = parent::getCMSFields(); - + function getCMSFields($params = null) { + $fields = parent::getCMSFields($params); + $fields->merge( new FieldSet( new TextField("Title", _t("TagCloudWidget.TILE", "Title")), diff --git a/tests/BlogTrackbackTest.php b/tests/BlogTrackbackTest.php index cf9550e..4a3e53c 100644 --- a/tests/BlogTrackbackTest.php +++ b/tests/BlogTrackbackTest.php @@ -60,7 +60,7 @@ class BlogTrackbackTest extends SapphireTest { $entry1 = $this->objFromFixture('BlogEntry', 'testpost'); $entry1->doPublish(); $this->assertEquals(2, $entry1->TrackBackURLs()->Count()); - $this->assertEquals(array('testGoodTrackbackURL' => 1), $entry1->TrackBackURLs()->map('URL', 'Pung')); + $this->assertEquals(array('testGoodTrackbackURL' => 1), $entry1->TrackBackURLs()->map('URL', 'Pung')->toArray()); $entry2 = $this->objFromFixture('BlogEntry', 'testpost2'); $entry2->doPublish(); @@ -123,4 +123,4 @@ class TestTrackbackHTTPServer extends TrackbackHTTPServer implements TestOnly { Some error text "; } -} \ No newline at end of file +} From 90a0e80667ceb37dde25a7c2c811b07e46ee33fd Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Sat, 14 Apr 2012 11:08:18 +1200 Subject: [PATCH 250/250] Revert "BUGFIX Initial fixes to support at least building the blog module on SS3" This reverts commit 8b58156211b0ede5e0dd72e577df4d2870b95373. --- code/BlogEntry.php | 11 ++++++----- code/BlogHolder.php | 30 ++++++++++++++++-------------- code/BlogTree.php | 6 +++--- code/TrackBackDecorator.php | 6 +++--- code/widgets/ArchiveWidget.php | 4 ++-- code/widgets/RSSWidget.php | 4 ++-- code/widgets/TagCloudWidget.php | 6 +++--- tests/BlogTrackbackTest.php | 4 ++-- 8 files changed, 37 insertions(+), 34 deletions(-) diff --git a/code/BlogEntry.php b/code/BlogEntry.php index f882b50..862b07c 100644 --- a/code/BlogEntry.php +++ b/code/BlogEntry.php @@ -49,7 +49,7 @@ class BlogEntry extends Page { $this->setField('Date', date('Y-m-d H:i:s', strtotime('now'))); } - function getCMSFields($params = null) { + function getCMSFields() { Requirements::javascript('blog/javascript/bbcodehelp.js'); Requirements::themedCSS('bbcodehelp'); @@ -57,7 +57,7 @@ class BlogEntry extends Page { $codeparser = new BBCodeParser(); SiteTree::disableCMSFieldsExtensions(); - $fields = parent::getCMSFields($params); + $fields = parent::getCMSFields(); SiteTree::enableCMSFieldsExtensions(); if(!self::$allow_wysiwyg_editing) { @@ -87,8 +87,8 @@ class BlogEntry extends Page { * Returns the tags added to this blog entry */ function TagsCollection() { - $tags = preg_split('/ *, */', trim($this->Tags)); - $output = new ArrayList(); + $tags = split(" *, *", trim($this->Tags)); + $output = new DataObjectSet(); $link = $this->getParent() ? $this->getParent()->Link('tag') : ''; @@ -270,6 +270,7 @@ class BlogEntry_Controller extends Page_Controller { */ function PageComments() { if($this->hasMethod('CommentsForm')) return $this->CommentsForm(); + else return parent::PageComments(); } - + } diff --git a/code/BlogHolder.php b/code/BlogHolder.php index d0053a3..b50d830 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -27,15 +27,15 @@ class BlogHolder extends BlogTree implements PermissionProvider { 'BlogEntry' ); - function getCMSFields($params = null) { + function getCMSFields() { $blogOwners = $this->blogOwners(); SiteTree::disableCMSFieldsExtensions(); - $fields = parent::getCMSFields($params); + $fields = parent::getCMSFields(); SiteTree::enableCMSFieldsExtensions(); $fields->addFieldToTab('Root.Content.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks')); - $fields->addFieldToTab('Root.Content.Main', new DropdownField('OwnerID', 'Blog owner', $blogOwners->map('ID', 'Name'))); + $fields->addFieldToTab('Root.Content.Main', new DropdownField('OwnerID', 'Blog owner', $blogOwners->toDropDownMap('ID', 'Name', 'None'))); $fields->addFieldToTab('Root.Content.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field')); $this->extend('updateCMSFields', $fields); @@ -49,15 +49,15 @@ class BlogHolder extends BlogTree implements PermissionProvider { function blogOwners($sort = 'Name', $direction = "ASC") { $adminMembers = Permission::get_members_by_permission('ADMIN'); $blogOwners = Permission::get_members_by_permission('BLOGMANAGEMENT'); - - if(!$adminMembers) $adminMembers = new ArrayList(); - if(!$blogOwners) $blogOwners = new ArrayList(); - + + if(!$adminMembers) $adminMembers = new DataObjectSet(); + if(!$blogOwners) $blogOwners = new DataObjectSet(); + $blogOwners->merge($adminMembers); $blogOwners->sort($sort, $direction); - + $this->extend('extendBlogOwners', $blogOwners); - + return $blogOwners; } @@ -204,7 +204,7 @@ class BlogHolder_Controller extends BlogTree_Controller { } $codeparser = new BBCodeParser(); - $membername = Member::currentUser() ? Member::currentUser()->getName() : ""; + $membername = Member::currentMember() ? Member::currentMember()->getName() : ""; if(BlogEntry::$allow_wysiwyg_editing) { $contentfield = new HtmlEditorField("BlogPost", _t("BlogEntry.CN")); @@ -226,7 +226,7 @@ class BlogHolder_Controller extends BlogTree_Controller { if(!$this->AllowCustomAuthors && !Permission::check('ADMIN')) { $field = 'ReadonlyField'; } - $fields = new FieldList( + $fields = new FieldSet( new HiddenField("ID", "ID"), new TextField("Title", _t('BlogHolder.SJ', "Subject")), new $field("Author", _t('BlogEntry.AU'), $membername), @@ -237,7 +237,7 @@ class BlogHolder_Controller extends BlogTree_Controller { ); $submitAction = new FormAction('postblog', _t('BlogHolder.POST', 'Post blog entry')); - $actions = new FieldList($submitAction); + $actions = new FieldSet($submitAction); $validator = new RequiredFields('Title','BlogPost'); $form = new Form($this, 'BlogEntryForm',$fields, $actions,$validator); @@ -246,7 +246,7 @@ class BlogHolder_Controller extends BlogTree_Controller { $entry = DataObject::get_by_id('BlogEntry', $id); if($entry->IsOwner()) { $form->loadDataFrom($entry); - $form->Fields()->dataFieldByName('BlogPost')->setValue($entry->Content); + $form->datafieldByName('BlogPost')->setValue($entry->Content); } } else { $form->loadDataFrom(array("Author" => Cookie::get("BlogHolder_Name"))); @@ -274,7 +274,7 @@ class BlogHolder_Controller extends BlogTree_Controller { $form->saveInto($blogentry); $blogentry->ParentID = $this->ID; - $blogentry->Content = str_replace("\r\n", "\n", $form->Fields()->dataFieldByName('BlogPost')->dataValue()); + $blogentry->Content = str_replace("\r\n", "\n", $form->datafieldByName('BlogPost')->dataValue()); if(Object::has_extension($this->ClassName, 'Translatable')) { $blogentry->Locale = $this->Locale; @@ -288,3 +288,5 @@ class BlogHolder_Controller extends BlogTree_Controller { } } + +?> diff --git a/code/BlogTree.php b/code/BlogTree.php index 9ba3dff..758d828 100644 --- a/code/BlogTree.php +++ b/code/BlogTree.php @@ -93,8 +93,8 @@ class BlogTree extends Page { /* ----------- CMS CONTROL -------------- */ - function getCMSFields($params = null) { - $fields = parent::getCMSFields($params); + function getCMSFields() { + $fields = parent::getCMSFields(); $fields->addFieldToTab("Root.Content.Main", new TextField("Name", "Name of blog")); $fields->addFieldToTab('Root.Content.Main', new DropdownField('LandingPageFreshness', 'When you first open the blog, how many entries should I show', array( "" => "All entries", @@ -344,4 +344,4 @@ class BlogTree_Controller extends Page_Controller { return date("Y", mktime(0, 0, 0, date('m'), 1, $date)); } } -} +} \ No newline at end of file diff --git a/code/TrackBackDecorator.php b/code/TrackBackDecorator.php index 57a71a5..5356fd9 100644 --- a/code/TrackBackDecorator.php +++ b/code/TrackBackDecorator.php @@ -2,11 +2,11 @@ /** * Add trackback (receive and send) feature blog entry */ -class TrackBackDecorator extends DataExtension { +class TrackBackDecorator extends DataObjectDecorator { static $trackback_server_class = 'TrackbackHTTPServer'; - function extraStatics($class = null, $extension = null) { + function extraStatics() { return array( 'has_many' => array( 'TrackBackURLs' => 'TrackBackURL', @@ -15,7 +15,7 @@ class TrackBackDecorator extends DataExtension { ); } - function updateCMSFields(FieldList $fields) { + function updateCMSFields($fields) { // Trackback URL field if($this->owner->TrackBacksEnabled()) { $trackbackURLTable = new ComplexTableField( diff --git a/code/widgets/ArchiveWidget.php b/code/widgets/ArchiveWidget.php index 9dfb3f5..77b2c7b 100644 --- a/code/widgets/ArchiveWidget.php +++ b/code/widgets/ArchiveWidget.php @@ -28,8 +28,8 @@ class ArchiveWidget extends Widget { static $description = 'Show a list of months or years in which there are blog posts, and provide links to them.'; - function getCMSFields($params = null) { - $fields = parent::getCMSFields($params); + function getCMSFields() { + $fields = parent::getCMSFields(); $fields->merge( new FieldSet( diff --git a/code/widgets/RSSWidget.php b/code/widgets/RSSWidget.php index 4640bbf..17f8bc9 100644 --- a/code/widgets/RSSWidget.php +++ b/code/widgets/RSSWidget.php @@ -39,8 +39,8 @@ class RSSWidget extends Widget { } } - function getCMSFields($params = null) { - $fields = parent::getCMSFields($params); + function getCMSFields() { + $fields = parent::getCMSFields(); $fields->merge( new FieldSet( diff --git a/code/widgets/TagCloudWidget.php b/code/widgets/TagCloudWidget.php index 7d47a1c..ed1bbe0 100644 --- a/code/widgets/TagCloudWidget.php +++ b/code/widgets/TagCloudWidget.php @@ -26,9 +26,9 @@ class TagCloudWidget extends Widget { static $popularities = array( 'not-popular', 'not-very-popular', 'somewhat-popular', 'popular', 'very-popular', 'ultra-popular' ); - function getCMSFields($params = null) { - $fields = parent::getCMSFields($params); - + function getCMSFields() { + $fields = parent::getCMSFields(); + $fields->merge( new FieldSet( new TextField("Title", _t("TagCloudWidget.TILE", "Title")), diff --git a/tests/BlogTrackbackTest.php b/tests/BlogTrackbackTest.php index 4a3e53c..cf9550e 100644 --- a/tests/BlogTrackbackTest.php +++ b/tests/BlogTrackbackTest.php @@ -60,7 +60,7 @@ class BlogTrackbackTest extends SapphireTest { $entry1 = $this->objFromFixture('BlogEntry', 'testpost'); $entry1->doPublish(); $this->assertEquals(2, $entry1->TrackBackURLs()->Count()); - $this->assertEquals(array('testGoodTrackbackURL' => 1), $entry1->TrackBackURLs()->map('URL', 'Pung')->toArray()); + $this->assertEquals(array('testGoodTrackbackURL' => 1), $entry1->TrackBackURLs()->map('URL', 'Pung')); $entry2 = $this->objFromFixture('BlogEntry', 'testpost2'); $entry2->doPublish(); @@ -123,4 +123,4 @@ class TestTrackbackHTTPServer extends TrackbackHTTPServer implements TestOnly { Some error text "; } -} +} \ No newline at end of file