annotate save.php @ 1316:279930a008ca

All interfaces support comment boxes. Comment box identification matches presented tag (for instance, AB will be Comment on fragment A, rather than 1). Tighter buffer loading protocol, audioObjects register with the buffer rather than checking for buffer existence (which can be buggy depending on the buffer state). Buffers now have a state to ensure exact location in loading chain (downloading, decoding, LUFS, ready).
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Fri, 29 Jan 2016 11:11:57 +0000
parents
children 2647dd909229 b5bf2f57187c 9ee921c8cdd3
rev   line source
nickjillings@1316 1 <?php
nickjillings@1316 2 header('Access-Control-Allow-Origin: *');
nickjillings@1316 3 header("Content-type: text/xml");
nickjillings@1316 4 $postText = file_get_contents('php://input');
nickjillings@1316 5 $sha1_hash = sha1($postText);
nickjillings@1316 6 $datetime = date('ymdHis');
nickjillings@1316 7 $xmlfile = "save".$datetime."-".$sha1_hash.".xml";
nickjillings@1316 8 $fileHandle = fopen("saves/".$xmlfile, 'w');
nickjillings@1316 9 if ($fileHandle == FALSE)
nickjillings@1316 10 {
nickjillings@1316 11 // Filehandle failed
nickjillings@1316 12 $xml = '<response state="error"><message>Could not open file</message></response>';
nickjillings@1316 13 echo $xml;
nickjillings@1316 14 return;
nickjillings@1316 15 }
nickjillings@1316 16 $wbytes = fwrite($fileHandle, $postText);
nickjillings@1316 17 if ($wbytes == FALSE)
nickjillings@1316 18 {
nickjillings@1316 19 // FileWrite failed
nickjillings@1316 20 $xml = '<response state="error"><message>Could not write file "saves/'.$xmlfile.'"</message></response>';
nickjillings@1316 21 echo $xml;
nickjillings@1316 22 return;
nickjillings@1316 23 }
nickjillings@1316 24 fclose($fileHandle);
nickjillings@1316 25
nickjillings@1316 26 // Return JSON confirmation data
nickjillings@1316 27 $xml = '<response state="OK"><message>OK</message><file bytes="'.$wbytes.'">"saves/'.$xmlfile.'"</file></response>';
nickjillings@1316 28 echo $xml;
nickjillings@1316 29 ?>