} else { print " <td><a href=\"/?p=jails&toggle={$jail}&status={$status}\" style=\"color: red; text-decoration: underline;\">{$status}</a></td>\n"; } if ($status == "Running") { $dccmd = array("iocage getip4 {$jail}"); $response = send_dc_cmd($dccmd); $jip = $response["iocage getip4 {$jail}"]; print " <td>{$jip}</td>\n"; } else { print " <td></td>\n"; } print "</tr>\n"; } // Get the jail list unset($jailoutput); $jailoutput = get_jail_list(true); // No jails, lets display a intro page if (empty($jailoutput[0]) and empty($jailoutput[1])) { ?> <h1>Welcome to the Jail Manager!</h1> <br> <p>This manager will assist you in the creation and management of jails on this machine. To get started, let us first <a href="/?p=jailcreate" style="text-decoration: underline;">create a new jail.</a></p><br> <center><img src="/images/warden.png"></center> <?php } else { if ($noJails == "YES") { echo "<br> -- No jails are running! Please start a jail to browse the AppCafe -- <br><br>"; } // We have jails to display ?>
echo "</td></tr>"; // No log file showing, show all logs } else { // Lets check for updates first $pkgUpdates=false; // Check if we can prod local system for updates $larray = array(); if ( $sysType != "APPLIANCE" ) $larray[] = "#system"; // Build list of jails $jailoutput = get_jail_list(); $running=$jailoutput[0]; $rarray = explode( ", ", $running); // Combine the arrays $carray = array_merge($larray, $rarray); foreach ($carray as $jname) { if ( empty($jname) ) continue; // Sanitize the names if ( $jname == "#system" ) { $target="Local System"; $targetUrl="__system__"; } else {
function get_default_jail() { global $jail; global $jailUrl; global $sysType; // If not in appliance mode, grab the first jail if ($sysType != "APPLIANCE") { $jail = "#system"; $jailUrl = "__system__"; return 0; } // No local system, get first jail in list $jailoutput = get_jail_list(); $running = $jailoutput[0]; $rarray = explode(", ", $running); if (!empty($rarray[0])) { $jail = $rarray[0]; $jailUrl = $rarray[0]; return 0; } return 1; }