File FTL.php-improve-get-response-ftl.patch of Package pihole-admin-lte
30
1
Index: AdminLTE-5.18/scripts/pi-hole/php/FTL.php
2
===================================================================
3
--- AdminLTE-5.18.orig/scripts/pi-hole/php/FTL.php
4
+++ AdminLTE-5.18/scripts/pi-hole/php/FTL.php
5
6
return fsockopen($address, $port, $errno, $errstr, 1.0);
7
}
8
9
+/**
10
+ * Sends a request to pihole-FTL, or send to 127.0.0.1 and the port
11
+ * from PORTFILE specified in config.
12
+ *
13
+ * @param $requestin String to send to FTL.
14
+ */
15
function sendRequestFTL($requestin, $socket)
16
{
17
$request = '>'.$requestin;
18
fwrite($socket, $request) or exit('{"error":"Could not send data to server"}');
19
}
20
21
+/**
22
+ * Reads a response from pihole-FTL, or read from 127.0.0.1 and the port
23
+ * from PORTFILE specified in config.
24
+ *
25
+ * Returns response as string per line in array.
26
+ */
27
function getResponseFTL($socket)
28
{
29
$response = array();
30