}
if (isset($_POST['mass_start'])) {
    if (isset($_POST['mselect'])) {
        foreach ($_POST['mselect'] as $streamids) {
            start_stream($streamids);
        }
    }
    $message['type'] = "success";
    $message['message'] = "Streams started";
}
if (isset($_POST['mass_stop'])) {
    if (isset($_POST['mselect'])) {
        foreach ($_POST['mselect'] as $streamids) {
            stop_stream($streamids);
        }
    }
    $message['type'] = "success";
    $message['message'] = "Streams stopped";
}
if (isset($_GET['running']) && $_GET['running'] == 1) {
    $title = "Running Streams";
    $stream = Stream::where('status', '=', 1)->get();
} else {
    if (isset($_GET['running']) && $_GET['running'] == 2) {
        $title = "Stopped Streams";
        $stream = Stream::where('status', '=', 2)->get();
    } else {
        $stream = Stream::all();
    }
}
echo $template->view()->make('streams')->with('streams', $stream)->with('message', $message)->with('title', $title)->render();
Beispiel #2
0
<?php

/**
 * Created by Tyfix 2015
 */
include 'config.php';
logincheck();
//Create settings if not exists
$settings = Setting::first();
if (is_null($settings)) {
    $settings = new Setting();
    $settings->webip = $_SERVER['SERVER_ADDR'];
    $settings->webport = 8000;
    $settings->save();
}
$all = Stream::all()->count();
$online = Stream::where('running', '=', 1)->count();
$offline = Stream::where('running', '=', 0)->count();
//space
$space_pr = 0;
$space_free = round(disk_free_space('/') / 1048576, 1);
$space_total = round(disk_total_space('/') / 1048576, 1);
$space_pr = (int) (100 * ($space_free / $space_total));
if (stristr(PHP_OS, 'win')) {
    //cpu
    $cpu_usage = 2;
    $cpu_total = 10;
    $cpu_pr = $cpu_usage / $cpu_total * 100;
    //memory
    $mem_usage = 20;
    $mem_total = 120;