mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
Requires user catalog right to edit arts
Avoid additional sql requests on searches
This commit is contained in:
parent
a59af3e965
commit
173d5e9d76
24 changed files with 117 additions and 96 deletions
7
arts.php
7
arts.php
|
@ -24,6 +24,9 @@ require_once 'lib/init.php';
|
||||||
|
|
||||||
require_once AmpConfig::get('prefix') . '/templates/header.inc.php';
|
require_once AmpConfig::get('prefix') . '/templates/header.inc.php';
|
||||||
|
|
||||||
|
// If not a content manager user then kick em out
|
||||||
|
if (!Access::check('interface','50')) { UI::access_denied(); exit; }
|
||||||
|
|
||||||
$object_type = $_GET['object_type'];
|
$object_type = $_GET['object_type'];
|
||||||
$object_id = $_GET['object_id'];
|
$object_id = $_GET['object_id'];
|
||||||
$burl = '';
|
$burl = '';
|
||||||
|
@ -34,7 +37,6 @@ if (isset($_GET['burl'])) {
|
||||||
/* Switch on Action */
|
/* Switch on Action */
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'clear_art':
|
case 'clear_art':
|
||||||
if (!$GLOBALS['user']->has_access('75')) { UI::access_denied(); }
|
|
||||||
$art = new Art($object_id, $object_type);
|
$art = new Art($object_id, $object_type);
|
||||||
$art->reset();
|
$art->reset();
|
||||||
show_confirmation(T_('Art Cleared'), T_('Art information has been removed from the database'), $burl);
|
show_confirmation(T_('Art Cleared'), T_('Art information has been removed from the database'), $burl);
|
||||||
|
@ -64,9 +66,6 @@ switch ($_REQUEST['action']) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'find_art':
|
case 'find_art':
|
||||||
// If not a user then kick em out
|
|
||||||
if (!Access::check('interface','25')) { UI::access_denied(); exit; }
|
|
||||||
|
|
||||||
// Prevent the script from timing out
|
// Prevent the script from timing out
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
|
|
|
@ -577,13 +577,26 @@ class Album extends database_object implements library_item
|
||||||
* album information with the base required
|
* album information with the base required
|
||||||
* f_link, f_name
|
* f_link, f_name
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
$web_path = AmpConfig::get('web_path');
|
$web_path = AmpConfig::get('web_path');
|
||||||
|
|
||||||
/* Pull the advanced information */
|
if ($details) {
|
||||||
$data = $this->_get_extra_info();
|
/* Pull the advanced information */
|
||||||
foreach ($data as $key=>$value) { $this->$key = $value; }
|
$data = $this->_get_extra_info();
|
||||||
|
foreach ($data as $key=>$value) { $this->$key = $value; }
|
||||||
|
|
||||||
|
if ($this->album_artist) {
|
||||||
|
$Album_artist = new Artist($this->album_artist);
|
||||||
|
$Album_artist->format();
|
||||||
|
$this->album_artist_name = $Album_artist->name;
|
||||||
|
$this->f_album_artist_name = $Album_artist->f_name;
|
||||||
|
$this->f_album_artist_link = "<a href=\"" . $web_path . "/artists.php?action=show&artist=" . $this->album_artist . "\" title=\"" . scrub_out($this->album_artist_name) . "\">" . $this->f_album_artist_name . "</a>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->tags = Tag::get_top_tags('album', $this->id);
|
||||||
|
$this->f_tags = Tag::get_display($this->tags, true, 'album');
|
||||||
|
}
|
||||||
|
|
||||||
/* Truncate the string if it's to long */
|
/* Truncate the string if it's to long */
|
||||||
$this->f_name = $this->full_name;
|
$this->f_name = $this->full_name;
|
||||||
|
@ -611,21 +624,10 @@ class Album extends database_object implements library_item
|
||||||
$this->f_artist_name = $this->f_artist;
|
$this->f_artist_name = $this->f_artist;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->album_artist) {
|
|
||||||
$Album_artist = new Artist($this->album_artist);
|
|
||||||
$Album_artist->format();
|
|
||||||
$this->album_artist_name = $Album_artist->name;
|
|
||||||
$this->f_album_artist_name = $Album_artist->f_name;
|
|
||||||
$this->f_album_artist_link = "<a href=\"" . $web_path . "/artists.php?action=show&artist=" . $this->album_artist . "\" title=\"" . scrub_out($this->album_artist_name) . "\">" . $this->f_album_artist_name . "</a>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->year) {
|
if (!$this->year) {
|
||||||
$this->f_year = "N/A";
|
$this->f_year = "N/A";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tags = Tag::get_top_tags('album', $this->id);
|
|
||||||
$this->f_tags = Tag::get_display($this->tags, true, 'album');
|
|
||||||
|
|
||||||
$this->f_release_type = ucwords($this->release_type);
|
$this->f_release_type = ucwords($this->release_type);
|
||||||
|
|
||||||
} // format
|
} // format
|
||||||
|
|
|
@ -1495,12 +1495,11 @@ class Art extends database_object
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
}
|
}
|
||||||
echo "<div class=\"item_art_actions\">";
|
echo "<div class=\"item_art_actions\">";
|
||||||
if ($GLOBALS['user']->has_access(25)) {
|
if ($GLOBALS['user']->has_access(50)) {
|
||||||
echo "<a href=\"javascript:NavigateTo('" . AmpConfig::get('web_path') . "/arts.php?action=find_art&object_type=" . $object_type . "&object_id=" . $object_id . "&burl=' + getCurrentPage());\">";
|
echo "<a href=\"javascript:NavigateTo('" . AmpConfig::get('web_path') . "/arts.php?action=find_art&object_type=" . $object_type . "&object_id=" . $object_id . "&burl=' + getCurrentPage());\">";
|
||||||
echo UI::get_icon('edit', T_('Edit/Find Art'));
|
echo UI::get_icon('edit', T_('Edit/Find Art'));
|
||||||
echo "</a>";
|
echo "</a>";
|
||||||
}
|
|
||||||
if ($GLOBALS['user']->has_access(75)) {
|
|
||||||
echo "<a href=\"javascript:NavigateTo('" . AmpConfig::get('web_path') . "/arts.php?action=clear_art&object_type=" . $object_type . "&object_id=" . $object_id . "&burl=' + getCurrentPage());\" onclick=\"return confirm('" . T_('Do you really want to reset art?') . "');\">";
|
echo "<a href=\"javascript:NavigateTo('" . AmpConfig::get('web_path') . "/arts.php?action=clear_art&object_type=" . $object_type . "&object_id=" . $object_id . "&burl=' + getCurrentPage());\" onclick=\"return confirm('" . T_('Do you really want to reset art?') . "');\">";
|
||||||
echo UI::get_icon('delete', T_('Reset Art'));
|
echo UI::get_icon('delete', T_('Reset Art'));
|
||||||
echo "</a>";
|
echo "</a>";
|
||||||
|
|
|
@ -421,7 +421,7 @@ class Artist extends database_object implements library_item
|
||||||
* it changes the title into a full link.
|
* it changes the title into a full link.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
/* Combine prefix and name, trim then add ... if needed */
|
/* Combine prefix and name, trim then add ... if needed */
|
||||||
$name = trim($this->prefix . " " . $this->name);
|
$name = trim($this->prefix . " " . $this->name);
|
||||||
|
@ -438,21 +438,24 @@ class Artist extends database_object implements library_item
|
||||||
$this->f_link = AmpConfig::get('web_path') . '/artists.php?action=show&artist=' . $this->id;
|
$this->f_link = AmpConfig::get('web_path') . '/artists.php?action=show&artist=' . $this->id;
|
||||||
$this->f_name_link = "<a href=\"" . $this->f_link . "\" title=\"" . $this->f_full_name . "\">" . $name . "</a>";
|
$this->f_name_link = "<a href=\"" . $this->f_link . "\" title=\"" . $this->f_full_name . "\">" . $name . "</a>";
|
||||||
}
|
}
|
||||||
// Get the counts
|
|
||||||
$extra_info = $this->_get_extra_info($this->catalog_id);
|
|
||||||
|
|
||||||
//Format the new time thingy that we just got
|
if ($details) {
|
||||||
$min = sprintf("%02d",(floor($extra_info['time']/60)%60));
|
// Get the counts
|
||||||
|
$extra_info = $this->_get_extra_info($this->catalog_id);
|
||||||
|
|
||||||
$sec = sprintf("%02d",($extra_info['time']%60));
|
//Format the new time thingy that we just got
|
||||||
$hours = floor($extra_info['time']/3600);
|
$min = sprintf("%02d",(floor($extra_info['time']/60)%60));
|
||||||
|
|
||||||
$this->f_time = ltrim($hours . ':' . $min . ':' . $sec,'0:');
|
$sec = sprintf("%02d",($extra_info['time']%60));
|
||||||
|
$hours = floor($extra_info['time']/3600);
|
||||||
|
|
||||||
$this->tags = Tag::get_top_tags('artist', $this->id);
|
$this->f_time = ltrim($hours . ':' . $min . ':' . $sec,'0:');
|
||||||
$this->f_tags = Tag::get_display($this->tags, true, 'artist');
|
|
||||||
|
|
||||||
$this->object_cnt = $extra_info['object_cnt'];
|
$this->tags = Tag::get_top_tags('artist', $this->id);
|
||||||
|
$this->f_tags = Tag::get_display($this->tags, true, 'artist');
|
||||||
|
|
||||||
|
$this->object_cnt = $extra_info['object_cnt'];
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -176,12 +176,14 @@ class Broadcast extends database_object implements library_item
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
$this->f_name = $this->name;
|
$this->f_name = $this->name;
|
||||||
$this->f_link = '<a href="' . AmpConfig::get('web_path') . '/broadcast.php?id=' . $this->id . '">' . scrub_out($this->f_name) . '</a>';
|
$this->f_link = '<a href="' . AmpConfig::get('web_path') . '/broadcast.php?id=' . $this->id . '">' . scrub_out($this->f_name) . '</a>';
|
||||||
$this->tags = Tag::get_top_tags('broadcast', $this->id);
|
if ($details) {
|
||||||
$this->f_tags = Tag::get_display($this->tags, true, 'broadcast');
|
$this->tags = Tag::get_top_tags('broadcast', $this->id);
|
||||||
|
$this->f_tags = Tag::get_display($this->tags, true, 'broadcast');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -182,10 +182,12 @@ class Channel extends database_object implements media, library_item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
$this->tags = Tag::get_top_tags('channel', $this->id);
|
if ($details) {
|
||||||
$this->f_tags = Tag::get_display($this->tags, true, 'channel');
|
$this->tags = Tag::get_top_tags('channel', $this->id);
|
||||||
|
$this->f_tags = Tag::get_display($this->tags, true, 'channel');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_keywords()
|
public function get_keywords()
|
||||||
|
|
|
@ -91,20 +91,22 @@ class Clip extends Video
|
||||||
* this function takes the object and reformats some values
|
* this function takes the object and reformats some values
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
parent::format();
|
parent::format($details);
|
||||||
|
|
||||||
if ($this->artist) {
|
if ($details) {
|
||||||
$artist = new Artist($this->artist);
|
if ($this->artist) {
|
||||||
$artist->format();
|
$artist = new Artist($this->artist);
|
||||||
$this->f_artist = $artist->f_link;
|
$artist->format();
|
||||||
}
|
$this->f_artist = $artist->f_link;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->song) {
|
if ($this->song) {
|
||||||
$song = new Song($this->song);
|
$song = new Song($this->song);
|
||||||
$song->format();
|
$song->format();
|
||||||
$this->f_song = $song->f_link;
|
$this->f_song = $song->f_link;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -148,7 +148,7 @@ class Democratic extends Tmp_Playlist
|
||||||
* format
|
* format
|
||||||
* This makes the variables all purrty so that they can be displayed
|
* This makes the variables all purrty so that they can be displayed
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
$this->f_cooldown = $this->cooldown . ' ' . T_('minutes');
|
$this->f_cooldown = $this->cooldown . ' ' . T_('minutes');
|
||||||
$this->f_primary = $this->primary ? T_('Primary') : '';
|
$this->f_primary = $this->primary ? T_('Primary') : '';
|
||||||
|
|
|
@ -92,7 +92,7 @@ class Live_Stream extends database_object implements media, library_item
|
||||||
* This takes the normal data from the database and makes it pretty
|
* This takes the normal data from the database and makes it pretty
|
||||||
* for the users, the new variables are put in f_??? and f_???_link
|
* for the users, the new variables are put in f_??? and f_???_link
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
// Default link used on the rightbar
|
// Default link used on the rightbar
|
||||||
$this->f_link = "<a href=\"$this->url\">$this->name</a>";
|
$this->f_link = "<a href=\"$this->url\">$this->name</a>";
|
||||||
|
|
|
@ -114,9 +114,9 @@ class Movie extends Video
|
||||||
* this function takes the object and reformats some values
|
* this function takes the object and reformats some values
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
parent::format();
|
parent::format($details);
|
||||||
|
|
||||||
$this->f_original_name = trim($this->prefix . " " . $this->f_title);
|
$this->f_original_name = trim($this->prefix . " " . $this->f_title);
|
||||||
$this->f_title = ($this->f_original_name ?: $this->f_title);
|
$this->f_title = ($this->f_original_name ?: $this->f_title);
|
||||||
|
|
|
@ -92,9 +92,9 @@ class Personal_Video extends Video
|
||||||
* this function takes the object and reformats some values
|
* this function takes the object and reformats some values
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
parent::format();
|
parent::format($details);
|
||||||
|
|
||||||
$this->f_location = $this->location;
|
$this->f_location = $this->location;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ interface playable_item
|
||||||
*
|
*
|
||||||
* Creates member variables for output
|
* Creates member variables for output
|
||||||
*/
|
*/
|
||||||
public function format();
|
public function format($details = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_fullname
|
* get_fullname
|
||||||
|
|
|
@ -118,9 +118,9 @@ class Playlist extends playlist_object
|
||||||
* This takes the current playlist object and gussies it up a little
|
* This takes the current playlist object and gussies it up a little
|
||||||
* bit so it is presentable to the users
|
* bit so it is presentable to the users
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
parent::format();
|
parent::format($details);
|
||||||
$this->f_link = AmpConfig::get('web_path') . '/playlist.php?action=show_playlist&playlist_id=' . $this->id;
|
$this->f_link = AmpConfig::get('web_path') . '/playlist.php?action=show_playlist&playlist_id=' . $this->id;
|
||||||
$this->f_name_link = '<a href="' . $this->f_link . '">' . $this->f_name . '</a>';
|
$this->f_name_link = '<a href="' . $this->f_link . '">' . $this->f_name . '</a>';
|
||||||
|
|
||||||
|
|
|
@ -64,14 +64,15 @@ abstract class playlist_object extends database_object implements library_item
|
||||||
* This takes the current playlist object and gussies it up a little
|
* This takes the current playlist object and gussies it up a little
|
||||||
* bit so it is presentable to the users
|
* bit so it is presentable to the users
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
$this->f_name = $this->name;
|
$this->f_name = $this->name;
|
||||||
$this->f_type = ($this->type == 'private') ? UI::get_icon('lock', T_('Private')) : '';
|
$this->f_type = ($this->type == 'private') ? UI::get_icon('lock', T_('Private')) : '';
|
||||||
|
|
||||||
$client = new User($this->user);
|
if ($details) {
|
||||||
|
$client = new User($this->user);
|
||||||
$this->f_user = $client->fullname;
|
$this->f_user = $client->fullname;
|
||||||
|
}
|
||||||
|
|
||||||
} // format
|
} // format
|
||||||
|
|
||||||
|
|
|
@ -622,9 +622,10 @@ class Search extends playlist_object
|
||||||
* format
|
* format
|
||||||
* Gussy up the data
|
* Gussy up the data
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
parent::format();
|
parent::format();
|
||||||
|
|
||||||
$this->f_link = AmpConfig::get('web_path') . '/smartplaylist.php?action=show_playlist&playlist_id=' . $this->id;
|
$this->f_link = AmpConfig::get('web_path') . '/smartplaylist.php?action=show_playlist&playlist_id=' . $this->id;
|
||||||
$this->f_name_link = '<a href="' . $this->f_link . '">' . $this->f_name . '</a>';
|
$this->f_name_link = '<a href="' . $this->f_link . '">' . $this->f_name . '</a>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,13 +194,15 @@ class Share extends database_object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
$object = new $this->object_type($this->object_id);
|
if ($details) {
|
||||||
$object->format();
|
$object = new $this->object_type($this->object_id);
|
||||||
$this->f_object_link = $object->f_link;
|
$object->format();
|
||||||
$user = new User($this->user);
|
$this->f_object_link = $object->f_link;
|
||||||
$this->f_user = $user->fullname;
|
$user = new User($this->user);
|
||||||
|
$this->f_user = $user->fullname;
|
||||||
|
}
|
||||||
$this->f_allow_stream = $this->allow_stream;
|
$this->f_allow_stream = $this->allow_stream;
|
||||||
$this->f_allow_download = $this->allow_download;
|
$this->f_allow_download = $this->allow_download;
|
||||||
$this->f_creation_date = date("Y-m-d H:i:s", $this->creation_date);
|
$this->f_creation_date = date("Y-m-d H:i:s", $this->creation_date);
|
||||||
|
|
|
@ -1243,9 +1243,15 @@ class Song extends database_object implements media, library_item
|
||||||
* and does a ton of formating on it creating f_??? variables on the current
|
* and does a ton of formating on it creating f_??? variables on the current
|
||||||
* object
|
* object
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
$this->fill_ext_info();
|
if ($details) {
|
||||||
|
$this->fill_ext_info();
|
||||||
|
|
||||||
|
// Get the top tags
|
||||||
|
$this->tags = Tag::get_top_tags('song', $this->id);
|
||||||
|
$this->f_tags = Tag::get_display($this->tags, true, 'song');
|
||||||
|
}
|
||||||
|
|
||||||
// Format the album name
|
// Format the album name
|
||||||
$this->f_album_full = $this->get_album_name();
|
$this->f_album_full = $this->get_album_name();
|
||||||
|
@ -1285,10 +1291,6 @@ class Song extends database_object implements media, library_item
|
||||||
// Format the track (there isn't really anything to do here)
|
// Format the track (there isn't really anything to do here)
|
||||||
$this->f_track = (string) $this->track;
|
$this->f_track = (string) $this->track;
|
||||||
|
|
||||||
// Get the top tags
|
|
||||||
$this->tags = Tag::get_top_tags('song', $this->id);
|
|
||||||
$this->f_tags = Tag::get_display($this->tags, true, 'song');
|
|
||||||
|
|
||||||
// Format the size
|
// Format the size
|
||||||
$this->f_size = UI::format_bytes($this->size);
|
$this->f_size = UI::format_bytes($this->size);
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ class Song_Preview extends database_object implements media, playable_item
|
||||||
* and does a ton of formating on it creating f_??? variables on the current
|
* and does a ton of formating on it creating f_??? variables on the current
|
||||||
* object
|
* object
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
// Format the artist name
|
// Format the artist name
|
||||||
if ($this->artist) {
|
if ($this->artist) {
|
||||||
|
|
|
@ -646,7 +646,7 @@ class Tag extends database_object implements library_item
|
||||||
|
|
||||||
} // remove_map
|
} // remove_map
|
||||||
|
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,15 +175,17 @@ class TVShow extends database_object implements library_item
|
||||||
* format
|
* format
|
||||||
* this function takes the object and reformats some values
|
* this function takes the object and reformats some values
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
$this->f_name = trim($this->prefix . " " . $this->name);
|
$this->f_name = trim($this->prefix . " " . $this->name);
|
||||||
$this->link = AmpConfig::get('web_path') . '/tvshows.php?action=show&tvshow=' . $this->id;
|
$this->link = AmpConfig::get('web_path') . '/tvshows.php?action=show&tvshow=' . $this->id;
|
||||||
$this->f_link = '<a href="' . $this->link . '" title="' . $this->f_name . '">' . $this->f_name . '</a>';
|
$this->f_link = '<a href="' . $this->link . '" title="' . $this->f_name . '">' . $this->f_name . '</a>';
|
||||||
|
|
||||||
$this->_get_extra_info();
|
if ($details) {
|
||||||
$this->tags = Tag::get_top_tags('tvshow', $this->id);
|
$this->_get_extra_info();
|
||||||
$this->f_tags = Tag::get_display($this->tags, true, 'tvshow');
|
$this->tags = Tag::get_top_tags('tvshow', $this->id);
|
||||||
|
$this->f_tags = Tag::get_display($this->tags, true, 'tvshow');
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,12 +144,12 @@ class TVShow_Episode extends Video
|
||||||
* format
|
* format
|
||||||
* this function takes the object and reformats some values
|
* this function takes the object and reformats some values
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
parent::format();
|
parent::format($details);
|
||||||
|
|
||||||
$season = new TVShow_Season($this->season);
|
$season = new TVShow_Season($this->season);
|
||||||
$season->format();
|
$season->format($details);
|
||||||
|
|
||||||
$this->f_title = ($this->original_name ?: $this->f_title);
|
$this->f_title = ($this->original_name ?: $this->f_title);
|
||||||
$this->f_link = '<a href="' . $this->link . '">' . $this->f_title . '</a>';
|
$this->f_link = '<a href="' . $this->link . '">' . $this->f_title . '</a>';
|
||||||
|
|
|
@ -129,19 +129,21 @@ class TVShow_Season extends database_object implements library_item
|
||||||
* format
|
* format
|
||||||
* this function takes the object and reformats some values
|
* this function takes the object and reformats some values
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
$this->f_name = T_('Season') . ' ' . $this->season_number;
|
$this->f_name = T_('Season') . ' ' . $this->season_number;
|
||||||
|
|
||||||
$tvshow = new TVShow($this->tvshow);
|
$tvshow = new TVShow($this->tvshow);
|
||||||
$tvshow->format();
|
$tvshow->format($details);
|
||||||
$this->f_tvshow = $tvshow->f_name;
|
$this->f_tvshow = $tvshow->f_name;
|
||||||
$this->f_tvshow_link = $tvshow->f_link;
|
$this->f_tvshow_link = $tvshow->f_link;
|
||||||
|
|
||||||
$this->link = AmpConfig::get('web_path') . '/tvshow_seasons.php?action=show&season=' . $this->id;
|
$this->link = AmpConfig::get('web_path') . '/tvshow_seasons.php?action=show&season=' . $this->id;
|
||||||
$this->f_link = '<a href="' . $this->link . '" title="' . $tvshow->f_name . ' - ' . $this->f_name . '">' . $this->f_name . '</a>';
|
$this->f_link = '<a href="' . $this->link . '" title="' . $tvshow->f_name . ' - ' . $this->f_name . '">' . $this->f_name . '</a>';
|
||||||
|
|
||||||
$this->_get_extra_info();
|
if ($details) {
|
||||||
|
$this->_get_extra_info();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ class Video extends database_object implements media, library_item
|
||||||
* format
|
* format
|
||||||
* This formats a video object so that it is human readable
|
* This formats a video object so that it is human readable
|
||||||
*/
|
*/
|
||||||
public function format()
|
public function format($details = true)
|
||||||
{
|
{
|
||||||
$this->f_title = scrub_out($this->title);
|
$this->f_title = scrub_out($this->title);
|
||||||
$this->f_full_title = $this->f_title;
|
$this->f_full_title = $this->f_title;
|
||||||
|
@ -274,9 +274,11 @@ class Video extends database_object implements media, library_item
|
||||||
$min_h = sprintf("%02d", ($min%60));
|
$min_h = sprintf("%02d", ($min%60));
|
||||||
$this->f_time_h = $hour . ":" . $min_h . ":" . $sec;
|
$this->f_time_h = $hour . ":" . $min_h . ":" . $sec;
|
||||||
|
|
||||||
// Get the top tags
|
if ($details) {
|
||||||
$this->tags = Tag::get_top_tags('video', $this->id);
|
// Get the top tags
|
||||||
$this->f_tags = Tag::get_display($this->tags, true, 'video');
|
$this->tags = Tag::get_top_tags('video', $this->id);
|
||||||
|
$this->f_tags = Tag::get_display($this->tags, true, 'video');
|
||||||
|
}
|
||||||
|
|
||||||
$this->f_length = floor($this->time/60) . ' ' . T_('minutes');
|
$this->f_length = floor($this->time/60) . ' ' . T_('minutes');
|
||||||
$this->f_file = $this->f_title . '.' . $this->type;
|
$this->f_file = $this->f_title . '.' . $this->type;
|
||||||
|
|
|
@ -50,7 +50,7 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
foreach ($sres as $id) {
|
foreach ($sres as $id) {
|
||||||
$artist = new Artist($id);
|
$artist = new Artist($id);
|
||||||
$artist->format();
|
$artist->format(false);
|
||||||
$results[] = array(
|
$results[] = array(
|
||||||
'type' => T_('Artists'),
|
'type' => T_('Artists'),
|
||||||
'link' => $artist->f_link,
|
'link' => $artist->f_link,
|
||||||
|
@ -79,7 +79,7 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
foreach ($sres as $id) {
|
foreach ($sres as $id) {
|
||||||
$album = new Album($id);
|
$album = new Album($id);
|
||||||
$album->format();
|
$album->format(false);
|
||||||
$a_title = $album->f_title;
|
$a_title = $album->f_title;
|
||||||
if ($album->disk) {
|
if ($album->disk) {
|
||||||
$a_title .= " [" . T_('Disk') . " " . $album->disk . "]";
|
$a_title .= " [" . T_('Disk') . " " . $album->disk . "]";
|
||||||
|
@ -112,7 +112,7 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
foreach ($sres as $id) {
|
foreach ($sres as $id) {
|
||||||
$song = new Song($id);
|
$song = new Song($id);
|
||||||
$song->format();
|
$song->format(false);
|
||||||
$results[] = array(
|
$results[] = array(
|
||||||
'type' => T_('Songs'),
|
'type' => T_('Songs'),
|
||||||
'link' => $song->link,
|
'link' => $song->link,
|
||||||
|
@ -141,7 +141,7 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
foreach ($sres as $id) {
|
foreach ($sres as $id) {
|
||||||
$playlist = new Playlist($id);
|
$playlist = new Playlist($id);
|
||||||
$playlist->format();
|
$playlist->format(false);
|
||||||
$results[] = array(
|
$results[] = array(
|
||||||
'type' => T_('Playlists'),
|
'type' => T_('Playlists'),
|
||||||
'link' => $playlist->f_link,
|
'link' => $playlist->f_link,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue