-
Notifications
You must be signed in to change notification settings - Fork 4
/
admin.php
95 lines (92 loc) · 4.07 KB
/
admin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
// Smart.Framework / Runtime / Admin
// (c) 2006-present unix-world.org - all rights reserved
// r.8.7 / smart.framework.v.8.7
//##### WARNING: #####
// Changing the code below is on your own risk and may lead to severe disrupts in the execution of this software !
//####################
//== v.20241123
//--
ini_set('display_errors', '1'); // temporary enable this to display bootstrap errors if any ; will be managed later by Smart Error Handler
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); // on bootstrap show real-time errors (sync with Smart Error Handler)
//--
if((is_file('.sf-unpack')) OR (is_file('maintenance.html'))) { // {{{SYNC-HTTP-NOCACHE-HEADERS}}}
@http_response_code(503); // 503 maintenance mode
@header('Cache-Control: no-cache, must-revalidate'); // HTTP 1.1 no-cache
@header('Pragma: no-cache'); // HTTP 1.0 no-cache
if(!@readfile('maintenance.html', false)) {
echo('<h1>503 Service under Maintenance ...</h1>');
} //end if
die('<!-- Smart.Framework [A] 503 Maintenance -->');
} //end if
//--
//==
ob_start();
//--
const SMART_FRAMEWORK_LIB_PATH = 'lib/framework/'; // smart framework lib path
const SMART_FRAMEWORK_RUNTIME_MODE = 'web.app'; // runtime mode: 'web.app'
const SMART_STANDALONE_APP = false; // must be set to false, except standalone scripts !
const SMART_FRAMEWORK_ADMIN_AREA = true; // run app in private/admin mode
//--
define('SMART_FRAMEWORK_RUNTIME_READY', microtime(true)); // semaphore, runtime can execute scripts
//--
require('etc/init.php'); // the PHP.INI local settings (they must be called first !!!)
//--
require(SMART_FRAMEWORK_LIB_PATH.'smart-error-handler.php'); // Smart Framework Error Handler
require('lib/smart-runtime.php'); // Smart Runtime
require('etc/config-admin.php'); // Admin Config
require('lib/run/abstract-controller.php'); // Service Controller Definition
require('lib/run/middleware.php'); // Service Handler Definition
require('lib/run/middleware-admin.php'); // Admin Service Handler
//--
//==
//--
if((string)SMART_FRAMEWORK_RELEASE_MIDDLEWARE != '[A][T]@'.SMART_FRAMEWORK_RELEASE_TAGVERSION) {
@http_response_code(500);
die('Smart.Framework // App [A] Service: Middleware service validation Failed ... Invalid Version !');
} //end if
//--
if((string)get_parent_class('SmartAppAdminMiddleware') != 'SmartAbstractAppMiddleware') {
@http_response_code(500);
die('Smart.Framework // App [A] Service: the Class SmartAppAdminMiddleware must be extended from the Class SmartAbstractAppMiddleware ...');
} //end if
//--
$output = ob_get_contents();
ob_end_clean();
if((string)$output != '') {
Smart::log_warning('The middleware service [A] detected an illegal output in initialize'."\n".'The result of this output is: '.$output);
} //end if
$output = '';
//--
//==
//--
$run = SmartAppAdminMiddleware::Run(); // Handle the Admin service
ob_start();
if(SmartEnvironment::ifDebug()) {
if($run !== false) {
SmartAppAdminMiddleware::DebugInfoSet('adm', (bool)$run);
} //end if
} //end if
$output = ob_get_contents();
ob_end_clean();
if((string)$output != '') {
Smart::log_warning('The middleware service [A] detected an illegal output in shutdown'."\n".'The result of this output is: '.$output);
} //end if
$output = '';
//--
if((string)setlocale(LC_ALL, 0) != 'C') { // {{{SYNC-LOCALES-CHECK}}}
trigger_error(
'#SMART-FRAMEWORK-LOCALES-NOTICE#'."\n".
'Invalid PHP Locales (other than C) detected: ['.setlocale(LC_ALL, 0).'].'."\n".
'The locale information is maintained per process, not per thread'."\n".
'Thus if other external PHP scripts changed locales while Smart.Framework was running in the same (server) process this will generate unpredictable results.'."\n".
'Solution: You should assure to run Smart.Framework in an isolated (server) process context to avoid this issue !'."\n".
'If you changed the locales using setlocale() in your PHP scripts inside Smart.Framework you should stop doing this as other locales than C are not supported ...',
E_USER_NOTICE
);
} //end if
//--
//==
//#END
//==
// end of php code