This repository was archived by the owner on Feb 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
85 lines (58 loc) · 2.31 KB
/
bootstrap.php
File metadata and controls
85 lines (58 loc) · 2.31 KB
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
<?php
/**
* bootstrap.php
*
* Frontend (JSON) for the comodojo role_mapper.
*
* Please see role_mapper file to see how it works.
*
* @package Comodojo ServerSide Core Packages
* @author comodojo.org
* @copyright __COPYRIGHT__ comodojo.org (info@comodojo.org)
* @version __CURRENT_VERSION__
* @license GPL Version 3
*/
require 'comodojo/global/comodojo_basic.php';
class bootstrap extends comodojo_basic {
public $script_name = 'bootstrap.php';
public $use_session_transport = true;
public function logic($attributes) {
$to_return = "comodojo.debug('Starting comodojo bootstrap process. There are:');\n";
try {
comodojo_load_resource('role_mapper');
$mapper = new role_mapper();
}
catch (Exception $e) {
comodojo_debug('Error n°'.$e->getCode().' bootstrapping comodojo: '.$e->getMessage(),'ERROR','bootstrap');
throw $e;
}
$this->header_params['statusCode'] = 200;
$this->header_params['contentType'] = 'text/javascript';
$this->header_params['charset'] = COMODOJO_DEFAULT_ENCODING;
$properties = $mapper->get_applications_properties();
$autostart = $mapper->get_autostart();
//Set registered applications
$to_return .= "comodojo.Bus._registeredApplications = " . array2json($properties,false) . "; \n";
// Remove running applications and autostart registers
$to_return .= "comodojo.Bus._runningApplications = []; \n";
$to_return .= "comodojo.Bus._autostartApplications = []; \n";
$to_return .= "comodojo.debug(' - ".count($properties)." application/s to register');\n";
$to_return .= "comodojo.debug(' - ".count($autostart)." application/s to autostart');\n";
foreach($autostart as $key => $val) $to_return .= "comodojo.Bus.addAutostartApplication('" . $val . "');\n";
//$to_return .= "comodojo.stateFired = ".count($autostart).";\n";
$to_return .= "comodojo.debug('Comodojo bootstrap process completed');\n";
return $to_return;
}
public function error($error_code, $error_content) {
$index = "comodojo.debug('".$error_code.": " . $error_content . "');\n";
$index .= "comodojo.Error.critical('".$error_code.": " . $error_content . "');\n";
set_header(Array(
'statusCode' => 200,
'contentType' => 'text/javascript',
'charset' => 'UTF-8'
), strlen($index));
return $index;
}
}
$bootstrap = new bootstrap();
?>