WebCalendar PHP Cross Reference Groupware Applications

Source: /ajax.php - 79 lines - 2683 bytes - Summary - Text - Print

   1  <?php
   2  /* $Id: ajax.php,v 1.16.2.9 2012/03/03 01:54:14 cknudsen Exp $
   3   *
   4   * Description
   5   * This is the handler for Ajax httpXmlRequests.
   6   */
   7  require_once 'includes/classes/WebCalendar.class';
   8  
   9  $WebCalendar = new WebCalendar ( __FILE__ );
  10  
  11  include  'includes/translate.php';
  12  include  'includes/config.php';
  13  include  'includes/dbi4php.php';
  14  include  'includes/formvars.php';
  15  include  'includes/functions.php';
  16  require_valide_referring_url ();
  17  
  18  $WebCalendar->initializeFirstPhase ();
  19  
  20  include 'includes/' . $user_inc;
  21  include  'includes/access.php';
  22  include  'includes/validate.php';
  23  
  24  $WebCalendar->initializeSecondPhase ();
  25  
  26  load_global_settings ();
  27  load_user_preferences ();
  28  $WebCalendar->setLanguage ();
  29  
  30  $cat_id = getValue ( 'cat_id', '-?[0-9,\-]*', true );
  31  $name = getPostValue ( 'name' );
  32  $page = getPostValue ( 'page' );
  33  
  34  // We're processing edit_remotes Calendar ID field.
  35  if ( $page == 'edit_remotes' || $page == 'edit_nonuser' ) {
  36    $res = dbi_execute ( 'SELECT cal_login FROM webcal_nonuser_cals
  37      WHERE cal_login = ?', array ( $NONUSER_PREFIX . $name ) );
  38    if ( $res ) {
  39      $row = dbi_fetch_row ( $res );
  40      // Presuming we are using '_NUC_' as $NONUSER_PREFIX.
  41      if ( $name == substr ( $row[0], strlen ( $NONUSER_PREFIX ) ) )
  42        // translate ( 'Duplicate Name' )
  43        echo str_replace ( 'XXX', $name, translate ( 'Duplicate Name XXX', true ) );
  44    }
  45  } elseif ( $page == 'register' || $page == 'edit_user' ) {
  46    // We're processing username field.
  47    $res = dbi_execute ( 'SELECT cal_login FROM webcal_user WHERE cal_login = ?',
  48      array ( $name ) );
  49    if ( $res ) {
  50      $row = dbi_fetch_row ( $res );
  51      // translate ( 'Username already exists.' )
  52      if ( $row[0] == $name )
  53        echo str_replace ( 'XXX', $name,
  54          translate ( 'Username XXX already exists.', true ) );
  55    }
  56  } elseif ( $page == 'email' ) {
  57    // We're processing email field from any page.
  58    $res = dbi_execute ( 'SELECT cal_email FROM webcal_user WHERE cal_email = ?',
  59      array ( $name ) );
  60    if ( $res ) {
  61      $row = dbi_fetch_row ( $res );
  62      // translate ( 'Email address already exists.' )
  63      if ( $row[0] == $name )
  64        echo str_replace ( 'XXX', $name,
  65          translate ( 'Email address XXX already exists.', true ) );
  66    }
  67  } elseif ( $page == 'minitask' ) {
  68    $name = ( ! empty ( $name ) ? $name : 0 );
  69    require_once 'includes/classes/Event.class';
  70    require_once 'includes/classes/RptEvent.class';
  71    include_once  'includes/gradient.php';
  72    $column_array = array ( 'we.cal_priority', 'we.cal_name',
  73      'we.cal_due_date', 'weu.cal_percent' );
  74    $task_filter = ' ORDER BY ' . $column_array[$name % 4]
  75     . ( $name > 3 ? ' ASC' : ' DESC' );
  76    echo display_small_tasks ( $cat_id );
  77  }
  78  
  79  ?>

title

Description

title

Description

title

Description

title

title

Body