[ Index ] |
|
Code source de WebCalendar 1.0.5 |
1 <?php 2 include_once 'includes/init.php'; 3 load_user_categories(); 4 5 $error = ""; 6 7 // Only proceed if id was passed 8 if ( $id > 0 ) { 9 10 // double check to make sure user doesn't already have the event 11 $is_my_event = false; 12 $sql = "SELECT cal_id FROM webcal_entry_user " . 13 "WHERE cal_login = '$login' AND cal_id = $id"; 14 $res = dbi_query ( $sql ); 15 if ( $res ) { 16 $row = dbi_fetch_row ( $res ); 17 if ( $row[0] == $id ) { 18 $is_my_event = true; 19 echo "Event # " . $id . " is already on your calendar."; 20 exit; 21 } 22 dbi_free_result ( $res ); 23 } 24 25 // Now lets make sure the user is allowed to add the event (not private) 26 27 $sql = "SELECT cal_access FROM webcal_entry WHERE cal_id = " . $id; 28 $res = dbi_query ( $sql ); 29 if ( ! $res ) { 30 echo translate("Invalid entry id") . ": $id"; 31 exit; 32 } 33 $row = dbi_fetch_row ( $res ); 34 35 if ( $row[0] == "R" && ! $is_my_event ) { 36 $is_private = true; 37 etranslate("This is a private event and may not be added to your calendar."); 38 exit; 39 } else { 40 $is_private = false; 41 } 42 43 // add the event 44 if ( $readonly == "N" && ! $is_my_event && ! $is_private ) { 45 if ( ! dbi_query ( "INSERT INTO webcal_entry_user ( cal_id, cal_login, cal_status ) VALUES ( $id, '$login', 'A' )") ) { 46 $error = translate("Error adding event") . ": " . dbi_error (); 47 } 48 } 49 } 50 51 send_to_preferred_view (); 52 exit; 53 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Nov 30 19:09:19 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |