本文整理汇总了PHP中dbi_free_result函数的典型用法代码示例。如果您正苦于以下问题:PHP dbi_free_result函数的具体用法?PHP dbi_free_result怎么用?PHP dbi_free_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbi_free_result函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_palm_events
function delete_palm_events($login)
{
$res = dbi_query("SELECT cal_id FROM webcal_import_data " . "WHERE cal_login = '{$login}'");
if ($res) {
while ($row = dbi_fetch_row($res)) {
dbi_query("DELETE FROM webcal_entry_user WHERE cal_id = {$row['0']}");
dbi_query("DELETE FROM webcal_entry_repeats WHERE cal_id = {$row['0']}");
dbi_query("DELETE FROM webcal_entry_repeats_not WHERE cal_id = {$row['0']}");
dbi_query("DELETE FROM webcal_entry_log WHERE cal_entry_id = {$row['0']}");
dbi_query("DELETE FROM webcal_site_extras WHERE cal_id = {$row['0']}");
dbi_query("DELETE FROM webcal_reminder_log WHERE cal_id = {$row['0']}");
dbi_query("DELETE FROM webcal_import_data WHERE cal_id = {$row['0']}");
dbi_query("DELETE FROM webcal_entry WHERE cal_id = {$row['0']}");
}
}
dbi_free_result($res);
return 1;
}
示例2: db_load_config
function db_load_config()
{
global $webcalConfig;
while (list($key, $val) = each($webcalConfig)) {
$res = dbi_execute('SELECT cal_value FROM webcal_config
WHERE cal_setting = ?', array($key), false, false);
$sql = 'INSERT INTO webcal_config ( cal_setting, cal_value ) VALUES (?,?)';
if (!$res) {
dbi_execute($sql, array($key, $val));
} else {
// SQLite returns $res always.
$row = dbi_fetch_row($res);
if (!isset($row[0])) {
dbi_execute($sql, array($key, $val));
}
dbi_free_result($res);
}
}
}
示例3: delete_palm_events
function delete_palm_events($login)
{
$res = dbi_execute('SELECT cal_id FROM webcal_import_data
WHERE cal_login = ? AND cal_import_type = ?', array($login, 'palm'));
if ($res) {
while ($row = dbi_fetch_row($res)) {
dbi_execute('DELETE FROM webcal_blob WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_entry_log WHERE cal_entry_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_entry_repeats WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_entry_repeats_not WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_import_data WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_reminders WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_site_extras WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_entry_user WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_entry WHERE cal_id = ?', array($row[0]));
}
}
dbi_free_result($res);
return 1;
}
示例4: save_layer
function save_layer($layer_user, $layeruser, $layercolor, $dups, $id)
{
global $error, $layers;
if ($layer_user == $layeruser) {
$error = translate('You cannot create a layer for yourself.');
}
load_user_layers($layer_user, 1);
if (!empty($layeruser) && $error == '') {
// Existing layer entry.
if (!empty($layers[$id]['cal_layeruser'])) {
// Update existing layer entry for this user.
$layerid = $layers[$id]['cal_layerid'];
dbi_execute('UPDATE webcal_user_layers SET cal_layeruser = ?,
cal_color = ?, cal_dups = ? WHERE cal_layerid = ?', array($layeruser, $layercolor, $dups, $layerid));
} else {
// New layer entry.
// Check for existing layer for user. Can only have one layer per user.
$res = dbi_execute('SELECT COUNT( cal_layerid ) FROM webcal_user_layers
WHERE cal_login = ? AND cal_layeruser = ?', array($layer_user, $layeruser));
if ($res) {
$row = dbi_fetch_row($res);
if ($row[0] > 0) {
$error = translate('You can only create one layer for each user.');
}
dbi_free_result($res);
}
if ($error == '') {
$res = dbi_execute('SELECT MAX( cal_layerid ) FROM webcal_user_layers');
if ($res) {
$row = dbi_fetch_row($res);
$layerid = $row[0] + 1;
} else {
$layerid = 1;
}
dbi_execute('INSERT INTO webcal_user_layers ( cal_layerid, cal_login,
cal_layeruser, cal_color, cal_dups ) VALUES ( ?, ?, ?, ?, ? )', array($layerid, $layer_user, $layeruser, $layercolor, $dups));
}
}
}
}
示例5: doDbSanityCheck
function doDbSanityCheck()
{
global $db_database, $db_host, $db_login;
$dieMsgStr = 'Error finding WebCalendar tables in database "' . $db_database . '" using db login "' . $db_login . '" on db server "' . $db_host . '".<br /><br />
Have you created the database tables as specified in the
<a href="docs/WebCalendar-SysAdmin.html" ' . ' target="other">WebCalendar System Administrator\'s Guide</a>?';
$res = @dbi_execute('SELECT COUNT( cal_value ) FROM webcal_config', array(), false, false);
if ($res) {
if ($row = dbi_fetch_row($res)) {
// Found database. All is peachy.
dbi_free_result($res);
} else {
// Error accessing table.
// User has wrong db name or has not created tables.
// Note: can't translate this since translate.php is not included yet.
dbi_free_result($res);
die_miserable_death($dieMsgStr);
}
} else {
die_miserable_death($dieMsgStr);
}
}
示例6: doDbSanityCheck
function doDbSanityCheck()
{
global $db_login, $db_host, $db_database;
$res = @dbi_query("SELECT COUNT(cal_value) FROM webcal_config", false, false);
if ($res) {
if ($row = dbi_fetch_row($res)) {
// Found database. All is peachy.
dbi_free_result($res);
} else {
// Error accessing table.
// User has wrong db name or has not created tables.
// Note: cannot translate this since we have not included
// translate.php yet.
dbi_free_result($res);
die_miserable_death("Error finding WebCalendar tables in database '{$db_database}' " . "using db login '{$db_login}' on db server '{$db_host}'.<br/><br/>\n" . "Have you created the database tables as specified in the " . "<a href=\"docs/WebCalendar-SysAdmin.html\" target=\"other\">WebCalendar " . "System Administrator's Guide</a>?");
}
} else {
// Error accessing table.
// User has wrong db name or has not created tables.
// Note: cannot translate this since we have not included translate.php yet.
die_miserable_death("Error finding WebCalendar tables in database '{$db_database}' " . "using db login '{$db_login}' on db server '{$db_host}'.<br/><br/>\n" . "Have you created the database tables as specified in the " . "<a href=\"docs/WebCalendar-SysAdmin.html\" target=\"other\">WebCalendar " . "System Administrator's Guide</a>?");
}
}
示例7: process_event
function process_event($id, $name, $event_date, $event_time)
{
global $site_extras, $debug, $only_testing;
global $EXTRA_REMINDER_WITH_OFFSET, $EXTRA_REMINDER_WITH_DATE;
if ($debug) {
printf("Event %d: \"%s\" at %s on %s <br />\n", $id, $name, $event_time, $event_date);
}
// Check to see if this event has any reminders
$extras = get_site_extra_fields($id);
for ($j = 0; $j < count($site_extras); $j++) {
$extra_name = $site_extras[$j][0];
$extra_type = $site_extras[$j][2];
$extra_arg1 = $site_extras[$j][3];
$extra_arg2 = $site_extras[$j][4];
//if ( $debug )
// printf ( " name: %s\n type: %d\n arg1: %s\n arg2: %s\n",
// $extra_name, $extra_type, $extra_arg1, $extra_arg2 );
if (!empty($extras[$extra_name]['cal_remind'])) {
if ($debug) {
echo " Reminder set for event. <br />\n";
}
// how many minutes before event should we send the reminder?
$ev_h = (int) ($event_time / 10000);
$ev_m = $event_time / 100 % 100;
$ev_year = substr($event_date, 0, 4);
$ev_month = substr($event_date, 4, 2);
$ev_day = substr($event_date, 6, 2);
$event_time = mktime($ev_h, $ev_m, 0, $ev_month, $ev_day, $ev_year);
if (($extra_arg2 & $EXTRA_REMINDER_WITH_OFFSET) > 0) {
$minsbefore = $extras[$extra_name]['cal_data'];
$remind_time = $event_time - $minsbefore * 60;
} else {
if (($extra_arg2 & $EXTRA_REMINDER_WITH_DATE) > 0) {
$rd = $extras[$extra_name]['cal_date'];
$r_year = substr($rd, 0, 4);
$r_month = substr($rd, 4, 2);
$r_day = substr($rd, 6, 2);
$remind_time = mktime(0, 0, 0, $r_month, $r_day, $r_year);
} else {
$minsbefore = $extra_arg1;
$remind_time = $event_time - $minsbefore * 60;
}
}
if ($debug) {
echo " Mins Before: {$minsbefore} <br />\n";
}
if ($debug) {
echo " Event time is: " . date("m/d/Y H:i", $event_time) . "<br />\n";
echo " Remind time is: " . date("m/d/Y H:i", $remind_time) . "<br />\n";
}
if (time() >= $remind_time) {
// It's remind time or later. See if one has already been sent
$last_sent = 0;
$res = dbi_query("SELECT MAX(cal_last_sent) FROM " . "webcal_reminder_log WHERE cal_id = " . $id . " AND cal_event_date = {$event_date}" . " AND cal_name = '" . $extra_name . "'");
if ($res) {
if ($row = dbi_fetch_row($res)) {
$last_sent = $row[0];
}
dbi_free_result($res);
}
if ($debug) {
echo " Last sent on: " . date("m/d/Y H:i", $last_sent) . "<br />\n";
}
if ($last_sent < $remind_time) {
// Send a reminder
if ($debug) {
echo " SENDING REMINDER! <br />\n";
}
send_reminder($id, $event_date);
// now update the db...
log_reminder($id, $extra_name, $event_date);
}
}
}
}
}
示例8: access_load_user_functions
function access_load_user_functions($user)
{
global $is_admin;
static $permissions;
if (!empty($permissions[$user])) {
return $permissions[$user];
}
$ret = '';
$rets = array();
$users = array($user, '__default__');
for ($i = 0, $cnt = count($users); $i < $cnt && empty($ret); $i++) {
$res = dbi_execute('SELECT cal_permissions FROM webcal_access_function
WHERE cal_login = ?', array($users[$i]));
assert('$res');
if ($row = dbi_fetch_row($res)) {
$rets[$users[$i]] = $row[0];
}
dbi_free_result($res);
}
// If still no setting found, then assume access to everything
// if an admin user, otherwise access to all non-admin functions.
if (!empty($rets[$user])) {
$ret = $rets[$user];
} else {
if (!empty($rets['__default__'])) {
$ret = $rets['__default__'];
} else {
for ($i = 0; $i < ACCESS_NUMBER_FUNCTIONS; $i++) {
$ret .= get_default_function_access($i, $user);
}
}
}
// do_debug ( $user . " " . $ret);
$permissions[$user] = $ret;
return $ret;
}
示例9: user_get_users
function user_get_users()
{
global $public_access, $PUBLIC_ACCESS_FULLNAME;
$count = 0;
$ret = array();
if ($public_access == "Y") {
$ret[$count++] = array("cal_login" => "__public__", "cal_lastname" => "", "cal_firstname" => "", "cal_is_admin" => "N", "cal_email" => "", "cal_password" => "", "cal_fullname" => $PUBLIC_ACCESS_FULLNAME);
}
$res = dbi_query("SELECT cal_login, cal_lastname, cal_firstname, " . "cal_is_admin, cal_email, cal_passwd FROM webcal_user " . "ORDER BY cal_lastname, cal_firstname, cal_login");
if ($res) {
while ($row = dbi_fetch_row($res)) {
if (strlen($row[1]) && strlen($row[2])) {
$fullname = "{$row['2']} {$row['1']}";
} else {
$fullname = $row[0];
}
$ret[$count++] = array("cal_login" => $row[0], "cal_lastname" => $row[1], "cal_firstname" => $row[2], "cal_is_admin" => $row[3], "cal_email" => empty($row[4]) ? "" : $row[4], "cal_password" => $row[5], "cal_fullname" => $fullname);
}
dbi_free_result($res);
}
return $ret;
}
示例10: list_unapproved
function list_unapproved($user)
{
global $temp_fullname, $key, $login;
//echo "Listing events for $user <br>";
$sql = "SELECT webcal_entry.cal_id, webcal_entry.cal_name, " . "webcal_entry.cal_description, " . "webcal_entry.cal_priority, webcal_entry.cal_date, " . "webcal_entry.cal_time, webcal_entry.cal_duration, " . "webcal_entry_user.cal_status " . "FROM webcal_entry, webcal_entry_user " . "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id " . "AND ( webcal_entry.cal_ext_for_id IS NULL " . "OR webcal_entry.cal_ext_for_id = 0 ) AND " . "webcal_entry_user.cal_login = '{$user}' AND " . "webcal_entry_user.cal_status = 'W' " . "ORDER BY webcal_entry.cal_date";
$res = dbi_query($sql);
$count = 0;
$eventinfo = "";
if ($res) {
while ($row = dbi_fetch_row($res)) {
if ($count == 0) {
echo "<ul>\n";
}
$key++;
$id = $row[0];
$name = $row[1];
$description = $row[2];
$pri = $row[3];
$date = $row[4];
$time = $row[5];
$duration = $row[6];
$status = $row[7];
$divname = "eventinfo-{$id}-{$key}";
echo "<li><a title=\"" . translate("View this entry") . "\" class=\"entry\" href=\"view_entry.php?id={$id}&user={$user}";
echo "\" onmouseover=\"window.status='" . translate("View this entry") . "'; show(event, '{$divname}'); return true;\" onmouseout=\"hide('{$divname}'); return true;\">";
$timestr = "";
if ($time > 0) {
$timestr = display_time($time);
if ($duration > 0) {
// calc end time
$h = (int) ($time / 10000);
$m = $time / 100 % 100;
$m += $duration;
$d = $duration;
while ($m >= 60) {
$h++;
$m -= 60;
}
$end_time = sprintf("%02d%02d00", $h, $m);
$timestr .= " - " . display_time($end_time);
}
}
echo htmlspecialchars($name);
echo "</a>";
echo " (" . date_to_str($date) . ")\n";
//approve
echo ": <a title=\"" . translate("Approve/Confirm") . "\" href=\"approve_entry.php?id={$id}&ret=list&user={$user}";
if ($user == "__public__") {
echo "&public=1";
}
echo "\" class=\"nav\" onclick=\"return confirm('" . translate("Approve this entry?") . "');\">" . translate("Approve/Confirm") . "</a>, ";
//reject
echo "<a title=\"" . translate("Reject") . "\" href=\"reject_entry.php?id={$id}&ret=list&user={$user}";
if ($user == "__public__") {
echo "&public=1";
}
echo "\" class=\"nav\" onclick=\"return confirm('" . translate("Reject this entry?") . "');\">" . translate("Reject") . "</a>";
//delete
echo ", <a title=\"" . translate("Delete") . "\" href=\"del_entry.php?id={$id}&ret=list";
if ($user != $login) {
echo "&user={$user}";
}
echo "\" class=\"nav\" onclick=\"return confirm('" . translate("Are you sure you want to delete this entry?") . "');\">" . translate("Delete") . "</a>";
echo "\n</li>\n";
$eventinfo .= build_event_popup($divname, $user, $description, $timestr, site_extras_for_popup($id));
$count++;
}
dbi_free_result($res);
if ($count > 0) {
echo "</ul>\n";
}
}
if ($count == 0) {
user_load_variables($user, "temp_");
echo "<span class=\"nounapproved\">" . translate("No unapproved events for") . " " . $temp_fullname . ".</span>\n";
} else {
if (!empty($eventinfo)) {
echo $eventinfo;
}
}
}
示例11: import_data
function import_data($data, $overwrite, $type)
{
global $login, $count_con, $count_suc, $error_num, $ImportType, $LOG_CREATE;
global $single_user, $single_user_login, $allow_conflicts;
global $numDeleted, $errormsg;
global $calUser, $H2COLOR, $sqlLog;
$oldUIDs = array();
$oldIds = array();
$firstEventId = 0;
$importId = 1;
// Generate a unique import id
$res = dbi_query("SELECT MAX(cal_import_id) FROM webcal_import");
if ($res) {
if ($row = dbi_fetch_row($res)) {
$importId = $row[0] + 1;
}
dbi_free_result($res);
}
$sql = "INSERT INTO webcal_import ( cal_import_id, cal_name, " . "cal_date, cal_type, cal_login ) VALUES ( {$importId}, NULL, " . date("Ymd") . ", '{$type}', '{$login}' )";
if (!dbi_query($sql)) {
$errormsg = translate("Database error") . ": " . dbi_error();
return;
}
foreach ($data as $Entry) {
$priority = 2;
$participants[0] = $calUser;
// Some additional date/time info
$START = $Entry['StartTime'] > 0 ? localtime($Entry['StartTime']) : 0;
$END = $Entry['EndTime'] > 0 ? localtime($Entry['EndTime']) : 0;
$Entry['StartMinute'] = sprintf("%02d", $START[1]);
$Entry['StartHour'] = sprintf("%02d", $START[2]);
$Entry['StartDay'] = sprintf("%02d", $START[3]);
$Entry['StartMonth'] = sprintf("%02d", $START[4] + 1);
$Entry['StartYear'] = sprintf("%04d", $START[5] + 1900);
$Entry['EndMinute'] = sprintf("%02d", $END[1]);
$Entry['EndHour'] = sprintf("%02d", $END[2]);
$Entry['EndDay'] = sprintf("%02d", $END[3]);
$Entry['EndMonth'] = sprintf("%02d", $END[4] + 1);
$Entry['EndYear'] = sprintf("%04d", $END[5] + 1900);
if ($overwrite && !empty($Entry['UID'])) {
$oldUIDs[$Entry['UID']]++;
}
// Check for untimed
if ($Entry['Untimed'] == 1) {
$Entry['StartMinute'] = '';
$Entry['StartHour'] = '';
$Entry['EndMinute'] = '';
$Entry['EndHour'] = '';
}
// first check for any schedule conflicts
if (empty($allow_conflicts) && $Entry['Duration'] != 0) {
$date = mktime(0, 0, 0, $Entry['StartMonth'], $Entry['StartDay'], $Entry['StartYear']);
$endt = !empty($Entry['Repeat']['EndTime']) ? $Entry['Repeat']['EndTime'] : 'NULL';
$dayst = !empty($Entry['Repeat']['RepeatDays']) ? $Entry['Repeat']['RepeatDays'] : "nnnnnnn";
$ex_days = array();
if (!empty($Entry['Repeat']['Exceptions'])) {
foreach ($Entry['Repeat']['Exceptions'] as $ex_date) {
$ex_days[] = date("Ymd", $ex_date);
}
}
$dates = get_all_dates($date, RepeatType($Entry['Repeat']['Interval']), $endt, $dayst, $ex_days, $Entry['Repeat']['Frequency']);
$overlap = overlap($dates, $Entry['Duration'], $Entry['StartHour'], $Entry['StartMinute'], $participants, $login, 0);
}
if (empty($error) && !empty($overlap)) {
$error = translate("The following conflicts with the suggested time") . ":<ul>{$overlap}</ul>\n";
}
if (empty($error)) {
$updateMode = false;
// See if event already is there from prior import.
// The same UID is used for all events imported at once with iCal.
// So, we still don't have enough info to find the exact
// event we want to replace. We could just delete all
// existing events that correspond to the UID.
/************************************************************************
Not sure what to do with this code since I don't know how Palm and vCal
use the UID stuff yet...
if ( ! empty ( $Entry['UID'] ) ) {
$res = dbi_query ( "SELECT webcal_import_data.cal_id " .
"FROM webcal_import_data, webcal_entry_user " .
"WHERE cal_import_type = 'ical' AND " .
"webcal_import_data.cal_id = webcal_entry_user.cal_id AND " .
"webcal_entry_user.cal_login = '$login' AND " .
"cal_external_id = '$Entry[UID]'" );
if ( $res ) {
if ( $row = dbi_fetch_row ( $res ) ) {
if ( ! empty ( $row[0] ) ) {
$id = $row[0];
$updateMode = true;
// update rather than add a new event
}
}
}
}
************************************************************************/
// Add the Event
$res = dbi_query("SELECT MAX(cal_id) FROM webcal_entry");
if ($res) {
$row = dbi_fetch_row($res);
$id = $row[0] + 1;
//.........这里部分代码省略.........
示例12: delete_events
function delete_events($nid)
{
// Get event ids for all events this user is a participant.
$events = get_users_event_ids($nid);
// Now count number of participants in each event...
// If just 1, then save id to be deleted.
$delete_em = array();
for ($i = 0, $cnt = count($events); $i < $cnt; $i++) {
$res = dbi_execute('SELECT COUNT( * ) FROM webcal_entry_user
WHERE cal_id = ?', array($events[$i]));
if ($res) {
$row = dbi_fetch_row($res);
if (!empty($row) && $row[0] == 1) {
$delete_em[] = $events[$i];
}
dbi_free_result($res);
}
}
// Now delete events that were just for this user.
for ($i = 0, $cnt = count($delete_em); $i < $cnt; $i++) {
dbi_execute('DELETE FROM webcal_entry_repeats WHERE cal_id = ?', array($delete_em[$i]));
dbi_execute('DELETE FROM webcal_entry_repeats_not WHERE cal_id = ?', array($delete_em[$i]));
dbi_execute('DELETE FROM webcal_entry_log WHERE cal_entry_id = ?', array($delete_em[$i]));
dbi_execute('DELETE FROM webcal_import_data WHERE cal_id = ?', array($delete_em[$i]));
dbi_execute('DELETE FROM webcal_site_extras WHERE cal_id = ?', array($delete_em[$i]));
dbi_execute('DELETE FROM webcal_entry_ext_user WHERE cal_id = ?', array($delete_em[$i]));
dbi_execute('DELETE FROM webcal_reminders WHERE cal_id =? ', array($delete_em[$i]));
dbi_execute('DELETE FROM webcal_blob WHERE cal_id = ?', array($delete_em[$i]));
dbi_execute('DELETE FROM webcal_entry WHERE cal_id = ?', array($delete_em[$i]));
}
// Delete user participation from events.
dbi_execute('DELETE FROM webcal_entry_user WHERE cal_login = ?', array($nid));
}
示例13: load_nonuser_preferences
function load_nonuser_preferences($nonuser)
{
global $prefarray;
$res = dbi_query("SELECT cal_setting, cal_value FROM webcal_user_pref " . "WHERE cal_login = '{$nonuser}'");
if ($res) {
while ($row = dbi_fetch_row($res)) {
$setting = $row[0];
$value = $row[1];
$sys_setting = "sys_" . $setting;
// save system defaults
// ** don't override ones set by load_user_prefs
if (!empty($GLOBALS[$setting]) && empty($GLOBALS["sys_" . $setting])) {
$GLOBALS["sys_" . $setting] = $GLOBALS[$setting];
}
$GLOBALS[$setting] = $value;
$prefarray[$setting] = $value;
}
dbi_free_result($res);
}
}
示例14: export_alarm_ical
function export_alarm_ical($id, $description)
{
$sql = "SELECT cal_data FROM webcal_site_extras " . "WHERE cal_id = {$id} AND cal_type = 7 AND cal_remind = 1";
$res = dbi_query($sql);
$row = dbi_fetch_row($res);
dbi_free_result($res);
if ($row) {
echo "BEGIN:VALARM\r\n";
echo "TRIGGER:-PT" . $row[0] . "M\r\n";
echo "ACTION:DISPLAY\r\n";
$array = export_fold_lines($description, "utf8");
while (list($key, $value) = each($array)) {
echo "{$value}\r\n";
}
echo "END:VALARM\r\n";
}
}
示例15: while
while ($row = dbi_fetch_row($res)) {
$events[] = $row[0];
}
}
// Now count number of participants in each event...
// If just 1, then save id to be deleted
$delete_em = array();
for ($i = 0; $i < count($events); $i++) {
$res = dbi_query("SELECT COUNT(*) FROM webcal_entry_user " . "WHERE cal_id = " . $events[$i]);
if ($res) {
if ($row = dbi_fetch_row($res)) {
if ($row[0] == 1) {
$delete_em[] = $events[$i];
}
}
dbi_free_result($res);
}
}
// Now delete events that were just for this user
for ($i = 0; $i < count($delete_em); $i++) {
dbi_query("DELETE FROM webcal_entry WHERE cal_id = " . $delete_em[$i]);
}
// Delete user participation from events
dbi_query("DELETE FROM webcal_entry_user WHERE cal_login = '{$user}'");
// Delete any layers other users may have that point to this user.
dbi_query("DELETE FROM webcal_user_layers WHERE cal_layeruser = '{$user}'");
// Delete user
if (!dbi_query("DELETE FROM webcal_nonuser_cals WHERE cal_login = '{$user}'")) {
$error = translate("Database error") . ": " . dbi_error();
}
} else {