forked from Codiad/Codiad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·217 lines (152 loc) · 6.72 KB
/
index.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
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
207
208
209
210
211
212
213
214
215
216
217
<?php
if(file_exists('config.php')){ require_once('config.php'); }
// Context Menu
$context_menu = file_get_contents(COMPONENTS . "/filemanager/context_menu.json");
$context_menu = json_decode($context_menu,true);
// Right Bar
$right_bar = file_get_contents(COMPONENTS . "/right_bar.json");
$right_bar = json_decode($right_bar,true);
// Components
$components = file_get_contents(COMPONENTS . "/load.json");
$components = json_decode($components,true);
?>
<!doctype html>
<head>
<meta charset="utf-8">
<title>CODIAD</title>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/fonts.css">
<link rel="stylesheet" href="css/screen.css">
<?php
// Load Component CSS Files
foreach($components as $component){
if(file_exists(COMPONENTS . "/" . $component . "/screen.css")){
echo('<link rel="stylesheet" href="components/'.$component.'/screen.css">');
}
}
?>
</head>
<body>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="js/jquery-1.7.2.min.js"%3E%3C/script%3E'));</script>
<script src="js/jquery-ui-1.8.23.custom.min.js"></script>
<script src="js/jquery.css3.min.js"></script>
<script src="js/jquery.easing.js"></script>
<script src="js/localstorage.js"></script>
<script src="js/jquery.hoverIntent.min.js"></script>
<script src="js/system.js"></script>
<script src="js/sidebars.js"></script>
<script src="js/modal.js"></script>
<script src="js/message.js"></script>
<script src="js/jsend.js"></script>
<div id="message"></div>
<?php
//////////////////////////////////////////////////////////////////
// NOT LOGGED IN
//////////////////////////////////////////////////////////////////
if(!isset($_SESSION['user'])){
$path = rtrim(str_replace("index.php", "", $_SERVER['PHP_SELF']),"/");
$users = file_exists($_SERVER['DOCUMENT_ROOT'] . $path . "/data/users.php");
$projects = file_exists($_SERVER['DOCUMENT_ROOT'] . $path . "/data/projects.php");
$active = file_exists($_SERVER['DOCUMENT_ROOT'] . $path . "/data/active.php");
if(!$users && !$projects && !$active){
// Installer
require_once('components/install/view.php');
}else{
// Login form
?>
<form id="login" method="post" style="position: fixed; width: 350px; top: 30%; left: 50%; margin-left: -175px; padding: 35px;">
<label><span class="icon">+</span> Username</label>
<input type="text" name="username" autofocus="autofocus" autocomplete="off">
<label><span class="icon">U</span> Password</label>
<input type="password" name="password">
<button>Login</button>
</form>
<script src="components/user/init.js"></script>
<?php
}
//////////////////////////////////////////////////////////////////
// AUTHENTICATED
//////////////////////////////////////////////////////////////////
}else{
?>
<div id="workspace">
<div id="sb-left" class="sidebar">
<div class="sb-left-content">
<a id="lock-left-sidebar" class="icon">U</a>
<div id="context-menu" data-path="" data-type="">
<?php
////////////////////////////////////////////////////////////
// Load Context Menu
////////////////////////////////////////////////////////////
foreach($context_menu as $menu_item=>$data){
if($data['title']=='Break'){
echo('<hr class="'.$data['applies-to'].'">');
}else{
echo('<a class="'.$data['applies-to'].'" onclick="'.$data['onclick'].'"><span class="icon">'.$data['icon'].'</span>'.$data['title'].'</a>');
}
}
?>
</div>
<div id="file-manager"></div>
<ul id="active-files"></ul>
</div>
<div class="sidebar-handle"><span>||</span></div>
</div>
<div id="cursor-position">Ln: 0 · Col: 0</div>
<div id="editor-region">
<div id="editor-bottom-bar">
<a id="settings" class="ico-wrapper"><span class="icon">l</span>Settings</a>
<div id="divider"></div>
<a id="split" class="ico-wrapper"><span class="icon">k</span>Split</a>
<div id="divider"></div>
<a id="current-mode"><span class="icon">k</span></a>
<div id="divider"></div>
<div id="current-file"></div>
</div>
<ul id="changemode-menu" class="options-menu">
</ul>
<ul id="split-options-menu" class="options-menu">
<li id="split-horizontally"><a> Split Horizontally </a></li>
<li id="split-vertically"><a> Split Vertically </a></li>
<li id="merge-all"><a> Merge all </a></li>
</ul>
</div>
<div id="sb-right" class="sidebar">
<div class="sidebar-handle"><span>||</span></div>
<div class="sb-right-content">
<?php
////////////////////////////////////////////////////////////
// Load Right Bar
////////////////////////////////////////////////////////////
foreach($right_bar as $item_rb=>$data){
if($data['title']=='break'){
echo("<hr>");
}else{
echo('<a onclick="'.$data['onclick'].'"><span class="icon">'.$data['icon'].'</span>'.$data['title'].'</a>');
}
}
?>
</div>
</div>
</div>
<div id="modal-overlay"></div>
<div id="modal"><div id="drag-handle" class="icon">0</div><div id="modal-content"></div></div>
<iframe id="download"></iframe>
<!-- ACE -->
<script src="components/editor/ace-editor/ace.js"></script>
<!-- COMPONENTS -->
<?php
//////////////////////////////////////////////////////////////////
// LOAD COMPONENTS
//////////////////////////////////////////////////////////////////
// JS
foreach($components as $component){
if(file_exists(COMPONENTS . "/" . $component . "/init.js")){
echo('<script src="components/'.$component.'/init.js"></script>"');
}
}
}
?>
</body>
</html>