require_once dirname(__FILE__) . '/lib/config.php'; require_once dirname(__FILE__) . '/lib/utils.php'; require_once dirname(__FILE__) . '/lib/vboxconnector.php'; // Allow caching of some screenshot data @Header('ETag: "' . $_REQUEST['vm'] . '_' . $_REQUEST['randid'] . '"'); session_cache_limiter('private_no_expire'); // Check for valid session global $_SESSION; session_init(); if (!@$_SESSION['valid']) { return; } // Clean request $_REQUEST = array_merge(@$_GET, @$_POST); $settings = new phpVBoxConfigClass(); $vbox = new vboxconnector(); $vbox->connect(); // Set width. Else assume we want real time updates if VM is running below if ($_REQUEST['width']) { $force_width = $_REQUEST['width']; } try { // Is VM Specified if (!$_REQUEST['vm']) { echo "Please specify a VM to take a screen shot of. E.g. http://webserver/phpvirtualbox/screen.php?vm=VMName"; exit; } $machine = $vbox->vbox->findMachine($_REQUEST['vm']); // Is snapshot specified? if ($_REQUEST['snapshot']) { $snapshot = $machine->findSnapshot($_REQUEST['snapshot']);
case 'getConfig': $settings = new phpVBoxConfigClass(); $response['data']['responseData'] = get_object_vars($settings); $response['data']['responseData']['host'] = parse_url($response['data']['responseData']['location']); $response['data']['responseData']['host'] = $response['data']['responseData']['host']['host']; $response['data']['responseData']['phpvboxver'] = @constant('PHPVBOX_VER'); // Session session_init(); // Hide credentials unset($response['data']['responseData']['username']); unset($response['data']['responseData']['password']); foreach ($response['data']['responseData']['servers'] as $k => $v) { $response['data']['responseData']['servers'][$k] = array('name' => $v['name']); } // Vbox version $vbox = new vboxconnector(); $response['data']['responseData']['version'] = $vbox->getVersion(); $response['data']['responseData']['hostOS'] = $vbox->vbox->host->operatingSystem; $response['data']['responseData']['DSEP'] = $vbox->getDsep(); $response['data']['responseData']['groupDefinitionKey'] = $settings->phpVboxGroups ? vboxconnector::phpVboxGroupKey : 'GUI/GroupDefinitions'; $response['data']['success'] = true; break; /* * * USER FUNCTIONS FOLLOW * */ /* * Pass login to authentication module. */ /*
# Turn off PHP notices error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING); global $vbox, $localbrowser, $allowed; require_once dirname(__FILE__) . '/lib/config.php'; require_once dirname(__FILE__) . '/lib/utils.php'; require_once dirname(__FILE__) . '/lib/vboxconnector.php'; error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_WARNING); session_init(); if (!$_SESSION['valid']) { return; } /* * Get Settings */ $settings = new phpVBoxConfigClass(); $vbox = new vboxconnector(); $vbox->connect(); /* * Clean request */ global $request; $request = clean_request(); /* * Determine directory separator */ $localbrowser = @$settings->browserLocal; if ($localbrowser) { define('DSEP', DIRECTORY_SEPARATOR); } else { define('DSEP', $vbox->getDsep()); }
/** * * Remove the user $user * @param string $user Username to remove */ function deleteUser($user) { // Use main / auth server $vbox = new vboxconnector(true); $vbox->connect(); $vbox->vbox->setExtraData('phpvb/users/' . $user . '/pass', ''); $vbox->vbox->setExtraData('phpvb/users/' . $user . '/admin', ''); $vbox->vbox->setExtraData('phpvb/users/' . $user, ''); }