本文整理汇总了PHP中Video::GeneratePrivate方法的典型用法代码示例。如果您正苦于以下问题:PHP Video::GeneratePrivate方法的具体用法?PHP Video::GeneratePrivate怎么用?PHP Video::GeneratePrivate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::GeneratePrivate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Video
// 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);
View::$vars->meta->title = View::$vars->video->title;
View::$vars->meta->keywords = implode(', ', View::$vars->video->tags);
View::$vars->meta->description = View::$vars->video->description;
Plugin::Trigger('play.load_video');
// Retrieve user data if logged in
if (View::$vars->logged_in) {
示例2: dirname
// Include required files
include_once dirname(dirname(dirname(__FILE__))) . '/config/bootstrap.php';
App::LoadClass('User');
App::LoadClass('Video');
// Establish page variables, objects, arrays, etc
View::InitView('upload');
Plugin::Trigger('upload.start');
Functions::RedirectIf(View::$vars->logged_in = User::LoginCheck(), HOST . '/login/');
App::EnableUploadsCheck();
View::$vars->user = new User(View::$vars->logged_in);
View::$vars->categories = NULL;
View::$vars->data = array();
View::$vars->errors = array();
View::$vars->message = null;
View::$vars->private_url = Video::GeneratePrivate();
unset($_SESSION['upload']);
### Retrieve categories for drop down
$query = "SELECT cat_id, cat_name FROM " . DB_PREFIX . "categories";
View::$vars->result_cat = $db->Query($query);
/******************************
Handle upload form if submitted
******************************/
if (isset($_POST['submitted'])) {
// Validate Title
if (!empty($_POST['title']) && !ctype_space($_POST['title'])) {
View::$vars->data['title'] = htmlspecialchars(trim($_POST['title']));
} else {
View::$vars->errors['title'] = Language::GetText('error_title');
}
// Validate Description
示例3: Exception
throw new Exception('error');
}
$vid = Video::Exist(array('private_url' => $_POST['private_url']));
if ($vid && $vid != $video->video_id) {
throw new Exception('error');
}
// Set private URL
$data['private_url'] = htmlspecialchars(trim($_POST['private_url']));
$private_url = $data['private_url'];
} catch (Exception $e) {
$errors['private_url'] = 'Invalid private URL';
}
} else {
$data['private'] = '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 {