Revert "Remove calendar based entry overview"
This reverts commit 405847cac666247a34fb3f6df8d82c3ee8d690f4.
This commit is contained in:
parent
507dc05998
commit
4f2ea4de8a
@ -260,6 +260,16 @@ function serveCategory($matches) {
|
||||
include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
|
||||
}
|
||||
|
||||
function serveArchive() {
|
||||
global $serendipity;
|
||||
$serendipity['view'] = 'archive';
|
||||
$serendipity['GET']['action'] = 'archives';
|
||||
|
||||
locateHiddenVariables($serendipity['uriArguments']);
|
||||
|
||||
include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
|
||||
}
|
||||
|
||||
function gotoAdmin() {
|
||||
global $serendipity;
|
||||
$base = $serendipity['baseURL'];
|
||||
@ -373,6 +383,115 @@ function serveArchives() {
|
||||
|
||||
$_args = locateHiddenVariables($serendipity['uriArguments']);
|
||||
|
||||
/* We must always *assume* that Year, Month and Day are the first 3 arguments */
|
||||
list(,$year, $month, $day) = $_args;
|
||||
if ($year == "archives") {
|
||||
unset($year);
|
||||
}
|
||||
|
||||
$serendipity['GET']['action'] = 'read';
|
||||
$serendipity['GET']['hidefooter'] = true;
|
||||
|
||||
if (!isset($year)) {
|
||||
$year = date('Y');
|
||||
$month = date('m');
|
||||
$day = date('j');
|
||||
$serendipity['GET']['action'] = null;
|
||||
$serendipity['GET']['hidefooter'] = null;
|
||||
}
|
||||
|
||||
if (isset($year) && !is_numeric($year)) {
|
||||
$year = date('Y');
|
||||
}
|
||||
|
||||
if (isset($month) && !is_numeric($month)) {
|
||||
$month = date('m');
|
||||
}
|
||||
|
||||
if (isset($day) && !is_numeric($day)) {
|
||||
$day = date('d');
|
||||
}
|
||||
|
||||
switch($serendipity['calendar']) {
|
||||
case 'gregorian':
|
||||
default:
|
||||
$gday = 1;
|
||||
|
||||
if ($week) {
|
||||
$tm = strtotime('+ '. ($week-2) .' WEEKS monday', mktime(0, 0, 0, 1, 1, $year));
|
||||
$ts = mktime(0, 0, 0, date('m', $tm), date('j', $tm), $year);
|
||||
$te = mktime(23, 59, 59, date('m', $tm), date('j', $tm)+7, $year);
|
||||
$date = serendipity_formatTime(WEEK .' '. $week .', %Y', $ts, false);
|
||||
} else {
|
||||
if ($day) {
|
||||
$ts = mktime(0, 0, 0, $month, $day, $year);
|
||||
$te = mktime(23, 59, 59, $month, $day, $year);
|
||||
$date = serendipity_formatTime(DATE_FORMAT_ENTRY, $ts, false);
|
||||
} else {
|
||||
$ts = mktime(0, 0, 0, $month, $gday, $year);
|
||||
if (!isset($gday2)) {
|
||||
$gday2 = date('t', $ts);
|
||||
}
|
||||
$te = mktime(23, 59, 59, $month, $gday2, $year);
|
||||
$date = serendipity_formatTime('%B %Y', $ts, false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'persian-utf8':
|
||||
require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
|
||||
$gday = 1;
|
||||
if ($week) {
|
||||
--$week;
|
||||
$week *= 7;
|
||||
++$week;
|
||||
$day = $week;
|
||||
|
||||
// convert day number of year to day number of month AND month number of year
|
||||
$j_days_in_month = array(0, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
|
||||
if(($g_y % 4) == 3) $j_days_in_month[12]++;
|
||||
|
||||
for($i=1; isset($j_days_in_month[$i]); ++$i){
|
||||
if(($day-$j_days_in_month[$i])>0){
|
||||
$day -= $j_days_in_month[$i];
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$tm = persian_mktime(0, 0, 0, $i, $day, $year);
|
||||
$ts = persian_mktime(0, 0, 0, persian_date_utf('m', $tm), persian_date_utf('j', $tm), $year);
|
||||
$te = persian_mktime(23, 59, 59, persian_date_utf('m', $tm), persian_date_utf('j', $tm)+7, $year);
|
||||
$date = serendipity_formatTime(WEEK .' '. $week .'، %Y', $ts, false);
|
||||
} else {
|
||||
if ($day) {
|
||||
$ts = persian_mktime(0, 0, 0, $month, $day, $year);
|
||||
$te = persian_mktime(23, 59, 59, $month, $day, $year);
|
||||
$date = serendipity_formatTime(DATE_FORMAT_ENTRY, $ts, false);
|
||||
} else {
|
||||
$ts = persian_mktime(0, 0, 0, $month, $gday, $year);
|
||||
if (!isset($gday2)) {
|
||||
$gday2 = persian_date_utf('t', $ts);
|
||||
}
|
||||
$te = persian_mktime(23, 59, 59, $month, $gday2, $year);
|
||||
$date = serendipity_formatTime('%B %Y', $ts, false);
|
||||
}
|
||||
}
|
||||
|
||||
list($year, $month, $day) = p2g ($year, $month, $day);
|
||||
break;
|
||||
}
|
||||
|
||||
$serendipity['range'] = array($ts, $te);
|
||||
|
||||
if ($serendipity['GET']['action'] == 'read') {
|
||||
if ($serendipity['GET']['category']) {
|
||||
$cInfo = serendipity_fetchCategoryInfo($serendipity['GET']['category']);
|
||||
$serendipity['head_title'] = $cInfo['category_name'];
|
||||
}
|
||||
$serendipity['head_subtitle'] .= sprintf(ENTRIES_FOR, $date);
|
||||
}
|
||||
|
||||
include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
|
||||
|
||||
}
|
||||
|
@ -82,6 +82,8 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
|
||||
} else if (preg_match(PAT_ADMIN, $uri)) {
|
||||
gotoAdmin();
|
||||
exit;
|
||||
} else if (preg_match(PAT_ARCHIVE, $uri)) {
|
||||
serveArchive();
|
||||
} else if ((isset($serendipity['POST']['isMultiCat']) && is_array($serendipity['POST']['multiCat'])) ||
|
||||
preg_match(PAT_PERMALINK_CATEGORIES, $uri, $matches)) {
|
||||
serveCategory($matches);
|
||||
|
Loading…
x
Reference in New Issue
Block a user