$blCarMovie = new BLCarMovie(); $blMovieType = new BLMovieType(); /* * To change this template, choose Tools | Templates * and open the template in the editor. */ if (!isset($_POST["site"])) { exit; } else { $sitep = $_POST["site"]; } //get site $site = $blSite->getSiteByName($sitep); //Check if site is child site if ($site->getParentSiteId() != null) { $parentsite = $blSite->getSite($site->getParentSiteId()); $site->setDefaultCarId($parentsite->getDefaultCarId()); //Overwrite Id => Make sure correct pictures are used $site->setId($parentsite->getId()); } //get car $car = $blCar->getCar($_POST["carid"]); //picture $picture = $blCarPicture->getCarPicture($_POST["carpictureid"]); $picturefolder = getcwd() . '/html/' . $site->getName() . '/' . $car->getFolderName() . '/pictures'; if (!is_dir($picturefolder)) { mkdir($picturefolder, 0777, true); chmod($picturefolder, 0777); } //check if file exists if (!file_exists(getcwd() . "/pictures/" . $picture->getName() . "." . $picture->getType())) {
<?php include_once getcwd() . "/classes/BLCar.php"; include_once getcwd() . "/classes/BLSiteOrder.php"; include_once getcwd() . "/classes/BLSite.php"; $blCar = new BLCar(); $crudCar = new CRUDCar(); $blSiteOrder = new BLSiteOrder(); $blSite = new BLSite(); if (isset($_GET["id"])) { $id = $_GET["id"]; $car = $blCar->getCar($id); $site = $blSite->getSite($car->getSiteId()); if ($car->getState() == "Design") { $car->setDateApproved(date('d/m/Y')); $car->setUserIdApproved($_SESSION["userid"]); } if ($site->getDefaultCarId() == null || $site->getDefaultCarId() == 0) { $site->setDefaultCarId($car->getId()); $blSite->updateSite($site); } $foldername = clean_string(utf8_decode(str_replace(' ', '_', $car->getType()))); $carfind = $blCar->getCarByFolderName($foldername); if ($carfind != null) { $nr = 1; while ($carfind != null) { $foldername = clean_string(utf8_decode(str_replace(' ', '_', $car->getType()))) . "(" . $nr . ")"; $carfind = $blCar->getCarByFolderName($foldername); $nr++; } }
<?php include_once getcwd() . "/classes/BLSite.php"; $blSite = new BLSite(); if (isset($_GET["id"]) && isset($_GET["site"])) { $id = $_GET["id"]; $siteid = $_GET["site"]; $site = $blSite->getSite($siteid); $site->setDefaultCarId($id); $blSite->updateSite($site); }