WebCalendar PHP Cross Reference Groupware Applications

Source: /minical.php - 126 lines - 4125 bytes - Summary - Text - Print

   1  <?php
   2  /* $Id: minical.php,v 1.21.2.4 2007/11/12 15:40:31 umcesrjones Exp $
   3   *
   4   * Description:
   5   * This script is intended to be used inside an IFRAME on another website
   6   * It can be embedded like so
   7   * <iframe name="minical" frameborder="0" height="190" width="250"
   8   *   src="http://cal/minical.php";>
   9   *
  10   * You must have public access enabled in System Settings to use this page
  11   * (unless you modify the $public_must_be_enabled setting below in this file).
  12   *
  13   * By default (if you do not edit this file),
  14   * events for the public calendar will be used.
  15   *
  16   * Input parameters:
  17   * You can override settings by changing the URL parameters:
  18   *   - cat_id: specify a category id to filter on
  19   *   - user: login name of calendar to display (instead of public user),
  20   *           if allowed by System Settings.
  21   *           Only NUC Calendar that are marked PUBLIC can be specified.
  22   *
  23   * Security:
  24   * $PUBLISH_ENABLED must be set true
  25   */
  26  include_once  'includes/init.php';
  27  
  28  load_global_settings ();
  29  
  30  // These values will be used by styles.php to customize the size of this calendar.
  31  $DISPLAY_WEEKENDS = true;
  32  $MINICALFONT = '11px';
  33  $MINICALWIDTH = '160px';
  34  
  35  if ( empty ( $PUBLISH_ENABLED ) || $PUBLISH_ENABLED != 'Y' ) {
  36    header ( 'Content-Type: text/plain' );
  37    echo print_not_auth (20);
  38    exit;
  39  }
  40  
  41  /* Configurable settings for this file. You may change the settings below to
  42   * change the default settings. These settings will likely move into the
  43   * System Settings in the web admin interface in a future release.
  44   */
  45  
  46  // The HTML target window to use when clicking on the minical. You should be
  47  // able to set this to the desired frame or window to receive the results.
  48  $MINI_TARGET = '_blank';
  49  
  50  // Change this to false if you still want to access this page
  51  // even though you do not have public access enabled.
  52  $public_must_be_enabled = true;
  53  
  54  // Login of calendar user to use.
  55  // '__public__' is the login name for the public user.
  56  $user = ( empty ( $user ) ? '__public__' : $user );
  57  
  58  // Allow the URL to override the user setting such as
  59  // "minical.php?user=_NUC_training".
  60  // If false, __public_ will always be used.
  61  $allow_user_override = false;
  62  
  63  // Load just a specified category (by its id).
  64  // Leave blank to not filter on category (unless specified in URL).
  65  // Can override in URL with "minical.php?cat_id=4"
  66  $cat_id = ( empty ( $cat_id ) ? '' : $cat_id );
  67  
  68  // End configurable settings...
  69  
  70  // Set for use elsewhere as a global.
  71  $login = $user;
  72  
  73  //Error code 
  74  if ( $public_must_be_enabled && $PUBLIC_ACCESS != 'Y' )
  75    $error = print_not_auth (21);
  76  
  77  if ( $allow_user_override ) {
  78    $u = getValue ( 'user', '[A-Za-z0-9_\.=@,\-]+', true );
  79    if ( ! empty ( $u ) )
  80      $login = $user = $u;
  81    // We also set $login since some functions assume that it is set.
  82  }
  83  
  84  load_user_preferences ();
  85  
  86  user_load_variables ( $login, 'minical_' );
  87  
  88  if ( $user != '__public__' && ! nonuser_load_variables ( $login, 'minica_' ) )
  89    die_miserable_death (
  90      // translate ( 'No such nonuser calendar' )
  91      str_replace ( 'XXX', $login,
  92        translate ( 'No such nonuser calendar XXX.' ) ) );
  93  
  94  if ( $user != '__public__' &&
  95    ( empty ( $minical_is_public ) || $minical_is_public != 'Y' ) )
  96    die_miserable_death ( translate ( 'This Calendar is not Public.' ) );
  97  
  98  $next = mktime ( 0, 0, 0, $thismonth + 1, 1, $thisyear );
  99  $nextmonth = date ( 'm', $next );
 100  $nextyear = date ( 'Y', $next );
 101  
 102  $prev = mktime ( 0, 0, 0, $thismonth - 1, 1, $thisyear );
 103  $prevmonth = date ( 'm', $prev );
 104  $prevyear = date ( 'Y', $prev );
 105  
 106  $boldDays = true;
 107  $startdate = mktime ( 0, 0, 0, $thismonth, 0, $thisyear );
 108  $enddate = mktime ( 23, 59, 59, $thismonth + 1, 0, $thisyear );
 109  
 110  // Don't display custom header.
 111  print_header ( '', generate_refresh_meta (), '', true );
 112  
 113  /* Pre-Load the repeated events for quicker access. */
 114  $repeated_events = read_repeated_events ( $user, $startdate, $enddate, $cat_id );
 115  
 116  /* Pre-load the non-repeating events for quicker access. */
 117  $events = read_events ( $user, $startdate, $enddate, $cat_id );
 118  
 119  echo display_small_month ( $thismonth, $thisyear, true, false );
 120  
 121  // Reset...just in case.
 122  $login = '';
 123  
 124  ?>
 125    </body>
 126  </html>

title

Description

title

Description

title

Description

title

title

Body