$aDropFieldTypes = array(); array_push($aDropFields, 'image_file_drop'); array_push($aDropFieldTypes, 'image'); // if form was submitted: if ($_POST['commit'] == "Cancel") { header("Location:video_list.php"); exit; } if ($_POST['commit'] == "Save Video") { if ($id == 0) { // add the listing $objVideo = new Video(); $objVideo->Title = $_REQUEST["title"]; $objVideo->Summary = $_REQUEST["summary"]; $objVideo->VideoEmbed = $_REQUEST["video_embed"]; $objVideo->Create(); $objVideo->HandleFileUploads(); $objVideo->HandleDropFileUploads($aDropFields[0], 'ImageFile'); // redirect to listing list header("Location:video_list.php"); exit; } else { $objVideo = new Video($_REQUEST["id"]); $objVideo->Title = $_REQUEST["title"]; $objVideo->Summary = $_REQUEST["summary"]; $objVideo->VideoEmbed = $_REQUEST["video_embed"]; $objVideo->Update(); $objVideo->HandleFileUploads(); $objVideo->HandleDropFileUploads($aDropFields[0], 'ImageFile'); // redirect to listing list header("Location:video_list.php");
// Validate private if (!empty($_POST['private']) && $_POST['private'] == '1') { View::$vars->data['private'] = '1'; if (!empty($_POST['private_url']) && strlen($_POST['private_url']) == 7 && !Video::Exist(array('private_url' => $_POST['private_url']))) { View::$vars->data['private_url'] = htmlspecialchars(trim($_POST['private_url'])); View::$vars->private_url = View::$vars->data['private_url']; } else { View::$vars->errors['private_url'] = Language::GetText('error_private_url'); } } else { View::$vars->data['private'] = '0'; } // Validate Video Upload last (only if other fields were valid) if (empty(View::$vars->errors)) { View::$vars->data['user_id'] = View::$vars->user->user_id; View::$vars->data['filename'] = Video::CreateFilename(); View::$vars->data['status'] = 'new'; Plugin::Trigger('upload.before_create_video'); $_SESSION['upload'] = Video::Create(View::$vars->data); Plugin::Trigger('upload.create_video'); header('Location: ' . HOST . '/myaccount/upload/video/'); exit; } else { View::$vars->message = Language::GetText('errors_below'); View::$vars->message .= '<br /><br /> - ' . implode('<br /> - ', View::$vars->errors); View::$vars->message_type = 'error'; } } // Output page Plugin::Trigger('upload.before_render'); View::Render('myaccount/upload.tpl');
$private_url = $data['private_url']; } else { $errors['private_url'] = 'Invalid private URL'; } } else { $data['private'] = '0'; } // Update video if no errors were made if (empty($errors)) { // Create record $data['user_id'] = $admin->user_id; $data['original_extension'] = Functions::GetExtension($data['upload']['temp']); $data['filename'] = basename($data['upload']['temp'], '.' . $data['original_extension']); unset($data['upload']); $data['status'] = 'pending conversion'; $id = Video::Create($data); // Begin encoding $cmd_output = $config->debug_conversion ? CONVERSION_LOG : '/dev/null'; $converter_cmd = 'nohup ' . $php_path . ' ' . DOC_ROOT . '/cc-core/system/encode.php --video="' . $id . '" >> ' . $cmd_output . ' &'; exec($converter_cmd); // Output message $message = 'Video has been created.'; $message_type = 'success'; unset($data); } else { $message = 'The following errors were found. Please correct them and try again.'; $message .= '<br /><br /> - ' . implode('<br /> - ', $errors); $message_type = 'error'; } } // Output Header