Пример #1
0
include "../inc/classes/Video.php";
include "../inc/classes/Helpers.php";
if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'sort') {
    $objVideo = new Video();
    $objVideo->SortValues(substr($_REQUEST['action'], 1), substr($_REQUEST['action'], 0, 1));
    unset($objVideo);
} elseif (isset($_REQUEST['dragsort'])) {
    // handle drag sort ajax request:
    $objVideo = new Video($_REQUEST['id']);
    $new_sort_order = $_REQUEST['idx'] * 10 + 5;
    if ($new_sort_order > $objVideo->SortOrder) {
        $new_sort_order += 10;
        // increasing sort order so must add another 10
    }
    $objVideo->SortOrder = $new_sort_order;
    $objVideo->Update();
    echo "success";
    exit;
    // just exit since this is an ajax request
}
include "includes/pagetemplate.php";
function PageContent()
{
    ?>
    
        <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                // fix to preserve width of cells
                var fixHelper = function(e, ui) {
Пример #2
0
                $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) {
        $bi->Finish();
    }
}
HTMLstuff::RefererRedirect();
Пример #3
0
         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);
                 }
                 $videotags = Tag::GetTagArray((string) $Video->attributes()->tags);
                 $Tag2AllThisVideo = Tag2All::Filter($Tag2AllThisSet, NULL, $Model2Process->getID(), $Set2Process->getID(), NULL, $Video2Process->getID());
                 Tag2All::HandleTags($videotags, $Tag2AllThisVideo, $TagsInDB, $CurrentUser, $Model2Process->getID(), $Set2Process->getID(), NULL, $Video2Process->getID(), FALSE);
             }
         }
     }
 }
 if ($fileToProcess != 'setup_data.xml') {
     unlink(realpath($fileToProcess));
 }
 $infoSuccess = new Info($lang->g('MessageXMLImported'));
 Info::AddInfo($infoSuccess);
Пример #4
0
    $target = UPLOAD_PATH . '/temp/' . $video->filename . '.' . $extension;
    Plugin::Trigger('upload.ajax.before_move_video');
    if (!@move_uploaded_file($_FILES['upload']['tmp_name'], $target)) {
        App::Alert('Error During Video Upload', 'The raw video file transfer failed. Video File: ' . $target);
        throw new Exception(Language::GetText('error_uploadify_system', array('host' => HOST)));
    }
    ### Change permissions on raw video file
    Plugin::Trigger('upload.ajax.before_change_permissions');
    try {
        Filesystem::Open();
        Filesystem::SetPermissions($target, 0644);
        Filesystem::Close();
    } catch (Exception $e) {
        App::Alert('Error During Video Upload', $e->getMessage());
        throw new Exception(Language::GetText('error_uploadify_system', array('host' => HOST)));
    }
    ### Update video information
    $data = array('status' => 'pending conversion', 'original_extension' => $extension);
    Plugin::Trigger('upload.ajax.before_update_video');
    $video->Update($data);
    ### Initilize Encoder
    $cmd_output = $config->debug_conversion ? CONVERSION_LOG : '/dev/null';
    Plugin::Trigger('upload.ajax.before_encode');
    $converter_cmd = 'nohup ' . Settings::Get('php') . ' ' . DOC_ROOT . '/cc-core/system/encode.php --video="' . $video->video_id . '" >> ' . $cmd_output . ' 2>&1 &';
    exec($converter_cmd);
    Plugin::Trigger('upload.ajax.encode');
    // Output success message
    exit(json_encode(array('result' => 1, 'msg' => '')));
} catch (Exception $e) {
    exit(json_encode(array('result' => 0, 'msg' => $e->getMessage())));
}
Пример #5
0
$message = null;
$sub_header = null;
// Verify content type was provided
if (!empty($_GET['status']) && in_array($_GET['status'], array('video', 'member', 'comment'))) {
    $type = $_GET['status'];
} else {
    $type = 'video';
}
### Handle "Ban" record
if (!empty($_GET['ban']) && is_numeric($_GET['ban'])) {
    switch ($type) {
        case 'video':
            $video = new Video($_GET['ban']);
            if ($video->found) {
                Flag::FlagDecision($video->video_id, $type, true);
                $video->Update(array('status' => 'banned'));
                $message = 'Video has been banned';
                $message_type = 'success';
            }
            break;
        case 'member':
            $user = new User($_GET['ban']);
            if ($user->found) {
                Flag::FlagDecision($user->user_id, $type, true);
                $user->UpdateContentStatus('banned');
                $user->Update(array('status' => 'banned'));
                $message = 'Member has been banned';
                $message_type = 'success';
            }
            break;
        case 'comment':
Пример #6
0
}
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;
            }
        }
    } else {
        if (Video::Insert($Video, $CurrentUser)) {
            Tag2All::HandleTags($tags, $TagsThisVideo, $TagsInDB, $CurrentUser, $ModelID, $SetID, NULL, $Video->getID());
            header('location:' . $ReturnURL);
            exit;
        }
    }
}
echo HTMLstuff::HtmlHeader(sprintf('%1$s - %2$s %3$s - %4$s', $Model->GetShortName(TRUE), $lang->g('NavigationSet'), $Set->getName(), $lang->g('NavigationVideos')), $CurrentUser);
?>
Пример #7
0
try {
    /////////////////////////////////////////////////////////////
    //                        STEP 1                           //
    //               Validate Requested Video                  //
    /////////////////////////////////////////////////////////////
    // Debug Log
    $config->debug_conversion ? App::Log(CONVERSION_LOG, 'Validating requested video...') : null;
    ### Validate requested video
    $video = new Video($video_id);
    if (!Video::Exist(array('video_id' => $video_id, 'status' => 'pending conversion'))) {
        throw new Exception("An invalid video was passed to the video encoder.");
    }
    // Debug Log
    $config->debug_conversion ? App::Log(CONVERSION_LOG, 'Establishing variables...') : null;
    ### Retrieve video information
    $video->Update(array('status' => 'processing'));
    $debug_log = LOG . '/' . $video->filename . '.log';
    $raw_video = UPLOAD_PATH . '/temp/' . $video->filename . '.' . $video->original_extension;
    $flv = UPLOAD_PATH . '/flv/' . $video->filename . '.flv';
    $mobile_temp = UPLOAD_PATH . '/mobile/' . $video->filename . '_temp.mp4';
    $mobile = UPLOAD_PATH . '/mobile/' . $video->filename . '.mp4';
    $thumb = UPLOAD_PATH . '/thumbs/' . $video->filename . '.jpg';
    Plugin::Trigger('encode.load_video');
    // Debug Log
    $config->debug_conversion ? App::Log(CONVERSION_LOG, 'Verifying raw video exists...') : null;
    ### Verify Raw Video Exists
    if (!file_exists($raw_video)) {
        throw new Exception("The raw video file does not exists. The id of the video is: {$video->video_id}");
    }
    // Debug Log
    $config->debug_conversion ? App::Log(CONVERSION_LOG, 'Verifying raw video was valid size...') : null;