Exemple #1
0
} 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);
    } else {
        header('location:index.php');
        exit;
    }
}
if (array_key_exists('hidAction', $_POST) && $_POST['hidAction'] == 'VideoView') {
    $Video->setFileName(Utils::NullIfEmpty($_POST['txtFilename']));
    $Video->setFileExtension(Utils::NullIfEmpty($_POST['txtFileExtension']));
    $Video->setFileSize(intval($_POST['txtFilesize']));
    $Video->setFileCheckSum(Utils::NullIfEmpty($_POST['txtFileChecksum']));
    $Video->setFileCRC32(Utils::NullIfEmpty($_POST['txtFileCRC32']));
    $tags = Tag::GetTagArray($_POST['txtTags']);
    if ($Video->getID()) {
        if ($DeleteVideo) {
            if (Video::Delete($Video, $CurrentUser)) {
                header('location:' . $ReturnURL);
                exit;
            }
        } else {
            if (Video::Update($Video, $CurrentUser)) {
                Tag2All::HandleTags($tags, $TagsThisVideo, $TagsInDB, $CurrentUser, $ModelID, $SetID, NULL, $Video->getID(), NULL);
                header('location:' . $ReturnURL);
                exit;
            }
Exemple #2
0
             } 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);
             } else {
                 if ($CurrentUser->hasPermission(RIGHT_VIDEO_EDIT)) {
                     Video::Update($VideoInDB, $CurrentUser);
                 }
             }
         }
     }
 }
 $infoSuccess = new Info($lang->g('MessageVideosImported'));
 Info::AddInfo($infoSuccess);
 if (isset($argv) && $argc > 0) {
 public function parseVideo($videoObject)
 {
     $video = new Video();
     $video->setFileId($videoObject->file_id);
     $video->setWidth($videoObject->width);
     $video->setHeight($videoObject->height);
     $video->setDuration($videoObject->duration);
     if (property_exists($videoObject, 'thumb')) {
         $video->setThumb($this->parsePhotoSize($videoObject->thumb));
     }
     if (property_exists($videoObject, 'mime_type')) {
         $video->setMimeType($videoObject->mime_type);
     }
     if (property_exists($videoObject, 'file_size')) {
         $video->setFileSize($videoObject->file_size);
     }
     return $video;
 }