コード例 #1
0
ファイル: download_csv.php プロジェクト: laiello/candydolldb
 $SetsThisModel = Set::Filter($Sets, $Model->getID());
 if ($SetsThisModel) {
     /* @var $Set Set */
     foreach ($SetsThisModel as $Set) {
         $ImagesThisSet = Image::GetImages(new ImageSearchParameters(FALSE, FALSE, $Set->getID(), FALSE, $Model->getID()));
         if ($ImagesThisSet) {
             /* @var $Image Image */
             foreach ($ImagesThisSet as $Image) {
                 if (Utils::_empty($Image->getFileCRC32())) {
                     continue;
                 }
                 printf("%1\$s,%2\$s,%3\$s,\\%4\$s\\,%5\$s%6\$s", $Image->getExportFilename(), $Image->getFileSize(), $Image->getFileCRC32(), str_replace(CANDYPATH . DIRECTORY_SEPARATOR, '', dirname($Image->getFilenameOnDisk())), $x <= $commentcount - 1 ? $commentarray[$x] . "," : NULL, PHP_EOL);
                 $x++;
             }
         }
         $VideosThisSet = Video::GetVideos(new VideoSearchParameters(FALSE, FALSE, $Set->getID(), FALSE, $Model->getID()));
         if ($VideosThisSet) {
             /* @var $Video Video */
             foreach ($VideosThisSet as $Video) {
                 if (Utils::_empty($Video->getFileCRC32())) {
                     continue;
                 }
                 printf("%1\$s,%2\$s,%3\$s,\\%4\$s\\,%5\$s%6\$s", $Video->getExportFilename($includepath), $Video->getFileSize(), $Video->getFileCRC32(), str_replace(CANDYPATH . DIRECTORY_SEPARATOR, '', dirname($Video->getFilenameOnDisk())), $x <= $commentcount - 1 ? $commentarray[$x] . "," : NULL, PHP_EOL);
                 $x++;
             }
             ob_flush();
             flush();
         }
         ob_flush();
         flush();
     }
コード例 #2
0
ファイル: import_video.php プロジェクト: laiello/candydolldb
<?php

include 'cd.php';
ini_set('max_execution_time', '3600');
$CurrentUser = Authentication::Authenticate();
if (!$CurrentUser->hasPermission(RIGHT_VIDEO_ADD) && !$CurrentUser->hasPermission(RIGHT_VIDEO_EDIT)) {
    $e = new Error(RIGHTS_ERR_USERNOTALLOWED);
    Error::AddError($e);
    HTMLstuff::RefererRedirect();
}
$ModelID = Utils::SafeIntFromQS('model_id');
$SetID = Utils::SafeIntFromQS('set_id');
$Models = Model::GetModels(new ModelSearchParameters(is_null($ModelID) ? FALSE : $ModelID));
$Sets = Set::GetSets(new SetSearchParameters(is_null($SetID) ? FALSE : $SetID));
$Videos = Video::GetVideos(new VideoSearchParameters(FALSE, FALSE, is_null($SetID) ? FALSE : $SetID, FALSE, is_null($ModelID) ? FALSE : $ModelID));
$CacheImages = CacheImage::GetCacheImages();
if ($SetID) {
    $Set = $Sets[0];
    $Models = array($Set->getModel());
}
/* @var $Model Model */
for ($i = 0; $i < count($Models); $i++) {
    $Model = $Models[$i];
    $VideoFolder = sprintf('%1$s/%2$s', CANDYPATH, $Model->GetFullName());
    if (!file_exists($VideoFolder)) {
        continue;
    }
    /* @var $it RecursiveIteratorIterator */
    $it = new RecursiveDirectoryIterator($VideoFolder, FileSystemIterator::SKIP_DOTS | FileSystemIterator::CURRENT_AS_FILEINFO);
    $itArray = array();
    foreach ($it as $file) {
コード例 #3
0
ファイル: set.php プロジェクト: laiello/candydolldb
<?php

include 'cd.php';
$CurrentUser = Authentication::Authenticate();
HTMLstuff::RefererRegister($_SERVER['REQUEST_URI']);
$ModelID = Utils::SafeIntFromQS('model_id');
if (!isset($ModelID)) {
    header('location:index.php');
    exit;
}
$Model = NULL;
$SetRows = '';
$SetCount = 0;
$Video = NULL;
$Videos = Video::GetVideos(new VideoSearchParameters(FALSE, FALSE, FALSE, FALSE, $ModelID));
$Sets = Set::GetSets(new SetSearchParameters(FALSE, FALSE, $ModelID));
$Dates = Date::GetDates(new DateSearchParameters(FALSE, FALSE, FALSE, FALSE, $ModelID));
if ($Sets) {
    if ($Sets[0]->getModel()->getFirstName() == 'VIP') {
        usort($Sets, array('Set', 'CompareAsc'));
    }
    /* @var $Set Set */
    foreach ($Sets as $Set) {
        $SetCount++;
        if (!$Model) {
            $Model = $Set->getModel();
        }
        $DatesThisSet = Date::FilterDates($Dates, NULL, $ModelID, $Set->getID());
        $Video = Video::Filter($Videos, $ModelID, $Set->getID());
        if ($Video) {
            $Video = $Video[0];
コード例 #4
0
$CacheImages = array();
$MultipleImageIDs = NULL;
$MultipleVideoIDs = NULL;
if (!is_null($SetID) && $DeleteSetsImages) {
    $imagesThisSet = Image::GetImages(new ImageSearchParameters(FALSE, FALSE, $SetID));
    /* @var $im Image */
    foreach ($imagesThisSet as $im) {
        $MultipleImageIDs[] = $im->getID();
    }
    $cisp = new CacheImageSearchParameters(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, is_null($MultipleImageIDs) ? FALSE : $MultipleImageIDs);
    if ($cisp->getValues()) {
        $CacheImages = array_merge($CacheImages, CacheImage::GetCacheImages($cisp));
    }
}
if (!is_null($SetID) && $DeleteSetsVideos) {
    $videosThisSet = Video::GetVideos(new VideoSearchParameters(FALSE, FALSE, $SetID));
    /* @var $vd Video */
    foreach ($videosThisSet as $vd) {
        $MultipleVideoIDs[] = $vd->getID();
    }
    $cisp = new CacheImageSearchParameters(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, is_null($MultipleVideoIDs) ? FALSE : $MultipleVideoIDs);
    if ($cisp->getValues()) {
        $CacheImages = array_merge($CacheImages, CacheImage::GetCacheImages($cisp));
    }
}
$cisp = new CacheImageSearchParameters(FALSE, FALSE, is_null($ModelIndexID) ? FALSE : $ModelIndexID, FALSE, is_null($ModelID) ? FALSE : $ModelID, FALSE, is_null($SetID) ? FALSE : $SetID, FALSE, is_null($ImageID) ? FALSE : $ImageID, FALSE, is_null($VideoID) ? FALSE : $VideoID, FALSE, is_null($Width) ? FALSE : $Width, is_null($Height) ? FALSE : $Height);
if ($cisp->getValues()) {
    $CacheImages = array_merge($CacheImages, CacheImage::GetCacheImages($cisp));
}
if ($CacheImages) {
    CacheImage::DeleteMulti($CacheImages, $CurrentUser);
コード例 #5
0
                 $CacheImage->setKind(CACHEIMAGE_KIND_SET);
                 $CacheImage->setImageWidth($Width);
                 $CacheImage->setImageHeight($Height);
                 CacheImage::Insert($CacheImage, $CurrentUser);
             }
             Image::OutputImage($imagefileondisk, $Width, $Height, TRUE, $imagefileondisk ? $CacheImage->getFilenameOnDisk() : NULL);
         }
     }
 } else {
     if ($VideoID) {
         $CacheImage = CacheImage::GetCacheImages(new CacheImageSearchParameters(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, $VideoID, FALSE, $Width, $Height));
         if ($CacheImage) {
             $CacheImage = $CacheImage[0];
             Image::OutputImage($CacheImage->getFilenameOnDisk(), $CacheImage->getImageWidth(), $CacheImage->getImageHeight(), TRUE);
         } else {
             $Video = Video::GetVideos(new VideoSearchParameters($VideoID));
             if ($Video) {
                 $Video = $Video[0];
                 $filename = sprintf('%1$s/%2$s/%3$s.jpg', CANDYPATH, CANDYVIDEOTHUMBPATH, $Video->getFileName());
                 if (file_exists($filename)) {
                     $CacheImage = new CacheImage();
                     $CacheImage->setVideoID($VideoID);
                     $CacheImage->setKind(CACHEIMAGE_KIND_VIDEO);
                     $CacheImage->setImageWidth($Width);
                     $CacheImage->setImageHeight($Height);
                     CacheImage::Insert($CacheImage, $CurrentUser);
                     Image::OutputImage($filename, $Width, $Height, TRUE, $CacheImage->getFilenameOnDisk());
                 } else {
                     Image::OutputImage();
                 }
             } else {
コード例 #6
0
ファイル: setup_data.php プロジェクト: laiello/candydolldb
    $fileToProcess = $_GET['file'];
}
if (isset($argv) && $argc > 0) {
    if (file_exists(sprintf('%1$s/%2$s', dirname($_SERVER['PHP_SELF']), $fileToProcess))) {
        $XmlFromFile = new SimpleXMLElement(file_get_contents(sprintf('%1$s/%2$s', dirname($_SERVER['PHP_SELF']), $fileToProcess)));
    }
} else {
    if (file_exists($fileToProcess)) {
        $XmlFromFile = new SimpleXMLElement(file_get_contents($fileToProcess));
    }
}
if ($XmlFromFile) {
    $ModelsInDb = Model::GetModels();
    $SetsInDb = Set::GetSets();
    $DatesInDb = Date::GetDates();
    $VideosInDb = Video::GetVideos();
    if (isset($argv) && $argc > 0) {
        $bi = new BusyIndicator(count($XmlFromFile->Model), 0);
    }
    foreach ($XmlFromFile->Model as $Model) {
        if (isset($argv) && $argc > 0) {
            $bi->Next();
        }
        $ModelInDb = Model::Filter($ModelsInDb, NULL, (string) $Model->attributes()->firstname, (string) $Model->attributes()->lastname);
        if ($ModelInDb) {
            $ModelInDb = $ModelInDb[0];
        }
        /* @var $Model2Process Model */
        $Model2Process = $ModelInDb ? $ModelInDb : new Model();
        // Provide a one-model-only import for impatient developers
        if ($Model2Process->getID() && $ModelID && $Model2Process->getID() !== $ModelID) {
コード例 #7
0
ファイル: video_view.php プロジェクト: laiello/candydolldb
    exit;
}
if (!isset($SetID)) {
    header('location:set.php?model_id=' . $ModelID);
    exit;
}
$DeleteVideo = array_key_exists('cmd', $_GET) && $_GET['cmd'] && $_GET['cmd'] == COMMAND_DELETE;
$ReturnURL = sprintf('video.php?model_id=%1$d&set_id=%2$d', $ModelID, $SetID);
$DisableControls = $DeleteVideo || !$CurrentUser->hasPermission(RIGHT_VIDEO_EDIT) && !is_null($VideoID) || !$CurrentUser->hasPermission(RIGHT_VIDEO_ADD) && is_null($VideoID);
$DisableDefaultButton = !$CurrentUser->hasPermission(RIGHT_VIDEO_DELETE) && !is_null($VideoID) && $DeleteVideo || !$CurrentUser->hasPermission(RIGHT_VIDEO_EDIT) && !is_null($VideoID) && !$DeleteVideo || !$CurrentUser->hasPermission(RIGHT_VIDEO_ADD) && is_null($VideoID);
$DisableCacheDeleteButton = $DeleteVideo || is_null($VideoID) || !$CurrentUser->hasPermission(RIGHT_CACHE_DELETE);
/* @var $Video Video */
/* @var $Set Set */
/* @var $Model Model */
if ($VideoID != NULL) {
    $Videos = Video::GetVideos(new VideoSearchParameters($VideoID, FALSE, $SetID, FALSE, $ModelID));
    if ($Videos) {
        $Video = $Videos[0];
    } else {
        header('location:set.php?model_id=' . $ModelID);
        exit;
    }
    $Set = $Video->getSet();
    $Model = $Set->getModel();
} else {
    $Video = new Video(NULL, $lang->g('LabelNew'));
    $Set = Set::GetSets(new SetSearchParameters($SetID));
    if ($Set) {
        $Set = $Set[0];
        $Model = $Set->getModel();
        $Video->setSet($Set);
コード例 #8
0
ファイル: search.php プロジェクト: laiello/candydolldb
        break;
    case 'IMAGE':
        if (!$SetIDsToShow || !$ModelIDsToShow) {
            break;
        }
        $isp = new ImageSearchParameters(FALSE, $ImageIDsToShow, FALSE, $SetIDsToShow, FALSE, FALSE, TRUE);
        $ToShow = Image::GetImages($isp, NULL, sprintf("%1\$d, %2\$d", $from, $max_results));
        $Total = count(Image::GetImages($isp));
        break;
    case 'VIDEO':
        if (!$SetIDsToShow || !$ModelIDsToShow) {
            break;
        }
        $vsp = new VideoSearchParameters(FALSE, $VideoIDsToShow, FALSE, $SetIDsToShow, FALSE, FALSE, TRUE);
        $ToShow = Video::GetVideos($vsp, NULL, sprintf("%1\$d, %2\$d", $from, $max_results));
        $Total = count(Video::GetVideos($vsp));
        break;
}
$TotalPages = ceil($Total / $max_results);
if ($ToShow) {
    switch ($searchMode) {
        case "MODEL":
            foreach ($ToShow as $Model) {
                /* @var $Model Model */
                $ItemCount++;
                $Results .= sprintf("<div class=\"ThumbGalItem\">\n\t\t\t\t\t\t<h3 class=\"Hidden\">%1\$s</h3>\n\t\t\t\t\t\t<div class=\"ThumbImageWrapper\">\n\t\t\t\t\t\t\t<a href=\"set.php?model_id=%2\$d\" title=\"%1\$s\">\n\t\t\t\t\t\t\t\t<img src=\"download_image.php?model_id=%2\$d&amp;portrait_only=true&amp;width=150&amp;height=225\" width=\"150\" height=\"225\" alt=\"%1\$s\" />\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"SearchThumbDataWrapper\">\n\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t<li>%4\$s: %1\$s</li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t%3\$s", htmlentities($Model->GetFullName()), $Model->getID(), $ItemCount % 4 == 0 ? "<div class=\"Clear\"></div>" : NULL, $lang->g('LabelName'));
            }
            break;
        case "SET":
            foreach ($ToShow as $Set) {
                /* @var $Set Set */
コード例 #9
0
ファイル: download_xml.php プロジェクト: laiello/candydolldb
function XmlOutputModel($Model, $TaggedOnly)
{
    global $xmlw, $Sets, $Dates, $Tag2Alls, $IncludeImages, $IncludeVideos;
    $xmlw->startElement('Model');
    $xmlw->writeAttribute('firstname', $Model->getFirstName());
    $xmlw->writeAttribute('lastname', $Model->getLastName());
    $xmlw->writeAttribute('birthdate', $Model->getBirthdate() > 0 ? date('Y-m-d', $Model->getBirthdate()) : NULL);
    $TagsThisModel = Tag2All::Filter($Tag2Alls, NULL, $Model->getID(), FALSE, FALSE, FALSE);
    $TagsThisModelOnly = Tag2All::Filter($TagsThisModel, NULL, $Model->getID(), NULL, NULL, NULL);
    $xmlw->writeAttribute('tags', Tag2All::Tags2AllCSV($TagsThisModelOnly));
    $SetsThisModel = Set::Filter($Sets, $Model->getID());
    if ($SetsThisModel) {
        $xmlw->startElement('Sets');
        $DatesThisModel = Date::FilterDates($Dates, NULL, $Model->getID());
        if ($Model->getFirstName() == 'VIP') {
            usort($SetsThisModel, array('Set', 'CompareASC'));
        }
        foreach ($SetsThisModel as $Set) {
            $PicDatesThisSet = Date::FilterDates($DatesThisModel, NULL, NULL, $Set->getID(), DATE_KIND_IMAGE);
            $VidDatesThisSet = Date::FilterDates($DatesThisModel, NULL, NULL, $Set->getID(), DATE_KIND_VIDEO);
            $TagsThisSet = Tag2All::Filter($TagsThisModel, NULL, $Model->getID(), $Set->getID(), NULL, NULL);
            $xmlw->startElement('Set');
            if ($Model->getFirstName() == 'VIP' && !is_numeric($Set->getName())) {
                $xmlw->writeAttribute('name', sprintf('SP_%1$s', $Set->getName()));
            } else {
                $xmlw->writeAttribute('name', $Set->getName());
            }
            $xmlw->writeAttribute('date_pic', Date::FormatDates($PicDatesThisSet, 'Y-m-d', FALSE, ' '));
            $xmlw->writeAttribute('date_vid', Date::FormatDates($VidDatesThisSet, 'Y-m-d', FALSE, ' '));
            $xmlw->writeAttribute('tags', Tag2All::Tags2AllCSV($TagsThisSet));
            if ($IncludeImages) {
                $ImagesThisSet = Image::GetImages(new ImageSearchParameters(FALSE, FALSE, $Set->getID(), FALSE, $Model->getID()));
                if ($ImagesThisSet) {
                    $xmlw->startElement('Images');
                    /* @var $Image Image */
                    foreach ($ImagesThisSet as $Image) {
                        $TagsThisImage = Tag2All::Filter($TagsThisModel, NULL, $Model->getID(), $Set->getID(), $Image->getID(), NULL);
                        if ($TaggedOnly === TRUE && $TagsThisImage || $TaggedOnly === FALSE) {
                            $xmlw->startElement('Image');
                            $xmlw->writeAttribute('name', $Image->getFileName());
                            $xmlw->writeAttribute('extension', $Image->getFileExtension());
                            $xmlw->writeAttribute('filesize', $Image->getFileSize());
                            $xmlw->writeAttribute('height', $Image->getImageHeight());
                            $xmlw->writeAttribute('width', $Image->getImageWidth());
                            $xmlw->writeAttribute('checksum', $Image->getFileCheckSum());
                            $xmlw->writeAttribute('crc32', $Image->getFileCRC32());
                            $xmlw->writeAttribute('tags', Tag2All::Tags2AllCSV($TagsThisImage));
                            $xmlw->endElement();
                        }
                    }
                    $xmlw->endElement();
                    $xmlw->flush();
                    ob_flush();
                    flush();
                    unset($ImagesThisSet);
                }
            }
            if ($IncludeVideos) {
                $VideosThisSet = Video::GetVideos(new VideoSearchParameters(FALSE, FALSE, $Set->getID(), FALSE, $Model->getID()));
                if ($VideosThisSet) {
                    $xmlw->startElement('Videos');
                    /* @var $Video Video */
                    foreach ($VideosThisSet as $Video) {
                        $TagsThisVideo = Tag2All::Filter($TagsThisModel, NULL, $Model->getID(), $Set->getID(), NULL, $Video->getID());
                        if ($TaggedOnly === TRUE && $TagsThisVideo || $TaggedOnly === FALSE) {
                            $xmlw->startElement('Video');
                            $xmlw->writeAttribute('name', $Video->getFileName());
                            $xmlw->writeAttribute('extension', $Video->getFileExtension());
                            $xmlw->writeAttribute('filesize', $Video->getFileSize());
                            $xmlw->writeAttribute('checksum', $Video->getFileCheckSum());
                            $xmlw->writeAttribute('crc32', $Video->getFileCRC32());
                            $xmlw->writeAttribute('tags', Tag2All::Tags2AllCSV($TagsThisVideo));
                            $xmlw->endElement();
                        }
                    }
                    $xmlw->endElement();
                    $xmlw->flush();
                    ob_flush();
                    flush();
                    unset($VideosThisSet);
                }
            }
            $xmlw->endElement();
        }
        $xmlw->endElement();
        $xmlw->flush();
        ob_flush();
        flush();
        if ($Model->getRemarks()) {
            $xmlw->startElement('Remarks');
            $xmlw->text($Model->getRemarks());
            $xmlw->endElement();
        }
    }
    $xmlw->endElement();
    $xmlw->flush();
    ob_flush();
    flush();
}