Output of support data

- FlatPress provides the admin with all relevant data that could contribute to solving the problem.
- In the event that templates are faulty or a plugin is disrupting FlatPress, the support data can be retrieved via the URL http(s)://your-domain.ltd/admin/support.php.
This commit is contained in:
Fraenkiman 2024-02-25 20:06:33 +01:00
parent fef34b356c
commit 84640c6965
15 changed files with 316 additions and 0 deletions

View File

@ -21,5 +21,6 @@
<li><a href="{$action_url|cmd_link:do:restorechmods}">{$panelstrings.opt3}</a></li>
<li><a href="{$action_url|cmd_link:do:phpinfo}">{$panelstrings.opt4}</a></li>
<li><a href="{$panel_url|action_link:updates}">{$panelstrings.opt5}</a></li>
<li><a href="admin/support.php">{$panelstrings.opt6}</a></li>
</ul>
{/if}

302
admin/support.php Normal file
View File

@ -0,0 +1,302 @@
<?php
/*
* Name: Create support data
* Autor: FlatPress
* Version: 1.0.0
* Purpose: The FlatPress admin is thus able to provide the community with all relevant data to solve a problem quickly and specifically.
* Hint: The output is in English only, so that the project supervisor or the community do not have to translate it.
*/
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-en">
<html>
<head>
<meta charset="UTF-8">
<title>FlatPress - Create support data</title>
<style type="text/css">
body { font-family: Arial }
.error { color: #990000; padding-left: 10px }
.attention { color: #D35400; padding-left: 10px }
.success { color: #0E7924; padding-left: 10px }
.output { padding-left: 10px }
</style>
</head>
<body>
<p>For bug reports and help, visit the <a href="https://forum.flatpress.org" target="_blank">FlatPress forum</a>, report the bug on <a href="https://github.com/flatpressblog/flatpress/issues" target="_blank">GitHub</a> or <a href="mailto:hello@flatpress.org">send an email</a>.<br>Include these outputs (copy &#38; paste) in English with the following information: bug description, steps to reproduce.</p>
<h1>FlatPress general</h1>
<h2>Setup</h2>
<?php
require_once '../defaults.php';
require_once INCLUDES_DIR . 'includes.php';
require_once CONFIG_FILE;
require_once CONFIG_DIR . 'plugins.conf.php';
global $fp_config, $fp_plugins;
$LANG_DEFAULT = null;
$LANG_DEFAULT = LANG_DEFAULT;
$lang = null;
$lang = $fp_config ['locale'] ['lang'];
$theme = $fp_config ['general'] ['theme'];
$style = null;
$style = $fp_config ['general'] ['style'];
$BASE_DIR = BASE_DIR;
//$path = ABS_PATH . ADMIN_DIR . "panels/$panel/admin.$panel.$action.tpl";
echo '<p class="output"><strong>FlatPress version:</strong> ' . SYSTEM_VER . '</p>';
echo '<p class="output"><strong>Basis directory:</strong> ' . BASE_DIR . '</p>';
echo '<p class="output"><strong>Blog base URL:</strong> ' . BLOG_BASEURL . '</p>';
if ($LANG_DEFAULT) {
echo '<p class="output"><strong>Language (automatic):</strong> ' . $LANG_DEFAULT . '</p>';
} else {
echo '<p class="output"><strong>Language (automatic): &#8505;</strong> not recognized</p>';
}
if ($lang) {
echo '<p class="output"><strong>Language (set):</strong> ' . $lang . '</p>';
} else {
echo '<p class="output"><strong>Language (set):</strong> not set</p>';
}
echo '<p class="output"><strong>Theme:</strong> ' . $theme . '</p>';
if ($style) {
echo '<p class="output"><strong>Stil:</strong> ' . $style . '</p>';
} else {
echo '<p class="output"><strong>Stil:</strong> default style</p>';
}
echo '<p class="output"><strong>Activated plugins:</strong></p>';
echo '<p class="output">';
for($i = 0; $i < count($fp_plugins); $i++) {
echo ', ' . $fp_plugins [$i];
}
echo '</p>';
?>
</p>
<h1>FlatPress file and directory permissions</h1>
<h2>Core files</h2>
<p>As soon as the setup has been successfully executed, the setup.php file should be deleted before productive operation.</p>
<?php
$setupfile = BASE_DIR . '/setup.php';
if (file_exists($setupfile)) {
echo '<p class="error"><strong>&#33;</strong> The setup file is located in the main directory!</p>';
} else {
echo '<p class="success"><strong>&#10003;</strong> No .htaccess file was found in the main directory.</p>';
}
?>
<p>The admin directory should be read-only for productive operation.</p>
<?php
$test_file = @fopen("{$BASE_DIR}/admin/chmod-test-file", "a+");
if ($test_file) {
echo '<p class="attention"><strong>&#8505;</strong> The core files in the admin directory are writable!</p>';
} else {
echo '<p class="success"><strong>&#10003;</strong> The core files in the admin directory are not writable.</p>';
}
@fclose($test_file);
@unlink("{$BASE_DIR}/admin/chmod-test-file");
?>
<p>The fp-includes directory should be read-only for productive operation.</p>
<?php
$test_file = @fopen("{$BASE_DIR}/fp-includes/chmod-test-file", "a+");
if ($test_file) {
echo '<p class="attention"><strong>&#8505;</strong> The core files in the fp-includes directory are writable!</p>';
} else {
echo '<p class="success"><strong>&#10003;</strong> The core files in the fp-includes directory are not writable.</p>';
}
@fclose($test_file);
@unlink("{$BASE_DIR}/fp-includes/chmod-test-file");
?>
<h2>Themes and plugins</h2>
<p>The fp-content directory must be writable for FlatPress to work.</p>
<?php
$test_file = @fopen("{$BASE_DIR}/fp-content/chmod-test-file", "a+");
if ($test_file) {
echo '<p class="success"><strong>&#10003;</strong> The fp-content directory is writable.</p>';
} else {
echo '<p class="error"><strong>&#33;</strong> The directory fp-content is not writable!</p>';
}
@fclose($test_file);
@unlink("{$BASE_DIR}/fp-content/chmod-test-file");
?>
<p>The fp-plugin directory should be read-only for productive operation.</p>
<?php
$test_file = @fopen("{$BASE_DIR}/fp-plugins/chmod-test-file", "a+");
if ($test_file) {
echo '<p class="attention"><strong>&#8505;</strong> The plugin directory fp-plugins writable!</p>';
} else {
echo '<p class="success"><strong>&#10003;</strong> The plugin directory fp-plugins is not writable.</p>';
}
@fclose($test_file);
@unlink("{$BASE_DIR}/fp-plugins/chmod-test-file");
?>
<p>The fp-interface directory should be read-only for productive operation.</p>
<?php
$test_file = @fopen("{$BASE_DIR}/fp-interface/chmod-test-file", "a+");
if ($test_file) {
echo '<p class="attention"><strong>&#8505;</strong> The theme directory fp-interface writable!</p>';
} else {
echo '<p class="success"><strong>&#10003;</strong> The theme directory fp-interface is not writable.</p>';
}
@fclose($test_file);
@unlink("{$BASE_DIR}/fp-interface/chmod-test-file");
?>
<h2>.htaccess und defaults.php</h2>
<p>The root directory must be writable in order to be able to create or modify an .htaccess file with the PrettyURLs plugin.</p>
<p><strong>Note:</strong> Only web servers that are NCSA compatible, such as Apache, are familiar with the concept of .htaccess files.</p>
<?php
echo '<p>The server software is <strong>' . $_SERVER["SERVER_SOFTWARE"] . '</strong>.</p>';
$test_file = @fopen("{$BASE_DIR}/chmod-test-file", "a+");
if ($test_file) {
echo '<p class="success"><strong>&#10003;</strong> The FlatPress main directory is writable.</p>';
} else {
echo '<p class="attention"><strong>&#8505;</strong> The FlatPress main directory is not writable!</p>';
}
@fclose($test_file);
@unlink("{$BASE_DIR}/chmod-test-file");
// Do not create a .hthaccess file, otherwise the PrettyURLs plugin cannot create its own file. Better is .htaccess.txt
$test_file = @fopen("{$BASE_DIR}/.htaccess.txt", "a+");
if ($test_file) {
echo '<p class="success"><strong>&#10003;</strong> The .htaccess file is writable.</p>';
} else {
echo '<p class="attention"><strong>&#8505;</strong> The .htaccess file is not writable!</p>';
}
@fclose($test_file);
@unlink("{$BASE_DIR}/.htaccess.txt");
$htaccess = BASE_DIR . '/.htaccess';
if (file_exists($htaccess)) {
echo '<p class="attention"><strong>&#8505;</strong> A .htaccess file already exists in the main directory!</p>';
} else {
echo '<p class="success"><strong>&#10003;</strong> No .htaccess file was found in the main directory.</p>';
}
?>
<p>The defaults.php file should only be read-only for productive operation.</p>
<?php
$test_file = @fopen("{$BASE_DIR}/defaults.php", "a+");
if ($test_file) {
echo '<p class="attention"><strong>&#8505;</strong> The defaults.php file can be changed!</p>';
} else {
echo '<p class="success"><strong>&#10003;</strong> The defaults.php file cannot be changed.</p>';
}
@fclose($test_file);
?>
<h2>Upload directory (fp-content/attachs)</h2>
<p>This directory must have write permissions so that you can upload something.</p>
<?php
if (file_exists("{$BASE_DIR}/fp-content/attachs/")) {
$test_file = @fopen("{$BASE_DIR}/fp-content/attachs/chmod-test-file", "a+");
if ($test_file) {
echo '<p class="success"><strong>&#10003;</strong> The upload directory is writable.</p>';
} else {
echo '<p class="error"><strong>&#33;</strong> The upload directory is not writable!</p>';
}
@fclose($test_file);
@unlink("{$BASE_DIR}/fp-content/attachs/chmod-test-file");
} else {
echo '<p class="attention"><strong>&#8505;</strong> The upload directory does not exist.</p>';
}
?>
<h2>Cache directory (fp-content/cache)</h2>
<p>This directory must have write permission for the cache to function correctly.</p>
<?php
if (file_exists("{$BASE_DIR}/fp-content/cache/")) {
$test_file = @fopen("{$BASE_DIR}/fp-content/cache/chmod-test-file", "a+");
if ($test_file) {
echo '<p class="success"><strong>&#10003;</strong> The cache directory is writable.</p>';
} else {
echo '<p class="error"><strong>&#33;</strong> The cache directory is not writable!</p>';
}
@fclose($test_file);
@unlink("{$BASE_DIR}/fp-content/cache/chmod-test-file");
} else {
echo '<p class="success"><strong>&#33;</strong> The directory cache does not exist.</p>';
}
?>
<h1>PHP</h1>
<p>The PHP version is <strong><?php echo phpversion();?></strong></p>
<h2>Extensions</h2>
<p>The PHP-Intl extension must be activated.</p>
<?php
if (!function_exists("intl_error_name")) {
echo '<p class="error"><strong>&#33;</strong> The intl Extension is not activated!</p>';
} else {
echo '<p class="success"><strong>&#10003;</strong> The intl Extension is activated.</p>';
}
?>
<p>The GDlib extension must be activated to create image thumbnails.</p>
<?php
if (!function_exists("gd_info")) {
echo '<p class="error"><strong>&#33;</strong> The GD Extension is not activated!</p>';
} else {
echo '<p class="success"><strong>&#10003;</strong> The GD Extension is activated.</p>';
}
?>
<h1>Other</h1>
<p>The browser used is of interest if there are display errors.</p>
<?php
// Browser recognition does not always work correctly.
// This also depends on whether a current browscap has been set in php.ini or not.
function browser() {
$user_agent = $_SERVER ['HTTP_USER_AGENT'];
$browser = "not recognized";
$browsers = [
'/msie/i' => 'Internet explorer',
'/trident/i' => 'Internet explorer',
'/edge/i' => 'Edge',
'/firefox/i' => 'Firefox',
'/safari/i' => 'Safari',
'/chrome/i' => 'Chrome',
'/opera/i' => 'Opera',
'/opr/i' => 'Opera',
'/mobile/i' => 'Mobile browser',
'/konqueror/i' => 'Konqueror',
];
foreach ($browsers as $regex => $value) {
if (preg_match($regex, $user_agent)) {
$browser = $value;
}
}
return $browser;
}
echo '<p class="output"><strong>Browser: </strong>' . browser() . '</p>';
?>
<p>If visitors to the FlatPress blog are to be informed about cookies, this is the cookie.</p>
<p><strong>Hint:</strong> The name of the cookie changes each time FlatPress is reinstalled.</p>
<?php
@cookie_setup();
echo '<p class="output"><strong>FlatPress Session cookie: </strong>' . SESS_COOKIE . '</p>';
?>
<h2>Output completed!</h2>
<p class="output"><strong>Symbols:</strong></p>
<p class="success"><strong>&#10003;</strong> No action necessary</p>
<p class="attention"><strong>&#8505;</strong> Does not restrict functionality, but requires attention</p>
<p class="error"><strong>&#33;</strong> Action urgently needed</p>
<p>Powered by <a href="https://flatpress.org" target="_blank">FlatPress</a>.</p>
</body>
</html>

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'Obnovit oprávnění souborů',
'opt4' => 'Ukázat informace o PHP',
'opt5' => 'Zjistit aktualizace',
'opt6' => 'Zobrazit údaje o podpoře',
'chmod_info' => 'Pokud se oprávnění souboru <strong>nepodařilo</strong> obnovit na ' . decoct(FILE_PERMISSIONS) . ', vlastník souboru pravděpodobně není stejný jako vlastník webového serveru.<br>' . //
'Případně můžete ignorovat toto oznámení.'

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'Gendan rettigheder til filadgang',
'opt4' => 'Vis PHP-information om webserveren',
'opt5' => 'Tjek for nye versioner',
'opt6' => 'Vis supportdata',
'chmod_info' => 'Hvis filrettighederne <strong>ikke</strong> kunne nulstilles til ' . decoct(FILE_PERMISSIONS) . ', er ejeren af filen sandsynligvis ikke den samme som ejeren af webserveren.<br>' . //
'Normalt kan du ignorere dette tip.'

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'Wiederherstellen der Dateizugriffsrechte',
'opt4' => 'Zeige PHP-Informationen des Webservers',
'opt5' => 'Prüfe auf neue Versionen',
'opt6' => 'Zeige Supportdaten',
'chmod_info' => 'Wenn die Dateiberechtigungen <strong>nicht</strong> auf ' . decoct(FILE_PERMISSIONS) . ' zurückgesetzt werden konnten, ist wahrscheinlich der Eigentümer der Datei nicht derselbe wie der des Webservers.<br>' . //
'Normalerweise kann man diesen Hinweis ignorieren.'

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'Επαναφορά δικαιωμάτων αρχείων',
'opt4' => 'Εμφάνιση πληροφοριών σχετικά με την PHP',
'opt5' => 'Έλεγχος για αναβαθμίσεις',
'opt6' => 'Εμφάνιση δεδομένων υποστήριξης',
'chmod_info' => 'Αν τα δικαιώματα του αρχείου <strong>δεν μπόρεσαν</strong> να επανέλθουν σε ' . decoct(FILE_PERMISSIONS) . ', ο ιδιοκτήτης του αρχείου δεν είναι πιθανότατα ο ίδιος με τον ιδιοκτήτη του διακομιστή ιστού.<br>' . //
'Συνήθως αυτή η ειδοποίηση μπορεί να αγνοηθεί.'

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'Restore file permissions',
'opt4' => 'Show info about PHP',
'opt5' => 'Check for updates',
'opt6' => 'Show support data',
'chmod_info' => 'If the file permissions <strong>could not</strong> be reset to ' . decoct(FILE_PERMISSIONS) . ', the owner of the file is probably not the same as the owner of the web server.<br>' . //
'Normalement, tu peux ignorer cette remarque.'

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'Restaurar permisos de archivos',
'opt4' => 'Mostrar información sobre PHP',
'opt5' => 'Buscar actualizaciones',
'opt6' => 'Mostrar datos de apoyo',
'chmod_info' => 'Si los permisos del archivo <strong>no se pudieron</strong> restablecer a ' . decoct(FILE_PERMISSIONS) . ', es probable que el propietario del archivo no sea el mismo que el del servidor web.<br>' . //
'Por lo general, puede ignorar este aviso.'

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'Restaurer les permissions de fichiers',
'opt4' => 'Afficher info.php',
'opt5' => 'V&eacute;rifier les mises &agrave; jour',
'opt6' => 'Afficher les données de support',
'chmod_info' => 'Si les permissions du fichier <strong>n\'ont pas pu être remises à ' . decoct(FILE_PERMISSIONS) . '</strong>, il est probable que le propriétaire du fichier ne soit pas le même que celui du serveur web.<br>' . //
'tre diff&eacute;rent du serveur web.'

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'Ripristina i permessi dei file',
'opt4' => 'Visualizza informazioni su PHP',
'opt5' => 'Controllo aggiornamenti',
'opt6' => 'Mostra i dati di supporto',
'chmod_info' => 'Se non è stato possibile reimpostare i permessi del file a ' . decoct(FILE_PERMISSIONS) . ', probabilmente il proprietario del file non è lo stesso del server web.<br>' . //
'Di solito puoi ignorare questo avviso.'

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'ファイルパーミッションの回復',
'opt4' => 'PHP情報を表示します',
'opt5' => 'アップデートをチェックします',
'opt6' => 'サポートデータの表示',
'chmod_info' => 'ファイルのパーミッションを' . decoct(FILE_PERMISSIONS) . 'にリセットできなかった場合、ファイルの所有者がウェブサーバーの所有者と同じでない可能性があります。<br>' . //
'でも通常、この通知を無視することができます。'

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'Bestandsmachtigingen herstellen',
'opt4' => 'Toon info over PHP',
'opt5' => 'Controleren op updates',
'opt6' => 'Toon ondersteuningsgegevens',
'chmod_info' => 'Als de bestandsrechten niet konden worden teruggezet naar ' . decoct(FILE_PERMISSIONS) . ', is de eigenaar van het bestand waarschijnlijk niet dezelfde als de eigenaar van de webserver.<br>' . //
'Meestal kunt u deze kennisgeving negeren.'

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'Restaure as permissões de arquivos',
'opt4' => 'Mostre as informações sobre o PHP',
'opt5' => 'Procure atualizações',
'opt6' => 'Mostrar dados de suporte',
'chmod_info' => 'Se não for possível redefinir as permissões do arquivo para ' . decoct(FILE_PERMISSIONS) . ', o proprietário do arquivo provavelmente não é o mesmo que o proprietário do servidor Web.<br>' . //
'Geralmente você pode ignorar este aviso.'

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'Восстановить права доступа к файлам',
'opt4' => 'Показать информацию о PHP',
'opt5' => 'Проверить наличие обновлений',
'opt6' => 'Показать данные о поддержке',
'chmod_info' => 'Если права доступа к файлу не удалось сбросить на ' . decoct(FILE_PERMISSIONS) . ', владелец файла, вероятно, не совпадает с владельцем веб-сервера.<br>' . //
'Обычно это уведомление можно проигнорировать.'

View File

@ -10,6 +10,7 @@ $lang ['admin'] ['maintain'] ['default'] = array(
'opt3' => 'Obnovi dovoljenja datotek',
'opt4' => 'Prikaži informacije o PHP',
'opt5' => 'Preveri posodobitve',
'opt6' => 'Prikaži podatke o podpori',
'chmod_info' => 'Če pravic datoteke ni bilo mogoče ponastaviti na ' . decoct(FILE_PERMISSIONS) . ', lastnik datoteke verjetno ni isti kot lastnik spletnega strežnika.<br>' . //
'Običajno lahko to obvestilo prezrete.'