2,52c2,3 < // macos_textutil_convert.php < // Supervise macOS (via PHP exec) textutil (command line) conversions < /* < textutil: [command_option] [other_options] file... < Command options are (-help is the default): < -help show this message and exit < -info display information about each file < -convert fmt convert each input file to format (txt, rtf, rtfd, < html, doc, docx, odt, wordml, or webarchive) < -cat fmt concatenate input files into one output file < There are some additional optional arguments: < -extension ext alternate extension for all output files < -output path alternate file name for first output file < -stdin read from stdin instead of files < -stdout send first output file to stdout < -encoding IANA_name|NSStringEncoding < encoding used for plain text or html output files < (default encoding is UTF-8) < -inputencoding IANA_name|NSStringEncoding < encoding used to interpret plain text input files < (by default encoding will be detected from BOM) < -format fmt force input files to be interpreted in this format < -font font specify font used for converting plain to rich text < -fontsize size specify font size for converting plain to rich text < -- specifies that all further arguments are file names < < -noload do not load subsidiary resources for html files < -nostore do not write out subsidiary resources for html files < -baseurl url base URL for subsidiary resources in html files < -timeout t time in seconds to wait for html resources to load < -textsizemultiplier x < factor to apply to font sizes in html files < -excludedelements "(tag1, tag2, ...)" < html elements to exclude from html output files < -prefixspaces n < number of spaces to indent nested html output < < -strip do not copy metadata attributes to output files < -title val title metadata attribute for output files < -author val author metadata attribute for output files < -subject val subject metadata attribute for output files < -keywords "(val1, val2, ...)" < keywords metadata attribute for output files < -comment val comment metadata attribute for output files < -editor val last editor metadata attribute for output files < -company val company metadata attribute for output files < -creationtime yyyy-mm-ddThh:mm:ssZ < creation time metadata attribute for output files < -modificationtime yyyy-mm-ddThh:mm:ssZ < modification time metadata attribute for output files < */ --- > // macos_say_record.php > // Supervise and synchronize 'say [words]' (say) some text 56,59c7,8 < $doutput=""; < $outfileis=""; < $sufext="_0"; < $iext=0; --- > $daudio=""; > $audiois=""; 62,111c11,43 < if (isset($_GET['convertthis']) && isset($_GET['outputname'])) { < if ($_GET['convertthis'] != "") { < $thewords=str_replace("+"," ",urldecode($_GET['convertthis'])); < if (file_exists(str_replace("+"," ",urldecode($_GET['outputname'])))) { < while (file_exists(str_replace("+"," ",urldecode($_GET['outputname'])) . $sufext)) { < $iext++; < $sufext="_" . $iext; < } < exec("rename " . str_replace("+"," ",urldecode($_GET['outputname'])) . " " . str_replace("+"," ",urldecode($_GET['outputname'])) . $sufext); < } < exec("textutil -convert " . explode(".",str_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",str_replace("+"," ",urldecode($_GET['outputname']))))] . " " . $thewords . " -output " . str_replace("+"," ",urldecode($_GET['outputname'])) . " > x.out 2> x.err"); < exit; < } < } else if (isset($_POST['convertthis']) && isset($_POST['outputname'])) { < if ($_POST['convertthis'] != "") { < $thewords=str_replace("+"," ",urldecode($_POST['convertthis'])); < if (file_exists(str_replace("+"," ",urldecode($_POST['outputname'])))) { < while (file_exists(str_replace("+"," ",urldecode($_POST['outputname'])) . $sufext)) { < $iext++; < $sufext="_" . $iext; < } < exec("rename " . str_replace("+"," ",urldecode($_POST['outputname'])) . " " . str_replace("+"," ",urldecode($_POST['outputname'])) . $sufext); < } < exec("textutil -convert " . explode(".",str_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",str_replace("+"," ",urldecode($_POST['outputname']))))] . " " . $thewords . " -output " . str_replace("+"," ",urldecode($_POST['outputname'])) . " > x.out 2> x.err"); < exit; < } < } else if ((!isset($_GET['convertthis']) && !isset($_POST['convertthis'])) || !isset($_GET['outputname']) || !isset($_POST['outputname'])) { < $outfileis=""; < if (isset($_GET['outputname'])) { < $extis=explode(".",str_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",str_replace("+"," ",urldecode($_GET['outputname']))))]; < if (file_exists(str_replace("+"," ",urldecode($_GET['outputname'])))) { < if (strtolower("~" . $extis, "~htm") !== false) { < $thecontent=file_get_contents(str_replace("+"," ",urldecode($_GET['outputname']))); < } else { < header('Content-type: application/' . explode(".",str_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",str_replace("+"," ",urldecode($_GET['outputname']))))]); < echo file_get_contents(str_replace("+"," ",urldecode($_GET['outputname']))); < exit; < } < } < } else if (isset($_POST['outputname'])) { < $extis=explode(".",str_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",str_replace("+"," ",urldecode($_POST['outputname']))))]; < if (file_exists(str_replace("+"," ",urldecode($_POST['outputname'])))) { < if (strtolower("~" . $extis, "~htm") !== false) { < $thecontent=file_get_contents(str_replace("+"," ",urldecode($_POST['outputname']))); < } else { < header('Content-type: application/' . explode(".",str_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",str_replace("+"," ",urldecode($_POST['outputname']))))]); < echo file_get_contents(str_replace("+"," ",urldecode($_POST['outputname']))); < exit; < } < } --- > if (isset($_GET['saythis']) && isset($_GET['audioname'])) { > if ($_GET['saythis'] != "") { > file_put_contents("xqx.xqx","say -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_GET['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err"); > $thewords=str_replace("+"," ",urldecode($_GET['saythis'])); > file_put_contents("xq.xq","say -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_GET['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err"); > exec("say -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_GET['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err"); > } > } else if (isset($_POST['saythis']) && isset($_POST['audioname'])) { > if ($_POST['saythis'] != "") { > file_put_contents("xqqx.xqqx","say -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_POST['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err"); > $thewords=str_replace("+"," ",urldecode($_POST['saythis'])); > //echo "say -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_POST['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords); > //exit; > file_put_contents("xqq.xqq","say -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_POST['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err"); > exec("say -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_POST['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err"); > } > } else if ((!isset($_GET['saythis']) && !isset($_POST['saythis'])) || !isset($_GET['audioname']) || !isset($_POST['audioname'])) { > $audiois=""; > if (isset($_GET['audioname'])) { > $audiois=""; > $thecontent="data:audio/x-aiff;base64," . base64_encode(file_get_contents(dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_GET['audioname'])))); > $daudio=""; > //unlink(dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_GET['audioname']))); > } else if (isset($_POST['audioname'])) { > $audiois=""; > $thecontent="data:audio/x-aiff;base64," . base64_encode(file_get_contents(dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_POST['audioname'])))); > $daudio=""; > //unlink(dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_POST['audioname']))); > } > if (isset($_GET['saythis'])) { > $tastuff=str_replace("+"," ",urldecode($_GET['saythis'])); > } else if (isset($_GET['saythis'])) { > $tastuff=str_replace("+"," ",urldecode($_POST['saythis'])); 120c52 < location.href=document.URL.split('?')[0].split('#')[0] + '?outputname=' + encodeURIComponent(document.getElementById('outputname').value) + '&dummyconvertthis=' + encodeURIComponent(document.getElementById('thewords').value); --- > location.href=document.URL.split('?')[0].split('#')[0] + '?audioname=' + encodeURIComponent(document.getElementById('audioname').value) + '&dummysaythis=' + encodeURIComponent(document.getElementById('thewords').value); 131c63 < window.opener.document.getElementById('doutput').innerHTML='" . $doutput . "'; --- > window.opener.document.getElementById('daudio').innerHTML='" . $daudio . "'; 138c70 <