From 9e07f4f2019973e0a42d6b1e21534572efee8013 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 13 May 2003 04:14:22 +0000 Subject: part two of admin.php --- admin.php | 217 ++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 112 insertions(+), 105 deletions(-) (limited to 'admin.php') diff --git a/admin.php b/admin.php index aadf7c0..159e8bf 100644 --- a/admin.php +++ b/admin.php @@ -1,10 +1,9 @@ $invalid_login_lang"; - $is_loged_in = FALSE; - } + if (is_loggedin()) { + $is_loged_in = TRUE; } - - if ($is_loged_in == FALSE) { - setcookie("username",""); - setcookie("password",""); - setcookie("md5_password",""); + if (isset($username) && $action != "logout") { + $is_loged_in = login ($username, $password); } } @@ -68,17 +48,6 @@ else { <?php echo "$admin_header_lang"; ?> "> - - -
@@ -93,7 +62,7 @@ else {   - {$logout_lang}"; } ?>  + {$logout_lang}"; } ?>   @@ -108,12 +77,15 @@ else { // If User is Not Logged In, Display The Login Page if ($is_loged_in == FALSE) { + if (isset($username)) + $login_error = "$invalid_login_lang"; + echo << - + @@ -156,32 +128,44 @@ EOT; // Add or Update a calendar if ($action == "addupdate") { - $addupdate_success = FALSE; - if (!is_uploaded_file_v4($HTTP_POST_FILES['calfile']['tmp_name'])) { - $upload_error = get_upload_error($HTTP_POST_FILES['calfile']); - } - elseif (!is_uploaded_ics($HTTP_POST_FILES['calfile']['name'])) { - $upload_error = $upload_error_type_lang; - } - // copy() should be replaced with move_uploaded_file(), but only if we can require PHP 4 >= 4.0.3 - elseif (!copy($HTTP_POST_FILES['calfile']['tmp_name'], $calendar_path . "/" . $HTTP_POST_FILES['calfile']['name'])) { - $upload_error = $copy_error_lang . " " . $HTTP_POST_FILES['calfile']['tmp_name'] . " - " . $calendar_path . "/" . $HTTP_POST_FILES['calfile']['name']; - } - else { - $addupdate_success = TRUE; + $addupdate_msg = ""; + + for($filenumber=1; $filenumber<6; $filenumber++) { + $file = $HTTP_POST_FILES['calfile']; + $addupdate_success = FALSE; + + if (!is_uploaded_file_v4($file['tmp_name'][$filenumber])) { + $upload_error = get_upload_error($file['error'][$filenumber]); + } + elseif (!is_uploaded_ics($file['name'][$filenumber])) { + $upload_error = $upload_error_type_lang; + } + elseif (!copy_cal($file['tmp_name'][$filenumber], $file['name'][$filenumber])) { + $upload_error = $copy_error_lang . " " . $file['tmp_name'][$filenumber] . " - " . $calendar_path . "/" . $file['name'][$filenumber]; + } + else { + $addupdate_success = TRUE; + } + + if ($addupdate_success) + $addupdate_msg = $addupdate_msg . "{$cal_file_lang} {$filenumber}: {$action_success_lang}
"; + else + $addupdate_msg = $addupdate_msg . "{$cal_file_lang} {$filenumber}: {$upload_error}
"; } } // Delete a calendar // Not at all secure - need to strip out path info if used by users besides admin in the future if ($action == "delete") { - $delete_success = FALSE; - - if (!unlink($calendar_path . "/" . urldecode($delete_calendar))) { - $delete_error = $delete_error_lang . " " . $calendar_path . "/" . urldecode($delete_calendar); - } - else { - $delete_success = TRUE; + $delete_msg = ""; + + foreach ($delete_calendar as $filename) { + if (!delete_cal(urldecode($filename))) { + $delete_msg = $delete_msg . "" . $delete_error_lang . " " . urldecode(substr($filename,0,-4)) . "
"; + } + else { + $delete_msg = $delete_msg . "" . urldecode(substr($filename,0,-4)) . " " . $delete_success_lang . "
"; + } } } @@ -190,70 +174,93 @@ if ($action == "delete") {

- > +
{$username_lang}:
{$password_lang}:
- - + + + + + + + + + + + + + + + + + + - +
: 1:
2:
3:
4:
5:
 
{$action_success_lang}"; } ?>  
- +

-
> + - - - - - - - - - - + // Print Calendar Checkboxes + // + $COLUMNS_TO_PRINT = 3; + $column = 1; + $filelist = get_calendar_files($calendar_path); + foreach ($filelist as $file) { + if ($column > $COLUMNS_TO_PRINT) { + echo ""; + $column = 1; + } + if ($column == 1) { + echo ""; + } + + $cal_filename_tmp = substr($file,0,-4); + $cal_tmp = urlencode($file); + $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp); + + echo "\n"; + + $column++; + } + // Print remaining empty columns if necessary + $number_of_columns = count($filelist); + while (gettype($number_of_columns/$COLUMNS_TO_PRINT) != "integer") { + echo ""; + $number_of_columns++; + } + ?>
: - \n"; - $filelist = get_calendar_files($calendar_path); - foreach ($filelist as $file) { - $cal_filename_tmp = substr($file,0,-4); - $cal_tmp = urlencode($file); - $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp); - print "\n"; - } - print "\n"; - ?> -
 
{$action_success_lang}"; } ?> 
$cal_displayname_tmp 
+

+

 

- - -"; + -include (BASE.'includes/footer.inc.php'); -echo "
- - "; -?> + + + + + + + -- cgit v1.2.3