Use APP_NAME and MAIL_FROM_ADDRESS in place of database settings and remove unused entries from site and settings table

This commit is contained in:
DariusIII
2020-03-01 01:13:00 +01:00
parent 5a34b67450
commit 405c6f34ac
26 changed files with 40 additions and 331 deletions
+1 -1
View File
@@ -116,7 +116,7 @@ class NZB
);
$this->_siteCommentString = sprintf(
'NZB downloaded from %s',
Settings::settingValue('site.main.title')
config('app.name')
);
}
+2 -2
View File
@@ -122,9 +122,9 @@ abstract class Capabilities
return [
'server' => [
'title' => Settings::settingValue('site.main.title'),
'title' => config('app.name'),
'strapline' => Settings::settingValue('site.main.strapline'),
'email' => Settings::settingValue('site.main.email'),
'email' => config('mail.from.address'),
'meta' => Settings::settingValue('site.main.metakeywords'),
'url' => $serverroot,
'image' => $serverroot.'/assets/images/tmux_logo.png',
+2 -2
View File
@@ -30,9 +30,9 @@ class ApiV2Controller extends BasePageController
$capabilities = [
'server' => [
'title' => Settings::settingValue('site.main.title'),
'title' => config('app.name'),
'strapline' => Settings::settingValue('site.main.strapline'),
'email' => Settings::settingValue('site.main.email'),
'email' => config('mail.from.address'),
'url' => url('/'),
],
'limits' => [
@@ -170,7 +170,7 @@ class BtcPaymentController extends BasePageController
User::updateUserRoleChangeDate($userId, null, $role->addyears);
PaypalPayment::query()->insert(['users_id' => $userId, 'transaction_id' => $request->input('paymentId'), 'created_at' => now(), 'updated_at' => now()]);
$title = 'Cheers!';
$meta_title = Settings::settingValue('site.main.title').' - Payment Complete';
$meta_title = config('app.name').' - Payment Complete';
$meta_description = 'Payment Complete';
$content = $this->smarty->fetch('thankyou.tpl');
$this->smarty->assign(compact('content', 'meta_title', 'title', 'meta_description'));
+5 -5
View File
@@ -32,7 +32,7 @@ class ContactUsController extends BasePageController
if ($request->has('useremail')) {
$email = $request->input('useremail');
$mailTo = Settings::settingValue('site.main.email');
$mailTo = config('mail.from.address');
$mailBody = 'Values submitted from contact form: ';
foreach ($request->all() as $key => $value) {
@@ -44,7 +44,7 @@ class ContactUsController extends BasePageController
if (! preg_match("/\n/i", $request->input('useremail'))) {
SendContactUsEmail::dispatch($email, $mailTo, $mailBody)->onQueue('contactemail');
}
$msg = "<h2 style='text-align:center;'>Thank you for getting in touch with ".Settings::settingValue('site.main.title').'.</h2>';
$msg = "<h2 style='text-align:center;'>Thank you for getting in touch with ".config('app.name').'.</h2>';
}
return $this->showContactForm($msg);
@@ -58,10 +58,10 @@ class ContactUsController extends BasePageController
public function showContactForm($msg = '')
{
$this->setPrefs();
$title = 'Contact '.Settings::settingValue('site.main.title');
$meta_title = 'Contact '.Settings::settingValue('site.main.title');
$title = 'Contact '.config('app.name');
$meta_title = 'Contact '.config('app.name');
$meta_keywords = 'contact us,contact,get in touch,email';
$meta_description = 'Contact us at '.Settings::settingValue('site.main.title').' and submit your feedback';
$meta_description = 'Contact us at '.config('app.name').' and submit your feedback';
$content = $this->smarty->fetch('contact.tpl');
$this->smarty->assign(compact('title', 'content', 'meta_title', 'meta_keywords', 'meta_description', 'msg'));
+2 -2
View File
@@ -13,9 +13,9 @@ class TermsController extends BasePageController
{
$this->setPrefs();
$title = 'Terms and Conditions';
$meta_title = Settings::settingValue('site.main.title').' - Terms and conditions';
$meta_title = config('app.name').' - Terms and conditions';
$meta_keywords = 'terms,conditions';
$meta_description = 'Terms and Conditions for '.Settings::settingValue('site.main.title');
$meta_description = 'Terms and Conditions for '.config('app.name');
$content = $this->smarty->fetch($this->theme.'/terms.tpl');
+1 -1
View File
@@ -37,6 +37,6 @@ class SendAccountDeletedEmail implements ShouldQueue
*/
public function handle()
{
Mail::to(Settings::settingValue('site.main.email'))->send(new AccountDeleted($this->user));
Mail::to(config('mail.from.address'))->send(new AccountDeleted($this->user));
}
}
+1 -1
View File
@@ -37,6 +37,6 @@ class SendNewRegisteredAccountMail implements ShouldQueue
*/
public function handle()
{
Mail::to(Settings::settingValue('site.main.email'))->send(new NewAccountCreatedEmail($this->user));
Mail::to(config('mail.from.address'))->send(new NewAccountCreatedEmail($this->user));
}
}
+2 -2
View File
@@ -34,8 +34,8 @@ class AccountChange extends Mailable
public function __construct($user)
{
$this->user = $user;
$this->siteEmail = Settings::settingValue('site.main.email');
$this->siteTitle = Settings::settingValue('site.main.title');
$this->siteEmail = config('mail.from.address');
$this->siteTitle = config('app.name');
}
/**
+2 -2
View File
@@ -35,8 +35,8 @@ class AccountDeleted extends Mailable
public function __construct($user)
{
$this->user = $user;
$this->siteEmail = Settings::settingValue('site.main.email');
$this->siteTitle = Settings::settingValue('site.main.title');
$this->siteEmail = config('mail.from.address');
$this->siteTitle = config('app.name');
}
/**
+2 -2
View File
@@ -23,8 +23,8 @@ class AccountExpired extends Mailable
public function __construct($user)
{
$this->user = $user;
$this->siteEmail = Settings::settingValue('site.main.email');
$this->siteTitle = Settings::settingValue('site.main.title');
$this->siteEmail = config('mail.from.address');
$this->siteTitle = config('app.name');
}
/**
+2 -2
View File
@@ -34,8 +34,8 @@ class AccountWillExpire extends Mailable
{
$this->user = $user;
$this->days = $days;
$this->siteEmail = Settings::settingValue('site.main.email');
$this->siteTitle = Settings::settingValue('site.main.title');
$this->siteEmail = config('mail.from.address');
$this->siteTitle = config('app.name');
}
/**
+2 -2
View File
@@ -33,8 +33,8 @@ class ForgottenPassword extends Mailable
public function __construct($resetLink)
{
$this->resetLink = $resetLink;
$this->siteEmail = Settings::settingValue('site.main.email');
$this->siteTitle = Settings::settingValue('site.main.title');
$this->siteEmail = config('mail.from.address');
$this->siteTitle = config('app.name');
}
/**
+2 -2
View File
@@ -34,8 +34,8 @@ class NewAccountCreatedEmail extends Mailable
public function __construct($user)
{
$this->user = $user;
$this->siteEmail = Settings::settingValue('site.main.email');
$this->siteTitle = Settings::settingValue('site.main.title');
$this->siteEmail = config('mail.from.address');
$this->siteTitle = config('app.name');
}
/**
+2 -2
View File
@@ -41,8 +41,8 @@ class PasswordReset extends Mailable
{
$this->user = $user;
$this->newPass = $newPass;
$this->siteEmail = Settings::settingValue('site.main.email');
$this->siteTitle = Settings::settingValue('site.main.title');
$this->siteEmail = config('mail.from.address');
$this->siteTitle = config('app.name');
}
/**
+2 -2
View File
@@ -41,8 +41,8 @@ class SendInvite extends Mailable
{
$this->user = $user;
$this->invite = $invite;
$this->siteEmail = Settings::settingValue('site.main.email');
$this->siteTitle = Settings::settingValue('site.main.title');
$this->siteEmail = config('mail.from.address');
$this->siteTitle = config('app.name');
}
/**
+2 -2
View File
@@ -34,8 +34,8 @@ class WelcomeEmail extends Mailable
public function __construct($user)
{
$this->user = $user;
$this->siteEmail = Settings::settingValue('site.main.email');
$this->siteTitle = Settings::settingValue('site.main.title');
$this->siteEmail = config('mail.from.address');
$this->siteTitle = config('app.name');
}
/**
+2 -2
View File
@@ -35,12 +35,12 @@ class UserServiceObserver
'rate_limit' => $rateLimit,
]
);
if (! empty(Settings::settingValue('site.main.email') && File::isFile(base_path().'/_install/install.lock'))) {
if (! empty(config('mail.from.address') && File::isFile(base_path().'/_install/install.lock'))) {
SendNewRegisteredAccountMail::dispatch($user)->onQueue('newreg');
SendWelcomeEmail::dispatch($user)->onQueue('welcomeemails');
UserVerification::generate($user);
UserVerification::send($user, 'User email verification required', Settings::settingValue('site.main.email'));
UserVerification::send($user, 'User email verification required', config('mail.from.address'));
}
}
}
-80
View File
@@ -993,22 +993,6 @@ return [
'hint' => 'Whether to send WEB-DL to the WEB-DL section or not. If set to true they will go in WEB-DL category, false will send them in HD TV.<br/>This will also make them inaccessible to Sickbeard and possibly Couchpotato.',
'setting' => 'catwebdl',
],
129 => [
'section' => 'indexer',
'subsection' => 'categorise',
'name' => 'imdblanguage',
'value' => 'en',
'hint' => 'Which language to lookup when sending requests to IMDB/Tmdb. (If akas.imdb.com is set, imdb still returns the original titles.)',
'setting' => 'imdblanguage',
],
130 => [
'section' => 'indexer',
'subsection' => 'categorise',
'name' => 'imdburl',
'value' => '0',
'hint' => 'akas.imdb.com returns titles in their original title, imdb.com returns titles based on your IP address (if you are in france, you will get french titles).',
'setting' => 'imdburl',
],
131 => [
'section' => 'indexer',
'subsection' => 'ppa',
@@ -1042,54 +1026,6 @@ return [
Default: %Y-%m-%d %T',
'setting' => 'shell.date.format',
],
135 => [
'section' => 'site',
'subsection' => 'google',
'name' => 'adbrowse',
'value' => '',
'hint' => 'The banner slot in the header.',
'setting' => 'adbrowse',
],
136 => [
'section' => 'site',
'subsection' => 'google',
'name' => 'addetail',
'value' => '',
'hint' => 'The banner slot in the release details view.',
'setting' => 'addetail',
],
137 => [
'section' => 'site',
'subsection' => 'google',
'name' => 'adheader',
'value' => '',
'hint' => 'The banner slot in the header.',
'setting' => 'adheader',
],
138 => [
'section' => 'site',
'subsection' => 'google',
'name' => 'google_adsense_acc',
'value' => '',
'hint' => 'AdSense account: e.g. pub-123123123123123',
'setting' => 'google_adsense_acc',
],
139 => [
'section' => 'site',
'subsection' => 'google',
'name' => 'google_adsense_search',
'value' => '',
'hint' => 'The ID of the google search ad panel displayed at the bottom of the left menu.',
'setting' => 'google_adsense_search',
],
140 => [
'section' => 'site',
'subsection' => 'google',
'name' => 'google_analytics_acc',
'value' => '',
'hint' => 'Analytic\'s account: e.g. UA-xxxxxx-x',
'setting' => 'google_analytics_acc',
],
141 => [
'section' => 'site',
'subsection' => 'main',
@@ -1114,14 +1050,6 @@ Default: %Y-%m-%d %T',
'hint' => 'Optional URL to prepend to external links',
'setting' => 'dereferrer_link',
],
144 => [
'section' => 'site',
'subsection' => 'main',
'name' => 'email',
'value' => '',
'hint' => 'Shown in the contact us page, and where the contact html form is sent to.',
'setting' => 'email',
],
145 => [
'section' => 'site',
'subsection' => 'main',
@@ -1210,14 +1138,6 @@ Default: %Y-%m-%d %T',
'hint' => 'Text displayed in the terms and conditions page.',
'setting' => 'tandc',
],
156 => [
'section' => 'site',
'subsection' => 'main',
'name' => 'title',
'value' => 'NNTmux',
'hint' => 'Displayed around the site and contact form as the name for the site.',
'setting' => 'title',
],
157 => [
'section' => 'site',
'subsection' => 'main',
-104
View File
@@ -646,14 +646,6 @@ class SettingsTableSeeder extends Seeder
'hint' => 'The number of threads for update_releases.',
'setting' => 'releasethreads',
],
81 => [
'section' => '',
'subsection' => '',
'name' => 'replacenzbs',
'value' => '0',
'hint' => 'NZBs that are crossposted, instead of deleting, replace with the nzb grabbed.(This is not necessary, was added before I understood how crossposted nzbs work).',
'setting' => 'replacenzbs',
],
82 => [
'section' => '',
'subsection' => '',
@@ -846,14 +838,6 @@ class SettingsTableSeeder extends Seeder
'hint' => 'The api key used for access to rotten tomatoes.',
'setting' => 'rottentomatokey',
],
110 => [
'section' => 'APIs',
'subsection' => '',
'name' => 'tmdbkey',
'value' => '9a4e16adddcd1e86da19bcaf5ff3c2a3',
'hint' => 'The API key used for access to TMDb.',
'setting' => 'tmdbkey',
],
111 => [
'section' => 'APIs',
'subsection' => '',
@@ -942,14 +926,6 @@ class SettingsTableSeeder extends Seeder
'hint' => 'The path to an unrar binary, used in deep password detection and media info grabbing. Use forward slashes in windows c:/path/to/unrar.exe',
'setting' => 'unrarpath',
],
122 => [
'section' => 'apps',
'subsection' => '',
'name' => 'yydecoderpath',
'value' => '',
'hint' => 'Path to yydecode, this will decode yEnc articles. On ubuntu/debian you can get yydecode in the getdeb repository. Compiling yydecode from source is easy/fast also. Use forward slashes in windows c:/path/to/yydecode.exe',
'setting' => 'yydecoderpath',
],
123 => [
'section' => 'apps',
'subsection' => '',
@@ -998,22 +974,6 @@ class SettingsTableSeeder extends Seeder
'hint' => 'Whether to send WEB-DL to the WEB-DL section or not. If set to true they will go in WEB-DL category, false will send them in HD TV.<br/>This will also make them inaccessible to Sickbeard and possibly Couchpotato.',
'setting' => 'catwebdl',
],
129 => [
'section' => 'indexer',
'subsection' => 'categorise',
'name' => 'imdblanguage',
'value' => 'en',
'hint' => 'Which language to lookup when sending requests to IMDB/Tmdb. (If akas.imdb.com is set, imdb still returns the original titles.)',
'setting' => 'imdblanguage',
],
130 => [
'section' => 'indexer',
'subsection' => 'categorise',
'name' => 'imdburl',
'value' => '0',
'hint' => 'akas.imdb.com returns titles in their original title, imdb.com returns titles based on your IP address (if you are in france, you will get french titles).',
'setting' => 'imdburl',
],
131 => [
'section' => 'indexer',
'subsection' => 'ppa',
@@ -1047,54 +1007,6 @@ class SettingsTableSeeder extends Seeder
Default: %Y-%m-%d %T',
'setting' => 'shell.date.format',
],
135 => [
'section' => 'site',
'subsection' => 'google',
'name' => 'adbrowse',
'value' => '',
'hint' => 'The banner slot in the header.',
'setting' => 'adbrowse',
],
136 => [
'section' => 'site',
'subsection' => 'google',
'name' => 'addetail',
'value' => '',
'hint' => 'The banner slot in the release details view.',
'setting' => 'addetail',
],
137 => [
'section' => 'site',
'subsection' => 'google',
'name' => 'adheader',
'value' => '',
'hint' => 'The banner slot in the header.',
'setting' => 'adheader',
],
138 => [
'section' => 'site',
'subsection' => 'google',
'name' => 'google_adsense_acc',
'value' => '',
'hint' => 'AdSense account: e.g. pub-123123123123123',
'setting' => 'google_adsense_acc',
],
139 => [
'section' => 'site',
'subsection' => 'google',
'name' => 'google_adsense_search',
'value' => '',
'hint' => 'The ID of the google search ad panel displayed at the bottom of the left menu.',
'setting' => 'google_adsense_search',
],
140 => [
'section' => 'site',
'subsection' => 'google',
'name' => 'google_analytics_acc',
'value' => '',
'hint' => 'Analytic\'s account: e.g. UA-xxxxxx-x',
'setting' => 'google_analytics_acc',
],
141 => [
'section' => 'site',
'subsection' => 'main',
@@ -1119,14 +1031,6 @@ Default: %Y-%m-%d %T',
'hint' => 'Optional URL to prepend to external links',
'setting' => 'dereferrer_link',
],
144 => [
'section' => 'site',
'subsection' => 'main',
'name' => 'email',
'value' => '',
'hint' => 'Shown in the contact us page, and where the contact html form is sent to.',
'setting' => 'email',
],
145 => [
'section' => 'site',
'subsection' => 'main',
@@ -1215,14 +1119,6 @@ Default: %Y-%m-%d %T',
'hint' => 'Text displayed in the terms and conditions page.',
'setting' => 'tandc',
],
156 => [
'section' => 'site',
'subsection' => 'main',
'name' => 'title',
'value' => 'NNTmux',
'hint' => 'Displayed around the site and contact form as the name for the site.',
'setting' => 'title',
],
157 => [
'section' => 'site',
'subsection' => 'main',
+1 -1
View File
@@ -5,6 +5,6 @@
@endsection
@section('content')
{{ \App\Models\Settings::settingValue('site.main.title') }} <br><br><br>
{{ \App\Models\config('app.name') }} <br><br><br>
<b>Acess denied! You're permissions and/or role do not allow you to access this page</b>
@endsection
+1 -1
View File
@@ -5,6 +5,6 @@
@endsection
@section('content')
{{ \App\Models\Settings::settingValue('site.main.title') }} <br><br><br>
{{ \App\Models\config('app.name') }} <br><br><br>
<b>You are not logged in!</b> <br>Please <a href='{!! url('/login'); !!}'>login</a>
@endsection
+1 -1
View File
@@ -17,7 +17,7 @@
<div class="left_col scroll-view">
<div class="navbar nav_title" style="border: 0;">
<a href="{$site->home_link}" class="site_title"><i class="fab fa-phoenix-framework"></i>
<span>{$site->title}</span></a>
<span>{{config('app.name')}}</span></a>
</div>
<div class="clearfix"></div>
<!-- menu profile quick info -->
@@ -19,7 +19,7 @@
<div class="left_col scroll-view">
<div class="navbar nav_title" style="border: 0;">
<a href="{$site->home_link}" class="site_title"><i class="fa fa-mixcloud"></i>
<span>{$site->title}</span></a>
<span>{{config('app.name')}}</span></a>
</div>
<div class="clearfix"></div>
<br/>
-107
View File
@@ -11,15 +11,6 @@
<fieldset>
<legend>Main Site Settings, HTML Layout, Tags</legend>
<table class="input data table table-striped responsive-utilities jambo-table">
<tr>
<td><label for="title">Title</label>:</td>
<td>
<input id="title" class="long" name="title" type="text" value="{$site->title}"/>
<div class="hint">Displayed around the site and contact form as the name for the site.</div>
</td>
</tr>
<tr>
<td><label for="strapline">Strapline</label>:</td>
<td>
@@ -70,16 +61,6 @@
</div>
</td>
</tr>
<tr>
<td style="width:160px;"><label for="codename">Code Name</label>:</td>
<td>
<input id="codename" name="code" type="text" value="{$site->code}"/>
<input type="hidden" name="id" value="{$site->id}"/>
<div class="hint">A just for fun value shown in debug and not on public pages.</div>
</td>
</tr>
<tr>
<td style="width: 180px;"><label for="coverspath">Cover&apos;s path:</label></td>
<td>
@@ -125,16 +106,6 @@
</div>
</td>
</tr>
<tr>
<td><label for="email">Email</label>:</td>
<td>
<input id="email" class="long" name="email" type="text" value="{$site->email}"/>
<div class="hint">Shown in the contact us page, and where the contact html form is sent to.
</div>
</td>
</tr>
<tr>
<td><label for="tandc">Terms and Conditions</label>:</td>
<td>
@@ -144,67 +115,6 @@
</tr>
</table>
</fieldset>
<fieldset>
<legend>Google Adsense, Analytics and 3rd Party Banners</legend>
<table class="input data table table-striped responsive-utilities jambo-table">
<tr>
<td style="width:160px;"><label for="google_analytics_acc">Google Analytics</label>:</td>
<td>
<input id="google_analytics_acc" name="google_analytics_acc" type="text"
value="{$site->google_analytics_acc}"/>
<div class="hint">e.g. UA-xxxxxx-x</div>
</td>
</tr>
<tr>
<td style="width:160px;"><label for="google_adsense_acc">Google Adsense</label>:</td>
<td>
<input id="google_adsense_acc" name="google_adsense_acc" type="text"
value="{$site->google_adsense_acc}"/>
<div class="hint">e.g. pub-123123123123123</div>
</td>
</tr>
<tr>
<td><label for="google_adsense_search">Google Adsense Search</label>:</td>
<td>
<input id="google_adsense_search" name="google_adsense_search" type="text"
value="{$site->google_adsense_search}"/>
<div class="hint">The id of the google search ad card displayed at the bottom of the left
menu.
</div>
</td>
</tr>
<tr>
<td><label for="adheader">Advert Space in Banner</label>:</td>
<td>
<textarea id="adheader" name="adheader">{$site->adheader}</textarea>
<div class="hint">The banner slot in the header.</div>
</td>
</tr>
<tr>
<td><label for="adbrowse">Advert Space in Browse List</label>:</td>
<td>
<textarea id="adbrowse" name="adbrowse">{$site->adbrowse}</textarea>
<div class="hint">The banner slot in the header.</div>
</td>
</tr>
<tr>
<td><label for="addetail">Advert Space in Detail View</label>:</td>
<td>
<textarea id="addetail" name="addetail">{$site->addetail}</textarea>
<div class="hint">The banner slot in the release details view.</div>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>3<sup>rd</sup> Party API Keys</legend>
<table class="input data table table-striped responsive-utilities jambo-table">
@@ -737,23 +647,6 @@
</tr>
</table>
</fieldset>
<fieldset>
<legend>IMDB.com URL</legend>
<table class="input data table table-striped responsive-utilities jambo-table">
<tr>
<td style="width:180px;"><label for="imdburl">IMDB.com:</label></td>
<td>
{html_options style="width:180px;" class="imdburl" id="imdburl" name='imdburl' values=$imdb_urls output=$imdburl_names selected=$site->imdburl}
<div class="hint">Akas.imdb.com returns titles in their original title, imdb.com returns titles
based on
your IP address (if you are in france, you will get french titles).
</div>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>Usenet Settings</legend>
<table class="input data table table-striped responsive-utilities jambo-table">
+1 -1
View File
@@ -9,7 +9,7 @@ class SettingsTest extends TestCase
{
public function testSettingValue()
{
$name = Settings::settingValue('site.main.title');
$name = config('app.name');
$this->assertEquals('NNTmux', $name);
}