0) {
file_put_contents('./magick.txt', $huhexes[0]);
}
}
}
}
exit;
}
if (isset($_GET['pdfimages'])) {
$fnd=false;
if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') {
if (file_exists('./pdfimages.txt')) {
$pplace=file_get_contents('./pdfimages.txt');
if (strpos($pplace, 'pdfimages.exe') !== false) {
$fnd=true;
}
}
if (!$fnd) {
$huhexe=shell_exec("where pdfimages.exe");
if ($huhexe == '') {
$huhexes=rglob("C:\\pdfimages.exe"); //shell_exec("where pdfimages.exe");
if (sizeof($huhexes) > 0) {
file_put_contents('./pdfimages.txt', $huhexes[0]);
}
}
}
}
exit;
}
if (isset($_GET['ffmpeg'])) {
$fnd=false;
if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') {
if (file_exists('./ffmpeg.txt')) {
$pplace=file_get_contents('./ffmpeg.txt');
if (strpos($pplace, 'ffmpeg.exe') !== false) {
$fnd=true;
}
}
if (!$fnd) {
$huhexe=shell_exec("where ffmpeg.exe");
if ($huhexe == '') {
$huhexes=rglob("C:\\ffmpeg.exe"); //shell_exec("where pdfimages.exe");
if (sizeof($huhexes) > 0) {
file_put_contents('./ffmpeg.txt', $huhexes[0]);
}
}
}
}
exit;
}
$ifo=".";
$cbi='';
$followupwhat='';
$olmore='';
$dn='nul';
$ffmpegpre='';
$ffmpegsuf='';
$pdfimagespre='';
$pdfimagessuf='';
$aeos='';
$minuspng='-png';
$startlook='000';
$zerothree='%03';
$details="details";
$summary="summary";
$wherepdfimages="?infilegetsize=";
$whereffmpeg="?infilegetsize=";
$wheremagick="?infilegetsize=";
$magickverb='convert';
$magickpre='';
$magicksuf='';
if (PHP_OS == "Darwin") {
$dn=' /dev/null';
} else if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') {
$ffmpegpre="\"C:\\Program Files\\ImageMagick-7.1.0-Q16-HDRI\\";
$ffmpegsuf=".exe\"";
if (!file_exists($ffmpegpre . 'ffmpeg' . $ffmpegsuf)) {
if (file_exists('./ffmpeg.txt')) {
if (!file_exists(file_get_contents('./ffmpeg.txt'))) {
unlink('./ffmpeg.txt');
$whereffmpeg="?ffmpeg=where";
} else {
$ffmpegpre="\"" . str_replace('ffmpeg.exe','',file_get_contents('./ffmpeg.txt')) . "\"";
}
}
if (file_exists('ffmpeg' . $ffmpegsuf)) {
$ffmpegpre="";
} else if (!file_exists('./ffmpeg.txt')) {
$huhexe=shell_exec("where ffmpeg.exe");
if (strpos($huhexe, 'ffmpeg.exe') === false) {
$whereffmpeg="?ffmpeg=where";
} else {
$ffmpegpre=str_replace('ffmpeg.exe','',$huhexe);
}
}
}
$pdfimagespre="\"C:\\MAMP\\htdocs\\xpdf-tools-win-4.04\\bin32\\";
$pdfimagessuf=".exe\"";
if (!file_exists($pdfimagespre . 'pdfimages' . $pdfimagessuf)) {
if (file_exists('./pdfimages.txt')) {
if (!file_exists(file_get_contents('./pdfimages.txt'))) {
unlink('./pdfimages.txt');
$wherepdfimages="?pdfimages=where";
} else {
$pdfimagespre="\"" . str_replace('pdfimages.exe','',file_get_contents('./pdfimages.txt')) . "\"";
}
}
if (file_exists('pdfimages' . $pdfimagessuf)) {
$pdfimagespre="";
} else if (!file_exists('./pdfimages.txt')) {
$huhexe=shell_exec("where pdfimages.exe");
if (strpos($huhexe, 'pdfimages.exe') === false) {
$wherepdfimages="?pdfimages=where";
} else {
$pdfimagespre=str_replace('pdfimages.exe','',$huhexe);
}
}
}
$magickverb='magick';
$magickpre="\"C:\\Program Files\\ImageMagick-7.1.0-Q16-HDRI\\";
$magicksuf=".exe\"";
if (!file_exists($magickpre . 'magick' . $magicksuf)) {
if (file_exists('./magick.txt')) {
if (!file_exists(file_get_contents('./magick.txt'))) {
unlink('./magick.txt');
$wheremagick="?magick=where";
} else {
$magickpre="\"" . str_replace('magick.exe','',file_get_contents('./magick.txt')) . "\"";
}
}
if (file_exists('magick' . $ffmpegsuf)) {
$magickpre="";
} else if (!file_exists('./magick.txt')) {
$huhexe=shell_exec("where magick.exe");
if (strpos($huhexe, 'magick.exe') === false) {
$wheremagick="?magick=where";
} else {
$magickpre=str_replace('magick.exe','',$huhexe);
}
}
}
$minuspng='';
$startlook='0000';
$zerothree='%04';
//$details="DIV";
//$summary="Div";
}
if ($ffmpegpre != '' && strpos($ffmpegpre, ' ') === false) {
$ffmpegsuf=str_replace('"','',$ffmpegsuf);
$ffmpegpre=str_replace('"','',$ffmpegpre);
}
if ($pdfimagespre != '' && strpos($pdfimagespre, ' ') === false) {
$pdfimagessuf=str_replace('"','',$pdfimagessuf);
$pdfimagespre=str_replace('"','',$pdfimagespre);
}
if ($magickpre != '' && strpos($magickpre, ' ') === false) {
$magicksuf=str_replace('"','',$magicksuf);
$magickpre=str_replace('"','',$magickpre);
}
//echo $pdfimagespre;
//exit;
$filepath='';
$anyextac='';
$frmr="3";
if (isset($_GET['frmr'])) {
$frmr=str_replace('+', ' ', urldecode($_GET['frmr']));
}
if (isset($_POST['frmr'])) {
$frmr=str_replace('+', ' ', urldecode($_POST['frmr']));
}
// Does not support flag GLOB_BRACE
function rglob($pattern, $flags = 0) { // thanks to https://stackoverflow.com/questions/17160696/php-glob-scan-in-subfolders-for-a-file
$files = glob($pattern, $flags);
foreach (glob(str_replace(DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR,DIRECTORY_SEPARATOR,dirname($pattern).DIRECTORY_SEPARATOR).'*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
$files = array_merge(
[],
[$files, rglob($dir . DIRECTORY_SEPARATOR . basename($pattern), $flags)]
);
}
return $files;
}
function ourbasename($inb) {
return basename(str_replace(' ','_',$inb));
}
function ourrealpath($inb) {
return realpath(str_replace(' ','_',$inb));
}
if (isset($_GET['filename']) && isset($_GET['filesize']) && !isset($_GET['filepath'])) {
//file_put_contents('xj1.xj1','');
if (file_exists(str_replace('+',' ',urldecode($_GET['filename'])))) {
if (filesize(str_replace('+',' ',urldecode($_GET['filename']))) == $_GET['filesize']) {
$filepath=rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_GET['filename']));
}
}
if ($filepath == '') {
$filepath = rsearch(DIRECTORY_SEPARATOR, str_replace('+',' ',urldecode($_GET['filename'])), $_GET['filesize']);
}
if (!isset($_GET['inpath'])) {
// echo "
";
echo "";
exit;
} else {
$_GET['inpath']=urlencode(str_replace('"','',explode(str_replace('+',' ',urldecode($_GET['filename'])), $filepath)[0]));
//$_GET['convertthis']=$_GET['filename'];
}
} else if (isset($_GET['filename']) && isset($_GET['filesize']) && $_GET['filepath'] == '') {
//file_put_contents('xs0.xs0', '');
if (file_exists(str_replace('+',' ',urldecode($_GET['filename'])))) {
//file_put_contents('xs.xs', '');
if (filesize(str_replace('+',' ',urldecode($_GET['filename']))) == $_GET['filesize']) {
$filepath=rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . str_replace('+',' ',urldecode($_GET['filename']));
//file_put_contents('xs.xs1', $filepath);
}
}
if ($filepath == '') {
//file_put_contents('xs.xs3', '');
$filepath = rsearch(DIRECTORY_SEPARATOR, str_replace('+',' ',urldecode($_GET['filename'])), $_GET['filesize']);
//file_put_contents('xs.xs4', $filepath);
}
if (!isset($_GET['inpath'])) {
echo "";
exit;
} else {
$_GET['inpath']=urlencode(explode(str_replace('+',' ',urldecode($_GET['filename'])), $filepath)[0]);
//$_GET['convertthis']=$_GET['filename'];
}
} else if (isset($_GET['filename']) && isset($_GET['filesize']) && isset($_GET['filepath'])) {
$anyextrac='';
if (substr(str_replace('+',' ',urldecode($_GET['filepath'])), -1, 1) != DIRECTORY_SEPARATOR) {
$anyextrac=DIRECTORY_SEPARATOR;
}
if (!isset($_GET['inpath'])) {
echo "";
exit;
} else {
$_GET['inpath']=urlencode(str_replace('+',' ',urldecode($_GET['filepath'])) . $anyextac);
//$_GET['convertthis']=$_GET['filename'];
}
}
if (isset($_GET['infilegetsize'])) {
if (strlen(str_replace('+',' ',urldecode($_GET['infilegetsize']))) > 0) {
if (isset($_GET['infilegetsize']) && isset($_GET['infilepathdel'])) {
if (str_replace('+',' ',urldecode($_GET['infilepathdel'])) == (sys_get_temp_dir() . DIRECTORY_SEPARATOR)) {
if (strpos('~@!' . str_replace('+',' ',urldecode($_GET['infilegetsize'])), '~@!' . (sys_get_temp_dir() . DIRECTORY_SEPARATOR)) !== false) {
sleep(120);
if (file_exists(str_replace('+',' ',urldecode($_GET['infilegetsize'])))) {
unlink(str_replace('+',' ',urldecode($_GET['infilegetsize'])));
}
}
}
echo "";
exit;
}
if (substr(str_replace('+',' ',urldecode($_GET['infilegetsize'])),0,4) == 'http') {
$preinnards=file_get_contents(str_replace(' ','%20',str_replace('+',' ',urldecode($_GET['infilegetsize']))));
$innards="data:application/pdf;base64,";
if ($preinnards != "") {
$innards="data:application/pdf;base64," . base64_encode($preinnards) . "#" . basename(str_replace('+',' ',urldecode($_GET['infilegetsize']))) . '#' . sys_get_temp_dir() . DIRECTORY_SEPARATOR;
}
if ($innards == "data:application/pdf;base64,") {
echo "";
} else if (strpos(('' . $_SERVER['SERVER_NAME']), "localhost") !== false) {
file_put_contents(sys_get_temp_dir() . DIRECTORY_SEPARATOR . ourbasename(str_replace('+',' ',urldecode($_GET['infilegetsize']))), $preinnards);
echo "" . filesize(sys_get_temp_dir() . DIRECTORY_SEPARATOR . ourbasename(str_replace('+',' ',urldecode($_GET['infilegetsize'])))) . "#" . ourbasename(str_replace('+',' ',urldecode($_GET['infilegetsize']))) . '#' . sys_get_temp_dir() . DIRECTORY_SEPARATOR . "";
} else {
echo "" . str_replace($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR, explode('//', $pdru)[0] . '//' . explode('/', explode('//', $pdru)[1])[0] . "/", realpath(str_replace('+',' ',urldecode($_GET['infilegetsize'])))) . "#" . basename(str_replace('+',' ',urldecode($_GET['infilegetsize']))) . '#' . realpath(str_replace('+',' ',urldecode($_GET['infilegetsize']))) . DIRECTORY_SEPARATOR . "";
}
} else if (file_exists(str_replace('+',' ',urldecode($_GET['infilegetsize'])))) {
if (strpos(('' . $_SERVER['SERVER_NAME']), "localhost") === false) {
echo "" . str_replace($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR, explode('//', $pdru)[0] . '//' . explode('/', explode('//', $pdru)[1])[0] . "/", realpath(str_replace('+',' ',urldecode($_GET['infilegetsize'])))) . "#" . basename(str_replace('+',' ',urldecode($_GET['infilegetsize']))) . '#' . realpath(str_replace('+',' ',urldecode($_GET['infilegetsize']))) . DIRECTORY_SEPARATOR . "";
} else {
echo "" . filesize(str_replace('+',' ',urldecode($_GET['infilegetsize']))) . "#" . basename(str_replace('+',' ',urldecode($_GET['infilegetsize']))) . '#' . realpath(str_replace('+',' ',urldecode($_GET['infilegetsize']))) . DIRECTORY_SEPARATOR . "";
}
} else {
echo "";
}
} else {
echo "";
}
exit;
}
if (isset($_POST['pdfunitec'])) {
$cis=str_replace('+',' ',urldecode($_POST['pdfunitec']));
//file_put_contents('xxx01.xxx01', $cis);
if (explode(' ', $cis)[0] == 'pdfunite' || explode(' ', $cis)[0] == 'pdfunite.exe') {
//file_put_contents('xxx02.xxx01', $cis);
$huhs=explode('"', $cis);
//file_put_contents('xxx03.xxx01', $cis);
if (sizeof($huhs) > 5) {
//file_put_contents('xxx04.xxx01', $cis . ' vs ' . sys_get_temp_dir());
if (sys_get_temp_dir() == substr($huhs[5], 0, strlen(sys_get_temp_dir()))) {
//file_put_contents('xxx05.xxx01', $cis);
if (PHP_OS == "Darwin") {
//file_put_contents('xxx06.xxx01', $cis);
putenv('PATH=/usr/local/bin');
exec(explode(';',$cis)[0] . ' 2> pdfunite.bad');
//file_put_contents('xxx07.xxx01', $cis);
} else if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') {
exec(explode(';', $cis)[0] . ' 2> pdfunite.bad');
}
}
}
}
exit;
}
if (isset($_POST['rmzip'])) {
$cis=str_replace('+',' ',urldecode($_POST['rmzip']));
$precis=explode('-', $cis)[0];
sleep(120);
$xx='' . rand(456, 78534432);
if (file_exists($cis) && strpos(($cis . $xx . '~'), '.zip' . $xx . '~') !== false && strpos($cis, '-') !== false) {
if (file_exists($precis . '.mp4') && trim($precis) != '') { unlink($precis . '.mp4'); }
if (file_exists($precis . '.gif') && trim($precis) != '') { unlink($precis . '.gif'); }
if (file_exists($precis . '.pdf') && trim($precis) != '') { unlink($precis . '.pdf'); }
unlink($cis);
}
exit;
}
if (isset($_GET['inurl'])) {
$mt="image";
$mprefix='