示例#1
0
echo T_('Actions');
?>
</th>
        </tr>
    </thead>
    <tbody>
        <?php 
if (AmpConfig::get('ratings')) {
    Rating::build_cache('podcast', $object_ids);
}
if (AmpConfig::get('userflags')) {
    Userflag::build_cache('podcast', $object_ids);
}
foreach ($object_ids as $podcast_id) {
    $libitem = new Podcast($podcast_id);
    $libitem->format();
    ?>
        <tr id="podcast_<?php 
    echo $libitem->id;
    ?>
" class="<?php 
    echo UI::flip_class();
    ?>
">
            <?php 
    require AmpConfig::get('prefix') . UI::find_template('show_podcast_row.inc.php');
    ?>
        </tr>
        <?php 
}
?>
示例#2
0
 /**
  * format
  * this function takes the object and reformats some values
  */
 public function format($details = true)
 {
     $this->f_title = scrub_out($this->title);
     $this->f_description = scrub_out($this->description);
     $this->f_category = scrub_out($this->category);
     $this->f_author = scrub_out($this->author);
     $this->f_website = scrub_out($this->website);
     $this->f_pubdate = date("m\\/d\\/Y - H:i", $this->pubdate);
     $this->f_state = ucfirst($this->state);
     // Format the Time
     $min = floor($this->time / 60);
     $sec = sprintf("%02d", $this->time % 60);
     $this->f_time = $min . ":" . $sec;
     $hour = sprintf("%02d", floor($min / 60));
     $min_h = sprintf("%02d", $min % 60);
     $this->f_time_h = $hour . ":" . $min_h . ":" . $sec;
     // Format the Size
     $this->f_size = UI::format_bytes($this->size);
     $this->f_file = $this->f_title . '.' . $this->type;
     $this->link = AmpConfig::get('web_path') . '/podcast_episode.php?action=show&podcast_episode=' . $this->id;
     $this->f_link = '<a href="' . $this->link . '" title="' . $this->f_title . '">' . $this->f_title . '</a>';
     if ($details) {
         $podcast = new Podcast($this->podcast);
         $podcast->format();
         $this->catalog = $podcast->catalog;
         $this->f_podcast = $podcast->f_title;
         $this->f_podcast_link = $podcast->f_link;
         $this->f_file = $this->f_podcast . ' - ' . $this->f_file;
     }
     return true;
 }
示例#3
0
文件: podcast.php 项目: bl00m/ampache
            UI::access_denied();
            exit;
        }
        $podcast_id = scrub_in($_REQUEST['podcast_id']);
        show_confirmation(T_('Podcast Deletion'), T_('Are you sure you want to delete this podcast?'), AmpConfig::get('web_path') . "/podcast.php?action=confirm_delete&podcast_id=" . $podcast_id, 1, 'delete_podcast');
        break;
    case 'confirm_delete':
        if (!Access::check('interface', 75) || AmpConfig::get('demo_mode')) {
            UI::access_denied();
            exit;
        }
        $podcast = new Podcast($_REQUEST['podcast_id']);
        if ($podcast->remove()) {
            show_confirmation(T_('Podcast Deletion'), T_('Podcast has been deleted.'), AmpConfig::get('web_path') . '/browse.php?action=podcast');
        } else {
            show_confirmation(T_('Podcast Deletion'), T_('Cannot delete this podcast.'), AmpConfig::get('web_path') . '/browse.php?action=podcast');
        }
        break;
    case 'show':
        $podcast_id = intval($_REQUEST['podcast']);
        if ($podcast_id > 0) {
            $podcast = new Podcast($podcast_id);
            $podcast->format();
            $object_ids = $podcast->get_episodes();
            $object_type = 'podcast_episode';
            require_once AmpConfig::get('prefix') . UI::find_template('show_podcast.inc.php');
        }
        break;
}
// end data collection
UI::show_footer();
示例#4
0
 public static function _musicMetadata($prmPath, $prmQuery = '')
 {
     $root = 'amp://music';
     $pathreq = explode('/', $prmPath);
     if ($pathreq[0] == '' && count($pathreq) > 0) {
         array_shift($pathreq);
     }
     $meta = null;
     switch ($pathreq[0]) {
         case 'artists':
             switch (count($pathreq)) {
                 case 1:
                     $counts = Catalog::count_medias();
                     $meta = array('id' => $root . '/artists', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['artists'], 'dc:title' => T_('Artists'), 'upnp:class' => 'object.container');
                     break;
                 case 2:
                     $artist = new Artist($pathreq[1]);
                     if ($artist->id) {
                         $artist->format();
                         $meta = self::_itemArtist($artist, $root . '/artists');
                     }
                     break;
             }
             break;
         case 'albums':
             switch (count($pathreq)) {
                 case 1:
                     $counts = Catalog::count_medias();
                     $meta = array('id' => $root . '/albums', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['albums'], 'dc:title' => T_('Albums'), 'upnp:class' => 'object.container');
                     break;
                 case 2:
                     $album = new Album($pathreq[1]);
                     if ($album->id) {
                         $album->format();
                         $meta = self::_itemAlbum($album, $root . '/albums');
                     }
                     break;
             }
             break;
         case 'songs':
             switch (count($pathreq)) {
                 case 1:
                     $counts = Catalog::count_medias();
                     $meta = array('id' => $root . '/songs', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['songs'], 'dc:title' => T_('Songs'), 'upnp:class' => 'object.container');
                     break;
                 case 2:
                     $song = new Song($pathreq[1]);
                     if ($song->id) {
                         $song->format();
                         $meta = self::_itemSong($song, $root . '/songs');
                     }
                     break;
             }
             break;
         case 'playlists':
             switch (count($pathreq)) {
                 case 1:
                     $counts = Catalog::count_medias();
                     $meta = array('id' => $root . '/playlists', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['playlists'], 'dc:title' => T_('Playlists'), 'upnp:class' => 'object.container');
                     break;
                 case 2:
                     $playlist = new Playlist($pathreq[1]);
                     if ($playlist->id) {
                         $playlist->format();
                         $meta = self::_itemPlaylist($playlist, $root . '/playlists');
                     }
                     break;
             }
             break;
         case 'smartplaylists':
             switch (count($pathreq)) {
                 case 1:
                     $counts = Catalog::count_medias();
                     $meta = array('id' => $root . '/smartplaylists', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['smartplaylists'], 'dc:title' => T_('Smart Playlists'), 'upnp:class' => 'object.container');
                     break;
                 case 2:
                     $playlist = new Search($pathreq[1], 'song');
                     if ($playlist->id) {
                         $playlist->format();
                         $meta = self::_itemSmartPlaylist($playlist, $root . '/smartplaylists');
                     }
                     break;
             }
             break;
         case 'live_streams':
             switch (count($pathreq)) {
                 case 1:
                     $counts = Catalog::count_medias();
                     $meta = array('id' => $root . '/live_streams', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['live_streams'], 'dc:title' => T_('Radio Stations'), 'upnp:class' => 'object.container');
                     break;
                 case 2:
                     $radio = new Live_Stream($pathreq[1]);
                     if ($radio->id) {
                         $radio->format();
                         $meta = self::_itemLiveStream($radio, $root . '/live_streams');
                     }
                     break;
             }
             break;
         case 'podcasts':
             switch (count($pathreq)) {
                 case 1:
                     $counts = Catalog::count_medias();
                     $meta = array('id' => $root . '/podcasts', 'parentID' => $root, 'restricted' => '1', 'childCount' => $counts['podcasts'], 'dc:title' => T_('Podcasts'), 'upnp:class' => 'object.container');
                     break;
                 case 2:
                     $podcast = new Podcast($pathreq[1]);
                     if ($podcast->id) {
                         $podcast->format();
                         $meta = self::_itemPodcast($podcast, $root . '/podcasts');
                     }
                     break;
                 case 3:
                     $episode = new Podcast_Episode($pathreq[2]);
                     if ($episode->id) {
                         $episode->format();
                         $meta = self::_itemPodcastEpisode($episode, $root . '/podcasts/' . $pathreq[1]);
                     }
                     break;
             }
             break;
         default:
             $meta = array('id' => $root, 'parentID' => '0', 'restricted' => '1', 'childCount' => '5', 'dc:title' => T_('Music'), 'upnp:class' => 'object.container');
             break;
     }
     return $meta;
 }