diff --git a/www/phpvirtualbox-legacy/Makefile b/www/phpvirtualbox-legacy/Makefile index 623174262c8e..efaccedd0017 100644 --- a/www/phpvirtualbox-legacy/Makefile +++ b/www/phpvirtualbox-legacy/Makefile @@ -1,40 +1,41 @@ PORTNAME= phpvirtualbox DISTVERSION= 5.2-1 PORTREVISION= 5 CATEGORIES= www PKGNAMESUFFIX= -legacy MAINTAINER= vbox@FreeBSD.org COMMENT= AJAX Web Interface for VirtualBox WWW= https://sourceforge.net/projects/phpvirtualbox/ LICENSE= GPLv3 USES= dos2unix php USE_PHP= session simplexml soap xml NO_ARCH= yes NO_BUILD= yes USE_GITHUB= yes DOS2UNIX_REGEX= .*\.(php|txt|js|css|html) WWWDIR= ${PREFIX}/www/${PORTNAME}${PKGNAMESUFFIX} ETCDIR= ${WWWDIR} -EXTRA_PATCHES+= ${.CURDIR}/../phpvirtualbox/files/patch-php8 +EXTRA_PATCHES+= ${.CURDIR}/../phpvirtualbox/files/patch-php8 \ + ${.CURDIR}/../phpvirtualbox/files/patch-panes_mediumEncryptionPasswords.html post-patch: @${MV} ${WRKSRC}/phpvirtualbox.conf ${WRKSRC}/phpvirtualbox-legacy.conf @${REINPLACE_CMD} -e 's#Alias /phpvirtualbox#Alias /phpvirtualbox-legacy#' \ -e 's#/usr/share/phpvirtualbox#${WWWDIR}#g' \ ${WRKSRC}/phpvirtualbox-legacy.conf do-install: ${MKDIR} ${STAGEDIR}${WWWDIR} (cd ${WRKSRC}/ && ${COPYTREE_SHARE} "*" ${STAGEDIR}${WWWDIR} \ "-not -name *.orig -not -name config.php-example") ${INSTALL_DATA} ${WRKSRC}/config.php-example \ ${STAGEDIR}${WWWDIR}/config.php.sample .include diff --git a/www/phpvirtualbox-legacy/files/patch-panes_mediumEncryptionPasswords.html b/www/phpvirtualbox-legacy/files/patch-panes_mediumEncryptionPasswords.html deleted file mode 100644 index 75142aed7747..000000000000 --- a/www/phpvirtualbox-legacy/files/patch-panes_mediumEncryptionPasswords.html +++ /dev/null @@ -1,41 +0,0 @@ ---- panes/mediumEncryptionPasswords.html.orig 2017-07-27 16:54:58 UTC -+++ panes/mediumEncryptionPasswords.html -@@ -15,6 +15,7 @@ - Status - ID - Password -+ Clear on suspend - - - -@@ -37,9 +38,12 @@ function vboxMediumEncryptionPasswordAdd - .append($('') - .append( - valid ? '*****' : -- $('').attr({'type':'password','style':'width:95%'}).addClass('vboxText') -+ $('').attr({'type':'password','style':'width:90%'}).addClass('vboxText') - ) - ) -+ .append($('') -+ .append($('').attr({'type':'checkbox', 'checked':'checked'})) -+ ) - .appendTo($('#vboxMediumEncryptionPasswordList')) - } - -@@ -55,7 +59,8 @@ function vboxMediumEncryptionPasswordsGe - continue; - encryptionPWs.push({ - 'id': $(rowlist[i]).data('vboxEncryptionId'), -- 'password': $(rowlist[i]).find('input').first().val() -+ 'password': $(rowlist[i]).find('input[type="password"]').first().val(), -+ 'clearOnSuspend': $(rowlist[i]).find('input[type="checkbox"]').first().is(':checked') ? '1' : '0' - }); - - } -@@ -75,4 +80,4 @@ function vboxMediumEncryptionPasswordsVa - }); - return valid; - } -- -\ No newline at end of file -+ diff --git a/www/phpvirtualbox/files/patch-panes_mediumEncryptionPasswords.html b/www/phpvirtualbox/files/patch-panes_mediumEncryptionPasswords.html index 75142aed7747..3e8a7c62dfb7 100644 --- a/www/phpvirtualbox/files/patch-panes_mediumEncryptionPasswords.html +++ b/www/phpvirtualbox/files/patch-panes_mediumEncryptionPasswords.html @@ -1,41 +1,34 @@ --- panes/mediumEncryptionPasswords.html.orig 2017-07-27 16:54:58 UTC +++ panes/mediumEncryptionPasswords.html @@ -15,6 +15,7 @@ Status ID Password + Clear on suspend @@ -37,9 +38,12 @@ function vboxMediumEncryptionPasswordAdd .append($('') .append( valid ? '*****' : - $('').attr({'type':'password','style':'width:95%'}).addClass('vboxText') + $('').attr({'type':'password','style':'width:90%'}).addClass('vboxText') ) ) + .append($('') + .append($('').attr({'type':'checkbox', 'checked':'checked'})) + ) .appendTo($('#vboxMediumEncryptionPasswordList')) } @@ -55,7 +59,8 @@ function vboxMediumEncryptionPasswordsGe continue; encryptionPWs.push({ 'id': $(rowlist[i]).data('vboxEncryptionId'), - 'password': $(rowlist[i]).find('input').first().val() + 'password': $(rowlist[i]).find('input[type="password"]').first().val(), + 'clearOnSuspend': $(rowlist[i]).find('input[type="checkbox"]').first().is(':checked') ? '1' : '0' }); } -@@ -75,4 +80,4 @@ function vboxMediumEncryptionPasswordsVa - }); - return valid; - } -- -\ No newline at end of file -+ diff --git a/www/phpvirtualbox/files/patch-php8 b/www/phpvirtualbox/files/patch-php8 index 318b3c4b5a58..52fe5a6a5b12 100644 --- a/www/phpvirtualbox/files/patch-php8 +++ b/www/phpvirtualbox/files/patch-php8 @@ -1,255 +1,248 @@ --- endpoints/api.php.orig 2024-06-07 15:46:20 UTC +++ endpoints/api.php @@ -334,6 +334,9 @@ try { // Just append to $vbox->errors and let it get // taken care of below + if(!isset($vbox)) { + $vbox = new stdClass(); + } if(!$vbox || !$vbox->errors) { $vbox->errors = array(); } @@ -342,7 +345,7 @@ try { // Add any messages -if($vbox && count($vbox->messages)) { +if($vbox && isset($vbox->messages)?count($vbox->messages):false) { foreach($vbox->messages as $m) $response['messages'][] = 'vboxconnector('.$request['fn'] .'): ' . $m; } @@ -360,7 +363,7 @@ if($vbox && $vbox->errors) { if($e->getCode() == vboxconnector::PHPVB_ERRNO_CONNECT && isset($vbox->settings)) $d .= "\n\nLocation:" . $vbox->settings->location; - $response['messages'][] = htmlentities($e->getMessage()).' ' . htmlentities($details); + $response['messages'][] = htmlentities($e->getMessage()). htmlentities(' '. $details); $response['errors'][] = array( 'error'=> ($e->getCode() & vboxconnector::PHPVB_ERRNO_HTML ? $e->getMessage() : htmlentities($e->getMessage())), --- endpoints/jqueryFileTree.php.orig 2024-06-07 15:46:20 UTC +++ endpoints/jqueryFileTree.php @@ -223,6 +223,8 @@ function getdir($dir, $dirsOnly=false, $recurse=array( */ function getdir($dir, $dirsOnly=false, $recurse=array()) { + global $allowed_exts; + if(!$dir) $dir = DSEP; $entries = getDirEntries($dir, $dirsOnly); @@ -251,9 +253,9 @@ function getdir($dir, $dirsOnly=false, $recurse=array( // Push file on to stack } else { - $ext = strtolower(preg_replace('/^.*\./', '', $file)); + $ext = strtolower(preg_replace('/^.*\./', '', $path)); - if(count($allowed) && !$allowed['.'.$ext]) continue; + if(count($allowed_exts) && !$allowed_exts['.'.$ext]) continue; array_push($dirents, file_entry($path)); } --- endpoints/lib/config.php.orig 2024-06-07 15:46:20 UTC +++ endpoints/lib/config.php @@ -141,6 +141,10 @@ class phpVBoxConfigClass { */ var $eventListenerTimeout = 20; + var $enableHDFlushConfig = false; + + var $authMaster = false; + /** * Read user configuration, apply defaults, and do some sanity checking * @see vboxconnector --- endpoints/lib/language.php.orig 2024-06-07 15:46:20 UTC +++ endpoints/lib/language.php @@ -73,6 +73,8 @@ class __vbox_language { $xmlObj = simplexml_load_string(@file_get_contents(VBOX_BASE_LANG_DIR.'/'.$lang.'.xml')); $arrXml = $this->objectsIntoArray($xmlObj); + if(!array_key_exists('context',$arrXml)) return; + $lang = array(); if(!@$arrXml['context'][0]) $arrXml['context'] = array($arrXml['context']); foreach($arrXml['context'] as $c) { --- endpoints/lib/vboxServiceWrappers.php.orig 2024-06-07 15:46:20 UTC +++ endpoints/lib/vboxServiceWrappers.php @@ -108,7 +108,7 @@ abstract class VBox_Collection implements ArrayAccess, } /** ArrayAccess Functions **/ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if ($value instanceof $this->_interfaceName) { @@ -127,49 +127,50 @@ abstract class VBox_Collection implements ArrayAccess, } } - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->_objects[$offset]); } - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->_objects[$offset]); } - public function offsetGet($offset) + public function offsetGet($offset): mixed { return isset($this->_objects[$offset]) ? $this->_objects[$offset] : null; } /** Iterator Functions **/ - public function rewind() + public function rewind(): void { reset($this->_objects); } - public function current() + public function current(): mixed { return current($this->_objects); } - public function key() + public function key(): mixed { return key($this->_objects); } + #[\ReturnTypeWillChange] public function next() { return next($this->_objects); } - public function valid() + public function valid(): bool { return ($this->current() !== false); } /** Countable Functions **/ - public function count() + public function count(): int { return count($this->_objects); } --- endpoints/lib/vboxconnector.php.orig 2024-06-07 15:46:20 UTC +++ endpoints/lib/vboxconnector.php @@ -112,6 +112,8 @@ class vboxconnector { */ var $dsep = null; + var $client = null; + /** * Obtain configuration settings and set object vars * @param boolean $useAuthMaster use the authentication master obtained from configuration class @@ -387,7 +389,8 @@ class vboxconnector { // The amount of time we will wait for events is determined by // the amount of listeners - at least half a second - $listenerWait = max(100,intval(500/count($this->persistentRequest['vboxEventListeners']))); + $listenerCount = count($this->persistentRequest['vboxEventListeners']); + $listenerWait = max(100,intval(500/($listenerCount > 0 ? $listenerCount : 1))); } // Get events from each configured event listener @@ -5660,11 +5663,6 @@ class vboxconnector { } } catch (Exception $null) {} $m->releaseRemote(); - - // Attempt to UTF-8 encode string or json_encode may choke - // and return an empty string - if(function_exists('utf8_encode')) - return utf8_encode($log); return $log; } -@@ -5855,4 +5853,4 @@ class vboxconnector { - - return @$rcodes['0x'.strtoupper(dechex($c))] . ' (0x'.strtoupper(dechex($c)).')'; - } --} -\ No newline at end of file -+} --- endpoints/screen.php.orig 2024-06-07 15:46:20 UTC +++ endpoints/screen.php @@ -87,13 +87,13 @@ try { // Let the browser cache images for 3 seconds $ctime = 0; - if(strpos($_SERVER['HTTP_IF_NONE_MATCH'],'_')) { - $ctime = preg_replace("/.*_/",str_replace('"','',$_SERVER['HTTP_IF_NONE_MATCH'])); - } else if(strpos($_ENV['HTTP_IF_NONE_MATCH'],'_')) { - $ctime = preg_replace("/.*_/",str_replace('"','',$_ENV['HTTP_IF_NONE_MATCH'])); - } else if(strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'],'GMT')) { + if(strpos($_SERVER['HTTP_IF_NONE_MATCH'] ?? '','_')) { + $ctime = preg_replace("/.*_/","",str_replace('"','',$_SERVER['HTTP_IF_NONE_MATCH'])); + } else if(strpos($_ENV['HTTP_IF_NONE_MATCH'] ?? '','_')) { + $ctime = preg_replace("/.*_/","",str_replace('"','',$_ENV['HTTP_IF_NONE_MATCH'])); + } else if(strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'] ?? '','GMT')) { $ctime = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']); - } else if(strpos($_ENV['HTTP_IF_MODIFIED_SINCE'],'GMT')) { + } else if(strpos($_ENV['HTTP_IF_MODIFIED_SINCE'] ?? '','GMT')) { $ctime = strtotime($_ENV['HTTP_IF_MODIFIED_SINCE']); } @@ -164,13 +164,13 @@ try { // Let the browser cache saved state images $ctime = 0; - if(strpos($_SERVER['HTTP_IF_NONE_MATCH'],'_')) { - $ctime = preg_replace("/.*_/",str_replace('"','',$_SERVER['HTTP_IF_NONE_MATCH'])); - } else if(strpos($_ENV['HTTP_IF_NONE_MATCH'],'_')) { - $ctime = preg_replace("/.*_/",str_replace('"','',$_ENV['HTTP_IF_NONE_MATCH'])); - } else if(strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'],'GMT')) { + if(strpos($_SERVER['HTTP_IF_NONE_MATCH'] ?? '','_')) { + $ctime = preg_replace("/.*_/","",str_replace('"','',$_SERVER['HTTP_IF_NONE_MATCH'])); + } else if(strpos($_ENV['HTTP_IF_NONE_MATCH'] ?? '','_')) { + $ctime = preg_replace("/.*_/","",str_replace('"','',$_ENV['HTTP_IF_NONE_MATCH'])); + } else if(strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'] ?? '','GMT')) { $ctime = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']); - } else if(strpos($_ENV['HTTP_IF_MODIFIED_SINCE'],'GMT')) { + } else if(strpos($_ENV['HTTP_IF_MODIFIED_SINCE'] ?? '','GMT')) { $ctime = strtotime($_ENV['HTTP_IF_MODIFIED_SINCE']); } --- panes/settingsDisplay.html.orig 2024-06-07 15:46:20 UTC +++ panes/settingsDisplay.html @@ -77,9 +77,9 @@ --> Authentication Method: --- panes/settingsNetwork.html.orig 2024-06-07 15:46:20 UTC +++ panes/settingsNetwork.html @@ -320,7 +320,7 @@ function vboxSettingsUpdateNetworkOptions(sel) { } // Special case for Internal, Generic, and VDE network selects - if(sel.value == 'Internal' || sel.value == 'VDE' || sel.value == 'Generic' || sel.value == 'Bridged') { + if(sel.value == 'Internal' || sel.value == 'VDE' || sel.value == 'Generic') { $(nsel).jec(); }