Beispiel #1
0
function parse_plugin_details($origin, $col, $showRemoval = false, $filter = true)
{
    global $totalCols;
    global $SCERROR;
    global $sysType;
    global $cage_installed;
    $sccmd = array("cage-summary {$origin}");
    $response = send_sc_query($sccmd);
    $pbiarray = $response["cage-summary {$origin}"];
    // Output format (4/7/15): [origin, name, iconpath, arch, fbsdver]
    $pbiname = $pbiarray[1];
    $pbiicon = $pbiarray[2];
    $pbiarch = $pbiarray[3];
    $pbifbsdver = $pbiarray[4];
    // If no match, return false
    if (empty($pbiname) or $pbiname == "{$SCERROR}") {
        return 1;
    }
    // Set our $cage_installed only once
    if (empty($cage_installed)) {
        $sccmd = array("jail stoppedcages", "jail runningcages");
        $response = send_sc_query($sccmd);
        $cage_installed[] = $response["jail stoppedcages"];
        $cage_installed[] = $response["jail runningcages"];
    }
    $pbiinstalled = false;
    if (array_search_partial($origin . " ", $cage_installed) !== false) {
        $pbiinstalled = true;
    }
    if ($col == 1) {
        print "<tr>\n";
    }
    // Get our values from this line
    print "  <td>\n";
    if (strlen($pbiname) > 25) {
        $pbiname = substr($pbiname, 0, 14) . "..";
    }
    $appbusy = false;
    $dStatus = getDispatcherStatus();
    foreach ($dStatus as $curStatus) {
        if (strpos($curStatus, "iocage fetch {$origin}") !== false) {
            $appbusy = true;
            break;
        }
        if (strpos($curStatus, "iocage destroy {$origin}") !== false) {
            $appbusy = true;
            break;
        }
    }
    if ($appbusy) {
        print "<div id='item-working'><img style=\"background-color: Transparent;background-repeat:no-repeat;border: none;float:right;\" height=22 width=22 src=\"images/working.gif\" title=\"Working...\"></div>";
    } else {
        // Get the divid for this entry
        $appdivid = "button-" . str_replace("/", "-", $origin);
        // Is this app installed?
        if ($pbiinstalled == true) {
            $ioid = get_iocage_id_from_origin($origin);
            print "<div id='" . $appdivid . "'><button title=\"Delete {$pbiname}\" style=\"background-color: Transparent;background-repeat:no-repeat;border: none;float:right;\" onclick=\"delAppConfirmTiny('" . $pbiname . "','" . $origin . "','" . $ioid . "','" . $appdivid . "')\"><img src=\"/images/application-exit.png\" height=22 width=22></button></div>\n";
        } else {
            $sccmd = array("pbi cage " . $origin . " git");
            $response = send_sc_query($sccmd);
            $ghrepo = $response["pbi cage " . $origin . " git"];
            print "<div id='" . $appdivid . "'><button title=\"Install {$pbiname}\" style=\"background-color: Transparent;background-repeat:no-repeat;border: none;float:right;\" onclick=\"addAppConfirmTiny('" . $pbiname . "','" . $origin . "','" . $ghrepo . "','" . $appdivid . "')\"><img src=\"/images/install.png\" height=22 width=22></button></div>\n";
        }
    }
    print "    <a href=\"/?p=plugininfo&app=" . rawurlencode($origin) . "\" title=\"{$pbicomment}\"><img border=0 align=\"center\" height=48 width=48 src=\"/images/pbiicon.php?i={$pbiicon}\" style=\"float:left;\"></a>\n";
    print "    <a href=\"/?p=plugininfo&app=" . rawurlencode($origin) . "\" style=\"margin-left:5px;text-width:100%\">{$pbiname}</a><br>\n";
    print "  </td>\n";
    if ($col == $totalCols) {
        print "</tr>\n";
    }
    return 0;
}
Beispiel #2
0
    $pbiip4 = $output[0];
    if (strstr($pbiip4, "|") !== false) {
        $pbiip4 = substr(strstr($pbiip4, "|"), 1);
        $pbiip4 = substr($pbiip4, 0, strpos($pbiip4, "/"));
    }
    // Check if this app has service details
    if (file_exists($pbicdir . "/service-start") or file_exists($pbicdir . "/service-configure")) {
        $hasService = true;
    }
    // Check if this app has config files to edit
    if (file_exists($pbicdir . "/service-config.json")) {
        $hasConfig = true;
    }
}
// Get the current work queue status of the dispatcher
$dStatus = getDispatcherStatus();
?>
   
<br>
<table class="pbidescription" style="width:<?php 
if ($deviceType == "computer") {
    echo "600px";
} else {
    echo "100%";
}
?>
">
  <tr>
    <th colspan=3>
      <?php 
echo "{$pbiname}";
Beispiel #3
0
function parse_plugin_details($origin, $col, $showRemoval = false, $filter = true)
{
    global $sc;
    global $jailUrl;
    global $totalCols;
    global $SCERROR;
    global $sysType;
    global $cage_installed;
    exec("{$sc} " . escapeshellarg("cage-summary {$origin}"), $pbiarray);
    $pbiarray = explode("::::", $pbiarray[0]);
    //only one line output based on cmd above
    // Output format (4/7/15): [origin, name, iconpath, arch, fbsdver]
    $pbiname = $pbiarray[1];
    $pbiicon = $pbiarray[2];
    $pbiarch = $pbiarray[3];
    $pbifbsdver = $pbiarray[4];
    // If no match, return false
    if (empty($pbiname) or $pbiname == "{$SCERROR}") {
        return 1;
    }
    // Set our $cage_installed only once
    if (empty($cage_installed)) {
        exec("{$sc} " . escapeshellarg("jail cages"), $cage_installed);
    }
    $pbiinstalled = false;
    if (array_search_partial($origin . " ", $cage_installed) !== false) {
        $pbiinstalled = true;
    }
    if ($col == 1) {
        print "<tr>\n";
    }
    // Get our values from this line
    print "  <td>\n";
    if (strlen($pbiname) > 25) {
        $pbiname = substr($pbiname, 0, 14) . "..";
    }
    $appbusy = false;
    $dStatus = getDispatcherStatus();
    foreach ($dStatus as $curStatus) {
        if (strpos($curStatus, "iocage pull {$origin}") !== false) {
            $appbusy = true;
            break;
        }
        if (strpos($curStatus, "iocage destroy {$origin}") !== false) {
            $appbusy = true;
            break;
        }
    }
    if ($appbusy) {
        print "<img style=\"background-color: Transparent;background-repeat:no-repeat;border: none;float:right;\" height=22 width=22 src=\"images/working.gif\" title=\"Working...\">";
        echo "<script>setTimeout(function () { location.reload(1); }, 8000);</script>";
    } else {
        // Is this app installed?
        if ($pbiinstalled == true) {
            $ioid = get_iocage_id_from_origin($origin);
            print "    <button title=\"Delete {$pbiname}\" style=\"background-color: Transparent;background-repeat:no-repeat;border: none;float:right;\" onclick=\"delJailConfirm('" . $pbiname . "','" . rawurlencode($origin) . "','" . $ioid . "')\"><img src=\"/images/application-exit.png\" height=22 width=22></button>\n";
        } else {
            exec("{$sc} " . escapeshellarg("pbi cage " . $origin . " git"), $ghrepo);
            print "    <button title=\"Install {$pbiname}\" style=\"background-color: Transparent;background-repeat:no-repeat;border: none;float:right;\" onclick=\"addJailConfirm('" . $pbiname . "','" . rawurlencode($origin) . "','" . rawurlencode($ghrepo[0]) . "')\"><img src=\"/images/install.png\" height=22 width=22></button>\n";
        }
    }
    print "    <a href=\"/?p=plugininfo&app=" . rawurlencode($origin) . "\" title=\"{$pbicomment}\"><img border=0 align=\"center\" height=48 width=48 src=\"/images/pbiicon.php?i={$pbiicon}\" style=\"float:left;\"></a>\n";
    print "    <a href=\"/?p=plugininfo&app=" . rawurlencode($origin) . "\" style=\"margin-left:5px;text-width:100%\">{$pbiname}</a><br>\n";
    print "  </td>\n";
    if ($col == $totalCols) {
        print "</tr>\n";
    }
    return 0;
}