public function remove_from_disk() { $deleted = true; $video_ids = $this->get_episodes(); foreach ($video_ids as $id) { $video = Video::create_from_id($id); $deleted = $video->remove_from_disk(); if (!$deleted) { debug_event('tvshow_season', 'Error when deleting the video `' . $id . '`.', 1); break; } } if ($deleted) { $sql = "DELETE FROM `tvshow_season` WHERE `id` = ?"; $deleted = Dba::write($sql, array($this->id)); if ($deleted) { Art::gc('tvshow_season', $this->id); Userflag::gc('tvshow_season', $this->id); Rating::gc('tvshow_season', $this->id); Shoutbox::gc('tvshow_season', $this->id); } } return $deleted; }
<td class="cel_rating" id="rating_<?php echo $libitem->id; ?> _playlist"><?php Rating::show($libitem->id, 'playlist'); ?> </td> <?php } if (AmpConfig::get('userflags')) { ?> <td class="cel_userflag" id="userflag_<?php echo $libitem->id; ?> _playlist"><?php Userflag::show($libitem->id, 'playlist'); ?> </td> <?php } } ?> <td class="cel_action"> <?php if (Access::check_function('batch_download') && check_can_zip('playlist')) { ?> <a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?> /batch.php?action=playlist&id=<?php echo $libitem->id;
<?php } ?> <th class="cel_action essential"><?php 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'); ?>
private static function _setStar($input, $star) { $id = $input['id']; $albumId = $input['albumId']; $artistId = $input['artistId']; // Normalize all in one array $ids = array(); $r = Subsonic_XML_Data::createSuccessResponse(); if ($id) { if (!is_array($id)) { $id = array($id); } foreach ($id as $i) { $aid = Subsonic_XML_Data::getAmpacheId($i); if (Subsonic_XML_Data::isArtist($i)) { $type = 'artist'; } else { if (Subsonic_XML_Data::isAlbum($i)) { $type = 'album'; } else { if (Subsonic_XML_Data::isSong($i)) { $type = 'song'; } else { $type = ""; } } } $ids[] = array('id' => $aid, 'type' => $type); } } else { if ($albumId) { if (!is_array($albumId)) { $albumId = array($albumId); } foreach ($albumId as $i) { $aid = Subsonic_XML_Data::getAmpacheId($i); $ids[] = array('id' => $aid, 'album'); } } else { if ($artistId) { if (!is_array($artistId)) { $artistId = array($artistId); } foreach ($artistId as $i) { $aid = Subsonic_XML_Data::getAmpacheId($i); $ids[] = array('id' => $aid, 'artist'); } } else { $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_MISSINGPARAM); } } } foreach ($ids as $i) { $flag = new Userflag($i['id'], $i['type']); $flag->set_flag($star); } self::apiOutput($input, $r); }
/** * display_home * This display the module in home page */ public function display_home() { if (AmpConfig::get('userflags')) { $userflags = Userflag::get_latest(null, -1, $this->maxitems); $i = 0; echo '<div class="home_plugin"><table class="tabledata">'; foreach ($userflags as $userflag) { $item = new $userflag['type']($userflag['id']); $item->format(); $user = new User($userflag['user']); $user->format(); if ($item->id) { echo '<tr class="' . ($i % 2 == 0 ? 'even' : 'odd') . '"><td>'; echo '<div>'; echo '<div style="float: left;">'; echo '<span style="font-weight: bold;">' . $item->f_link . '</span> '; echo '<span style="margin-right: 10px;">'; if (AmpConfig::get('directplay')) { echo Ajax::button('?page=stream&action=directplay&object_type=' . $userflag['type'] . '&object_id=' . $userflag['id'], 'play', T_('Play'), 'play_' . $userflag['type'] . '_' . $userflag['id']); if (Stream_Playlist::check_autoplay_append()) { echo Ajax::button('?page=stream&action=directplay&object_type=' . $userflag['type'] . '&object_id=' . $userflag['id'] . '&append=true', 'play_add', T_('Play last'), 'addplay_' . $userflag['type'] . '_' . $userflag['id']); } } echo Ajax::button('?action=basket&type=' . $userflag['type'] . '&id=' . $userflag['id'], 'add', T_('Add to temporary playlist'), 'play_full_' . $userflag['id']); echo '</span>'; echo '</div>'; echo '<div style="float: right; opacity: 0.5;">' . T_('recommended by') . ' ' . $user->f_link . '</div>'; echo '</div><br />'; echo '<div style="margin-left: 30px;">'; echo '<div style="float: left; margin-right: 20px;">'; $thumb = UI::is_grid_view('album') ? 2 : 11; $item->display_art($thumb); echo '</div>'; echo '<div style="white-space: normal;">' . $item->get_description() . '</div>'; echo '</div>'; echo '</td></tr>'; $i++; } } echo '</table></div>'; } }
<?php show_rating($season->id, 'tvshow_season'); ?> </div> <?php } ?> <?php if (AmpConfig::get('userflags')) { ?> <div style="display:table-cell;" id="userflag_<?php echo $season->id; ?> _tvshow_season"> <?php Userflag::show($season->id, 'tvshow_season'); ?> </div> <?php } } ?> <div id="information_actions"> <h3><?php echo T_('Actions'); ?> :</h3> <ul> <?php if (AmpConfig::get('directplay')) { ?>
?> _video"><?php Rating::show($libitem->id, 'video'); ?> </td> <?php } ?> <?php if (AmpConfig::get('userflags')) { ?> <td class="cel_userflag" id="userflag_<?php echo $libitem->id; ?> _video"><?php Userflag::show($libitem->id, 'video'); ?> </td> <?php } } ?> <td class="cel_action"> <a href="<?php echo $libitem->link; ?> "><?php echo UI::get_icon('preferences', T_('Video Information')); ?> </a> <?php
<dt class="<?php echo $rowparity; ?> "><?php echo T_('Fav.'); ?> </dt> <dd class="<?php echo $rowparity; ?> "> <div id="userflag_<?php echo $video->id; ?> _video"><?php Userflag::show($video->id, 'video'); ?> </div> </dd> <?php } } $rowparity = UI::flip_class(); ?> <dt class="<?php echo $rowparity; ?> "><?php echo T_('Action'); ?> </dt>
public static function stats($input) { $type = $input['type']; $offset = $input['offset']; $limit = $input['limit']; if ($type == "newest") { $albums = Stats::get_newest("album", $limit, $offset); } else { if ($type == "highest") { $albums = Rating::get_highest("album", $limit, $offset); } else { if ($type == "frequent") { $albums = Stats::get_top("album", $limit, '', $offset); } else { if ($type == "recent") { $albums = Stats::get_recent("album", $limit, $offset); } else { if ($type == "flagged") { $albums = Userflag::get_latest('album'); } else { if (!$limit) { $limit = AmpConfig::get('popular_threshold'); } $albums = Album::get_random($limit); } } } } } ob_end_clean(); echo XML_Data::albums($albums); }
<td class="cel_rating" id="rating_<?php echo $album->id; ?> _album"><?php Rating::show($album->id, 'album'); ?> </td> <?php } if (AmpConfig::get('userflags')) { ?> <td class="cel_userflag" id="userflag_<?php echo $album->id; ?> _album"><?php Userflag::show($album->id, 'album'); ?> </td> <?php } ?> <td class="cel_action"> <?php if (AmpConfig::get('sociable') && (!$album->allow_group_disks || $album->allow_group_disks && !count($album->album_suite))) { ?> <a href="<?php echo AmpConfig::get('web_path'); ?> /shout.php?action=show_add_shout&type=album&id=<?php echo $album->id; ?>
/** * gc * * This is a wrapper function for all of the different cleaning * functions, it runs them in an order that resembles correctness. */ public static function gc() { debug_event('catalog', 'Database cleanup started', 5); Song::gc(); Album::gc(); Artist::gc(); Video::gc(); Art::gc(); Stats::gc(); Rating::gc(); Userflag::gc(); Useractivity::gc(); Playlist::gc(); Tmp_Playlist::gc(); Shoutbox::gc(); Tag::gc(); // TODO: use InnoDB with foreign keys and on delete cascade to get rid of garbage collection \Lib\Metadata\Repository\Metadata::gc(); \Lib\Metadata\Repository\MetadataField::gc(); debug_event('catalog', 'Database cleanup ended', 5); }
<?php } ?> <th class="cel_action essential"><?php echo T_('Actions'); ?> </th> </tr> </thead> <tbody> <?php if (AmpConfig::get('ratings')) { Rating::build_cache('album', $object_ids); } if (AmpConfig::get('userflags')) { Userflag::build_cache('album', $object_ids); } /* Foreach through the albums */ foreach ($object_ids as $album_id) { $album = new Album($album_id); $album->allow_group_disks = $allow_group_disks; $album->format(); ?> <tr id="album_<?php echo $album->id; ?> " class="<?php echo UI::flip_class(); ?> "> <?php
"><?php Rating::show($libitem->id, $object_type); ?> </td> <?php } if (AmpConfig::get('userflags')) { ?> <td class="cel_userflag" id="userflag_<?php echo $libitem->id; ?> _<?php echo $object_type; ?> "><?php Userflag::show($libitem->id, $object_type); ?> </td> <?php } } ?> <td class="cel_action"> <?php if (AmpConfig::get('download')) { ?> <a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?> /stream.php?action=download&<?php echo $object_type;
?> _podcast"> <?php Rating::show($libitem->id, 'podcast'); ?> </td> <?php } if (AmpConfig::get('userflags')) { ?> <td class="cel_userflag" id="userflag_<?php echo $libitem->id; ?> _podcast"> <?php Userflag::show($libitem->id, 'podcast'); ?> </td> <?php } } ?> <td class="cel_action"> <?php if (Access::check('interface', '50')) { ?> <a id="<?php echo 'edit_podcast_' . $libitem->id; ?> " onclick="showEditDialog('podcast_row', '<?php echo $libitem->id;
?> _tvshow"><?php Rating::show($libitem->id, 'tvshow'); ?> </td> <?php } ?> <?php if (AmpConfig::get('userflags')) { ?> <td class="cel_userflag" id="userflag_<?php echo $libitem->id; ?> _tvshow"><?php Userflag::show($libitem->id, 'tvshow'); ?> </td> <?php } } ?> <td class="cel_action"> <?php if (Access::check('interface', '50')) { ?> <a id="<?php echo 'edit_tvshow_' . $libitem->id; ?> " onclick="showEditDialog('tvshow_row', '<?php echo $libitem->id;
} ?> <th class="cel_action essential"><?php echo T_('Action'); ?> </th> </tr> </thead> <tbody> <?php // Cache the ratings we are going to use if (AmpConfig::get('ratings')) { Rating::build_cache('artist', $object_ids); } if (AmpConfig::get('userflags')) { Userflag::build_cache('artist', $object_ids); } /* Foreach through every artist that has been passed to us */ foreach ($object_ids as $artist_id) { $artist = new Artist($artist_id, $_SESSION['catalog']); $artist->format(); ?> <tr id="artist_<?php echo $artist->id; ?> " class="<?php echo UI::flip_class(); ?> "> <?php require AmpConfig::get('prefix') . '/templates/show_artist_row.inc.php';
if (User::is_registered()) { ?> <?php if (AmpConfig::get('ratings')) { Rating::build_cache('song', array_map(create_function('$i', '$i=(array) $i; return $i[\'object_id\'];'), $object_ids)); ?> <th class="cel_rating"><?php echo T_('Rating'); ?> </th> <?php } ?> <?php if (AmpConfig::get('userflags')) { Userflag::build_cache('song', array_map(create_function('$i', '$i=(array) $i; return $i[\'object_id\'];'), $object_ids)); ?> <?php } ?> <th class="cel_userflag essential"><?php echo T_('Fav.'); ?> </th> <?php } ?> <th class="cel_action essential"><?php echo T_('Action'); ?> </th>
<?php Rating::show($playlist->id, 'playlist'); ?> </div> <?php } ?> <?php if (AmpConfig::get('userflags')) { ?> <div style="display:table-cell;" id="userflag_<?php echo $playlist->id; ?> _playlist"> <?php Userflag::show($playlist->id, 'playlist'); ?> </div> <?php } } ?> <div id="information_actions"> <ul> <?php if ($GLOBALS['user']->has_access('50')) { ?> <li> <a onclick="submitNewItemsOrder('<?php echo $playlist->id; ?>
public function remove_from_disk() { $deleted = true; $season_ids = $this->get_seasons(); foreach ($season_ids as $id) { $season = new TVShow_Season($id); $deleted = $season->remove_from_disk(); if (!$deleted) { debug_event('tvshow', 'Error when deleting the season `' . $id . '`.', 1); break; } } if ($deleted) { $sql = "DELETE FROM `tvshow` WHERE `id` = ?"; $deleted = Dba::write($sql, array($this->id)); if ($deleted) { Art::gc('tvshow', $this->id); Userflag::gc('tvshow', $this->id); Rating::gc('tvshow', $this->id); Shoutbox::gc('tvshow', $this->id); Useractivity::gc('tvshow', $this->id); } } return $deleted; }
/** * gc * * This is a wrapper function for all of the different cleaning * functions, it runs them in an order that resembles correctness. */ public static function gc() { debug_event('catalog', 'Database cleanup started', 5); Song::gc(); Album::gc(); Artist::gc(); Art::gc(); Stats::gc(); Rating::gc(); Userflag::gc(); Playlist::gc(); Tmp_Playlist::gc(); Shoutbox::gc(); Tag::gc(); debug_event('catalog', 'Database cleanup ended', 5); }
<td class="cel_rating" id="rating_<?php echo $libitem->id; ?> _artist"><?php Rating::show($libitem->id, 'artist'); ?> </td> <?php } if (AmpConfig::get('userflags')) { ?> <td class="cel_userflag" id="userflag_<?php echo $libitem->id; ?> _artist"><?php Userflag::show($libitem->id, 'artist'); ?> </td> <?php } } ?> <td class="cel_action"> <?php if (!AmpConfig::get('use_auth') || Access::check('interface', '25')) { if (AmpConfig::get('sociable') && (!$libitem->allow_group_disks || $libitem->allow_group_disks && !count($libitem->album_suite))) { ?> <a href="<?php echo AmpConfig::get('web_path'); ?> /shout.php?action=show_add_shout&type=artist&id=<?php
<td class="cel_rating" id="rating_<?php echo $libitem->id; ?> _album"><?php Rating::show($libitem->id, 'album'); ?> </td> <?php } if (AmpConfig::get('userflags')) { ?> <td class="cel_userflag" id="userflag_<?php echo $libitem->id; ?> _album"><?php Userflag::show($libitem->id, 'album'); ?> </td> <?php } } ?> <td class="cel_action"> <?php if (!AmpConfig::get('use_auth') || Access::check('interface', '25')) { if (AmpConfig::get('sociable') && (!$libitem->allow_group_disks || $libitem->allow_group_disks && !count($libitem->album_suite))) { ?> <a href="<?php echo AmpConfig::get('web_path'); ?> /shout.php?action=show_add_shout&type=album&id=<?php
echo T_('Rating'); ?> </label> <div id="rating_<?php echo $media->id; ?> _song"> <?php Rating::show($media->id, 'song'); ?> </div> </div> <div class="np_cell cel_userflag"> <label><?php echo T_('Fav.'); ?> </label> <div id="userflag_<?php echo $media->id; ?> _song"> <?php Userflag::show($media->id, 'song'); ?> </div> </div> <?php } ?> </div>
<?php show_rating($tvshow->id, 'tvshow'); ?> </div> <?php } ?> <?php if (AmpConfig::get('userflags')) { ?> <div style="display:table-cell;" id="userflag_<?php echo $tvshow->id; ?> _tvshow"> <?php Userflag::show($tvshow->id, 'tvshow'); ?> </div> <?php } } ?> <div id="information_actions"> <h3><?php echo T_('Actions'); ?> :</h3> <ul> <?php if (AmpConfig::get('directplay')) { ?>
?> _tvshow_season"> <?php Rating::show($libitem->id, 'tvshow_season'); ?> </td> <?php } if (AmpConfig::get('userflags')) { ?> <td class="cel_userflag" id="userflag_<?php echo $libitem->id; ?> _tvshow_season"> <?php Userflag::show($libitem->id, 'tvshow_season'); ?> </td> <?php } } ?> <td class="cel_action"> <?php if (Access::check('interface', '50')) { ?> <a id="<?php echo 'edit_tvshow_season_' . $libitem->id; ?> " onclick="showEditDialog('tvshow_season_row', '<?php echo $libitem->id;
$rating = new Rating($_GET['object_id'], $_GET['rating_type']); $rating->set_rating($_GET['rating']); Rating::show($_GET['object_id'], $_GET['rating_type']); $key = "rating_" . $_GET['object_id'] . "_" . $_GET['rating_type']; $results[$key] = ob_get_contents(); ob_end_clean(); } else { $results['rfc3514'] = '0x1'; } break; /* Setting userflags */ /* Setting userflags */ case 'set_userflag': if (User::is_registered()) { ob_start(); $userflag = new Userflag($_GET['object_id'], $_GET['userflag_type']); $userflag->set_flag($_GET['userflag']); Userflag::show($_GET['object_id'], $_GET['userflag_type']); $key = "userflag_" . $_GET['object_id'] . "_" . $_GET['userflag_type']; $results[$key] = ob_get_contents(); ob_end_clean(); } else { $results['rfc3514'] = '0x1'; } break; case 'action_buttons': ob_start(); if (AmpConfig::get('ratings')) { echo " <div id='rating_" . $_GET['object_id'] . "_" . $_GET['object_type'] . "'>"; Rating::show($_GET['object_id'], $_GET['object_type']); echo "</div> |";
<?php if (AmpConfig::get('ratings')) { ++$thcount; Rating::build_cache('song', $object_ids); ?> <th class="cel_rating optional"><?php echo T_('Rating'); ?> </th> <?php } ?> <?php if (AmpConfig::get('userflags')) { ++$thcount; Userflag::build_cache('song', $object_ids); ?> <th class="cel_userflag optional"><?php echo T_('Fav.'); ?> </th> <?php } ?> <th class="cel_action essential"><?php echo T_('Action'); ?> </th> <?php if (isset($argument) && $argument) { ++$thcount;
} ?> <th class="cel_action essential"><?php echo T_('Action'); ?> </th> </tr> </thead> <tbody> <?php // Cache the ratings we are going to use if (AmpConfig::get('ratings')) { Rating::build_cache('tvshow', $object_ids); } if (AmpConfig::get('userflags')) { Userflag::build_cache('tvshow', $object_ids); } /* Foreach through every tv show that has been passed to us */ foreach ($object_ids as $tvshow_id) { $libitem = new TVShow($tvshow_id); $libitem->format(); ?> <tr id="tvshow_<?php echo $libitem->id; ?> " class="<?php echo UI::flip_class(); ?> "> <?php require AmpConfig::get('prefix') . UI::find_template('show_tvshow_row.inc.php');
<td class="cel_rating" id="rating_<?php echo $artist->id; ?> _artist"><?php Rating::show($artist->id, 'artist'); ?> </td> <?php } if (AmpConfig::get('userflags')) { ?> <td class="cel_userflag" id="userflag_<?php echo $artist->id; ?> _artist"><?php Userflag::show($artist->id, 'artist'); ?> </td> <?php } ?> <td class="cel_action"> <?php if (Access::check_function('batch_download')) { ?> <a href="<?php echo AmpConfig::get('web_path'); ?> /batch.php?action=artist&id=<?php echo $artist->id; ?>
_song"> <?php Rating::show($libitem->id, 'song'); ?> </td> <?php } if (AmpConfig::get('userflags')) { ?> <td class="cel_userflag" id="userflag_<?php echo $libitem->id; ?> _song"> <?php Userflag::show($libitem->id, 'song'); ?> </td> <?php } } ?> <td class="cel_action"> <a href="<?php echo $libitem->link; ?> "><?php echo UI::get_icon('preferences', T_('Song Information')); ?> </a> <?php