function remove_edit_panels() { global $s_edit_where, $s_edit_values, $s_edit_idx; global $s_data_panels, $s_sql_panels; for ($i = 1; $i <= $s_edit_idx; $i++) { $idx = get_panel_index($s_data_panels, 'dt_edit' . $i); if ($idx !== FALSE) { array_splice($s_data_panels, $idx, 1); } $idx = get_panel_index($s_sql_panels, 'dt_edit' . $i); if ($idx !== FALSE) { array_splice($s_sql_panels, $idx, 1); } } $s_edit_where = array(); $s_edit_values = array(); $s_edit_idx = 0; }
$s_edit_where[$s_edit_idx] = array('where' => get_request_data('edit', 'GET'), 'table' => $s_wt['table']); $s_fields = get_table_computed_sources($s_wt['table'], $s_fields); $s_edit_values[$s_edit_idx] = init_edit_values($s_edit_where[$s_edit_idx], $s_fields[$s_wt['table']]); } elseif (isset($_GET['del'])) { $where = get_request_data('del', 'GET'); $quote = identifier_quote($s_login['dialect']); $sql = 'DELETE FROM ' . $quote . $s_wt['table'] . $quote . ' ' . $where; if ($s_cust['askdel'] == TRUE) { $s_delete_idx = $s_delete_idx > 0 ? get_max_key($s_confirmations['row']) + 1 : 1; $target_panels = get_panel_array($s_referer); $pname = 'dt_delete' . $s_delete_idx; $ptitle = 'Delete'; $ptitle .= $s_delete_idx > 1 ? " ({$s_delete_idx}) " : ' '; $ptitle .= 'from table ' . $s_wt['table']; ${$target_panels}[] = array($pname, $ptitle, 'open'); $pos = get_panel_index(${$target_panels}, $pname); ${$target_panels} = array_moveto_top(${$target_panels}, $pos); $s_confirmations['row'][$s_delete_idx] = array('msg' => sprintf($MESSAGES['CONFIRM_ROW_DELETE'], $s_wt['table'], $where), 'sql' => $sql); } else { fbird_query($dbhandle, $sql) or $ib_error = fbird_errmsg(); // cleanup the watchtable output buffer $s_watch_buffer = ''; } } // cleanup the watchtable output buffer if (isset($_GET['go']) || isset($_GET['order'])) { $s_watch_buffer = ''; $s_cust['wt'][$s_login['database']] = array('table' => $s_wt['table'], 'start' => $s_wt['start'], 'order' => $s_wt['order'], 'dir' => $s_wt['direction']); set_customize_cookie($s_cust); } globalize_session_vars();
$js_stack .= js_markable_table(); } } // cleanup the watchtable output buffer $s_watch_buffer = ''; } // // process the export buttons from the sql_enter panel // if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST)) { foreach (array_keys($_POST) as $name) { if (preg_match('/sql_export_([0-9]+)/', $name, $matches) && isset($s_sql['queries'][$matches[1]])) { // set export parameters $s_export['source'] = array('option' => 'query', 'query' => $s_sql['queries'][$matches[1]]); // make sure the export-panel is open $idx = get_panel_index($s_data_panels, 'dt_export'); $s_data_panels[$idx][2] = 'open'; // goto the export-panel globalize_session_vars(); redirect(url_session('data.php#dt_export')); } } } // // print out all the panels // $s_page = 'SQL'; $panels = $s_sql_panels; require './inc/script_end.inc.php'; // // build a result table for an 'select' from the sql_enter panel
function remove_confirm($instance) { global $s_confirmations, $s_delete_idx; $panels_arrayname = get_panel_array($_SERVER['SCRIPT_NAME']); $name = 'dt_delete' . $instance; $idx = get_panel_index($GLOBALS[$panels_arrayname], $name); array_splice($GLOBALS[$panels_arrayname], $idx, 1); unset($s_confirmations['row'][$instance]); if (count($s_confirmations['row']) == 0) { unset($s_confirmations['row']); $s_delete_idx = 0; } }
} $bindargs[] = empty($field['notnull']) && strlen($value) == 0 ? NULL : $value; } $cols[] = $field['name']; $k++; } if (count($bindargs) > 0) { $ib_error = $s_cust['enter']['as_new'] == TRUE ? insert_row($table, $cols, $bindargs) : update_row($table, $cols, $bindargs, substr($s_edit_where[$instance]['where'], 6)); if (empty($ib_error)) { $success = TRUE; $s_enter_values = array(); $s_watch_buffer = ''; // cleanup the watchtable output buffer $s_watch_buffer = ''; } } } $panels_arrayname = get_panel_array($_SERVER['SCRIPT_NAME']); if ($success || $job == 'cancel') { // remove the dt_edit panel $name = 'dt_edit' . $instance; $idx = get_panel_index(${$panels_arrayname}, $name); array_splice(${$panels_arrayname}, $idx, 1); unset($s_edit_where[$instance]); unset($s_edit_values[$instance]); if (count($s_edit_where) == 0) { $s_edit_idx = 0; } } } }