<?php include_once getcwd() . "/classes/BLCarFile.php"; include_once getcwd() . "/classes/BLBlobs.php"; $blCarFile = new BLCarFile(); $blBlobs = new BLBlobs(); if (isset($_GET["id"])) { $id = $_GET["id"]; $carfile = $blCarFile->getCarFile($id); $blCarFile->deleteCarFile($id); $blBlobs->deleteBlobs($carfile->getBlobId()); unlink(getcwd() . "/files/" . $carfile->getName() . "." . $carfile->getType()); }
<?php include_once getcwd() . "/classes/BLCar.php"; include_once getcwd() . "/classes/BLCarPicture.php"; include_once getcwd() . "/classes/BLPictureOrder.php"; include_once getcwd() . "/classes/BLBlobs.php"; $blCar = new BLCar(); $blCarPicture = new BLCarPicture(); $blPictureOrder = new BLPictureOrder(); $blBlobs = new BLBlobs(); if (isset($_GET["id"])) { $id = $_GET["id"]; $carpic = $blCarPicture->getCarPicture($id); $car = $blCar->getCar($carpic->getCarId()); if ($car->getDefaultPictureId() == $id) { echo "A default picture can not be deleted!"; } else { $blCarPicture->deleteCarPicture($id); $blBlobs->deleteBlobs($carpic->getBlobId()); $blPictureOrder->deleteCarPictureFromList($id); unlink(getcwd() . "/pictures/" . $carpic->getName() . "." . $carpic->getType()); } }