opensmtpdadmin/setup.php

53 lines
2.4 KiB
PHP
Raw Normal View History

2022-08-18 14:01:52 +02:00
<?php
2022-08-22 20:59:23 +02:00
/**
* OpenSMTPD Admin Setup
* by Jeroen Janssen <jeroen at laylo dot io>
* Copyright (c) 2022 LAYLO
*/
/* Check whether the configuration file exists - bail if that is the case */
if (file_exists(realpath("./config.inc.php"))) {
2022-08-22 20:59:23 +02:00
print 'It seems that config.inc.php is already configured. Please delete setup.php to continue.';
die();
}
/* Define the app specifics */
2022-08-22 20:59:23 +02:00
DEFINE('APP_NAME', 'OpenSMTPD Admin Setup Checker');
DEFINE('VERSION', '1.1');
/* Start generating the HTML output */
2022-08-22 20:59:23 +02:00
$html = '<html>';
$html .= '<head>';
$html .= '<title></title>';
$html .= '</head>';
$html .= '<body>';
$html .= '<img id="login_header_logo" src="images/postbox.png" />';
$html .= '<img id="login_header_logo" height="30px" src="images/opensmtpdadmin.png" />';
$html .= '<h1>' . APP_NAME . ' v' . VERSION . '</h1>';
$html .= '<p>It seems that you are running this version of OpenSMTPD Admin for the first time.</p>';
$html .= '<table>';
$html .= '<tr>';
$html .= '<td><strong>PHP:</strong></td>';
$html .= (version_compare(PHP_VERSION, '7.4.0') >= 0) ? '<td><span style="color:green;">At least 7.4</td>' : '<td><span style="color:red;">Unsupported version (=< 7.3)</span></td>';
2022-08-22 20:59:23 +02:00
$html .= '</tr><tr>';
$html .= '<td><strong>SQL support:</strong></td>';
$html .= (extension_loaded('mysqli')) ? '<td><span style="color:green;">MySQL/MariaDB</span>' : '<td><span style="color:red;">MySQL/MariaDB</span>';
$html .= (extension_loaded('pgsql')) ? ' - <span style="color:green;">PostgreSQL</span> (change the database_type if you want to use PostgreSQL)</td>' : ' - <span style="color:red;">PostgreSQL</span></td>';
$html .= '</tr><tr>';
$html .= '<td><strong>Functions:</strong></td>';
$html .= (extension_loaded('pcre')) ? '<td><span style="color:green;">pcre</span>' : '<td><span style="color:red;">pcre</span>';
$html .= (function_exists('get_magic_quotes_gpc')) ? ' - <span style="color:green;">get_magic_quotes_gpc</span>' : ' - <span style="color:red;">get_magic_quotes_gpc</span>';
$html .= (function_exists('session_start')) ? ' - <span style="color:green;">session_start</span></td>' : ' - <span style="color:red;">session_start</span></td>';
$html .= '</tr>';
$html .= '</table>';
$html .= '<p>Copy the <pre>config.inc.php.sample</pre> to <pre>config.inc.php</pre> and edit it to your environment and delete <em>setup.php</em>';
2022-08-22 20:59:23 +02:00
$html .= '</body>';
$html .= '</html>';
/* Print the output */
2022-08-22 20:59:23 +02:00
print $html;
/* Thank you, goodbye */
2022-08-22 20:59:23 +02:00
die();
?>