Esempio n. 1
0
$blCarLink = new BLCarLink();
$blDetailType = new BLDetailType();
$blPressContact = new BLPressContact();
$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);
//get car
$car = $blCar->getCar($_POST["carid"]);
//file
$file = $blCarFile->getCarFile($_POST["carfileid"]);
if (!is_dir(getcwd() . '/html/' . $site->getName() . '/' . $car->getFolderName() . '/files')) {
    mkdir(getcwd() . '/html/' . $site->getName() . '/' . $car->getFolderName() . '/files', 0777, true);
    chmod(getcwd() . '/html/' . $site->getName() . '/' . $car->getFolderName() . '/files', 0777);
}
//check if file exists
if (!file_exists(getcwd() . "/files/" . $file->getName() . "." . $file->getType())) {
    error_log(date("F j, Y, g:i a") . "-File not found: /files/" . $file->getName() . "." . $file->getType() . "\n", 3, getcwd() . "/log/logfile.log");
}
if (!file_exists(getcwd() . "/html/" . $site->getName() . "/" . $car->getFolderName() . "/files/" . $file->getName() . "." . $file->getType())) {
    copy(getcwd() . "/files/" . $file->getName() . "." . $file->getType(), getcwd() . "/html/" . $site->getName() . "/" . $car->getFolderName() . "/files/" . $file->getName() . "." . $file->getType());
    chmod(getcwd() . "/html/" . $site->getName() . "/" . $car->getFolderName() . "/files/" . $file->getName() . "." . $file->getType(), 0777);