mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Update contact form
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
2018-04-05 DariusIII
|
||||
* Chg: Update contact form
|
||||
* Chg: Update and improve registration page
|
||||
* Fix: Fix NOCAPTCHA on login pages
|
||||
* Chg: Add ConsoleController
|
||||
|
||||
@@ -92,7 +92,7 @@ class BasePageController extends Controller
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->middleware('auth')->except('api', 'rss', 'contact-us');
|
||||
$this->middleware('auth')->except('api', 'rss', 'contact', 'showContactForm');
|
||||
// Buffer settings/DB connection.
|
||||
$this->settings = new Settings();
|
||||
$this->pdo = new DB();
|
||||
@@ -121,6 +121,7 @@ class BasePageController extends Controller
|
||||
$this->smarty->assign('ismod', 'false');
|
||||
$this->smarty->assign('loggedin', 'false');
|
||||
}
|
||||
|
||||
if ($this->theme === 'None') {
|
||||
$this->theme = Settings::settingValue('site.main.style');
|
||||
}
|
||||
@@ -141,8 +142,6 @@ class BasePageController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPostBack()
|
||||
|
||||
@@ -9,21 +9,17 @@ use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class ContactUsController extends BasePageController
|
||||
{
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function showContactForm(Request $request)
|
||||
public function contact(Request $request)
|
||||
{
|
||||
$this->setPrefs();
|
||||
$this->validate($request, [
|
||||
'useremail' => 'required',
|
||||
'username' => 'required'
|
||||
]);
|
||||
|
||||
if (env('NOCAPTCHA_ENABLED') === true) {
|
||||
@@ -37,11 +33,11 @@ class ContactUsController extends BasePageController
|
||||
if ($request->has('useremail')) {
|
||||
$email = $request->input('useremail');
|
||||
$mailTo = Settings::settingValue('site.main.email');
|
||||
$mailBody = "Values submitted from contact form:\n";
|
||||
$mailBody = 'Values submitted from contact form: ';
|
||||
|
||||
foreach ($request->all() as $key => $value) {
|
||||
if ($key !== 'submit') {
|
||||
$mailBody .= "$key : $value<br />\r\n";
|
||||
if ($key !== 'submit' && $key !== '_token') {
|
||||
$mailBody .= "$key : $value" . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,12 +47,21 @@ class ContactUsController extends BasePageController
|
||||
$msg = "<h2 style='text-align:center;'>Thank you for getting in touch with ".Settings::settingValue('site.main.title').'.</h2>';
|
||||
}
|
||||
$this->smarty->assign('msg', $msg);
|
||||
|
||||
redirect('/');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function showContactForm()
|
||||
{
|
||||
$this->setPrefs();
|
||||
$title = 'Contact '.Settings::settingValue('site.main.title');
|
||||
$meta_title = 'Contact '.Settings::settingValue('site.main.title');
|
||||
$meta_keywords = 'contact us,contact,get in touch,email';
|
||||
$meta_description = 'Contact us at '.Settings::settingValue('site.main.title').' and submit your feedback';
|
||||
|
||||
$content = $this->smarty->fetch('contact.tpl');
|
||||
$content = $this->smarty->fetch($this->theme.'/contact.tpl');
|
||||
|
||||
$this->smarty->assign(
|
||||
[
|
||||
@@ -65,9 +70,10 @@ class ContactUsController extends BasePageController
|
||||
'meta_title' => $meta_title,
|
||||
'meta_keywords' => $meta_keywords,
|
||||
'meta_description' => $meta_description,
|
||||
'nocaptcha' => env('NOCAPTCHA_ENABLED'),
|
||||
]
|
||||
);
|
||||
|
||||
$this->pagerender();
|
||||
$this->smarty->display($this->theme.'/basepage.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
{{ $mailBody }}
|
||||
{!! nl2br(e($mailBody)) !!}
|
||||
@endsection
|
||||
|
||||
@@ -54,7 +54,9 @@
|
||||
<label for="comment" class="h6">Message</label>
|
||||
<textarea rows="7" name="comment" id="comment"
|
||||
class="form-control form-white"></textarea>
|
||||
{if $nocaptcha != false}
|
||||
{NoCaptcha::display()}{NoCaptcha::renderJs()}
|
||||
{/if}
|
||||
<button type="submit" class="btn btn-primary m-t-20">
|
||||
Send message
|
||||
</button>
|
||||
|
||||
+1
-5
@@ -91,11 +91,7 @@ Route::get('/xxx', function () {
|
||||
})->middleware('auth');
|
||||
|
||||
Route::get('contact-us', 'ContactUsController@showContactForm');
|
||||
Route::post('contact-us', 'ContactUsController@showContactForm');
|
||||
|
||||
Route::post('/contact-us', function () {
|
||||
redirect('/contact-us');
|
||||
})->middleware('guest');
|
||||
Route::post('contact-us', 'ContactUsController@contact');
|
||||
|
||||
Route::get('/forum', function () {
|
||||
redirect('/forum');
|
||||
|
||||
Reference in New Issue
Block a user