Exemple #1
0
     $path = '/var/tmp/' . $_GET['file'];
     header('Content-Type: text/json');
     if (filesize($path) < 16 && trim(file_get_contents($path)) == false) {
         echo json_encode("0");
     } else {
         echo json_encode(file_get_contents($path));
     }
     break;
 case 'graph-pop':
     // Generate dynamic graph in new window with descriptive title
     $mycodo_db = $install_path . "/config/mycodo.db";
     $user_db = $install_path . "/config/users.db";
     $note_db = $install_path . "/config/notes.db";
     require $install_path . "/includes/database.php";
     require $install_path . "/includes/functions.php";
     $graph_id = get_graph_cookie('id');
     // Create page title (only create title)
     $sensor_type = $_POST['Generate_Graph_Type'];
     $sensor_span = $_POST['Generate_Graph_Span'];
     if ($sensor_span == "all") {
         $title = "Graph ({$sensor_type}) All Time";
     } else {
         if ($sensor_span == "1 Hour") {
             $time_start = date('Y/m/d-H:i:s', strtotime('-1 hour'));
         } else {
             if ($sensor_span == "3 Hours") {
                 $time_start = date('Y/m/d-H:i:s', strtotime('-3 hour'));
             } else {
                 if ($sensor_span == "6 Hours") {
                     $time_start = date('Y/m/d-H:i:s', strtotime('-6 hour'));
                 } else {
Exemple #2
0
            // Configuration changes
            require $install_path . "/includes/database.php";
            // Reload SQLite database
        }
    }
} else {
    if (isset($_GET['r']) && $_GET['r'] == 1 && (isset($_GET['tab']) && $_GET['tab'] == 'graph')) {
        set_new_graph_id();
    }
}
require $install_path . "/includes/public.php";
// Handle remaining forms
// Retrieve graph-generation variables (must come after running public.php)
$graph_id = get_graph_cookie('id');
$graph_type = get_graph_cookie('type');
$graph_time_span = get_graph_cookie('span');
delete_graphs();
// Delete graph image files if quantity exceeds 20 (delete oldest)
?>
<!doctype html>
<html lang="en" class="no-js">
<head>
    <title>Mycodo</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="robots" content="noindex">
    <link rel="stylesheet" href="css/fonts.css" type="text/css">
    <link rel="stylesheet" href="css/reset.css" type="text/css">
    <link rel="stylesheet" href="css/style.css" type="text/css">
    <script src="js/modernizr.js"></script>
    <script type="text/javascript">