vid; $p[':fnumber'] = gpc_get_int($_POST, 'fnumber'); $p[':ftype'] = gpc_get_int($_POST, 'ftype', NULL, -1); $p[':current'] = gpc_get_int($_POST, 'current'); $p[':location'] = gpc_get_int($_POST, 'location'); $p[':description'] = gpc_get_string($_POST, 'description'); $id = db_exec_insert('fuse', $p); db_set_revision('table', TBL_FUSES); $action = ACT_VIEW; break; case 'update': $p[':fuseid'] = $id; $p[':fnumber'] = gpc_get_int($_POST, 'fnumber'); $p[':ftype'] = gpc_get_int($_POST, 'ftype', [-1]); $p[':current'] = gpc_get_float($_POST, 'current'); $p[':color'] = gpc_get_color($_POST, 'color'); $p[':cableid'] = gpc_get_int($_POST, 'cableid', NULL, -1); $p[':eid'] = gpc_get_int($_POST, 'id', [-1]); $p[':location'] = gpc_get_int($_POST, 'location', NULL, -1); $p[':description'] = gpc_get_string($_POST, 'description'); $p[':remarks'] = gpc_get_string($_POST, 'remarks'); db_exec_update('fuse', $p, 'fuseid'); $action = ACT_VIEW; break; case 'delete': // Security token needed! if (gpc_get_string($_POST, 'token', 16) != $_SESSION['token']) { $g_error->Add(_('Delete prohibited, invalid security token!')); $action = ACT_VIEW; break; } // tagref have to be empty // TODO $action = ACT_DEFAULT; break; default: $g_error->Add(sprintf(_('Unknown function!'), $submit)); $valid = FALSE; } // ========== ACTIONS END ===================================================== require 'header.php'; // ========== PAGE CONTENT ==================================================== if ($action == ACT_DEFAULT): // ========== VARIANT: default behavior ======================================= // lookup tables $opt_ftype_short = db_get_options(DD_FUSE_TYPE, '', true); // load filter from db $flt = db_get_filter($user->id, 212, ['txt', 'location', 'type']); $w = array('vid=:vid'); $p = array(':vid' => $user->vid); if ($flt->location == -1) { $w[] = 'location IS NULL'; } elseif ($flt->location > 0) { $w[] = 'location=:location'; $p[':location'] = $flt->location; } if ($flt->type == -1) { $w[] = 'ftype IS NULL'; } elseif ($flt->type > 0) { $w[] = 'ftype=:ftype'; $p[':ftype'] = $flt->type; } if (strlen($flt->txt) > 1) { $w[] = 'description LIKE :txt'; $p[':txt'] = '%'.$flt->txt.'%'; } $where = join(' AND ', $w); $order = ' ORDER BY fnumber'; echo "