forked from Atheos/Atheos
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·206 lines (162 loc) · 6.57 KB
/
index.php
File metadata and controls
executable file
·206 lines (162 loc) · 6.57 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?php
//////////////////////////////////////////////////////////////////////////////80
// Index
//////////////////////////////////////////////////////////////////////////////80
// Copyright (c) Atheos & Liam Siira (Atheos.io), distributed as-is and without
// warranty under the MIT License. See [root]/docs/LICENSE.md for more.
// This information must remain intact.
//////////////////////////////////////////////////////////////////////////////80
// Authors: Codiad Team, @Fluidbyte, Atheos Team, @hlsiira
//////////////////////////////////////////////////////////////////////////////80
require_once("common.php");
//PHPCoin - toggle theme
if(isset($_REQUEST['toggleTheme'])) {
if(isset($_SESSION['theme'])) {
if($_SESSION['theme']=="dark") {
$_SESSION['theme']="light";
} else {
$_SESSION['theme']="dark";
}
} else {
$_SESSION['theme']="light";
}
$url = $_SERVER['REQUEST_URI'];
$url = str_replace("?&toggleTheme", "", $url);
header("location: ".$url);
exit;
}
if (defined("HEADERS") && HEADERS) {
foreach (unserialize(HEADERS) as $val) {
header($val);
}
}
require_once("traits/cls.source.php");
$SourceManager = new SourceManager;
//phpcoin: initialize view for user
require_once "components/user/class.user.php";
require_once "components/project/class.project.php";
SESSION("user", "user");
SESSION("lang", "en");
$projectName = "PHPCoin Smart Contracts";
$projectPath = session_id();
$Project = new Project();
$projectPath = Common::cleanPath($projectPath);
$projectName = htmlspecialchars($projectName);
if (!Common::isAbsPath($projectPath)) {
$projectPath = $Project->sanitizePath($projectPath);
$projectPath = WORKSPACE . "/" . $projectPath;
}
if (!file_exists($projectPath)) {
if (!mkdir($projectPath . "/", 0755, true)) {
Common::send("error", i18n("project_unableAbsolute"));
}
} else {
if (!is_writable($projectPath) || !is_readable($projectPath)) {
Common::send("error", i18n("project_unablePermissions"));
}
}
if(empty($_SESSION['projectPath'])) {
SESSION("projectPath", $projectPath);
SESSION("projectName", $projectName);
}
$theme = "dark";
if(isset($_SESSION['theme'])) {
$theme = $_SESSION['theme'];
}
ob_start()
// PHPCoin
?>
<!doctype html>
<html lang="en" class="<?php if (defined("THEME") && THEME) echo(THEME) ?>">
<head>
<meta charset="utf-8">
<title><?php if (defined("DOMAIN") && DOMAIN) echo(DOMAIN . " | ") ?>Atheos IDE</title>
<meta name="author" content="Liam Siira">
<!-- //PHPcoin fix for mobile screen-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <meta name="description" content="A Web-Based IDE with a small footprint and minimal requirements">
<!-- PreConnects -->
<link rel="preconnect" href="https://www.atheos.io">
<!-- FAVICONS -->
<?php
require_once("templates/favicons.php");
// Load THEME
echo("<!-- THEME -->\n");
echo("\t<link rel=\"stylesheet\" href=\"theme/main.min.css\">\n");
//PHPCOin - include dark theme
if($_SESSION['theme']!="dark") {
echo("\t<link rel=\"stylesheet\" theme=\"".$_SESSION['theme']."\" href=\"phpcoin/light.css\">\n");
}
// LOAD FONTS
$SourceManager->linkResource("css", "fonts", DEVELOPMENT);
// LOAD LIBRARIES
$SourceManager->linkResource("js", "libraries", DEVELOPMENT);
// LOAD MODULES
$SourceManager->linkResource("js", "modules", DEVELOPMENT);
// LOAD PLUGINS
$SourceManager->linkResource("css", "plugins", DEVELOPMENT);
?>
</head>
<body class="<?php echo @$_SESSION['theme'] ?>">
<?php
//////////////////////////////////////////////////////////////////
// LOGGED IN
//////////////////////////////////////////////////////////////////
if (SESSION("user")) {
?>
<div id="workspace">
<div id="contextmenu"></div>
<?php require_once("components/sidebars/sb-left.php"); ?>
<div id="ACTIVE">
<ul id="active_file_tabs" class="tabList"></ul>
<a id="tab_dropdown" class="fas fa-chevron-circle-down"></a>
<a id="tab_close" class="fas fa-times-circle"></a>
<ul id="active_file_dropdown" class="tabList" style="display: none;"></ul>
</div>
<div id="EDITOR">
<div id="root-editor-wrapper"></div>
</div>
<div id="BOTTOM">
<a id="split"><i class="fas fa-columns"></i><?php echo i18n("split"); ?></a>
<a id="current_mode"><i class="fas fa-code"></i><span></span></a>
<span id="current_file"></span>
<span id="codegit_file_status"></span>
<div id="changemode_menu" style="display:none;" class="options-menu"></div>
<ul id="split_menu" style="display:none;" class="options-menu">
<li id="split-horizontally"><a><i class="fas fa-arrows-alt-h"></i><?php echo i18n("split_h"); ?> </a></li>
<li id="split-vertically"><a><i class="fas fa-arrows-alt-v"></i><?php echo i18n("split_v"); ?> </a></li>
<li id="merge-all"><a><i class="fas fa-compress-arrows-alt"></i><?php echo i18n("merge_all"); ?> </a></li>
</ul>
<span id="cursor-position"><?php echo i18n("ln"); ?>: 0 · <?php echo i18n("col"); ?>: 0</span>
</div>
<?php require_once("components/sidebars/sb-right.php"); ?>
</div>
<iframe id="download" title="download"></iframe>
<!-- ACE -->
<script src="components/editor/ace-editor/ace.js"></script>
<script src="components/editor/ace-editor/ext-language_tools.js"></script>
<script src="components/editor/ace-editor/ext-beautify.js"></script>
<?php
// LOAD COMPONENTS
echo("\n");
$SourceManager->linkResource("js", "components", DEVELOPMENT);
// LOAD PLUGINS
$SourceManager->linkResource("js", "plugins", DEVELOPMENT);
} else {
// If constant DATA defined in config.php, use it. Otherwise fall back to default folder location
$path = defined("DATA") ? DATA . "/" : __DIR__ . "/data/";
$users = file_exists($path . "users.json");
$projects = file_exists($path . "projects.json");
if (!$users && !$projects) {
// Installer
require_once("components/install/view.php");
} else {
// Login form
require_once("components/user/login.php");
}
}
?>
<overlay class=""></overlay>
<toaster></toaster>
<output></output>
</body>
</html>