File tree 8 files changed +51
-2
lines changed
8 files changed +51
-2
lines changed Original file line number Diff line number Diff line change 8
8
9
9
namespace JetApplication ;
10
10
11
+ use Jet \IO_File ;
11
12
use Jet \Logger ;
12
13
13
14
use Jet \MVC ;
@@ -49,6 +50,7 @@ public static function init( MVC_Router $router ): void
49
50
{
50
51
SysConf_Jet_MVC::setUseModulePages ( false );
51
52
53
+
52
54
Logger::setLoggerProvider ( function () : ?Application_Web_Services_Logger {
53
55
return Application_Web_Services::Logger ();
54
56
} );
@@ -60,6 +62,14 @@ public static function init( MVC_Router $router ): void
60
62
SysConf_Jet_UI::setViewsDir ( $ router ->getBase ()->getViewsPath () . 'ui/ ' );
61
63
SysConf_Jet_Form::setDefaultViewsDir ( $ router ->getBase ()->getViewsPath () . 'form/ ' );
62
64
SysConf_Jet_ErrorPages::setErrorPagesDir ( $ router ->getBase ()->getPagesDataPath ( $ router ->getLocale () ) );
65
+
66
+ if ($ router ->tryDirectFiles ([
67
+ 'robots.txt ' ,
68
+ 'security.txt '
69
+ ])) {
70
+ return ;
71
+ }
72
+
63
73
}
64
74
65
75
}
Original file line number Diff line number Diff line change
1
+ * [cs ] robots .txt example
Original file line number Diff line number Diff line change
1
+ * [CS] security.txt example
Original file line number Diff line number Diff line change
1
+ * robots .txt example
Original file line number Diff line number Diff line change
1
+ * security.txt example
Original file line number Diff line number Diff line change 16
16
17
17
SysConf_Jet_Mailing::setTemplatesDir ( SysConf_Path::getApplication ().'email-templates/ ' );
18
18
19
- SysConf_Jet_Debug::setDevelMode ( true );
19
+ SysConf_Jet_Debug::setDevelMode ( false );
20
20
21
21
if ( SysConf_Jet_Debug::getDevelMode () ) {
22
22
//Dev configuration
Original file line number Diff line number Diff line change 8
8
9
9
namespace Jet ;
10
10
11
+ use JetApplication \Application ;
12
+
11
13
require_once 'Router/Interface.php ' ;
12
14
13
15
/**
@@ -175,6 +177,10 @@ public function resolve( string|null $request_URL = null ): void
175
177
$ this ->request_URL = (string )$ request_URL ;
176
178
177
179
if ( $ this ->resolve_seekBaseAndLocale () ) {
180
+ if ($ this ->getIs404 ()) {
181
+ return ;
182
+ }
183
+
178
184
if ($ this ->resolve_seekPage ()) {
179
185
if ($ this ->resolve_authorizePage ()) {
180
186
if ($ this ->resolve_pageResolve ()) {
@@ -581,5 +587,28 @@ public function getValidUrl(): string
581
587
{
582
588
return $ this ->valid_url ;
583
589
}
584
-
590
+
591
+ /**
592
+ * @param array $allowed_files
593
+ * @return bool
594
+ */
595
+ public function tryDirectFiles ( array $ allowed_files ) : bool
596
+ {
597
+ if (
598
+ in_array ($ this ->getUrlPath (), $ allowed_files )
599
+ ) {
600
+ $ path = $ this ->getBase ()->getPagesDataPath ($ this ->getLocale ()).$ this ->getUrlPath ();
601
+
602
+ if (IO_File::isReadable ($ path )) {
603
+ echo IO_File::read ( $ path );
604
+ Application::end ();
605
+ }
606
+
607
+ $ this ->setIs404 ();
608
+ return true ;
609
+ }
610
+
611
+ return false ;
612
+ }
613
+
585
614
}
Original file line number Diff line number Diff line change @@ -145,5 +145,11 @@ public function getHasUnusedUrlPath(): bool;
145
145
* @return string
146
146
*/
147
147
public function getValidUrl (): string ;
148
+
149
+ /**
150
+ * @param array $allowed_files
151
+ * @return bool
152
+ */
153
+ public function tryDirectFiles ( array $ allowed_files ) : bool ;
148
154
149
155
}
You can’t perform that action at this time.
0 commit comments