Ejemplo n.º 1
0
function do_service_action()
{
    global $pbiorigin;
    $jail = "#system";
    $jailUrl = "__system__";
    $sname = $_GET['service'];
    $sscript = $_GET['servicerc'];
    $action = $_GET['action'];
    if (empty($sname) or empty($sscript) or empty($action)) {
        return;
    }
    $output = run_cmd("service {$action} {$sname} {$sscript} {$jailUrl}");
    if ($action == "start") {
        echo "Started {$sname} on {$jail}<br>";
    }
    if ($action == "stop") {
        echo "Stopped {$sname} on {$jail}<br>";
    }
    if ($action == "restart") {
        echo "Restarted {$sname} on {$jail}<br>";
    }
    $newUrl = http_build_query($_GET);
    $app = str_replace("/", "%2F", $app);
    $newUrl = str_replace("&service={$sname}", "", $newUrl);
    $newUrl = str_replace("service={$sname}", "", $newUrl);
    $newUrl = str_replace("&servicerc={$sscript}", "", $newUrl);
    $newUrl = str_replace("servicerc={$sscript}", "", $newUrl);
    $newUrl = str_replace("&action={$action}", "", $newUrl);
    $newUrl = str_replace("action={$action}", "", $newUrl);
    hideurl("?" . $newUrl);
}
Ejemplo n.º 2
0
function queueDeleteApp()
{
    global $jail;
    global $jailUrl;
    $app = $_GET['deleteApp'];
    $type = $_GET['deleteAppCmd'];
    if (!empty($app) and !empty($type) and !empty($jail)) {
        run_cmd("queue {$type} {$app} delete {$jailUrl}");
    }
    // Now we can remove those values from the URL
    $newUrl = http_build_query($_GET);
    $app = str_replace("/", "%2F", $app);
    $newUrl = str_replace("&deleteApp={$app}", "", $newUrl);
    $newUrl = str_replace("deleteApp={$app}", "", $newUrl);
    $newUrl = str_replace("&deleteAppCmd={$type}", "", $newUrl);
    $newUrl = str_replace("deleteAppCmd={$type}", "", $newUrl);
    hideurl("?" . $newUrl);
}
Ejemplo n.º 3
0
function do_service_action()
{
    global $pbiorigin;
    global $sc;
    global $jail;
    global $jailUrl;
    $sname = $_GET['service'];
    $sscript = $_GET['servicerc'];
    $action = $_GET['action'];
    if (empty($sname) or empty($sscript) or empty($action)) {
        return;
    }
    if ($jail == "#system") {
        $output = run_cmd("service {$action} {$sname} {$sscript} {$jailUrl}");
    } else {
        // Get jail ID
        exec("{$sc} " . escapeshellarg("jail " . $jail . " id"), $jarray);
        $jid = $jarray[0];
        $output = run_cmd("service {$action} {$sname} {$sscript} {$jid}");
    }
    if ($action == "start") {
        echo "Started {$sname} on {$jail}<br>";
    }
    if ($action == "stop") {
        echo "Stopped {$sname} on {$jail}<br>";
    }
    if ($action == "restart") {
        echo "Restarted {$sname} on {$jail}<br>";
    }
    $newUrl = http_build_query($_GET);
    $app = str_replace("/", "%2F", $app);
    $newUrl = str_replace("&service={$sname}", "", $newUrl);
    $newUrl = str_replace("service={$sname}", "", $newUrl);
    $newUrl = str_replace("&servicerc={$sscript}", "", $newUrl);
    $newUrl = str_replace("servicerc={$sscript}", "", $newUrl);
    $newUrl = str_replace("&action={$action}", "", $newUrl);
    $newUrl = str_replace("action={$action}", "", $newUrl);
    hideurl("?" . $newUrl);
}
Ejemplo n.º 4
0
      // Time to queue up some updates for the requested target
      $updateTarget=$_GET['updateTarget'];
      if ( $updateTarget == "__system__")
        $updateTargetName="#system";
      else
        $updateTargetName="$updateTarget";

      // Queue it up now
      run_cmd("pkgupdate $updateTarget");

      // Now we can remove those values from the URL
      $newUrl=http_build_query($_GET);
      $app=str_replace("/", "%2F", $app);
      $newUrl=str_replace("&updateTarget=$updateTarget", "", $newUrl);
      $newUrl=str_replace("updateTarget=$updateTarget", "", $newUrl);
      hideurl("?".$newUrl);
   }

   // Did the user request log files?
   if ( ! empty($_GET['log']) )
   {
      $logoutput=run_cmd("log ". $_GET['log']);

?>

<h1>Action Log (<a href="?p=<?php 
echo $newpage;
?>
">Back</a>)</h1>
<br>
<table class="status" style="width:768px">
Ejemplo n.º 5
0
    $tjail = $_GET['toggle'];
    $sjail = $_GET['status'];
    if ($sjail == "Running") {
        $dccmd = array("iocage stop {$tjail}");
        send_dc_cmd($dccmd);
    } else {
        $dccmd = array("iocage start {$tjail}");
        send_dc_cmd($dccmd);
    }
    hideurl("/?p=plugininfo");
}
if (!empty($_GET['autostart'])) {
    $tjail = $_GET['autostart'];
    $dccmd = array("iocage set boot=on {$tjail}");
    send_dc_cmd($dccmd);
    hideurl();
}
/////////////////////////////////////////////////////
function parse_service_config()
{
    global $pbicdir;
    global $pbiorigin;
    global $pbiindexdir;
    global $pbiip4;
    global $ioid;
    $lines = file($pbicdir . "/service-configure");
    foreach ($lines as $line_num => $line) {
        $cline = trim($line);
        if (empty($cline)) {
            continue;
        }
Ejemplo n.º 6
0
function queueDeletePlugin()
{
    $ioid = $_GET['deletePlugin'];
    $app = $_GET['app'];
    if (!empty($ioid)) {
        $dccmd = array("queue iocage destroy {$app} {$ioid}");
        send_dc_cmd($dccmd);
    }
    // Now we can remove those values from the URL
    $newUrl = http_build_query($_GET);
    $newUrl = str_replace("&deletePlugin={$ioid}", "", $newUrl);
    $newUrl = str_replace("deletePlugin={$ioid}", "", $newUrl);
    hideurl("?" . $newUrl);
}