@@ -28,7 +28,7 @@ public function handleException($exception)
28
28
{
29
29
$ recievers = $ this ->getRecievers ();
30
30
31
- if ($ recievers !== false && $ this ->pluginSettings ->enabled && $ this ->checkEnvironment () && $ this ->checkNotFound ($ exception )) {
31
+ if ($ recievers !== false && $ this ->pluginSettings ->enabled && $ this ->checkEnvironment () && $ this ->checkNotFound ($ exception )) {
32
32
$ view = Craft::$ app ->getView ();
33
33
$ oldTemplatesPath = $ view ->getTemplatesPath ();
34
34
$ view ->setTemplatesPath (ErrorNotifier::getInstance ()->getBasePath ());
@@ -45,11 +45,11 @@ public function handleException($exception)
45
45
);
46
46
$ view ->setTemplatesPath ($ oldTemplatesPath );
47
47
48
- if (array_key_exists ('fromName ' , $ this ->settings )) {
48
+ if (array_key_exists ('fromName ' , $ this ->settings )) {
49
49
$ message = new Message ();
50
50
$ message ->setFrom ([$ this ->pluginSettings ->sender => $ this ->settings ['fromName ' ]]);
51
51
$ 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 ));
53
53
$ message ->setHtmlBody ($ body );
54
54
55
55
Craft::$ app ->mailer ->send ($ message );
@@ -59,7 +59,7 @@ public function handleException($exception)
59
59
60
60
protected function getRecievers ()
61
61
{
62
- if ($ this ->pluginSettings ->recievers !== '' ) {
62
+ if ($ this ->pluginSettings ->recievers !== '' ) {
63
63
return array_map ('trim ' , explode (', ' , $ this ->pluginSettings ->recievers ));
64
64
}
65
65
@@ -68,7 +68,7 @@ protected function getRecievers()
68
68
69
69
protected function checkEnvironment ()
70
70
{
71
- if (in_array ($ this ->environment , $ this ->pluginEnvironments , true )) {
71
+ if (in_array ($ this ->environment , $ this ->pluginEnvironments , true )) {
72
72
return true ;
73
73
}
74
74
@@ -77,7 +77,7 @@ protected function checkEnvironment()
77
77
78
78
protected function checkNotFound ($ exception )
79
79
{
80
- if ($ this ->pluginSettings ->notFound !== '1 ' && $ this ->getExceptionName ($ exception ) === 'Not Found ' ) {
80
+ if ($ this ->pluginSettings ->notFound !== '1 ' && $ this ->getExceptionName ($ exception ) === 'Not Found ' ) {
81
81
return false ;
82
82
}
83
83
@@ -95,12 +95,27 @@ protected function getServerVars()
95
95
{
96
96
$ serverVars = $ _SERVER ;
97
97
98
+ $ serverVars ['REQUEST_SCHEME ' ] = $ this ->getRequestScheme ();
99
+
98
100
// clean some fields
99
101
unset($ serverVars ['DB_PASSWORD ' ], $ serverVars ['HTTP_COOKIE ' ]);
100
102
101
103
return $ serverVars ;
102
104
}
103
105
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
+
104
119
protected function getUserVars ()
105
120
{
106
121
return print_r (Craft::$ app ->getUser (), true );
@@ -119,4 +134,4 @@ protected function getCookieVars()
119
134
{
120
135
return print_r ($ _COOKIE , true );
121
136
}
122
- }
137
+ }
0 commit comments