summaryrefslogtreecommitdiff
path: root/www/phpvirtualbox/files/patch-php8
blob: 318b3c4b5a5832076765b1746e5c3462616d111e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
--- 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 @@ -->
 		<th><span class='translate'>Authentication Method:</span></th>
 		<td>
              <select name='vboxSettingsDisplayVRDEAuth' id='vboxSettingsDisplayVRDEAuthID' style='width: 100%'>
-              <option value='' >None</option>
-				<option value='External'>External</option>
-				<option value='Guest'>Guest</option>
+              <option value='Null'>None</option>
+              <option value='External'>External</option>
+              <option value='Guest'>Guest</option>
              </select>
           </td>
 	</tr>
--- 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();
 	}