$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]; } $DatesOutput = ''; if ($DatesThisSet) { $DatesOutput = '<ul>'; /* @var $date Date */ foreach ($DatesThisSet as $date) { $DatesOutput .= sprintf("<li>%1\$s (%2\$s)</li>", date($CurrentUser->getDateFormat(), $date->getTimeStamp()), $date->getDateKind() == DATE_KIND_VIDEO ? 'V' : ($date->getDateKind() == DATE_KIND_IMAGE ? 'P' : '?')); } $DatesOutput .= '</ul>'; } $SetRows .= sprintf("<div class=\"SetThumbGalItem\">\n\t\t\t<h3 class=\"Hidden\">%1\$s %13\$s %2\$s</h3>\n\t\t\t\n\t\t\t<div class=\"SetThumbImageWrapper\">\n\t\t\t%27\$s\n\t\t\t</div>\n\t\t\t\n\t\t\t<div class=\"SetThumbDataWrapper\">\n\t\t\t<ul>\n\t\t\t<li>%14\$s: %3\$s</li>\n\t\t\t<li>%15\$s: %2\$s</li>\n\t\t\t<li>%16\$s %9\$s</li>\n\t\t\t<li%11\$s>%17\$s: %4\$d</li>\n\t\t\t<li%12\$s>%18\$s: %5\$d</li>\n\t\t\t</ul>\n\t\t\t</div>\n\t\t\t\n\t\t\t<div class=\"SetThumbButtonWrapper\">\n\t\t\t%28\$s\n\t\t\t%29\$s\n\t\t\t%30\$s\n\t\t\t%31\$s\n\t\t\t%32\$s\n\t\t\t%33\$s\n\t\t\t<a href=\"image.php?model_id=%8\$d&set_id=%6\$d\"><img src=\"images/button_view.png\" width=\"16\" height=\"16\" title=\"%25\$s\" alt=\"%25\$s\"/></a>\n\t\t\t<a href=\"video.php?model_id=%8\$d&set_id=%6\$d\"><img src=\"images/button_view.png\" width=\"16\" height=\"16\" title=\"%26\$s\" alt=\"%26\$s\"/></a>\n\t\t\t</div>\n\t\t\t\n\t\t\t</div>\n\t\t\t\n\t\t\t%10\$s", htmlentities($Model->GetFullName()), htmlentities($Set->getName()), htmlentities($Set->getPrefix()), $Set->getAmountPicsInDB(), $Set->getAmountVidsInDB(), $Set->getID(), COMMAND_DELETE, $Model->getID(), $DatesOutput, $SetCount % 3 == 0 ? "<div class=\"Clear\"></div>" : NULL, $Set->getSetIsDirtyPic() ? " class=\"Dirty\"" : NULL, $Set->getSetIsDirtyVid() ? " class=\"Dirty\"" : NULL, strtolower($lang->g('NavigationSet')), $lang->g('LabelPrefix'), $lang->g('LabelName'), $lang->g('LabelDates'), $lang->g('NavigationImages'), $lang->g('NavigationVideos'), $lang->g('LabelEditSet'), $lang->g('LabelDeleteSet'), $lang->g('ButtonImportImages'), $lang->g('ButtonImportVideos'), $lang->g('LabelDownloadImages'), $lang->g('LabelDownloadVideos'), $lang->g('LabelViewImages'), $lang->g('LabelViewVideos'), $Video && $Set->getContainsWhat() == SET_CONTENT_VIDEO ? sprintf("<a href=\"video.php?model_id=%1\$d&set_id=%2\$d\">" . "<img src=\"download_image.php?video_id=%6\$d&landscape_only=true&width=225&height=150\" height=\"150\" alt=\"%3\$s %4\$s %5\$s\" title=\"%3\$s %4\$s %5\$s\" />" . "</a>", $Model->getID(), $Set->getID(), htmlentities($Model->GetFullName()), strtolower($lang->g('NavigationSet')), htmlentities($Set->getName()), $Video->getID()) : sprintf("<a href=\"image.php?model_id=%1\$d&set_id=%2\$d\">" . "<img src=\"download_image.php?set_id=%2\$d&landscape_only=true&width=225&height=150\" height=\"150\" alt=\"%3\$s %4\$s %5\$s\" title=\"%3\$s %4\$s %5\$s\" />" . "</a>", $Model->getID(), $Set->getID(), htmlentities($Model->GetFullName()), strtolower($lang->g('NavigationSet')), htmlentities($Set->getName())), $CurrentUser->hasPermission(RIGHT_SET_EDIT) ? sprintf("<a href=\"set_view.php?model_id=%1\$d&set_id=%2\$d\"><img src=\"images/button_edit.png\" width=\"16\" height=\"16\" title=\"%3\$s\" alt=\"%3\$s\"/></a>", $ModelID, $Set->getID(), $lang->g('LabelEditSet')) : sprintf("<a href=\"#\"><img src=\"images/button_edit_invalid.png\" width=\"16\" height=\"16\" title=\"%1\$s\" alt=\"%1\$s\"/></a>", $lang->g('LabelNotAllowed')), $CurrentUser->hasPermission(RIGHT_SET_DELETE) ? sprintf("<a href=\"set_view.php?model_id=%1\$d&set_id=%2\$d&cmd=%4\$s\"><img src=\"images/button_delete.png\" width=\"16\" height=\"16\" title=\"%3\$s\" alt=\"%3\$s\"/></a>", $ModelID, $Set->getID(), $lang->g('LabelDeleteSet'), COMMAND_DELETE) : sprintf("<a href=\"#\"><img src=\"images/button_delete_invalid.png\" width=\"16\" height=\"16\" title=\"%1\$s\" alt=\"%1\$s\"/></a>", $lang->g('LabelNotAllowed')), $CurrentUser->hasPermission(RIGHT_IMAGE_ADD) ? sprintf("<a href=\"import_image.php?model_id=%1\$d&set_id=%2\$d\"><img src=\"images/button_upload.png\" width=\"16\" height=\"16\" alt=\"%3\$s\" title=\"%3\$s\" /></a>", $ModelID, $Set->getID(), $lang->g('ButtonImportImages')) : sprintf("<a href=\"#\"><img src=\"images/button_upload_invalid.png\" width=\"16\" height=\"16\" alt=\"%1\$s\" title=\"%1\$s\" /></a>", $lang->g('LabelNotAllowed')), $CurrentUser->hasPermission(RIGHT_VIDEO_ADD) ? sprintf("<a href=\"import_video.php?model_id=%1\$d&set_id=%2\$d\"><img src=\"images/button_upload.png\" width=\"16\" height=\"16\" alt=\"%3\$s\" title=\"%3\$s\" /></a>", $ModelID, $Set->getID(), $lang->g('ButtonImportVideos')) : sprintf("<a href=\"#\"><img src=\"images/button_upload_invalid.png\" width=\"16\" height=\"16\" alt=\"%1\$s\" title=\"%1\$s\" /></a>", $lang->g('LabelNotAllowed')), $CurrentUser->hasPermission(RIGHT_EXPORT_ZIP) ? sprintf("<a href=\"download_zip.php?model_id=%1\$d&set_id=%2\$d\"><img src=\"images/button_download.png\" width=\"16\" height=\"16\" alt=\"%3\$s\" title=\"%3\$s\" /></a>", $ModelID, $Set->getID(), $lang->g('LabelDownloadImages')) : sprintf("<a href=\"#\"><img src=\"images/button_download_invalid.png\" width=\"16\" height=\"16\" title=\"%1\$s\" alt=\"%1\$s\"/></a>", $lang->g('LabelNotAllowed')), $CurrentUser->hasPermission(RIGHT_EXPORT_VIDEO) ? sprintf("<a href=\"download_vid.php?set_id=%1\$d\"><img src=\"images/button_download.png\" width=\"16\" height=\"16\" title=\"%2\$s\" alt=\"%2\$s\"/></a>", $Set->getID(), $lang->g('LabelDownloadVideo')) : sprintf("<a href=\"#\"><img src=\"images/button_download_invalid.png\" width=\"16\" height=\"16\" title=\"%1\$s\" alt=\"%1\$s\"/></a>", $lang->g('LabelNotAllowed'))); } } else {
/* @var $FileInfo SplFileInfo */ foreach ($itArray as $FileInfo) { if (isset($argv) && $argc > 0) { $bi->Next(); } if ($FileInfo->isFile() && $FileInfo->isReadable()) { $setnamematch = preg_match('/(?P<Prefix>[A-Z]+[_ -])?(?P<Name>[A-Z0-9]+)(?P<Number>\\d\\d)(?P<Suffix>[a-z])?\\.(?P<Extension>[^.]+)$/i', $FileInfo->getFilename(), $matches); if (isset($matches) && count($matches) > 0) { $Set = Set::Filter($Sets, $Model->getID(), NULL, $matches['Name'] . $matches['Number'], $matches['Prefix']); if (!$Set) { continue; } else { $Set = $Set[0]; } /* @var $VideoInDB Video */ $VideosInDB = Video::Filter($Videos, $ModelID, $Set->getID(), $matches['Name'] . $matches['Number'] . $matches['Suffix']); if ($VideosInDB) { $VideoInDB = $VideosInDB[0]; $cis = CacheImage::Filter($CacheImages, NULL, NULL, NULL, NULL, NULL, $VideoInDB->getID()); CacheImage::DeleteMulti($cis, $CurrentUser); } else { $VideoInDB = new Video(); $VideoInDB->setSet($Set); } $VideoInDB->setFileName($matches['Prefix'] . $matches['Name'] . $matches['Number'] . $matches['Suffix']); $VideoInDB->setFileExtension($matches['Extension']); $VideoInDB->setFileSize($FileInfo->getSize()); $VideoInDB->setFileCheckSum(Utils::CalculateMD5($FileInfo->getRealPath())); $VideoInDB->setFileCRC32(Utils::CalculateCRC32($FileInfo->getRealPath())); if (!$VideoInDB->getID() && $CurrentUser->hasPermission(RIGHT_VIDEO_ADD)) { Video::Insert($VideoInDB, $CurrentUser);
$Image2Process->setFileSize((int) $Image->attributes()->filesize); $Image2Process->setFileCheckSum((string) $Image->attributes()->checksum); $Image2Process->setFileCRC32((string) $Image->attributes()->crc32); if ($Image2Process->getID()) { Image::Update($Image2Process, $CurrentUser); } else { Image::Insert($Image2Process, $CurrentUser); } $imagetags = Tag::GetTagArray((string) $Image->attributes()->tags); $Tag2AllThisImage = Tag2All::Filter($Tag2AllThisSet, NULL, $Model2Process->getID(), $Set2Process->getID(), $Image2Process->getID(), NULL); Tag2All::HandleTags($imagetags, $Tag2AllThisImage, $TagsInDB, $CurrentUser, $Model2Process->getID(), $Set2Process->getID(), $Image2Process->getID(), NULL, FALSE); } } if ($Set->Videos) { foreach ($Set->Videos->Video as $Video) { $VideoInDb = Video::Filter($VideosInDb, $Model2Process->getID(), $Set2Process->getID(), (string) $Video->attributes()->name); if ($VideoInDb) { $VideoInDb = $VideoInDb[0]; } /* @var $Video2Process Video */ $Video2Process = $VideoInDb ? $VideoInDb : new Video(); $Video2Process->setSet($Set2Process); $Video2Process->setFileName((string) $Video->attributes()->name); $Video2Process->setFileExtension((string) $Video->attributes()->extension); $Video2Process->setFileSize((int) $Video->attributes()->filesize); $Video2Process->setFileCheckSum((string) $Video->attributes()->checksum); $Video2Process->setFileCRC32((string) $Video->attributes()->crc32); if ($Video2Process->getID()) { Video::Update($Video2Process, $CurrentUser); } else { Video::Insert($Video2Process, $CurrentUser);