(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 ""; 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="Document Conversions via pandoc or textutil"; $onl=" if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 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"); $precmds=""; 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" ) ) { 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/local/bin/pandoc")) { $verb="/usr/local/bin/pandoc"; $switchone="-t"; $switchtwo="-o"; $panplus="pandoc or "; } } 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"); exec("$verb" . " " . $switchone . " \"" . str_replace(".", "", $outlineinspec) . " " . $filename . "\" " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err"); 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" . file_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"); exec("$verb" . " " . $switchone . " \"" . str_replace(".", "", $outlineinspec) . " " . $filename . "\" " . $switchtwo . " \"" . $outnameis . "\"" . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err"); 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" . file_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) { $cvse="Email"; $title="Email off your Document Conversion Attachment Input Files for Your Inhouse Document Converter to Listen For and Convert"; if ($iphone || $ipad || $android || $ipod || $blackberry) { // thanks to http://www.phpmysqlscript.com/2012/03/detecting-users-screen-size-and.html $cself=" "; //🤳 "; $cvse="Email 📧"; $divinfront=""; } else { $cvse="Email"; $divinfront=""; } $title="Email off your Document Conversion Attachment Input Files for Your Inhouse Document Converter to Listen For and Convert"; $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) { $accf.=$accfd . basename($filename); $accfout.=$accfd . explode(".", basename($filename))[0] . $accfoutext; $accfd=","; } echo "" . $title . ""; exit; } function ourstr_replace($fris, $tois, $stris) { global $indx; if (strpos($stris, ",") !== false || ($indx == 0 && ($_GET['inpath'] || $_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 yourstr_replace($fris, $tois, $stris) { global $indx, $qindx; $iindx=$indx; if ($qindx >= 0) { $iindx=$qindx; } $qindx=-1; if (strpos($stris, ",") !== false || ($indx == 0 && ($_GET['outpath'] || $_POST['outpath']))) { $interim=str_replace($fris, $tois, explode(",",$stris)[$iindx]); if (isset($_GET['outpath'])) { return str_replace("+"," ",urldecode($_GET['outpath'])) . $interim; } else if (isset($_POST['outpath'])) { return str_replace("+"," ",urldecode($_POST['outpath'])) . $interim; } return $interim; } 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'); if (strpos(explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))], $_SERVER['DOCUMENT_ROOT']) !== false) { //file_put_contents("x7.x7",''); if (isset($_GET['turl'])) { echo "'; } //else { //echo ''; //} } //else if (isset($_GET['turl'])) { //echo ''; //} else { // echo ''; //} 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" || isset($_GET['emailanyway']) || $iphone || $ipad || $android || $ipod || $blackberry) { if (isset($_GET['convertthis']) && isset($_GET['outputname'])) { if ($_GET['convertthis'] != "") { $thewords=str_replace("+"," ",urldecode($_GET['convertthis'])); $thegoes=explode(",", $thewords); for ($indx=0; $indx macos_textutil_convert.out 2> macos_textutil_convert.err \n"); exec("$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"); if (explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_GET['outputname']))))] == "pdf") { $PDFfilename=yourstr_replace("+"," ",urldecode($_GET['outputname'])); $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("+"," ",urldecode($_GET['outputname'])); $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("+"," ",urldecode($_GET['outputname'])); $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 "

" . file_get_contents("macos_textutil_convert.err") . "

"; } } 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 macos_textutil_convert.out 2> macos_textutil_convert.err \n"); exec("$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"); if (explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))] == "pdf") { $PDFfilename=yourstr_replace("+"," ",urldecode($_POST['outputname'])); $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($_POST['outputname'])))[-1 + sizeof(explode(".",yourstr_replace("+"," ",urldecode($_POST['outputname']))))] == "rtf") { $PDFfilename=yourstr_replace("+"," ",urldecode($_POST['outputname'])); $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("+"," ",urldecode($_POST['outputname'])); $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); } echo "

" . file_get_contents("macos_textutil_convert.err") . "

"; } } } exit; } } else if ((!isset($_GET['convertthis']) && !isset($_POST['convertthis'])) || !isset($_GET['outputname']) || !isset($_POST['outputname'])) { $outfileis=""; if (isset($_GET['outputname'])) { $extis=explode(".",str_replace("+"," ",urldecode($_GET['outputname'])))[-1 + sizeof(explode(".",str_replace("+"," ",urldecode($_GET['outputname']))))]; if (file_exists(str_replace("+"," ",urldecode($_GET['outputname'])))) { if (strtolower("~" . $extis, "~htm") !== false) { $thecontent=file_get_contents(str_replace("+"," ",urldecode($_GET['outputname']))); } else 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("+"," ",urldecode($_GET['outputname'])); $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("+"," ",urldecode($_GET['outputname'])); $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("+"," ",urldecode($_POST['outputname'])); $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("+"," ",urldecode($_POST['outputname'])); $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 " " . $title . " " . $title . "

Supervise " . $panplus . "textutil Document Conversions

RJM Programming - July, 2020

" . $outfileis . "
Input Document File(s)    

     ... or" . $cself . " ... 
" . $divinfront . "

" . str_replace("\n","
",$thecontent) . "
"; } } else { // try { // @file_get_contents('HTTP://localhost' . $lportbit . '/macos_textutil_convert.php?imgname=' . $imgn); // sleep(2); // } catch (Exception $exc) { } echo " var tryit='HTTP://localhost" . $lportbit . "/" . $imgn . "'; var thatone='', thattwo=''; var wowowo=null; 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); Email off your Document Conversion Attachment Input Files for Your Inhouse Document Converter to Listen For and Convert

This PHP web application only works with macOS and its textutil -convert [outextension] [infilename] -output [outfilename] command line Document Conversion functionality, or install pandoc (for Windows). Perhaps consider getting a local Apache/PHP/MySql web server such as MAMP or you have an email listener and will Email and Download to that emailee to do the conversions



"; exit; } ?>