From ab36c8763141c923991a1ed148d10a761e89d56e Mon Sep 17 00:00:00 2001 From: DariusIII Date: Mon, 19 Nov 2018 13:42:47 +0100 Subject: [PATCH] Fix display of contact form when logged in --- Changelog | 2 + app/Http/Controllers/BasePageController.php | 31 +++-- app/Http/Controllers/ContactUsController.php | 17 ++- resources/views/themes/Gentele/contact.tpl | 134 +++++++++---------- 4 files changed, 100 insertions(+), 84 deletions(-) diff --git a/Changelog b/Changelog index 9274093f1..4cd219519 100755 --- a/Changelog +++ b/Changelog @@ -1,3 +1,5 @@ +2018-11-19 DariusIII + * Fix: Fix display of contact form when logged in 2018-11-18 DariusIII * Chg: Increase number of checked files in PostProcess par2 check function * Chg: Update Blacklight/utility/Country class diff --git a/app/Http/Controllers/BasePageController.php b/app/Http/Controllers/BasePageController.php index fa0b2383f..1a2a90036 100644 --- a/app/Http/Controllers/BasePageController.php +++ b/app/Http/Controllers/BasePageController.php @@ -118,20 +118,33 @@ class BasePageController extends Controller if (Auth::check()) { $this->userdata = User::find(Auth::id()); $this->setUserPreferences(); + if ($this->theme === 'None') { + $this->theme = Settings::settingValue('site.main.style'); + } } else { $this->theme = Settings::settingValue('site.main.style'); + // Tell Smarty which directories to use for templates + $this->smarty->setTemplateDir([ + 'user' => config('ytake-laravel-smarty.template_path').DIRECTORY_SEPARATOR.$this->theme, + 'shared' => config('ytake-laravel-smarty.template_path').'/shared', + 'default' => config('ytake-laravel-smarty.template_path').'/Gentele', + ]); - $this->smarty->assign('isadmin', 'false'); - $this->smarty->assign('ismod', 'false'); - $this->smarty->assign('loggedin', 'false'); + $this->smarty->assign( + [ + 'isadmin' => false, + 'ismod' => false, + 'loggedin' => false + ] + ); } - if ($this->theme === 'None') { - $this->theme = Settings::settingValue('site.main.style'); - } - - $this->smarty->assign('theme', $this->theme); - $this->smarty->assign('site', $this->settings); + $this->smarty->assign( + [ + 'theme'=> $this->theme, + 'site' => $this->settings + ] + ); } /** diff --git a/app/Http/Controllers/ContactUsController.php b/app/Http/Controllers/ContactUsController.php index 1d525ff89..fd1b6b392 100644 --- a/app/Http/Controllers/ContactUsController.php +++ b/app/Http/Controllers/ContactUsController.php @@ -16,6 +16,7 @@ class ContactUsController extends BasePageController */ public function contact(Request $request) { + $this->setPrefs(); $this->validate($request, [ 'useremail' => 'required', 'username' => 'required', @@ -45,33 +46,35 @@ class ContactUsController extends BasePageController } $msg = "

Thank you for getting in touch with ".Settings::settingValue('site.main.title').'.

'; } - app('smarty.view')->assign('msg', $msg); - return redirect('contact-us'); + return $this->showContactForm($msg); } /** + * @param string $msg + * * @throws \Exception */ - public function showContactForm() + public function showContactForm($msg = '') { - $theme = Settings::settingValue('site.main.style'); + $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 = app('smarty.view')->fetch($theme.'/contact.tpl'); + $content = $this->smarty->fetch('contact.tpl'); - app('smarty.view')->assign( + $this->smarty->assign( [ 'title' => $title, 'content' => $content, 'meta_title' => $meta_title, 'meta_keywords' => $meta_keywords, 'meta_description' => $meta_description, + 'msg' => $msg, ] ); - app('smarty.view')->display($theme.'/basepage.tpl'); + $this->pagerender(); } } diff --git a/resources/views/themes/Gentele/contact.tpl b/resources/views/themes/Gentele/contact.tpl index fcacb6416..172985779 100755 --- a/resources/views/themes/Gentele/contact.tpl +++ b/resources/views/themes/Gentele/contact.tpl @@ -1,77 +1,75 @@ - - {$meta_title}{if $meta_title != "" && $site->metatitle != ""} - {/if}{$site->metatitle} - + + {$meta_title}{if $meta_title != "" && $site->metatitle != ""} - {/if}{$site->metatitle} +
-
-

Contact Us

- -
-
-
-
-
-
-
-
-
-
-
-
- {$msg} - {if empty($msg)} -

Have a question?
Don't hesitate to send us a message. Our team - will be - happy to help you.

-
-
-
-
- {{Form::open(['url' => 'contact-us'])}} -
-
- - -
-
- - -
-
- - - {if {config('captcha.enabled')} == 1 && !empty({config('captcha.sitekey')}) && !empty({config('captcha.secret')})} - {NoCaptcha::display()}{NoCaptcha::renderJs()} - {/if} - - {{Form::close()}} -
-
-
-
-
-
- {/if} -
-
-
-
-
+
+

Contact Us

+ +
+
+
+
+
+
+
+
+
+
+
+
+ {$msg} +

Have a question?
Don't hesitate to send us a message. Our team + will be + happy to help you.

+
+
+
+
+ {{Form::open(['url' => 'contact-us'])}} +
+
+ + +
+
+ + +
+
+ + + {if {config('captcha.enabled')} == 1 && !empty({config('captcha.sitekey')}) && !empty({config('captcha.secret')})} + {NoCaptcha::display()}{NoCaptcha::renderJs()} + {/if} + + {{Form::close()}} +
+
+
+
+
+
+
+
+
+
+