mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
Sort code and display bytes and datetime also
This commit is contained in:
@@ -5,10 +5,32 @@ include("settings.php");
|
||||
|
||||
$file = str_replace("|","/",xssClean($_GET['file'],'html'));
|
||||
|
||||
// Get contents
|
||||
$loadedFile = toUTF8noBOM(file_get_contents("../backups/".$file,false,$context),true);
|
||||
$encoding=ini_get("default_charset");
|
||||
if($encoding=="")
|
||||
$encoding="UTF-8";
|
||||
|
||||
// Set content in a textarea
|
||||
echo '<textarea name="loadedFile" id="loadedFile">'.htmlentities($loadedFile,ENT_COMPAT,$encoding).'</textarea>';
|
||||
echo "<script>parent.document.getElementById('buttonsContainer').style.display = 'inline-block';parent.editor.setValue(document.getElementById('loadedFile').value)</script>";
|
||||
?>
|
||||
|
||||
// Get bytes for this file
|
||||
$bytes = filesize("../backups/".$file);
|
||||
// Change into kilobytes
|
||||
$outputSize = ($bytes/1024);
|
||||
$outputUnit = "kb";
|
||||
// Maybe we should show in megabytes?
|
||||
if ($outputSize >= 1024) {
|
||||
$outputSize = ($outputSize/1024);
|
||||
$outputUnit = "mb";
|
||||
}
|
||||
$size = number_format($outputSize, 2, '.', '').$outputUnit." (".number_format($bytes)." bytes)";
|
||||
|
||||
// Get date & time of file
|
||||
$datetime = str_replace("-","<br>",date( "D jS M Y-g:i:sa", filemtime("../backups/".$file)));
|
||||
?>
|
||||
<script>
|
||||
parent.document.getElementById('buttonsContainer').style.display = 'inline-block';
|
||||
parent.editor.setValue(document.getElementById('loadedFile').value);
|
||||
parent.document.getElementById('infoContainer').innerHTML = 'Size:<br><?php echo $size;?><br><br>Date & Time:<br><?php echo $datetime;?>';
|
||||
</script>
|
||||
Reference in New Issue
Block a user