|
1 | 1 | <?php |
2 | 2 | // Load common functions |
3 | 3 | include("headers.php"); |
4 | | -include_once("settings-common.php"); |
| 4 | +include("settings.php"); |
5 | 5 | $text = $_SESSION['text']; |
6 | 6 | $t = $text['backup-versions']; |
7 | 7 |
|
|
17 | 17 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
18 | 18 | <meta name="robots" content="noindex, nofollow"> |
19 | 19 | <link rel="stylesheet" type="text/css" href="backup-versions.css?microtime=<?php echo microtime(true);?>"> |
| 20 | +<link rel="stylesheet" href="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror.css?microtime=<?php echo microtime(true);?>"> |
| 21 | +<script src="../<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js?microtime=<?php echo microtime(true);?>"></script> |
| 22 | + |
| 23 | +<style type="text/css"> |
| 24 | +.CodeMirror {position: absolute; width: 409px; height: 180px; font-size: <?php echo $ICEcoder["fontSize"];?>} |
| 25 | +.CodeMirror-scroll {overflow: hidden} |
| 26 | +/* Make sure this next one remains the 3rd item, updated with JS */ |
| 27 | +.cm-tab {border-left-width: <?php echo $ICEcoder["visibleTabs"] ? "1px" : "0";?>; margin-left: <?php echo $ICEcoder["visibleTabs"] ? "-1px" : "0";?>; border-left-style: solid; border-left-color: rgba(255,255,255,0.2)} |
| 28 | +</style> |
| 29 | +<link rel="stylesheet" href="editor.css?microtime=<?php echo microtime(true);?>"> |
| 30 | +<?php |
| 31 | +$themeArray = array(); |
| 32 | +$handle = opendir('../'.$ICEcoder["codeMirrorDir"].'/theme/'); |
| 33 | + |
| 34 | +while (false !== ($cssFile = readdir($handle))) { |
| 35 | + if ($cssFile !== "." && $cssFile != "..") { |
| 36 | + array_push($themeArray,basename($cssFile,".css")); |
| 37 | + } |
| 38 | +} |
| 39 | +sort($themeArray); |
| 40 | +for ($i=0;$i<count($themeArray);$i++) { |
| 41 | + echo '<link rel="stylesheet" href="../'.$ICEcoder["codeMirrorDir"].'/theme/'.$themeArray[$i].'.css?microtime='.microtime(true).'">'.PHP_EOL; |
| 42 | +} |
| 43 | +?> |
20 | 44 | </head> |
21 | 45 |
|
22 | 46 | <body class="backup-versions"> |
|
25 | 49 | <h2><?php echo $file;?></h2> |
26 | 50 |
|
27 | 51 | <br> |
| 52 | +<div style="display: inline-block"> |
28 | 53 | <?php |
29 | 54 | $dateCounts = $fileCountInfo['dateCounts']; |
30 | 55 | $displayVersions = $versions; |
31 | 56 |
|
| 57 | +// Establish the base, host and date dir parts... |
| 58 | +$backupDirHost = isset($ftpSite) ? parse_url($ftpSite,PHP_URL_HOST) : "localhost"; |
| 59 | + |
32 | 60 | foreach ($dateCounts as $key => $value) { |
33 | 61 | echo "<b>".date("jS M Y",strtotime($key))." (".$value." ".($value != 1 ? $t["backups"] : $t["backup"]).")</b>"; |
34 | 62 | echo '<br>'; |
35 | 63 | for ($j=0; $j<$value; $j++) { |
36 | | - echo "Backup ".$displayVersions.'<br>'; |
| 64 | + echo '<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fbackup-versions-preview-loader.php%3Ffile%3D%3C%2Fspan%3E%3Cspan+class%3D"x">'.str_replace("/","|",$backupDirHost.'/'.$key.$file).' ('.$displayVersions.')&csrf='.$_SESSION['csrf'].'" target="previewLoader">Backup '.$displayVersions.'<br>'; |
37 | 65 | $displayVersions--; |
38 | 66 | } |
39 | 67 | echo '<br>'; |
40 | 68 | } |
41 | 69 | ?> |
| 70 | +</div> |
| 71 | +<div style="display: inline-block; height: 300px; width: 400px; margin-left: 30px"> |
| 72 | + <textarea id="code" name="code">Click a backup to the left to preview it</textarea> |
| 73 | +</div> |
| 74 | +<div style="display: none; width: 180px; margin-left: 30px" id="buttonsContainer"> |
| 75 | + <div class="button" onclick="openNew()">Open in new tab</div> |
| 76 | + <div class="button" onclick="openDiff()">Open in diff mode</div> |
| 77 | + <!-- |
| 78 | + <div class="button" onclick="alert('Function not available yet - Coming in v5.4')">Restore as new version</div> |
| 79 | + //--> |
| 80 | +</div> |
| 81 | +<div style="display: none"> |
| 82 | + <iframe name="previewLoader"></iframe> |
| 83 | +</div> |
| 84 | + |
| 85 | +<script> |
| 86 | +var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
| 87 | + lineNumbers: true, |
| 88 | + readOnly: "nocursor", |
| 89 | + indentUnit: top.ICEcoder.indentSize, |
| 90 | + tabSize: top.ICEcoder.indentSize, |
| 91 | + mode: "javascript", |
| 92 | + theme: "<?php echo $ICEcoder["theme"]=="default" ? 'icecoder' : $ICEcoder["theme"];?>" |
| 93 | + }); |
| 94 | +editor.setSize("400px","330px"); |
| 95 | + |
| 96 | +var openNew = function() { |
| 97 | + var cM; |
| 98 | + |
| 99 | + top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')) |
| 100 | + top.ICEcoder.newTab(); |
| 101 | + cM = top.ICEcoder.getcMInstance(); |
| 102 | + cM.setValue(editor.getValue()); |
| 103 | +} |
| 104 | + |
| 105 | +var openDiff = function() { |
| 106 | + var cMDiff; |
| 107 | + |
| 108 | + top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')) |
| 109 | + top.ICEcoder.setSplitPane('on'); |
| 110 | + cMDiff = top.ICEcoder.getcMdiffInstance(); |
| 111 | + top.ICEcoder.focus('diff'); |
| 112 | + cMDiff.setValue(editor.getValue()); |
| 113 | +} |
| 114 | +</script> |
42 | 115 |
|
43 | 116 | </body> |
44 | 117 |
|
|
0 commit comments