Repository navigation
Expand file tree
/
Copy pathorchestra.php
More file actions
executable file
·54 lines (45 loc) · 2.36 KB
/
Copy pathorchestra.php
File metadata and controls
executable file
·54 lines (45 loc) · 2.36 KB
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
<?php
require_once("_basic_tasks.php");
if(isset($_GET['file'])) $file = urldecode($_GET['file']);
else $file = '';
if($file == '') die();
$url_this_page = "orchestra.php?file=".urlencode($file);
save_settings("last_page",$url_this_page);
$table = explode(SLASH,$file);
$filename = end($table);
$this_file = $bp_application_path.$file;
$dir = str_replace($filename,'',$this_file);
$current_directory = str_replace(SLASH.$filename,'',$file);
save_settings("last_directory",$current_directory);
require_once("_header.php");
display_darklight();
echo "<p>";
$url = "index.php?path=".urlencode($current_directory);
echo " Workspace = <input title=\"List this workspace\" class=\"edit big\" name=\"workspace\" type=\"submit\" onmouseover=\"checksaved();\" onclick=\"if(checksaved()) window.open('".$url."','_self');\" value=\"".$current_directory."\">";
echo link_to_help();
if($test) echo "file = ".$file."<br />";
if($test) echo "url_this_page = ".$url_this_page."<br />";
if($test) echo "this_file = ".$this_file."<br />";
if($test) echo "dir = ".$dir."<br />";
echo "<h2>Orchestra “".$filename."”</h2>";
save_settings("last_name",$filename);
if(isset($_POST['savethisfile'])) {echo "<span id=\"timespan\" style=\"color:red; float:right; background-color:white; padding:6px; border-radius:6px;\"> Saved “".$this_file."” file…</span>";
$content = $_POST['thistext'];
$handle = fopen($this_file,"w");
$file_header = $top_header."\n// MIDI orchestra file saved as \"".$filename."\". Date: ".gmdate('Y-m-d H:i:s')." GMT";
fwrite($handle,$file_header."\n");
fwrite($handle,$content);
fclose($handle);
}
try_create_new_file($this_file,$filename);
$content = @file_get_contents($this_file);
if($content === FALSE) ask_create_new_file($url_this_page,$filename);
if(MB_CONVERT_OK) $content = mb_convert_encoding($content,'UTF-8','UTF-8');
$extract_data = extract_data(FALSE,TRUE,$content);
echo "<p class=\"green-text\">".$extract_data['headers']."</p>";
$content = $extract_data['content'];
echo "<form method=\"post\" action=\"".$url_this_page."\" enctype=\"multipart/form-data\">";
echo "<p style=\"text-align:left;\"><input class=\"save\" type=\"submit\" onclick=\"clearsave();\" name=\"savethisfile\" value=\"SAVE ‘".$filename."’\"></p>";
echo "<textarea name=\"thistext\" onchange=\"tellsave()\" rows=\"40\" style=\"width:700px;\">".$content."</textarea>";
echo "</form>";
?>