diff --git a/public/delete.php b/public/delete.php index 5230690..e62092f 100644 --- a/public/delete.php +++ b/public/delete.php @@ -1,95 +1,95 @@ . **/ //Constants //$CN_APTH = "/mnt/volume-fra1-11/var/www/cdn/pling-cdn"; $CN_APTH = "."; $imgurl = urldecode($_GET['path']); echo "

Deleting file: ".$imgurl.'

\n'; $delete_post_name = $_GET['post']; $imagename = basename($imgurl); if (!$imgurl || !$imagename) { - print "Error, param: path missing\n"; + echo "Error, param: path missing\n"; return; } if (!$delete_post_name) { - print "Error, param: post missing\n"; + echo "Error, param: post missing\n"; return; } $fileExists = file_exists($CN_APTH.'/img/' . $imgurl); if($fileExists) { - print_r("

File exists".'\n'); + echo("

File exists".'\n'); echo ''; } else { - print_r("

File did not exists".'\n'); + echo("

File did not exists".'\n'); } -print_r("

Rename file...".'\n'); -print_r('

Command: cp '.$CN_APTH.'/img/' . $imgurl . ' ' . $CN_APTH.'/img/' . $imgurl . $delete_post_name.'\n'); +echo("

Rename file...".'\n'); +echo('

Command: cp '.$CN_APTH.'/img/' . $imgurl . ' ' . $CN_APTH.'/img/' . $imgurl . $delete_post_name.'\n'); //TODO //$last_line = system('mv '.$imgurl . ' ' . $imgurl . $delete_post_name, $retval); $last_line = system('cp '.$CN_APTH.'/img/' . $imgurl . ' ' . $CN_APTH.'/img/' . $imgurl . $delete_post_name.' 2>&1'); echo $last_line.'\n'; $fileExists = file_exists($CN_APTH.'/img/' . $imgurl . $delete_post_name); if($fileExists) { - print_r("

File exists".'\n'); + echo("

File exists".'\n'); echo ''; } else { - print_r("

File did not exists".'\n'); + echo("

File did not exists".'\n'); } //TODO -print_r("

Search for cached files: \n"); -print_r('

Command: locate -i "' . $imgurl.'"\n'); +echo("

Search for cached files: \n"); +echo('

Command: locate -i "' . $imgurl.'"\n'); $last_line = exec('locate -i "' . $imgurl.'" 2>&1', $resultArray, $result); //var_dump($resultArray); foreach ($resultArray as $value) { if(strpos($value, '/cache/') !== false) { echo "

Command: rm $value\n"; } } /* $image = getimg($imgurl); file_put_contents('img/' . $imagename, $image); if (file_exists('./img/' . $imagename)) { print ""; } else { print "Error"; } */ \ No newline at end of file