forked from SteamLUG/steamlug.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyoutubegeneratevideo.php
69 lines (56 loc) · 1.53 KB
/
youtubegeneratevideo.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
<?php
$pageTitle = "Generating YouTube Video";
ini_set('implicit_flush', 1);
include_once('includes/session.php');
// are we logged in? no → leave
if ( !login_check() ) {
header( "Location: /" );
exit();
} else {
$me = $_SESSION['u'];
}
// are we admin? no → leave
if ( in_array( $me, getAdmins() ) ) {
} else {
header( "Location: /" );
exit();
}
include_once('includes/functions_cast.php');
include_once('includes/functions_youtube.php');
include_once('includes/header.php');
ob_flush();
$action = "Failure";
$body = "";
$style = " panel-success";
/* User wanting to see a specific cast, and shownotes file exists */
if ( $season !== "00" && $episode !== "00" && ($meta = getCastHeader( $slug ) ) ) {
// TODO test we have audio?
flush(); /* visitor should get better indication that the page is actually loading now */
// TODO verify we dont have an existing youtube hash?
ob_start();
$reply = generateVideo( $season, $episode );
$debugoutput = ob_get_clean();
if ( $reply === false ) {
$style = "panel-danger";
} else {
$action = "Success";
}
/* XXX debug */
$body .= '<pre>'.print_r( $debugoutput, true ).'</pre>';
$body .= '<p>'.print_r( $reply, true ).'</p>';
} else {
$body = "<p>You didn’t supply a valid episode.</p>";
}
if ( $body !== "" ) {
print <<<ACTIONMSG
<article class="panel panel-default {$style}">
<header class="panel-heading">
<h3 class="panel-title">{$action}</h3>
</header>
<div class="panel-body">
{$body}
</div>
</article>
ACTIONMSG;
}
include_once('includes/footer.php');