Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better view for fatal error #816

Merged
merged 8 commits into from
Apr 16, 2024
4 changes: 2 additions & 2 deletions core/admin/article.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function refreshImg(dta) {
gt = />/g,
ap = /’/g,
ic = /"/g;
dta = dta.replace(lt, "<").replace(gt, ">").replace(ap, "&\#39;").replace(ic, "&\#34;");}
dta = dta.replace(lt, "<").replace(gt, ">").replace(ap, "&\#39;").replace(ic, "&\#34;");
let link = dta.match(/^(?:https?|data):/gi) ? dta : '<?php echo $plxAdmin->racine ?>'+dta;
document.getElementById('id_thumbnail_img').innerHTML = '<img src="'+link+'" alt="" />';
}
Expand All @@ -286,7 +286,7 @@ function refreshImg(dta) {

<p><a class="back" href="index.php"><?php echo L_BACK_TO_ARTICLES ?></a></p>

<input type="submit" name="preview" onclick="this.form.target='_blank';return true;" value="<?php echo L_ARTICLE_PREVIEW_BUTTON ?>"/>
<input type="submit" name="preview" onclick="this.form.target='plx_preview_article'; return true;" value="<?php echo L_ARTICLE_PREVIEW_BUTTON ?>"/>
<?php
if($_SESSION['profil']>PROFIL_MODERATOR AND $plxAdmin->aConf['mod_art']) {
if(in_array('draft', $catId)) { # brouillon
Expand Down
54 changes: 40 additions & 14 deletions core/lib/class.plx.plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,28 @@ public function __construct($default_lang='') {
# For hiding sensitive informations
$documentRoot = realpath($_SERVER['DOCUMENT_ROOT']); # resolve symbolic link with Linux
$filename = $error['file'];
$newFolder = dirname($filename) . '-orig';

$hr = str_repeat('=', 60) . PHP_EOL;
header('Content-Type: text/plain; charset=UTF-8');

if(isset($this->rootPlugins) and preg_match('#^' . $this->rootPlugins . '/([^/]+)#', $error['file'], $matches)) {
$hasHeaders_sent = headers_sent();
if(!$hasHeaders_sent and empty(ob_get_length())) {
header('Content-Type: text/plain; charset=UTF-8');
} else {
?>
<pre id="fatal-error" style="
position: fixed;
top: 10vh;
width: 80rem;
left: calc(50vw - 40rem);
max-height: 80vh;
padding: 0.5rem 1rem;
background-color: #555;
color: lime;
"><code>
<?php
}
if(isset($this->rootPlugins) and preg_match('#' . basename($this->rootPlugins) . '/([^/]+)/\1\.php$#', $error['file'], $matches)) {
$pluginName = $matches[1];
$newFolder = dirname($filename) . '-orig';
?>
An error is occured with the "<?= strtoupper($pluginName) ?>" plugin :
<?php
Expand Down Expand Up @@ -87,10 +102,14 @@ public function __construct($default_lang='') {
'PHP_SELF',
));
}, ARRAY_FILTER_USE_KEY) as $k=>$v) {
if($k == 'SCRIPT_FILENAME') {
$v = preg_replace('#^' . $documentRoot . '#', '', $v);
switch($k) {
case 'SCRIPT_FILENAME' : $v = preg_replace('#^' . $documentRoot . '#', '', realpath($v)); break;
case 'SERVER_SIGNATURE' : $v = trim(strip_tags($v)); break;
default : # nothing to do
}
if(!empty($v)) {
echo $k . ' : ' . $v . PHP_EOL;
}
echo $k . ' : ' . $v . PHP_EOL;
}

if(!empty($pluginName)) {
Expand All @@ -100,28 +119,35 @@ public function __construct($default_lang='') {
?>
<?= $hr ?>
About this plugin :
<?php readfile($infosFilename); ?>
<?= htmlspecialchars(file_get_contents($infosFilename)); ?>
<?php
}
}
} # fin pour l'administrateur

echo $hr;
if(!empty($pluginName) and rename(dirname($filename), $newFolder)) {
# PluXml essaie de sauver la situation
if(!empty($pluginName)) {
echo $hr;
if(rename(dirname($filename), $newFolder)) {
# PluXml essaie de sauver la situation
?>
The folder of plugin is renamed to : <?= preg_replace('#^' . $this->rootPlugins . '/#', '', $newFolder) . PHP_EOL ?>
Reload this page to continue ...
<?php
} else {
# Echec ! Une intervention humaine est requise pour débloquer la situation
} else {
# Echec ! Une intervention humaine est requise pour débloquer la situation
?>
Drop this plugin now for running PluXml and report to its author !!
<?php
}
}

if($hasHeaders_sent) {
?>
</code></pre>
<?php
}
}
});

}

/**
Expand Down
Empty file modified update/update_5.8.1.php
100755 → 100644
Empty file.
Empty file modified update/update_5.8.6.php
100755 → 100644
Empty file.
9 changes: 5 additions & 4 deletions update/versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
'5.8.5' => '',
'5.8.6' => 'update_5.8.6.php',
'5.8.7' => 'update_5.8.7.php',
'5.8.8' => '',
'5.8.9' => '',
'5.8.10' => '',
'5.8.11' => '',
'5.8.8' => '',
'5.8.9' => '',
'5.8.10' => '',
'5.8.11' => '',
'5.8.12' => '',
);