vid; $p[':fnumber'] = gpc_get_int($_POST, 'fnumber');; $p[':ftype'] = gpc_get_int($_POST, 'ftype');; $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); $action = ACT_VIEW; break; case 'update': $p[':fuseid'] = $id; $p[':fnumber'] = gpc_get_string($_POST, 'fuseid'); $p[':current'] = gpc_get_float($_POST, 'current'); $p[':cableid'] = gpc_get_int($_POST, 'cableid'); $p[':eid'] = gpc_get_int($_POST, 'id'); $p[':weight'] = min(gpc_get_float($_POST, 'weight'), 9.99); // limit max value $p[':location'] = gpc_get_int($_POST, 'location'); $p[':description'] = gpc_get_string($_POST, 'description'); $p[':remarks'] = gpc_get_string($_POST, 'remarks'); db_exec_update('tag', $p, 'tagid'); $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(7, '', true); // load filter from db $flt = db_get_filter($user->id, 212); $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 (strlen($flt->txt) > 1) { $w[] = 'description LIKE :txt'; $p[':txt'] = '%'.$flt->txt.'%'; } $where = join(' AND ', $w); $order = ' ORDER BY fnumber'; echo "