Blob


1 <?php
2 /**
3 * OpenSMTPD Admin Refactor
4 * by Jeroen Janssen <jeroen at laylo dot io>
5 * Copyright (c) 2022-2023 LAYLO
6 */
8 // Check whether the configuration file exists - bail if that is the case
9 if (file_exists(realpath("./conf.php"))) {
10 print 'It seems that conf.php is already configured. Please delete setup.php to continue.';
11 die();
12 }
13 // Define the app specifics
14 DEFINE('APP_NAME', 'OpenSMTPD Admin Setup Checker');
15 DEFINE('VERSION', '1.2');
17 // Start generating the HTML output
18 $html = '<html>';
19 $html .= '<head>';
20 $html .= '<title></title>';
21 $html .= '</head>';
22 $html .= '<body>';
23 $html .= '<img id="login_header_logo" src="images/postbox.png" />';
24 $html .= '<img id="login_header_logo" height="30px" src="images/opensmtpdadmin.png" />';
25 $html .= '<h1>' . APP_NAME . ' v' . VERSION . '</h1>';
26 $html .= '<p>It seems that you are running this version of OpenSMTPD Admin for the first time.</p>';
27 $html .= '<table>';
28 $html .= '<tr>';
29 $html .= '<td><strong>PHP version:</strong></td>';
30 $html .= (version_compare(PHP_VERSION, '7.4.0') >= 0) ? '<td><span style="color:green;">' . phpversion() . '</td>' : '<td><span style="color:red;">' . phpversion() . '</span></td>';
31 $html .= '</tr><tr>';
32 $html .= '<td><strong>SQL support:</strong></td>';
33 $html .= (extension_loaded('PDO')) ? '<td><span style="color:green;">PDO - MySQL/MariaDB</span>' : '<td><span style="color:red;">PDO - MySQL/MariaDB</span>';
34 $html .= '</tr><tr>';
35 $html .= '<td><strong>Functions:</strong></td>';
36 $html .= (extension_loaded('pcre')) ? '<td><span style="color:green;">pcre</span>' : '<td><span style="color:red;">pcre</span>';
37 $html .= (function_exists('session_start')) ? ' - <span style="color:green;">session_start</span></td>' : ' - <span style="color:red;">session_start</span></td>';
38 $html .= '</tr>';
39 $html .= '</table>';
40 $html .= '<p>cp or mv conf.php-sample to conf.php and change it to reflect your setup.</p>';
41 $html .= '</body>';
42 $html .= '</html>';
44 print $html;
45 die();
46 ?>