aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2004-05-24 01:39:42 +0000
committerChad Little <clittle@users.sourceforge.net>2004-05-24 01:39:42 +0000
commitc6b16ef0bf6e62ede566ffe457281f38c2cda232 (patch)
tree6d9bafe72fb925da7ef895999a18862b7bbc0c2e
parente08fe020bc4643c7ea3b50b89e9c1717ec0a13aa (diff)
downloadphpicalendar-c6b16ef0bf6e62ede566ffe457281f38c2cda232.tar.gz
phpicalendar-c6b16ef0bf6e62ede566ffe457281f38c2cda232.tar.bz2
phpicalendar-c6b16ef0bf6e62ede566ffe457281f38c2cda232.zip
Start of admin wiring. Removed unneeded things from print.
-rw-r--r--admin.php14
-rw-r--r--functions/template.php40
-rw-r--r--print.php16
-rw-r--r--templates/default/admin.tpl8
4 files changed, 52 insertions, 26 deletions
diff --git a/admin.php b/admin.php
index 4d26c2f..46f025a 100644
--- a/admin.php
+++ b/admin.php
@@ -1,6 +1,4 @@
<?php
-session_start();
-
define('BASE', './');
require_once(BASE.'functions/admin_functions.php');
require_once(BASE.'functions/ical_parser.php');
@@ -20,18 +18,16 @@ if (!isset($action)) $action = '';
// Logout by clearing session variables
if ((isset($action)) && ($action == "logout")) {
- $HTTP_SESSION_VARS['phpical_loggedin'] = FALSE;
- unset($HTTP_SESSION_VARS['phpical_username']);
- unset($HTTP_SESSION_VARS['phpical_password']);
+ $_SESSION['phpical_loggedin'] = FALSE;
+ unset($_SESSION['phpical_username']);
+ unset($_SESSION['phpical_password']);
}
// if $auth_method == 'none', don't do any authentication
if ($auth_method == "none") {
$is_loged_in = TRUE;
-}
-// Check if The User is Identified
-else {
+} else {
$is_loged_in = FALSE;
if (is_loggedin()) {
@@ -77,6 +73,7 @@ $page->replace_tags(array(
'l_delete_cal' => $lang['l_delete_cal'],
'l_delete' => $lang['l_delete'],
'l_logout' => $lang['l_logout'],
+ 'l_login' => $lang['l_login'],
'l_submit' => $lang['l_submit'],
'l_addupdate_cal' => $lang['l_addupdate_cal'],
'l_addupdate_desc' => $lang['l_addupdate_desc'],
@@ -84,6 +81,7 @@ $page->replace_tags(array(
'l_this_site_is' => $lang['l_this_site_is']
));
+$page->draw_admin();
$page->output();
?>
diff --git a/functions/template.php b/functions/template.php
index 81615d5..78ad822 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -14,6 +14,46 @@ class Page {
}
}
+ function draw_admin() {
+ global $template, $getdate, $cal, $master_array, $is_loged_in;
+
+ if ($is_loged_in == TRUE) {
+ // Print Calendar Checkboxes
+ $COLUMNS_TO_PRINT = 3;
+ $column = 1;
+ $filelist = availableCalendarNames('', '', '', true);
+ foreach ($filelist as $file) {
+ if ($column > $COLUMNS_TO_PRINT) {
+ $delete_table .= '</tr>';
+ $column = 1;
+ }
+ if ($column == 1) {
+ $delete_table .= '<tr>';
+ }
+
+ $cal_filename_tmp = substr($file,0,-4);
+ $cal_tmp = urlencode($file);
+ $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp);
+
+ $delete_table .= '<td align="left"><input name="delete_calendar[]" value="'.$cal_tmp.'" type="checkbox" />'.$cal_displayname_tmp.'</td>';
+
+ $column++;
+ }
+ // Print remaining empty columns if necessary
+ $number_of_columns = count($filelist);
+ while (gettype($number_of_columns/$COLUMNS_TO_PRINT) != "integer") {
+ $delete_table .= '<td>&nbsp;</td>';
+ $number_of_columns++;
+ }
+
+ $this->page = str_replace('{DELETE_TABLE}', $delete_table, $this->page);
+ } else {
+ $this->page = preg_replace('!<\!-- switch logged_in on -->(.*)<\!-- switch logged_in off -->!is', '', $this->page);
+ $this->page = preg_replace('!<\!-- switch logged_in2 on -->(.*)<\!-- switch logged_in2 off -->!is', '', $this->page);
+ }
+
+ }
+
function draw_print($template_p) {
global $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $printview, $dateFormat_day, $timeFormat, $week_start, $week_end, $lang;
preg_match("!<\!-- loop events on -->(.*)<\!-- loop events off -->!is", $this->page, $match1);
diff --git a/print.php b/print.php
index e899222..5143e0f 100644
--- a/print.php
+++ b/print.php
@@ -4,11 +4,6 @@ define('BASE', './');
require_once(BASE.'functions/ical_parser.php');
require_once(BASE.'functions/list_functions.php');
require_once(BASE.'functions/template.php');
-$cal_displayname2 = $calendar_name . " $calendar_lang";
-if (strlen($cal_displayname2) > 24) {
- $cal_displayname2 = substr("$cal_displayname2", 0, 21);
- $cal_displayname2 = $cal_displayname2 . "...";
-}
$start_week_time = strtotime(dateOfWeek($getdate, $week_start_day));
$end_week_time = $start_week_time + (6 * 25 * 60 * 60);
@@ -16,15 +11,12 @@ $parse_month = date ("Ym", strtotime($getdate));
$printview = $HTTP_GET_VARS['printview'];
$cal_displayname = str_replace("32", " ", $cal);
$events_week = 0;
-$unix_time = strtotime("$getdate");
+$unix_time = strtotime($getdate);
if ($printview == 'day') {
$display_date = localizeDate ($dateFormat_day, strtotime($getdate));
$next = date("Ymd", strtotime("+1 day", $unix_time));
$prev = date("Ymd", strtotime("-1 day", $unix_time));
- $zero_events = $no_events_day_lang;
- $print_next_nav = $next_day_lang;
- $print_prev_nav = $last_day_lang;
$week_start = '';
$week_end = '';
} elseif ($printview == 'week') {
@@ -35,16 +27,10 @@ if ($printview == 'day') {
$week_end = date("Ymd", $end_week_time);
$next = date("Ymd", strtotime("+1 week", $unix_time));
$prev = date("Ymd", strtotime("-1 week", $unix_time));
- $zero_events = $no_events_week_lang;
- $print_next_nav = $next_week_lang;
- $print_prev_nav = $last_week_lang;
} elseif ($printview == 'month') {
$display_date = localizeDate ($dateFormat_month, strtotime($getdate));
$next = date("Ymd", strtotime("+1 month", $unix_time));
$prev = date("Ymd", strtotime("-1 month", $unix_time));
- $zero_events = $no_events_month_lang;
- $print_next_nav = $next_month_lang;
- $print_prev_nav = $last_month_lang;
$week_start = '';
$week_end = '';
}
diff --git a/templates/default/admin.tpl b/templates/default/admin.tpl
index 0cf19fa..ae79330 100644
--- a/templates/default/admin.tpl
+++ b/templates/default/admin.tpl
@@ -27,9 +27,9 @@
</tr>
<tr>
<td align="right">
- <!-- switch logged_in on -->
+ <!-- switch logged_in2 on -->
<a href="admin.php?action=logout\">{L_LOGOUT}</a>&nbsp;
- <!-- switch logged_in off -->
+ <!-- switch logged_in2 off -->
</td>
</tr>
<tr>
@@ -108,7 +108,9 @@
<b>{L_DELETE_CAL}</b>
<form action="admin.php" method="post">
- {DELETE_TABLE}
+ <table width="100%" border="0" cellspacing="0" cellpadding="2" class="G10B">
+ {DELETE_TABLE}
+ </table>
<input type="hidden" name="action" value="delete">
<p><input type="submit" value="{L_DELETE}"></p>
<p>{DELETE_MSG} &nbsp;</p>

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