<?php
// macos_textutil_convert.php
// Supervise macOS (via PHP exec) textutil (command line) conversions
// 8: /usr/bin/pandoc -t html "/tmp/xx.docx" -o "/tmp/FileZilla.html" > macos_textutil_convert.out 2> macos_textutil_convert.err; rm -f /tmp/xx.docx
/*     
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
*/
ini_set('max_execution_time', 6000); 
error_reporting(E_ERROR | E_PARSE);

$opth="";
$wobit="";
$switchfrom=" txt ";
$switchto=" txt ";
$inaconto="none";
$plurals="(s)";
$mult=" multiple";

$alone="";
$altwo="";
$commstatus=0;
$okthen=true;
if (isset($_GET['bemaye'])) {
    if (strlen($_GET['bemaye']) > 0) { $commstatus=1; $okthen=false; $alone=" onload='setTimeout(function(){ if (window.opener) { window.opener.location.href=document.URL.split(String.fromCharCode(35))[0].split(String.fromCharCode(63))[0]; } }, 5000);' ";  $altwo=" onload='setTimeout(function(){ if (window.opener) { window.opener.location.href=document.URL.split(String.fromCharCode(35))[0].split(String.fromCharCode(63))[0]; } }, 5000);' "; }
}
if (isset($_GET['bemays'])) {
    if (strlen($_GET['bemays']) > 0) { $commstatus=2; $okthen=false; $alone=" onload='setTimeout(function(){ if (window.opener) { window.opener.location.href=document.URL.split(String.fromCharCode(35))[0].split(String.fromCharCode(63))[0]; } }, 5000);' ";  $altwo=" onload='setTimeout(function(){ if (window.opener) { window.opener.location.href=document.URL.split(String.fromCharCode(35))[0].split(String.fromCharCode(63))[0]; } }, 5000);' "; }
}
//$alone="";
//$altwo="";
//$okthen=false;


$jstit=" 
 var ifdone=false;
 var saconto=null;
 var cs=" . $commstatus . ";
 
 function zonc(event){  if (event.target.innerHTML.indexOf('<br') != -1) { event.target.setAttribute('data-big', encodeURIComponent(event.target.innerHTML)); event.target.innerHTML=event.target.innerHTML.replace(/\<br\>/g, String.fromCharCode(10));    } else { event.target.innerHTML=decodeURIComponent(event.target.getAttribute('data-big'));   } }
 
 function zonr(event){  var wwwooo=top.window.open('','_blank','top=15,left=15,width=500,height=500'); wwwooo.document.write(window.atob(event.target.getAttribute('data-biggest')));   }  
 
 function onc(event){ if (eval('' + event.target.innerHTML.length) >= eval('' + window.atob(event.target.getAttribute('data-smalltitle')).length) && eval('' + event.target.innerHTML.length) < eval('' + window.atob(event.target.getAttribute('data-bigtitle')).length)) { event.target.innerHTML=window.atob(event.target.getAttribute('data-bigtitle'));  } else {  event.target.innerHTML=window.atob(event.target.getAttribute('data-smalltitle'));    }  }

 function onr(event){ var wwwooo=window.open('','_blank','top=15,left=15,width=500,height=500'); wwwooo.document.write(window.atob(event.target.getAttribute('data-biggest')));  }

 function justit(iois) {
  var aconto=null, wobj=null, sis='', wasais=''. wpg='', newwasais='', tsis='', wasihis='';
  if (aconto == null && !ifdone) {
       aconto = (iois.contentWindow || iois.contentDocument);
       if (aconto != null) {
       if (aconto.document) { aconto = aconto.document; }
       if (aconto.body != null) {
         saconto=aconto;
         if (aconto.body.innerHTML.indexOf(';base64,') != -1) {
           ifdone=true;
           sis=aconto.body.innerHTML;
           wasais=aconto.body.innerHTML.split('\">')[0].split('>')[0];
           wpg=window.atob(wasais.split(';base64,')[1]);
           if (wpg.indexOf('<body') != -1) {
           aconto.body.innerHTML=wpg.split('<body' + wpg.split('<body')[1].split('>')[0] + '>')[1].split('</body>')[0];
           if (cs > 0) {
              if (aconto.body.title != 'Click to toggle line feed display and double click to show HTML view') {
              aconto.body.setAttribute('data-biggest', window.btoa(aconto.body.innerHTML));
              }
              wasihis=aconto.body.innerText;
              while (wasihis.indexOf(String.fromCharCode(10)) != -1) {
                wasihis=wasihis.replace(String.fromCharCode(10), '<br>');
              }
              aconto.body.innerHTML=wasihis;
              aconto.body.onclick=function(event){  zonc(event);  }
              aconto.body.title='Click to toggle line feed display and double click to show HTML view';
              aconto.body.ondblclick=function(){ var wwwooo=top.window.open('','_blank','top=15,left=15,width=500,height=500'); wwwooo.document.write(window.atob(saconto.body.getAttribute('data-biggest')));   };
           }
           } else {
           aconto.body.innerHTML=wpg;
           if (cs > 0) {
              if (aconto.body.title != 'Click to toggle line feed display and double click to show HTML view') {
              aconto.body.setAttribute('data-biggest', window.btoa(aconto.body.innerHTML));
              }
              wasihis=aconto.body.innerText;
              while (wasihis.indexOf(String.fromCharCode(10)) != -1) {
                wasihis=wasihis.replace(String.fromCharCode(10), '<br>');
              }
              aconto.body.innerHTML=wasihis;
              aconto.body.onclick=function(event){  zonc(event);  }
              aconto.body.title='Click to toggle line feed display and double click to show HTML view';
              aconto.body.ondblclick=function(){ var wwwooo=top.window.open('','_blank','top=15,left=15,width=500,height=500'); wwwooo.document.write(window.atob(saconto.body.getAttribute('data-biggest')));   };
           }
           }
           if (!window.parent) {
           wobj=window.self;
           }
           if (window.parent || wobj) {
           if (parent.window.opener || wobj) {
           if (!wobj) { wobj=parent.window.opener; } else { wobj=window.parent;  }
           if (parent.window.opener.top) {
             wobj=parent.window.opener.top;
           }
           if (!wobj.document.getElementById('dres')) {
           wobj.document.body.innerHTML+='<br><div id=dres onclick=onc(event); oncontextmenu=onr(event); style=width:100%;></div>';
           }
           if (!wobj.document.getElementById('dhj')) {
           wobj.document.body.innerHTML+='<br><div id=dhj style=width:100%;></div>';
           }
           wobj.document.getElementById('dres').setAttribute('data-biggest',wasais.split(';base64,')[1]);
           wobj.document.getElementById('dres').setAttribute('data-smalltitle',window.btoa(aconto.body.innerText));
           wobj.document.getElementById('dres').title='Click toggles whether line feeds show and right click opens HTML look';
           newwasais=aconto.body.innerText;
           while (newwasais.indexOf(String.fromCharCode(10)) != -1) {
             newwasais=newwasais.replace(String.fromCharCode(10),'<br>');
           }
           wobj.document.getElementById('dres').innerHTML=newwasais; 
           wobj.document.getElementById('dres').setAttribute('data-bigtitle',window.btoa(newwasais));
           wobj.document.getElementById('dres').style.backgroundColor='white';
           parent.document.getElementById('dhj').innerHTML=iois.outerHTML.replace(' srcdoc=', ' src=');
           } else if (window.opener) {
           wobj=window.opener;
           if (window.opener.top) {
             wobj=window.opener.top;
           }
           if (!wobj.document.getElementById('dres')) {
           wobj.document.body.innerHTML+='<br><div id=dres onclick=onc(event); oncontextmenu=onr(event); style=width:100%;></div>';
           }
           if (!wobj.document.getElementById('dhj')) {
           wobj.document.body.innerHTML+='<br><div id=dhj style=width:100%;></div>';
           }
           wobj.document.getElementById('dres').setAttribute('data-biggest',wasais.split(';base64,')[1]);
           wobj.document.getElementById('dres').setAttribute('data-smalltitle',window.btoa(aconto.body.innerText));
           wobj.document.getElementById('dres').title='Click toggles whether line feeds show and right click opens HTML look';
           newwasais=aconto.body.innerText;
           while (newwasais.indexOf(String.fromCharCode(10)) != -1) {
             newwasais=newwasais.replace(String.fromCharCode(10),'<br>');
           }
           wobj.document.getElementById('dres').innerHTML=newwasais; 
           wobj.document.getElementById('dres').setAttribute('data-bigtitle',window.btoa(newwasais));
           wobj.document.getElementById('dres').style.backgroundColor='white';
           if (window.opener) {
           window.opener.document.getElementById('myform').style.display='block';
           window.opener.document.getElementById('dhj').innerHTML=iois.outerHTML.replace(' srcdoc=', ' src=');
           } else {
           document.getElementById('myform').style.display='block';
           document.getElementById('dhj').innerHTML=iois.outerHTML.replace(' srcdoc=', ' src=');
           }
           }

           }
         }
       }
       }
  }
  }
";

$jit="<scr" . "ipt type=text/javascript>   function justit(iois) { } </scr" . "ipt>";
$hjit="<scr" . "ipt type=text/javascript>   " . str_replace('ion justit(iois) {','ion hjustit(iois) {  ' . str_replace("'","",str_replace('onload=','',$alone)) . str_replace("'","",str_replace('onload=','',$altwo)),$jstit) . " </scr" . "ipt>";

function server_remote_addr() {
    $rma = $_SERVER['REMOTE_ADDR'];
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    // you can add different browsers with the same way ..
    if (1 == 1) {
    if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
            $rma = '000000'.$rma;
    elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
            $rma = '00000'.$rma;
    elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
            $rma = '0000'.$rma;
    elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
            $rma = '000'.$rma;
    elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
            $rma = '00'.$rma;
    elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
            $rma = '0'.$rma;
    } 
    return str_replace(':','_',str_replace('.','_',$rma));
} 

if (file_exists('/tmp/wobit' . server_remote_addr() . '.xxx')) {
   $wobit=file_get_contents('/tmp/wobit' . server_remote_addr() . '.xxx');
   unlink('/tmp/wobit' . server_remote_addr() . '.xxx');
}

  $rjm='rjmprogramming.com.au';
  $whereplace=shell_exec("ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'");
  if (strpos(($whereplace . ' ' . $_SERVER['SERVER_ADDR']), '65.254.92.213') !== false) { //65.254.95.247') !== false) {
     //$mult="";
     //$plurals="";
     $rjm='youllneverfindthis';
     $switchto=" plain ";
     $switchto=" HTML -s ";
if (isset($_GET['outpath'])) {
   $_GET['outpath']=urlencode('/tmp/');
} else if (isset($_POST['outpath'])) {
   $_POST['outpath']=urlencode('/tmp/');
} else if (isset($_GET['outputname'])) {
   $_GET['outpath']=urlencode('/tmp/');
} else if (isset($_POST['outputname'])) {
   $_POST['outpath']=urlencode('/tmp/');
}    
  } else if (strpos(($whereplace . ' ' . $_SERVER['SERVER_ADDR']), '65.254.95.247') !== false) {
     //$mult="";
     //$plurals="";
     $opth="/tmp/' readonly ";
     $rjm='youllneverfindthis';
     $switchto=" plain ";
     $switchto=" HTML -s ";
if (isset($_GET['outpath'])) {
   $_GET['outpath']=urlencode('/tmp/');
   $huhx='';
   if (!isset($_GET['content'])) {
     file_put_contents('abc.poi', 'yes');
     $huhx=' ';
   } else {
     if (strlen($_GET['content']) == 0) {
     $huhx='  ';
     file_put_contents('abc.pii', 'yes');
     }
   }
   if ($huhx != '') {
      $his="";
      if ($huhx == ' ') {
        $his="<html><body style=cursor:progress; onload=\" var locationhash=('' + locationhash).replace(/^undefined/g,'').replace(/^null/g,'');  if (locationhash == '' && document.URL.indexOf('#') != -1) { locationhash=document.URL.split('#')[1]; } if (locationhash == '') {   if (document.getElementById('content').value.trim() == '') { if ('" . $commstatus . "' == '2') { alert('Maybe try email back for the originator when the output files are old in the tooth.'); location.href=document.URL.split('?')[0].split('#')[0];   } else {  alert('Sorry, you might need to recontact the originator to recreate this output file.');  location.href=document.URL.split('?')[0].split('#')[0];   } }   } else {  if (decodeURIComponent('' + locationhash).split('content=')[1].indexOf('data:') == 0) { document.getElementById('content').value=decodeURIComponent('' + locationhash).split('content=')[1].replace(/\ /g,'+'); } else { document.getElementById('content').value=decodeURIComponent('' + locationhash).split('content=')[1].replace(/\ /g,'+'); } if (document.getElementById('content').value.trim() == '') { if ('" . $commstatus . "' == '2') { alert('Maybe try email back for the originator when the output files are old in the tooth.');  location.href=document.URL.split('?')[0].split('#')[0];  } else {  alert('Sorry, you might need to recontact the originator to recreate this output file.');  location.href=document.URL.split('?')[0].split('#')[0];   } } else { document.getElementById('mysbut').click(); } } \"><form id=myf target=_self action=./macos_textutil_convert.php method=POST><input type=hidden value='' name=content id=content></input></form><br><div id=divend style=width:100%;display:none;></div></body></html>";
      } else {
        $his="<html><body style=cursor:progress; onload=\" var locationhash=('' + locationhash).replace(/^undefined/g,'').replace(/^null/g,'');  if (locationhash == '' && document.URL.indexOf('#') != -1) { locationhash=document.URL.split('#')[1]; } if (locationhash == '') {   if (document.getElementById('content').value.trim() == '') { if ('" . $commstatus . "' == '2') { alert('Maybe try email back for the originator when the output files are old in the tooth.'); location.href=document.URL.split('?')[0].split('#')[0];   } else {  alert('Sorry, you might need to recontact the originator to recreate this output file.');  location.href=document.URL.split('?')[0].split('#')[0];   } }   } else {  if (decodeURIComponent('' + locationhash).split('content=')[1].indexOf('data:') == 0) { document.getElementById('content').value=decodeURIComponent('' + locationhash).split('content=')[1].replace(/\ /g,'+'); } else { document.getElementById('content').value=decodeURIComponent('' + locationhash).split('content=')[1].replace(/\ /g,'+'); } if (document.getElementById('content').value.trim() == '') { if ('" . $commstatus . "' == '2') { alert('Maybe try email back for the originator when the output files are old in the tooth.');  location.href=document.URL.split('?')[0].split('#')[0];  } else {  alert('Sorry, you might need to recontact the originator to recreate this output file.');  location.href=document.URL.split('?')[0].split('#')[0];   } } else { document.getElementById('mysbut').click(); } } \"><form id=myf target=_self action=./macos_textutil_convert.php method=POST></form><br><div id=divend style=width:100%;display:none;></div></body></html>";
      }
      $huhfm='';
      $huhfn='';
      foreach ( $_GET as $key => $value ) {
        if ($key == 'outputname') {
      if ($value != '') { $huhfm=basename($value); }
     file_put_contents('abc.iop', $value);
          if (strpos($_SERVER['SERVER_NAME'], 'rjmprogramming.com.au') !== false) {
            if (strpos(urldecode($value), '/tmp/') !== false) {
               if (file_exists(urldecode($value))) {
                 $huhfn=urldecode($value);
     file_put_contents('abc.bxp', '' . $commstatus . ' ... ' . $huhfn);
               } else if (file_exists(str_replace('+',' ',urldecode($value)))) {
                 $huhfn=urldecode(str_replace('+',' ',urldecode($value)));
     file_put_contents('abc.cxp', '' . $commstatus . ' ... ' . $huhfn);
               }
            } else {
               if (file_exists('/tmp/' . urldecode($value))) {
                 $huhfn='/tmp/' . urldecode($value);
     file_put_contents('abc.ixp', '' . $commstatus . ' ... ' . $huhfn);
               } else if (file_exists('/tmp/' . str_replace('+',' ',urldecode($value)))) {
                 $huhfn='/tmp/' . str_replace('+',' ',urldecode($value));
     file_put_contents('abc.izp', $value);
               }
            }
          }
        }
        if (strpos(urldecode($value), 'data:') !== false) {
          $his=str_replace("</form>", "<input type=hidden id=" . $key . " name=" . $key . " value=\"" . str_replace(' ','+',urldecode($value)) . "\"></input></form>", $his);
        } else {
          $his=str_replace("</form>", "<input type=hidden id=" . $key . " name=" . $key . " value=\"" . str_replace('+',' ',urldecode($value)) . "\"></input></form>", $his);
        }
      }
      $his=str_replace('</form>', '<input style=display:none; type=submit id=mysbut value=Submit></input></form>', $his);
     //file_put_contents('abc.ixx', '' . $commstatus . ' ... ' . $his);
      if ($commstatus > 0 && 1 == 1) {
     //file_put_contents('abc.izz', '' . $commstatus . ' ... ' . $his);
      if ($huhfn != '') {
      $his=str_replace("<html><body", "<html><head><meta charset='UTF-8'/><title>" . basename($huhfn) . "</title></head><body", $his);
      //file_put_contents('abc.opi', $his);
      //} else {
     //file_put_contents('abc.iyy', '' . $commstatus . ' ... ' . $his);
         switch (strtolower(explode('.', $huhfn)[-1 + sizeof(explode('.', $huhfn))])) {
           case "html":
           case "htm":
         $his="<html><head><meta charset='UTF-8'/><title>" . str_replace('/tmp/','',$huhfn) . "</title>" . $hjit . "</head><body style='margin:5 5 5 5;padding:5 5 5 5;' title='Click outside iframe below for popup of sending webpage' onclick=\"window.open(document.URL.split('?')[0].split('#')[0], '_blank', 'top=100,left=100,width=600,height=600');\"><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=\"data:text/html;base64," . base64_encode(file_get_contents($huhfn)) . "\"></iframe><br><div id=divend style=width:100%;display:none;></div></body></html>";
        //header('Content-Type: text/html');
        //header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        //header('Pragma: public');
        //header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        //header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        //header('Content-Length: ' . strlen($pdf));
        //header('Content-Disposition: inline; filename="' . basename($PDFfilename) .'";');
        //ob_clean(); 
        //flush(); 
        echo file_get_contents($huhfn);  
         exit;
             break;
           case "txt":
         $his="<html><head><meta charset='UTF-8'/><title>" . str_replace('/tmp/','',$huhfn) . "</title>" . $hjit . "</head><body style='margin:5 5 5 5;padding:5 5 5 5;' title='Click to toggle line feed display and double click to show HTML view ... Click outside iframe below for popup of sending webpage' onclick=\"window.open(document.URL.split('?')[0].split('#')[0], '_blank', 'top=100,left=100,width=600,height=600');\"><div id='dres' title='Toggle look via click' onclick=zonc(event); oncontextmenu=zonr(event);></div><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=\"data:text/plain;base64," . base64_encode(file_get_contents($huhfn)) . "\"></iframe><br><div id=divend style=width:100%;display:none;></div></body></html>";
        //header('Content-Type: text/plain');
        //header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        //header('Pragma: public');
        //header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        //header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        //header('Content-Length: ' . strlen($pdf));
        //header('Content-Disposition: inline; filename="' . basename($huhfn) .'";');
        //ob_clean(); 
        //flush(); 
        if (1 == 1) {
        echo $his;
        } else {
        echo "<html><head><meta charset='UTF-8'/><title>" . str_replace('/tmp/','',$huhfn) . "</title>" . $hjit . "</head><body><div id='dres' title='Toggle look via click' onclick=zonc(event); data-oncontextmenu=zonr(event);>" . str_replace("\n","<br>",file_get_contents($huhfn)) . "</div><br><div id=divend style=width:100%;display:none;></div></body></html>";  
        }
         exit;
             break;
           case "pdf":
         $his="<html><head><meta charset='UTF-8'/><title>" . str_replace('/tmp/','',$huhfn) . "</title>" . $hjit . "</head><body><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=\"data:application/pdf;base64," . base64_encode(file_get_contents($huhfn)) . "\"></iframe><br><div id=divend style=width:100%;display:none;></div></body></html>";
        header('Content-Type: application/pdf');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($huhfn) .'";');
        ob_clean(); 
        flush(); 
        echo file_get_contents($huhfn);  
             break;
           case "odt":
         $his="<html><head><meta charset='UTF-8'/><title>" . str_replace('/tmp/','',$huhfn) . "</title>" . $hjit . "</head><body><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=\"application/vnd.oasis.opendocument.text;base64," . base64_encode(file_get_contents($huhfn)) . "\"></iframe><br><div id=divend style=width:100%;display:none;></div></body></html>";
        header('Content-Type: application/vnd.oasis.opendocument.text');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($huhfn) .'";');
        ob_clean(); 
        flush(); 
        echo file_get_contents($huhfn);  
             exit;
             break;
           case "doc":
           case "docx":
         $his="<html><head><meta charset='UTF-8'/><title>" . str_replace('/tmp/','',$huhfn) . "</title>" . $hjit . "</head><body><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64," . base64_encode(file_get_contents($huhfn)) . "\"></iframe><br><div id=divend style=width:100%;display:none;></div></body></html>";
        header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($huhfn) .'";');
        ob_clean(); 
        flush(); 
        echo file_get_contents($huhfn);  
             exit;
             break;
           case "rtf":
           case "rtfd":
         $his="<html><head><meta charset='UTF-8'/><title>" . str_replace('/tmp/','',$huhfn) . "</title>" . $hjit . "</head><body><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=\"data:application/rtf;base64," . base64_encode(file_get_contents($huhfn)) . "\"></iframe><br><div id=divend style=width:100%;display:none;></div></body></html>";
        header('Content-Type: application/rtf');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($huhfn) .'";');
        ob_clean(); 
        flush(); 
        echo file_get_contents($huhfn);  
             exit;
             break;
           default:
             break;
         } 
     //file_put_contents('abc.iyp', $his);
      }
      if ($huhfm != '') {
      $his=str_replace("<html><body", "<html><head><meta charset='UTF-8'/><title>" . $huhfm . "</title></head><body", $his);
      } else {
      $his=str_replace("<html><body", "<html><head><meta charset='UTF-8'/><title>Pandoc conversion ...</title></head><body", $his);
      }
      echo $his;
      exit;
      }
   }
} else if (isset($_POST['outpath'])) {
   $_POST['outpath']=urlencode('/tmp/');
} else if (isset($_GET['outputname'])) {
   $_GET['outpath']=urlencode('/tmp/');
} else if (isset($_POST['outputname'])) {
   $_POST['outpath']=urlencode('/tmp/');
}     
  }


$pltx="";
$avbit="out";  
$resbit="";  
$lportbit=":8888";
$imgn='imgm' . rand(0,1298765434) . '.gif';
$qindx=-1;
$divinfront="";
$rone="";
$rtwo="";
$resultof="";
$curt="";

if (isset($_GET['inpath'])) {
      $ona=str_replace('+',' ',urldecode($_GET['outputname']));
      if (strpos($ona, ',') !== false) {
      $resultof='<p>Result of Conversion from ' . str_replace('+',' ',urldecode($_GET['inpath'])) . str_replace('+',' ',urldecode((isset($_GET['dummyconvertthis']) ? $_GET['dummyconvertthis'] : (isset($_GET['convertthis']) ? $_GET['convertthis'] : '')))) . ' to ' . explode(',',$ona)[1] . ' ... </p><br><div id=dres onclick=onc(event); oncontextmenu=onr(event);></div>';
      } else {
      $resultof='<p>Result of Conversion from ' . str_replace('+',' ',urldecode($_GET['inpath'])) . str_replace('+',' ',urldecode((isset($_GET['dummyconvertthis']) ? $_GET['dummyconvertthis'] : (isset($_GET['convertthis']) ? $_GET['convertthis'] : '')))) . ' to ' . str_replace('+',' ',urldecode($_GET['outputname'])) . ' ... </p><br><div id=dres onclick=onc(event); oncontextmenu=onr(event);></div>';
      }
} else if (isset($_POST['inpath'])) {
      $ona=str_replace('+',' ',urldecode($_POST['outputname']));
      if (strpos($ona, ',') !== false) {
      $resultof='<p>Result of Conversion from ' . str_replace('+',' ',urldecode($_POST['inpath'])) . str_replace('+',' ',urldecode((isset($_POST['dummyconvertthis']) ? $_POST['dummyconvertthis'] : (isset($_POST['convertthis']) ? $_POST['convertthis'] : '')))) . ' to ' . explode(',',$ona)[1] . ' ... </p><br><div id=dres onclick=onc(event); oncontextmenu=onr(event);></div>';
      } else {
      $resultof='<p>Result of Conversion from ' . str_replace('+',' ',urldecode($_POST['inpath'])) . str_replace('+',' ',urldecode((isset($_POST['dummyconvertthis']) ? $_POST['dummyconvertthis'] : (isset($_POST['convertthis']) ? $_POST['convertthis'] : '')))) . ' to ' . str_replace('+',' ',urldecode($_POST['outputname'])) . ' ... </p><br><div id=dres onclick=onc(event); oncontextmenu=onr(event);></div>';
      }
}

if (isset($_GET['content']) || isset($_POST['content'])) {
  $curt=" document.body.style.cursor='progress'; ";
}

function switcheroo($swi) {
  global $switchfrom, $switchto;
  return str_replace(' html ', ' html -s ',str_replace($switchfrom,$switchto,$swi));
}

function theecho($ofwhat) {
  file_put_contents('abc.xyz', $ofwhat);
}

function big($invc) {
  global $indx, $qindx, $wobit;
  $qindx=-1;
  if ((0 + sizeof(explode(',',$invc))) > (1 + $indx)) {
    if (strlen(explode(',',$invc)[(1 + $indx)]) > strlen(explode(',',$invc)[(0 + $indx)])) {
      $qindx=(1 + $indx);
    }
  }
  return $invc;
}
  

$user_agent = $_SERVER["HTTP_USER_AGENT"];
function getOS() { // thanks to https://www.daniweb.com/programming/web-development/threads/495588/getting-users-os-info-out-of-server-http-user-agent
    global $user_agent, $lportbit;
    $os_platform    =   "win Unknown OS Platform";
    $os_array       =   array(
                            '/windows nt 10/i'     =>  'Windows 10',
                            '/windows nt 6.3/i'     =>  'Windows 8.1',
                            '/windows nt 6.2/i'     =>  'Windows 8',
                            '/windows nt 6.1/i'     =>  'Windows 7',
                            '/windows nt 6.0/i'     =>  'Windows Vista',
                            '/windows nt 5.2/i'     =>  'Windows Server 2003/XP x64',
                            '/windows nt 5.1/i'     =>  'Windows XP',
                            '/windows xp/i'         =>  'Windows XP',
                            '/windows nt 5.0/i'     =>  'Windows 2000',
                            '/windows me/i'         =>  'Windows ME',
                            '/win98/i'              =>  'Windows 98',
                            '/win95/i'              =>  'Windows 95',
                            '/win16/i'              =>  'Windows 3.11',
                            '/macintosh|mac os x/i' =>  'Mac OS X',
                            '/mac_powerpc/i'        =>  'Mac OS 9',
                            '/linux/i'              =>  'Linux',
                            '/ubuntu/i'             =>  'Ubuntu',
                            '/iphone/i'             =>  'iPhone',
                            '/ipod/i'               =>  'iPod',
                            '/ipad/i'               =>  'iPad',
                            '/android/i'            =>  'Android',
                            '/blackberry/i'         =>  'BlackBerry',
                            '/webos/i'              =>  'Mobile'
                        );

    foreach ($os_array as $regex => $value) { 

        if (preg_match($regex, $user_agent)) {
            $os_platform    =   $value;
        }

    }   

    return $os_platform;
}

if (substr(strtoupper(getOS()),0,3) === 'WIN') { $lportbit="";  }

if (isset($_GET['imgname'])) {
  if (1 == 5) {
  $im = imagecreatetruecolor(120, 10);
  $text_color = imagecolorallocate($im, 233, 14, 91);
  file_put_contents('aaaa.aaaa3', '');
  imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);
  // Output the image
  imagegif($im, urldecode($_GET['imgname']));
  // Free up memory
  imagedestroy($im);
  sleep(25);
  unlink(urldecode($_GET['imgname']));
  }
  echo "<html><body onload=\"    var asu=(('" . $_SERVER['QUERY_STRING'] . "').replace('&','?') + '?');  asu=('?' + asu.split('?')[1]).replace(/^\?$/g,'');  if (document.URL.indexOf('localhost') != -1) { window.open(document.URL.split('?')[0] + asu,'_blank'); }\"></body></html>";
  exit;
}


$innards="";
$innards=" if (!inIframe()) { if (document.URL.indexOf('httJUNKp:') == 0) { wowo=window.open('HTTP:/localhost" . $lportbit . "/macos_textutil_convert.php','mamptry'); document.getElementById('mamptry').style.display='block'; } else { windowopen('HTTP:/localhost" . $lportbit . "/macos_textutil_convert.php','blank');  } } ";

$thecontent="";
$tastuff="";
$doutput="";
$outfileis="";
$sufext="_0";
$iext=0;
$cself="";

$verb="textutil";
$switchone="-convert";
$switchtwo="-output";

$indx=0;
$iof=0;

$cvse="Convert";
$title="<title>Document Conversions via pandoc or textutil</title>";
$onl=" if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { if (!window.parent) { document.getElementById('thewords').focus(); } else { if (window.parent == window.self) {  document.getElementById('thewords').focus();   }  } } ";

$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$ipad = strpos($_SERVER['HTTP_USER_AGENT'],"iPad");
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
$blackberry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");

$outfis='';

$precmds="";

function yourfile_get_contents($inff) {
   $jinff=@file_get_contents($inff);
   if (isset($_POST['content']) || isset($_GET['content'])) {
      if (strpos($jinff, 'No such file or directory') !== false) {
        return '';
      }
   }
   return $jinff;
}

function inf($indi) {
  if (isset($_POST['infname'])) {
    if (strlen($_POST['infname']) > 0) {
    $pif=str_replace('+',' ',urldecode($_POST['infname']));
    $arrpif=explode('.', $pif);
    if (sizeof($arrpif) > 1) {
      return $arrpif[(-1 + sizeof($arrpif))];
    }
    }
  }
  if ($indi == 'ent') { return 'docx'; }
  if ($indi == 'ocx') { return 'docx'; }
  if ($indi == 'tml') { return 'html'; }
  if ($indi == 'tfd') { return 'rtf'; }
  if ($indi == 'ext') { return 'odt'; }
  //if ($indi == 'doc') { return 'docx'; }
  return $indi;
}

function getxenv($one,$two) {
  global $precmds;
  foreach (glob("C:\\Users\\*\\AppData\\Local\\Pandoc\\pandoc.exe") as $infl) {
  $precmds=explode("\\AppData", $infl)[0] . "\\AppData\\Local\\Programs\\MiKTeX\\miktex\\bin\\x64\\";
  return str_replace("\\","\\\\",explode("\\AppData", $infl)[0]);
  }
  return "C:\\Users\\user";
}

if ( !file_exists( "/usr/local/bin" ) && !is_dir( "/usr/local/bin" ) &&  !file_exists( "/usr/bin" ) && !is_dir( "/usr/bin" ) ) {
if (getxenv("USERPROFILE",true)) {
    if (file_exists(getxenv("USERPROFILE",true) . "\\AppData\\Local\\Pandoc\\pandoc.exe")) {
      $verb=getxenv("USERPROFILE",true) . "\\AppData\\Local\\Pandoc\\pandoc.exe";
      $switchone="-t";
      $switchtwo="-o";
      $panplus="pandoc or ";
    }
}
} else {
//exec("which pandoc > lookup_pandoc.txt 2>>&1");
//shell_exec("/usr/local/bin/pandoc --version > lookup_pandoc.txt 2>&1");
    if (file_exists("/usr/bin/pandoc")) {
      $verb="/usr/bin/pandoc";
      $switchone="-t";
      $switchtwo="-o";
      $panplus="pandoc or ";
if (PHP_OS != "Darwin") {     
if (isset($_GET['outpath'])) {
   $_GET['outpath']='';
} else if (isset($_POST['outpath'])) {
   $_POST['outpath']='';
}
}
    } else if (file_exists("/usr/local/bin/pandoc")) {
      $verb="/usr/local/bin/pandoc";
      $switchone="-t";
      $switchtwo="-o";
      $panplus="pandoc or ";
if (PHP_OS != "Darwin") {     
if (isset($_GET['outpath'])) {
   $_GET['outpath']='';
} else if (isset($_POST['outpath'])) {
   $_POST['outpath']='';
}
}
    }
}


 if (isset($argv)) { // command line
  $numargs = sizeof($argv);
  if ($numargs <= 4) {
   if (PHP_OS == 'WINNT') {
    echo '$ Input path ( eg. we will take blank to mean ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ) then *.pdf,*.doc,*.docx,*.htm,*.html,*.txt Input File(spec) then Output path ( eg. we will take blank to mean ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ) then .pdf,.doc,.docx,.htm,.html,.txt Output File Extension below ...' . "\n";
    $line = stream_get_line(STDIN, 1024, PHP_EOL);
    if (str_replace("\n", "", $line) == "") { $line=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
    $lineinspec = stream_get_line(STDIN, 1024, PHP_EOL);
    $outline = stream_get_line(STDIN, 1024, PHP_EOL);
    if (str_replace("\n", "", $outline) == "") { $outline=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
    $outlineinspec = stream_get_line(STDIN, 1024, PHP_EOL);
    if (strpos(($outlineinspec . "~"), "htm~") !== false) {  $outlineinspec.="l";   }
   } else {
    $line = readline('$ Input path ( eg. we will take blank to mean ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ) then *.pdf,*.doc,*.docx,*.htm,*.html,*.txt Input File(spec) then Output path ( eg. we will take blank to mean ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ) then .pdf,.doc,.docx,.htm,.html,.txt Output File Extension below ...' . "\n");
    if (str_replace("\n", "", $line) == "") { $line=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
    $lineinspec = readline('');
    $outline = readline('');
    if (str_replace("\n", "", $outline) == "") { $outline=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
    $outlineinspec = readline('');
    if (strpos(($outlineinspec . "~"), "htm~") !== false) {  $outlineinspec.="l";   }
   }
  $cmdsuff="";
  if ($verb != "textutil" && explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] == "pdf") {
  if (file_exists("/Library/TeX/Root/bin/x86_64-darwin/pdflatex")) {
  $cmdsuff=" --pdf-engine=/Library/TeX/Root/bin/x86_64-darwin/pdflatex";
  } else if (file_exists("/Library/TeX/texbin/pdflatex")) {
  $cmdsuff=" --pdf-engine=/Library/TeX/texbin/pdflatex";
  } else {
  $cmdsuff=" --pdf-engine=" . $precmds . "pdflatex";
  }
  }
   $openers="";
   $openersdelim="";
  echo $line . $lineinspec;
  exit;
   foreach (glob($line . $lineinspec) as $filename) {    
    $outnameis=$outline . str_replace("." . explode(".", basename($filename))[-1 + sizeof(explode(".", basename($filename)))], ".", basename($filename)) . str_replace(".", "", $outlineinspec);
  if (file_exists($outnameis)) {
  $sufext="_0";
  $iext=0;
  $rone="";
  $rtwo="";
    while (file_exists($outnameis . $sufext)) {
      $iext++;
      $sufext="_" . $iext;
    }
    $rtwo=$outnameis;
    $rone=$outnameis . $sufext;
    echo "Renaming " . $outnameis . " to " . $outnameis . $sufext . "\n";
    try {
    rename($outnameis, $outnameis . $sufext);
    } catch (Exception $e) {
    echo $e->getMessage() . "\n";
    }
    if (!file_exists($outnameis . $sufext)) {
    echo "Renaming did not happen." . "\n";
    }
  }
    if (explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] == "pdJUNKf") {
    echo ("php " . $argv[0] . " " . $line . " " . basename($filename) . " " . $outline . " " . $outlineinspec . "\n");
    passthru("php " . $argv[0] . " " . $line . " " . basename($filename) . " " . $outline . " " . $outlineinspec);
    } else {

 //echo $verb . " " . $switchone . " " . str_replace(".", "", $outlineinspec) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff;
 //exit;

    //echo ($verb . " " . $switchone . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convertHUH.out 2> macos_textutil_convert.err");
    file_put_contents("macos_textutil_convertYES.out",$verb . "   " . $switchone . " " . str_replace(".", "", $outlineinspec) . " " . $filename . " " . $switchtwo . " \"" . $outnameis . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err \n");
    if (isset($_POST['content'])) {
    //echo "yes";
    //exit;
    $befbsf=str_replace(' ','+', urldecode($_POST['content']));
    file_put_contents('/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))), base64_decode(explode(';base64,',$befbsf)[1]));
theecho("1:" . "$verb" . " " . $switchone . " " . "/tmp/xx." . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err ; rm -f " . "/tmp/xx." . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))));
//exit;
    exec("$verb" . " " . $switchone . switcheroo(" " . "/tmp/xx." . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))) . " ") . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err ; rm -f " . "/tmp/xx." . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))));

  $mimt=inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0]))));
  //file_put_contents("abc.xzy",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
  if ($mimt == 'html' && file_exists($outnameis)) {
  //file_put_contents("abc.xz2",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body>" . $ocontis . "</body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     } else {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title>" . $hjit . "</head><body><div id=dhj><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe></div><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     }
  //file_put_contents("abc.xz3",$ocontis );
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );

     //echo "<html><body onload=\" " . $wobit . " \"></body></html>";   // might be temporary arrangement
     //exit;
  } else if ($mimt == "pdf") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/pdf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if (substr($mimt,0,3) == "rtf") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/rtf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if ($mimt == "odt") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.oasis.opendocument.text;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  } else if (substr($mimt,0,3) == "doc") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  } else if (str_replace('plain','txt',str_replace('text','txt',$mimt)) == "txt") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     $pltx=$ocontis;
     if (strpos($ocontis, '<body') !== false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe onload=window.opener.top.justit(this); style=\"width:100%;height:100%;\" src=\"data:text/html;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
       $wobit=" top.document.getElementById('dres').style.width='98%'; if (2 == 5) { top.document.getElementById('dres').style.height='30%'; } top.document.getElementById('dres').innerHTML='<iframe id=ifmy onload=top.justit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe>';      ";
     } else if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><div>" . str_replace("\n","<br>",$ocontis) . "\"></div><br></body></html>";
       $wobit=" top.document.getElementById('dres').style.width='98%'; top.document.getElementById('dres').style.height='30%'; top.document.getElementById('dres').innerHTML='<textarea id=myta style=width:98%;height:98%;>' + window.atob('" . base64_encode($pltx) . "') + '</textarea>'; top.document.getElementById('myta').value=window.atob('" . base64_encode($pltx) . "');      ";
     }
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  }

    } else {
theecho("2:" . "$verb" . " " . $switchone . " \"" . str_replace(".", "", $outlineinspec) . " " . $filename . "\" " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");
//exit;
    exec("$verb" . " " . $switchone . switcheroo(" \"") . str_replace(".", "", $outlineinspec) . " " . $filename . "\" " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");

  $mimt=str_replace(".", "", $outlineinspec);
  //file_put_contents("abc.xzy",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
  if ($mimt == 'html' && file_exists($outnameis)) {
  //file_put_contents("abc.xz2",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body>" . $ocontis . "</body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     } else {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title>" . $hjit . "</head><body><div id=dhj><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe></div><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     }
  //file_put_contents("abc.xz3",$ocontis );
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );

     //echo "<html><body onload=\" " . $wobit . " \"></body></html>";   // might be temporary arrangement
     //exit;
  } else if ($mimt == "pdf") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\"  src=\"data:application/pdf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if (substr($mimt,0,3) == "rtf") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/rtf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if ($mimt == "odt") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.oasis.opendocument.text;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  } else if (substr($mimt,0,3) == "doc") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  } else if (str_replace('plain','txt',str_replace('text','txt',$mimt)) == "txt") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     $pltx=$ocontis;
     if (strpos($ocontis, '<body') !== false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe onload=window.opener.top.justit(this); style=\"width:100%;height:100%;\" src=\"data:text/html;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
       $wobit=" top.document.getElementById('dres').style.width='98%'; if (2 == 5) { top.document.getElementById('dres').style.height='30%'; } top.document.getElementById('dres').innerHTML='<iframe id=ifmy onload=top.justit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe>';      ";
     } else if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><div>" . str_replace("\n","<br>",$ocontis) . "\"></div><br></body></html>";
       $wobit=" top.document.getElementById('dres').style.width='98%'; top.document.getElementById('dres').style.height='30%'; top.document.getElementById('dres').innerHTML='<textarea id=myta style=width:98%;height:98%;>' + window.atob('" . base64_encode($pltx) . "') + '</textarea>'; top.document.getElementById('myta').value=window.atob('" . base64_encode($pltx) . "');      ";
     }
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  }


    }
  if (file_exists("macos_textutil_convert.out") && file_exists("macos_textutil_convert.err")) {
  if (filesize("macos_textutil_convert.out") == 0 && filesize("macos_textutil_convert.err") != 0) {
     if ($rone != "" && $rtwo != "") {
    echo "Renaming " . $rone . " back to " . $rtwo . "\n";
      rename($rone, $rtwo);
     }
     echo "\n\n" . yourfile_get_contents("macos_textutil_convert.err") . "\n\n";
  }
  }
    if (PHP_OS == "Darwin") { // && explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] != "pdf") {
       if (file_exists($outnameis)) {
       $openers.=$openersdelim . "open " . $outnameis;
       $openersdelim=" ; ";
       }
    }
    }
   }
   if (PHP_OS == "Darwin" && $openers != "") {
    echo "\n\nWill try to open successful (or old resurrected) files in 8 seconds ...\n"; 
    sleep(8);
    echo ($openers . " \n");
    exec($openers);
   }
   //echo "do the work";
  } else {
   $openers="";
   $openersdelim="";
   $line=trim($argv[1]);
   if (str_replace("\n", "", $line) == "") { $line=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
   $lineinspec=$argv[2];
   $outline=trim($argv[3]);
   if (str_replace("\n", "", $outline) == "") { $outline=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
   $outlineinspec=$argv[4];
  $cmdsuff="";
  if ($verb != "textutil" && explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] == "pdf") {
  if (file_exists("/Library/TeX/Root/bin/x86_64-darwin/pdflatex")) {
  $cmdsuff=" --pdf-engine=/Library/TeX/Root/bin/x86_64-darwin/pdflatex";
  } else if (file_exists("/Library/TeX/texbin/pdflatex")) {
  $cmdsuff=" --pdf-engine=/Library/TeX/texbin/pdflatex";
  } else {
  $cmdsuff=" --pdf-engine=" . $precmds . "pdflatex";
  }
  }
  echo $line . $lineinspec;
  exit;
  foreach (glob($line . $lineinspec) as $filename) {   
     $outnameis=$outline . str_replace("." . explode(".", basename($filename))[-1 + sizeof(explode(".", basename($filename)))], ".", basename($filename)) . str_replace(".", "", $outlineinspec);
  if (file_exists($outnameis)) {
  $sufext="_0";
  $iext=0;
  $rone="";
  $rtwo="";
    while (file_exists($outnameis . $sufext)) {
      $iext++;
      $sufext="_" . $iext;
    }
    $rtwo=$outnameis;
    $rone=$outnameis . $sufext;
    echo "Renaming " . $outnameis . " to " . $outnameis . $sufext . "\n";
    rename($outnameis, $outnameis . $sufext);
  }



 //echo $verb . " " . $switchone . " " . str_replace(".", "", $outlineinspec) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff;
 //exit;

    //echo ($verb . " " . $switchone . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convertHUH.out 2> macos_textutil_convert.err");
    file_put_contents("macos_textutil_convertYES.out",$verb . "     " . $switchone . " " . str_replace(".", "", $outlineinspec) . " " . $filename . " " . $switchtwo . " \"" . $outnameis . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err \n");
    if (isset($_POST['content'])) {
    //echo "Yes";
    //exit;
    $befbsf=str_replace(' ','+', urldecode($_POST['content']));
    file_put_contents('/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))), base64_decode(explode(';base64,',$befbsf)[1]));
theecho("3:" . "$verb" . " " . $switchone . " " . "/tmp/xx." . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err ; rm -f " . "/tmp/xx." . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))));
//exit;
    exec("$verb" . " " . $switchone . switcheroo(" " . "/tmp/xx." . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))) . " ") . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err ; rm -f " . "/tmp/xx." . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))));


  $mimt=inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0]))));
  //file_put_contents("abc.xzy",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
  if ($mimt == 'html' && file_exists($outnameis)) {
  //file_put_contents("abc.xz2",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body>" . $ocontis . "</body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     } else {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title>" . $hjit . "</head><body><div id=dhj><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe></div><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     }
  //file_put_contents("abc.xz3",$ocontis );
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );

     //echo "<html><body onload=\" " . $wobit . " \"></body></html>";   // might be temporary arrangement
     //exit;
  } else if ($mimt == "pdf") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\"  src=\"data:application/pdf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if (substr($mimt,0,3) == "rtf") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/rtf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if ($mimt == "odt") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.oasis.opendocument.text;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  } else if (substr($mimt,0,3) == "doc") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  } else if (str_replace('plain','txt',str_replace('text','txt',$mimt)) == "txt") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     $pltx=$ocontis;
     if (strpos($ocontis, '<body') !== false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe onload=window.opener.top.justit(this); style=\"width:100%;height:100%;\" src=\"data:text/html;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
       $wobit=" top.document.getElementById('dres').style.width='98%'; if (2 == 5) { top.document.getElementById('dres').style.height='30%'; } top.document.getElementById('dres').innerHTML='<iframe id=ifmy onload=top.justit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe>';      ";
     } else if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><div>" . str_replace("\n","<br>",$ocontis) . "\"></div><br></body></html>";
       $wobit=" top.document.getElementById('dres').style.width='98%'; top.document.getElementById('dres').style.height='30%'; top.document.getElementById('dres').innerHTML='<textarea id=myta style=width:98%;height:98%;>' + window.atob('" . base64_encode($pltx) . "') + '</textarea>'; top.document.getElementById('myta').value=window.atob('" . base64_encode($pltx) . "');      ";
     }
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  }




    } else {
theecho("4:" . "$verb" . " " . $switchone . " \"" . str_replace(".", "", $outlineinspec) . " " . $filename . "\" " . $switchtwo . " \"" . $outnameis . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");
//exit;
    exec("$verb" . " " . $switchone . switcheroo(" \"" . str_replace(".", "", $outlineinspec) . " ") . $filename . "\" " . $switchtwo . " \"" . $outnameis . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");


  $mimt=str_replace(".", "", $outlineinspec);
  //file_put_contents("abc.xzy",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
  if ($mimt == 'html' && file_exists($outnameis)) {
  //file_put_contents("abc.xz2",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body>" . $ocontis . "</body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     } else {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title>" . $hjit . "</head><body><div id=dhj><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe></div><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     }
  //file_put_contents("abc.xz3",$ocontis );
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );

     //echo "<html><body onload=\" " . $wobit . " \"></body></html>";   // might be temporary arrangement
     //exit;
  } else if ($mimt == "pdf") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\"  src=\"data:application/pdf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if (substr($mimt,0,3) == "rtf") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/rtf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if ($mimt == "odt") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.oasis.opendocument.text;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  } else if (substr($mimt,0,3) == "doc") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  } else if (str_replace('plain','txt',str_replace('text','txt',$mimt)) == "txt") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     $pltx=$ocontis;
     if (strpos($ocontis, '<body') !== false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe onload=window.opener.top.justit(this); style=\"width:100%;height:100%;\" src=\"data:text/html;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
       $wobit=" top.document.getElementById('dres').style.width='98%'; if (2 == 5) { top.document.getElementById('dres').style.height='30%'; } top.document.getElementById('dres').innerHTML='<iframe id=ifmy onload=top.justit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe>';      ";
     } else if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><div>" . str_replace("\n","<br>",$ocontis) . "\"></div><br></body></html>";
       $wobit=" top.document.getElementById('dres').style.width='98%'; top.document.getElementById('dres').style.height='30%'; top.document.getElementById('dres').innerHTML='<textarea id=myta style=width:98%;height:98%;>' + window.atob('" . base64_encode($pltx) . "') + '</textarea>'; top.document.getElementById('myta').value=window.atob('" . base64_encode($pltx) . "');      ";
     }
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  }




    }
  if (file_exists("macos_textutil_convert.out") && file_exists("macos_textutil_convert.err")) {
  if (filesize("macos_textutil_convert.out") == 0 && filesize("macos_textutil_convert.err") != 0) {
     if ($rone != "" && $rtwo != "") {
    echo "Renaming " . $rone . " back to " . $rtwo . "\n";
      rename($rone, $rtwo);
     }
     echo "\n\n" . yourfile_get_contents("macos_textutil_convert.err") . "\n\n";
  }
  }
    if (PHP_OS == "Darwin") { // && explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] != "pdf") {
       if (file_exists($outnameis)) {
       $openers.=$openersdelim . "open " . $outnameis;
       $openersdelim=" ; ";
       }
    }
   }
   if (PHP_OS == "Darwin" && $openers != "") {
    echo "\n\nWill try to open successful (or old resurrected) files in 8 seconds ...\n"; 
    sleep(8);
    echo ($openers . " \n");
    exec($openers);
   }
   //echo "Do the work ";
  }
  exit;
 }
 
 if (strpos($_SERVER['SERVER_NAME'], "rjmprogramming.com.au") !== false && 45 == 43) { 
   $cvse="Email";
   $title="<title>Email off your Document Conversion Attachment Input Files for Your Inhouse Document Converter to Listen For and Convert</title>";
   if ($iphone || $ipad || $android || $ipod || $blackberry) { // thanks to http://www.phpmysqlscript.com/2012/03/detecting-users-screen-size-and.html
   $cself="&nbsp;"; //&#129331;&nbsp;";
   $cvse="Email &#128231;";
   $divinfront="<button onmouseover='tsuper();' style='width:100%;height:100px;background-color:#ffffe0;' onclick='return ddforb(event);' id=dbwithlf>Email &#128231; Document" . $plurals . "<div id=dbafterfirstline<br><br><div style='border:1px dashed #9b870c;' id=bdiv onmouseover='domo(event);' onmouseout='domout(event);' onmousedown='ionclick(event);' onclick='return ionclick(event);' onfocus='onf(event);' contenteditable=true onblur='donblur(this);' title='Click in to change email address as required'></div></div></button>";
   } else {
   $cvse="Email";
   $divinfront="<button onmouseover='tsuper();' style='width:100%;height:100px;background-color:#ffffe0;' onclick='return ddforb(event);' id=dbwithlf>Email Document" . $plurals . "<div id=dbafterfirstline<br><br><div style='border:1px dashed #9b870c;' id=bdiv onmouseover='domo(event);' onmouseout='domout(event);' onmousedown='ionclick(event);' onclick='return ionclick(event);' onfocus='onf(event);' contenteditable=true onblur='donblur(this);' title='Click in to change email address as required'></div></div></button>";
   }
   $title="<title>Email off your Document Conversion Attachment Input Files for Your Inhouse Document Converter to Listen For and Convert</title>";
   $onl="";
 }
 
 if (isset($_POST['to']) && isset($_POST['subject']) && isset($_POST['body'])) {
   $tow=str_replace("+"," ",urldecode($_POST['to']));
   if (strpos($tow, "@") !== false) {
   $subjw=str_replace('*','html',str_replace("+"," ",urldecode($_POST['subject'])));
   $orign=basename(explode(" ", $subjw)[0]);
   $thenn=basename(explode(" ", $subjw)[-1 + sizeof(explode(" ", $subjw))]);
   $bodyn=str_replace(" ","+",urldecode($_POST['body']));
   if (strpos($bodyn, "data:") !== false) {
     file_put_contents($thenn, base64_decode(explode(";base64,", $bodyn)[1]));
   } else {
     file_put_contents($thenn, $bodyn);
   }
   if (1 == 1) { // thanks to https://community.hpe.com/t5/general/use-of-sendmail-and-uuencode/td-p/2431436#.XxqPtvgzZZo
   //$cmd="/usr/sbin/sendmail " . $tow . " << END\nSubject: " . $subjw . "\n`uuencode " . $thenn . " " . $thenn . "`\nEND";
   $cmd="/usr/sbin/sendmail " . $tow . " << END\nSubject: " . $subjw . "\n`uuencode " . $thenn . " " . $thenn . "`\nEND";
   //file_put_contents("00x.00x", $cmd);
   exec($cmd);
   exec("rm -f " . $thenn);
   } else {
   //file_put_contents("0x.0x", "uuencode " . $thenn . " " . $thenn . " > " . explode(".", $thenn)[0] . "; cat " . explode(".", $thenn)[0] . " | /usr/sbin/sendmail " . $tow . "; rm -f " . explode(".", $thenn)[0] . "; rm -f " . $thenn);
   //exec("uuencode " . $thenn . " " . $thenn . " > " . explode(".", $thenn)[0] . "; cat " . explode(".", $thenn)[0] . " | /usr/sbin/sendmail " . $tow . " > smail.out 2> smail.err; rm -f " . explode(".", $thenn)[0] . "; rm -f " . $thenn);
   exec("uuencode " . $thenn . " " . $thenn . " > " . explode(".", $thenn)[0] . "; cat " . explode(".", $thenn)[0] . " | /usr/sbin/sendmail " . $tow . " > smail.out 2> smail.err; rm -f " . explode(".", $thenn)[0] . "; rm -f " . $thenn);
   }
   }
   exit;
 }
 
 if (isset($_GET['globit'])) {
   $accf="";
   $accfd="";
   $accfout="";
   $accfoutext=".html";
   if ($lportbit == "" && strpos($_SERVER['SERVER_NAME'],'rjmprogramming.com.au') === false) {
   $pprefix=dirname(__FILE__) . "\\";
   } else {
   $pprefix=dirname(__FILE__) . DIRECTORY_SEPARATOR;
   }
  if (isset($_GET['globpath'])) {
     if (str_replace("+", " ", urldecode($_GET['globpath'])) != "") {
     $pprefix=str_replace("+", " ", urldecode($_GET['globpath']));
     }
   }
   if (isset($_GET['globext'])) {
     $accfoutext="." . str_replace(".", "", str_replace("+", " ", urldecode($_GET['globext'])));
   }
 file_put_contents('a.a',$_GET['globit'] . "\n" . $_GET['globpath'] . "\n" . $_GET['globext'] . "\n" . $pprefix); 

   foreach (glob($pprefix . str_replace("+", " ", urldecode($_GET['globit']))) as $filename) { 
       if ($accf == '') { 
       $accf.=$accfd . basename($filename);
       $accfout.=$accfd . explode(".", basename($filename))[0] . $accfoutext;
       $accfd=",";
       }
   }
   echo "<html><head><meta charset='UTF-8'/>" . (strpos($title,'<') !== false ? $title : '') . "</head><body onload=\" " . $wobit . "  parent.document.getElementById('thewords').value='" . $accf . "';  parent.document.getElementById('outputname').value='" . $accfout . "'; \"></body></html>";
   exit;
 }

function ourstr_replace($fris, $tois, $stris) {
  global $indx;
  if (strpos($stris, ",") !== false || ($indx == 0 && (isset($_GET['inpath']) || isset($_POST['inpath'])))) {
    $interim=str_replace($fris, $tois, explode(",",$stris)[$indx]);
    if (isset($_GET['inpath'])) {
      return str_replace("+"," ",urldecode($_GET['inpath'])) . $interim;
    } else if (isset($_POST['inpath'])) {
      return str_replace("+"," ",urldecode($_POST['inpath'])) . $interim;
    } 
    return $interim;
  } 
  return str_replace($fris, $tois, $stris);
}

function outf($fid) {
  global $outfis;
  if (isset($_POST['content'])) {
     if (isset($_POST['infname'])) {
       if ($_POST['content'] != $_POST['infname']) {
        if (basename($fid) == $fid && substr($fid,0,1) != '.') {
         $outfis='/tmp/' . basename($fid);
         file_put_contents('zv.zv', $outfis);
         return '/tmp/' . basename($fid);
        }
       }
     } else {
     //if (file_exists($fid)) {
        if (basename($fid) == $fid && substr($fid,0,1) != '.') {
         $outfis='/tmp/' . basename($fid);
         file_put_contents('zzv.zzv', $outfis);
         return '/tmp/' . basename($fid);
        }
     //}
     }
  }
  return $fid;
}

function yourstr_replace($fris, $tois, $stris) {
  global $indx, $qindx;
  $iindx=$indx;
  if ($qindx >= 0) {  $iindx=$qindx; }
  $qindx=-1;
  if (strpos($stris, ",") !== false || ($indx == 0 && (isset($_GET['outpath']) || isset($_POST['outpath'])))) {
    $interim=str_replace($fris, $tois, explode(",",$stris)[$iindx]);
    if (isset($_GET['outpath'])) {
      if (!file_exists(outf(str_replace("+"," ",urldecode($_GET['outpath'])) . $interim)) && strpos(outf(str_replace("+"," ",urldecode($_GET['outpath'])) . $interim), '/') === false) {
        if (isset($_GET['bemaye']) || isset($_GET['bemays'])) {
        if (strpos(('~' . $interim), '~.') !== false) {
        $interim=str_replace($fris, $tois, explode(",",$stris)[-1 + sizeof(explode(",",$stris))]);
        }
        if (file_exists('/tmp/' . $interim)) {
          return '/tmp/' . $interim;
        }
        }
      }
      return outf(str_replace("+"," ",urldecode($_GET['outpath'])) . $interim);
    } else if (isset($_POST['outpath'])) {
      if (!file_exists(outf(str_replace("+"," ",urldecode($_POST['outpath'])) . $interim)) && strpos(outf(str_replace("+"," ",urldecode($_POST['outpath'])) . $interim), '/') === false) {
        if (isset($_POST['bemaye']) || isset($_POST['bemays'])) {
        if (strpos(('~' . $interim), '~.') !== false) {
        $interim=str_replace($fris, $tois, explode(",",$stris)[-1 + sizeof(explode(",",$stris))]);
        }
        if (file_exists('/tmp/' . $interim)) {
          return '/tmp/' . $interim;
        }
        }
      }
      return outf(str_replace("+"," ",urldecode($_POST['outpath'])) . $interim);
    }
    if (!file_exists($interim) && strpos($interim, '/') === false) {
        if (isset($_GET['bemaye']) || isset($_GET['bemays'])) {
        if (strpos(('~' . $interim), '~.') !== false) {
        $interim=str_replace($fris, $tois, explode(",",$stris)[-1 + sizeof(explode(",",$stris))]);
        }
        }
       if (file_exists('/tmp/' . $interim)) {
         $interim='/tmp/' . $interim;
       }
    }
    return $interim;
  }
  if (!file_exists(str_replace($fris, $tois, $stris)) && strpos(('~' . str_replace($fris, $tois, $stris)), '~.') === false) {
       if (file_exists('/tmp/' . str_replace($fris, $tois, $stris))) {
         return '/tmp/' . str_replace($fris, $tois, $stris);
       }
  }
  return str_replace($fris, $tois, $stris);
}

if (isset($_GET['vsfs']) && isset($_GET['vsfn']) && isset($_GET['vsfi']) && isset($_GET['vsfu'])) {
  $docroot=dirname(__FILE__);
  if (file_exists("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))))) {
    unlink("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))));
  }
  exec("find " . $_SERVER['DOCUMENT_ROOT'] . " -name '" . str_replace(")","*",str_replace("(","*",str_replace("+"," ",urldecode($_GET['vsfn'])))) . "' -exec ls -l {} \\; 2> /dev/null > lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))));
  if (file_exists("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))))) {
    $infois=file_get_contents(("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn']))))));
    $lines=explode("\n", $infois);
    for ($il=0; $il<sizeof($lines); $il++) {
      $lines[$il]=str_replace("\r","",$lines[$il]);
      if (strpos($lines[$il], " " . $_GET['vsfs'] . " ") !== false) {
        //file_put_contents("look_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))), "thisplace=" . $docroot . "\n" . "rootplace=" . $_SERVER['DOCUMENT_ROOT'] . "\n" . "origplace=" . str_replace("+"," ",urldecode($_GET['vsfu'])) . "\n" . "foundplace=" . explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))] . "\n" . '<html><body onload=" parent.document.getElementById(' . "'" . str_replace("+"," ",urldecode($_GET['vsfi'])) . "'" . ").value='" . str_replace($_SERVER['DOCUMENT_ROOT'],explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[0] . "localhost" . explode("/",explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[1])[0] . "",explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))]) . "'; " . '"></body></html>');
        if (strpos(explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))], $_SERVER['DOCUMENT_ROOT']) !== false) {
          //file_put_contents("x7.x7",'<html><body onload=" if (parent.document.getElementById(' . "'" . 'eangle' . "'" . ')) { parent.document.getElementById(' . "'" . 'eangle' . "'" . ').value=' . "'" . $ort . "'" . ';  } top.document.getElementById(' . "'" . str_replace("+"," ",urldecode($_GET['vsfi'])) . "'" . ").value='" . $ort . "'; " . '"></body></html>');
          if (isset($_GET['turl'])) {      
          echo "<html><body onload=\" " . $wobit . " var tp='" . str_replace("junk" . $_SERVER['DOCUMENT_ROOT'],"juJUNKnk" . explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[0] . "localhost" . explode("/",explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[1])[0] . "",explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))]) . "'; " . "  var tt='" . str_replace("+"," ",urldecode($_GET['vsfn'])) . "'; "  . ' var ct=top.document.getElementById(' . "'" . 'cto' . "'" . ').value; ct=ct.replace(' . "'" . '*' . "'" . ',' . "'" . 'html' . "'" . '); top.document.getElementById(' . "'" . 'sin' . "'" . ').style.display=' . "'" . 'inline-block' . "'" . '; top.document.getElementById(' . "'" . 'path' . "'" . ").value=tp.replace(tt, ''); " . ' top.document.getElementById(' . "'" . 'opath' . "'" . ").value=tp.replace(tt, ''); " . '  top.selch(ct);   "></body></html>'; 
          } //else { 
          //echo '<html><body onload=" if (parent.document.getElementById(' . "'" . 'eangle' . "'" . ')) { parent.document.getElementById(' . "'" . 'eangle' . "'" . ').value=' . "'" . $ort . "'" . ';  } top.document.getElementById(' . "'" . str_replace("+"," ",urldecode($_GET['vsfi'])) . "'" . ").value='" . $ort . "'; " . '"></body></html>'; 
          //}
        } //else if (isset($_GET['turl'])) {      
          //echo '<html><body onload=" top.document.getElementById(' . "'" . 'turl' . "'" . ").placeholder='" . str_replace($_SERVER['DOCUMENT_ROOT'],explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[0] . "localhost" . explode("/",explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[1])[0] . "",explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))]) . "'; " . '  top.document.getElementById(' . "'" . 'turl' . "'" . ').title=top.document.getElementById(' . "'" . 'turl' . "'" . ').placeholder;   top.document.getElementById(' . "'" . 'thewords' . "'" . ').title=top.document.getElementById(' . "'" . 'thewords' . "'" . ').title.replace( top.document.getElementById(' . "'" . 'turl' . "'" . ').value, top.document.getElementById(' . "'" . 'turl' . "'" . ').placeholder);   top.document.getElementById(' . "'" . 'thewords' . "'" . ').value=top.document.getElementById(' . "'" . 'thewords' . "'" . ').value.replace( top.document.getElementById(' . "'" . 'turl' . "'" . ').value, top.document.getElementById(' . "'" . 'turl' . "'" . ').placeholder);   top.document.getElementById(' . "'" . 'turl' . "'" . ').value=top.document.getElementById(' . "'" . 'turl' . "'" . ').placeholder;   top.document.getElementById(' . "'" . 'thewords' . "'" . ').value=top.document.getElementById(' . "'" . 'thewords' . "'" . ').value.replace( top.document.getElementById(' . "'" . 'turl' . "'" . ').value, top.document.getElementById(' . "'" . 'turl' . "'" . ').placeholder);  "></body></html>'; 
        //} else { 
        //  echo '<html><body onload=" parent.document.getElementById(' . "'" . str_replace("+"," ",urldecode($_GET['vsfi'])) . "'" . ").value='" . str_replace($_SERVER['DOCUMENT_ROOT'],explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[0] . "localhost" . explode("/",explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[1])[0] . "",explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))]) . "'; " . '"></body></html>'; 
        //}
        unlink("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn']))))); 
      } else {
        unlink("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn']))))); 
      }
    }
  } 
  exit;
}



if ((PHP_OS == "Darwin" || $verb != "textutil"  || (strpos($verb, DIRECTORY_SEPARATOR) !== false && strpos($iverb, DIRECTORY_SEPARATOR) !== false)) || isset($_GET['emailanyway']) || $iphone || $ipad || $android || $ipod || $blackberry) {
if (strpos($verb, DIRECTORY_SEPARATOR) !== false && strpos($verb, DIRECTORY_SEPARATOR) !== false) {
  $avbit='';
  //$resbit="<input type=hidden id=saysub value=''></input><input type=hidden id=resultout value=''></input><input type=hidden id=resJUNKult value=''></input><input type=hidden id=audioname value=''></input><textarea id=toptext style=visibility:hidden;></textarea>";
  $resbit="<input type=hidden id=saysub value=''></input><input type=hidden id=resultout value=''></input><input type=hidden id=resultrestout value=''></input><input type=hidden id=resJUNKult value=''></input><input type=hidden id=audioname value=''></input><input type=hidden id=audiorestname value=''></input>" . $resultof . "<textarea id=myta rows=50 cols=120 id=toptext style=visibility:hidden;></textarea>";
}
if (isset($_GET['convertthis']) && isset($_GET['outputname'])) {
  if ($_GET['convertthis'] != "") {
  $thewords=str_replace("+"," ",urldecode($_GET['convertthis']));
  $thegoes=explode(",", $thewords);
  for ($indx=0; $indx<sizeof($thegoes); $indx++) {
  if (file_exists(yourstr_replace("+"," ",urldecode($_GET['outputname'])))) {
    while (file_exists(yourstr_replace("+"," ",urldecode($_GET['outputname'])) . $sufext)) {
      $iext++;
      $sufext="_" . $iext;
    }
    exec("rename " . yourstr_replace("+"," ",urldecode($_GET['outputname'])) . " " . yourstr_replace("+"," ",urldecode($_GET['outputname'])) . $sufext);
  }
  // pandoc -t pdf scjob.docx -o scjob.pdf  --pdf-engine=/Library/TeX/Root/bin/x86_64-darwin/pdflatex
  $cmdsuff="";
  if ($verb != "textutil" && explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))] == "pdf") {
  if (file_exists("/Library/TeX/Root/bin/x86_64-darwin/pdflatex")) {
  $cmdsuff=" --pdf-engine=/Library/TeX/Root/bin/x86_64-darwin/pdflatex";
  } else if (file_exists("/Library/TeX/texbin/pdflatex")) {
  $cmdsuff=" --pdf-engine=/Library/TeX/texbin/pdflatex";
  } else {
  $cmdsuff=" --pdf-engine=" . $precmds . "pdflatex";
  }
  }


 //echo $verb . " " . $switchone . " " . explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))] . " " . ourstr_replace("+"," ",$thewords) . " " . $switchtwo . " " . yourstr_replace("+"," ",urldecode($_GET['outputname'])) . $cmdsuff;
 //exit;

    file_put_contents("macos_textutil_convertYES.out",$verb . "        " . $switchone . " " . explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))] . " " . ourstr_replace("+"," ",$thewords) . " " . $switchtwo . " " . yourstr_replace("+"," ",urldecode($_GET['outputname'])) . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err \n");

    if (isset($_POST['content'])) {
    //echo "yeS";
    //exit;
    $befbsf=str_replace(' ','+', urldecode($_POST['content']));
    file_put_contents('/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))), base64_decode(explode(';base64,',$befbsf)[1]));
theecho("6:" . "$verb" . " " . $switchone . " " . "/tmp/xx." . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err ; rm -f " . "/tmp/xx." . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))));
//exit;
    exec("$verb" . " " . $switchone . switcheroo(" " . "/tmp/xx." . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))) . " ") . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err ; rm -f " . "/tmp/xx." . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))));


  $mimt=inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0]))));
  //file_put_contents("abc.xzy",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
  if ($mimt == 'html' && file_exists($outnameis)) {
  //file_put_contents("abc.xz2",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body>" . $ocontis . "</body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     } else {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title>" . $hjit . "</head><body><div id=dhj><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe></div><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     }
  //file_put_contents("abc.xz3",$ocontis );
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );

     //echo "<html><body onload=\" " . $wobit . " \"></body></html>";   // might be temporary arrangement
     //exit;
  } else if ($mimt == "pdf") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\"  src=\"data:application/pdf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if (substr($mimt,0,3) == "rtf") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/rtf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if ($mimt == "odt") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.oasis.opendocument.text;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  } else if (substr($mimt,0,3) == "doc") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  } else if (str_replace('plain','txt',str_replace('text','txt',$mimt)) == "txt") {
     $ocontis=file_get_contents($outnameis); $oocontis=$ocontis; 
     $pltx=$ocontis;
     if (strpos($ocontis, '<body') !== false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><iframe onload=window.opener.top.justit(this); style=\"width:100%;height:100%;\" src=\"data:text/html;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename($outnameis) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
       $wobit=" top.document.getElementById('dres').style.width='98%'; if (2 == 5) { top.document.getElementById('dres').style.height='30%'; } top.document.getElementById('dres').innerHTML='<iframe id=ifmy onload=top.justit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe>';      ";
     } else if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename($outnameis) . "</title></head><body><div>" . str_replace("\n","<br>",$ocontis) . "\"></div><br></body></html>";
       $wobit=" top.document.getElementById('dres').style.width='98%'; top.document.getElementById('dres').style.height='30%'; top.document.getElementById('dres').innerHTML='<textarea id=myta style=width:98%;height:98%;>' + window.atob('" . base64_encode($pltx) . "') + '</textarea>'; top.document.getElementById('myta').value=window.atob('" . base64_encode($pltx) . "');      ";
     }
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  }




    } else {
theecho("7:" . "$verb" . " " . $switchone . switcheroo(" " . explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))] . " \"") . '/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))) . "\" " . $switchtwo . " \"" . (yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err; rm -f " . '/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))));
//exit;
  //exec("$verb" . " " . $switchone . switcheroo(" \"" . str_replace('txt','plain',explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))]) . "\" ") . ourstr_replace("+"," ",$thewords) . " " . $switchtwo . " \"" . yourstr_replace("+"," ",urldecode($_GET['outputname'])) . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");
  exec("$verb" . " " . $switchone . switcheroo(" " . explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))] . " \"") . '/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))) . "\" " . $switchtwo . " \"" . (yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err; rm -f " . '/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))));

  $mimt=explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))];
  //file_put_contents("abc.xzy",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
  if ($mimt == 'html' && file_exists(yourstr_replace("+"," ",urldecode($_GET['outputname'])))) {
  //file_put_contents("abc.xz2",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
     $ocontis=file_get_contents(yourstr_replace("+"," ",urldecode($_GET['outputname'])));
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "</title></head><body>" . $ocontis . "</body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     } else {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "</title>" . $hjit . "</head><body><iframe onload=hjustit(this); style=width:100%;height:100%; src=data:text/html;base64," . base64_encode($ocontis) . "></iframe><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     }
  //file_put_contents("abc.xz3",$ocontis );
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );

     //echo "<html><body onload=\" " . $wobit . " \"></body></html>";   // might be temporary arrangement
     //exit;
  } else if ($mimt == "pdf") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",urldecode($_GET['outputname']))); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\"  src=\"data:application/pdf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if (substr($mimt,0,3) == "rtf") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",urldecode($_GET['outputname']))); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/rtf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if ($mimt == "odt") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",urldecode($_GET['outputname']))); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.oasis.opendocument.text;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  } else if (substr($mimt,0,3) == "doc") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",urldecode($_GET['outputname'])));  $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) { 
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_GET['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit ); 
  } else if (str_replace('plain','txt',str_replace('text','txt',$mimt)) == "txt") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",urldecode($_GET['outputname']))); $oocontis=$ocontis; 
     $pltx=$ocontis;
     if (strpos($ocontis, '<body') !== false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",urldecode($_GET['outputname']))) . "</title></head><body><iframe onload=window.opener.top.justit(this); style=\"width:100%;height:100%;\" src=\"data:text/html;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",urldecode($_GET['outputname']))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
       $wobit=" top.document.getElementById('dres').style.width='98%'; if (2 == 5) { top.document.getElementById('dres').style.height='30%'; } top.document.getElementById('dres').innerHTML='<iframe id=ifmy onload=top.justit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe>';      ";
     } else if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",urldecode($_GET['outputname']))) . "</title></head><body><div>" . str_replace("\n","<br>",$ocontis) . "\"></div><br></body></html>";
       $wobit=" top.document.getElementById('dres').style.width='98%'; top.document.getElementById('dres').style.height='30%'; top.document.getElementById('dres').innerHTML='<textarea id=myta style=width:98%;height:98%;>' + window.atob('" . base64_encode($pltx) . "') + '</textarea>'; top.document.getElementById('myta').value=window.atob('" . base64_encode($pltx) . "');      ";
     }
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  }




    }
  if (explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))] == "pdf") {
        $PDFfilename=yourstr_replace("+"," ",big(urldecode($_GET['outputname'])));
        if ($okthen) {
        $pdf = file_get_contents($PDFfilename);
        header('Content-Type: application/pdf');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($PDFfilename) .'";');
        ob_clean(); 
        flush(); 
        echo $pdf;  
        //exit; 
        }
  } else if (explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))] == "rtf") {
        $PDFfilename=yourstr_replace("+"," ",big(urldecode($_GET['outputname'])));
        if ($okthen) {
        $pdf = file_get_contents($PDFfilename);
        header('Content-Type: application/rtf');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($PDFfilename) .'";');
        ob_clean(); 
        flush(); 
        echo $pdf;  
        //exit; 
        }
  } else if (explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))] == "odt") {
        $PDFfilename=yourstr_replace("+"," ",big(urldecode($_GET['outputname'])));
        if ($okthen) {
        $pdf = file_get_contents($PDFfilename);
        header('Content-Type: application/odt');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($PDFfilename) .'";');
        ob_clean(); 
        flush(); 
        echo $pdf;  
        //exit; 
        }
  }
  if (file_exists("macos_textutil_convert.out") && file_exists("macos_textutil_convert.err")) {
  if (filesize("macos_textutil_convert.out") == 0 && filesize("macos_textutil_convert.err") != 0) {
     if ($rone != "" && $rtwo != "") {
      rename($rone, $rtwo);
     }
    //if (explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))] == 'html') {
    //echo file_get_contents(ourstr_replace("+"," ",$thewords) . " " . $switchtwo . " " . yourstr_replace("+"," ",urldecode($_GET['outputname'])));
    //} else {
    if (file_exists(yourstr_replace("+"," ",urldecode($_GET['outputname']))) && explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))] == 'html') {
    echo file_get_contents(yourstr_replace("+"," ",urldecode($_GET['outputname'])));
    } else {
    echo "<html><head><meta charset='UTF-8'/><title>Supervise pandoc or textutil Document Conversions - RJM Programming - January, 2025</title><style> * { overflow-y:visible; } </style>
      <scr" . "ipt type=text/javascript>   

  var wwoo=null, inaconto=null;
  var inaconto=null, wqwq=null;
  var childtop=eval(-470 + eval('' + screen.height)), childleft=eval(-470 + eval('' + screen.width));
  var childwoos=[];
 
 function onc(event){ if (eval('' + event.target.innerHTML.length) >= eval('' + window.atob(event.target.getAttribute('data-smalltitle')).length) && eval('' + event.target.innerHTML.length) < eval('' + window.atob(event.target.getAttribute('data-bigtitle')).length)) { event.target.innerHTML=window.atob(event.target.getAttribute('data-bigtitle'));  } else {  event.target.innerHTML=window.atob(event.target.getAttribute('data-smalltitle'));    }  }

 function onr(event){ var wwwooo=window.open('','_blank','top=15,left=15,width=500,height=500'); wwwooo.document.write(window.atob(event.target.getAttribute('data-biggest')));  }
  
  
  function justit(iois) {
  var aconto=null;
  if (aconto == null) {
       aconto = (iois.contentWindow || iois.contentDocument);
       if (aconto != null) {
       if (aconto.document) { aconto = aconto.document; }
       if (aconto.body != null) {
         if (window.opener) {
          if (window.opener.top.document.getElementById('dres')) {
              window.opener.top.document.getElementById('dres').style.width='98%'; 
              window.opener.top.document.getElementById('dres').style.height='30%';
              window.opener.top.document.getElementById('dres').innerHTML=aconto.body.innerText;
           }
         } else if (aconto.body.innerHTML.indexOf(';base64,') != -1) {
           var wasais=aconto.body.innerHTML.split('\">')[0].split('>')[0];
           var wpg=window.atob(wasais.split(';base64,')[1]);
           top.document.getElementById('dres').setAttribute('data-biggest',wasais.split(';base64,')[1]);
           if (wpg.indexOf('<body') != -1) {
           aconto.body.innerHTML=wpg.split('<body' + wpg.split('<body')[1].split('>')[0] + '>')[1].split('</body>')[0];
           } else {
           aconto.body.innerHTML=wpg;
           }
           top.document.getElementById('dres').setAttribute('data-smalltitle',window.btoa(aconto.body.innerText));
           top.document.getElementById('dres').title='Click toggles whether line feeds show and right click opens HTML look';
           var newwasais=aconto.body.innerText;
           while (newwasais.indexOf(String.fromCharCode(10)) != -1) {
             newwasais=newwasais.replace(String.fromCharCode(10),'<br>');
           }
           top.document.getElementById('dres').innerHTML=newwasais; //aconto.body.innerText;
           top.document.getElementById('dres').setAttribute('data-bigtitle',window.btoa(newwasais));
           top.document.getElementById('dres').style.backgroundColor='white';
           top.document.getElementById('dres').onclick=function(evt){ if (eval('' + evt.target.innerHTML.length) >= eval('' + window.atob(evt.target.getAttribute('data-smalltitle')).length) && eval('' + evt.target.innerHTML.length) < eval('' + window.atob(evt.target.getAttribute('data-bigtitle')).length)) { evt.target.innerHTML=window.atob(evt.target.getAttribute('data-bigtitle'));  } else {  evt.target.innerHTML=window.atob(evt.target.getAttribute('data-smalltitle'));    }  };
           top.document.getElementById('dres').oncontextmenu=function(evt){ var wwwooo=window.open('','_blank','top=15,left=15,width=500,height=500'); wwwooo.document.write(window.atob(evt.target.getAttribute('data-biggest')));  };
         }
       }
       }
  }
  }
  
  function yesfivefive(restis) {
    document.getElemenetById('toptext').innerHTML=restis;
  }
  
  function oldcheckformaybes() {
     var argd='?', argst='', contd='', resultof='Result of ...';
     resultof='Result of conversion to ' + document.getElementById('outputname').value.split(',')[eval(-1 + document.getElementById('outputname').value.split(',').length)] + ' ( via *.' + document.getElementById('thewords').value.split(',')[eval(-1 + document.getElementById('thewords').value.split(',').length)].split('.')[eval(-1 + document.getElementById('thewords').value.split(',')[eval(-1 + document.getElementById('thewords').value.split(',').length)].split('.').length)] + ' ) ' + document.getElementById('thewords').value + ' ... ';
     if ((('' + document.getElementById('maybee').value).replace(/^undefined/g,'') + ('' + document.getElementById('maybes').value).replace(/^undefined/g,'')) != '') {
        alert('a0:' + document.getElementById('myform').outerHTML);
        document.getElementById('myform').method='GET';
        var things=document.getElementById('myform').innerHTML.split(' name=');
        var idthing='', namething='';
        for (var ith=1; ith<things.length; ith++) {
         namething=things[ith].split(' ')[0].split('>')[0].replace('\"','').replace('\"','').replace(/\'/g, '');
         idthing=namething.replace('convertto','cto').replace('outpath','opath').replace('inpath','path').replace('convertthis','thewords');
         if (namething == 'content') {
         if (document.getElementById('content0')) {
         contd='#content=' + encodeURIComponent(document.getElementById('content0').value);
         alert('a1:' + document.getElementById('content0').outerHTML);
         } else if (!document.getElementById('content')) {
         var inps=document.getElementsByTagName('input');
         for (var jnps=0; jnps<inps.length; jnps++) {
            if (('' + inps[jnps].name) == 'content') {
         inps[jnps].id='content';  
         contd='#content=' + encodeURIComponent(document.getElementById('content').value);
            }
         }
         } else {
         contd='#content=' + encodeURIComponent(document.getElementById('content').value);
         alert('b1:' + document.getElementById('content0').outerHTML);
         }
         } else {
         if (!document.getElementById(idthing)) {   
         argst+=argd + namething + '=' + '';
         } else {
         argst+=argd + namething + '=' + encodeURIComponent(document.getElementById(idthing).value);
         }
         argd='&';
         }
        }
    //alert(document.URL.split('?')[0].split('#')[0] + argst + contd);
        //location.href=document.URL.split('?')[0].split('#')[0] + argst + contd; //'?outputname=' + encodeURIComponent(document.getElementById('outputname').value)
        //return false;
        document.getElementById('myform').method='POST';
        document.getElementById('myform').action=document.URL.split('?')[0].split('#')[0] + contd;
     }
     return true;
  }
  
  function youngercheckformaybes() {
     var argd='?', argst='', contd='', resultof='Result of ...', optnfrom='youllneverfindthis', optnto='youllneverfindthis';
     resultof='Result of conversion of ' + document.getElementById('thewords').value + ' to ' +  document.getElementById('outputname').value.split(',')[eval(-1 + document.getElementById('outputname').value.split(',').length)] + ' ... ';
     resultof='Result of conversion to ' + document.getElementById('outputname').value.split(',')[eval(-1 + document.getElementById('outputname').value.split(',').length)] + ' ( via *.' + document.getElementById('thewords').value.split(',')[eval(-1 + document.getElementById('thewords').value.split(',').length)].split('.')[eval(-1 + document.getElementById('thewords').value.split(',')[eval(-1 + document.getElementById('thewords').value.split(',').length)].split('.').length)] + ' ) ' + document.getElementById('thewords').value + ' ... ';
     if ((('' + document.getElementById('maybee').value).replace(/^undefined/g,'') + ('' + document.getElementById('maybes').value).replace(/^undefined/g,'')) != '') {
        //document.getElementById('myform').method='GET';
        var things=document.getElementById('myform').innerHTML.split(' name=');
        var idthing='', namething='';
        for (var ith=1; ith<things.length; ith++) {
         namething=things[ith].split(' ')[0].split('>')[0].replace('\"','').replace('\"','').replace(/\'/g, '');
         idthing=namething.replace('convertto','cto').replace('outpath','opath').replace('inpath','path').replace('convertthis','thewords');
         if (namething == 'outputname') {
           optnfrom=encodeURIComponent(document.getElementById(namething).value);
           optnto=encodeURIComponent(document.getElementById(namething).value);
           //alert(optnto);
           if (document.getElementById(namething).value.indexOf(',') != -1) {
              optnto=encodeURIComponent(document.getElementById(namething).value.split(',')[1]);
           //alert(optnto);
           }
         }
         if (namething == 'content') {
         if (document.getElementById('content0')) {
         contd='#content=' + encodeURIComponent(document.getElementById('content0').value);
         } else if (!document.getElementById('content')) {
         var inps=document.getElementsByTagName('input');
         for (var jnps=0; jnps<inps.length; jnps++) {
            if (('' + inps[jnps].name) == 'content') {
         inps[jnps].id='content';  
         contd='#content=' + encodeURIComponent(document.getElementById('content').value);
            }
         }
         } else {
         contd='#content=' + encodeURIComponent(document.getElementById('content').value);
         }
         } else {
         if (!document.getElementById(idthing)) {   
         argst+=argd + namething + '=' + '';
         } else {
         if (namething == 'outputname') {
           optnfrom=encodeURIComponent(document.getElementById(namething).value);
           optnto=encodeURIComponent(document.getElementById(namething).value);
           //alert(optnto);
           if (document.getElementById(namething).value.indexOf(',') != -1) {
              optnto=encodeURIComponent(document.getElementById(namething).value.split(',')[1]);
         argst+=argd + namething + '=' + encodeURIComponent(document.getElementById(namething).value.split(',')[1]);
           //alert(optnto);
           } else {
         argst+=argd + namething + '=' + encodeURIComponent(document.getElementById(idthing).value);
           }
         } else {
         argst+=argd + namething + '=' + encodeURIComponent(document.getElementById(idthing).value);
         }
         }
         argd='&';
         }
        }
        var subjpref='';
        var toppref='_top';
        if (document.getElementById('maybes').value.trim() != '') {
        subjpref='For keeps ... ';
        toppref='_top';
        document.getElementById('dinhouse').innerHTML+=\"<a target=\" + toppref + \" href='sms:\" + document.getElementById('maybes').value.trim() + \"&body=\" + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + (argst.replace(/\%20/g,'+').replace(/\&maybe/g,'&bemay') + contd.replace(/^\JnK#/g,'&'))) + \"' id=msyes style=display:none;>SMS</a>\";
        toppref='_top';
        }
        if (document.getElementById('maybee').value.indexOf('@') != -1) {
        document.getElementById('dinhouse').innerHTML+=\"<a target=\" + toppref + \" href='mailto:\" + document.getElementById('maybee').value + \"?subject=\" + encodeURIComponent(subjpref + resultof) + \"&body=\" + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + argst.replace(/\&maybe/g,'&bemay') + contd) + \"' id=myes style=display:none;>Email</a>\";
        } 
        if (document.getElementById('myes') || document.getElementById('msyes')) {
        //alert(document.getElementById('myes').href);
        if (document.getElementById('msyes')) {
        if (window.opener) {
        window.opener.document.getElementById('wophelp').href=document.getElementById('msyes').href;
        window.opener.document.getElementById('wophelp').click();
        } else {
        document.getElementById('msyes').click();
        }
        }
        if (document.getElementById('myes')) {
        if (window.opener) {
        window.opener.document.getElementById('wophelp').href=document.getElementById('myes').href;
        window.opener.document.getElementById('wophelp').click();
        } else {
        document.getElementById('myes').click();
        }
        }
        document.getElementById('maybee').value='';
        document.getElementById('maybes').value='';
        document.getElementById('maybee').name='mayjunkbee';
        document.getElementById('maybes').name='mayjunkbes';
        } //else {
        //alert(document.URL.split('?')[0].split('#')[0] + argst + contd);
        //}
        //location.href=document.URL.split('?')[0].split('#')[0] + argst + contd; //'?outputname=' + encodeURIComponent(document.getElementById('outputname').value)
        //return false;
        document.getElementById('myform').method='POST';
        document.getElementById('myform').action=document.URL.split('?')[0].split('#')[0] + contd;
     }
     return true;
  }
  
  function checkformaybes() {
     var retval=true;
     var argd='?', argst='', contd='', resultof='Result of ...', optnfrom='youllneverfindthis', optnto='youllneverfindthis';
     resultof='Result of conversion of ' + document.getElementById('thewords').value + ' to ' +  document.getElementById('outputname').value.split(',')[eval(-1 + document.getElementById('outputname').value.split(',').length)] + ' ... ';
     resultof='Result of conversion to ' + document.getElementById('outputname').value.split(',')[eval(-1 + document.getElementById('outputname').value.split(',').length)] + ' ( via *.' + document.getElementById('thewords').value.split(',')[eval(-1 + document.getElementById('thewords').value.split(',').length)].split('.')[eval(-1 + document.getElementById('thewords').value.split(',')[eval(-1 + document.getElementById('thewords').value.split(',').length)].split('.').length)] + ' ) ' + document.getElementById('thewords').value + ' ... ';
     if ((('' + document.getElementById('maybee').value).replace(/^undefined/g,'') + ('' + document.getElementById('maybes').value).replace(/^undefined/g,'')) != '') {
        //document.getElementById('myform').method='GET';
        var things=document.getElementById('myform').innerHTML.split(' name=');
        var idthing='', namething='';
        for (var ith=1; ith<things.length; ith++) {
         namething=things[ith].split(' ')[0].split('>')[0].replace('\"','').replace('\"','').replace(/\'/g, '');
         idthing=namething.replace('convertto','cto').replace('outpath','opath').replace('inpath','path').replace('convertthis','thewords');
         if (namething == 'outputname') {
           optnfrom=encodeURIComponent(document.getElementById(namething).value);
           optnto=encodeURIComponent(document.getElementById(namething).value);
           //alert(optnto);
           if (document.getElementById(namething).value.indexOf(',') != -1) {
              optnto=encodeURIComponent(document.getElementById(namething).value.split(',')[1]);
           //alert(optnto);
           }
         }
         if (namething == 'content') {
         if (document.getElementById('content0')) {
         contd='#content=' + encodeURIComponent(document.getElementById('content0').value);
         } else if (!document.getElementById('content')) {
         var inps=document.getElementsByTagName('input');
         for (var jnps=0; jnps<inps.length; jnps++) {
            if (('' + inps[jnps].name) == 'content') {
         inps[jnps].id='content';  
         contd='#content=' + encodeURIComponent(document.getElementById('content').value);
            }
         }
         } else {
         contd='#content=' + encodeURIComponent(document.getElementById('content').value);
         }
         } else {
         if (!document.getElementById(idthing)) {   
         argst+=argd + namething + '=' + '';
         } else {
         if (namething == 'outputname') {
           optnfrom=encodeURIComponent(document.getElementById(namething).value);
           optnto=encodeURIComponent(document.getElementById(namething).value);
           //alert(optnto);
           if (document.getElementById(namething).value.indexOf(',') != -1) {
              optnto=encodeURIComponent(document.getElementById(namething).value.split(',')[1]);
         argst+=argd + namething + '=' + encodeURIComponent(document.getElementById(namething).value.split(',')[1]);
           //alert(optnto);
           } else {
         argst+=argd + namething + '=' + encodeURIComponent(document.getElementById(idthing).value);
           }
         } else {
         argst+=argd + namething + '=' + encodeURIComponent(document.getElementById(idthing).value);
         }
         }
         argd='&';
         }
        }
        //if (document.getElementById('maybee').value.indexOf('@') != -1) {
        //document.getElementById('dinhouse').innerHTML+=\"<a target=_top href='mailto:\" + document.getElementById('maybee').value + \"?subject=\" + encodeURIComponent(resultof) + \"&body=\" + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + argst.replace(/\&maybe/g,'&bemay') + contd) + \"' id=myes style=display:none;>Email</a>\";
        //} 
        //if (document.getElementById('maybes').value.trim() != '') {
        //alert('argst=' + argst);
        //document.getElementById('dinhouse').innerHTML+=\"<a target=_top href='sms:\" + document.getElementById('maybes').value.trim() + \"&body=\" + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + (argst.replace(/\%20/g,'+').replace(/\&maybe/g,'&bemay') + contd.replace(/^\JnK#/g,'&'))) + \"' id=msyes style=display:none;>SMS</a>\";
        //}
        var subjpref='';
        var toppref='_top';
        if (document.getElementById('maybes').value.trim() != '') {
        subjpref='For keeps ... ';
        toppref='_top';
        if (document.getElementById('maybee').value.indexOf('@') != -1) {
        document.getElementById('dinhouse').innerHTML+=\"<a data-onclick=\\\"setTimeout(function(){ document.getElementById('myes').click(); }, 3000);\\\" target=\" + toppref + \" href='sms:\" + document.getElementById('maybes').value.trim() + \"&body=\" + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + (argst.replace(/\%20/g,'+').replace(/\&maybe/g,'&bemay') + contd.replace(/^\JnK#/g,'&'))) + \"' id=msyes style=display:none;>SMS</a>\";
        } else {
        document.getElementById('dinhouse').innerHTML+=\"<a target=\" + toppref + \" href='sms:\" + document.getElementById('maybes').value.trim() + \"&body=\" + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + (argst.replace(/\%20/g,'+').replace(/\&maybe/g,'&bemay') + contd.replace(/^\JnK#/g,'&'))) + \"' id=msyes style=display:none;>SMS</a>\";
        }
        toppref='_top';
        }
        if (document.getElementById('maybee').value.indexOf('@') != -1) {
        document.getElementById('dinhouse').innerHTML+=\"<a target=\" + toppref + \" href='mailto:\" + document.getElementById('maybee').value + \"?subject=\" + encodeURIComponent(subjpref + resultof) + \"&body=\" + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + argst.replace(/\&maybe/g,'&bemay') + contd) + \"' id=myes style=display:none;>Email</a>\";
        } 
        if (document.getElementById('myes') || document.getElementById('msyes')) {
        //alert(document.getElementById('myes').href);
        if (document.getElementById('myes')) {
        if (window.opener) {
        window.opener.document.getElementById('wophelp').href=document.getElementById('myes').href;
        window.opener.document.getElementById('wophelp').click();
        } else {
        document.getElementById('myes').click();
        }
        }
        if (document.getElementById('msyes')) {
        if (document.getElementById('myes')) {
        //document.getElementById('myform').target='_blank';
        retval=false;
        } else {
        if (window.opener) {
        window.opener.document.getElementById('wophelp').href=document.getElementById('msyes').href;
        window.opener.document.getElementById('wophelp').click();
        } else {
        document.getElementById('msyes').click();
        }
        }
        }
        document.getElementById('maybee').value='';
        document.getElementById('maybes').value='';
        document.getElementById('maybee').name='mayjunkbee';
        document.getElementById('maybes').name='mayjunkbes';
        } //else {
        //alert(document.URL.split('?')[0].split('#')[0] + argst + contd);
        //}
        //location.href=document.URL.split('?')[0].split('#')[0] + argst + contd; //'?outputname=' + encodeURIComponent(document.getElementById('outputname').value)
        //return false;
        document.getElementById('myform').method='POST';
        document.getElementById('myform').action=document.URL.split('?')[0].split('#')[0] + contd;
     }
     if (!retval) {
                document.body.style.cursor='crosshair'; 
                document.getElementById('ifsubmit').disabled=true;
                document.getElementById('myes').target='_top';
        setTimeout(function(){
           if (1 == 1) {
                if (4 == 4) {
                   setTimeout(wqwqlook, 3000);
                   var ifb=document.getElementById('ifsubmit').getBoundingClientRect();
                   wqwq=window.open('','_blank','top=' + ifb.top + ',left=' + ifb.left + ',width=' + ifb.width + ',height=' + eval(2 * eval('' + ifb.height)));
                   wqwq.document.write(\"<html><body data-onload=\\\" var xcv=confirm('Ready to send SMS?'); if (xcv) {          if (window.opener) {        window.opener.document.getElementById('wophelp').href=document.getElementById('msyes').href;        window.opener.document.getElementById('wophelp').click();        } else { document.getElementById('msyes').click(); }  window.opener.focus(); if (45 == 67) { window.opener.document.getElementById('ifsubmit').click(); } }\\\">\" + document.getElementById('msyes').outerHTML.replace('none','block').replace(\"<a \", \"<a onclick='setTimeout(function(){ window.close(); }, 20000);' \") + \"</body></html>\");
                }
                //document.getElementById('myes').click();
                //document.getElementById('ifsubmit').click();
           }
        }, 20000);
        //retval=true;
     }
     if (retval) {
         document.getElementById('ifsubmit').disabled=true;
         document.getElementById('ifesubmit').disabled=true;
     }
     return retval;
  }
  
  function wqwqlook() {
     if (wqwq) {
       if (wqwq.closed) {
         wqwq=null;
         document.getElementById('ifsubmit').disabled=false;
         document.body.style.cursor='progress'; 
         document.getElementById('ifsubmit').click();
         document.getElementById('ifsubmit').disabled=true;
         document.getElementById('ifesubmit').disabled=true;
       } else {
         setTimeout(wqwqlook, 3000);
       }
     }
  }
      
  function shareit() {
     var doc=false, idoc=0, bigrecipient='';
     var recipient=prompt('Please enter an email address and/or SMS number to send results to (ie. comma separated as required)?  Email is preferred because the output file might be recreateable way down the track if the recipient retains the email, with the link, and wants to click that link to recreate that output file again themselves without the originator getting involved again.', '');
     if (recipient != null) {
       if (('' + recipient).trim() != '') {
        var rwords=('' + recipient).trim().split(',');
        if (('' + recipient).trim().indexOf('@') != -1) {
          document.body.style.cursor='progress';
          doc=true;
          if (eval('' + rwords.length) > 1) {
          for (idoc=0; idoc<rwords.length; idoc++) {
            if (rwords[idoc].indexOf('@') != -1) {
               recipient=(',' + recipient).replace(',' + rwords[idoc] + ',', ',').replace(',' + rwords[idoc] + '', '').replace(/^\,/g,'');
               if (bigrecipient == '') {
                 bigrecipient=rwords[idoc];
               } else {
                 bigrecipient+=',' + rwords[idoc];
               }
            }
          }
          document.getElementById('maybee').value=('' + bigrecipient).trim();
          } else {
          document.getElementById('maybee').value=('' + recipient).trim();
          }
          //document.getElementById('ifsubmit').click();
        } 
        if (('' + recipient).trim().replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '') {
          document.body.style.cursor='progress';
          doc=true;
          document.getElementById('maybes').value=('' + recipient).trim();
          //document.getElementById('ifsubmit').click();
        }
        if (doc) { document.getElementById('ifsubmit').click();  }
       }
     }
  }
  
  function yesthreethree(restis) {
  // alert(45);
   if (document.getElementById('ifesubmit')) {
    if (document.getElementById('ifsubmit')) {
      document.getElementById('ifsubmit').style.width='48%';
      document.getElementById('ifesubmit').style.display='inline-block';
    }
   }
   if (document.getElementById('ifesubmit')) {
    if (document.getElementById('ifsubmit')) {
      document.getElementById('ifsubmit').style.width='48%';
      document.getElementById('ifesubmit').style.display='inline-block';
    }
   }
   if (document.getElementById('content0')) {
   //alert(restis);
    document.getElementById('content0').value=restis;
    //alert('467 ' + restis);
   }
   if (document.getElementById('dinhouse')) {
   //alert(restis);
    document.getElementById('dinhouse').innerHTML+='<div id=divcontent><input type=hidden name=infname id=infname value=\"' + document.getElementById('thewords').value + '\"></input><input type=hidden name=content id=content value=\"' + restis + '\"></input><input type=hidden name=maybee id=maybee value=\"\"></input><input type=hidden name=maybes id=maybes value=\"\"></input>';
    //setTimeout(function(){ document.getElementById('divcontent').innerHTML='';   }, 20000);
    //alert('1467 ' + document.getElementById('dinhouse').innerHTML);
    if (('' + location.hash).indexOf('content=') != -1) {
      //if (document.URL.indexOf('convertto=pdf') != -1) {
      //alert(675);
      //}
      document.body.style.cursor='progress';
      if (document.getElementById('myes')) {
        setTimeout(function(){
        if (document.getElementById('myes') || document.getElementById('msyes')) {
        if (document.getElementById('msyes')) {
        if (window.opener) {
        window.opener.document.getElementById('wophelp').href=document.getElementById('msyes').href;
        window.opener.document.getElementById('wophelp').click();
        } else {
        document.getElementById('msyes').click();
        }
        }
        if (document.getElementById('myes')) {
        if (window.opener) {
        window.opener.document.getElementById('wophelp').href=document.getElementById('myes').href;
        window.opener.document.getElementById('wophelp').click();
        } else {
        document.getElementById('myes').click();
        }
        }
        }
         document.getElementById('ifsubmit').click();
         }, 5000);
      } else {
      document.getElementById('ifsubmit').click();
      }
    }
   }
  }
  
  
  function yes_three_three(restis, rstis, nmis) {
   //alert('yes45');
   if (rstis != '') {
   document.getElementById('outputname').value=document.getElementById('thewords').value.split('.')[0] + '.html';
   childwoos.push(window.open(document.URL.split('?')[0].split('#')[0] + '?foneile=' + encodeURIComponent(nmis) + '#' + encodeURIComponent(restis), '_blank', 'top=' + childtop + ',left=' + childleft + ',width=470,height=470'));
   childtop-=10;
   childleft-=10;
   if (document.getElementById('divend')) {
     if (document.getElementById('divend').innerHTML == '') {
       document.getElementById('divend').innerHTML='<a target=_top id=wophelp style=display:none; href=#>Email or SMS</a>';
     }
   }
   } else {
   if (document.getElementById('ifesubmit')) {
    if (document.getElementById('ifsubmit')) {
      document.getElementById('ifsubmit').style.width='48%';
      document.getElementById('ifesubmit').style.display='inline-block';
    }
   }
   if (document.getElementById('ifesubmit')) {
    if (document.getElementById('ifsubmit')) {
      document.getElementById('ifsubmit').style.width='48%';
      document.getElementById('ifesubmit').style.display='inline-block';
    }
   }
   if (document.getElementById('content0')) {
   //alert(restis);
    document.getElementById('content0').value=restis;
    //alert('467 ' + restis);
   }
   if (document.getElementById('dinhouse')) {
   //alert(restis);
    document.getElementById('dinhouse').innerHTML+='<div id=divcontent><input type=hidden name=infname id=infname value=\"' + document.getElementById('thewords').value + '\"></input><input type=hidden name=content id=content value=\"' + restis + '\"></input><input type=hidden name=maybee id=maybee value=\"\"></input><input type=hidden name=maybes id=maybes value=\"\"></input>';
    //setTimeout(function(){ document.getElementById('divcontent').innerHTML='';   }, 20000);
    //alert('1467 ' + document.getElementById('dinhouse').innerHTML);
    if (('' + location.hash).indexOf('content=') != -1) {
      //if (document.URL.indexOf('convertto=pdf') != -1) {
      //alert(675);
      //}
      document.body.style.cursor='progress';
      if (document.getElementById('myes')) {
        setTimeout(function(){
        if (document.getElementById('myes') || document.getElementById('msyes')) {
        if (document.getElementById('msyes')) {
        if (window.opener) {
        window.opener.document.getElementById('wophelp').href=document.getElementById('msyes').href;
        window.opener.document.getElementById('wophelp').click();
        } else {
        document.getElementById('msyes').click();
        }
        }
        if (document.getElementById('myes')) {
        if (window.opener) {
        window.opener.document.getElementById('wophelp').href=document.getElementById('myes').href;
        window.opener.document.getElementById('wophelp').click();
        } else {
        document.getElementById('myes').click();
        }
        }
        }
         document.getElementById('ifsubmit').click();
         }, 5000);
      } else {
      document.getElementById('ifsubmit').click();
      }
    }
   }
   }
  }
  
  function worry() {
     if (document.getElementById('myta')) {
       if (document.getElementById('myta').value == '') {
        setTimeout(worry, 5000);
       } else {
        document.body.style.cursor='pointer';
       }
     } else {
       setTimeout(worry, 5000);
     }  
  }
  
  function oops(inidis) {
     if (inidis == 'hidden') {
      //if (document.URL.indexOf('convertto=pdf') != -1) {
      //alert(7675);
      //}

       setTimeout(worry, 5000);
     }
     return inidis;
  }

 function mnm(iois) {
  var aconto=null;
  if (aconto == null) {
       aconto = (iois.contentWindow || iois.contentDocument);
       if (aconto != null) {
       if (aconto.document) { aconto = aconto.document; }
       if (aconto.body != null) {
        if ('" . $mult . "' == '') {
         aconto.getElementById('files').removeAttribute('multiple');
        }
       }
       }
  }
  }

  function lhit() {
  var afi='';
  var resultof='';
  " . $curt . " 
  if (('' + location.hash).indexOf('content=') != -1) {
      //if (document.URL.indexOf('convertto=pdf') != -1) {
      //alert(2675);
      //}
   if (document.getElementById('myp')) { document.body.style.cursor='progress'; document.getElementById('myp').style.visibility=oops('hidden');  }
  //alert(256);
     if (window.top) {
  //alert(37256);
       if (!document.getElementById('myform')) {
//&inpath=&convertto=*&outpath=&outputname=.html%2Cxxx.html&convertthis=xxx.txt&
         if (decodeURIComponent((document.URL.replace('#','&') + '&').split('outputname=')[1].split('&')[0]).indexOf(',') != -1) {
         resultof='Result of Conversion from ' + decodeURIComponent((document.URL.replace('#','&') + '&').split('inpath=')[1].split('&')[0]) + decodeURIComponent((document.URL.replace('#','&') + '&').split('convertthis=')[1].split('&')[0]) + ' to ' + decodeURIComponent((document.URL.replace('#','&') + '&').split('outputname=')[1].split('&')[0]).split(',')[1] + ' ... ';
         } else {
         resultof='Result of Conversion from ' + decodeURIComponent((document.URL.replace('#','&') + '&').split('inpath=')[1].split('&')[0]) + decodeURIComponent((document.URL.replace('#','&') + '&').split('convertthis=')[1].split('&')[0]) + ' to ' + decodeURIComponent((document.URL.replace('#','&') + '&').split('outputname=')[1].split('&')[0]) + ' ... ';
         }
  //alert('48256 ');
         document.body.innerHTML+=\"<form accept-charset='UTF-8' style=display:none; id=myform data-onsubmit=\\\" if (!checkformaybes()) {  return false;  } if (document.getElementById('ifsubmit').value.indexOf('mail ') != -1) { setTimeout(askee,9000); return false; } else { if (document.getElementById('thewords').value.indexOf(',') != -1) {  woit(); return false; } else { document.getElementById('myform').style.cursor='progress'; document.body.style.cursor='progress'; setTimeout(thenreload,20000); return true; } }\\\" target=dothework action=./macos_textutil_convert.php method=POST><table border=20 style='width:98%;' cellspacing=5 cellpadding=5><tr><th style='background-color:lightgreen;'>Input Document File" . $plurals . " <span id=sin style=display:none;>in</span> <input name=inpath style=display:inline-block;width:60%; type=text id=path value='" . str_replace('+',' ',urldecode($_GET['inpath'])) . "' placeholder='Optional input path'></input></th><th><select onchange=\\\" selch(this.value);  \\\" style=display:inline-block; name=convertto id=cto><option value='" . str_replace('+',' ',urldecode($_GET['convertto'])) . "'></option><option value='*'>Convert to</option><option value='txt'>Convert to txt</option><option value='rtf'>Convert to rtf</option><!--option value='rtfd'>Convert to rtfd</option--><option value='html'>Convert to html</option><!--option value='doc'>Convert to doc</option--><option value='docx'>Convert to docx</option><option value='odt'>Convert to odt</option><!--option value='wordml'>Convert to wordml</option><option value='webarchive'>Convert to webarchive</option--> <option value='pdf'>Convert to pdf</option></select>&nbsp;<input name=outpath style=display:inline-block;width:30%; type=text id=opath value='" . str_replace('+',' ',urldecode($_GET['outpath'])) . "' placeholder='Optional output path'></input> <input style='width:40%;' onblur=\\\"if (document.URL.toLowerCase().indexOf('" . $rjm . "') != -1) { this.value=''; } if (this.value.toLowerCase().indexOf('.pdf') != -1) { document.getElementById('myform').target='_blank';   }  \\\" placeholder='Output document file" . $plurals . "' type=text name=outputname id=outputname value='" . str_replace('+',' ',urldecode($_GET['outputname'])) . "'></input></div>&nbsp;</th></tr><tr><td style='vertical-align:top;background-color:lightgreen;'><input type=text onblur=\\\"if (document.URL.toLowerCase().indexOf('" . $rjm . "') != -1) { this.value=''; } else { assessit(this.value); }\\\" style='width:90%;' placeholder='Input document file" . $plurals . "' id=thewords name=convertthis  value='" . str_replace('+',' ',urldecode($_GET['convertthis'])) . "'></input><br><br><sup>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;or" . $cself . "&nbsp;...&nbsp;</sup><div style='display:inline-block;width:95px;height:30px;overflow:hidden;vertical-align:text-bottom;'><iframe onload=mnm(this); scrolling=no frameborder=0 id=cbi data-style='border-top:1px solid black;border-bottom:1px solid black;border-left:2px solid yellow;border-right:1px solid yellow;' style='width:173px;height:228px;margin-top:-194px;' src='HTMLCSS/client_browsing.htm?totype=html&d=" . rand(0,18765432) . "'></iframe></div><br><br><sup>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;or" . $cself . "&nbsp;...&nbsp;</sup><input id=pdfcb type=checkbox onchange=pcpon(this);>PDF</input></td><td style=vertical-align:top;><div id=dforbutton>" . $divinfront . "</div><input id=ifsubmit style='width:100%;height:100px;background-color:yellow;display:inline-block;' type=submit value='" . $cvse . " Document" . $plurals . "'></input>&nbsp;<input onclick=shareit(); id=ifesubmit style='width:48%;height:100px;background-color:lightblue;display:none;' type=button value='" . $cvse . " Document" . $plurals . " to Recipient'></input><br><div id=resultout>" . str_replace("\n","<br>",$thecontent) . "</div></td></tr></table><div id=dinhouse></div></form>\";
         if (document.getElementById('maybee')) {
          if (document.getElementById('maybee').value != '') {
  //alert('48256maybee ');
            document.getElementById('esmore').innerHTML+=\"<a target=_top href='mailto:\" + document.getElementById('maybee').value + \"?subject=\" + encodeURIComponent(resultof) + \"&body=\" + encodeURIComponent(document.URL.replace(/\&maybe/g,'&bemay')) + \"' id=myes style=display:none;>Email</a>\";
          }
         } else if (document.URL.indexOf('maybee=') != -1 && (document.URL.replace('#','&') + '&').indexOf('maybee=&') == -1) {
            document.getElementById('esmore').innerHTML+=\"<a target=_top href='mailto:\" + decodeURIComponent((document.URL.replace('#','&') + '&').split('maybee=')[1].split('&')[0]) + \"?subject=\" + encodeURIComponent(resultof) + \"&body=\" + encodeURIComponent(document.URL.replace(/\&maybe/g,'&bemay')) + \"' id=myes style=display:none;>Email</a>\";
         }
         if (document.getElementById('maybes')) {
          if (document.getElementById('maybes').value != '') {
  //alert('48256maybes ');
            document.getElementById('esmore').innerHTML+=\"<a target=_top href='sms:\" + document.getElementById('maybes').value + \"&body=\" + encodeURIComponent(document.URL.replace(/\&maybe/g,'&bemay')) + \"' id=myes style=display:none;>SMS</a>\";
          } else if (document.URL.indexOf('maybes=') != -1 && (document.URL.replace('#','&') + '&').indexOf('maybes=&') == -1) {
            document.getElementById('esmore').innerHTML+=\"<a target=_top href='sms:\" + decodeURIComponent((document.URL.replace('#','&') + '&').split('maybes=')[1].split('&')[0]) + \"&body=\" + encodeURIComponent(document.URL.replace(/\&maybe/g,'&bemay')) + \"' id=myes style=display:none;>SMS</a>\";
          }
         }
       }
     }
  //alert('9256 ' + document.getElementById('thewords').value);
     var inna=decodeURIComponent(('' + location.hash).split('content=')[1].split('&')[0].split('#')[0]);
     if (document.getElementById('thewords').value == '') {
        if (inna.indexOf('data:') == 0) {
  //alert(1256);
          inna=inna.replace(/\ /g,'+');
          document.getElementById('thewords').value='xx.' + inna.split('/')[1].split(';')[0].split(',')[0].replace('plain','txt');
          document.getElementById('thewords').blur();
        } else {
  //alert(2256);
          document.getElementById('thewords').value=inna;
          document.getElementById('thewords').blur();
        }
     }
  //alert(3256);
     yesthreethree(inna);
  //alert(4256);
  } else if (('' + location.hash).replace(/^\#/g,'').indexOf('data') == 0) {
  afi=location.search.split('foneile=')[1] ? decodeURIComponent(location.search.split('foneile=')[1].split('&')[0].split('#')[0]) : '';
  if (afi != '') { document.getElementById('audioname').value=afi; document.getElementById('thewords').value=afi; document.getElementById('outputname').value='' + afi.split('.')[0] + '.html';  firstgo=false; }
  //document.getElementById('resultout').innerHTML=decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+');
  yesthreethree(decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+'));
  } else if (('' + document.URL).indexOf('#data') != -1) {
  afi=location.search.split('foneile=')[1] ? decodeURIComponent(location.search.split('foneile=')[1].split('&')[0].split('#')[0]) : '';
  if (afi != '') { document.getElementById('audioname').value=afi;  document.getElementById('thewords').value=afi; document.getElementById('outputname').value='' + afi.split('.')[0] + '.html';  firstgo=false;  }
  //document.getElementById('resultout').innerHTML=decodeURIComponent(('' + document.URL).split('#data')[1]).replace(/\ /g,'+');
  yesthreethree(decodeURIComponent(('' + document.URL).split('#data')[1]).replace(/\ /g,'+'));
  }
  }
  
  
   function pcpon(cbo) {
   if (cbo.checked) {
   if (document.getElementById('prepcp').innerHTML == '') {
   document.getElementById('prepcp').innerHTML=\"<br><a href='#uptop'>Back to input <span style=cursor:pointer;text-decoration:underline; onclick=\\\"event.stopPropagation(); window.open('//pandoc.org/','blank','top=100,left=100,height=600,width=600');\\\">pandoc</span> document conversions that are not PDF ...</a><br><br>\"; 
   document.getElementById('ifpcp').style.display='block';
   document.getElementById('ifpcp').style.width='100%';
   document.getElementById('ifpcp').style.height='800px';
   }
   cbo.checked=false;
   location.href='#prepcp';
   }
   }

 
 function inform(iois) {
  if (iois) {
       inaconto = (iois.contentWindow || iois.contentDocument);
       if (inaconto != null) {
       if (inaconto.document) { inaconto = inaconto.document; }
       if (inaconto.body != null) {
         var spansare=inaconto.getElementsByTagName('span');
         for (var ijkh=0; ijkh<spansare.length; ijkh++) {
            if (spansare[ijkh].outerHTML.indexOf(' ondblclick=') != -1 && spansare[ijkh].outerHTML.indexOf(' onclick=') == -1) {
              if (spansare[ijkh].outerHTML.indexOf('install=') != -1) {
               spansare[ijkh].setAttribute('data-name', spansare[ijkh].outerHTML.split('install=')[1].split(\"'\")[0].split('\"')[0].split('&')[0]);
               if (spansare[ijkh].getAttribute('data-name') == 'pdfimages') {
                 spansare[ijkh].title+='   Click for Pdfimages information';
                 spansare[ijkh].onclick=function(event){ window.open('//www.xpdfreader.com/pdfimages-man.html', '_blank', 'top=150,left=150,height=500,width=500');  };
               } else {
                 //spansare[ijkh].title+='   Click for ' + event.target.getAttribute('data-name').substring(0,1).toUpperCase() + event.target.getAttribute('data-name').substring(1).toLowerCase() + ' information';
                 spansare[ijkh].title+='.   Click for ' + spansare[ijkh].outerHTML.split('install=')[1].split(\"'\")[0].split('\"')[0].split('&')[0].substring(0,1).toUpperCase() + spansare[ijkh].outerHTML.split('install=')[1].split(\"'\")[0].split('\"')[0].split('&')[0].substring(1).toLowerCase() + ' information';
                 spansare[ijkh].onclick=function(event){ window.open('//www.' + event.target.getAttribute('data-name') + '.org', '_blank', 'top=150,left=150,height=500,width=500');  };
               }
               //alert(spansare[ijkh].outerHTML.split('install=')[1].split(\"'\")[0].split('\"')[0].split('&')[0]);
              }
            }
         }
       }
       }
  }
  }
 
    </scr" . "ipt>
    </head><body onload=\" " . $wobit . " lhit(); if (window.opener) { window.opener.document.getElementById('dothework').style.height='80%';    window.opener.document.getElementById('dothework').style.display='block';  } else if (window.parent) { parent.document.getElementById('dothework').style.height='80%';    parent.document.getElementById('dothework').style.display='block'; } \"><p id=myp>" . yourfile_get_contents("macos_textutil_convert.err") . "</p><iframe style='width:100%;height:0px;display:none;' frameborder=0 name=dothework id=dothework src=macos_textutil_convert.php></iframe><div id=esmore></div><br><span id=prepcp></span><iframe onload=inform(this); id=ifpcp src=/PHP/php_calls_pdfimages.php style=display:none; style=width:100%;height:800px;display:" . $inaconto . ";></iframe><br><div id=divend style=width:100%;display:none;></div></body></html>";
    }
  } else {
    if (explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))] == 'html') {
    echo file_get_contents(yourstr_replace("+"," ",urldecode($_GET['outputname'])));
    } else {
    echo explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))];
    }
  }
  }
  }
  exit;
  }
} else if (isset($_POST['convertthis']) && isset($_POST['outputname'])) {
  if ($_POST['convertthis'] != "") {
  $thewords=str_replace("+"," ",urldecode($_POST['convertthis']));
  $thegoes=explode(",", $thewords);
  for ($indx=0; $indx<sizeof($thegoes); $indx++) {
    
  $rone="";
  $rtwo="";  
  
  if (file_exists(yourstr_replace("+"," ",urldecode($_POST['outputname'])))) {
    $sufext="_0";
    $iext=0;
    while (file_exists(yourstr_replace("+"," ",urldecode($_POST['outputname'])) . $sufext)) {
      $iext++;
      $sufext="_" . $iext;
    }
    $rtwo=yourstr_replace("+"," ",urldecode($_POST['outputname']));
    $rone=yourstr_replace("+"," ",urldecode($_POST['outputname'])) . $sufext;
    rename(yourstr_replace("+"," ",urldecode($_POST['outputname'])), yourstr_replace("+"," ",urldecode($_POST['outputname'])) . $sufext);
  }
  // pandoc -t pdf scjob.docx -o scjob.pdf
  $cmdsuff="";
  if ($verb != "textutil" && explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))] == "pdf") {
  if (file_exists("/Library/TeX/Root/bin/x86_64-darwin/pdflatex")) {
  $cmdsuff=" --pdf-engine=/Library/TeX/Root/bin/x86_64-darwin/pdflatex";
  } else if (file_exists("/Library/TeX/texbin/pdflatex")) {
  $cmdsuff=" --pdf-engine=/Library/TeX/texbin/pdflatex";
  } else {
  $cmdsuff=" --pdf-engine=" . $precmds . "pdflatex";
  }
  }
    //file_put_contents("macos_textutil_convertYES.out",$verb . "     " . "       " . $switchone . " " . explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))] . " " . ourstr_replace("+"," ",$thewords) . " " . $switchtwo . " " . yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err \n");

    if (isset($_POST['content'])) {
    //echo "yEs";
    //exit;
    $befbsf=str_replace(' ','+', urldecode($_POST['content']));
    //file_put_contents("macos_textutil_convertYES.oux", substr($befbsf,0,120));
    file_put_contents('/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))), base64_decode(explode(';base64,',$befbsf)[1]));
    //file_put_contents("xn.xn","$verb" . " " . $switchone . " " . explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))] . " \"" . '/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))) . "\" " . $switchtwo . " \"" . (yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err ; rm -f " . '/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))));
theecho("8:" . "$verb" . " " . $switchone . " " . explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))] . " \"" . '/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))) . "\" " . $switchtwo . " \"" . (yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err; rm -f " . '/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))));
//exit;
  exec("$verb" . " " . $switchone . switcheroo(" " . explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))] . " \"") . '/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))) . "\" " . $switchtwo . " \"" . (yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err; rm -f " . '/tmp/xx.' . inf(substr(explode(';base64,',$befbsf)[0], (-3 + strlen(explode(';base64,',$befbsf)[0])))));
  $mimt=explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))];
  //file_put_contents("abc.xzy",$mimt);
  if ($mimt == 'html' && file_exists(yourstr_replace("+"," ",big(urldecode($_POST['outputname']))))) {
  //file_put_contents("abc.xz2",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
     $ocontis=file_get_contents(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title></head><body>" . $ocontis . "</body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=110,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     } else {
       $oocontis="<html><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title>" . $hjit . "</head><body><div id=dhj><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe></div><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=210,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     }
  //file_put_contents("abc.xz3",$ocontis );
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );

     //echo "<html><body onload=\" " . $wobit . " \"></body></html>";   // might be temporary arrangement
     //exit;
  } else if ($mimt == "pdf") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))); $oocontis=$ocontis; 
     $inaconto="block";
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\"  src=\"data:application/pdf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=' + eval(-500 + screen.width) + ',top=10,width=500,height=400');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null;  document.getElementById('ifpcp').style.display='block';    document.getElementById('ifpcp').style.width='100%';   document.getElementById('ifpcp').style.height='800px'; inaconto.getElementById('path').value='/tmp/';  inaconto.getElementById('thewords').value='" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "';  inaconto.getElementById('mysbut').disabled=false; if (1 == 1) {  document.getElementById('pdfcb').click(); } else { location.href='#prepcp'; }  }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if (substr($mimt,0,3) == "rtf") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/rtf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if ($mimt == "odt") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.oasis.opendocument.text;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if (substr($mimt,0,3) == "doc") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if (str_replace('plain','txt',str_replace('text','txt',$mimt)) == "txt") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))); $oocontis=$ocontis; 
     $pltx=$ocontis;
     if (strpos($ocontis, '<body') !== false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",urldecode($_POST['outputname']))) . "</title>" . $jit . "</head><body onload=\"setTimeout(function(){ justit(document.getElementById('ifmy')); }, 5000);\"><iframe id=ifmy onload='justit(this);' style=\"width:100%;height:100%;\" src=\"data:text/html;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",urldecode($_POST['outputname']))) . "','left=310,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
       $wobit=" top.document.getElementById('dres').style.width='98%'; if (2 == 5) { top.document.getElementById('dres').style.height='30%'; } top.document.getElementById('dres').innerHTML='<iframe id=ifmy onload=top.justit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe>';      ";
       //file_put_contents("abc.xz4",$wobit );
     } else if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title></head><body><div>" . str_replace("\n","<br>",$ocontis) . "\"></div><br></body></html>";
       $wobit=" top.document.getElementById('dres').style.width='98%'; top.document.getElementById('dres').style.height='30%'; top.document.getElementById('dres').innerHTML='<textarea id=myta style=width:98%;height:98%;>' + window.atob('" . base64_encode($pltx) . "') + '</textarea>'; top.document.getElementById('myta').value=window.atob('" . base64_encode($pltx) . "');      ";
     }
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  }
    } else {
theecho("9:" . "$verb" . " " . $switchone . " \"" . explode(".",yourstr_replace("+"," ",urldecode($_POST['outputna $oocontis=$ocontis; me'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))] . "\" " . ourstr_replace("+"," ",$thewords) . " " . $switchtwo . " \"" . (yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");
//exit;
  exec("$verb" . " " . $switchone . switcheroo(" \"" . explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))] . "\" ") . ourstr_replace("+"," ",$thewords) . " " . $switchtwo . " \"" . (yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");

  $mimt=explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))];
  file_put_contents("abc.xzy",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
  if ($mimt == 'html' && file_exists(yourstr_replace("+"," ",big(urldecode($_POST['outputname']))))) {
  //file_put_contents("abc.xz2",yourstr_replace("+"," ",big(urldecode($_POST['outputname']))) );
     $ocontis=file_get_contents(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title></head><body>" . $ocontis . "</body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=410,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     } else {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title>" . $hjit . "</head><body><div id=dhj><iframe onload=hjustit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe></div><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=510,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
     }
  //file_put_contents("abc.xz3",$ocontis );
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );

     //echo "<html><body onload=\" " . $wobit . " \"></body></html>";   // might be temporary arrangement
     //exit;
  } else if ($mimt == "pdf") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\"  src=\"data:application/pdf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if (substr($mimt,0,3) == "rtf") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/rtf;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if ($mimt == "odt") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.oasis.opendocument.text;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if (substr($mimt,0,3) == "doc") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))); $oocontis=$ocontis; 
     if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title></head><body><iframe " . $alone . " style=\"width:100%;height:100%;\" src=\"data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
     }
     $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "','left=10,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  } else if (str_replace('plain','txt',str_replace('text','txt',$mimt)) == "txt") {
     $ocontis=file_get_contents(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))); $oocontis=$ocontis; 
     $pltx=$ocontis;
     if (strpos($ocontis, '<body') !== false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",urldecode($_POST['outputname']))) . "</title></head><body><iframe onload=window.opener.top.justit(this); style=\"width:100%;height:100%;\" src=\"data:text/html;base64," . base64_encode($ocontis) . "\"></iframe><br></body></html>";
       $wobit="  if (!wwoo) { wwoo=top.window.open('','" . basename(yourstr_replace("+"," ",urldecode($_POST['outputname']))) . "','left=610,top=10,width=500,height=500');  wwoo.document.write(window.atob('" . base64_encode($oocontis) . "'));  setTimeout(function(){ wwoo=null; }, 10000); }  ";
       $wobit=" top.document.getElementById('dres').style.width='98%'; if (2 == 5) { top.document.getElementById('dres').style.height='30%'; } top.document.getElementById('dres').innerHTML='<iframe id=ifmy onload=top.justit(this); style=width:100%;height:100%; srcdoc=data:text/html;base64," . base64_encode($ocontis) . "></iframe>';      ";
     } else if (strpos($ocontis, '<body') === false) {
       $oocontis="<html><head><meta charset='UTF-8'/><title>" . basename(yourstr_replace("+"," ",big(urldecode($_POST['outputname'])))) . "</title></head><body><div>" . str_replace("\n","<br>",$ocontis) . "\"></div><br></body></html>";
       $wobit=" top.document.getElementById('dres').style.width='98%'; top.document.getElementById('dres').style.height='30%'; top.document.getElementById('dres').innerHTML='<textarea id=myta style=width:98%;height:98%;>' + window.atob('" . base64_encode($pltx) . "') + '</textarea>'; top.document.getElementById('myta').value=window.atob('" . base64_encode($pltx) . "');      ";
     }
  //file_put_contents("abc.xz4",$wobit );
    file_put_contents("/tmp/wobit" . server_remote_addr() . ".xxx",$wobit );
  }


    }
  if (explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))] == "pdf") {
        $PDFfilename=yourstr_replace("+"," ",big(urldecode($_POST['outputname'])));
        $pdf = file_get_contents($PDFfilename);
        if ($okthen) {
        header('Content-Type: application/pdf');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($PDFfilename) .'";');
        ob_clean(); 
        flush(); 
        echo $pdf;  
        //exit; 
        }
  } else if (explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))] == "rtf") {
        $PDFfilename=yourstr_replace("+"," ",big(urldecode($_POST['outputname'])));
        if ($okthen) {
        $pdf = file_get_contents($PDFfilename);
        header('Content-Type: application/rtf');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($PDFfilename) .'";');
        ob_clean(); 
        flush(); 
        echo $pdf;  
        //exit; 
        }
  } else if (explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))] == "odt") {
        $PDFfilename=yourstr_replace("+"," ",big(urldecode($_POST['outputname'])));
        if ($okthen) {
        $pdf = file_get_contents($PDFfilename);
        header('Content-Type: application/odt');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($PDFfilename) .'";');
        ob_clean(); 
        flush(); 
        echo $pdf;  
        //exit; 
        }
  }
    file_put_contents('xvvv.xvvv',$outfis);
  sleep(60);
  if (file_exists("macos_textutil_convert.out") && file_exists("macos_textutil_convert.err")) {
    file_put_contents('xvvvv.xvvvv',$outfis);
    if (strpos(str_replace('onempty <title> element','xiting with status 0',file_get_contents("macos_textutil_convert.err")), 'xiting with status 0') !== false)
  if (filesize("macos_textutil_convert.out") == 0 && (strpos(str_replace('onempty <title> element','xiting with status 0',file_get_contents("macos_textutil_convert.err")), 'xiting with status 0') === false && filesize("macos_textutil_convert.err") != 0)) {
    file_put_contents('xvvvvx.xvvvvx',$outfis);
     if ($rone != "" && $rtwo != "") {
      rename($rone, $rtwo);
     }
    echo "<html>
    <head><meta charset='UTF-8'/>
    <title>Supervise pandoc or textutil Document Conversions - RJM Programming - January, 2025</title>
    <scr" . "ipt type=text/javascript>
      
  function worry() {
     if (document.getElementById('myta')) {
       if (document.getElementById('myta').value == '') {
        setTimeout(worry, 5000);
       } else {
        document.body.style.cursor='pointer';
       }
     } else {
       setTimeout(worry, 5000);
     }  
  }
  
  function oops(inidis) {
     if (inidis == 'hidden') {
       setTimeout(worry, 5000);
     }
     return inidis;
  }

   </scr" . "ipt></head>    
    <body onload=\" " . $wobit . " if (('' + location.hash).indexOf('content=') != -1) { document.getElementById('myp').style.visibility=oops('hidden');  } parent.document.getElementById('dothework').style.height='80%';  parent.document.getElementById('dothework').style.display='block'; \"><p id=myp>" . yourfile_get_contents("macos_textutil_convert.err") . "</p><br><div id=divend style=width:100%;display:none;></div></body></html>";
  } else if (isset($_POST['content']) && $outfis != '') {
    //sleep(20);
    file_put_contents('xv.xv',$outfis);
    if (file_exists($outfis)) {
      file_put_contents('xvv.xvv',"<html><head><scr" . "ipt type=text/javascript> function winopit() { var tow=top.window.open('','_blank','top=10,left=10,width=600,height=600'); tow.document.write(document.body.innerHTML); } setTimeout(winopit, 5000); </scr" . "ipt></head><body onload=winopit();>" . $resultof . "<textarea id=myta rows=50 cols=120>" . file_get_contents($outfis) . "</textarea><br><div id=divend style=width:100%;display:none;></div></body></html>");
      echo "<html><head><meta charset='UTF-8'/><title>Supervise pandoc or textutil Document Conversions - RJM Programming - January, 2025</title><scr" . "ipt type=text/javascript> function winopit() { if (window.opener) { window.opener.yesfivefive(document.body.innerHTML); } else { parent.yesfivefive(document.body.innerHTML);  if (parent.document.getElementById('toptext')) {   parent.document.getElementById('toptext').value=document.body.innerHTML.replace(/\</g,'&lt;').replace(/\>/g,'&gt;'); } else { var tow=parent.window.open('','_blank','top=10,left=10,width=600,height=600'); tow.document.write(document.body.innerHTML); } } } setTimeout(winopit, 5000); </scr" . "ipt></head><body onload=\" " . $woit . " winopit();\">" . str_replace('></div>','>' . str_replace("\n","<br>",$pltx) . '</div>',$resultof) . "<textarea id=myta rows=50 cols=120>" . file_get_contents($outfis) . "</textarea></body></html>";
    }
  }
  }
  }
  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 if (strtolower("~" . $extis, "~pdf") !== false) { // thanks to https://stackoverflow.com/questions/12730581/use-this-php-code-to-open-a-pdf-in-a-new-tab
        if (1 == 2) {
        $PDFfilename=str_replace("+"," ",big(urldecode($_GET['outputname'])));
        if ($okthen) {
        $pdf = file_get_contents($PDFfilename);
        header('Content-Type: application/pdf');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($PDFfilename) .'";');
        ob_clean(); 
        flush(); 
        echo $pdf; 
        }
        }
        exit;  
    } else if (strtolower("~" . $extis, "~rtf") !== false) { // thanks to https://stackoverflow.com/questions/12730581/use-this-php-code-to-open-a-pdf-in-a-new-tab
        if (1 == 1) {
        $PDFfilename=str_replace("+"," ",big(urldecode($_GET['outputname'])));
        if ($okthen) {
        $pdf = file_get_contents($PDFfilename);
        header('Content-Type: application/rtf');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($PDFfilename) .'";');
        ob_clean(); 
        flush(); 
        echo $pdf; 
        }
        } 
        exit; 
    } else {
    //echo explode(".",str_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",str_replace("+"," ",urldecode($_GET['outputname']))))];
    //exit;
    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 if (strtolower("~" . $extis, "~pdf") !== false) { // thanks to https://stackoverflow.com/questions/12730581/use-this-php-code-to-open-a-pdf-in-a-new-tab
        if (1 == 2) {
        $PDFfilename=str_replace("+"," ",big(urldecode($_POST['outputname'])));
        if ($okthen) {
        $pdf = file_get_contents($PDFfilename);
        header('Content-Type: application/pdf');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($PDFfilename) .'";');
        ob_clean(); 
        flush(); 
        echo $pdf; 
        }
        } 
        exit; 
    } else if (strtolower("~" . $extis, "~rtf") !== false) { // thanks to https://stackoverflow.com/questions/12730581/use-this-php-code-to-open-a-pdf-in-a-new-tab
        if (1 == 1) {
        $PDFfilename=str_replace("+"," ",big(urldecode($_POST['outputname'])));
        if ($okthen) {
        $pdf = file_get_contents($PDFfilename);
        header('Content-Type: application/rtf');
        header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Content-Length: ' . strlen($pdf));
        header('Content-Disposition: inline; filename="' . basename($PDFfilename) .'";');
        ob_clean(); 
        flush(); 
        echo $pdf; 
        }
        } 
        exit; 
    } else {
    //echo explode(".",str_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",str_replace("+"," ",urldecode($_POST['outputname']))))];
    //exit;
    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;
    }
    }
  }
  echo "<html>
<head>" . (strpos($title,'<') !== false ? $title : '') . "
<meta charset='UTF-8'/>
<script type='text/javascript'>
  var wwoo=null;
  var firstgo=true;
  var lastvalue='.html';
  var oktosub=true;
  var origemail='';
  var wowo=null;
  var ourwis='&wording=Pandoc%20document%2E%20';
  var avbit='" . $avbit . "', resbit=\"" . $resbit . "\"; 
  var wasv='';
  var inaconto=null, wqwq=null;
  var childtop=eval(-470 + eval('' + screen.height)), childleft=eval(-470 + eval('' + screen.width));
  var childwoos=[];
 
 function onc(event){ if (eval('' + event.target.innerHTML.length) >= eval('' + window.atob(event.target.getAttribute('data-smalltitle')).length) && eval('' + event.target.innerHTML.length) < eval('' + window.atob(event.target.getAttribute('data-bigtitle')).length)) { event.target.innerHTML=window.atob(event.target.getAttribute('data-bigtitle'));  } else {  event.target.innerHTML=window.atob(event.target.getAttribute('data-smalltitle'));    }  }

 function onr(event){ var wwwooo=window.open('','_blank','top=15,left=15,width=500,height=500'); wwwooo.document.write(window.atob(event.target.getAttribute('data-biggest')));  }
  
  function justit(iois) {
  var aconto=null;
  if (aconto == null) {
       aconto = (iois.contentWindow || iois.contentDocument);
       if (aconto != null) {
       if (aconto.document) { aconto = aconto.document; }
       if (aconto.body != null) {
         if (window.opener) {
          if (window.opener.top.document.getElementById('dres')) {
              window.opener.top.document.getElementById('dres').style.width='98%'; 
              window.opener.top.document.getElementById('dres').style.height='30%';
              window.opener.top.document.getElementById('dres').innerHTML=aconto.body.innerText;
           }
         } else if (aconto.body.innerHTML.indexOf(';base64,') != -1) {
           var wasais=aconto.body.innerHTML.split('\">')[0].split('>')[0];
           var wpg=window.atob(wasais.split(';base64,')[1]);
           top.document.getElementById('dres').setAttribute('data-biggest',wasais.split(';base64,')[1]);
           if (wpg.indexOf('<body') != -1) {
           aconto.body.innerHTML=wpg.split('<body' + wpg.split('<body')[1].split('>')[0] + '>')[1].split('</body>')[0];
           } else {
           aconto.body.innerHTML=wpg;
           }
           top.document.getElementById('dres').setAttribute('data-smalltitle',window.btoa(aconto.body.innerText));
           top.document.getElementById('dres').title='Click toggles whether line feeds show and right click opens HTML look';
           var newwasais=aconto.body.innerText;
           while (newwasais.indexOf(String.fromCharCode(10)) != -1) {
             newwasais=newwasais.replace(String.fromCharCode(10),'<br>');
           }
           top.document.getElementById('dres').innerHTML=newwasais; //aconto.body.innerText;
           top.document.getElementById('dres').setAttribute('data-bigtitle',window.btoa(newwasais));
           top.document.getElementById('dres').style.backgroundColor='white';
           top.document.getElementById('dres').onclick=function(evt){ if (eval('' + evt.target.innerHTML.length) >= eval('' + window.atob(evt.target.getAttribute('data-smalltitle')).length) && eval('' + evt.target.innerHTML.length) < eval('' + window.atob(evt.target.getAttribute('data-bigtitle')).length)) { evt.target.innerHTML=window.atob(evt.target.getAttribute('data-bigtitle'));  } else {  evt.target.innerHTML=window.atob(evt.target.getAttribute('data-smalltitle'));    }  };
           top.document.getElementById('dres').oncontextmenu=function(evt){ var wwwooo=window.open('','_blank','top=15,left=15,width=500,height=500'); wwwooo.document.write(window.atob(evt.target.getAttribute('data-biggest')));  };
         }
       }
       }
  }
  }
    
  function yesfivefive(restis) {
    document.getElemenetById('toptext').innerHTML=restis;
  }
  
  function checkformaybes() {
     var retval=true;
     var argd='?', argst='', contd='', resultof='Result of ...', optnfrom='youllneverfindthis', optnto='youllneverfindthis';
     resultof='Result of conversion of ' + document.getElementById('thewords').value + ' to ' +  document.getElementById('outputname').value.split(',')[eval(-1 + document.getElementById('outputname').value.split(',').length)] + ' ... ';
     resultof='Result of conversion to ' + document.getElementById('outputname').value.split(',')[eval(-1 + document.getElementById('outputname').value.split(',').length)] + ' ( via *.' + document.getElementById('thewords').value.split(',')[eval(-1 + document.getElementById('thewords').value.split(',').length)].split('.')[eval(-1 + document.getElementById('thewords').value.split(',')[eval(-1 + document.getElementById('thewords').value.split(',').length)].split('.').length)] + ' ) ' + document.getElementById('thewords').value + ' ... ';
     if ((('' + document.getElementById('maybee').value).replace(/^undefined/g,'') + ('' + document.getElementById('maybes').value).replace(/^undefined/g,'')) != '') {
        //document.getElementById('myform').method='GET';
        var things=document.getElementById('myform').innerHTML.split(' name=');
        var idthing='', namething='';
        for (var ith=1; ith<things.length; ith++) {
         namething=things[ith].split(' ')[0].split('>')[0].replace('\"','').replace('\"','').replace(/\'/g, '');
         idthing=namething.replace('convertto','cto').replace('outpath','opath').replace('inpath','path').replace('convertthis','thewords');
         if (namething == 'outputname') {
           optnfrom=encodeURIComponent(document.getElementById(namething).value);
           optnto=encodeURIComponent(document.getElementById(namething).value);
           //alert(optnto);
           if (document.getElementById(namething).value.indexOf(',') != -1) {
              optnto=encodeURIComponent(document.getElementById(namething).value.split(',')[1]);
           //alert(optnto);
           }
         }
         if (namething == 'content') {
         if (document.getElementById('content0')) {
         contd='#content=' + encodeURIComponent(document.getElementById('content0').value);
         } else if (!document.getElementById('content')) {
         var inps=document.getElementsByTagName('input');
         for (var jnps=0; jnps<inps.length; jnps++) {
            if (('' + inps[jnps].name) == 'content') {
         inps[jnps].id='content';  
         contd='#content=' + encodeURIComponent(document.getElementById('content').value);
            }
         }
         } else {
         contd='#content=' + encodeURIComponent(document.getElementById('content').value);
         }
         } else {
         if (!document.getElementById(idthing)) {   
         argst+=argd + namething + '=' + '';
         } else {
         if (namething == 'outputname') {
           optnfrom=encodeURIComponent(document.getElementById(namething).value);
           optnto=encodeURIComponent(document.getElementById(namething).value);
           //alert(optnto);
           if (document.getElementById(namething).value.indexOf(',') != -1) {
              optnto=encodeURIComponent(document.getElementById(namething).value.split(',')[1]);
         argst+=argd + namething + '=' + encodeURIComponent(document.getElementById(namething).value.split(',')[1]);
           //alert(optnto);
           } else {
         argst+=argd + namething + '=' + encodeURIComponent(document.getElementById(idthing).value);
           }
         } else {
         argst+=argd + namething + '=' + encodeURIComponent(document.getElementById(idthing).value);
         }
         }
         argd='&';
         }
        }
        //if (document.getElementById('maybee').value.indexOf('@') != -1) {
        //document.getElementById('dinhouse').innerHTML+=\"<a target=_top href='mailto:\" + document.getElementById('maybee').value + \"?subject=\" + encodeURIComponent(resultof) + \"&body=\" + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + argst.replace(/\&maybe/g,'&bemay') + contd) + \"' id=myes style=display:none;>Email</a>\";
        //} 
        //if (document.getElementById('maybes').value.trim() != '') {
        //alert('argst=' + argst);
        //document.getElementById('dinhouse').innerHTML+=\"<a target=_top href='sms:\" + document.getElementById('maybes').value.trim() + \"&body=\" + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + (argst.replace(/\%20/g,'+').replace(/\&maybe/g,'&bemay') + contd.replace(/^\JnK#/g,'&'))) + \"' id=msyes style=display:none;>SMS</a>\";
        //}
        var subjpref='';
        var toppref='_top';
        if (document.getElementById('maybes').value.trim() != '') {
        subjpref='For keeps ... ';
        toppref='_top';
        if (document.getElementById('maybee').value.indexOf('@') != -1) {
        document.getElementById('dinhouse').innerHTML+=\"<a data-onclick=\\\"setTimeout(function(){ document.getElementById('myes').click(); }, 3000);\\\" target=\" + toppref + \" href='sms:\" + document.getElementById('maybes').value.trim() + \"&body=\" + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + (argst.replace(/\%20/g,'+').replace(/\&maybe/g,'&bemay') + contd.replace(/^\JnK#/g,'&'))) + \"' id=msyes style=display:none;>SMS</a>\";
        } else {
        document.getElementById('dinhouse').innerHTML+=\"<a target=\" + toppref + \" href='sms:\" + document.getElementById('maybes').value.trim() + \"&body=\" + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + (argst.replace(/\%20/g,'+').replace(/\&maybe/g,'&bemay') + contd.replace(/^\JnK#/g,'&'))) + \"' id=msyes style=display:none;>SMS</a>\";
        }
        toppref='_top';
        }
        if (document.getElementById('maybee').value.indexOf('@') != -1) {
        document.getElementById('dinhouse').innerHTML+=\"<a target=\" + toppref + \" href='mailto:\" + document.getElementById('maybee').value + \"?subject=\" + encodeURIComponent(subjpref + resultof) + \"&body=\" + encodeURIComponent(document.URL.split('?')[0].split('#')[0] + argst.replace(/\&maybe/g,'&bemay') + contd) + \"' id=myes style=display:none;>Email</a>\";
        } 
        if (document.getElementById('myes') || document.getElementById('msyes')) {
        //alert(document.getElementById('myes').href);
        if (document.getElementById('myes')) {
        if (window.opener) {
        window.opener.document.getElementById('wophelp').href=document.getElementById('myes').href;
        window.opener.document.getElementById('wophelp').click();
        } else {
        document.getElementById('myes').click();
        }
        }
        if (document.getElementById('msyes')) {
        if (document.getElementById('myes')) {
        //document.getElementById('myform').target='_blank';
        retval=false;
        } else {
        if (window.opener) {
        window.opener.document.getElementById('wophelp').href=document.getElementById('msyes').href;
        window.opener.document.getElementById('wophelp').click();
        } else {
        document.getElementById('msyes').click();
        }
        }
        }
        document.getElementById('maybee').value='';
        document.getElementById('maybes').value='';
        document.getElementById('maybee').name='mayjunkbee';
        document.getElementById('maybes').name='mayjunkbes';
        } //else {
        //alert(document.URL.split('?')[0].split('#')[0] + argst + contd);
        //}
        //location.href=document.URL.split('?')[0].split('#')[0] + argst + contd; //'?outputname=' + encodeURIComponent(document.getElementById('outputname').value)
        //return false;
        document.getElementById('myform').method='POST';
        document.getElementById('myform').action=document.URL.split('?')[0].split('#')[0] + contd;
     }
     if (!retval) {
                document.body.style.cursor='crosshair'; 
                document.getElementById('ifsubmit').disabled=true;
                document.getElementById('myes').target='_top';
        setTimeout(function(){
           if (1 == 1) {
                if (4 == 4) {
                   setTimeout(wqwqlook, 3000);
                   var ifb=document.getElementById('ifsubmit').getBoundingClientRect();
                   wqwq=window.open('','_blank','top=' + ifb.top + ',left=' + ifb.left + ',width=' + ifb.width + ',height=' + eval(2 * eval('' + ifb.height)));
                   wqwq.document.write(\"<html><body data-onload=\\\" var xcv=confirm('Ready to send SMS?'); if (xcv) {          if (window.opener) { window.opener.document.getElementById('wophelp').href=document.getElementById('msyes').href; window.opener.document.getElementById('wophelp').click(); } else { document.getElementById('msyes').click(); }  window.opener.focus(); if (45 == 67) { window.opener.document.getElementById('ifsubmit').click(); } }\\\">\" + document.getElementById('msyes').outerHTML.replace('none','block').replace(\"<a \", \"<a onclick='setTimeout(function(){ window.close(); }, 20000);' \") + \"</body></html>\");
                }
                //document.getElementById('myes').click();
                //document.getElementById('ifsubmit').click();
           }
        }, 20000);
        //retval=true;
     }
     if (retval) {
         document.getElementById('ifsubmit').disabled=true;
         document.getElementById('ifesubmit').disabled=true;
     }
     return retval;
  }
  
  function wqwqlook() {
     if (wqwq) {
       if (wqwq.closed) {
         wqwq=null;
         document.getElementById('ifsubmit').disabled=false;
         document.body.style.cursor='progress'; 
         document.getElementById('ifsubmit').click();
       } else {
         setTimeout(wqwqlook, 3000);
       }
     }
  }
  
  function oldshareit() {
     var recipient=prompt('Please enter an email address and/or SMS number to send results to (ie. comma separated as required)?  Email is preferred because the output file might be recreateable way down the track if the recipient retains the email, with the link, and wants to click that link to recreate that output file again themselves without the originator getting involved again.', '');
     if (recipient != null) {
       if (('' + recipient).trim() != '') {
        if (('' + recipient).trim().indexOf('@') != -1) {
          document.getElementById('maybee').value=('' + recipient).trim();
          document.getElementById('ifsubmit').click();
        } else if (('' + recipient).trim().replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '') {
          document.getElementById('maybes').value=('' + recipient).trim();
          document.getElementById('ifsubmit').click();
        }
       }
     }
  }
  
  function shareit() {
     var doc=false, idoc=0, bigrecipient='';
     var recipient=prompt('Please enter an email address and/or SMS number to send results to (ie. comma separated as required)?  Email is preferred because the output file might be recreateable way down the track if the recipient retains the email, with the link, and wants to click that link to recreate that output file again themselves without the originator getting involved again.', '');
     if (recipient != null) {
       if (('' + recipient).trim() != '') {
        var rwords=('' + recipient).trim().split(',');
        if (('' + recipient).trim().indexOf('@') != -1) {
          document.body.style.cursor='progress';
          doc=true;
          if (eval('' + rwords.length) > 1) {
          for (idoc=0; idoc<rwords.length; idoc++) {
            if (rwords[idoc].indexOf('@') != -1) {
               recipient=(',' + recipient).replace(',' + rwords[idoc] + ',', ',').replace(',' + rwords[idoc] + '', '').replace(/^\,/g,'');
               if (bigrecipient == '') {
                 bigrecipient=rwords[idoc];
               } else {
                 bigrecipient+=',' + rwords[idoc];
               }
            }
          }
          document.getElementById('maybee').value=('' + bigrecipient).trim();
          } else {
          document.getElementById('maybee').value=('' + recipient).trim();
          }
          //document.getElementById('ifsubmit').click();
        } 
        if (('' + recipient).trim().replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '') {
          document.body.style.cursor='progress';
          doc=true;
          document.getElementById('maybes').value=('' + recipient).trim();
          //document.getElementById('ifsubmit').click();
        }
        if (doc) { document.getElementById('ifsubmit').click();  }
       }
     }
  }
  
  function yesthreethree(restis) {
   if (document.getElementById('ifesubmit')) {
    if (document.getElementById('ifsubmit')) {
      document.getElementById('ifsubmit').style.width='48%';
      document.getElementById('ifesubmit').style.display='inline-block';
    }
   }
   if (document.getElementById('content0')) {
   //alert(restis);
    document.getElementById('content0').value=restis;
    //alert('467 ' + restis);
   }
   if (document.getElementById('dinhouse')) {
   //alert(restis);
    document.getElementById('dinhouse').innerHTML+='<div id=divcontent><input type=hidden name=infname value=\"' + document.getElementById('thewords').value + '\"></input><input type=hidden name=content value=\"' + restis + '\"></input><input type=hidden name=maybee id=maybee value=\"\"></input><input type=hidden name=maybes id=maybes value=\"\"></input>';
    //setTimeout(function(){ document.getElementById('divcontent').innerHTML='';   }, 20000);
    //alert('1467 ' + document.getElementById('dinhouse').innerHTML);
   }
  }
  
  function yes_three_three(restis, rstis, nmis) {
  //alert('Yes45 ' + rstis);
   if (rstis != '') {
   document.getElementById('outputname').value=document.getElementById('thewords').value.split('.')[0] + '.html';
   childwoos.push(window.open(document.URL.split('?')[0].split('#')[0] + '?foneile=' + encodeURIComponent(nmis) + '#' + encodeURIComponent(restis), '_blank', 'top=' + childtop + ',left=' + childleft + ',width=470,height=470'));
   childtop-=10;
   childleft-=10;
   if (document.getElementById('divend')) {
     if (document.getElementById('divend').innerHTML == '') {
       document.getElementById('divend').innerHTML='<a target=_top id=wophelp style=display:none; href=#>Email or SMS</a>';
     }
   }
   } else {
   if (document.getElementById('ifesubmit')) {
    if (document.getElementById('ifsubmit')) {
      document.getElementById('ifsubmit').style.width='48%';
      document.getElementById('ifesubmit').style.display='inline-block';
    }
   }
   if (document.getElementById('content0')) {
   //alert(restis);
    document.getElementById('content0').value=restis;
    //alert('467 ' + restis);
   }
   if (document.getElementById('dinhouse')) {
   //alert(restis);
    document.getElementById('dinhouse').innerHTML+='<div id=divcontent><input type=hidden name=infname value=\"' + document.getElementById('thewords').value + '\"></input><input type=hidden name=content value=\"' + restis + '\"></input><input type=hidden name=maybee id=maybee value=\"\"></input><input type=hidden name=maybes id=maybes value=\"\"></input>';
    //setTimeout(function(){ document.getElementById('divcontent').innerHTML='';   }, 20000);
    //alert('1467 ' + document.getElementById('dinhouse').innerHTML);
   }
   }
  }
  
  function notwotwo() {
  }
  
  function setoe() {
  localStorage.setItem('macos_textutil_convert', encodeURIComponent(origemail));
  }

  
  function worry() {
     if (document.getElementById('myta')) {
       if (document.getElementById('myta').value == '') {
        setTimeout(worry, 5000);
       } else {
        document.body.style.cursor='pointer';
       }
     } else {
       setTimeout(worry, 5000);
     }  
  }
  
  function oops(inidis) {
     if (inidis == 'hidden') {
       setTimeout(worry, 5000);
     }
     return inidis;
  }
  
  function lhit() {
  var afi='';
  " . $curt . "
  if (('' + location.hash).indexOf('content=') != -1) {
   if (document.getElementById('myp')) { document.body.style.cursor='progress'; document.getElementById('myp').style.visibility=oops('hidden');  }
  //alert(256);
     var inna=decodeURIComponent(('' + location.hash).split('content=')[1].split('&')[0].split('#')[0]);
     if (document.getElementById('thewords').value == '') {
        if (inna.indexOf('data:') == 0) {
          inna=inna.replace(/\ /g,'+');
          document.getElementById('thewords').value='xx.' + inna.split('/')[1].split(';')[0].split(',')[0].replace('plain','txt');
          document.getElementById('thewords').blur();
        } else {
          document.getElementById('thewords').value=inna;
          document.getElementById('thewords').blur();
        }
     }
     yesthreethree(inna);
  } else if (('' + location.hash).replace(/^\#/g,'').indexOf('data') == 0) {
  afi=location.search.split('foneile=')[1] ? decodeURIComponent(location.search.split('foneile=')[1].split('&')[0].split('#')[0]) : '';
  if (afi != '') { document.getElementById('audioname').value=afi;  document.getElementById('thewords').value=afi; document.getElementById('outputname').value='' + afi.split('.')[0] + '.html';  firstgo=false; }
  //document.getElementById('resultout').innerHTML=decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+');
  yesthreethree(decodeURIComponent(('' + location.hash).replace(/^\#/g,'')).replace(/\ /g,'+'));
  } else if (('' + document.URL).indexOf('#data') != -1) {
  afi=location.search.split('foneile=')[1] ? decodeURIComponent(location.search.split('foneile=')[1].split('&')[0].split('#')[0]) : '';
  if (afi != '') { document.getElementById('audioname').value=afi;  document.getElementById('thewords').value=afi; document.getElementById('outputname').value+='' + afi.split('.')[0] + '.html';  firstgo=false;  }
  //document.getElementById('resultout').innerHTML=decodeURIComponent(('' + document.URL).split('#data')[1]).replace(/\ /g,'+');
  yesthreethree(decodeURIComponent(('' + document.URL).split('#data')[1]).replace(/\ /g,'+'));
  }
  }

  function getoe() {
  " . $wobit . "
  " . $curt . "
  //alert(56);
  var eeeis=decodeURIComponent(('' + localStorage.getItem('macos_textutil_convert')).replace(/^null$/g,''));
  if (eeeis != '') { 
    origemail=eeeis; 
    if (document.getElementById('bdiv')) { document.getElementById('bdiv').innerHTML=origemail; } 
    if (document.getElementById('preaemail')) { document.getElementById('preaemail').innerHTML=origemail; } 
  }
  lhit();
  }
  
  function ots() {
    oktosub=true;
  }
  
  function dforb(evt) {
  evt.stopPropagation(); 
  if (oktosub) { document.getElementById('ifsubmit').click();  document.getElementById('myform').style.cursor='progress'; document.body.style.cursor='progress';  }
  return false;
  }
  
  function ddforb(evt) {
  evt.stopPropagation(); 
  if (oktosub) { document.getElementById('ifsubmit').click();  document.getElementById('myform').style.cursor='progress'; document.body.style.cursor='progress';  }
  return false;
  }
  
  function getask(defv, force) {
  if (defv.indexOf('@') != -1 && !force) {
  return defv;
  } else {
  var eee=prompt('Email to?',defv); 
  if (eee == null) { 
   eee=''; 
  } 
  if (eee.indexOf('@') != -1) { origemail=eee; setoe(); }
  return eee;
  }
  }
  
  function aonclick(evt) {
  evt.stopPropagation(); 
  athis=evt.target;
  oktosub=false; 
  var ee=getask(athis.innerHTML.replace('&nbsp;',''), true);
  if (ee != '') { 
   athis.innerHTML=ee.trim();  
  } 
  if (ee.indexOf('@') != -1) { 
   origemail=ee;
   oktosub=true; 
   document.getElementById('ifsubmit').click();   
  } else { 
   setTimeout(ots, 1000); 
  }
  return false;
  }
  
  function donblur(dthis) {
  oktosub=false; 
  var ee=dthis.innerHTML; 
  if (ee == null) { 
   ee=''; 
  } 
  if (ee != '') { 
   dthis.innerHTML=ee.trim();  
  } 
  if (ee.indexOf('@') != -1) { 
   if (ee != origemail) {
   oktosub=true; 
   origemail=ee;
   setoe();
   document.getElementById('ifsubmit').click();   
   }
  } else { 
   setTimeout(ots, 1000); 
  }
  }
  
  function domo(evt) {
  evt.stopPropagation(); 
  oktosub=false;
  return false;
  }
  
  function domout(evt) {
  evt.stopPropagation(); 
  oktosub=true;
  return false;
  }
  
  function ionclick(evt) {
  evt.stopPropagation(); 
  oktosub=false;
  return false;
  }
  
  function onf(evt) {
  evt.stopPropagation(); 
  oktosub=false;
  origemail=' ';
  }
  
  function tsuper() {
  if (document.getElementById('thsuperfluous')) { document.getElementById('thsuperfluous').style.visibility='hidden';    }
  if (document.getElementById('tdsuperfluous')) { document.getElementById('tdsuperfluous').style.visibility='hidden';    }
  }

  function woit() {
    var lf=100,tpq=100;
    for (var ij=0; ij<document.getElementById('thewords').value.split(',').length; ij++) {
    window.open(document.URL.split('?')[0].split('#')[0] + '?outputname=' + encodeURIComponent(document.getElementById('outputname').value.split(',')[ij]) + '&inpath=' + encodeURIComponent(document.getElementById('path').value) + '&outpath=' + encodeURIComponent(document.getElementById('opath').value) + '&convertthis=' + encodeURIComponent(document.getElementById('thewords').value.split(',')[ij]),'_blank','top=' + tpq + ',left=' + lf + ',width=500,height=500');
    lf+=20;
    tpq+=20;
    }
  }

  function thenreload() {
    location.href=document.URL.split('?')[0].split('#')[0] + '?outputname=' + encodeURIComponent(document.getElementById('outputname').value) + '&inpath=' + encodeURIComponent(document.getElementById('path').value) + '&outpath=' + encodeURIComponent(document.getElementById('opath').value) + '&dummyconvertthis=' + encodeURIComponent(document.getElementById('thewords').value);
  }
  
  function resultchange() {
    var newwo=null;
    if (document.getElementById('dbwithlf')) { document.getElementById('ifsubmit').style.display='none'; }
    if (('' + document.getElementById('resultout').value).replace(/^undefined/g,'') == '') {
    setTimeout(resultchange, 2000);
    } else if (firstgo) {
    alert(document.getElementById('resultout').value);
    firstgo=false;
    setTimeout(resultchange, 6000);
    } else if (window.opener && document.URL.indexOf('outpath=') == -1) {
    } else if (window.opener && document.URL.indexOf('outpath=') != -1) {
    if (document.URL.split('outpath=')[1].indexOf('html') != -1) {
      newwo=window.open('','_blank','left=200,top=200,width=300,height=300');
      newwo.document.write(document.getElementById('resultout').value);
    }
    }
  }
  
  function selch(thisvalue) {
    if (lastvalue != '.*') {
     while (document.getElementById('outputname').value.indexOf(lastvalue) != -1) {
      document.getElementById('outputname').value=document.getElementById('outputname').value.replace(lastvalue, '.*');
     }
    }
    document.getElementById('outputname').value=document.getElementById('outputname').value.replace(/\.\*/g,'.' + thisvalue);
    lastvalue='.' + thisvalue;
    document.getElementById('cbi').src=document.getElementById('cbi').src.split('#')[0].split('?')[0] + '?totype=' + encodeURIComponent(thisvalue.replace('*','html')) + '&d=' + Math.floor(Math.random() * 19876543);
  }
  
  function filespecit(iois) {
  var aconto=null;
  if (aconto != null) {
       aconto = (iois.contentWindow || iois.contentDocument);
       if (aconto != null) {
       if (aconto.document) { aconto = aconto.document; }
       if (aconto.body != null) {
         iois=iois;
       }
       }
  }
  }
 
 function onc(event){ if (eval('' + event.target.innerHTML.length) >= eval('' + window.atob(event.target.getAttribute('data-smalltitle')).length) && eval('' + event.target.innerHTML.length) < eval('' + window.atob(event.target.getAttribute('data-bigtitle')).length)) { event.target.innerHTML=window.atob(event.target.getAttribute('data-bigtitle'));  } else {  event.target.innerHTML=window.atob(event.target.getAttribute('data-smalltitle'));    }  }

 function onr(event){ var wwwooo=window.open('','_blank','top=15,left=15,width=500,height=500'); wwwooo.document.write(window.atob(event.target.getAttribute('data-biggest')));  }
  
  function justit(iois) {
  var aconto=null;
  if (aconto == null) {
       aconto = (iois.contentWindow || iois.contentDocument);
       if (aconto != null) {
       if (aconto.document) { aconto = aconto.document; }
       if (aconto.body != null) {
         if (window.opener) {
          if (window.opener.top.document.getElementById('dres')) {
              window.opener.top.document.getElementById('dres').style.width='98%'; 
              window.opener.top.document.getElementById('dres').style.height='30%';
              window.opener.top.document.getElementById('dres').innerHTML=aconto.body.innerText;
           }
         } else if (aconto.body.innerHTML.indexOf(';base64,') != -1) {
           var wasais=aconto.body.innerHTML.split('\">')[0].split('>')[0];
           var wpg=window.atob(wasais.split(';base64,')[1]);
           top.document.getElementById('dres').setAttribute('data-biggest',wasais.split(';base64,')[1]);
           if (wpg.indexOf('<body') != -1) {
           aconto.body.innerHTML=wpg.split('<body' + wpg.split('<body')[1].split('>')[0] + '>')[1].split('</body>')[0];
           } else {
           aconto.body.innerHTML=wpg;
           }
           top.document.getElementById('dres').setAttribute('data-smalltitle',window.btoa(aconto.body.innerText));
           top.document.getElementById('dres').title='Click toggles whether line feeds show and right click opens HTML look';
           var newwasais=aconto.body.innerText;
           while (newwasais.indexOf(String.fromCharCode(10)) != -1) {
             newwasais=newwasais.replace(String.fromCharCode(10),'<br>');
           }
           top.document.getElementById('dres').innerHTML=newwasais; //aconto.body.innerText;
           top.document.getElementById('dres').setAttribute('data-bigtitle',window.btoa(newwasais));
           top.document.getElementById('dres').style.backgroundColor='white';
           top.document.getElementById('dres').onclick=function(evt){ if (eval('' + evt.target.innerHTML.length) >= eval('' + window.atob(evt.target.getAttribute('data-smalltitle')).length) && eval('' + evt.target.innerHTML.length) < eval('' + window.atob(evt.target.getAttribute('data-bigtitle')).length)) { evt.target.innerHTML=window.atob(evt.target.getAttribute('data-bigtitle'));  } else {  evt.target.innerHTML=window.atob(evt.target.getAttribute('data-smalltitle'));    }  };
           top.document.getElementById('dres').oncontextmenu=function(evt){ var wwwooo=window.open('','_blank','top=15,left=15,width=500,height=500'); wwwooo.document.write(window.atob(evt.target.getAttribute('data-biggest')));  };
         }
       }
       }
  }
  }
 
 function assessit(tv) {
  if (tv.indexOf('*') != -1 || tv.indexOf('%') != -1 || tv.indexOf('$') != -1) {
    document.getElementById('globit').src=document.URL.split('#')[0].split('?')[0] + '?globit=' + encodeURIComponent(tv) + '&globpath=' + encodeURIComponent(document.getElementById('path').value) + '&globext=' + encodeURIComponent(document.getElementById('cto').value.replace('*','html'));
  } else if (tv.indexOf(',') == -1) {
    document.getElementById('outputname').value=tv.split('.')[0] + '.' + document.getElementById('cto').value.replace('*','html').replace('.','');
  }
 }
 
 function askee() {
   var msg='';
   if (document.getElementById('thewords').value.trim() != '' && document.getElementById('outputname').value.trim() != '') {
   var ee=prompt('Please enter your emailee address.','');
   if (ee == null) { ee=''; }
   if (ee.indexOf('@') != -1) {
     var inps=document.getElementsByTagName('input');
     for (var iii=0; iii<inps.length; iii++) {
     if (('~' + ('' + inps[iii].name) + '~').indexOf('to~') != -1 || ('~' + ('' + inps[iii].name) + '~').indexOf('~to') != -1) {
       inps[iii].value=ee;
     } else if (('~' + ('' + inps[iii].name) + '~').indexOf('subject~') != -1 || ('~' + ('' + inps[iii].name) + '~').indexOf('~subject') != -1) {
       //alert('lastvalue=' + lastvalue + ' and inps[iii].value=' + inps[iii].value + ' AND ' + document.getElementById('cto').value.toLowerCase()); 
       // lastvalue=.gif and inps[iii].value=0000__1-Arial_12pxnormal.pdf downloadable ready for your inhouse .pdf to .html conversions, sent to you (for you to download) as convert_audiovideo_please_html_0000__1-Arial_12pxnormal.pdf AND gif
       inps[iii].value=inps[iii].value.replace('_*_','_html_').replace('.* ','.html ');;
       if (inps[iii].value.indexOf('_html_') != -1 && document.getElementById('cto').value.toLowerCase().replace('.','') != 'html') {
          inps[iii].value=inps[iii].value.replace('_html_', '_' + document.getElementById('cto').value.toLowerCase() + '_').replace('.html ', '.' + document.getElementById('cto').value.toLowerCase() + ' ');
       } else if (inps[iii].value.indexOf(lastvalue.replace('.','_') + '_') != -1 && lastvalue.replace('.','') != document.getElementById('cto').value.replace('.','')) {
          inps[iii].value=inps[iii].value.replace(lastvalue.replace('.','_') + '_', '_' + document.getElementById('cto').value.toLowerCase() + '_').replace(lastvalue + ' ', '.' + document.getElementById('cto').value.toLowerCase() + ' ');
       } 
     } else if (('' + inps[iii].type).toLowerCase().indexOf('submit') != -1 && ('' + inps[iii].id).toLowerCase().indexOf('ifsubmit') == -1) {
       inps[iii].click();
       if (msg == '') {
         msg='Email sent';
       } else {
         msg='Emails sent';
       }
     }
     }
   }
   }
   document.getElementById('myform').style.cursor='pointer'; 
   document.body.style.cursor='pointer';    
   if (msg != '') {
     alert(msg + ' to ' + ee);
   }
 }
 
   function pcpon(cbo) {
   if (cbo.checked) {
   if (document.getElementById('prepcp').innerHTML == '') {
   document.getElementById('prepcp').innerHTML=\"<br><a href='#uptop'>Back to input Pandoc document conversions that are not PDF ...</a><br><br>\"; 
   document.getElementById('prepcp').innerHTML=\"<br><a href='#uptop'>Back to input <span style=cursor:pointer;text-decoration:underline; onclick=\\\"event.stopPropagation(); window.open('//pandoc.org/','blank','top=100,left=100,height=600,width=600');\\\">pandoc</span> document conversions that are not PDF ...</a><br><br>\"; 
   document.getElementById('ifpcp').style.display='block';
   document.getElementById('ifpcp').style.width='100%';
   document.getElementById('ifpcp').style.height='800px';
   }
   cbo.checked=false;
   location.href='#prepcp';
   }
   }
 
 function inform(iois) {
  if (iois) {
       inaconto = (iois.contentWindow || iois.contentDocument);
       if (inaconto != null) {
       if (inaconto.document) { inaconto = inaconto.document; }
       if (inaconto.body != null) {
         var spansare=inaconto.getElementsByTagName('span');
         for (var ijkh=0; ijkh<spansare.length; ijkh++) {
            if (spansare[ijkh].outerHTML.indexOf(' ondblclick=') != -1 && spansare[ijkh].outerHTML.indexOf(' onclick=') == -1) {
              if (spansare[ijkh].outerHTML.indexOf('install=') != -1) {
               spansare[ijkh].setAttribute('data-name', spansare[ijkh].outerHTML.split('install=')[1].split(\"'\")[0].split('\"')[0].split('&')[0]);
               if (spansare[ijkh].getAttribute('data-name') == 'pdfimages') {
                 spansare[ijkh].title+='   Click for Pdfimages information';
                 spansare[ijkh].onclick=function(event){ window.open('//www.xpdfreader.com/pdfimages-man.html', '_blank', 'top=150,left=150,height=500,width=500');  };
               } else {
                 //spansare[ijkh].title+='   Click for ' + event.target.getAttribute('data-name').substring(0,1).toUpperCase() + event.target.getAttribute('data-name').substring(1).toLowerCase() + ' information';
                 spansare[ijkh].title+='.   Click for ' + spansare[ijkh].outerHTML.split('install=')[1].split(\"'\")[0].split('\"')[0].split('&')[0].substring(0,1).toUpperCase() + spansare[ijkh].outerHTML.split('install=')[1].split(\"'\")[0].split('\"')[0].split('&')[0].substring(1).toLowerCase() + ' information';
                 spansare[ijkh].onclick=function(event){ window.open('//www.' + event.target.getAttribute('data-name') + '.org', '_blank', 'top=150,left=150,height=500,width=500');  };
               }
               //alert(spansare[ijkh].outerHTML.split('install=')[1].split(\"'\")[0].split('\"')[0].split('&')[0]);
              }
            }
         }
       }
       }
  }
  }

 function mnm(iois) {
  var aconto=null;
  if (aconto == null) {
       aconto = (iois.contentWindow || iois.contentDocument);
       if (aconto != null) {
       if (aconto.document) { aconto = aconto.document; }
       if (aconto.body != null) {
        if ('" . $mult . "' == '') {
         aconto.getElementById('files').removeAttribute('multiple');
        }
       }
       }
  }
  }

</script>
</head>" . (strpos($title,'<') !== false ? $title : '') . "
<style>
  input[type=text] { background-color: #f0f0f0;  border-radius: 5px; }
  input[type=submit] { font-size: 18px; border-radius: 20px; }
  button { font-size: 18px; border-radius: 20px; }
  div[contenteditable=true] { font-size: 14px; border-radius: 5px; }
  table { border-radius: 25px; }
</style>
<body onload=\" " . $wobit . " getoe(); " . $onl . " resultchange();\" style=\"background: linear-gradient(to left, #ffffff 40%, #ffefba 60%); \">
<br><h1 id=uptop>Supervise <span id=sverb" . (trim($panplus) != '' ? " style=cursor:pointer;text-decoration:none; title=\"Click for Pandoc information\" onclick=\"window.open('//pandoc.org/','blank','top=100,left=100,height=600,width=600');\">" . $panplus . "</span><span title=\"Click for Textutil (on macOS via MAMP perhaps) information\" style=cursor:pointer;text-decoration:none; onclick=\"window.open('//ss64.com/mac/textutil.html','_blank','top=120,left=120,width=400,height=400');\">" : '>' . $panplus) . "textutil</span> Document Conversions</h1>
<h3>RJM Programming - July, 2020</h3>
" . $outfileis . "
<form accept-charset='UTF-8' id=myform onsubmit=\" if (!checkformaybes()) {  return false;  } if (document.getElementById('ifsubmit').value.indexOf('mail ') != -1) { setTimeout(askee,9000); return false; } else { if (document.getElementById('thewords').value.indexOf(',') != -1) {  woit(); return false; } else { document.getElementById('myform').style.cursor='progress'; document.body.style.cursor='progress'; setTimeout(thenreload,20000); return true; } }\" target=dothework action=./macos_textutil_convert.php method=POST><div id=dinhouse></div>
<table border=20 style='width:98%;' cellspacing=5 cellpadding=5>
<tr><th style='background-color:lightgreen;'>Input Document File" . $plurals . " <span id=sin style=display:none;>in</span> <input name=inpath style=display:inline-block;width:60%; type=text id=path value='' placeholder='Optional input path'></input></th><th><select onchange=\" selch(this.value);  \" style=display:inline-block; name=convertto id=cto>
<option value='*'>Convert to</option> 
<option value='txt'>Convert to txt</option>  
<option value='rtf'>Convert to rtf</option> 
<!--option value='rtfd'>Convert to rtfd</option--> 
<option value='html'>Convert to html</option>  
<!--option value='doc'>Convert to doc</option-->  
<option value='docx'>Convert to docx</option> 
<option value='odt'>Convert to odt</option> 
<!--option value='wordml'>Convert to wordml</option> 
<option value='webarchive'>Convert to webarchive</option--> 
<option value='pdf'>Convert to pdf</option> 
</select>&nbsp;<input name=outpath style=display:inline-block;width:30%; type=text id=opath value='" . $opth . "' placeholder='Optional output path'></input> <input style='width:40%;' onblur=\"if (document.URL.toLowerCase().indexOf('" . $rjm . "') != -1) { this.value=''; } if (this.value.toLowerCase().indexOf('.pdf') != -1) { document.getElementById('myform').target='_blank';   }  \" placeholder='Output document file" . $plurals . "' type=text name=outputname id=outputname value=''></input></div>&nbsp;</th></tr>
<tr><td style='vertical-align:top;background-color:lightgreen;'><input type=text onblur=\"if (document.URL.toLowerCase().indexOf('" . $rjm . "') != -1) { this.value=''; } else { assessit(this.value); }\" style='width:90%;' placeholder='Input document file" . $plurals . "' id=thewords name=convertthis  value=''></input><br><br><sup>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;or" . $cself . "&nbsp;...&nbsp;</sup><div style='display:inline-block;width:95px;height:30px;overflow:hidden;vertical-align:text-bottom;'><iframe onload=mnm(this); scrolling=no frameborder=0 id=cbi data-style='border-top:1px solid black;border-bottom:1px solid black;border-left:2px solid yellow;border-right:1px solid yellow;' style='width:173px;height:228px;margin-top:-194px;' src='HTMLCSS/client_browsing.htm?totype=html&d=" . rand(0,18765432) . "'></iframe></div><br><br><sup>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;or" . $cself . "&nbsp;...&nbsp;</sup><input id=pdfcb type=checkbox onchange=pcpon(this);>PDF</input></td><td style=vertical-align:top;><div id=dforbutton>" . $divinfront . "</div><input id=ifsubmit style='width:100%;height:100px;background-color:yellow;' type=submit value='" . $cvse . " Document" . $plurals . "'></input>&nbsp;<input onclick=shareit(); id=ifesubmit style='width:48%;height:100px;background-color:lightblue;display:none;' type=button value='" . $cvse . " Document" . $plurals . " to Recipient'></input><br><div id=resultout>" . str_replace("\n","<br>",$thecontent) . "</div></td></tr>
</table>
<div id=dmaybe></div>
</form>
<iframe style='width:100%;height:0px;display:none;' frameborder=0 name=dothework id=dothework src=macos_textutil_convert.php></iframe>
<iframe onload='filespecit(this);' style='display:none;' id=globit src=></iframe>
<input type=text style='position:absolute;top:-1200px;left:-1200px;'></input>
<input type=hidden id=turl value=''></input>
<div id=dforms>" . $resbit . "</div><br>
<span id=prepcp></span><iframe id=ifpcp onload=inform(this); src=/PHP/php_calls_pdfimages.php style=display:" . $inaconto . "; style=width:100%;height:800px;display:none;></iframe>
<br><div id=divend style=width:100%;display:none;></div></body>
</html>";
} 
} else {
// try {
//   @file_get_contents('HTTP://localhost' . $lportbit . '/macos_textutil_convert.php?imgname=' . $imgn);
//   sleep(2);
// } catch (Exception $exc) { }
 echo "<html><head><meta charset='UTF-8'/><title>Supervise pandoc or textutil Document Conversions - RJM Programming - January, 2025</title><scr" . "ipt type=text/javascript> 
 var tryit='HTTP://localhost" . $lportbit . "/" . $imgn . "'; 
 var thatone='', thattwo='';
 var wowowo=null;
   
 
 function onc(event){ if (eval('' + event.target.innerHTML.length) >= eval('' + window.atob(event.target.getAttribute('data-smalltitle')).length) && eval('' + event.target.innerHTML.length) < eval('' + window.atob(event.target.getAttribute('data-bigtitle')).length)) { event.target.innerHTML=window.atob(event.target.getAttribute('data-bigtitle'));  } else {  event.target.innerHTML=window.atob(event.target.getAttribute('data-smalltitle'));    }  }

 function onr(event){ var wwwooo=window.open('','_blank','top=15,left=15,width=500,height=500'); wwwooo.document.write(window.atob(event.target.getAttribute('data-biggest')));  }
  
  function justit(iois) {
  var aconto=null;
  if (aconto == null) {
       aconto = (iois.contentWindow || iois.contentDocument);
       if (aconto != null) {
       if (aconto.document) { aconto = aconto.document; }
       if (aconto.body != null) {
         if (window.opener) {
          if (window.opener.top.document.getElementById('dres')) {
              window.opener.top.document.getElementById('dres').style.width='98%'; 
              window.opener.top.document.getElementById('dres').style.height='30%';
              window.opener.top.document.getElementById('dres').innerHTML=aconto.body.innerText;
           }
         } else if (aconto.body.innerHTML.indexOf(';base64,') != -1) {
           var wasais=aconto.body.innerHTML.split('\">')[0].split('>')[0];
           var wpg=window.atob(wasais.split(';base64,')[1]);
           top.document.getElementById('dres').setAttribute('data-biggest',wasais.split(';base64,')[1]);
           if (wpg.indexOf('<body') != -1) {
           aconto.body.innerHTML=wpg.split('<body' + wpg.split('<body')[1].split('>')[0] + '>')[1].split('</body>')[0];
           } else {
           aconto.body.innerHTML=wpg;
           }
           top.document.getElementById('dres').setAttribute('data-smalltitle',window.btoa(aconto.body.innerText));
           top.document.getElementById('dres').title='Click toggles whether line feeds show and right click opens HTML look';
           var newwasais=aconto.body.innerText;
           while (newwasais.indexOf(String.fromCharCode(10)) != -1) {
             newwasais=newwasais.replace(String.fromCharCode(10),'<br>');
           }
           top.document.getElementById('dres').innerHTML=newwasais; //aconto.body.innerText;
           top.document.getElementById('dres').setAttribute('data-bigtitle',window.btoa(newwasais));
           top.document.getElementById('dres').style.backgroundColor='white';
           top.document.getElementById('dres').onclick=function(evt){ if (eval('' + evt.target.innerHTML.length) >= eval('' + window.atob(evt.target.getAttribute('data-smalltitle')).length) && eval('' + evt.target.innerHTML.length) < eval('' + window.atob(evt.target.getAttribute('data-bigtitle')).length)) { evt.target.innerHTML=window.atob(evt.target.getAttribute('data-bigtitle'));  } else {  evt.target.innerHTML=window.atob(evt.target.getAttribute('data-smalltitle'));    }  };
           top.document.getElementById('dres').oncontextmenu=function(evt){ var wwwooo=window.open('','_blank','top=15,left=15,width=500,height=500'); wwwooo.document.write(window.atob(evt.target.getAttribute('data-biggest')));  };
         }
       }
       }
  }
  }
  
 function calledlater() {
            if (tryit != '') {
            if (!inIframe() && document.URL.indexOf('https:') == 0 && document.URL.indexOf('localhost') == -1 && navigator.userAgent.toLowerCase().indexOf('safari/') > -1) {
              location.href=document.URL.replace('https:','http:');
            }
            if (1 == 5) {
            // document.body.style.background='URL(" . "HTTP://localhost" . $lportbit . "/" . $imgn . ")'; 
   // window.open('HTTP://localhost" . $lportbit . "/" . $imgn . "','xxlocit');
            var im=new Image();

    im.onload = function() {
      console.log('event')
            tryit+=' ';
    };
 
    
  im.onerror = function error(event) {
      console.log(event)
  };
               
            im.src=tryit + '';
            }
            }
 }

 function windowopen(theone, thetwo) {
   var asu=('&" . $_SERVER['QUERY_STRING'] . "').replace(/^\&$/g,'');  
   wowowo=window.open('HTTP://localhost" . $lportbit . "/macos_textutil_convert.php?imgname=" . $imgn . "' + asu,'xxlocit');
   thatone=theone;
   thattwo=thetwo;
   setTimeout(postwo, 4000);
 }
 
 function postwo() {
   if (tryit.trim() == tryit) {
     return null;
   } 
   wowo=window.open(thatone, thattwo);
 }
 
 function inIframe () {  // thanks to https://stackoverflow.com/questions/326069/how-to-identify-if-a-webpage-is-being-loaded-inside-an-iframe-or-directly-into-t
    try {
        return window.self !== window.top;
    } catch (e) {
        return true;
    }
 }
  
 function mamptry() { " . $innards . "
 }
 
 setTimeout(calledlater, 2000);
  
</scr" . "ipt><title>Email off your Document Conversion Attachment Input Files for Your Inhouse Document Converter to Listen For and Convert</title></head><body onload=setTimeout(mamptry,9000);><p>This PHP web application only works with macOS and its textutil -convert [outextension] [infilename] -output [outfilename] command line Document Conversion functionality, or install <a target=_blank title='pandoc Document Conversion' href='https://pandoc.org/'>pandoc</a> (for Windows).  Perhaps consider getting a local Apache/PHP/MySql web server such as <a target=_blank title='MAMP for Apache/PHP/MySql on Mac OS X local web server' href='http://www.mamp.info'><i>MAMP</i></a> or you have an email listener and will <a target=_self href='./macos_textutil_convert.php?emailanyway=y'>Email and Download</a> to that emailee to do the conversions</p><br><br><iframe style=display:none;width:100%;height:900px; name=mamptry id=mamptry src=></iframe><iframe name=xxlocit id=xxlocit style='display:none;' src=></iframe><br><div id=divend style=width:100%;display:none;></div></body><html>";
 exit;
}
?>
