示例#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";
$result = MySQLQueries::get_settings();
$settings = null;
$result = MySQLQueries::get_settings();
$row = MySQLConnection::fetch_object($result);
if (isset($row->data)) {
    $row->data = json_decode($row->data);
}
$settings = $row;
Functions::format_dates($settings);
echo json_encode($settings);
示例#2
0
# 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;
?>
</h1> 
     	 
示例#3
0
 public static function format_dates($row)
 {
     if (!isset($row) || empty($row)) {
         return;
     }
     foreach ($row as $property => $value) {
         if (is_object($value) || is_array($value)) {
             Functions::format_dates($value);
         } else {
             if (DateTime::createFromFormat('Y-m-d G:i:s', $value) !== FALSE) {
                 $row->{$property} = date(DATE_FORMAT, strtotime($value));
             }
         }
     }
     return $row;
 }
示例#4
0
$_SERVER['SCRIPT_NAME'] !== "/controller.php" ? require_once __DIR__ . "/classes/Requires.php" : (Links::$pretty = true);
//Get recipes
$recipes = array();
$result = MySQLQueries::get_recipes();
while ($row = MySQLConnection::fetch_object($result)) {
    //Calculate Statistics
    $row->lines = substr_count($row->content, "\n") + 1;
    $row->length = Functions::format_bytes(strlen($row->content));
    $recipes[$row->id] = $row;
}
//Get number of versions for all recipes
$result = MySQLQueries::get_number_of_recipe_versions();
while ($row = MySQLConnection::fetch_object($result)) {
    $recipes[$row->id]->number_of_versions = $row->count;
}
$recipes = Functions::format_dates($recipes);
Header::set_title("Commando.io - Recipes");
Header::render();
Navigation::render("recipes");
?>
    
    <div class="container">
           
      <h1 class="header">Recipes</h1> 
      
	  <div class="row">
   	  	<div class="span12">
   	  		<div class="well">
   	  			<a href="<?php 
echo Links::render("add-recipe");
?>
示例#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['id']));
$result = MySQLQueries::get_group($_POST['id']);
$row = MySQLConnection::fetch_object($result);
$row = Functions::format_dates($row);
echo json_encode($row);
示例#6
0
}
$recipe = Functions::format_dates($recipe);
//Get recipe versions
$recipe_versions = array();
$result = MySQLQueries::get_recipe_versions($_GET['param1']);
while ($row = MySQLConnection::fetch_object($result)) {
    ////
    // Move head to the top of the array
    ////
    if ($row->id === $head->recipe_version) {
        array_unshift($recipe_versions, $row);
    } else {
        $recipe_versions[] = $row;
    }
}
$recipe_versions = Functions::format_dates($recipe_versions, "l, F j, Y");
//Calculate Statistics
$recipe->lines = substr_count($recipe->content, "\n") + 1;
$recipe->length = Functions::format_bytes(strlen($recipe->content));
//Get the correct language for code-pretty
switch ($recipe->interpreter) {
    case 'shell':
        $code_pretty_lang = "lang-sh";
        break;
    case 'bash':
        $code_pretty_lang = "lang-bsh";
        break;
    case 'node.js':
        $code_pretty_lang = "lang-js";
        break;
    case 'perl':