3 namespace Friendica\Module\Admin\Logs;
5 use Friendica\Core\Renderer;
7 use Friendica\Module\BaseAdminModule;
8 use Friendica\Util\Strings;
10 class View extends BaseAdminModule
12 public static function content(array $parameters = [])
14 parent::content($parameters);
16 $t = Renderer::getMarkupTemplate('admin/logs/view.tpl');
17 $f = DI::config()->get('system', 'logfile');
20 if (!file_exists($f)) {
21 $data = DI::l10n()->t('Error trying to open <strong>%1$s</strong> log file.\r\n<br/>Check to see if file %1$s exist and is readable.', $f);
25 $data = DI::l10n()->t('Couldn\'t open <strong>%1$s</strong> log file.\r\n<br/>Check to see if file %1$s is readable.', $f);
28 $size = $fstat['size'];
30 if ($size > 5000000 || $size < 0) {
33 $seek = fseek($fp, 0 - $size, SEEK_END);
35 $data = Strings::escapeHtml(fread($fp, $size));
37 $data .= Strings::escapeHtml(fread($fp, 4096));
44 return Renderer::replaceMacros($t, [
45 '$title' => DI::l10n()->t('Administration'),
46 '$page' => DI::l10n()->t('View Logs'),
48 '$logname' => DI::config()->get('system', 'logfile')