Skip to content

Commit

Permalink
plxAdmin::getFileStatique() always returns a string (#827)
Browse files Browse the repository at this point in the history
PLX_DEBUG is set to "true"

In plxPlugins::__construct(), error is ignored in some cases :
 - PLX_DEBUG is false
 - $error['file'] is empty
 - $error['type'] < E_DEPRECATED ( not warnings )

Co-authored-by: Jean-Pierre Pourrez <[email protected]>
  • Loading branch information
kazimentou and bazooka07 committed Jul 18, 2024
1 parent f3ea8a4 commit 3d6965f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
9 changes: 5 additions & 4 deletions core/lib/class.plx.admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -840,14 +840,15 @@ public function getFileStatique($num) {
# Emplacement de la page
$filename = PLX_ROOT.$this->aConf['racine_statiques'].$num.'.'.$this->aStats[ $num ]['url'].'.php';
if(file_exists($filename) AND filesize($filename) > 0) {
if($f = fopen($filename, 'r')) {
$content = fread($f, filesize($filename));
fclose($f);
$content = file_get_contents($filename);
if(is_string($content)) {
# On retourne le contenu
return $content;
} else {
return implode(PHP_EOL, array('<p>', "\t" . L_UNKNOWN_ERROR, '</p>'));
}
}
return null;
return implode(PHP_EOL, array('<p>', "\t" . L_STATICS_NEW_PAGE, '</p>'));
}

/**
Expand Down
3 changes: 2 additions & 1 deletion core/lib/class.plx.plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct($default_lang='') {

register_shutdown_function(function() {
$error = error_get_last();
if($error != null) {
if($error != null and !empty($error['file']) and (PLX_DEBUG or $error['type'] < E_DEPRECATED)) { # error['type'] < 8192
# For hiding sensitive informations
$documentRoot = realpath($_SERVER['DOCUMENT_ROOT']); # resolve symbolic link with Linux
$filename = $error['file'];
Expand Down Expand Up @@ -79,6 +79,7 @@ public function __construct($default_lang='') {
User : <?= $_SESSION['user'] . PHP_EOL ?>
Profil : <?= $_SESSION['profil'] . PHP_EOL ?>
PluXml version : <?= PLX_VERSION . PHP_EOL ?>
PLX_DEBUG : <?= PLX_DEBUG ? 'true' : 'false' ?>
PHP version : <?= PHP_VERSION . PHP_EOL ?>
<?= $hr ?>
About this server :
Expand Down
2 changes: 1 addition & 1 deletion core/lib/config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
const PLX_DEBUG = true;
const PLX_VERSION = '5.8.14';
const PLX_VERSION = '5.8.15';
const PLX_URL_REPO = 'https://www.pluxml.org';
const PLX_URL_VERSION = PLX_URL_REPO.'/download/latest-version.txt';

Expand Down
5 changes: 5 additions & 0 deletions readme/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## PLUXML 5.8.15 (2024/07/18)
[+] plxAdmin::getFileStatique() always returns a string
[+] PLX_DEBUG is set to "true"
[+] In plxPlugins::__construct(), error is ignored in some cases

## PLUXML 5.8.14 (2024/05/15)
[+] date_creation or date_update may be missing in a file of article

Expand Down

0 comments on commit 3d6965f

Please sign in to comment.