Exemplo n.º 1
0
function rest_put()
{
    global $projectid;
    if (isset($_GET['buildgroup'])) {
        // Modify an existing buildgroup.
        $buildgroup = json_decode($_GET['buildgroup'], true);
        // Deal with the fact that unchecked checkboxes will not be included
        // in the above array.
        if (!array_key_exists('emailcommitters', $buildgroup)) {
            $buildgroup['emailcommitters'] = 0;
        }
        if (!array_key_exists('includesubprojecttotal', $buildgroup)) {
            $buildgroup['includesubprojecttotal'] = 0;
        }
        $BuildGroup = new BuildGroup();
        $BuildGroup->SetId(pdo_real_escape_numeric($buildgroup['id']));
        $BuildGroup->SetName(pdo_real_escape_string($buildgroup['name']));
        $BuildGroup->SetDescription(pdo_real_escape_string($buildgroup['description']));
        $BuildGroup->SetSummaryEmail(pdo_real_escape_numeric($buildgroup['summaryemail']));
        $BuildGroup->SetEmailCommitters(pdo_real_escape_numeric($buildgroup['emailcommitters']));
        $BuildGroup->SetIncludeSubProjectTotal(pdo_real_escape_numeric($buildgroup['includesubprojecttotal']));
        $BuildGroup->SetAutoRemoveTimeFrame(pdo_real_escape_numeric($buildgroup['autoremovetimeframe']));
        if (!$BuildGroup->Save()) {
            echo_error('Failed to save BuildGroup');
        }
        return;
    }
}