Skip to content
This repository was archived by the owner on Aug 19, 2021. It is now read-only.

Commit 3bf5902

Browse files
authored
Update 0.3
1 parent cf01e58 commit 3bf5902

File tree

17 files changed

+867
-163
lines changed

17 files changed

+867
-163
lines changed

assets/avt.jpg

61.5 KB
Loading

assets/background.png

53.2 KB
Loading

assets/bg-light.png

129 KB
Loading

assets/preview.png

131 KB
Loading

bakafiles-this_is-your_config.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111

1212
//your root dir here - default: $_SERVER['DOCUMENT_ROOT']
1313
define("ROOT_DIR", $_SERVER['DOCUMENT_ROOT']);
14+
15+
// your login information -- note: please don't add anything to here!

core/system/dir.php

Lines changed: 101 additions & 140 deletions
Large diffs are not rendered by default.

core/system/editor.php

Lines changed: 126 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,129 @@
77
https://github.com/michioxd/bakafiles
88
99
File: editor.php
10-
*/
10+
*/
11+
require __DIR__ . '/kernel/sys.php';
12+
if (isset($_GET['dir'])) {
13+
if ($_GET['dir'] == "/" or $_GET['dir'] == null) {
14+
$main_path = ROOT_DIR . "/";
15+
} else {
16+
$main_path = ROOT_DIR . "/" . $_GET['dir'];
17+
}
18+
} else {
19+
$main_path = ROOT_DIR . "/";
20+
}
21+
$load_file = fopen($main_path, "r");
22+
?>
23+
<div class="dir-badge mdl-card mdl-shadow--2dp">
24+
<?php
25+
if (isset($_GET['dir'])) {
26+
if ($_GET['dir'] != null or $_GET['dir'] != "") { ?>
27+
<button class="link-click mdl-button mdl-js-button mdl-js-ripple-effect" data-href="core/system/dir.php?dir=<?php
28+
if (urlencode(dirname($_GET['dir'], 1)) == "." or $_GET['dir'] == '%2f') {
29+
echo "";
30+
} else {
31+
echo urlencode(dirname($_GET['dir'], 1));
32+
} ?>" style="float: left;">
33+
<span class="material-icons">
34+
arrow_back_ios
35+
</span>
36+
<div class="rippleJS"></div>
37+
</button>
38+
<?php }
39+
} ?>
40+
<a class="inndeexx link-click" data-href="core/system/dir.php" href="#"><i class="material-icons">home</i> (root)/</a>
41+
<?php
42+
if (isset($_GET['dir'])) {
43+
if ($_GET['dir'] != "/" or $_GET['dir'] != null) {
44+
$forrr = explode("/", $_GET['dir']);
45+
foreach ($forrr as $dir_badge) { ?>
46+
<a><?php if ($dir_badge != null) {
47+
echo str_replace("../", "", $dir_badge . "/");
48+
}; ?></a>
49+
<?php }
50+
}
51+
} ?>
52+
</div>
53+
<div class="open-ace">
54+
<textarea id="raw-input"><?php
55+
if (filesize($main_path) > 0) {
56+
echo fread($load_file, filesize($main_path));
57+
} ?></textarea>
58+
<div id="editor"></div>
59+
60+
</div>
61+
<div class="open-editor-nav">
62+
<button class="f-sv mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect mdl-button--raised mdl-button--colored">
63+
<span class="material-icons">
64+
save
65+
</span>
66+
Save <div class="rippleJS"></div>
67+
</button>
68+
<button class="fs-ed mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect mdl-button--raised mdl-button--colored">
69+
<span class="material-icons">
70+
fullscreen
71+
</span>
72+
Full <div class="rippleJS"></div>
73+
</button>
74+
<button class="f5 mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect mdl-button--raised mdl-button--colored">
75+
<span class="material-icons">
76+
refresh
77+
</span>
78+
Reload <div class="rippleJS"></div>
79+
</button>
80+
</div>
81+
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js" integrity="sha512-GZ1RIgZaSc8rnco/8CXfRdCpDxRCphenIiZ2ztLy3XQfCbQUSCuk8IudvNHxkRA3oUg6q0qejgN/qqyG1duv5Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
82+
83+
<script src="js/page.js"></script>
84+
85+
<script>
86+
$('.f5').click(function() {
87+
if (confirm("Bạn có muốn reload lại không? -- LƯU Ý: nhớ lưu lại file không tạch sml :v\nDo you want to reload file? -- note: remember save your file :3")) {
88+
cload("core/system/editor.php?dir=<?php if (isset($_GET['dir'])) {
89+
if ($_GET['dir'] != "/" or $_GET['dir'] != null) {
90+
echo urlencode($_GET['dir']);
91+
}
92+
} ?>");
93+
}
94+
})
95+
$('.fs-ed').click(function() {
96+
if ($('.open-editor-nav').css("position") === "fixed") {
97+
$('.open-editor-nav').removeClass("open-editor-nav__full");
98+
$('#editor').removeClass("editor--full");
99+
} else {
100+
$('.open-editor-nav').addClass("open-editor-nav__full");
101+
$('#editor').addClass("editor--full");
102+
}
103+
})
104+
$('.f-sv').click(function() {
105+
var content = ace.edit("editor").getValue();
106+
$.ajax({
107+
method: "POST",
108+
url: "core/system/kernel/sys.php",
109+
cache: false,
110+
data: {
111+
save__in_file: "<?php echo $main_path; ?>",
112+
save__content: content
113+
}
114+
})
115+
})
116+
117+
function load_ace() {
118+
var editor = ace.edit("editor");
119+
var textarea = $('#raw-input').hide();
120+
editor.getSession().setValue(textarea.val());
121+
editor.getSession().on('change', function() {
122+
textarea.val(editor.getSession().getValue());
123+
});
124+
editor.setTheme("ace/theme/monokai");
125+
editor.session.setMode("ace/mode/<?php
126+
$ext_file = pathinfo($main_path, PATHINFO_EXTENSION);
127+
if ($ext_file == "js") {
128+
echo "javascript";
129+
} else {
130+
echo $ext_file;
131+
} ?>");
132+
}
133+
load_ace();
134+
</script>
135+
<?php fclose($load_file); ?>

core/system/kernel/sys.php

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,29 @@
1818
include __DIR__ . '/../../ui/error/no-config.php';
1919
exit();
2020
}
21-
define("VERSION_BKF", "v0.2");
22-
define("VERSION", "0.2");
21+
if (isset($SS_USERNAME) == false and isset($SS_PASSWORD) == false) {
22+
require __DIR__ . '/../../ui/u/first_setup.php';
23+
exit();
24+
}
25+
if (isset($_COOKIE['bkf_token']) !== true) {
26+
setcookie('bkf_token', null, -1, '/');
27+
require __DIR__ . '/../../ui/u/login.php';
28+
exit();
29+
} else {
30+
$__get_udata = json_decode(base64_decode(base64_decode($_COOKIE['bkf_token'])));
31+
if ($__get_udata->uu_username != $SS_USERNAME or $__get_udata->uu_password != md5($SS_PASSWORD)) {
32+
setcookie('bkf_token', null, -1, '/');
33+
header("Location: " . $_SERVER['REQUEST_URI'] . "");
34+
exit();
35+
}
36+
}
37+
if (isset($_GET['logout'])) {
38+
setcookie('bkf_token', null, -1, '/');
39+
echo 'Logged out!';
40+
exit();
41+
}
42+
define("VERSION_BKF", "v0.3");
43+
define("VERSION", "0.3");
2344
include __DIR__ . '/update_core/server.php';
2445
$_get_update = file_get_contents(UPDATE_SERVER);
2546
if ($_get_update == null) {
@@ -132,16 +153,22 @@ function deleteDirectory($dir)
132153

133154
return rmdir($dir);
134155
}
135-
if (isset($_FILES['file'], $_POST['upload_dir'])) {
136-
if ($_FILES['file'] == null) {
137-
echo 'Vui lòng chọn file :<\nPlease select a file :<\n\n bakafiles';
138-
} elseif (0 < $_FILES['file']['error']) {
139-
echo 'Lỗi/error: ' . $_FILES['file']['error'] . '\n\n bakafiles';
140-
} else {
141-
move_uploaded_file($_FILES['file']['tmp_name'], urldecode($_POST['upload_dir']) . "/" . $_FILES['file']['name']);
142-
echo "Đã up thành công! - Uploaded!";
143-
}
156+
// if (isset($_FILES['file'], $_POST['upload_dir'])) {
157+
// if ($_FILES['file'] == null) {
158+
// echo 'Vui lòng chọn file :<\nPlease select a file :<\n\n bakafiles';
159+
// } elseif (0 < $_FILES['file']['error']) {
160+
// echo 'Lỗi/error: ' . $_FILES['file']['error'] . '\n\n bakafiles';
161+
// } else {
162+
// move_uploaded_file($_FILES['file']['tmp_name'], urldecode($_POST['upload_dir']) . "/" . $_FILES['file']['name']);
163+
// echo "Đã up thành công! - Uploaded!";
164+
// }
165+
// }
166+
if (!empty($_FILES) and isset($_GET['upload__dir']) == true) {
167+
$temp_file = $_FILES['file']['tmp_name'];
168+
$location = urldecode($_GET['upload__dir']) . "/" . $_FILES['file']['name'];
169+
move_uploaded_file($temp_file, $location);
144170
}
171+
145172
if (isset($_GET['download'], $_GET['dird'])) {
146173
$file__dir = $_GET['dird'];
147174
if (strpos(mime_content_type(ROOT_DIR . "/" . $file__dir), "image/") === false) {
@@ -154,3 +181,10 @@ function deleteDirectory($dir)
154181
exit;
155182
}
156183
}
184+
if (isset($_POST['save__in_file'], $_POST['save__content'])) {
185+
$file__dir = urldecode($_POST['save__in_file']);
186+
$file__content = urldecode($_POST['save__content']);
187+
$file__wipe = fopen($file__dir, "w");
188+
fclose($file__wipe);
189+
file_put_contents($file__dir, $file__content);
190+
}

core/ui/footer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
cload("core/system/dir.php");
2525
});
2626
</script>
27+
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js" integrity="sha512-GZ1RIgZaSc8rnco/8CXfRdCpDxRCphenIiZ2ztLy3XQfCbQUSCuk8IudvNHxkRA3oUg6q0qejgN/qqyG1duv5Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
2728
<script async src="https://cdn.jsdelivr.net/npm/vanilla-ripplejs@1.0.6" integrity="sha384-OlarGErerEgz/M7123pQTTek4pUIiR6t0BK09bTmWDi2cZYbv3VHrriaXDnA0Oup" crossorigin="anonymous"></script>
2829
</body>
2930

core/ui/header.php

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@
1212
jQuery - MIT License (https://jquery.com)
1313
*/
1414
?>
15+
<!-- bakafiles >~<
16+
by Michio Nakano (michio.xd)
17+
18+
License: GNU GENERAL PUBLIC LICENSE (GPL)
19+
20+
https://github.com/michioxd/bakafiles
21+
22+
File: header.php (UI Headerrrrrr)
23+
24+
Material Design Lite - © Google, 2015. Licensed under an Apache-2 license. (https://getmdl.io)
25+
jQuery - MIT License (https://jquery.com)
26+
-->
1527
<!DOCTYPE html>
1628
<html lang="en">
1729

@@ -20,15 +32,17 @@
2032
<meta http-equiv="X-UA-Compatible" content="IE=edge">
2133
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2234
<title>bakafiles</title>
35+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.2/dropzone.css" />
36+
<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.2/dropzone.js"></script>
2337
<link rel="stylesheet" href="assets/font/GoogleSans/main.css">
2438
<link rel="stylesheet" href="assets/font/MaterialIcons/main.css">
2539
<link rel="stylesheet" href="plugins/mdl/material.min.css">
2640
<script src="plugins/mdl/material.min.js"></script>
2741
<script src="plugins/jquery/jquery-3.6.0.min.js"></script>
2842
<link rel="stylesheet" href="css/main.css">
2943
<link rel="stylesheet" href="css/additional.css">
30-
<link rel="stylesheet" href="dark.css">
3144
<script src="js/function.js"></script>
45+
3246
</head>
3347

3448
<body>
@@ -67,7 +81,7 @@
6781
New version: <?php echo $_get_update; ?>
6882
</div>
6983
<div class="mdl-card__actions mdl-card--border">
70-
<button class="update-dialog-up mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect mdl-button--raised mdl-button--colored">
84+
<button onclick="window.location.href='https://github.com/michioxd/bakafiles/releases/tag/<?php echo $_get_update; ?>'" class="update-dialog-up mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect mdl-button--raised mdl-button--colored">
7185
Update!
7286
</button>
7387
<button id="update-dialog-closeb" class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
@@ -112,6 +126,19 @@
112126
</header>
113127
<div class="mdl-layout__drawer">
114128
<span class="mdl-layout-title">bakafiles</span>
129+
<h6 style="margin:0;font-size: 12px;color:gray !important;float: left;margin-left: 10px;">USER</h6>
130+
<div class="nav-settings">
131+
<div style="text-align: center;">
132+
<img style="border-radius: 10px;box-shadow: 0px 0px 20px currentColor;" src="assets/avt.jpg" alt="" width="160px">
133+
<h6 style="margin:0;font-size: 12px;color:gray !important;">HELLO!</h6>
134+
<h4 style="margin: 0;line-height:0.8"><?php echo $__get_udata->uu_username; ?></h4>
135+
</div>
136+
<div onclick="window.location.href='?logout'" class="nav-settings__content">
137+
<h5 style="float: left;margin:0">Logout<span style="font-size: 12px;font-weight:lighter;display:block">See u next time :< </span>
138+
</h5>
139+
<div class="rippleJS"></div>
140+
</div>
141+
</div>
115142
<h6 style="margin:0;font-size: 12px;color:gray !important;float: left;margin-left: 10px;">SETTINGS</h6>
116143
<div class="nav-settings">
117144
<div class="nav-settings__content">
@@ -130,10 +157,10 @@
130157
</label>
131158
<div class="rippleJS"></div>
132159
</div>
133-
<div class="nav-settings__content">
160+
<!-- <div class="nav-settings__content">
134161
<h5 style="float: left;margin:0">Update<span style="font-size: 12px;font-weight:lighter;display:block">Check update for more new function!</span></h5>
135162
<div class="rippleJS"></div>
136-
</div>
163+
</div> -->
137164
</div>
138165
<h6 style="margin:0;font-size: 12px;color:gray !important;float: left;margin-left: 10px;">ABOUT</h6>
139166
<div class="nav-settings">
@@ -151,4 +178,5 @@
151178
</div>
152179
<main class="mdl-layout__content">
153180
<div class="page-content main__bkf">
154-
<div class="boot"></div>
181+
<div class="boot">
182+
</div>

0 commit comments

Comments
 (0)