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 pathshell.php
More file actions
152 lines (125 loc) · 5.32 KB
/
shell.php
File metadata and controls
152 lines (125 loc) · 5.32 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
/**
* startup.php
*
* backend class in charge of building environment & controls for a new instance of Comodojo;
*
* @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 shell extends comodojo_basic {
public $script_name = 'shell.php';
public $use_session_transport = true;
public $require_valid_session = false;
public $do_authentication = true;
public function logic($attributes) {
comodojo_load_resource('events');
$events = new events();
$this->header_params['statusCode'] = 200;
$this->header_params['contentType'] = 'text/html';
$this->header_params['charset'] = COMODOJO_DEFAULT_ENCODING;
return COMODOJO_SHELL_ENABLED ? $this->start_shell($attributes) : $this->stop_shell($attributes);
}
private function start_shell($attributes) {
$loader = "
<link rel=\"stylesheet\" type=\"text/css\" href=\"comodojo/javascript/dojo/resources/dojo.css\" />
<link rel=\"stylesheet\" type=\"text/css\" href=\"comodojo/javascript/dijit/themes/" . COMODOJO_SITE_THEME_DOJO . "/" . COMODOJO_SITE_THEME_DOJO . ".css\" />
<script type=\"text/javascript\">
var dojoConfig = {
async: true,
parseOnLoad: false,
baseUrl: '" . COMODOJO_JS_BASE_URL . "',";
//if (COMODOJO_JS_XD_LOADING) {
//$loader .= "
// dojoBlankHtmlUrl: '" . (is_null(COMODOJO_SITE_EXTERNAL_URL) ? COMODOJO_SITE_URL : COMODOJO_SITE_EXTERNAL_URL) . COMODOJO_JS_BASE_URL . "resources/blank.html',
// packages: [{
// name: 'comodojo',
// location: '" . (is_null(COMODOJO_SITE_EXTERNAL_URL) ? COMODOJO_SITE_URL : COMODOJO_SITE_EXTERNAL_URL) . "comodojo/javascript/comodojo'
// }],
// waitSeconds: '" . COMODOJO_JS_XD_TIMEOUT . "',";
//}
$loader .= "
locale: '" . $this->locale . "',
has: {
'dojo-amd-factory-scan': false,
'dojo-firebug': ".(COMODOJO_JS_DEBUG ? "true" : "false").",
'dojo-debug-messages': ".(COMODOJO_JS_DEBUG_DEEP ? "true" : "false").",
'popup': ".(COMODOJO_JS_DEBUG_POPUP ? "true" : "false")."
}
};
</script>
<script type=\"text/javascript\" src=\"" . /*(COMODOJO_JS_XD_LOADING ? COMODOJO_JS_XD_LOCATION : */'comodojo/javascript/dojo/dojo.js'/*)*/ . "\"></script>
<script type=\"text/javascript\">
require([\"dojo/ready\",\"comodojo/Shell\"], function(ready,shell){
ready(function(){
var s = new shell({
shellNode: 'shell_main',
shellLoader: 'shell_loader',
userName: '".COMODOJO_USER_NAME."',
userRole: '".COMODOJO_USER_ROLE."',
siteName: '".strtolower(str_replace (" ", "", COMODOJO_SITE_TITLE))."',
clientIP: '".$_SERVER["REMOTE_ADDR"]."',
rpcProxy: ".COMODOJO_RPC_PROXY_ENABLED."
});
});
});
</script>
";
$index = file_get_contents(COMODOJO_SITE_PATH . "comodojo/templates/web_shell.html");
$index = str_replace("*_SITETITLE_*",COMODOJO_SITE_TITLE,$index);
$index = str_replace("*_DEFAULTENCODING_*",strtolower(COMODOJO_DEFAULT_ENCODING),$index);
$index = str_replace("*_DOJOTHEME_*",COMODOJO_SITE_THEME_DOJO,$index);
$index = str_replace("*_DOJOLOADER_*",$loader,$index);
return $index;
}
private function stop_shell($attributes) {
$loader = "
<link rel=\"stylesheet\" type=\"text/css\" href=\"comodojo/javascript/dojo/resources/dojo.css\" />
<link rel=\"stylesheet\" type=\"text/css\" href=\"comodojo/javascript/dijit/themes/" . COMODOJO_SITE_THEME_DOJO . "/" . COMODOJO_SITE_THEME_DOJO . ".css\" />
<script type=\"text/javascript\">
var dojoConfig = {
async: true,
parseOnLoad: false,
baseUrl: '" . COMODOJO_JS_BASE_URL . "',";
//if (COMODOJO_JS_XD_LOADING) {
// $loader .= "
// dojoBlankHtmlUrl: '" . (is_null(COMODOJO_SITE_EXTERNAL_URL) ? COMODOJO_SITE_URL : COMODOJO_SITE_EXTERNAL_URL) . COMODOJO_JS_BASE_URL . "resources/blank.html',
// packages: [{
// name: 'comodojo',
// location: '" . (is_null(COMODOJO_SITE_EXTERNAL_URL) ? COMODOJO_SITE_URL : COMODOJO_SITE_EXTERNAL_URL) . "comodojo/javascript/comodojo'
// }],
// waitSeconds: '" . COMODOJO_JS_XD_TIMEOUT . "',";
//}
$loader .= "
locale: '" . $this->locale . "',
has: {
'dojo-amd-factory-scan': false,
'dojo-firebug': ".(COMODOJO_JS_DEBUG ? "true" : "false").",
'dojo-debug-messages': ".(COMODOJO_JS_DEBUG_DEEP ? "true" : "false").",
'popup': ".(COMODOJO_JS_DEBUG_POPUP ? "true" : "false")."
}
};
</script>
<script type=\"text/javascript\" src=\"" . /*(COMODOJO_JS_XD_LOADING ? COMODOJO_JS_XD_LOCATION : */'comodojo/javascript/dojo/dojo.js'/*)*/ . "\"></script>
<script type=\"text/javascript\">
require([\"dojo/ready\",\"dojo/dom\"], function(ready,dom){
ready(function(){
dom.byId('shell_main').innerHTML = 'Shell disabled';
});
});
</script>
";
$index = file_get_contents(COMODOJO_SITE_PATH . "comodojo/templates/web_shell.html");
$index = str_replace("*_SITETITLE_*",COMODOJO_SITE_TITLE,$index);
$index = str_replace("*_DEFAULTENCODING_*",strtolower(COMODOJO_DEFAULT_ENCODING),$index);
$index = str_replace("*_DOJOTHEME_*",COMODOJO_SITE_THEME_DOJO,$index);
$index = str_replace("*_DOJOLOADER_*",$loader,$index);
return $index;
}
}
$s = new shell();
?>