forked from shownotesArchive/shownot.es
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathepisodeselector.php
66 lines (57 loc) · 2.1 KB
/
episodeselector.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
<?php
function insertselector($podcast=false)
{
$count = 0;
$count2 = 0;
$last = false;
$prev = '';
$next = '';
if($podcast === false)
{
$info = explode('/', $_GET['podcast']);
}
$printit = '';
if ($handle = @scandir('./'.$info[1].'/', 1))
{
foreach($handle as $file)
{
if ($file != "." && $file != "..")
{
$Episode = explode('.', $file);
if($Episode[2] != '')
{
if(($count == 0)&&($Episode[0] == $info[2]))
{
$last = true;
}
if($Episode[0] == $info[2])
{
$count2 = $count;
}
$files[$count] = ltrim($Episode[0], '0 \t\n\r');
$link = './'.ltrim($Episode[0], '0 \t\n\r');
$printit .= '<li><a ';
if($info[2] == ltrim($Episode[0], '0 \t\n\r'))
{
$printit .= 'id="selected" ';
}
$printit .= 'href="'.$link.'">Episode '.ltrim($Episode[0], '0 \t\n\r').'</a></li>';
++$count;
}
}
}
}
echo '<div class="baf-group-x1"><a class="baf bluehover grey prev" href="http://shownot.es/'.$info[1].'/'.$files[$count2+1].'"><span class="baf-icomoon bigger" aria-hidden="true" data-icon=""></span></a><div class="baf-group"><a class="baf bluehover dropdown-toggle w80">Episode '.$files[$count2].'<span class="caret"></span></a><ul class="dropdown-menu">';
echo $printit;
echo '</ul></div><a class="baf bluehover grey next"';
if($last)
{
echo ' disabled="true"';
}
else
{
echo ' href="http://shownot.es/'.$info[1].'/'.$files[$count2-1].'"';
}
echo ' ><span class="baf-icomoon bigger" aria-hidden="true" data-icon=""></span></a></div>';
}
?>