本文整理汇总了PHP中Video::Exist方法的典型用法代码示例。如果您正苦于以下问题:PHP Video::Exist方法的具体用法?PHP Video::Exist怎么用?PHP Video::Exist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::Exist方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Exception
Plugin::Trigger('flag.ajax.login_check');
// Verify valid ID was provided
if (empty($_POST['id']) || !is_numeric($_POST['id'])) {
App::Throw404();
}
if (empty($_POST['type']) || !in_array($_POST['type'], array('video', 'member', 'comment'))) {
App::Throw404();
}
try {
// Check if user is logged in
if (!$logged_in) {
throw new Exception(Language::GetText('error_flag_login'));
}
switch ($_POST['type']) {
case 'video':
$id = Video::Exist(array('video_id' => $_POST['id'], 'status' => 'approved'));
if (!$id) {
App::Throw404();
}
$video = new Video($_POST['id']);
$member_id = $video->user_id;
$url = $video->url;
$name = "Title: {$video->title}";
$type = 'Video';
Plugin::Trigger('flag.ajax.flag_video');
break;
case 'member':
$id = User::Exist(array('user_id' => $_POST['id'], 'status' => 'active'));
if (!$id) {
App::Throw404();
}
示例2: dirname
<?php
// Include required files
include_once dirname(dirname(dirname(__FILE__))) . '/config/bootstrap.php';
App::LoadClass('Video');
// Establish page variables, objects, arrays, etc
View::InitView('mobile_play');
Plugin::Trigger('mobile_play.start');
// Verify a video was selected
if (!isset($_GET['vid']) || !is_numeric($_GET['vid'])) {
App::Throw404();
}
// Verify video exists
$data = array('video_id' => $_GET['vid'], 'status' => 'approved', 'private' => '0', 'gated' => '0');
$id = Video::Exist($data);
if (!$id) {
App::Throw404();
}
// Retrieve video
View::$vars->video = $video = new Video($id);
View::$vars->meta->title = $video->title;
// Output Page
Plugin::Trigger('mobile_play.before_render');
View::Render('play.tpl');
示例3: dirname
<?php
// Include required files
include_once dirname(dirname(__FILE__)) . '/config/bootstrap.php';
App::LoadClass('Video');
try {
// Verify video is available
if (empty($_GET['vid']) && !is_numeric($_GET['vid'])) {
throw new Exception();
}
// Validate given video
if (!Video::Exist(array('video_id' => $_GET['vid'], 'status' => 'approved', 'gated' => '0', 'private' => '0'))) {
throw new Exception();
}
// Load Video
$video = new Video($_GET['vid']);
} catch (Exception $e) {
$video = null;
}
// Output player
include $config->theme_path . '/embed.tpl';
示例4: htmlspecialchars
// Validate disable embed
if (!empty($_POST['disable_embed']) && $_POST['disable_embed'] == '1') {
View::$vars->data['disable_embed'] = '1';
} else {
View::$vars->data['disable_embed'] = '0';
}
// Validate gated
if (!empty($_POST['gated']) && $_POST['gated'] == '1') {
View::$vars->data['gated'] = '1';
} else {
View::$vars->data['gated'] = '0';
}
// 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);
示例5: session_write_close
App::EnableUploadsCheck();
### Retrieve video information
if (!isset($_POST['token'], $_POST['timestamp'])) {
App::Throw404();
}
session_write_close();
session_id($_POST['token']);
session_start();
// Validate upload key
$upload_key = md5(md5($_POST['timestamp']) . SECRET_KEY);
if (!isset($_SESSION['upload_key']) || $_SESSION['upload_key'] != $upload_key) {
App::Throw404();
}
Functions::RedirectIf($logged_in = User::LoginCheck(), HOST . '/login/');
$user = new User($logged_in);
if (isset($_SESSION['upload']) && Video::Exist(array('video_id' => $_SESSION['upload'], 'status' => 'new'))) {
$video = new Video($_SESSION['upload']);
Plugin::Trigger('upload.ajax.load_video');
} else {
header('Location: ' . HOST . '/myaccount/upload/');
exit;
}
try {
### Verify upload was made
if (empty($_FILES) || !isset($_FILES['upload']['name'])) {
throw new Exception(Language::GetText('error_uploadify_empty'));
}
### Check for upload errors
if ($_FILES['upload']['error'] != 0) {
App::Alert('Error During Video Upload', 'There was an HTTP FILE POST error (Error code #' . $_FILES['upload']['error'] . '). Video ID: ' . $video->video_id);
throw new Exception(Language::GetText('error_uploadify_system', array('host' => HOST)));
示例6: Video
// Establish page variables, objects, arrays, etc
View::InitView('play');
Plugin::Trigger('play.start');
View::$vars->logged_in = User::LoginCheck();
View::$vars->tags = null;
View::$vars->private = null;
// Validate requested video
if (!empty($_GET['vid']) && is_numeric($_GET['vid']) && Video::Exist(array('video_id' => $_GET['vid'], 'status' => 'approved'))) {
View::$vars->video = new Video($_GET['vid']);
View::$vars->comments_url = HOST . '/videos/' . View::$vars->video->video_id . '/comments';
// Prevent direct access to video to all users except owner
if (View::$vars->video->private == '1' && View::$vars->logged_in != View::$vars->video->user_id) {
App::Throw404();
}
} else {
if (!empty($_GET['private']) && ($video_id = Video::Exist(array('status' => 'approved', 'private_url' => $_GET['private'])))) {
View::$vars->video = new Video($video_id);
View::$vars->private = true;
View::$vars->comments_url = HOST . '/private/comments/' . View::$vars->video->private_url;
} else {
if (!empty($_GET['get_private'])) {
exit(Video::GeneratePrivate());
} else {
App::Throw404();
}
}
}
// Load video data for page rendering
View::$vars->member = new User(View::$vars->video->user_id);
View::$vars->video->Update(array('views' => View::$vars->video->views + 1));
View::$vars->rating = Rating::GetRating(View::$vars->video->video_id);
示例7: Exception
View::$vars->data['gated'] = '1';
} else {
View::$vars->data['gated'] = '0';
}
// Validate private
if (!empty($_POST['private']) && $_POST['private'] == '1') {
View::$vars->data['private'] = '1';
try {
// Validate private URL
if (empty($_POST['private_url'])) {
throw new Exception('error');
}
if (strlen($_POST['private_url']) != 7) {
throw new Exception('error');
}
$vid = Video::Exist(array('private_url' => $_POST['private_url']));
if ($vid && $vid != View::$vars->video->video_id) {
throw new Exception('error');
}
// Set private URL
View::$vars->data['private_url'] = htmlspecialchars(trim($_POST['private_url']));
View::$vars->private_url = View::$vars->data['private_url'];
} catch (Exception $e) {
View::$vars->errors['private_url'] = Language::GetText('error_private_url');
}
} else {
View::$vars->data['private'] = '0';
View::$vars->data['private_url'] = '';
View::$vars->private_url = Video::GeneratePrivate();
}
// Update video if no errors were made
示例8: Video
$message = 'Video has been approved and is now available';
$message_type = 'success';
}
} else {
if (!empty($_GET['unban']) && is_numeric($_GET['unban'])) {
// Validate video id
if (Video::Exist(array('video_id' => $_GET['unban']))) {
$video = new Video($_GET['unban']);
$video->Approve('approve');
$message = 'Video has been unbanned';
$message_type = 'success';
}
} else {
if (!empty($_GET['ban']) && is_numeric($_GET['ban'])) {
// Validate video id
if (Video::Exist(array('video_id' => $_GET['ban']))) {
$video = new Video($_GET['ban']);
$video->Update(array('status' => 'banned'));
Flag::FlagDecision($video->video_id, 'video', true);
$message = 'Video has been banned';
$message_type = 'success';
}
}
}
}
}
}
}
### Determine which type (status) of video to display
$query = "SELECT video_id FROM " . DB_PREFIX . "videos WHERE";
$status = !empty($_GET['status']) ? $_GET['status'] : 'approved';
示例9: User
App::LoadClass('Pagination');
App::LoadClass('Rating');
// Establish page variables, objects, arrays, etc
View::InitView('myvideos');
Plugin::Trigger('myvideos.start');
Functions::RedirectIf(View::$vars->logged_in = User::LoginCheck(), HOST . '/login/');
View::$vars->user = new User(View::$vars->logged_in);
$records_per_page = 9;
$url = HOST . '/myaccount/myvideos';
View::$vars->message = null;
/***********************
Handle Form if submitted
***********************/
if (isset($_GET['vid']) && is_numeric($_GET['vid'])) {
$data = array('user_id' => View::$vars->user->user_id, 'video_id' => $_GET['vid']);
$video_id = Video::Exist($data);
if ($video_id) {
Video::Delete($video_id);
View::$vars->message = Language::GetText('success_video_deleted');
View::$vars->message_type = 'success';
Plugin::Trigger('myvideos.delete_video');
}
}
// Retrieve total count
$query = "SELECT video_id FROM " . DB_PREFIX . "videos WHERE user_id = " . View::$vars->user->user_id . " AND status = 'approved'";
$result_count = $db->Query($query);
$total = $db->Count($result_count);
// Initialize pagination
View::$vars->pagination = new Pagination($url, $total, $records_per_page);
$start_record = View::$vars->pagination->GetStartRecord();
// Retrieve limited results
示例10: print_r
$db->Query("SET @@session.wait_timeout=36000");
// Debug Log
if ($config->debug_conversion) {
App::Log(CONVERSION_LOG, "\n\n### Converter Called...");
App::Log(CONVERSION_LOG, "Values passed to encoder:\n" . print_r($argv, TRUE));
}
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;