Exemple #1
0
    public static function render($current_page = "")
    {
        echo '<div class="navbar navbar-fixed-top">
			      <div class="navbar-inner">
			        <div class="container">
			          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
			      	 	<span class="icon-bar"></span>
			      	 	<span class="icon-bar"></span>
			      	 	<span class="icon-bar"></span>
			          </a>
			          <a class="brand" href="/">Commando.io</a>
			          <div class="nav-collapse">
			            <ul class="nav">';
        foreach (Navigation::$pages as $page => $icon) {
            if ($page === strtolower($current_page)) {
                echo '<li class="active">';
            } else {
                echo '<li>';
            }
            echo '<a href="' . Links::render($page) . '"><i class="' . $icon . '"></i> ' . ucfirst($page) . '</a></li>';
        }
        echo '</ul>';
        if (!empty(Navigation::$right)) {
            echo '<ul class="nav pull-right">' . Navigation::$right . '</ul>';
        }
        echo '</div>
			        </div>
			      </div>
			    </div>';
    }
Exemple #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($_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'])));
Exemple #3
0
?>
</textarea>
				    			<p class="help-block" style="clear: both;">Optional notes and comments you wish to attach to the recipe. <a href="http://daringfireball.net/projects/markdown/">Markdown</a> is supported.</p>
				    		</div>
				    	</div>
				    	<div class="control-group">
				    		<label class="control-label" for="recipe-editor">Recipe</label>
				    		<div class="controls">
				    			<textarea id="recipe-editor" name="content"><?php 
echo $recipe->content;
?>
</textarea>
				    			<p class="help-block" style="clear: both;"></p>
				    		</div>
				    	</div>
				    	<div class="control-group">
							<div class="controls">
								<a class="btn btn-primary" id="edit-recipe-submit" onclick="validate_edit_recipe();"><i class="icon-ok-sign icon-white"></i> Update Recipe</a>
								<a class="btn" href="<?php 
echo Links::render("view-recipe", array($recipe->id));
?>
">Cancel</a>
							</div>
				       </div>
				    </fieldset>
		        </form>
    		</div> 
		</div>
	  </div>   
<?php 
Footer::render(array("chosen", "codemirror", "autosize", "edit-recipe"));
echo ucfirst($execution_history['recipe']['interpreter']);
?>
</a>
			                	</li>
	                		</ul>
	              		</div>
            		</div>
          		</div>
				<div id="contents-loading" class="progress progress-striped active">
					<div class="bar" style="width: 100%;"></div>
				</div>
				<div id="execution-history-contents" style="display: none;">
					<div style="float: right; position: relative; top: 0px; right: 0px;">
						<a href="<?php 
echo Links::render("download-execution-history", array($execution_history['_id']->__toString()));
?>
" class="btn btn-medium"><i class="icon-download-alt"></i> Download JSON</a> <a href="<?php 
echo Links::render("view-execution-history-raw", array($execution_history['_id']->__toString()));
?>
" class="btn btn-medium"><i class="icon-align-left"></i> Raw</a>
					</div>
					<pre class="prettyprint linenums"><?php 
echo htmlentities(@json_encode($execution_history, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
?>
</pre>
				</div>
    		</div>
		</div>
	  </div>
<?php 
Footer::render(array("code-pretty", "zclip", "view-execution-history"));
Exemple #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['name']));
MySQLQueries::add_group($_POST['name']);
Functions::redirect(Links::render("groups"));
Exemple #6
0
# 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";
//Get files
$files = array();
MongoConnection::connect();
MongoConnection::grid_fs();
$results = MongoConnection::grid_fs_find();
$results->sort(array("uploadDate" => -1));
MongoConnection::close();
foreach ($results as $result) {
    $result->file['uploadDate'] = date(DATE_FORMAT, $result->file['uploadDate']->sec + Functions::timezone_offset_in_seconds());
    $files[] = $result->file;
}
$html = "";
if (count($files) === 0) {
    $html .= '<div id="no-files" class="alert alert-grey no-bottom-margin">No files added. Drag a file into the upload box above.</div>';
} else {
    $html .= '<div class="control-group"><div class="controls"><a id="delete-files" class="btn disabled"><i class="icon-remove"></i> Delete Selected</a></div></div><table class="table table-striped table-hover table-bordered table-condensed"><thead><tr><th><input type="checkbox" id="files-delete-all-check" /></th><th>Action</th><th>ID</th><th>Name</th><th>Type</th><th>Size</th><th>Added</th></tr></thead><tbody>';
    foreach ($files as $file) {
        $html .= '<tr id="' . $file['_id'] . '" class="file"><td><input type="checkbox" class="file-delete-check" value="' . $file['_id'] . '" /></td><td><a href="' . Links::render("download-file", array($file['_id']->__toString())) . '" class="btn btn-mini"><i class="icon-download-alt"></i></a>';
        $html .= strpos($file['type'], 'text') !== false || $file['type'] === "application/json" ? ' <a href="' . Links::render("view-file-raw", array($file['_id']->__toString())) . '" class="btn btn-mini"><i class="icon-align-left"></i>' : null;
        $html .= '</td><td><a class="btn btn-mini disabled expand-west expand-file-id">' . Functions::add_ellipsis_reverse($file['_id'], 8) . '</a></td><td><a href="' . Links::render("view-file", array($file['_id']->__toString())) . '">' . $file['real_filename'] . '</a></td><td><span class="badge badge-info">';
        $html .= empty($file['type']) ? "unknown" : $file['type'];
        $html .= '</span></td><td>' . Functions::format_bytes($file['length']) . '</td><td>' . $file['uploadDate'] . '</td></tr>';
    }
    $html .= '</tbody></table>';
}
echo '{"count":' . count($files) . ',"html":' . json_encode($html) . '}';
<?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']));
if (!CSRF::is_valid(METHOD_GET)) {
    Error::halt(400, 'bad request', 'Missing required security token.');
}
MySQLQueries::delete_recipes(array($_GET['id']));
Functions::redirect(Links::render("recipes"));
Exemple #8
0
          </div>
        </div>
		<div class="span3">
        	<div class="well">
        		<h1 style="margin-bottom: 10px;"><a href="<?php 
echo Links::render("recipes");
?>
">Recipes</a></h1>
         		<p>Recipes are containers of commands that are fully versioned. Recipes can be written in pure shell, bash, perl, python, or node.js.</p>
          		<p><a class="btn btn-primary btn-large" href="<?php 
echo Links::render("recipes");
?>
">Recipes &raquo;</a></p>
        	</div>
        </div>
        <div class="span3">
        	<div class="well">
        		<h1 style="margin-bottom: 10px;"><a href="<?php 
echo Links::render("files");
?>
">Files</a></h1>
         		<p>Files is a centralized place to store text or binary files and then SCP transfer them to groups of servers via recipes.</p>
          		<p><a class="btn btn-primary btn-large" href="<?php 
echo Links::render("files");
?>
">Files &raquo;</a></p>
        	</div>
        </div>
      </div>
<?php 
Footer::render(array("index"));
Exemple #9
0
				        </div>
				        <div class="control-group">
				    		<label class="control-label" for="recipe-notes">Notes</label>
				    		<div class="controls">
				    			<textarea id="recipe-notes" name="notes"></textarea>
				    			<p class="help-block" style="clear: both;">Optional notes and comments you wish to attach to the recipe. <a href="http://daringfireball.net/projects/markdown/">Markdown</a> is supported.</p>
				    		</div>
				    	</div>
				    	<div class="control-group">
				    		<label class="control-label" for="recipe-editor">Recipe</label>
				    		<div class="controls">
				    			<textarea id="recipe-editor" name="content"></textarea>
				    			<p class="help-block" style="clear: both;"></p>
				    		</div>
				    	</div>
				    	<div class="control-group">
							<div class="controls">
								<a class="btn btn-primary" id="add-recipe-submit" onclick="validate_add_recipe();"><i class="icon-ok-sign icon-white"></i> Add Recipe</a>
								<a class="btn" href="<?php 
echo Links::render("recipes");
?>
">Cancel</a>
							</div>
				       </div>
				    </fieldset>
	        	</form>
    		</div> 
		</div>
	  </div>   
<?php 
Footer::render(array("chosen", "codemirror", "autosize", "add-recipe"));
Exemple #10
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"));
Exemple #11
0
	          					<b class="caret"></b>
	    					</a>
	    					<ul class="dropdown-menu"></ul>
	    			   </li>');
Navigation::render("execute");
?>
    
    <div class="container">
           
      <h1 class="header">Execute</h1> 
      
      <div class="row">
   	  	<div class="span12">
   	  		<div class="well">
   	 			<a href="<?php 
echo Links::render("execution-history");
?>
" class="btn btn-primary btn-large"><i class="icon-time icon-white"></i> Execution History</a>
				<div style="float: right">	
					<div class="input-prepend" style="float: right">
						<span class="add-on">
							<i class="icon-search"></i>
						</span><input id="search-results" type="text" class="span2" maxlength="100" placeholder="Search Results…" disabled="disabled" />
					</div>
				</div>
				<div class="clear"></div>
   	  		</div>
      	</div>
      </div>
      
	  <div class="row">
Exemple #12
0
				<div id="recipe-contents" style="display: none;">
					<div style="float: right; position: relative; top: 0px; right: 0px;">
						<a href="<?php 
if ($recipe->recipe_version === $head->recipe_version) {
    echo Links::render("download-recipe", array($recipe->id));
} else {
    echo Links::render("download-recipe", array($recipe->id, $recipe->recipe_version));
}
?>
						" class="btn btn-medium"><i class="icon-download-alt"></i> Download</a>
						
						<a href="<?php 
if ($recipe->recipe_version === $head->recipe_version) {
    echo Links::render("view-recipe-raw", array($recipe->id));
} else {
    echo Links::render("view-recipe-raw", array($recipe->id, $recipe->recipe_version));
}
?>
						" class="btn btn-medium"><i class="icon-align-left"></i> Raw</a>
					</div>
					<pre class="prettyprint <?php 
echo $code_pretty_lang;
?>
 linenums"><?php 
echo htmlentities($recipe->content);
?>
</pre>
    			</div>
    		</div>
		</div>
	  </div>
Exemple #13
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']));
if (!CSRF::is_valid(1, METHOD_GET)) {
    Error::halt(400, 'bad request', 'Missing required security token.');
}
MongoConnection::connect();
MongoConnection::grid_fs();
MongoConnection::grid_fs_delete(array($_GET['id']));
MongoConnection::close();
Functions::redirect(Links::render("files"));
Exemple #14
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";
$data = array("instance_key" => $_POST['instance_key'], "default_ssh_username" => $_POST['default_ssh_username'], "default_ssh_port" => $_POST['default_ssh_port'], "default_interpreter" => $_POST['default_interpreter'], "timezone_offset" => $_POST['timezone_offset'], "timezone_daylight_savings" => $_POST['timezone_daylight_savings']);
MySQLQueries::edit_settings(json_encode((object) $data));
Functions::redirect(Links::render("settings", array("saved")));
Exemple #15
0
    ?>
" class="btn btn-medium"><i class="icon-download-alt"></i> Download</a> <a href="<?php 
    echo Links::render("view-file-raw", array($file['_id']->__toString()));
    ?>
" class="btn btn-medium"><i class="icon-align-left"></i> Raw</a>
						</div>
						<pre class="prettyprint linenums"><?php 
    echo htmlentities($file['data']);
    ?>
</pre>
					</div>
				<?php 
} else {
    ?>
					<div class="alert alert-grey binary-file">
						<div style="float: right; position: relative; top: -11px; right: -11px;">
							<a href="<?php 
    echo Links::render("download-file", array($file['_id']->__toString()));
    ?>
" class="btn btn-medium"><i class="icon-download-alt"></i> Download</a>
						</div>
						<h3 style="margin-left: 112px; color: #cacaca;">Binary file.</h3>
					</div>
				<?php 
}
?>
    		</div>
		</div>
	  </div>
<?php 
Footer::render(array("code-pretty", "codemirror", "autosize", "zclip", "bootbox", "view-file"));