1+ <?php
2+ /**
3+ * Copyright 2009-2015 Remigijus Kiminas
4+ *
5+ * Licensed under the Apache License, Version 2.0 (the "License");
6+ * you may not use this file except in compliance with the License.
7+ * You may obtain a copy of the License at
8+ *
9+ * http://www.apache.org/licenses/LICENSE-2.0
10+ *
11+ * Unless required by applicable law or agreed to in writing, software
12+ * distributed under the License is distributed on an "AS IS" BASIS,
13+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ * See the License for the specific language governing permissions and
15+ * limitations under the License.
16+ */
17+
18+ @ini_set ('error_reporting ' , 0 );
19+ @ini_set ('display_errors ' , 0 );
20+ @ini_set ('session.gc_maxlifetime ' , 200000 );
21+ @ini_set ('session.cookie_lifetime ' , 2000000 );
22+ @ini_set ('session.cookie_httponly ' ,1 );
23+ @ini_set ('session.cookie_samesite ' , 'Lax ' );
24+
25+ // Uncomment these if you are using chrome extension
26+ // Min PHP 7.3v is required
27+ // @ini_set('session.cookie_samesite', 'None');
28+ // @ini_set('session.cookie_secure', true);
29+
30+ if (!defined ('LHC_AUTOLOADED ' )) {
31+
32+ require_once "ezcomponents/Base/src/base.php " ; // dependent on installation method, see below
33+
34+ ezcBase::addClassRepository ( './ ' ,'./lib/autoloads ' );
35+
36+ spl_autoload_register (array ('ezcBase ' ,'autoload ' ), true , false );
37+ spl_autoload_register (array ('erLhcoreClassSystem ' ,'autoload ' ), true , false );
38+ }
39+
40+ erLhcoreClassSystem::init ();
41+
42+ if (!defined ('LHC_AUTOLOADED ' )) {
43+ // your code here
44+ ezcBaseInit::setCallback (
45+ 'ezcInitDatabaseInstance ' ,
46+ 'erLhcoreClassLazyDatabaseConfiguration '
47+ );
48+ }
49+
50+ set_exception_handler ( array ('erLhcoreClassModule ' , 'defaultExceptionHandler ' ) );
51+ set_error_handler ( array ('erLhcoreClassModule ' , 'defaultWarningHandler ' ) );
52+
53+ try {
54+
55+ $ Result = erLhcoreClassModule::moduleInit ();
56+
57+ $ tpl = erLhcoreClassTemplate::getInstance ('pagelayouts/main.php ' );
58+ $ tpl ->set ('Result ' ,$ Result );
59+ if (isset ($ Result ['pagelayout ' ]))
60+ {
61+ $ tpl ->setFile ('pagelayouts/ ' .$ Result ['pagelayout ' ].'.php ' );
62+ }
63+
64+ echo $ tpl ->fetch ();
65+
66+ } catch (Exception $ e ) {
67+
68+ if (erConfigClassLhConfig::getInstance ()->getSetting ( 'site ' , 'debug_output ' ) == true ) {
69+ echo "<pre> " ;
70+ print_r ($ e );
71+ echo "</pre> " ;
72+ exit ;
73+ }
74+
75+ error_log ($ e );
76+
77+ header ('HTTP/1.1 503 Service Temporarily Unavailable ' );
78+ header ('Status: 503 Service Temporarily Unavailable ' );
79+ header ('Retry-After: 300 ' );
80+
81+ include_once ('design/defaulttheme/tpl/lhkernel/fatal_error.tpl.php ' );
82+
83+ erLhcoreClassLog::write (print_r ($ e ,true ));
84+ }
85+
86+
87+ flush ();
88+ session_write_close ();
89+
90+ if ( function_exists ('fastcgi_finish_request ' ) ) {
91+ fastcgi_finish_request ();
92+ };
93+
94+ erLhcoreClassChatEventDispatcher::getInstance ()->executeFinishRequest ();
0 commit comments