# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. */ $_SERVER['SCRIPT_NAME'] !== "/controller.php" ? require_once __DIR__ . "/classes/Requires.php" : (Links::$pretty = true); Functions::check_required_parameters(array($_GET['param1'])); //Get recipe $result = MySQLQueries::get_recipe($_GET['param1']); $recipe = MySQLConnection::fetch_object($result); $recipe = Functions::format_dates($recipe); $interpreters = array("shell", "bash", "perl", "python", "node.js"); Header::set_title("Commando.io - Edit Recipe"); Header::render(array("chosen", "codemirror")); Navigation::render("recipes"); ?> <div class="container"> <div class="row"> <div class="span12"> <h1 class="header" style="float: left;"><?php echo $recipe->name; ?>
# You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. */ require_once dirname(__DIR__) . "/classes/Requires.php"; Functions::check_required_parameters(array($_POST['groups'], $_POST['recipe'])); if (!CSRF::is_valid()) { Error::halt(400, 'bad request', 'Missing required security token.'); } $result = MySQLQueries::get_recipe($_POST['recipe']); $recipe = MySQLConnection::fetch_object($result); if (empty($recipe)) { //Output error details Error::halt(400, 'bad request', 'The recipe \'' . $_POST['recipe'] . '\' does not exist.'); } //Default group handling if (count($_POST['groups']) === 1 && empty($_POST['groups'][0])) { $_POST['groups'] = array(); } $servers = array(); $results = MySQLQueries::get_servers_by_groups($_POST['groups']); while ($row = MySQLConnection::fetch_object($results)) { $servers[] = $row; } $returned_results = array();