aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--day.php18
-rw-r--r--functions/calendar_functions.php4
-rw-r--r--functions/init.inc.php8
-rw-r--r--functions/init/configs.php16
-rw-r--r--functions/template.php22
-rw-r--r--month.php16
-rw-r--r--preferences.php34
-rw-r--r--week.php26
-rw-r--r--year.php4
9 files changed, 71 insertions, 77 deletions
diff --git a/day.php b/day.php
index af03d4f..0e109d4 100644
--- a/day.php
+++ b/day.php
@@ -38,18 +38,18 @@ $list_icals_pick = display_ical_list(availableCalendars($username, $password, $p
// login/logout
$is_logged_in = ($username != '' && !$invalid_login) ? true : false;
-$show_user_login = (!$is_logged_in && $allow_login == 'yes');
+$show_user_login = (!$is_logged_in && $phpiCal_config->allow_login == 'yes');
$login_querys = login_querys();
$logout_querys = logout_querys();
$page = new Page(BASE.'templates/'.$phpiCal_config->template.'/day.tpl');
$page->replace_files(array(
- 'header' => BASE.'templates/'.$template.'/header.tpl',
+ 'header' => BASE.'templates/'.$phpiCal_config->template.'/header.tpl',
'event_js' => BASE.'functions/event.js',
- 'footer' => BASE.'templates/'.$template.'/footer.tpl',
- 'sidebar' => BASE.'templates/'.$template.'/sidebar.tpl',
- 'search_box' => BASE.'templates/'.$template.'/search_box.tpl'
+ 'footer' => BASE.'templates/'.$phpiCal_config->template.'/footer.tpl',
+ 'sidebar' => BASE.'templates/'.$phpiCal_config->template.'/sidebar.tpl',
+ 'search_box' => BASE.'templates/'.$phpiCal_config->template.'/search_box.tpl'
));
$page->replace_tags(array(
@@ -68,7 +68,7 @@ $page->replace_tags(array(
'rss_powered' => $rss_powered,
'rss_available' => '',
'rss_valid' => '',
- 'show_search' => $show_search,
+ 'show_search' => $phpiCal_config->show_search,
'next_day' => $next_day,
'prev_day' => $prev_day,
'show_goto' => '',
@@ -105,13 +105,13 @@ $page->replace_tags(array(
'l_this_site_is' => $lang['l_this_site_is']
));
-if ($allow_preferences != 'yes') {
+if ($phpiCal_config->allow_preferences != 'yes') {
$page->replace_tags(array(
'allow_preferences' => ''
));
}
-if ($allow_login == 'yes') {
+if ($phpiCal_config->allow_login == 'yes') {
$page->replace_tags(array(
'l_invalid_login' => $lang['l_invalid_login'],
'l_password' => $lang['l_password'],
@@ -121,7 +121,7 @@ if ($allow_login == 'yes') {
));
}
-if ($show_search != 'yes') {
+if ($phpiCal_config->show_search != 'yes') {
$page->nosearch($page);
}
diff --git a/functions/calendar_functions.php b/functions/calendar_functions.php
index f4e7a81..b814cb1 100644
--- a/functions/calendar_functions.php
+++ b/functions/calendar_functions.php
@@ -288,9 +288,9 @@ function display_ical_list($cals, $pick=FALSE) {
// option to open all (non-web) calenders together
if (!$pick) {
if ($cal == $phpiCal_config->ALL_CALENDARS_COMBINED) {
- $return .= "<option value=\"$current_view.php?cal=$ALL_CALENDARS_COMBINED&amp;getdate=$getdate\" selected=\"selected\">$all_cal_comb_lang</option>";
+ $return .= "<option value=\"$current_view.php?cal=$phpiCal_config->ALL_CALENDARS_COMBINED&amp;getdate=$getdate\" selected=\"selected\">$all_cal_comb_lang</option>";
} else {
- $return .= "<option value=\"$current_view.php?cal=$ALL_CALENDARS_COMBINED&amp;getdate=$getdate\">$all_cal_comb_lang</option>";
+ $return .= "<option value=\"$current_view.php?cal=$phpiCal_config->ALL_CALENDARS_COMBINED&amp;getdate=$getdate\">$all_cal_comb_lang</option>";
}
}
return $return;
diff --git a/functions/init.inc.php b/functions/init.inc.php
index fee5d72..0b9f77b 100644
--- a/functions/init.inc.php
+++ b/functions/init.inc.php
@@ -149,13 +149,13 @@ if (count($local_cals) > 0) {
$add_cpath = '';
if (isset($cpath) && $cpath !='') $add_cpath = "$cpath/";
- if (($download_uri == '') && (preg_match('/(^\/|\.\.\/)/', $filename) == 0)) {
+ if (($phpiCal_config->download_uri == '') && (preg_match('/(^\/|\.\.\/)/', $filename) == 0)) {
$subscribe_path = 'webcal://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']).'/'.$filename;
$download_filename = $filename;
- } elseif ($download_uri != '') {
- $newurl = eregi_replace("^(http://)", "", $download_uri);
+ } elseif ($phpiCal_config->download_uri != '') {
+ $newurl = eregi_replace("^(http://)", "", $phpiCal_config->download_uri);
$subscribe_path = 'webcal://'.$newurl.'/'.$add_cpath.basename($filename);
- $download_filename = $download_uri.'/'.$add_cpath.basename($filename);
+ $download_filename = $phpiCal_config->download_uri.'/'.$add_cpath.basename($filename);
} else {
$subscribe_path = $add_cpath;
$download_filename = $add_cpath;
diff --git a/functions/init/configs.php b/functions/init/configs.php
index 9cea67b..aa79610 100644
--- a/functions/init/configs.php
+++ b/functions/init/configs.php
@@ -2,16 +2,15 @@
// Pull in the configuration and some functions.
include_once(BASE.'default_config.php');
if (is_file(BASE.'config.inc.php')){
- include_once(BASE.'config.inc.php');
+ include(BASE.'config.inc.php');
foreach($configs as $key=>$value) $phpiCal_config->setProperty($key, $value);
}
-// Set the cookie URI.
if ($phpiCal_config->cookie_uri == '') {
- $phpiCal_config->setProperty('cookie_uri', $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/') ).'phpicalendar' );
+ $phpiCal_config->cookie_uri = $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/'));
}
-
-if (isset($_COOKIE[$phpiCal_config->cookie_uri]) && !isset($_POST['unset'])) {
- $phpicalendar = unserialize(stripslashes($_COOKIE[$cookie_name]));
+$cookie_name = 'phpicalendar_'.basename($phpiCal_config->default_path);
+if (isset($_COOKIE[$cookie_name]) && !isset($_POST['unset'])) {
+ $phpicalendar = unserialize(stripslashes($_COOKIE[$phpiCal_config->cookie_uri]));
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'])) $phpiCal_config->setProperty('default_cpath_check', $phpicalendar['cookie_cpath']);
@@ -20,7 +19,7 @@ if (isset($_COOKIE[$phpiCal_config->cookie_uri]) && !isset($_POST['unset'])) {
$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_time'])) $phpiCal_config->setProperty('day_start', $phpicalendar['cookie_time']); echo "cookie!";
}
# language support
@@ -51,8 +50,7 @@ while ($fillTime < $phpiCal_config->day_end) {
}
-/*
-echo "<pre>xx";
+/*echo "<pre>xx";
print_r($configs);
print_r($phpiCal_config);
echo "</pre>";
diff --git a/functions/template.php b/functions/template.php
index c47d2a6..c5a9c6f 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -246,13 +246,13 @@ class Page {
}#end draw_search
function draw_week($template_p) {
- global $phpiCal_config, $start_week_time, $getdate, $cal, $master_array, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $timeFormat_small, $week_length;
+ global $phpiCal_config, $start_week_time, $getdate, $cal, $master_array, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $timeFormat_small;
// Figure out colspans
$dayborder = 0;
$thisdate = $start_week_time;
$swt = $start_week_time;
- for ($i=0;$i<7;$i++) {
+ for ($i=0;$i < 7;$i++) {
$thisday = date("Ymd", $thisdate);
$nbrGridCols[$thisday] = 1;
if (isset($master_array[$thisday])) {
@@ -267,7 +267,7 @@ class Page {
$thisdate = ($thisdate + (25 * 60 * 60));
}
- for ($i=0; $i<$week_length; $i++) {
+ for ($i=0; $i < $phpiCal_config->week_length; $i++) {
$thisdate = date ('Ymd', $start_week_time);
$weekarray[$i] = $thisdate;
$start_week_time = strtotime('+1 day', $start_week_time);
@@ -304,11 +304,11 @@ class Page {
$loop_dof = trim($match1[1]);
$start_wt = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day));
$start_day = strtotime($phpiCal_config->week_start_day);
- for ($i=0; $i<$week_length; $i++) {
+ for ($i=0; $i<$phpiCal_config->week_length; $i++) {
$day_num = date("w", $start_day);
$daylink = date('Ymd', $start_wt);
if ($current_view == 'day') {
- $weekday = $phpiCal_config->daysofweek_lang[$day_num];
+ $weekday = $daysofweek_lang[$day_num];
} else {
$weekday = localizeDate($dateFormat_week_list, strtotime($daylink));
}
@@ -345,7 +345,7 @@ class Page {
$this_month = $day_array2[2];
$this_year = $day_array2[1];
$thisdate = $swt;
- for ($i=0;$i<7;$i++) {
+ for ($i=0; $i < 7; $i++) {
$thisday = date("Ymd", $thisdate);
$event_length[$thisday] = array ();
$thisdate = ($thisdate + (25 * 60 * 60));
@@ -364,7 +364,7 @@ class Page {
} elseif ($cal_time == $phpiCal_config->day_start) {
$size_tmp = 60 - (int)substr($cal_time,2,2);
$weekdisplay .= '<tr>';
- $weekdisplay .= '<td colspan="4" rowspan="' . ($size_tmp / $phpiCal_config->gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>';
+ $weekdisplay .= '<td colspan="4" rowspan="' . ($size_tmp / $phpiCal_config->gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>';
$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $phpiCal_config->gridLength . '"></td>';
} else {
$weekdisplay .= '<tr>';
@@ -375,7 +375,7 @@ class Page {
$thisdate = $swt;
// loop this part 7 times, one for each day
- for ($week_loop=0; $week_loop<$week_length; $week_loop++) {
+ for ($week_loop=0; $week_loop<$phpiCal_config->week_length; $week_loop++) {
$thisday = date("Ymd", $thisdate);
$dayborder = 0;
unset($this_time_arr);
@@ -768,7 +768,7 @@ class Page {
}
function get_vtodo() {
- global $phpiCal_config, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines, $show_completed, $show_todos;
+ global $phpiCal_config, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines;
preg_match("!<\!-- switch show_completed on -->(.*)<\!-- switch show_completed off -->!is", $this->page, $match1);
preg_match("!<\!-- switch show_important on -->(.*)<\!-- switch show_important off -->!is", $this->page, $match2);
@@ -821,7 +821,7 @@ class Page {
// Reset this TODO's category.
$temp = '';
if ($status == 'COMPLETED' || (isset($val['completed_date']) && isset($val['completed_time']))) {
- if ($show_completed == 'yes') {
+ if ($phpiCal_config->show_completed == 'yes') {
$temp = $completed;
}
} elseif (isset($val['priority']) && ($val['priority'] != 0) && ($val['priority'] <= 5)) {
@@ -842,7 +842,7 @@ class Page {
}
// If there are no TODO items, completely hide the TODO list.
- if (($nugget2 == '') || ($show_todos != 'yes')) {
+ if (($nugget2 == '') || ($phpiCal_config->show_todos != 'yes')) {
$this->page = preg_replace('!<\!-- switch vtodo on -->(.*)<\!-- switch vtodo off -->!is', '', $this->page);
}
diff --git a/month.php b/month.php
index 0a018aa..8498db8 100644
--- a/month.php
+++ b/month.php
@@ -46,14 +46,14 @@ $list_jumps = list_jumps();
$list_calcolors = list_calcolors();
$list_icals_pick = display_ical_list(availableCalendars($username, $password, $phpiCal_config->ALL_CALENDARS_COMBINED), TRUE);
-$page = new Page(BASE.'templates/'.$template.'/month.tpl');
+$page = new Page(BASE.'templates/'.$phpiCal_config->template.'/month.tpl');
$page->replace_files(array(
- 'header' => BASE.'templates/'.$template.'/header.tpl',
+ 'header' => BASE.'templates/'.$phpiCal_config->template.'/header.tpl',
'event_js' => BASE.'functions/event.js',
- 'footer' => BASE.'templates/'.$template.'/footer.tpl',
- 'calendar_nav' => BASE.'templates/'.$template.'/calendar_nav.tpl',
- 'search_box' => BASE.'templates/'.$template.'/search_box.tpl'
+ 'footer' => BASE.'templates/'.$phpiCal_config->template.'/footer.tpl',
+ 'calendar_nav' => BASE.'templates/'.$phpiCal_config->template.'/calendar_nav.tpl',
+ 'search_box' => BASE.'templates/'.$phpiCal_config->template.'/search_box.tpl'
));
$page->replace_tags(array(
@@ -105,13 +105,13 @@ $page->replace_tags(array(
'l_this_site_is' => $lang['l_this_site_is']
));
-if ($allow_preferences != 'yes') {
+if ($phpiCal_config->allow_preferences != 'yes') {
$page->replace_tags(array(
'allow_preferences' => ''
));
}
-if ($allow_login == 'yes') {
+if ($phpiCal_config->allow_login == 'yes') {
$page->replace_tags(array(
'l_invalid_login' => $lang['l_invalid_login'],
'l_password' => $lang['l_password'],
@@ -121,7 +121,7 @@ if ($allow_login == 'yes') {
));
}
-if ($show_search != 'yes') {
+if ($phpiCal_config->show_search != 'yes') {
$page->nosearch($page);
}
diff --git a/preferences.php b/preferences.php
index edd67e7..67c67a3 100644
--- a/preferences.php
+++ b/preferences.php
@@ -6,17 +6,13 @@ require_once(BASE.'functions/template.php');
header("Content-Type: text/html; charset=$charset");
$display_date = $preferences_lang;
-if ($allow_preferences != 'yes') {
+if ($phpiCal_config->allow_preferences != 'yes') {
exit(error('Preferences are not available for this installation.', $cal));
}
-if ($cookie_uri == '') {
- $cookie_uri = $_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'], '/'));
-}
-
$current_view = "preferences";
$back_page = BASE.$default_view.'.php?cal='.$cal.'&amp;getdate='.$getdate.'&amp;cpath='.$cpath;
-if ($allow_preferences == 'no') header("Location: $back_page");
+if ($phpiCal_config->allow_preferences == 'no') header("Location: $back_page");
if (isset($_GET['action'])) {
$action = $_GET['action'];
@@ -39,9 +35,9 @@ if ($action == 'setcookie') {
$the_cookie = array ("cookie_language" => "$cookie_language", "cookie_calendar" => "$cookie_calendar", "cookie_view" => "$cookie_view", "cookie_startday" => "$cookie_startday", "cookie_style" => "$cookie_style", "cookie_time" => "$cookie_time", "cookie_cpath"=>"$cookie_cpath");
$the_cookie = serialize($the_cookie);
if ($cookie_unset) {
- setcookie("$cookie_name","$the_cookie",time()-(60*60*24*7) ,"/","$cookie_uri",0);
+ setcookie("$cookie_name","$the_cookie",time()-(60*60*24*7) ,"/","$phpiCal_config->cookie_uri",0);
} else {
- setcookie("$cookie_name","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$cookie_uri",0);
+ setcookie("$cookie_name","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$phpiCal_config->cookie_uri",0); echo "setcookie";
if (isset($_POST['cookie_view']))
$default_view = $_POST['cookie_view'];
if (isset($_POST['cookie_style']) && is_dir(BASE.'templates/'.$_POST['cookie_style'].'/'))
@@ -70,11 +66,11 @@ if (isset($_COOKIE[$cookie_name])) {
if ((!isset($_COOKIE[$cookie_name])) || ($cookie_unset)) {
# No cookie set -> use defaults from config file.
$cookie_language = ucfirst($language);
- $cookie_calendar = $default_cal;
- $cookie_view = $default_view;
- $cookie_style = $template;
- $cookie_startday = $week_start_day;
- $cookie_time = $day_start;
+ $cookie_calendar = $phpiCal_config->default_cal;
+ $cookie_view = $phpiCal_config->default_view;
+ $cookie_style = $phpiCal_config->template;
+ $cookie_startday = $phpiCal_config->week_start_day;
+ $cookie_time = $phpiCal_config->day_start;
}
if ($action == 'setcookie') {
@@ -146,17 +142,17 @@ closedir($dir_handle);
$php_ended = getmicrotime();
$generated = number_format(($php_ended-$php_started),3);
-$page = new Page(BASE.'templates/'.$template.'/preferences.tpl');
+$page = new Page(BASE.'templates/'.$phpiCal_config->template.'/preferences.tpl');
$page->replace_files(array(
- 'header' => BASE.'templates/'.$template.'/header.tpl',
- 'footer' => BASE.'templates/'.$template.'/footer.tpl'
+ 'header' => BASE.'templates/'.$phpiCal_config->template.'/header.tpl',
+ 'footer' => BASE.'templates/'.$phpiCal_config->template.'/footer.tpl'
));
$page->replace_tags(array(
- 'version' => $phpicalendar_version,
- 'charset' => $charset,
- 'template' => $template,
+ 'version' => $phpiCal_config->phpicalendar_version,
+ 'charset' => $phpiCal_config->charset,
+ 'template' => $phpiCal_config->template,
'default_path' => '',
'cpath' => $cpath,
'cal' => $cal,
diff --git a/week.php b/week.php
index e1250c2..8767b21 100644
--- a/week.php
+++ b/week.php
@@ -15,8 +15,8 @@ $next_week = date("Ymd", strtotime("+1 week", $unix_time));
$prev_week = date("Ymd", strtotime("-1 week", $unix_time));
$next_day = date('Ymd', strtotime("+1 day", $unix_time));
$prev_day = date('Ymd', strtotime("-1 day", $unix_time));
-$start_week_time = strtotime(dateOfWeek($getdate, $week_start_day));
-$end_week_time = $start_week_time + (($week_length - 1) * 25 * 60 * 60);
+$start_week_time = strtotime(dateOfWeek($getdate, $phpiCal_config->week_start_day));
+$end_week_time = $start_week_time + (($phpiCal_config->week_length - 1) * 25 * 60 * 60);
$start_week = localizeDate($dateFormat_week, $start_week_time);
$end_week = localizeDate($dateFormat_week, $end_week_time);
$display_date = "$start_week - $end_week";
@@ -39,18 +39,18 @@ $list_icals_pick = display_ical_list(availableCalendars($username, $password, $p
// login/logout
$is_logged_in = ($username != '' && !$invalid_login) ? true : false;
-$show_user_login = (!$is_logged_in && $allow_login == 'yes');
+$show_user_login = (!$is_logged_in && $phpiCal_config->allow_login == 'yes');
$login_querys = login_querys();
$logout_querys = logout_querys();
-$page = new Page(BASE.'templates/'.$template.'/week.tpl');
+$page = new Page(BASE.'templates/'.$phpiCal_config->template.'/week.tpl');
$page->replace_files(array(
- 'header' => BASE.'templates/'.$template.'/header.tpl',
+ 'header' => BASE.'templates/'.$phpiCal_config->template.'/header.tpl',
'event_js' => BASE.'functions/event.js',
- 'footer' => BASE.'templates/'.$template.'/footer.tpl',
- 'sidebar' => BASE.'templates/'.$template.'/sidebar.tpl',
- 'search_box' => BASE.'templates/'.$template.'/search_box.tpl'
+ 'footer' => BASE.'templates/'.$phpiCal_config->template.'/footer.tpl',
+ 'sidebar' => BASE.'templates/'.$phpiCal_config->template.'/sidebar.tpl',
+ 'search_box' => BASE.'templates/'.$phpiCal_config->template.'/search_box.tpl'
));
$page->replace_tags(array(
@@ -61,7 +61,7 @@ $page->replace_tags(array(
'cal' => $cal,
'getdate' => $getdate,
'getcpath' => "&cpath=$cpath",
- 'cpath' => $cpath,
+ 'cpath' => $cpath,
'calendar_name' => $cal_displayname,
'display_date' => $display_date,
'current_view' => $current_view,
@@ -69,7 +69,7 @@ $page->replace_tags(array(
'rss_powered' => $phpiCal_config->rss_powered,
'rss_available' => '',
'rss_valid' => '',
- 'show_search' => $show_search,
+ 'show_search' => $show_search,
'next_day' => $next_day,
'next_week' => $next_week,
'prev_day' => $prev_day,
@@ -108,13 +108,13 @@ $page->replace_tags(array(
'l_this_site_is' => $lang['l_this_site_is']
));
-if ($allow_preferences != 'yes') {
+if ($phpiCal_config->allow_preferences != 'yes') {
$page->replace_tags(array(
'allow_preferences' => ''
));
}
-if ($allow_login == 'yes') {
+if ($phpiCal_config->allow_login == 'yes') {
$page->replace_tags(array(
'l_invalid_login' => $lang['l_invalid_login'],
'l_password' => $lang['l_password'],
@@ -124,7 +124,7 @@ if ($allow_login == 'yes') {
));
}
-if ($show_search != 'yes') {
+if ($phpiCal_config->show_search != 'yes') {
$page->nosearch($page);
}
diff --git a/year.php b/year.php
index 22a47ba..f795efe 100644
--- a/year.php
+++ b/year.php
@@ -112,13 +112,13 @@ $page->replace_tags(array(
));
-if ($allow_preferences != 'yes') {
+if ($phpiCal_config->allow_preferences != 'yes') {
$page->replace_tags(array(
'allow_preferences' => ''
));
}
-if ($allow_login == 'yes') {
+if ($phpiCal_config->allow_login == 'yes') {
$page->replace_tags(array(
'l_invalid_login' => $lang['l_invalid_login'],
'l_password' => $lang['l_password'],

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