Skip to content

Commit

Permalink
Update file existence checks for 'conf.php' to use __DIR__
Browse files Browse the repository at this point in the history
  • Loading branch information
endelwar committed Sep 7, 2024
1 parent 3272c67 commit 1bee4e8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mailscanner/auto-release.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/

require_once __DIR__ . '/functions.php';
if (file_exists('conf.php')) {
if (file_exists(__DIR__ . '/conf.php')) {
$output = [];
if (isset($_GET['mid']) && (isset($_GET['r']) || isset($_GET['amp;r']))) {
dbconn();
Expand Down
2 changes: 1 addition & 1 deletion mailscanner/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}

// Read in MailWatch configuration file
if (!is_readable(__DIR__ . '/conf.php')) {
if (!file_exists(__DIR__ . '/conf.php') || !is_readable(__DIR__ . '/conf.php')) {
exit(__('cannot_read_conf'));
}
require_once __DIR__ . '/conf.php';
Expand Down
4 changes: 2 additions & 2 deletions mailscanner/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

$_SESSION['token'] = generateToken();

if (file_exists('conf.php') && isset($_GET['error'])) {
if (file_exists(__DIR__ . '/conf.php') && isset($_GET['error'])) {
$loginerror = deepSanitizeInput($_GET['error'], 'url');
if (false === validateInput($loginerror, 'loginerror')) {
header('Location: login.php');
Expand Down Expand Up @@ -84,7 +84,7 @@ function enableTimeoutNotice (timeout){
<div class="center"><img src=".' . IMAGES_DIR . MW_LOGO . '" alt="' . __('mwlogo99') . '"></div>
<h1>' . __('mwlogin01') . '</h1>
<div class="inner-container">';
if (file_exists('conf.php')) {
if (file_exists(__DIR__ . '/conf.php')) {
echo '
<form name="loginform" class="loginform" method="post" action="checklogin.php" autocomplete="off">
<fieldset class="hidden" id="sessiontimeout">
Expand Down
2 changes: 1 addition & 1 deletion mailscanner/password_reset.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
</div>
<div class="border-rounded">
<h1><?php echo __('title63'); ?></h1>
<?php if (file_exists('conf.php')) {
<?php if (file_exists(__DIR__ . '/conf.php')) {
if ('' !== $fields) {
?>
<form name="pwdresetform" class="pwdresetform" method="post" action="<?php echo sanitizeInput($_SERVER['PHP_SELF']); ?>" autocomplete="off">
Expand Down

0 comments on commit 1bee4e8

Please sign in to comment.