aboutsummaryrefslogtreecommitdiffstats
path: root/functions/init/date_range.php
blob: 62573048f42155a10e1c09cf1a9f74bcf1472d35 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
if (!isset($getdate)) {
	if (isset($_GET['getdate']) && ($_GET['getdate'] !== '')) {
		$getdate = $_GET['getdate'];
	} else {
		$getdate = date('Ymd', time() + $phpiCal_config->second_offset);
	}
}

preg_match ("/([0-9]{4})([0-9]{2})([0-9]{2})/", $getdate, $day_array2);
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];

# set bounds on master_array
# mktime int mktime ( [int $hour [, int $minute [, int $second [, int $month [, int $day [, int $year [, int $is_dst]]]]]]] )
$start_month = $this_month - 1;
$start_year = $this_year;
$end_month = $this_month + 1;
$end_year = $this_year;
if ($this_month == 1){
	$start_month = 12;
	$start_year--;
}	
if ($this_month == 12){
	$end_month = 1;
	$end_year++;
}

$current_view_time = $current_view;
if($current_view_time == 'print'){
	$current_view_time = 'year';
}

switch ($current_view_time){
	case 'month':
	case 'week':
	case 'day':
	case 'print':
		$mArray_begin = mktime (0,0,0,$start_month,1,($start_year));
		$mArray_end = mktime (0,0,0,$end_month,31,($end_year));
		break;
	case 'admin':
	case 'error':
	case 'preferences':
	case 'rss_index':
		$mArray_begin = time();
		$mArray_end = time();
		break;		
	case 'search':
		$mArray_begin = mktime (0,0,0,1,1,1970);
		$mArray_end = mktime (0,0,0,1,31,2030);
		break;		
	default:
		$mArray_begin = mktime (0,0,0,12,21,($this_year - 1));
		$mArray_end = mktime (0,0,0,1,31,($this_year + 1));
}
if ($phpiCal_config->save_parsed_cals == 'yes') {	
	$mArray_begin = mktime (0,0,0,12,21,($this_year - 1));
	$mArray_end = mktime (0,0,0,1,31,($this_year + 1));
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy