function rest_delete() { if (isset($_GET['buildgroupid'])) { // Delete the specified BuildGroup. $buildgroupid = pdo_real_escape_numeric($_GET['buildgroupid']); $Group = new BuildGroup(); $Group->SetId($buildgroupid); $Group->Delete(); return; } if (isset($_GET['wildcard'])) { // Delete a wildcard build group rule. $wildcard = json_decode($_GET['wildcard'], true); $buildgroupid = pdo_real_escape_numeric($wildcard['buildgroupid']); $match = htmlspecialchars(pdo_real_escape_string($wildcard['match'])); $buildtype = htmlspecialchars(pdo_real_escape_string($wildcard['buildtype'])); $sql = "DELETE FROM build2grouprule\n WHERE groupid='{$buildgroupid}' AND buildtype = '{$buildtype}' AND\n buildname = '%{$match}%'"; if (!pdo_query($sql)) { echo_error(pdo_error()); } } if (isset($_GET['dynamic'])) { // Delete a dynamic build group rule. $dynamic = json_decode($_GET['dynamic'], true); $buildgroupid = pdo_real_escape_numeric($dynamic['id']); $rule = json_decode($_GET['rule'], true); $match = htmlspecialchars(pdo_real_escape_string($rule['match'])); if (!empty($match)) { $match = "%" . $match . "%"; } $parentgroupid = pdo_real_escape_numeric($rule['parentgroupid']); $siteid = pdo_real_escape_numeric($rule['siteid']); $sql = "DELETE FROM build2grouprule\n WHERE groupid='{$buildgroupid}' AND buildname = '{$match}'"; if ($siteid > 0) { $sql .= " AND siteid = '{$siteid}'"; } if ($parentgroupid > 0) { $sql .= " AND parentgroupid = '{$parentgroupid}'"; } if (!pdo_query($sql)) { echo_error(pdo_error()); } } }