Source for file event_create.php

Documentation is available at event_create.php

  1. <?php
  2.  
  3. /**
  4.  * functions to create a event for calendar.
  5.  *
  6.  * @copyright 2002-2020 The SquirrelMail Project Team
  7.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  8.  * @version $Id: event_create.php 14840 2020-01-07 07:42:38Z pdontthink $
  9.  * @package plugins
  10.  * @subpackage calendar
  11.  */
  12.  
  13. /** @ignore */
  14. define('SM_PATH','../../');
  15.  
  16. /* SquirrelMail required files. */
  17. include_once(SM_PATH 'include/validate.php');
  18. /* date_intl() */
  19. include_once(SM_PATH 'functions/date.php');
  20.  
  21. /* Calendar plugin required files. */
  22. include_once(SM_PATH 'plugins/calendar/calendar_data.php');
  23. include_once(SM_PATH 'plugins/calendar/functions.php');
  24.  
  25. /* get globals */
  26. if (sqGetGlobalVar('year',$year,SQ_FORM|| is_numeric($year)) {
  27.     unset($year);
  28. }
  29. if (sqGetGlobalVar('month',$month,SQ_FORM|| is_numeric($month)) {
  30.     unset($month);
  31. }
  32. if (sqGetGlobalVar('day',$day,SQ_FORM|| is_numeric($day)) {
  33.     unset($day);
  34. }
  35. if (sqGetGlobalVar('hour',$hour,SQ_FORM|| is_numeric($hour)) {
  36.     unset($hour);
  37. }
  38. if (sqGetGlobalVar('event_hour',$event_hour,SQ_POST|| is_numeric($event_hour)) {
  39.     unset($event_hour);
  40. }
  41. if (sqGetGlobalVar('event_minute',$event_minute,SQ_POST|| is_numeric($event_minute)) {
  42.     unset($event_minute);
  43. }
  44. if (sqGetGlobalVar('event_length',$event_length,SQ_POST|| is_numeric($event_length)) {
  45.     unset($event_length);
  46. }
  47. if (sqGetGlobalVar('event_priority',$event_priority,SQ_POST|| is_numeric($event_priority)) {
  48.     unset($event_priority);
  49. }
  50.  
  51. sqGetGlobalVar('event_title',$event_title,SQ_POST);
  52. sqGetGlobalVar('event_text',$event_text,SQ_POST);
  53. sqGetGlobalVar('send',$send,SQ_POST);
  54.  
  55. /* got 'em */
  56.  
  57. //main form to gather event info
  58. function show_event_form({
  59.     global $color$editor_size$year$day$month$hour;
  60.  
  61.     echo "\n<form name=\"eventscreate\" action=\"event_create.php\" method=\"post\">\n".
  62.          "      <input type=\"hidden\" name=\"year\" value=\"$year\" />\n".
  63.          "      <input type=\"hidden\" name=\"month\" value=\"$month\" />\n".
  64.          "      <input type=\"hidden\" name=\"day\" value=\"$day\" />\n".
  65.          html_tag'tr' .
  66.          html_tag'td'_("Start time:")'right'$color[4"\n" .
  67.          html_tag'td''''left'$color[4"\n" .
  68.          "      <select name=\"event_hour\">\n";
  69.     select_option_hour($hour);
  70.     echo "      </select>\n" .
  71.          "      &nbsp;:&nbsp;\n" .
  72.          "      <select name=\"event_minute\">\n";
  73.     select_option_minute("00");
  74.     echo "      </select>\n".
  75.          "      </td></tr>\n".
  76.          html_tag'tr' .
  77.          html_tag'td'_("Length:")'right'$color[4"\n" .
  78.          html_tag'td''''left'$color[4"\n" .
  79.          "      <select name=\"event_length\">\n";
  80.     select_option_length("0");
  81.     echo "      </select>\n".
  82.          "      </td></tr>\n".
  83.          html_tag'tr' .
  84.          html_tag'td'_("Priority:")'right'$color[4"\n" .
  85.          html_tag'td''''left'$color[4"\n" .
  86.          "      <select name=\"event_priority\">\n";
  87.     echo "      </select>\n".
  88.          "      </td></tr>\n".
  89.          html_tag'tr' .
  90.          html_tag'td'_("Title:")'right'$color[4"\n" .
  91.          html_tag'td''''left'$color[4"\n" .
  92.          "      <input type=\"text\" name=\"event_title\" value=\"\" size=\"30\" maxlength=\"50\" /><br />\n".
  93.          "      </td></tr>\n".
  94.          html_tag'tr',
  95.              html_tag'td',
  96.                  "<textarea name=\"event_text\" rows=\"5\" cols=\"$editor_size\" wrap=\"hard\"></textarea>,
  97.              'left'$color[4]'colspan="2"' )
  98.          ."\n" .
  99.          html_tag'tr',
  100.              html_tag'td',
  101.                  '<input type="submit" name="send" value="' .
  102.                  _("Set Event"'" />' ,
  103.              'left'$color[4]'colspan="2"' )
  104.          ."\n";
  105.     echo "</form>\n";
  106. }
  107.  
  108.  
  109. if !isset($month|| $month <= 0){
  110.     $month date'm' );
  111. }
  112. if !isset($year|| $year <= 0){
  113.     $year date'Y' );
  114. }
  115. if (!isset($day|| $day <= 0){
  116.     $day date'd' );
  117. }
  118. if (!isset($hour|| $hour <= 0){
  119.     $hour '08';
  120. }
  121.  
  122. $calself=basename($PHP_SELF);
  123.  
  124.  
  125. displayPageHeader($color'None');
  126. //load calendar menu
  127.  
  128. echo html_tag'tr'''''$color[0.
  129.            html_tag'td''''left' .
  130.                html_tag'table'''''$color[0]'width="100%" border="0" cellpadding="2" cellspacing="1"' .
  131.                    html_tag'tr',
  132.                        html_tag'td'date_intl_("l, F j Y")mktime(000$month$day$year))'left''''colspan="2"' )
  133.                    );
  134. //if form has not been filled in
  135. if(!isset($event_text)){
  136.     show_event_form();
  137. else {
  138.     readcalendardata();
  139.     $calendardata["$month$day$year"]["$event_hour$event_minute"=
  140.     array'length'   => $event_length,
  141.            'priority' => $event_priority,
  142.            'title'    => $event_title,
  143.            'message'  => $event_text,
  144.            'reminder' => '' );
  145.     //save
  146.     writecalendardata();
  147.     echo html_tag'table',
  148.                 html_tag'tr',
  149.                     html_tag'th'_("Event Has been added!""<br />\n"''$color[4]'colspan="2"' )
  150.                 .
  151.                 html_tag'tr',
  152.                     html_tag'td'_("Date:")'right'$color[4"\n" .
  153.                     html_tag'td'date_intl(_("m/d/Y"),mktime(0,0,0,$month,$day,$year))'left'$color[4"\n"
  154.                 .
  155.                 html_tag'tr',
  156.                     html_tag'td'_("Time:")'right'$color[4"\n" .
  157.                     html_tag'td'date_intl(_("H:i"),mktime($event_hour,$event_minute,0,$month,$day,$year))'left'$color[4"\n"
  158.                 .
  159.                 html_tag'tr',
  160.                     html_tag'td'_("Title:")'right'$color[4"\n" .
  161.                     html_tag'td'sm_encode_html_special_chars($event_title,ENT_NOQUOTES)'left'$color[4"\n"
  162.                 .
  163.                 html_tag'tr',
  164.                     html_tag'td'_("Message:")'right'$color[4"\n" .
  165.                     html_tag'td'nl2br(sm_encode_html_special_chars($event_text,ENT_NOQUOTES))'left'$color[4"\n"
  166.                 .
  167.                 html_tag'tr',
  168.                     html_tag'td',
  169.                         "<a href=\"day.php?year=$year&amp;month=$month&amp;day=$day\">_("Day View""</a>\n" ,
  170.                     'left'$color[4]'colspan="2"' "\n"
  171.                 ,
  172.             ''$color[0]'width="100%" border="0" cellpadding="2" cellspacing="1"' ."\n";
  173. }
  174.  
  175. ?>
  176. </table></td></tr></table>
  177. </body></html>

Documentation generated on Mon, 13 Jan 2020 04:24:34 +0100 by phpDocumentor 1.4.3