@@ -28,7 +28,7 @@ public function handleException($exception)
2828 {
2929 $ recievers = $ this ->getRecievers ();
3030
31- if ($ recievers !== false && $ this ->pluginSettings ->enabled && $ this ->checkEnvironment () && $ this ->checkNotFound ($ exception )) {
31+ if ($ recievers !== false && $ this ->pluginSettings ->enabled && $ this ->checkEnvironment () && $ this ->checkNotFound ($ exception )) {
3232 $ view = Craft::$ app ->getView ();
3333 $ oldTemplatesPath = $ view ->getTemplatesPath ();
3434 $ view ->setTemplatesPath (ErrorNotifier::getInstance ()->getBasePath ());
@@ -45,11 +45,11 @@ public function handleException($exception)
4545 );
4646 $ view ->setTemplatesPath ($ oldTemplatesPath );
4747
48- if (array_key_exists ('fromName ' , $ this ->settings )) {
48+ if (array_key_exists ('fromName ' , $ this ->settings )) {
4949 $ message = new Message ();
5050 $ message ->setFrom ([$ this ->pluginSettings ->sender => $ this ->settings ['fromName ' ]]);
5151 $ message ->setTo ($ recievers );
52- $ message ->setSubject ($ this ->pluginSettings ->emailPrefix .' - ' . $ this ->settings ['fromName ' ] . ' - ' . $ this ->getExceptionName ($ exception ));
52+ $ message ->setSubject ($ this ->pluginSettings ->emailPrefix . ' - ' . $ this ->settings ['fromName ' ] . ' - ' . $ this ->getExceptionName ($ exception ));
5353 $ message ->setHtmlBody ($ body );
5454
5555 Craft::$ app ->mailer ->send ($ message );
@@ -59,7 +59,7 @@ public function handleException($exception)
5959
6060 protected function getRecievers ()
6161 {
62- if ($ this ->pluginSettings ->recievers !== '' ) {
62+ if ($ this ->pluginSettings ->recievers !== '' ) {
6363 return array_map ('trim ' , explode (', ' , $ this ->pluginSettings ->recievers ));
6464 }
6565
@@ -68,7 +68,7 @@ protected function getRecievers()
6868
6969 protected function checkEnvironment ()
7070 {
71- if (in_array ($ this ->environment , $ this ->pluginEnvironments , true )) {
71+ if (in_array ($ this ->environment , $ this ->pluginEnvironments , true )) {
7272 return true ;
7373 }
7474
@@ -77,7 +77,7 @@ protected function checkEnvironment()
7777
7878 protected function checkNotFound ($ exception )
7979 {
80- if ($ this ->pluginSettings ->notFound !== '1 ' && $ this ->getExceptionName ($ exception ) === 'Not Found ' ) {
80+ if ($ this ->pluginSettings ->notFound !== '1 ' && $ this ->getExceptionName ($ exception ) === 'Not Found ' ) {
8181 return false ;
8282 }
8383
@@ -95,12 +95,27 @@ protected function getServerVars()
9595 {
9696 $ serverVars = $ _SERVER ;
9797
98+ $ serverVars ['REQUEST_SCHEME ' ] = $ this ->getRequestScheme ();
99+
98100 // clean some fields
99101 unset($ serverVars ['DB_PASSWORD ' ], $ serverVars ['HTTP_COOKIE ' ]);
100102
101103 return $ serverVars ;
102104 }
103105
106+ protected function getRequestScheme ()
107+ {
108+ if (isset ($ _SERVER ['HTTPS ' ]) && ('on ' === strtolower ($ _SERVER ['HTTPS ' ]) || '1 ' == $ _SERVER ['HTTPS ' ])) {
109+ return 'https ' ;
110+ }
111+
112+ if (isset ($ _SERVER ['SERVER_PORT ' ]) && ('443 ' == $ _SERVER ['SERVER_PORT ' ])) {
113+ return 'https ' ;
114+ }
115+
116+ return 'http ' ;
117+ }
118+
104119 protected function getUserVars ()
105120 {
106121 return print_r (Craft::$ app ->getUser (), true );
@@ -119,4 +134,4 @@ protected function getCookieVars()
119134 {
120135 return print_r ($ _COOKIE , true );
121136 }
122- }
137+ }
0 commit comments