aboutsummaryrefslogtreecommitdiffstats
path: root/functions/init/configs.php
blob: f94c47b472f4260637b32fa8cd6534b6c8d025c1 (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
62
63
<?php
// Pull in the configuration and some functions.
include_once(BASE.'default_config.php');
if (is_file(BASE.'config.inc.php')){
	include(BASE.'config.inc.php');
	foreach($configs as $key=>$value) $phpiCal_config->setProperty($key, $value);
}
if ($phpiCal_config->cookie_uri == '') {
	$phpiCal_config->setProperty('cookie_uri', $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/')) );
	if ($phpiCal_config->cookie_uri == 'localhost')	$phpiCal_config->setProperty('cookie_uri', '');
;
}
$cookie_name = 'phpicalendar_'.basename($phpiCal_config->default_path);
if (isset($_COOKIE[$cookie_name]) && !isset($_POST['unset'])) {
	$phpicalendar = unserialize(stripslashes($_COOKIE[$cookie_name]));
	if (isset($phpicalendar['cookie_language'])) 	$phpiCal_config->setProperty('language', 			$phpicalendar['cookie_language']);
	if (isset($phpicalendar['cookie_calendar'])) 	$phpiCal_config->setProperty('default_cal_check', 	$phpicalendar['cookie_calendar']);
	if (isset($phpicalendar['cookie_cpath']) && strpos($phpicalendar['cookie_cpath'],'../') === false) 		$phpiCal_config->setProperty('default_cpath_check', $phpicalendar['cookie_cpath']);
	if (isset($phpicalendar['cookie_view'])) 		$phpiCal_config->setProperty('default_view', 		$phpicalendar['cookie_view']);
	if (isset($phpicalendar['cookie_style']) && is_dir(BASE.'templates/'.$phpicalendar['cookie_style'].'/')){ 
													$phpiCal_config->setProperty('template', 			$phpicalendar['cookie_style']);
	}	
	if (isset($phpicalendar['cookie_startday'])) 	$phpiCal_config->setProperty('week_start_day', 		$phpicalendar['cookie_startday']);
	if (isset($phpicalendar['cookie_time']))		$phpiCal_config->setProperty('day_start', 			$phpicalendar['cookie_time']); 
	if (isset($phpicalendar['cookie_endtime']))		$phpiCal_config->setProperty('day_end', 			$phpicalendar['cookie_endtime']); 
}

# language support
# default to english and overwrite other strings as available
unset($lang); 
include_once(BASE.'languages/english.inc.php');
$language = strtolower($phpiCal_config->language);
$lang_file = BASE.'languages/'.$language.'.inc.php';
if (is_file($lang_file)) {
	include_once($lang_file);
}

$template = $phpiCal_config->template;

$fillTime = $phpiCal_config->day_start;
$day_array = array ();
while ($fillTime < $phpiCal_config->day_end) {
	array_push ($day_array, $fillTime);
	preg_match ('/([0-9]{2})([0-9]{2})/', $fillTime, $dTime);
	$fill_h = $dTime[1];
	$fill_min = $dTime[2];
	$fill_min = sprintf('%02d', $fill_min + $phpiCal_config->gridLength);
	if ($fill_min >= 60) {
		$fill_h = sprintf('%02d', ($fill_h + 1));
		$fill_min = '00';
	}
	$fillTime = $fill_h . $fill_min;
}

if (!isset($current_view)) $current_view = $phpiCal_config->default_view;

$tz_array=array();
/*echo "<pre>xx";
print_r($configs);
print_r($phpiCal_config);
echo "</pre>";
#die;
*/

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