[ Index ]
 

Code source de WebCalendar 1.0.5

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables | Statistiques

title

Body

[fermer]

/ -> approve_entry.php (source)

   1  <?php
   2  include_once  'includes/init.php';
   3  load_user_categories();
   4  
   5  $error = "";
   6  
   7  if ( $readonly == 'Y' ) {
   8    $error = translate("You are not authorized");
   9  }
  10  
  11  // Allow administrators to approve public events
  12  if ( $public_access == "Y" && ! empty ( $public ) && $is_admin )
  13    $app_user = "__public__";
  14  else
  15    $app_user = ( $is_assistant || $is_nonuser_admin ? $user : $login );
  16  
  17  if ( empty ( $error ) && $id > 0 ) {
  18    if ( ! dbi_query ( "UPDATE webcal_entry_user SET cal_status = 'A' " .
  19      "WHERE cal_login = '$app_user' AND cal_id = $id" ) ) {
  20      $error = translate("Error approving event") . ": " . dbi_error ();
  21    } else {
  22      activity_log ( $id, $login, $app_user, $LOG_APPROVE, "" );
  23    }
  24    // Update any extension events related to this one.
  25    $res = dbi_query ( "SELECT cal_id FROM webcal_entry " .
  26      "WHERE cal_ext_for_id = $id" );
  27    if ( $res ) {
  28      if ( $row = dbi_fetch_row ( $res ) ) {
  29        $ext_id = $row[0];
  30        if ( ! dbi_query ( "UPDATE webcal_entry_user SET cal_status = 'A' " .
  31          "WHERE cal_login = '$app_user' AND cal_id = $ext_id" ) ) {
  32          $error = translate("Error approving event") . ": " . dbi_error ();
  33        }
  34      }
  35      dbi_free_result ( $res );
  36    }
  37  }
  38  
  39  if ( empty ( $error ) ) {
  40    if ( ! empty ( $ret ) && $ret == "list" )
  41      do_redirect ( "list_unapproved.php?user=$app_user" );
  42    else
  43      do_redirect ( "view_entry.php?id=$id&amp;user=$app_user" );
  44    exit;
  45  }
  46  print_header ();
  47  echo "<h2>" . translate("Error") . "</h2>\n";
  48  echo "<p>" . $error . "</p>\n";
  49  print_trailer ();
  50  ?>


Généré le : Fri Nov 30 19:09:19 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics