예제 #1
0
<?php

/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_GET['id'], $_GET['version']));
if (!CSRF::is_valid(1, METHOD_GET)) {
    Error::halt(400, 'bad request', 'Missing required security token.');
}
MySQLQueries::edit_recipe_head($_GET['id'], $_GET['version']);
Functions::redirect(Links::render("view-recipe", array($_GET['id'])));
예제 #2
0
<?php

/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_POST['name']));
MySQLQueries::add_group($_POST['name']);
Functions::redirect(Links::render("groups"));
예제 #3
0
# Copyright 2012 NodeSocket, LLC
#
# 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 execution history record
$execution_history = null;
MongoConnection::connect();
MongoConnection::select_collection("executions");
$results = MongoConnection::find(array("_id" => new MongoId($_GET['param1'])));
MongoConnection::close();
foreach ($results as $result) {
    $result['executed'] = date(DATE_FORMAT, $result['executed']->sec + Functions::timezone_offset_in_seconds());
    $execution_history = $result;
}
if (empty($execution_history)) {
    Error::halt(404, 'not found', 'Execution history ID \'' . $_GET['param1'] . '\' does not exist.');
}
$execution_history_json = @json_encode($execution_history, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
header("Content-Type: application/json");
예제 #4
0
<?php

/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_POST['id'], $_POST['name'], $_POST['interpreter'], $_POST['content']));
MySQLQueries::edit_recipe($_POST['id'], $_POST['name'], $_POST['interpreter'], $_POST['notes'], $_POST['content']);
Functions::redirect(Links::render("view-recipe", array($_POST['id'])));
예제 #5
0
<?php

/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_POST['address'], $_POST['port'], $_POST['username']));
$ssh = new SSH($_POST['address'], $_POST['port']);
$ssh_auth = $ssh->auth($_POST['username'], SSH_PUBLIC_KEY_PATH, SSH_PRIVATE_KEY_PATH);
echo '{"ssh_connected":true}';
예제 #6
0
<?php

/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_POST['label'], $_POST['address'], $_POST['ssh_username'], $_POST['ssh_port']));
MySQLQueries::add_server($_POST['label'], $_POST['group'], $_POST['tags'], $_POST['address'], $_POST['ssh_username'], $_POST['ssh_port']);
Functions::redirect(Links::render("servers"));
예제 #7
0
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
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']);
예제 #8
0
<?php

/*
# Copyright 2012 NodeSocket, LLC
#
# 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.
*/
require_once dirname(__DIR__) . "/classes/Requires.php";
Functions::check_required_parameters(array($_POST['id'], $_POST['notes']));
if (!CSRF::is_valid(2)) {
    Error::halt(400, 'bad request', 'Missing required security token.');
}
MongoConnection::connect();
MongoConnection::grid_fs();
MongoConnection::grid_fs_update(array("_id" => new MongoId($_POST['id'])), array('$set' => array("notes" => $_POST['notes'])));
MongoConnection::close();
echo '{"updated":true}';