-
Notifications
You must be signed in to change notification settings - Fork 1
/
editVideo.php
70 lines (59 loc) · 1.99 KB
/
editVideo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
require_once("includes/header.php");
require_once("includes/classes/VideoPlayer.php");
require_once("includes/classes/VideoDetailsFormProvider.php");
require_once("includes/classes/VideoUploadData.php");
require_once("includes/classes/SelectThumbnail.php");
if(!User::isLoggedIn()){
header("Location: signin.php");
}
if(!isset($_GET["videoId"])){
echo "No video selected";
exit();
}
$video = new Video($con, $_GET["videoId"], $userLoggedInObj);
if($video->getUploadedBy() != $userLoggedInObj->getUsername()){
echo "Not your video";
exit();
}
$detailsMessage = "";
if(isset($_POST["saveButton"])){
$videoData = new VideoUploadData(
null,
$_POST["titleInput"],
$_POST["descriptionInput"],
$_POST["privacyInput"],
$_POST["categoryInput"],
$userLoggedInObj->getUsername());
if($videoData->updateDetails($con, $video->getId())){
$detailsMessage = "<div class='alert alert-success'>
<strong>SUCCESS!</strong> Details updated successfully!
</div>";
$video = new Video($con, $_GET["videoId"], $userLoggedInObj);
}else {
$detailsMessage = "<div class='alert alert-danger'>
<strong>Error!</strong> Something went wrong
</div>";
}
}
?>
<script src="assets/js/editVideoActions.js"></script>
<div class="editVideoContainer column">
<div class="message">
<?php echo $detailsMessage; ?>
</div>
<div class="topSection">
<?php
$videoPlayer = new VideoPlayer($video);
echo $videoPlayer->create(false);
$selectThumbnail = new SelectThumbnail($con, $video);
echo $selectThumbnail->create();
?>
</div>
<div class="bottomSection">
<?php
$formProvider = new VideoDetailsFormProvider($con);
echo $formProvider->createEditDetailsForm($video);
?>
</div>
</div>