2023-10-31 15:14:55 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require '../../includes/csrf.php';
|
2025-01-21 04:59:57 -08:00
|
|
|
require_once '../../includes/session.php';
|
2023-10-31 15:14:55 +00:00
|
|
|
require_once '../../includes/config.php';
|
2024-03-11 18:52:34 +01:00
|
|
|
require_once '../../src/RaspAP/Auth/HTTPAuth.php';
|
|
|
|
require_once '../../includes/authenticate.php';
|
2023-10-31 15:14:55 +00:00
|
|
|
|
2023-10-31 15:17:13 +00:00
|
|
|
if (isset($_POST['csrf_token'])) {
|
|
|
|
if (csrfValidateRequest() && !CSRFValidate()) {
|
|
|
|
handleInvalidCSRFToken();
|
|
|
|
}
|
2023-10-31 22:18:23 +00:00
|
|
|
$root = getenv("DOCUMENT_ROOT");
|
2023-11-01 07:46:36 +00:00
|
|
|
exec('sudo '.RASPI_CONFIG.'/system/debuglog.sh -i '.$root, $return);
|
2023-10-31 20:31:27 +00:00
|
|
|
|
|
|
|
$logOutput = implode(PHP_EOL, $return);
|
|
|
|
$tempDir = sys_get_temp_dir();
|
2023-10-31 22:18:23 +00:00
|
|
|
$filePath = $tempDir . DIRECTORY_SEPARATOR . RASPI_DEBUG_LOG;
|
2023-10-31 20:31:27 +00:00
|
|
|
$handle = fopen($filePath, "w");
|
|
|
|
fwrite($handle, $logOutput);
|
|
|
|
fclose($handle);
|
|
|
|
echo json_encode($filePath);
|
2023-10-31 15:17:13 +00:00
|
|
|
} else {
|
|
|
|
handleInvalidCSRFToken();
|
|
|
|
}
|