2 include_once $gfplugins.'webcalendar/www/includes/init.php';
5 $error = "You are not authorized";
7 if ( $action == "Delete" || $action == translate ("Delete") ) {
9 dbi_query ( "DELETE FROM webcal_group WHERE cal_group_id = $id " );
10 dbi_query ( "DELETE FROM webcal_group_user WHERE cal_group_id = $id " );
12 $date = date ( "Ymd" );
13 if ( empty ( $groupname ) ) {
14 $error = translate("You must specify a group name");
16 else if ( ! empty ( $id ) ) {
18 if ( ! dbi_query ( "UPDATE webcal_group SET cal_name = " .
19 "'$groupname', cal_last_update = $date " .
20 "WHERE cal_group_id = $id" ) ) {
21 $error = translate ("Database error") . ": " . dbi_error();
24 # new... get new id first
25 $res = dbi_query ( "SELECT MAX(cal_group_id) FROM webcal_group" );
27 $row = dbi_fetch_row ( $res );
30 dbi_free_result ( $res );
31 $sql = "INSERT INTO webcal_group " .
32 "( cal_group_id, cal_owner, cal_name, cal_last_update ) VALUES ( " .
33 "$id, '$login', '$groupname', $date )";
34 if ( ! dbi_query ( $sql ) ) {
35 $error = translate ("Database error") . ": " . dbi_error();
38 $error = translate ("Database error") . ": " . dbi_error();
43 if ( $error == "" && ! empty ( $users ) ) {
44 dbi_query ( "DELETE FROM webcal_group_user WHERE cal_group_id = $id" );
45 for ( $i = 0; $i < count ( $users ); $i++ ) {
46 dbi_query ( "INSERT INTO webcal_group_user ( cal_group_id, cal_login ) " .
47 "VALUES ( $id, '$users[$i]' )" );
53 if ( ! empty ( $error ) ) {
54 print_header( '', '', '', true );
57 <h2><?php etranslate("Error")?></h2>
64 // echo "<br /><br /><strong>SQL:</strong> $sql";
69 <?php } else if ( empty ( $error ) ) {
70 ?><html><head></head><body onload="alert('<?php etranslate("Changes successfully saved");?>'); window.parent.location.href='users.php';">