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

Documentation generated on Mon, 13 Jan 2020 04:22:26 +0100 by phpDocumentor 1.4.3