event_delete.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /*
  3. * event_delete.php
  4. *
  5. * Copyright (c) 2001 Michal Szczotka <michal@tuxy.org>
  6. * Licensed under the GNU GPL. For full terms see the file COPYING.
  7. *
  8. * Functions to delete a event.
  9. *
  10. * $Id$
  11. */
  12. require_once('calendar_data.php');
  13. require_once('functions.php');
  14. chdir('..');
  15. require_once('../src/validate.php');
  16. require_once('../functions/strings.php');
  17. require_once('../functions/date.php');
  18. require_once('../config/config.php');
  19. require_once('../functions/page_header.php');
  20. require_once('../src/load_prefs.php');
  21. function confirm_deletion()
  22. {
  23. global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day;
  24. $tmparray = $calendardata["$dmonth$dday$dyear"]["$dhour$dminute"];
  25. echo " <TABLE BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">\n".
  26. " <TR><TH COLSPAN=2 BGCOLOR=\"$color[4]\">\n".
  27. _("Do you really want to delete this event?") . "<br></th>\n".
  28. " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Date:") . "</TD>\n".
  29. " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$dmonth/$dday/$dyear</TD></TR>\n".
  30. " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Time:") . "</TD>\n".
  31. " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$dhour:$dminute</TD></TR>\n".
  32. " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Title:") . "</TD>\n".
  33. " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$tmparray[title]</TD></TR>\n".
  34. " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Message:") . "</TD>\n".
  35. " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$tmparray[message]</TD></TR>\n".
  36. " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">\n".
  37. " <FORM NAME=\"delevent\" METHOD=POST ACTION=\"$calself\">\n".
  38. " <INPUT TYPE=HIDDEN NAME=\"dyear\" VALUE=\"$dyear\">\n".
  39. " <INPUT TYPE=HIDDEN NAME=\"dmonth\" VALUE=\"$dmonth\">\n".
  40. " <INPUT TYPE=HIDDEN NAME=\"dday\" VALUE=\"$dday\">\n".
  41. " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
  42. " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
  43. " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
  44. " <INPUT TYPE=HIDDEN NAME=\"dhour\" VALUE=\"$dhour\">\n".
  45. " <INPUT TYPE=HIDDEN NAME=\"dminute\" VALUE=\"$dminute\">\n".
  46. " <INPUT TYPE=HIDDEN NAME=\"confirmed\" VALUE=\"yes\">\n".
  47. ' <INPUT TYPE=SUBMIT VALUE="' . _("Yes") . "\">\n".
  48. " </FORM>\n".
  49. " </TD><TD ALIGN=LEFT BGCOLOR=\"$color[4]\">\n".
  50. " <FORM NAME=\"nodelevent\" METHOD=POST ACTION=\"day.php\">\n".
  51. " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
  52. " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
  53. " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
  54. ' <INPUT TYPE=SUBMIT VALUE="' . _("No") . "\">\n".
  55. " </FORM>\n".
  56. " </TD></TR>\n".
  57. " </TABLE>\n";
  58. }
  59. if ($month <= 0){
  60. $month = date( 'm' );
  61. }
  62. if ($year <= 0){
  63. $year = date( 'Y' );
  64. }
  65. if ($day <= 0){
  66. $day = date( 'd' );
  67. }
  68. $calself=basename($PHP_SELF);
  69. displayPageHeader($color, 'None');
  70. //load calendar menu
  71. calendar_header();
  72. echo "<TR BGCOLOR=\"$color[0]\"><TD>".
  73. "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">".
  74. '<tr><td>'.
  75. date_intl( 'l, F d Y', mktime(0, 0, 0, $month, $day, $year));
  76. if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)){
  77. if (isset($confirmed)){
  78. delete_event("$dmonth$dday$dyear", "$dhour$dminute");
  79. echo '<br><br>' . _("Event deleted!") . "<BR>\n";
  80. echo "<A HREF=\"day.php?year=$year&month=$month&day=$day\">" .
  81. _("Day View") . "</A>\n";
  82. } else {
  83. readcalendardata();
  84. confirm_deletion();
  85. }
  86. } else {
  87. echo '<br>' . _("Nothing to delete!");
  88. }
  89. ?>
  90. </table></td></tr></table>
  91. </body></html>