Add script 'get-openssl-version.sh'.
This commit is contained in:
209
snippets/dokuwiki-2023-04-04/lib/plugins/logviewer/admin.php
Normal file
209
snippets/dokuwiki-2023-04-04/lib/plugins/logviewer/admin.php
Normal file
@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
use dokuwiki\Logger;
|
||||
|
||||
/**
|
||||
* DokuWiki Plugin logviewer (Admin Component)
|
||||
*
|
||||
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
class admin_plugin_logviewer extends DokuWiki_Admin_Plugin
|
||||
{
|
||||
const MAX_READ_SIZE = 1048576; // 1 MB
|
||||
|
||||
protected $facilities;
|
||||
protected $facility;
|
||||
protected $date;
|
||||
|
||||
/** @inheritDoc */
|
||||
public function forAdminOnly()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
public function handle()
|
||||
{
|
||||
global $INPUT;
|
||||
|
||||
$this->facilities = $this->getFacilities();
|
||||
$this->facility = $INPUT->str('facility');
|
||||
if (!in_array($this->facility, $this->facilities)) {
|
||||
$this->facility = $this->facilities[0];
|
||||
}
|
||||
|
||||
$this->date = $INPUT->str('date');
|
||||
if (!preg_match('/^\d\d\d\d-\d\d-\d\d$/', $this->date)) {
|
||||
$this->date = gmdate('Y-m-d');
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
public function html()
|
||||
{
|
||||
echo '<div id="plugin__logviewer">';
|
||||
echo $this->locale_xhtml('intro');
|
||||
$this->displayTabs();
|
||||
$this->displayLog();
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the navigational tabs and date picker
|
||||
*/
|
||||
protected function displayTabs()
|
||||
{
|
||||
global $ID;
|
||||
|
||||
$form = new dokuwiki\Form\Form(['method' => 'GET']);
|
||||
$form->setHiddenField('do', 'admin');
|
||||
$form->setHiddenField('page', 'logviewer');
|
||||
$form->setHiddenField('facility', $this->facility);
|
||||
$form->addTextInput('date', $this->getLang('date'))
|
||||
->attr('type', 'date')->val($this->date)->addClass('quickselect');
|
||||
$form->addButton('submit', '>')->attr('type', 'submit');
|
||||
echo $form->toHTML();
|
||||
|
||||
echo '<ul class="tabs">';
|
||||
foreach ($this->facilities as $facility) {
|
||||
echo '<li>';
|
||||
if ($facility == $this->facility) {
|
||||
echo '<strong>' . hsc($facility) . '</strong>';
|
||||
} else {
|
||||
$link = wl($ID,
|
||||
['do' => 'admin', 'page' => 'logviewer', 'date' => $this->date, 'facility' => $facility]);
|
||||
echo '<a href="' . $link . '">' . hsc($facility) . '</a>';
|
||||
}
|
||||
echo '</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Read and output the logfile contents
|
||||
*/
|
||||
protected function displayLog()
|
||||
{
|
||||
$logfile = Logger::getInstance($this->facility)->getLogfile($this->date);
|
||||
if (!file_exists($logfile)) {
|
||||
echo $this->locale_xhtml('nolog');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$lines = $this->getLogLines($logfile);
|
||||
$this->printLogLines($lines);
|
||||
} catch (Exception $e) {
|
||||
msg($e->getMessage(), -1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the available logging facilities
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getFacilities()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// default facilities first
|
||||
$facilities = [
|
||||
Logger::LOG_ERROR,
|
||||
Logger::LOG_DEPRECATED,
|
||||
Logger::LOG_DEBUG,
|
||||
];
|
||||
|
||||
// add all other dirs
|
||||
$dirs = glob($conf['logdir'] . '/*', GLOB_ONLYDIR);
|
||||
foreach ($dirs as $dir) {
|
||||
$facilities[] = basename($dir);
|
||||
}
|
||||
$facilities = array_unique($facilities);
|
||||
|
||||
return $facilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the lines of the logfile and return them as array
|
||||
*
|
||||
* @param string $logfilePath
|
||||
* @return array
|
||||
* @throws Exception when reading fails
|
||||
*/
|
||||
protected function getLogLines($logfilePath)
|
||||
{
|
||||
global $lang;
|
||||
$size = filesize($logfilePath);
|
||||
$fp = fopen($logfilePath, 'r');
|
||||
|
||||
if (!$fp) throw new Exception($lang['log_file_failed_to_open']);
|
||||
|
||||
try {
|
||||
if ($size < self::MAX_READ_SIZE) {
|
||||
$toread = $size;
|
||||
} else {
|
||||
$toread = self::MAX_READ_SIZE;
|
||||
fseek($fp, -$toread, SEEK_END);
|
||||
}
|
||||
|
||||
$logData = fread($fp, $toread);
|
||||
if (!$logData) throw new Exception($lang['log_file_failed_to_read']);
|
||||
|
||||
$lines = explode("\n", $logData);
|
||||
unset($logData); // free memory early
|
||||
|
||||
if ($size >= self::MAX_READ_SIZE) {
|
||||
array_shift($lines); // Discard the first line
|
||||
while (!empty($lines) && (substr($lines[0], 0, 2) === ' ')) {
|
||||
array_shift($lines); // Discard indented lines
|
||||
}
|
||||
|
||||
// A message to inform users that previous lines are skipped
|
||||
array_unshift($lines, "******\t" . "\t" . '[' . $lang['log_file_too_large'] . ']');
|
||||
}
|
||||
} finally {
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
return $lines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of log lines and print them using appropriate styles
|
||||
*
|
||||
* @param array $lines
|
||||
*/
|
||||
protected function printLogLines($lines)
|
||||
{
|
||||
$numberOfLines = count($lines);
|
||||
|
||||
echo "<dl>";
|
||||
for ($i = 0; $i < $numberOfLines; $i++) {
|
||||
$line = $lines[$i];
|
||||
if (substr($line, 0, 2) === ' ') {
|
||||
// lines indented by two spaces are details, aggregate them
|
||||
echo '<dd>';
|
||||
while (substr($line, 0, 2) === ' ') {
|
||||
echo hsc(substr($line, 2)) . '<br />';
|
||||
$i++;
|
||||
$line = $lines[$i] ?? '';
|
||||
}
|
||||
echo '</dd>';
|
||||
$i -= 1; // rewind the counter
|
||||
} else {
|
||||
// other lines are actual log lines in three parts
|
||||
list($dt, $file, $msg) = sexplode("\t", $line, 3, '');
|
||||
echo '<dt>';
|
||||
echo '<span class="datetime">' . hsc($dt) . '</span>';
|
||||
echo '<span class="log">';
|
||||
echo '<span class="msg">' . hsc($msg) . '</span>';
|
||||
echo '<span class="file">' . hsc($file) . '</span>';
|
||||
echo '</span>';
|
||||
echo '</dt>';
|
||||
}
|
||||
}
|
||||
echo "</dl>";
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<svg viewBox="0 0 24 24"><path d="M15 20a1 1 0 0 0 1-1V4H8a1 1 0 0 0-1 1v11H5V5a3 3 0 0 1 3-3h11a3 3 0 0 1 3 3v1h-2V5a1 1 0 0 0-1-1 1 1 0 0 0-1 1v14a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3v-1h11a2 2 0 0 0 2 2M9 6h5v2H9V6m0 4h5v2H9v-2m0 4h5v2H9v-2z"/></svg>
|
After Width: | Height: | Size: 246 B |
@ -0,0 +1,6 @@
|
||||
====== Logs anzeigen ======
|
||||
|
||||
Diese Oberfläche gibt Zugriff auf die verschiedenen Logdateien die von DokuWiki erzeugt werden. Normalerweise sollte hier nicht viel zu sehen sein (abhängig von Ihren [[ [[doku>config:dontlog|Logging Einstellungen]]). Geht jedoch etwas schief, ist die Wahrscheinlichkeit hoch hier nützliche Informationen zum Problem zu finden. Alle angezeigten Zeiten sind in UTC!
|
||||
|
||||
Bitte beachten Sie, dass **Logdateien sensitive Informationen enthalten können**. Dazu gehören Passwörter, Dateipfade und andere Geheimnisse.
|
||||
Bearbeiten Sie die Ausgaben entsprechend wenn Sie diese im Forum oder in Fehlermeldungen posten!
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
$lang['menu'] = 'Logs anzeigen';
|
||||
$lang['date'] = 'Datum';
|
||||
$lang['js']['filter'] = 'Zeilen filtern:';
|
@ -0,0 +1 @@
|
||||
Es gibt keine Einträge für den ausgewählten Tag und Log-Typ.
|
@ -0,0 +1,8 @@
|
||||
====== View Logs ======
|
||||
|
||||
This interface allows you to view the various logs that are written by DokuWiki. By default, there shouldn't be much
|
||||
here (it depends on your [[doku>config:dontlog|log settings]]). However if something goes wrong, chances are high
|
||||
you'll find useful information about the problem. All times are UTC!
|
||||
|
||||
Please be aware that **log files can contain sensitive information** like passwords, paths or other secrets.
|
||||
Be sure to redact the logs appropriately when posting them on the forum or in bug reports!
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* English language file for logviewer plugin
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
|
||||
$lang['menu'] = 'View Logs';
|
||||
$lang['date'] = 'Date';
|
||||
$lang['js']['filter'] = 'Filter Loglines:';
|
@ -0,0 +1 @@
|
||||
There are no log entries for the selected day and log facility.
|
@ -0,0 +1,8 @@
|
||||
====== Ver registros ======
|
||||
|
||||
Esta interfaz te permite ver los diversos registros que son escritos por DokuWiki. Por defecto, no debería haber mucho
|
||||
aquí (depende de tu [[doku>config:dontlog|configuración de registros]]). Sin embargo, si algo va mal, es muy probable que
|
||||
que encuentres información útil sobre el problema. Todas las horas son UTC.
|
||||
|
||||
Ten en cuenta que **los archivos de registro pueden contener información sensible** como contraseñas, rutas u otros secretos.
|
||||
Asegúrate de redactar los registros adecuadamente cuando los publiques en el foro o en los informes de errores.
|
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author cadetill <cadetill@gmail.com>
|
||||
*/
|
||||
$lang['menu'] = 'Ver registros';
|
||||
$lang['date'] = 'Fecha';
|
@ -0,0 +1 @@
|
||||
No hay entradas de registro para el día y la instalación de registro seleccionados.
|
@ -0,0 +1,13 @@
|
||||
====== Visualisation des journaux ======
|
||||
|
||||
Cette interface permet de visualier les divers journaux que DokuWiki
|
||||
écrit. Par défaut, il ne devrait pas y avoir grand chose ici ;
|
||||
cela dépend du [[doku>fr:config:dontlog|réglage des journaux]].
|
||||
Cependant si quelque chose se passe mal, il y a de fortes chances
|
||||
que vous trouviez ici des informations utiles. Toutes les heures
|
||||
sont en [[wpfr>Temps Universel Coordonné|UTC]] !
|
||||
|
||||
Veuillez noter que les **journaux peuvent contenir des données
|
||||
sensibles** telles que des mots de passe, chemins, ou autres secrets.
|
||||
Veuillez les éditer convenablement avant de les poster sur un forum
|
||||
ou de les inclure dans un rapport de bogue.
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* French language file for logviewer plugin
|
||||
*
|
||||
* @author Schplurtz le Déboulonné <Schplurtz@laposte.net>
|
||||
*/
|
||||
$lang['menu'] = 'Voir les journaux';
|
||||
$lang['date'] = 'Date';
|
||||
$lang['js']['filter'] = 'Filtrer les lignes:';
|
@ -0,0 +1 @@
|
||||
Il n'y a aucune entrée pour le jour et la catégorie sélectionnés.
|
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Simone Perin <simoneperin.92@libero.it>
|
||||
*/
|
||||
$lang['menu'] = 'Visualizza Logs';
|
||||
$lang['date'] = 'Data';
|
@ -0,0 +1,8 @@
|
||||
====== Exibir registros ======
|
||||
|
||||
Esta interface permite que você visualize os vários logs que são escritos pelo DokuWiki. Por padrão, não deve haver muito
|
||||
aqui (depende das suas [[doku>config:dontlog|log settings]]). No entanto, se algo der errado, as chances são altas
|
||||
você encontrará informações úteis sobre o problema. Todos os horários são UTC!
|
||||
|
||||
Esteja ciente de que **arquivos de log podem conter informações confidenciais** como senhas, caminhos ou outros segredos.
|
||||
Certifique-se de redigir os logs adequadamente ao publicá-los no fórum ou em relatórios de bugs!
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Gilson Caldeira <gilsoncaldeira@gmail.com>
|
||||
*/
|
||||
$lang['menu'] = 'Exibir registros';
|
||||
$lang['date'] = 'Data';
|
||||
$lang['js']['filter'] = 'Filtrar linhas de registro:';
|
@ -0,0 +1 @@
|
||||
Não há entradas de log para o dia selecionado e facilidade de log.
|
@ -0,0 +1,8 @@
|
||||
====== Visualizar registros ======
|
||||
|
||||
Esta interface permite visualizar os vários logs que são escritos pelo DokuWiki. Por padrão, não deve haver muito
|
||||
aqui (depende das suas [[doku>config:dontlog|configurações de log]]). No entanto, se algo der errado, as chances são altas
|
||||
você encontrará informações úteis sobre o problema. Todos os horários são UTC!
|
||||
|
||||
Esteja ciente de que **os arquivos de registro podem conter informações confidenciais** como senhas, caminhos ou outros segredos.
|
||||
Certifique-se de redigir os registros adequadamente ao publicá-los no fórum ou em relatórios de bugs!
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Edney Rossi <prof.edneyrossi@gmail.com>
|
||||
*/
|
||||
$lang['menu'] = 'Ver registros';
|
||||
$lang['date'] = 'Data';
|
||||
$lang['js']['filter'] = 'Filtrar linhas de registro';
|
@ -0,0 +1 @@
|
||||
Não há entradas de registros para o dia e instalação de registros selecionados.
|
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Aleksandr Selivanov <alexgearbox@yandex.ru>
|
||||
*/
|
||||
$lang['menu'] = 'Просмотр журналов (logs)';
|
||||
$lang['date'] = 'Дата';
|
@ -0,0 +1 @@
|
||||
Нет записей для выбранного дня и объекта.
|
@ -0,0 +1,8 @@
|
||||
====== Xem Nhật ký Log ======
|
||||
|
||||
Giao diện này cho phép bạn xem các nhật ký log khác nhau do DokuWiki viết. Theo mặc định, không nên có nhiều
|
||||
tại đây (nó còn tùy thuộc vào [[doku>config:dontlog|cài đặt nhật ký log]] của bạn). Tuy nhiên, nếu có gì đó không ổn, rất có thể
|
||||
bạn sẽ tìm thấy thông tin hữu ích về vấn đề này. Tất cả thời gian là theo chuẩn UTC!
|
||||
|
||||
Xin lưu ý rằng **tệp nhật ký log có thể chứa thông tin nhạy cảm** như mật khẩu, đường dẫn hoặc các bí mật khác.
|
||||
Đảm bảo sắp xếp lại các nhật ký log một cách thích hợp khi đăng chúng lên diễn đàn hoặc trong các báo cáo lỗi!
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author Minh <phandinhminh@protonmail.ch>
|
||||
*/
|
||||
$lang['menu'] = 'Xem nhật ký log';
|
||||
$lang['date'] = 'Ngày tháng';
|
||||
$lang['js']['filter'] = 'Lọc dòng nhật ký log:';
|
@ -0,0 +1 @@
|
||||
Không có mục nhật ký log nào cho cơ sở nhật ký log và ngày tháng đã chọn.
|
@ -0,0 +1,5 @@
|
||||
====== 查看日志 ======
|
||||
|
||||
此界面允许您查看 DokuWiki 编写的各种日志。默认情况下,这里应该没有太多内容(这取决于您的[[doku>config:dontlog|日志设置]])。但是,如果出现问题,您很有可能会找到有关该问题的有用信息。所有时间都是世界协调时!
|
||||
|
||||
请注意,日志文件可能包含敏感信息,如密码、路径或其他机密。在论坛或错误报告中发布日志时,请务必适当地编辑日志!
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
*
|
||||
* @author 小李 <szsd5257@foxmail.com>
|
||||
*/
|
||||
$lang['menu'] = '查看日志';
|
||||
$lang['date'] = '日期';
|
||||
$lang['js']['filter'] = '过滤器日志:';
|
@ -0,0 +1 @@
|
||||
所选日期和日志工具没有日志条目。
|
@ -0,0 +1,7 @@
|
||||
base logviewer
|
||||
author Andreas Gohr
|
||||
email andi@splitbrain.org
|
||||
date 2020-08-13
|
||||
name logviewer plugin
|
||||
desc View DokuWiki logs
|
||||
url https://www.dokuwiki.org/plugin:logviewer
|
25
snippets/dokuwiki-2023-04-04/lib/plugins/logviewer/script.js
Normal file
25
snippets/dokuwiki-2023-04-04/lib/plugins/logviewer/script.js
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Scroll to the end of the log on load
|
||||
*/
|
||||
jQuery(function () {
|
||||
var $dl = jQuery('#plugin__logviewer').find('dl');
|
||||
if (!$dl.length) return;
|
||||
$dl.animate({scrollTop: $dl.prop("scrollHeight")}, 500);
|
||||
|
||||
|
||||
var $filter = jQuery('<input>');
|
||||
$filter.on('keyup', function (e) {
|
||||
var re = new RegExp($filter.val(), 'i');
|
||||
|
||||
$dl.find('dt').each(function (idx, elem) {
|
||||
if (elem.innerText.match(re)) {
|
||||
jQuery(elem).removeClass('hidden');
|
||||
} else {
|
||||
jQuery(elem).addClass('hidden');
|
||||
}
|
||||
});
|
||||
});
|
||||
$dl.before($filter);
|
||||
$filter.wrap('<label></label>');
|
||||
$filter.before(LANG.plugins.logviewer.filter + ' ');
|
||||
});
|
@ -0,0 +1,51 @@
|
||||
#plugin__logviewer {
|
||||
form {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-top: -1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
dl {
|
||||
max-height: 80vh;
|
||||
overflow: auto;
|
||||
|
||||
dt {
|
||||
display: flex;
|
||||
|
||||
&.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.datetime {
|
||||
flex: 0 0 auto;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.log {
|
||||
flex: 1 1 auto;
|
||||
|
||||
span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
span.file {
|
||||
font-family: monospace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dd {
|
||||
font-size: 80%;
|
||||
white-space: nowrap;
|
||||
font-family: monospace;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user