mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 22:33:55 -07:00
New emailer and page configuration.
This commit is contained in:
parent
40e4fb0791
commit
4eb259818a
8 changed files with 40 additions and 49 deletions
20
config/email.php
Normal file
20
config/email.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* TorrentPier – Bull-powered BitTorrent tracker engine
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2005-2017 TorrentPier (https://torrentpier.com)
|
||||||
|
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
||||||
|
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'enabled' => true,
|
||||||
|
'smtp' => [
|
||||||
|
'enabled' => false, // send email via external SMTP server
|
||||||
|
'host' => '', // SMTP server host
|
||||||
|
'port' => 25, // SMTP server port
|
||||||
|
'username' => '', // SMTP username (if server requires it)
|
||||||
|
'password' => '', // SMTP password (if server requires it)
|
||||||
|
],
|
||||||
|
'ssl_type' => '', // SMTP ssl type (ssl or tls)
|
||||||
|
];
|
|
@ -164,7 +164,7 @@ class Emailer
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang, $userdata;
|
global $bb_cfg, $lang, $userdata;
|
||||||
|
|
||||||
if (!$bb_cfg['emailer']['enabled']) {
|
if (!config('email.enabled')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,25 +180,25 @@ class Emailer
|
||||||
$this->encoding = $bb_cfg['charset'];
|
$this->encoding = $bb_cfg['charset'];
|
||||||
|
|
||||||
/** Prepare message */
|
/** Prepare message */
|
||||||
if ($bb_cfg['emailer']['smtp']['enabled']) {
|
if (config('email.smtp.enabled')) {
|
||||||
if (!empty($bb_cfg['emailer']['smtp']['host'])) {
|
if (!empty(config('email.smtp.host'))) {
|
||||||
if (empty($bb_cfg['emailer']['ssl_type'])) {
|
if (empty(config('email.ssl_type'))) {
|
||||||
/** @var Swift_SmtpTransport $transport external SMTP without ssl */
|
/** @var Swift_SmtpTransport $transport external SMTP without ssl */
|
||||||
$transport = (new Swift_SmtpTransport(
|
$transport = (new Swift_SmtpTransport(
|
||||||
$bb_cfg['emailer']['smtp']['host'],
|
config('email.smtp.host'),
|
||||||
$bb_cfg['emailer']['smtp']['port']
|
config('email.smtp.port')
|
||||||
))
|
))
|
||||||
->setUsername($bb_cfg['emailer']['smtp']['username'])
|
->setUsername(config('email.smtp.username'))
|
||||||
->setPassword($bb_cfg['emailer']['smtp']['password']);
|
->setPassword(config('email.smtp.password'));
|
||||||
} else {
|
} else {
|
||||||
/** @var Swift_SmtpTransport $transport external SMTP with ssl */
|
/** @var Swift_SmtpTransport $transport external SMTP with ssl */
|
||||||
$transport = (new Swift_SmtpTransport(
|
$transport = (new Swift_SmtpTransport(
|
||||||
$bb_cfg['emailer']['smtp']['host'],
|
config('email.smtp.host'),
|
||||||
$bb_cfg['emailer']['smtp']['port'],
|
config('email.smtp.port'),
|
||||||
$bb_cfg['emailer']['ssl_type']
|
config('email.ssl_type')
|
||||||
))
|
))
|
||||||
->setUsername($bb_cfg['emailer']['smtp']['username'])
|
->setUsername(config('email.smtp.username'))
|
||||||
->setPassword($bb_cfg['emailer']['smtp']['password']);
|
->setPassword(config('email.smtp.password'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/** @var Swift_SmtpTransport $transport local SMTP */
|
/** @var Swift_SmtpTransport $transport local SMTP */
|
||||||
|
|
|
@ -376,18 +376,6 @@ $bb_cfg['new_user_reg_restricted'] = false; // Ограничить регист
|
||||||
$bb_cfg['reg_email_activation'] = true; // Требовать активацию учетной записи по email
|
$bb_cfg['reg_email_activation'] = true; // Требовать активацию учетной записи по email
|
||||||
|
|
||||||
// Email
|
// Email
|
||||||
$bb_cfg['emailer'] = [
|
|
||||||
'enabled' => true,
|
|
||||||
'smtp' => [
|
|
||||||
'enabled' => false, // send email via external SMTP server
|
|
||||||
'host' => '', // SMTP server host
|
|
||||||
'port' => 25, // SMTP server port
|
|
||||||
'username' => '', // SMTP username (if server requires it)
|
|
||||||
'password' => '', // SMTP password (if server requires it)
|
|
||||||
],
|
|
||||||
'ssl_type' => '', // SMTP ssl type (ssl or tls)
|
|
||||||
];
|
|
||||||
|
|
||||||
$bb_cfg['board_email'] = "noreply@$domain_name"; // admin email address
|
$bb_cfg['board_email'] = "noreply@$domain_name"; // admin email address
|
||||||
$bb_cfg['board_email_form'] = false; // can users send email to each other via board
|
$bb_cfg['board_email_form'] = false; // can users send email to each other via board
|
||||||
$bb_cfg['board_email_sig'] = ''; // this text will be attached to all emails the board sends
|
$bb_cfg['board_email_sig'] = ''; // this text will be attached to all emails the board sends
|
||||||
|
@ -588,23 +576,6 @@ $bb_cfg['nofollow'] = [
|
||||||
'allowed_url' => [$domain_name], // 'allowed.site', 'www.allowed.site'
|
'allowed_url' => [$domain_name], // 'allowed.site', 'www.allowed.site'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Page settings
|
|
||||||
$bb_cfg['page'] = [
|
|
||||||
'show_torhelp' => [
|
|
||||||
#BB_SCRIPT => true
|
|
||||||
'index' => true,
|
|
||||||
'tracker' => true,
|
|
||||||
],
|
|
||||||
'show_sidebar1' => [
|
|
||||||
#BB_SCRIPT => true
|
|
||||||
'index' => true,
|
|
||||||
],
|
|
||||||
'show_sidebar2' => [
|
|
||||||
#BB_SCRIPT => true
|
|
||||||
'index' => true,
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
// Tracker settings
|
// Tracker settings
|
||||||
$bb_cfg['tracker'] = [
|
$bb_cfg['tracker'] = [
|
||||||
'autoclean' => true,
|
'autoclean' => true,
|
||||||
|
|
|
@ -166,8 +166,8 @@ $template->assign_vars(array(
|
||||||
'U_TERMS' => $bb_cfg['terms_and_conditions_url'],
|
'U_TERMS' => $bb_cfg['terms_and_conditions_url'],
|
||||||
'U_TRACKER' => "tracker.php",
|
'U_TRACKER' => "tracker.php",
|
||||||
|
|
||||||
'SHOW_SIDEBAR1' => !empty($bb_cfg['page']['show_sidebar1'][BB_SCRIPT]) || $bb_cfg['show_sidebar1_on_every_page'],
|
'SHOW_SIDEBAR1' => !empty(config('page.show_sidebar1.' . BB_SCRIPT)) || $bb_cfg['show_sidebar1_on_every_page'],
|
||||||
'SHOW_SIDEBAR2' => !empty($bb_cfg['page']['show_sidebar2'][BB_SCRIPT]) || $bb_cfg['show_sidebar2_on_every_page'],
|
'SHOW_SIDEBAR2' => !empty(config('page.show_sidebar2.' . BB_SCRIPT)) || $bb_cfg['show_sidebar2_on_every_page'],
|
||||||
|
|
||||||
'HTML_AGREEMENT' => LANG_DIR . 'html/user_agreement.html',
|
'HTML_AGREEMENT' => LANG_DIR . 'html/user_agreement.html',
|
||||||
'HTML_COPYRIGHT' => LANG_DIR . 'html/copyright_holders.html',
|
'HTML_COPYRIGHT' => LANG_DIR . 'html/copyright_holders.html',
|
||||||
|
@ -209,7 +209,7 @@ $template->assign_vars(array(
|
||||||
'U_WATCHED_TOPICS' => "profile.php?mode=watch",
|
'U_WATCHED_TOPICS' => "profile.php?mode=watch",
|
||||||
));
|
));
|
||||||
|
|
||||||
if (!empty($bb_cfg['page']['show_torhelp'][BB_SCRIPT]) && !empty($userdata['torhelp'])) {
|
if (!empty(config('page.show_torhelp.' . BB_SCRIPT)) && !empty($userdata['torhelp'])) {
|
||||||
$ignore_time = !empty($_COOKIE['torhelp']) ? (int)$_COOKIE['torhelp'] : 0;
|
$ignore_time = !empty($_COOKIE['torhelp']) ? (int)$_COOKIE['torhelp'] : 0;
|
||||||
|
|
||||||
if (TIMENOW > $ignore_time) {
|
if (TIMENOW > $ignore_time) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ switch ($mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Отключение регистрации
|
// Отключение регистрации
|
||||||
if ($bb_cfg['new_user_reg_disabled'] || ($bb_cfg['reg_email_activation'] && !$bb_cfg['emailer']['enabled'])) {
|
if ($bb_cfg['new_user_reg_disabled'] || ($bb_cfg['reg_email_activation'] && !config('email.enabled'))) {
|
||||||
bb_die($lang['NEW_USER_REG_DISABLED']);
|
bb_die($lang['NEW_USER_REG_DISABLED']);
|
||||||
} // Ограничение по времени
|
} // Ограничение по времени
|
||||||
elseif ($bb_cfg['new_user_reg_restricted']) {
|
elseif ($bb_cfg['new_user_reg_restricted']) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ if (!defined('BB_ROOT')) {
|
||||||
|
|
||||||
set_die_append_msg();
|
set_die_append_msg();
|
||||||
|
|
||||||
if (!$bb_cfg['emailer']['enabled']) {
|
if (!config('email.enabled')) {
|
||||||
bb_die($lang['EMAILER_DISABLED']);
|
bb_die($lang['EMAILER_DISABLED']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,5 +7,5 @@
|
||||||
<li>style/templates/default/page_footer.tpl</li>
|
<li>style/templates/default/page_footer.tpl</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br />
|
<br />
|
||||||
To disable this sidebar, set the variable $bb_cfg['page']['show_sidebar2'] in file config.php to false.
|
To disable this sidebar, set the variable 'show_sidebar2' in file config/page.php to false.
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,5 +7,5 @@
|
||||||
<li>style/templates/default/page_footer.tpl</li>
|
<li>style/templates/default/page_footer.tpl</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br />
|
<br />
|
||||||
To disable this sidebar, set the variable $bb_cfg['page']['show_sidebar2'] in file config.php to false.
|
To disable this sidebar, set the variable 'show_sidebar2' in file config/page.php to false.
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue