mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
Add Latest Artists and Latest Shouts rss feeds
Fix javascript escape string on cookie disclaimer notice
This commit is contained in:
parent
a4eafa834d
commit
a527a27e7d
5 changed files with 86 additions and 9 deletions
|
@ -74,7 +74,10 @@ class Ampache_RSS
|
|||
{
|
||||
$titles = array('now_playing' => T_('Now Playing'),
|
||||
'recently_played' => T_('Recently Played'),
|
||||
'latest_album' => T_('Newest Albums'));
|
||||
'latest_album' => T_('Newest Albums'),
|
||||
'latest_artist' => T_('Newest Artists'),
|
||||
'latest_shout' => T_('Newest Shouts')
|
||||
);
|
||||
|
||||
return scrub_out(AmpConfig::get('site_title')) . ' - ' . $titles[$this->type];
|
||||
|
||||
|
@ -100,7 +103,7 @@ class Ampache_RSS
|
|||
*/
|
||||
public static function validate_type($type)
|
||||
{
|
||||
$valid_types = array('now_playing','recently_played','latest_album');
|
||||
$valid_types = array('now_playing','recently_played','latest_album','latest_artist','latest_shout');
|
||||
|
||||
if (!in_array($type,$valid_types)) {
|
||||
return 'now_playing';
|
||||
|
@ -276,7 +279,71 @@ class Ampache_RSS
|
|||
|
||||
return $results;
|
||||
|
||||
} // load_recently_played
|
||||
} // load_latest_album
|
||||
|
||||
/**
|
||||
* load_latest_artist
|
||||
* This loads in the latest added artists
|
||||
* @return array
|
||||
*/
|
||||
public static function load_latest_artist()
|
||||
{
|
||||
$ids = Stats::get_newest('artist', 10);
|
||||
|
||||
$results = array();
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$artist = new Artist($id);
|
||||
$artist->format();
|
||||
|
||||
$xml_array = array('title' => $artist->f_name,
|
||||
'link' => $artist->link,
|
||||
'description' => $artist->summary,
|
||||
'image' => Art::url($artist->id, 'artist'),
|
||||
'comments' => '',
|
||||
'pubDate' => ''
|
||||
);
|
||||
$results[] = $xml_array;
|
||||
|
||||
} // end foreach
|
||||
|
||||
return $results;
|
||||
|
||||
} // load_latest_artist
|
||||
|
||||
/**
|
||||
* load_latest_shout
|
||||
* This loads in the latest added shouts
|
||||
* @return array
|
||||
*/
|
||||
public static function load_latest_shout()
|
||||
{
|
||||
$ids = Shoutbox::get_top(10);
|
||||
|
||||
$results = array();
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$shout = new Shoutbox($id);
|
||||
$shout->format();
|
||||
$object = Shoutbox::get_object($shout->object_type, $shout->object_id);
|
||||
$object->format();
|
||||
$user = new User($shout->user);
|
||||
$user->format();
|
||||
|
||||
$xml_array = array('title' => T_('Shout by') . ' ' . $user->username . ' ' . T_('on') . ' ' . $object->get_fullname(),
|
||||
'link' => $object->link,
|
||||
'description' => $shout->text,
|
||||
'image' => Art::url($shout->object_id, $shout->object_type),
|
||||
'comments' => '',
|
||||
'pubDate' => date("c", $shout->date)
|
||||
);
|
||||
$results[] = $xml_array;
|
||||
|
||||
} // end foreach
|
||||
|
||||
return $results;
|
||||
|
||||
} // load_latest_shout
|
||||
|
||||
/**
|
||||
* pubdate_recently_played
|
||||
|
|
|
@ -32,6 +32,8 @@ class Shoutbox
|
|||
public $date;
|
||||
|
||||
public $f_link;
|
||||
public $f_date;
|
||||
public $f_text;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -210,7 +212,8 @@ class Shoutbox
|
|||
public function format()
|
||||
{
|
||||
$this->sticky = ($this->sticky == "0") ? 'No' : 'Yes';
|
||||
$this->date = date("m\/d\/Y - H:i", $this->date);
|
||||
$this->f_date = date("m\/d\/Y - H:i", $this->date);
|
||||
$this->f_text = preg_replace('/(\r\n|\n|\r)/', '<br />', $this->text);
|
||||
return true;
|
||||
|
||||
} //format
|
||||
|
@ -246,7 +249,7 @@ class Shoutbox
|
|||
$html .= "<div class='shoutbox-object'>" . $object->f_link . "</div>";
|
||||
$html .= "<div class='shoutbox-date'>".date("Y/m/d H:i:s", $this->date) . "</div>";
|
||||
}
|
||||
$html .= "<div class='shoutbox-text'>" . preg_replace('/(\r\n|\n|\r)/', '<br />', $this->text) . "</div>";
|
||||
$html .= "<div class='shoutbox-text'>" . $this->f_text . "</div>";
|
||||
$html .= "</div>";
|
||||
$html .= "</div>";
|
||||
$html .= "<div class='shoutbox-footer'>";
|
||||
|
|
Binary file not shown.
|
@ -4178,8 +4178,8 @@ msgid ""
|
|||
"at any time. Otherwise, we\\'ll assume you\\'re OK to continue.<br /><br /"
|
||||
">Click on this message do not display it again."
|
||||
msgstr ""
|
||||
"à n'importe quel moment. Sinon, nous supposons que vous êtes OK pour "
|
||||
"continuer. <br /> <br /> Cliquez sur ce message ne pas afficher à nouveau."
|
||||
"à tout moment. Sinon, nous supposons que vous êtes OK pour "
|
||||
"continuer. <br /> <br /> Cliquez sur ce message pour ne plus l\\'afficher."
|
||||
|
||||
#: ../../templates/header.inc.php:303
|
||||
msgid "Log out"
|
||||
|
|
|
@ -37,6 +37,10 @@ $_SESSION['login'] = false;
|
|||
<link rel="alternate" type="application/rss+xml" title="<?php echo T_('Now Playing'); ?>" href="<?php echo $web_path; ?>/rss.php" />
|
||||
<link rel="alternate" type="application/rss+xml" title="<?php echo T_('Recently Played'); ?>" href="<?php echo $web_path; ?>/rss.php?type=recently_played" />
|
||||
<link rel="alternate" type="application/rss+xml" title="<?php echo T_('Newest Albums'); ?>" href="<?php echo $web_path; ?>/rss.php?type=latest_album" />
|
||||
<link rel="alternate" type="application/rss+xml" title="<?php echo T_('Newest Artists'); ?>" href="<?php echo $web_path; ?>/rss.php?type=latest_artist" />
|
||||
<?php if (AmpConfig::get('sociable')) { ?>
|
||||
<link rel="alternate" type="application/rss+xml" title="<?php echo T_('Newest Shouts'); ?>" href="<?php echo $web_path; ?>/rss.php?type=latest_shout" />
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=<?php echo AmpConfig::get('site_charset'); ?>" />
|
||||
<title><?php echo AmpConfig::get('site_title'); ?> - <?php echo $location['title']; ?></title>
|
||||
|
@ -273,7 +277,10 @@ $_SESSION['login'] = false;
|
|||
</script>
|
||||
<?php if (AmpConfig::get('cookie_disclaimer') && !isset($_COOKIE['cookie_disclaimer'])) { ?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
noty({text: '<?php echo T_("We have placed cookies on your computer to help make this website better. You can change your") . " <a href=\"" . AmpConfig::get('web_path') . "/cookie_disclaimer.php\">" . T_("cookie settings") . "</a> " . T_("at any time. Otherwise, we\'ll assume you\'re OK to continue.<br /><br />Click on this message do not display it again."); ?>',
|
||||
noty({text: '<?php echo json_encode(T_("We have placed cookies on your computer to help make this website better. You can change your") .
|
||||
" <a href=\"" . AmpConfig::get('web_path') . "/cookie_disclaimer.php\">" . T_("cookie settings") . "</a> " .
|
||||
T_("at any time. Otherwise, we will assume you are OK to continue.") . "<br /><br />" .
|
||||
T_("Click on this message do not display it again.")); ?>',
|
||||
type: 'warning',
|
||||
layout: 'bottom',
|
||||
timeout: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue