Merge branch 'Bramas-master' into develop

This commit is contained in:
Tobias Reich 2016-01-10 13:07:27 +01:00
commit c46ca81a97
2 changed files with 67 additions and 35 deletions

View File

@ -103,27 +103,41 @@ else echo $error;
echo(PHP_EOL . PHP_EOL . 'System Information' . PHP_EOL); echo(PHP_EOL . PHP_EOL . 'System Information' . PHP_EOL);
echo('------------------' . PHP_EOL); echo('------------------' . PHP_EOL);
# Load json # Ensure that user is logged in
$json = file_get_contents(LYCHEE_SRC . 'package.json'); session_start();
$json = json_decode($json, true);
# About imagick if ((isset($_SESSION['login'])&&$_SESSION['login']===true)&&
$imagick = extension_loaded('imagick'); (isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier'])) {
if ($imagick===true) $imagickVersion = @Imagick::getVersion();
else $imagick = '-';
if (!isset($imagickVersion, $imagickVersion['versionNumber'])||$imagickVersion==='') $imagickVersion = '-';
else $imagickVersion = $imagickVersion['versionNumber'];
# Output system information # Load json
echo('Lychee Version: ' . $json['version'] . PHP_EOL); $json = file_get_contents(LYCHEE_SRC . 'package.json');
echo('DB Version: ' . $settings['version'] . PHP_EOL); $json = json_decode($json, true);
echo('System: ' . PHP_OS . PHP_EOL);
echo('PHP Version: ' . floatval(phpversion()) . PHP_EOL); # About imagick
echo('MySQL Version: ' . $database->server_version . PHP_EOL); $imagick = extension_loaded('imagick');
echo('Imagick: ' . $imagick . PHP_EOL); if ($imagick===true) $imagickVersion = @Imagick::getVersion();
echo('Imagick Active: ' . $settings['imagick'] . PHP_EOL); else $imagick = '-';
echo('Imagick Version: ' . $imagickVersion . PHP_EOL); if (!isset($imagickVersion, $imagickVersion['versionNumber'])||$imagickVersion==='') $imagickVersion = '-';
echo('GD Version: ' . $gdVersion['GD Version'] . PHP_EOL); else $imagickVersion = $imagickVersion['versionNumber'];
echo('Plugins: ' . $settings['plugins'] . PHP_EOL);
# Output system information
echo('Lychee Version: ' . $json['version'] . PHP_EOL);
echo('DB Version: ' . $settings['version'] . PHP_EOL);
echo('System: ' . PHP_OS . PHP_EOL);
echo('PHP Version: ' . floatval(phpversion()) . PHP_EOL);
echo('MySQL Version: ' . $database->server_version . PHP_EOL);
echo('Imagick: ' . $imagick . PHP_EOL);
echo('Imagick Active: ' . $settings['imagick'] . PHP_EOL);
echo('Imagick Version: ' . $imagickVersion . PHP_EOL);
echo('GD Version: ' . $gdVersion['GD Version'] . PHP_EOL);
echo('Plugins: ' . $settings['plugins'] . PHP_EOL);
} else {
# Don't go further if the user is not logged in
echo('You have to be logged in to see more information.');
exit();
}
?> ?>

View File

@ -37,26 +37,44 @@ if (mysqli_connect_errno()!=0) {
exit(); exit();
} }
# Result # Load settings
$query = Database::prepare($database, "SELECT FROM_UNIXTIME(time), type, function, line, text FROM ?", array(LYCHEE_TABLE_LOG)); $settings = new Settings($database);
$result = $database->query($query); $settings = $settings->get();
# Output # Ensure that user is logged in
if ($result->num_rows===0) { session_start();
echo('Everything looks fine, Lychee has not reported any problems!' . PHP_EOL . PHP_EOL); if ((isset($_SESSION['login'])&&$_SESSION['login']===true)&&
(isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier'])) {
# Result
$query = Database::prepare($database, "SELECT FROM_UNIXTIME(time), type, function, line, text FROM ?", array(LYCHEE_TABLE_LOG));
$result = $database->query($query);
# Output
if ($result->num_rows===0) {
echo('Everything looks fine, Lychee has not reported any problems!');
} else {
while($row = $result->fetch_row()) {
# Encode result before printing
$row = array_map('htmlentities', $row);
# Format: time TZ - type - function(line) - text
printf ("%s - %s - %s (%s) \t- %s\n", $row[0], $row[1], $row[2], $row[3], $row[4]);
}
}
} else { } else {
while($row = $result->fetch_row()) { # Don't go further if the user is not logged in
echo('You have to be logged in to see the log.');
# Encode result before printing exit();
$row = array_map("htmlentities", $row);
# Format: time TZ - type - function(line) - text
printf ("%s %s - %s - %s (%s) \t- %s\n", $row[0], date_default_timezone_get(), $row[1], $row[2], $row[3], $row[4]);
}
} }