mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 09:05:58 +00:00
Use "date" for archives, using numbers directly causes too many problems
This commit is contained in:
parent
e52171bf75
commit
a7f024bc45
@ -135,6 +135,7 @@ class BlogHolder_Controller extends BlogTree_Controller {
|
|||||||
static $allowed_actions = array(
|
static $allowed_actions = array(
|
||||||
'index',
|
'index',
|
||||||
'tag',
|
'tag',
|
||||||
|
'date',
|
||||||
'metaweblog',
|
'metaweblog',
|
||||||
'postblog' => 'BLOGMANAGEMENT',
|
'postblog' => 'BLOGMANAGEMENT',
|
||||||
'post' => 'BLOGMANAGEMENT',
|
'post' => 'BLOGMANAGEMENT',
|
||||||
@ -146,17 +147,6 @@ class BlogHolder_Controller extends BlogTree_Controller {
|
|||||||
Requirements::themedCSS("bbcodehelp");
|
Requirements::themedCSS("bbcodehelp");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::checkAccessAction($action);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of usable tags for help
|
* Return list of usable tags for help
|
||||||
*/
|
*/
|
||||||
|
@ -196,8 +196,9 @@ class BlogTree_URL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function date() {
|
static function date() {
|
||||||
$year = Director::urlParam('Action');
|
if(Director::urlParam('Action') == 'date') {
|
||||||
$month = Director::urlParam('ID');
|
$year = Director::urlParam('ID');
|
||||||
|
$month = Director::urlParam('OtherID');
|
||||||
|
|
||||||
if($month && is_numeric($month) && $month >= 1 && $month <= 12 && is_numeric($year)) {
|
if($month && is_numeric($month) && $month >= 1 && $month <= 12 && is_numeric($year)) {
|
||||||
return "$year-$month";
|
return "$year-$month";
|
||||||
@ -208,6 +209,7 @@ class BlogTree_URL {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class BlogTree_Controller extends Page_Controller {
|
class BlogTree_Controller extends Page_Controller {
|
||||||
static $allowed_actions = array(
|
static $allowed_actions = array(
|
||||||
|
@ -81,9 +81,9 @@ class ArchiveWidget extends Widget {
|
|||||||
));
|
));
|
||||||
|
|
||||||
if($isMonthDisplay) {
|
if($isMonthDisplay) {
|
||||||
$link = $container->Link($sqlResult['Year']) . '/' . sprintf("%'02d", $monthVal);
|
$link = $container->Link('date') . '/' . $sqlResult['Year'] . '/' . sprintf("%'02d", $monthVal);
|
||||||
} else {
|
} else {
|
||||||
$link = $container->Link($sqlResult['Year']);
|
$link = $container->Link('date') . '/' . $sqlResult['Year'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$results->push(new ArrayData(array(
|
$results->push(new ArrayData(array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user