Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Upgrade for gPodder 3.0
- $db = new SQLite3('gpodder.sqlite');
- $channels = $db->query('select id, title from podcast');
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title>gPodder Feeds</title>
- <script src="js/jquery-1.7.1.js" type="text/javascript"></script>
- <script src="js/jquery-ui.js" type="text/javascript"></script>
- <link href="css/gpodder.css" rel="stylesheet" type="text/css" />
- <link href="css/jquery-ui.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript">
- $(function() {
- $.datepicker.setDefaults({ dateFormat: 'yy-mm-dd' });
- $(".datepicker").datepicker();
- $("form").submit(function(e) {
- var episode = $("#episodeid", $(this)).val();
- $.post('/gpodder/setdate.php', $(this).serialize(), function(data) {
- $("#pub" + episode).html(data);
- });
- e.preventDefault();
- });
- });
- </script>
- </head>
- <body>
- <header>gPodder RSS Feeds</header>
- <nav>
- <?php
- while ($row = $channels->fetchArray()) {
- echo "<p><a href='/gpodder/index.php?id=" . $row["id"] .
- "'>" . $row["title"] . "</a></p>";
- }
- ?>
- <hr />
- <a href="/gpodder/" >10 latest shows</a>
- </nav>
- <section>
- <?php
- $sql = 'select
- e.id episode_id
- , e.url episode_url
- , e.title episode_title
- , e.file_size
- , e.state
- , e.download_filename filename
- , e.description episode_description
- , e.published
- , e.total_time
- , c.id channel_id
- , c.title channel_title
- , c.link
- , c.description channel_description
- , c.cover_url image
- from episode e, podcast c
- where e.podcast_id = c.id ';
- if (isset($_GET["id"])) {
- $episodes = $db->query($sql . 'and c.id = ' . $_GET["id"] . ' order by published desc');
- $header = true;
- } else {
- $episodes = $db->query($sql . 'order by published desc limit 10');
- $header = false;
- echo "<h3>10 Latest Feeds</h3>";
- }
- while ($row = $episodes->fetchArray()) {
- if ($header) {
- echo "<a href='" . $row["link"] . "'><img width='100' src='" . $row["image"] .
- "' alt='" . $row["channel_title"] . "' /></a><br />";
- echo $row["channel_description"];
- $header = false;
- }
- echo "<p>";
- echo "<a href='" . $row["episode_url"] . "'>" . $row["episode_title"] . "</a><br />";
- if (!isset($_GET["id"])) {
- echo "<b>" . $row["channel_title"] . "</b><br />";
- }
- echo $row["episode_description"] . "<br />";
- echo "<div id='pub" . $row["episode_id"] . "'>";
- // Ideally get the date from the database
- if ($row["published"] == 0) {
- // Second best - from the file time stamp
- if ($row["state"]) {
- $filepath = "/var/gPodder/Downloads/" .
- $row["channel_title"] . "/" . $row["filename"];
- $tmpDate = new DateTime('@' . filectime($filepath));
- ?>
- <form>
- <input type="text" class="datepicker" name="published" value="<?php echo $tmpDate->format('Y-m-d') ?>" />
- <input type="hidden" name="episodeid" id="episodeid" value="<?php echo $row["episode_id"] ?>" />
- <input type="submit" value="Set" />
- <br />
- </form>
- <?php
- } else {
- echo "Date not available. <a href='#'>Click to set</a><br />";
- }
- } else {
- $tmpDate = new DateTime('@' . $row["published"]);
- echo $tmpDate->format('Y-m-d') . "<br />";
- }
- echo "</div>";
- $sec = $row["total_time"] % 60;
- $min = (int) $row["total_time"] / 60;
- $hr = (int) ($min / 60);
- $min %= 60;
- echo sprintf("%d:%02d:%02d ", $hr, $min, $sec) .
- number_format ($row["file_size"] / 1024) . "KB <img src=" .
- ($row["state"] ? "'s_success.png' alt='yes'" :
- "'s_error2.png' alt='no'") . "' />";
- echo "</p>\n";
- }
- $db->close();
- ?>
- </section>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement