コード例 #1
0
ファイル: functions.php プロジェクト: shabesoglu/pcbsd
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;
}
コード例 #2
0
ファイル: plugininfo.php プロジェクト: aaronraimist/pcbsd
    die("No such app: {$pbi}");
}
// Check if this app is installed
$pkgoutput = syscache_ins_plugin_list();
$pkglist = explode(", ", $pkgoutput);
if (array_search_partial($pbiorigin . " ", $pkglist) !== false) {
    $pbiInstalled = true;
} else {
    $pbiInstalled = false;
}
$hasService = false;
$hasConfig = false;
$pbirunning = false;
// Now check if this jail / plugin is running
if ($pbiInstalled) {
    $ioid = get_iocage_id_from_origin($pbiorigin);
    $jail = $ioid;
    $pbirunning = is_pbicage_running($ioid);
}
if ($pbirunning) {
    $cmd = "jail {$ioid}";
    $sccmd = array("{$cmd} path");
    $response = send_sc_query($sccmd);
    // This is a bit weird, but the pbicage meta-data isn't visible in the jail mount
    // Set it to the "real" location of the data
    $pbicdir = $response["{$cmd} path"] . "/../_/pbicage";
    // Get ipv4 address
    $dccmd = array("iocage getip4 {$ioid}");
    $output = send_dc_cmd($dccmd);
    $oarray = explode(" ", $output["iocage getip4 {$ioid}"]);
    $pbiip4 = $output[0];
コード例 #3
0
ファイル: functions.php プロジェクト: asxbsd/pcbsd
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;
}