示例#1
0
        $data['private_url'] = '';
        $private_url = Video::GeneratePrivate();
    }
    // Validate status
    if (!empty($_POST['status']) && !ctype_space($_POST['status'])) {
        $data['status'] = htmlspecialchars(trim($_POST['status']));
    } else {
        $errors['status'] = 'Invalid status';
    }
    // Update video if no errors were made
    if (empty($errors)) {
        // Perform addional actions based on status change
        if ($data['status'] != $video->status) {
            // Handle "Approve" action
            if ($data['status'] == 'approved') {
                $video->Approve('approve');
            } else {
                if ($data['status'] == 'banned') {
                    Flag::FlagDecision($video->video_id, 'video', true);
                }
            }
        }
        $video->Update($data);
        $message = 'Video has been updated.';
        $message_type = 'success';
    } else {
        $message = 'The following errors were found. Please correct them and try again.';
        $message .= '<br /><br /> - ' . implode('<br /> - ', $errors);
        $message_type = 'error';
    }
}
示例#2
0
 if (!file_exists($thumb) || filesize($thumb) == 0) {
     throw new Exception("The video thumbnail is invalid. The id of the video is: {$video->video_id}");
 }
 /////////////////////////////////////////////////////////////
 //                        STEP 7                           //
 //               Update Video Information                  //
 /////////////////////////////////////////////////////////////
 // Debug Log
 $config->debug_conversion ? App::Log(CONVERSION_LOG, "\nUpdating video information...") : null;
 // Update database with new video status information
 $data['duration'] = $duration[0];
 Plugin::Trigger('encode.before_update');
 $video->Update($data);
 Plugin::Trigger('encode.update');
 // Activate video
 $video->Approve('activate');
 /////////////////////////////////////////////////////////////
 //                         STEP 8                          //
 //                        Clean up                         //
 /////////////////////////////////////////////////////////////
 try {
     // Debug Log
     $config->debug_conversion ? App::Log(CONVERSION_LOG, 'Deleting raw video...') : null;
     ### Delete raw videos & pre-faststart files
     Filesystem::Open();
     Filesystem::Delete($raw_video);
     Filesystem::Delete($mobile_temp);
     ### Delete encoding log files
     if ($config->debug_conversion) {
         App::Log(CONVERSION_LOG, "Video ID: {$video->video_id}, has completed processing!\n");
     } else {