1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/view/logArchive.json.php
Daniel 2a9630258f https://github.com/WWBN/AVideo/issues/6345#issuecomment-1067056556
Also check the lang in case insensitive
2022-03-14 14:28:38 -03:00

33 lines
979 B
PHP

<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
header('Content-Type: application/json');
$obj = new stdClass();
$obj->error = true;
$obj->msg = '';
$obj->filename = $global['systemRootPath'].'videos'.DIRECTORY_SEPARATOR.'avideo.log_'.date('Ymd-His').'.zip';
if (!Permissions::canSeeLogs()) {
$obj->msg = __("You cannot see the logs");
die(json_encode($obj));
}
if (!empty($global['disableAdvancedConfigurations'])) {
$obj->msg = __("This page is disabled");
die(json_encode($obj));
}
$zip = new ZipArchive();
if ($zip->open($obj->filename, ZipArchive::CREATE | ZipArchive::OVERWRITE) === true) {
$zip->addFile($global['logfile'], 'avideo.log');
$zip->close();
file_put_contents($global['logfile'], '');
$obj->error = false;
die(json_encode($obj));
} else {
$obj->msg = __("Error on create file");
die(json_encode($obj));
}