remove last in favor of define

This commit is contained in:
mischa 2022-09-04 20:32:35 +00:00
parent 6fba688215
commit 555cc197a4
11 changed files with 24 additions and 142 deletions

View File

@ -1,6 +1,5 @@
<?php
define('DEBUG', 'true');
define('PAGE_SIZE', '10');
define('DB_TYPE', 'mysql');
define('DB_HOST', '');
@ -8,10 +7,22 @@ define('DB_USER', '');
define('DB_PASS', '');
define('DB_NAME', '');
define('ADMIN_EMAIL', 'postmaster@example.tld');
define('LOGGING', 'YES');
define('ALIASES', '10');
define('MAILBOXES', '10');
define('ALIAS_CONTROL', 'NO');
define('VACATION', 'NO');
define('ADMIN_EMAIL', 'postmaster@example.tld');
define('DEFAULT_LANGUAGE', 'en');
define('PAGE_SIZE', '25');
define('LOGGING', 'YES');
define('SHOW_HEADER', 'NO');
define('HEADER_TEXT', ':: OpenSMTPD Admin ::');
define('SHOW_FOOTER', 'YES');
define('FOOTER_TEXT', 'Return to OpenSMTPD!');
define('FOOTER_LINK', 'http://git.high5.nl/opensmtpdadmin');
?>

View File

@ -1,127 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: config.inc.php
//
if (preg_match("/config.inc.php/", $_SERVER['SCRIPT_NAME'])) {
header("Location: login.php");
exit;
}
// Debug mode
// Enables PHP error output
$CONF['debug'] = 'false';
// Language config
// Language files are located in './languages'.
$CONF['default_language'] = 'en';
// Database Config
// mysqli = MySQL 4.1
// pgsql = PostgreSQL
$CONF['database_type'] = 'mysqli';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'opensmtpdadmin';
$CONF['database_password'] = 'RandomStringOfChars';
$CONF['database_name'] = 'opensmtpd';
$CONF['database_prefix'] = '';
// Site Admin
// Define the Site Admins email address below.
// This will be used to send emails from to create mailboxes.
$CONF['admin_email'] = 'postmaster@change-this-to-your.domain.tld';
// Encrypt
$CONF['encrypt'] = 'bcrypt';
// Generate Password
// Generate a random password for a mailbox and display it.
// If you want to automagically generate paswords set this to 'YES'.
$CONF['generate_password'] = 'NO';
// Page Size
// Set the number of entries that you would like to see
// in one page.
$CONF['page_size'] = '25';
// Default Aliases
// The default aliases that need to be created for all domains.
$CONF['default_aliases'] = array (
'abuse' => 'abuse@change-this-to-your.domain.tld',
'hostmaster' => 'hostmaster@change-this-to-your.domain.tld',
'postmaster' => 'postmaster@change-this-to-your.domain.tld',
'webmaster' => 'webmaster@change-this-to-your.domain.tld'
);
// Mailboxes
// If you want to store the mailboxes per domain set this to 'YES'.
// Example: /usr/local/virtual/domain.tld/username@domain.tld
$CONF['domain_path'] = 'NO';
// If you don't want to have the domain in your mailbox set this to 'NO'.
// Example: /usr/local/virtual/domain.tld/username
$CONF['domain_in_mailbox'] = 'YES';
// Default Domain Values
// Specify your default values below. Quota in MB.
$CONF['aliases'] = '10';
$CONF['mailboxes'] = '10';
$CONF['maxquota'] = '0';
// Quota
// When you want to enforce quota for your mailbox users set this to 'YES'.
$CONF['quota'] = 'NO';
// You can either use '1024000' or '1048576'
$CONF['quota_multiplier'] = '1024000';
// Transport
// If you want to define additional transport options for a domain set this to 'YES'.
// Read the transport file of the OpenSMTPD documentation.
$CONF['transport'] = 'NO';
// Virtual Vacation
// If you want to use virtual vacation for you mailbox users set this to 'YES'.
$CONF['vacation'] = 'NO';
// Alias Control
// OpenSMTPD Admin inserts an alias in the alias table for every mailbox it creates.
// The reason for this is that when you want catch-all and normal mailboxes
// to work you need to have the mailbox replicated in the alias table.
// If you want to take control of these aliases as well set this to 'YES'.
$CONF['alias_control'] = 'NO';
// Special Alias Control
// Set to 'NO' if you don't want your domain admins to change the default aliases.
$CONF['special_alias_control'] = 'YES';
// Logging
// If you don't want logging set this to 'NO';
$CONF['logging'] = 'YES';
// Header
$CONF['show_header_text'] = 'NO';
$CONF['header_text'] = ':: OpenSMTPD Admin ::';
// Footer
// Below information will be on all pages.
// If you don't want the footer information to appear set this to 'NO'.
$CONF['show_footer_text'] = 'YES';
$CONF['footer_text'] = 'Return to change-this-to-your.domain.tld!';
$CONF['footer_link'] = 'http://change-this-to-your.domain.tld/';
// Welcome Message
// This message is send to every newly created mailbox.
// Change the text between EOM.
$CONF['welcome_text'] = <<<EOM
Hi,
Welcome to your new account.
EOM;
//
// END OF CONFIG FILE
//
?>

View File

@ -15,7 +15,7 @@ if(preg_match("/functions.inc.php/", $_SERVER['SCRIPT_NAME'])) {
DEFINE("VERSION", "version 1.0.0");
DEFINE('ROOT_PATH', dirname(__FILE__) . '/');
require_once ROOT_PATH . 'conf.php';
require_once ROOT_PATH . 'config.inc.php';
#require_once ROOT_PATH . 'config.inc.php';
//
// Check of debug is enabled or not

View File

@ -139,6 +139,7 @@ $LANG['Sendmail_to_text_error'] = '<span class="error_msg">TO is empty or is not
$LANG['Sendmail_subject'] = 'Subject';
$LANG['Sendmail_subject_text'] = 'Welcome';
$LANG['Sendmail_body'] = 'Body';
$LANG['Sendmail_body_text'] = "Hi,\n\nWelcome to your new account.";
$LANG['Sendmail_button'] = 'Send Message';
$LANG['Sendmail_result_error'] = '<span class="error_msg">Unable to send message.</span>';
$LANG['Sendmail_result_succes'] = 'The mailbox has been created.';

View File

@ -1,9 +1,9 @@
<div id="footer">
<a href="https://git.high5.nl/opensmtpdadmin/">OpenSMTPD Admin <?php echo VERSION ?></a>
<?php
if (($CONF['show_footer_text'] == "YES") and ($CONF['footer_link'])) {
if (SHOW_FOOTER == "YES" && FOOTER_LINK) {
echo "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;";
echo "<a href=\"" . $CONF['footer_link'] . "\">" . $CONF['footer_text'] . "</a>\n";
echo "<a href=\"" . FOOTER_LINK . "\">" . FOOTER_TEXT . "</a>\n";
}
?>
</div>

View File

@ -27,8 +27,8 @@ if (file_exists(realpath("../stylesheet.css"))) {
echo "<img id=\"login_header_logo\" src=\"../images/postbox.png\" />\n";
echo "<img id=\"login_header_logo\" height=\"30px\"% src=\"../images/opensmtpdadmin.png\" />\n";
}
if (($CONF['show_header_text'] == "YES") and ($CONF['header_text'])) {
echo "<h2>" . $CONF['header_text'] . "</h2>\n";
if (SHOW_HEADER == "YES" && HEADER_TEXT) {
echo "<h2>" . HEADER_TEXT . "</h2>\n";
}
?>
</div>

View File

@ -13,8 +13,6 @@ if ($list_domains[$domain_key]['aliases'] == 0) $list_domains[$domain_key]['alia
if ($list_domains[$domain_key]['aliases'] < 0) $list_domains[$domain_key]['aliases'] = $LANG['Overview_disabled'];
if ($list_domains[$domain_key]['mailboxes'] == 0) $list_domains[$domain_key]['mailboxes'] = $LANG['Overview_unlimited'];
if ($list_domains[$domain_key]['mailboxes'] < 0) $list_domains[$domain_key]['mailboxes'] = $LANG['Overview_disabled'];
if ($list_domains[$domain_key]['maxquota'] == 0) $list_domains[$domain_key]['maxquota'] = $LANG['Overview_unlimited'];
if ($list_domains[$domain_key]['maxquota'] < 0) $list_domains[$domain_key]['maxquota'] = $LANG['Overview_disabled'];
?>
</select>
<input type="hidden" name="offset" value="0">

View File

@ -22,7 +22,7 @@
<tr>
<td><?php echo $LANG['Sendmail_body'] . ":" ?></td>
<td>
<textarea class="flat" rows="10" cols="60" name="body"><?php echo $CONF['welcome_text']; ?></textarea>
<textarea class="flat" rows="10" cols="60" name="body"><?php echo $LANG['Sendmail_body_text']; ?></textarea>
</td>
<td>&nbsp;</td>
</tr>

View File

@ -4,7 +4,7 @@
<td>&nbsp;</td>
<td><?php echo $_SESSION['userid']['username']; ?></td>
</tr>
<?php if ($CONF['vacation'] == 'YES') { ?>
<?php if (VACATION == 'YES') { ?>
<tr>
<td nowrap><a target="_top" href="vacation.php"><?php echo $LANG['UsersMenu_vacation']; ?></a></td>
<td><?php echo $LANG['UsersMain_vacation']; ?></td>

View File

@ -1,6 +1,6 @@
<div id="menu">
<ul>
<?php if ($CONF['vacation'] == "YES") { ?>
<?php if (VACATION == "YES") { ?>
<li><a target="_top" href="vacation.php"><?php echo $LANG['UsersMenu_vacation']; ?></a></li>
<?php } ?>
<li><a target="_top" href="password.php"><?php echo $LANG['UsersMenu_password']; ?></a></li>

View File

@ -36,7 +36,6 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") {
$log = $sth->fetchAll();
}
}
include './templates/header.tpl';
include './templates/menu.tpl';
include './templates/viewlog.tpl';