mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-06 03:49:56 +02:00
Fix #173. Fix rating. Fix plenty of Warnings.
This commit is contained in:
parent
c174c2b9aa
commit
7e4e12f53b
23 changed files with 258 additions and 178 deletions
72
image.php
72
image.php
|
@ -81,45 +81,47 @@ switch ($_GET['thumb']) {
|
|||
break;
|
||||
} // define size based on thumbnail
|
||||
|
||||
switch ($_GET['type']) {
|
||||
case 'popup':
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_big_art.inc.php';
|
||||
break;
|
||||
// If we need to pull the data out of the session
|
||||
case 'session':
|
||||
Session::check();
|
||||
$filename = scrub_in($_REQUEST['image_index']);
|
||||
$image = Art::get_from_source($_SESSION['form']['images'][$filename], 'album');
|
||||
$mime = $_SESSION['form']['images'][$filename]['mime'];
|
||||
break;
|
||||
default:
|
||||
$media = new $type($_GET['id']);
|
||||
$filename = $media->name;
|
||||
$image = '';
|
||||
$typeManaged = false;
|
||||
if (isset($_GET['type'])) {
|
||||
switch ($_GET['type']) {
|
||||
case 'popup':
|
||||
$typeManaged = true;
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_big_art.inc.php';
|
||||
break;
|
||||
case 'session':
|
||||
// If we need to pull the data out of the session
|
||||
Session::check();
|
||||
$filename = scrub_in($_REQUEST['image_index']);
|
||||
$image = Art::get_from_source($_SESSION['form']['images'][$filename], 'album');
|
||||
$mime = $_SESSION['form']['images'][$filename]['mime'];
|
||||
$typeManaged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$typeManaged) {
|
||||
$media = new $type($_GET['id']);
|
||||
$filename = $media->name;
|
||||
|
||||
$art = new Art($media->id,$type);
|
||||
$art->get_db();
|
||||
$art = new Art($media->id,$type);
|
||||
$art->get_db();
|
||||
|
||||
if (!$art->raw_mime) {
|
||||
$mime = 'image/jpeg';
|
||||
$image = file_get_contents(AmpConfig::get('prefix') .
|
||||
AmpConfig::get('theme_path') .
|
||||
'/images/blankalbum.jpg');
|
||||
} else {
|
||||
if ($_GET['thumb']) {
|
||||
$thumb_data = $art->get_thumb($size);
|
||||
}
|
||||
|
||||
$mime = $thumb_data
|
||||
? $thumb_data['thumb_mime']
|
||||
: $art->raw_mime;
|
||||
$image = $thumb_data
|
||||
? $thumb_data['thumb']
|
||||
: $art->raw;
|
||||
if (!$art->raw_mime) {
|
||||
$mime = 'image/jpeg';
|
||||
$image = file_get_contents(AmpConfig::get('prefix') .
|
||||
AmpConfig::get('theme_path') .
|
||||
'/images/blankalbum.jpg');
|
||||
} else {
|
||||
if ($_GET['thumb']) {
|
||||
$thumb_data = $art->get_thumb($size);
|
||||
}
|
||||
break;
|
||||
} // end switch type
|
||||
|
||||
if ($image) {
|
||||
$mime = isset($thumb_data['thumb_mime']) ? $thumb_data['thumb_mime'] : $art->raw_mime;
|
||||
$image = isset($thumb_data['thumb']) ? $thumb_data['thumb'] : $art->raw;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($image)) {
|
||||
$extension = Art::extension($mime);
|
||||
$filename = scrub_out($filename . '.' . $extension);
|
||||
|
||||
|
|
|
@ -32,7 +32,9 @@ UI::show_header();
|
|||
|
||||
$action = isset($_REQUEST['action']) ? scrub_in($_REQUEST['action']) : null;
|
||||
|
||||
session_start();
|
||||
if (session_status() == PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
$_SESSION['catalog'] = 0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -379,13 +379,13 @@ class Album extends database_object
|
|||
* get_album_suite
|
||||
* gets the album ids with the same musicbrainz identifier
|
||||
*/
|
||||
public function get_album_suite()
|
||||
public function get_album_suite($catalog = '')
|
||||
{
|
||||
$results = array();
|
||||
|
||||
$catalog_where = "";
|
||||
$catalog_join = "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
|
||||
if ($catalog) {
|
||||
if (!empty($catalog)) {
|
||||
$catalog_where .= " AND `catalog`.`id` = '$catalog'";
|
||||
}
|
||||
if (AmpConfig::get('catalog_disable')) {
|
||||
|
|
|
@ -72,9 +72,11 @@ class Browse extends Query
|
|||
*/
|
||||
public function get_supplemental_objects()
|
||||
{
|
||||
$objects = $_SESSION['browse']['supplemental'][$this->id];
|
||||
$objects = isset($_SESSION['browse']['supplemental'][$this->id]) ? $_SESSION['browse']['supplemental'][$this->id] : '';
|
||||
|
||||
if (!is_array($objects)) { $objects = array(); }
|
||||
if (!is_array($objects)) {
|
||||
$objects = array();
|
||||
}
|
||||
|
||||
return $objects;
|
||||
|
||||
|
|
|
@ -387,7 +387,7 @@ class Preference extends database_object
|
|||
*/
|
||||
public static function load_from_session($uid=-1)
|
||||
{
|
||||
if (is_array($_SESSION['userdata']['preferences']) AND $_SESSION['userdata']['uid'] == $uid) {
|
||||
if (isset($_SESSION['userdata']['preferences']) && is_array($_SESSION['userdata']['preferences']) AND $_SESSION['userdata']['uid'] == $uid) {
|
||||
AmpConfig::set_by_array($_SESSION['userdata']['preferences'], true);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1011,7 +1011,7 @@ class Query
|
|||
*/
|
||||
private function get_join_sql()
|
||||
{
|
||||
if (!is_array($this->_state['join'])) {
|
||||
if (!isset($this->_state['join']) || !is_array($this->_state['join'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -1033,7 +1033,7 @@ class Query
|
|||
*/
|
||||
public function get_having_sql()
|
||||
{
|
||||
$sql = $this->_state['having'];
|
||||
$sql = isset($this->_state['having']) ? $this->_state['having'] : '';
|
||||
|
||||
return $sql;
|
||||
|
||||
|
@ -1049,7 +1049,7 @@ class Query
|
|||
{
|
||||
$sql = $this->get_base_sql();
|
||||
|
||||
if (!$this->_state['custom']) {
|
||||
if (!isset($this->_state['custom']) || !$this->_state['custom']) {
|
||||
$filter_sql = $this->get_filter_sql();
|
||||
$join_sql = $this->get_join_sql();
|
||||
$having_sql = $this->get_having_sql();
|
||||
|
@ -1074,7 +1074,7 @@ class Query
|
|||
*/
|
||||
private function post_process($data)
|
||||
{
|
||||
$tags = $this->_state['filter']['tag'];
|
||||
$tags = isset($this->_state['filter']['tag']) ? $this->_state['filter']['tag'] : '';
|
||||
|
||||
if (!is_array($tags) || sizeof($tags) < 2) {
|
||||
return $data;
|
||||
|
|
|
@ -122,14 +122,14 @@ class Rating extends database_object
|
|||
$user_id = $GLOBALS['user']->id;
|
||||
}
|
||||
|
||||
$key = 'rating_' . $type . '_user' . $user_id;
|
||||
$key = 'rating_' . $this->type . '_user' . $user_id;
|
||||
if (parent::is_cached($key, $this->id)) {
|
||||
return parent::get_from_cache($key, $this->id);
|
||||
}
|
||||
|
||||
$sql = "SELECT `rating` FROM `rating` WHERE `user` = ? ".
|
||||
"AND `object_id` = ? AND `object_type` = ?";
|
||||
$db_results = Dba::read($sql, array($user_id, $this->id, $type));
|
||||
$db_results = Dba::read($sql, array($user_id, $this->id, $this->type));
|
||||
|
||||
$rating = 0;
|
||||
|
||||
|
@ -149,8 +149,8 @@ class Rating extends database_object
|
|||
*/
|
||||
public function get_average_rating()
|
||||
{
|
||||
if (parent::is_cached('rating_' . $type . '_all', $id)) {
|
||||
return parent::get_from_cache('rating_' . $type . '_user', $id);
|
||||
if (parent::is_cached('rating_' . $this->type . '_all', $this->id)) {
|
||||
return parent::get_from_cache('rating_' . $this->type . '_user', $this->id);
|
||||
}
|
||||
|
||||
$sql = "SELECT AVG(`rating`) as `rating` FROM `rating` WHERE " .
|
||||
|
@ -159,7 +159,7 @@ class Rating extends database_object
|
|||
|
||||
$results = Dba::fetch_assoc($db_results);
|
||||
|
||||
parent::add_to_cache('rating_' . $type . '_all', $id, $results['rating']);
|
||||
parent::add_to_cache('rating_' . $this->type . '_all', $this->id, $results['rating']);
|
||||
return $results['rating'];
|
||||
|
||||
} // get_average_rating
|
||||
|
|
|
@ -204,10 +204,16 @@ class Session
|
|||
break;
|
||||
} // end switch on data type
|
||||
|
||||
$username = $data['username'];
|
||||
$username = '';
|
||||
if (isset($data['username'])) {
|
||||
$username = $data['username'];
|
||||
}
|
||||
$ip = $_SERVER['REMOTE_ADDR'] ? inet_pton($_SERVER['REMOTE_ADDR']) : '0';
|
||||
$type = $data['type'];
|
||||
$value = $data['value'];
|
||||
$value = '';
|
||||
if (isset($data['value'])) {
|
||||
$value = $data['value'];
|
||||
}
|
||||
$agent = (!empty($data['agent'])) ? $data['agent'] : substr($_SERVER['HTTP_USER_AGENT'], 0, 254);
|
||||
|
||||
if ($type == 'stream') {
|
||||
|
|
|
@ -185,6 +185,10 @@ class Song extends database_object implements media
|
|||
}
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
$artists = array();
|
||||
$albums = array();
|
||||
$tags = array();
|
||||
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
if (AmpConfig::get('show_played_times')) {
|
||||
$row['object_cnt'] = Stats::get_object_count('song', $row['id']);
|
||||
|
@ -200,7 +204,7 @@ class Song extends database_object implements media
|
|||
Artist::build_cache($artists);
|
||||
Album::build_cache($albums);
|
||||
Tag::build_cache($tags);
|
||||
Tag::build_map_cache('song',$song_ids);
|
||||
Tag::build_map_cache('song', $song_ids);
|
||||
Art::build_cache($albums);
|
||||
|
||||
// If we're rating this then cache them as well
|
||||
|
@ -824,8 +828,10 @@ class Song extends database_object implements media
|
|||
$this->fill_ext_info();
|
||||
|
||||
// Format the filename
|
||||
preg_match("/^.*\/(.*?)$/",$this->file, $short);
|
||||
$this->f_file = htmlspecialchars($short[1]);
|
||||
preg_match("/^.*\/(.*?)$/", $this->file, $short);
|
||||
if (is_array($short) && isset($short[1])) {
|
||||
$this->f_file = htmlspecialchars($short[1]);
|
||||
}
|
||||
|
||||
// Format the album name
|
||||
$this->f_album_full = $this->get_album_name();
|
||||
|
|
|
@ -243,7 +243,7 @@ END;
|
|||
*/
|
||||
private static function _find_icon($name)
|
||||
{
|
||||
if ($url = self::$_icon_cache[$name]) {
|
||||
if (isset(self::$_icon_cache[$name]) && $url = self::$_icon_cache[$name]) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
|
|
@ -180,24 +180,42 @@ function create_preference_input($name,$value)
|
|||
case 'share_social':
|
||||
case 'broadcast_by_default':
|
||||
case 'album_group':
|
||||
if ($value == '1') { $is_true = "selected=\"selected\""; } else { $is_false = "selected=\"selected\""; }
|
||||
$is_true = '';
|
||||
$is_false = '';
|
||||
if ($value == '1') {
|
||||
$is_true = "selected=\"selected\""; }
|
||||
else {
|
||||
$is_false = "selected=\"selected\"";
|
||||
}
|
||||
echo "<select name=\"$name\">\n";
|
||||
echo "\t<option value=\"1\" $is_true>" . T_("Enable") . "</option>\n";
|
||||
echo "\t<option value=\"0\" $is_false>" . T_("Disable") . "</option>\n";
|
||||
echo "</select>\n";
|
||||
break;
|
||||
case 'play_type':
|
||||
if ($value == 'localplay') { $is_local = 'selected="selected"'; } elseif ($value == 'democratic') { $is_vote = 'selected="selected"'; } elseif ($value == 'web_player') { $is_web_player = 'selected="selected"'; } else { $is_stream = "selected=\"selected\""; }
|
||||
$is_localplay = '';
|
||||
$is_democratic = '';
|
||||
$is_web_player = '';
|
||||
$is_stream = '';
|
||||
if ($value == 'localplay') {
|
||||
$is_localplay = 'selected="selected"';
|
||||
} elseif ($value == 'democratic') {
|
||||
$is_democratic = 'selected="selected"';
|
||||
} elseif ($value == 'web_player') {
|
||||
$is_web_player = 'selected="selected"';
|
||||
} else {
|
||||
$is_stream = "selected=\"selected\"";
|
||||
}
|
||||
echo "<select name=\"$name\">\n";
|
||||
echo "\t<option value=\"\">" . T_('None') . "</option>\n";
|
||||
if (AmpConfig::get('allow_stream_playback')) {
|
||||
echo "\t<option value=\"stream\" $is_stream>" . T_('Stream') . "</option>\n";
|
||||
}
|
||||
if (AmpConfig::get('allow_democratic_playback')) {
|
||||
echo "\t<option value=\"democratic\" $is_vote>" . T_('Democratic') . "</option>\n";
|
||||
echo "\t<option value=\"democratic\" $is_democratic>" . T_('Democratic') . "</option>\n";
|
||||
}
|
||||
if (AmpConfig::get('allow_localplay_playback')) {
|
||||
echo "\t<option value=\"localplay\" $is_local>" . T_('Localplay') . "</option>\n";
|
||||
echo "\t<option value=\"localplay\" $is_localplay>" . T_('Localplay') . "</option>\n";
|
||||
}
|
||||
echo "\t<option value=\"web_player\" $is_web_player>" . _('Web Player') . "</option>\n";
|
||||
echo "</select>\n";
|
||||
|
@ -236,7 +254,18 @@ function create_preference_input($name,$value)
|
|||
echo "</select>\n";
|
||||
break;
|
||||
case 'localplay_level':
|
||||
if ($value == '25') { $is_user = 'selected="selected"'; } elseif ($value == '100') { $is_admin = 'selected="selected"'; } elseif ($value == '50') { $is_manager = 'selected="selected"'; }
|
||||
$is_user = '';
|
||||
$is_admin = '';
|
||||
$is_manager = '';
|
||||
if ($value == '25') {
|
||||
$is_user = 'selected="selected"';
|
||||
}
|
||||
elseif ($value == '100') {
|
||||
$is_admin = 'selected="selected"';
|
||||
}
|
||||
elseif ($value == '50') {
|
||||
$is_manager = 'selected="selected"';
|
||||
}
|
||||
echo "<select name=\"$name\">\n";
|
||||
echo "<option value=\"0\">" . T_('Disabled') . "</option>\n";
|
||||
echo "<option value=\"25\" $is_user>" . T_('User') . "</option>\n";
|
||||
|
@ -272,14 +301,35 @@ function create_preference_input($name,$value)
|
|||
echo "</select>\n";
|
||||
break;
|
||||
case 'show_lyrics':
|
||||
if ($value == '1') { $is_true = "selected=\"selected\""; } else { $is_false = "selected=\"selected\""; }
|
||||
$is_true = '';
|
||||
$is_false = '';
|
||||
if ($value == '1') {
|
||||
$is_true = "selected=\"selected\"";
|
||||
} else {
|
||||
$is_false = "selected=\"selected\"";
|
||||
}
|
||||
echo "<select name=\"$name\">\n";
|
||||
echo "\t<option value=\"1\" $is_true>" . T_("Enable") . "</option>\n";
|
||||
echo "\t<option value=\"0\" $is_false>" . T_("Disable") . "</option>\n";
|
||||
echo "</select>\n";
|
||||
break;
|
||||
case 'album_sort':
|
||||
if ($value == 'year_asc') { $is_sort_year_asc = 'selected="selected"'; } elseif ($value == 'year_desc') { $is_sort_year_desc = 'selected="selected"'; } elseif ($value == 'name_asc') { $is_sort_name_asc = 'selected="selected"'; } elseif ($value == 'name_desc') { $is_sort_name_desc = 'selected="selected"'; } else { $is_sort_default = 'selected="selected"'; }
|
||||
$is_sort_year_asc = '';
|
||||
$is_sort_year_desc = '';
|
||||
$is_sort_name_asc = '';
|
||||
$is_sort_name_desc = '';
|
||||
$is_sort_default = '';
|
||||
if ($value == 'year_asc') {
|
||||
$is_sort_year_asc = 'selected="selected"';
|
||||
} elseif ($value == 'year_desc') {
|
||||
$is_sort_year_desc = 'selected="selected"';
|
||||
} elseif ($value == 'name_asc') {
|
||||
$is_sort_name_asc = 'selected="selected"';
|
||||
} elseif ($value == 'name_desc') {
|
||||
$is_sort_name_desc = 'selected="selected"';
|
||||
} else {
|
||||
$is_sort_default = 'selected="selected"';
|
||||
}
|
||||
|
||||
echo "<select name=\"$name\">\n";
|
||||
echo "\t<option value=\"default\" $is_sort_default>" . T_('Default') . "</option>\n";
|
||||
|
|
|
@ -347,7 +347,7 @@ function show_playlist_select($name,$selected='',$style='')
|
|||
|
||||
function xoutput_headers()
|
||||
{
|
||||
$output = $_REQUEST['xoutput'] ?: 'xml';
|
||||
$output = (isset($_REQUEST['xoutput']) && $_REQUEST['xoutput']) ?: 'xml';
|
||||
if ($output == 'xml') {
|
||||
header("Content-type: text/xml; charset=" . AmpConfig::get('site_charset'));
|
||||
header("Content-Disposition: attachment; filename=ajax.xml");
|
||||
|
@ -363,7 +363,7 @@ function xoutput_headers()
|
|||
|
||||
function xoutput_from_array($array, $callback = false, $type = '')
|
||||
{
|
||||
$output = $_REQUEST['xoutput'] ?: 'xml';
|
||||
$output = (isset($_REQUEST['xoutput']) && $_REQUEST['xoutput']) ?: 'xml';
|
||||
if ($output == 'xml') {
|
||||
return xml_from_array($array, $callback, $type);
|
||||
} elseif ($output == 'raw') {
|
||||
|
|
|
@ -216,9 +216,9 @@ class AmpacheLastfm {
|
|||
|
||||
// If we don't have the other stuff try to get it before giving up
|
||||
if (!$data['lastfm_host'] || !$data['lastfm_port'] || !$data['lastfm_url'] || !$data['lastfm_challenge']) {
|
||||
debug_event($this->name,'Running Handshake, missing information','3');
|
||||
debug_event($this->name, 'Running Handshake, missing information', '1');
|
||||
if (!$this->set_handshake($this->user_id)) {
|
||||
debug_event($this->name,'Handshake failed, you lose','3');
|
||||
debug_event($this->name, 'Handshake failed, you lose', '3');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ class Ampachelibrefm {
|
|||
if (!$scrobbler->submit_tracks()) {
|
||||
debug_event($this->name,'Error Submit Failed: ' . $scrobbler->error_msg,'3');
|
||||
if ($scrobbler->reset_handshake) {
|
||||
debug_event($this->name,'Re-running Handshake due to error','3');
|
||||
debug_event($this->name, 'Re-running Handshake due to error', '1');
|
||||
$this->set_handshake($this->user_id);
|
||||
// Try try again
|
||||
if ($scrobbler->submit_tracks()) {
|
||||
|
|
|
@ -338,7 +338,7 @@ switch ($_REQUEST['action']) {
|
|||
if (AmpConfig::get('ratings')) {
|
||||
echo " <div id='rating_" . $_GET['object_id'] . "_" . $_GET['object_type'] . "'>";
|
||||
Rating::show($_GET['object_id'], $_GET['object_type']);
|
||||
echo "</div>";
|
||||
echo "</div> |";
|
||||
}
|
||||
if (AmpConfig::get('userflags')) {
|
||||
echo " <div id='userflag_" . $_GET['object_id'] . "_" . $_GET['object_type'] . "'>";
|
||||
|
|
|
@ -24,7 +24,10 @@
|
|||
* Sub-Ajax page, requires AJAX_INCLUDE
|
||||
*/
|
||||
require_once '../lib/init.php';
|
||||
session_start();
|
||||
|
||||
if (session_status() == PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
if (!defined('AJAX_INCLUDE')) { exit; }
|
||||
|
||||
|
@ -34,10 +37,9 @@ if (isset($_REQUEST['browse_id'])) {
|
|||
$browse_id = null;
|
||||
}
|
||||
|
||||
$list_uid = scrub_in($_REQUEST['uid']);
|
||||
$browse = new Browse($browse_id);
|
||||
|
||||
if ($_REQUEST['show_header']) {
|
||||
if (isset($_REQUEST['show_header']) && $_REQUEST['show_header']) {
|
||||
$browse->set_show_header($_REQUEST['show_header'] == 'true');
|
||||
}
|
||||
|
||||
|
|
|
@ -19,77 +19,82 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
session_start();
|
||||
|
||||
if (session_status() == PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
?>
|
||||
|
||||
<?php $allowed_filters = Browse::get_allowed_filters($browse->get_type()); ?>
|
||||
<li><h4><?php echo T_('Filters'); ?></h4>
|
||||
<div class="sb3">
|
||||
<?php if (in_array('starts_with',$allowed_filters)) { ?>
|
||||
<form id="multi_alpha_filter_form" method="post" action="javascript:void(0);">
|
||||
<label id="multi_alpha_filterLabel" for="multi_alpha_filter"><?php echo T_('Starts With'); ?></label>
|
||||
<input type="text" id="multi_alpha_filter" name="multi_alpha_filter" value="<?php $browse->set_catalog($_SESSION['catalog']); echo scrub_out($browse->get_filter('starts_with'));?>" onKeyUp="delayRun(this, '400', 'ajaxState', '<?php echo Ajax::url('?page=browse&action=browse&browse_id=' . $browse->id . '&key=starts_with'); ?>', 'multi_alpha_filter');">
|
||||
</form>
|
||||
<?php } // end if alpha_match ?>
|
||||
<?php if (in_array('minimum_count',$allowed_filters)) { ?>
|
||||
<input id="mincountCB" type="checkbox" value="1" />
|
||||
<label id="mincountLabel" for="mincountCB"><?php echo T_('Minimum Count'); ?></label><br />
|
||||
<?php echo Ajax::observe('mincountCB', 'click', Ajax::action('?page=browse&action=browse&browse_id=' . $browse->id . '&key=min_count&value=1', '')); ?>
|
||||
<?php } ?>
|
||||
<?php if (in_array('rated',$allowed_filters)) { ?>
|
||||
<input id="ratedCB" type="checkbox" value="1" />
|
||||
<label id="ratedLabel" for="ratedCB"><?php echo T_('Rated'); ?></label><br />
|
||||
<?php echo Ajax::observe('ratedCB', 'click', Ajax::action('?page=browse&action=browse&browse_id=' . $browse->id . '&key=rated&value=1', '')); ?>
|
||||
<?php } ?>
|
||||
<?php if (in_array('unplayed',$allowed_filters)) { ?>
|
||||
<input id="unplayedCB" type="checkbox" <?php echo $string = $browse->get_filter('unplayed') ? 'checked="checked"' : ''; ?>/>
|
||||
<label id="unplayedLabel" for="unplayedCB"><?php echo T_('Unplayed'); ?></label><br />
|
||||
<?php } ?>
|
||||
<?php if (in_array('playlist_type',$allowed_filters)) { ?>
|
||||
<input id="show_allplCB" type="checkbox" <?php echo $string = $browse->get_filter('playlist_type') ? 'checked="checked"' : ''; ?>/>
|
||||
<label id="show_allplLabel" for="showallplCB"><?php echo T_('All Playlists'); ?></label><br />
|
||||
<?php echo Ajax::observe('show_allplCB','click',Ajax::action('?page=browse&action=browse&browse_id=' . $browse->id . '&key=playlist_type&value=1','')); ?>
|
||||
<?php } // if playlist_type ?>
|
||||
<?php if (in_array('object_type',$allowed_filters)) { ?>
|
||||
<?php $string = 'otype_' . $browse->get_filter('object_type'); ${$string} = 'selected="selected"'; ?>
|
||||
<input id="typeSongRadio" type="radio" name="object_type" value="1" <?php echo $otype_song; ?>/>
|
||||
<label id="typeSongLabel" for="typeSongRadio"><?php echo T_('Song Title'); ?></label><br />
|
||||
<?php echo Ajax::observe('typeSongRadio','click',Ajax::action('?page=tag&action=browse_type&browse_id=' . $browse->id . '&type=song','')); ?>
|
||||
<input id="typeAlbumRadio" type="radio" name="object_type" value="1" />
|
||||
<label id="typeAlbumLabel" for="typeAlbumRadio"><?php echo T_('Albums'); ?></label><br />
|
||||
<?php echo Ajax::observe('typeAlbumRadio','click',Ajax::action('?page=tag&action=browse_type&browse_id=' . $browse->id . '&type=album','')); ?>
|
||||
<input id="typeArtistRadio" type="radio" name="object_type" value="1" />
|
||||
<label id="typeArtistLabel" for="typeArtistRadio"><?php echo T_('Artist'); ?></label><br />
|
||||
<?php echo Ajax::observe('typeArtistRadio','click',Ajax::action('?page=tag&action=browse_type&browse_id=' . $browse->id . '&type=artist','')); ?>
|
||||
<?php } ?>
|
||||
<li>
|
||||
<h4><?php echo T_('Filters'); ?></h4>
|
||||
<div class="sb3">
|
||||
<?php if (in_array('starts_with',$allowed_filters)) { ?>
|
||||
<form id="multi_alpha_filter_form" method="post" action="javascript:void(0);">
|
||||
<label id="multi_alpha_filterLabel" for="multi_alpha_filter"><?php echo T_('Starts With'); ?></label>
|
||||
<input type="text" id="multi_alpha_filter" name="multi_alpha_filter" value="<?php $browse->set_catalog($_SESSION['catalog']); echo scrub_out($browse->get_filter('starts_with'));?>" onKeyUp="delayRun(this, '400', 'ajaxState', '<?php echo Ajax::url('?page=browse&action=browse&browse_id=' . $browse->id . '&key=starts_with'); ?>', 'multi_alpha_filter');">
|
||||
</form>
|
||||
<?php } // end if alpha_match ?>
|
||||
<?php if (in_array('minimum_count',$allowed_filters)) { ?>
|
||||
<input id="mincountCB" type="checkbox" value="1" />
|
||||
<label id="mincountLabel" for="mincountCB"><?php echo T_('Minimum Count'); ?></label><br />
|
||||
<?php echo Ajax::observe('mincountCB', 'click', Ajax::action('?page=browse&action=browse&browse_id=' . $browse->id . '&key=min_count&value=1', '')); ?>
|
||||
<?php } ?>
|
||||
<?php if (in_array('rated',$allowed_filters)) { ?>
|
||||
<input id="ratedCB" type="checkbox" value="1" />
|
||||
<label id="ratedLabel" for="ratedCB"><?php echo T_('Rated'); ?></label><br />
|
||||
<?php echo Ajax::observe('ratedCB', 'click', Ajax::action('?page=browse&action=browse&browse_id=' . $browse->id . '&key=rated&value=1', '')); ?>
|
||||
<?php } ?>
|
||||
<?php if (in_array('unplayed',$allowed_filters)) { ?>
|
||||
<input id="unplayedCB" type="checkbox" <?php echo $string = $browse->get_filter('unplayed') ? 'checked="checked"' : ''; ?>/>
|
||||
<label id="unplayedLabel" for="unplayedCB"><?php echo T_('Unplayed'); ?></label><br />
|
||||
<?php } ?>
|
||||
<?php if (in_array('playlist_type',$allowed_filters)) { ?>
|
||||
<input id="show_allplCB" type="checkbox" <?php echo $string = $browse->get_filter('playlist_type') ? 'checked="checked"' : ''; ?>/>
|
||||
<label id="show_allplLabel" for="showallplCB"><?php echo T_('All Playlists'); ?></label><br />
|
||||
<?php echo Ajax::observe('show_allplCB','click',Ajax::action('?page=browse&action=browse&browse_id=' . $browse->id . '&key=playlist_type&value=1','')); ?>
|
||||
<?php } // if playlist_type ?>
|
||||
<?php if (in_array('object_type',$allowed_filters)) { ?>
|
||||
<?php $string = 'otype_' . $browse->get_filter('object_type'); ${$string} = 'selected="selected"'; ?>
|
||||
<input id="typeSongRadio" type="radio" name="object_type" value="1" <?php echo $otype_song; ?>/>
|
||||
<label id="typeSongLabel" for="typeSongRadio"><?php echo T_('Song Title'); ?></label><br />
|
||||
<?php echo Ajax::observe('typeSongRadio','click',Ajax::action('?page=tag&action=browse_type&browse_id=' . $browse->id . '&type=song','')); ?>
|
||||
<input id="typeAlbumRadio" type="radio" name="object_type" value="1" />
|
||||
<label id="typeAlbumLabel" for="typeAlbumRadio"><?php echo T_('Albums'); ?></label><br />
|
||||
<?php echo Ajax::observe('typeAlbumRadio','click',Ajax::action('?page=tag&action=browse_type&browse_id=' . $browse->id . '&type=album','')); ?>
|
||||
<input id="typeArtistRadio" type="radio" name="object_type" value="1" />
|
||||
<label id="typeArtistLabel" for="typeArtistRadio"><?php echo T_('Artist'); ?></label><br />
|
||||
<?php echo Ajax::observe('typeArtistRadio','click',Ajax::action('?page=tag&action=browse_type&browse_id=' . $browse->id . '&type=artist','')); ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array('catalog',$allowed_filters)) { ?>
|
||||
<form method="post" id="catalog_choice" action="javascript.void(0);">
|
||||
<label id="catalogLabel" for="catalog_select"><?php echo T_('Catalog'); ?></label><br />
|
||||
<select id="catalog_select" name="catalog_key">
|
||||
<option value="0">All</option>
|
||||
<?php
|
||||
$sql = 'SELECT `id`,`name` FROM `catalog`';
|
||||
$db_results = Dba::read($sql);
|
||||
while ( $data = Dba::fetch_assoc($db_results) ) {
|
||||
$results[] = $data;
|
||||
}
|
||||
<?php if (in_array('catalog',$allowed_filters)) { ?>
|
||||
<form method="post" id="catalog_choice" action="javascript.void(0);">
|
||||
<label id="catalogLabel" for="catalog_select"><?php echo T_('Catalog'); ?></label><br />
|
||||
<select id="catalog_select" name="catalog_key">
|
||||
<option value="0">All</option>
|
||||
<?php
|
||||
$sql = 'SELECT `id`,`name` FROM `catalog`';
|
||||
$db_results = Dba::read($sql);
|
||||
while ( $data = Dba::fetch_assoc($db_results) ) {
|
||||
$results[] = $data;
|
||||
}
|
||||
|
||||
foreach ($results as $entries) {
|
||||
echo '<option value="' . $entries['id'] . '" ';
|
||||
if ($_SESSION['catalog'] == $entries['id']) {
|
||||
echo ' selected="selected" ';
|
||||
}
|
||||
echo '>' . $entries['name'] . '</options>';
|
||||
}
|
||||
?>
|
||||
foreach ($results as $entries) {
|
||||
echo '<option value="' . $entries['id'] . '" ';
|
||||
if ($_SESSION['catalog'] == $entries['id']) {
|
||||
echo ' selected="selected" ';
|
||||
}
|
||||
echo '>' . $entries['name'] . '</options>';
|
||||
}
|
||||
?>
|
||||
|
||||
</select>
|
||||
<?php echo Ajax::observe('catalog_select', 'change', Ajax::action('?page=browse&action=browse&browse_id=' . $browse->id,'catalog_select', 'catalog_choice')); ?>
|
||||
</form>
|
||||
<?php } ?>
|
||||
<?php if (in_array('show_art',$allowed_filters)) { ?>
|
||||
<?php echo T_('Toggle Artwork'); ?> <input id="show_artCB" type="checkbox" <?php echo Art::is_enabled() ? 'checked="checked"' : ''; ?>/>
|
||||
<?php echo Ajax::observe('show_artCB','click',Ajax::action('?page=browse&action=show_art&browse_id=' . $browse->id, '')); ?>
|
||||
<?php } // if show_art ?>
|
||||
</div>
|
||||
</select>
|
||||
<?php echo Ajax::observe('catalog_select', 'change', Ajax::action('?page=browse&action=browse&browse_id=' . $browse->id,'catalog_select', 'catalog_choice')); ?>
|
||||
</form>
|
||||
<?php } ?>
|
||||
<?php if (in_array('show_art',$allowed_filters)) { ?>
|
||||
<?php echo T_('Toggle Artwork'); ?> <input id="show_artCB" type="checkbox" <?php echo Art::is_enabled() ? 'checked="checked"' : ''; ?>/>
|
||||
<?php echo Ajax::observe('show_artCB','click',Ajax::action('?page=browse&action=show_art&browse_id=' . $browse->id, '')); ?>
|
||||
<?php } // if show_art ?>
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* to layout this page.
|
||||
*/
|
||||
|
||||
if ($is_header) {
|
||||
if (isset($is_header) && $is_header) {
|
||||
$is_header = false;
|
||||
} else {
|
||||
$is_header = true;
|
||||
|
|
|
@ -125,10 +125,10 @@ if (AmpConfig::get('show_played_times')) {
|
|||
<?php } ?>
|
||||
<?php if (Access::check('interface','50')) { ?>
|
||||
<li>
|
||||
<a id="<?php echo 'edit_album_'.$c_album->id ?>" onclick="showEditDialog('album_row', '<?php echo $album->id ?>', '<?php echo 'edit_album_'.$album->id ?>', '<?php echo T_('Album edit') ?>', '', '')">
|
||||
<a id="<?php echo 'edit_album_'.$album->id ?>" onclick="showEditDialog('album_row', '<?php echo $album->id ?>', '<?php echo 'edit_album_'.$album->id ?>', '<?php echo T_('Album edit') ?>', '', '')">
|
||||
<?php echo UI::get_icon('edit', T_('Edit')); ?>
|
||||
</a>
|
||||
<a id="<?php echo 'edit_album_'.$c_album->id ?>" onclick="showEditDialog('album_row', '<?php echo $album->id ?>', '<?php echo 'edit_album_'.$album->id ?>', '<?php echo T_('Album edit') ?>', '', '')">
|
||||
<a id="<?php echo 'edit_album_'.$album->id ?>" onclick="showEditDialog('album_row', '<?php echo $album->id ?>', '<?php echo 'edit_album_'.$album->id ?>', '<?php echo T_('Album edit') ?>', '', '')">
|
||||
<?php echo T_('Edit Album'); ?>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -177,7 +177,7 @@ if (!$isVideo && !$isRadio && !$is_share) {
|
|||
echo "var lyricsobj = '<a href=\"javascript:NavigateTo(\'" . AmpConfig::get('web_path') . "/song.php?action=show_lyrics&song_id=' + currenti.attr('data-song_id') + '\');\">" . T_('Show Lyrics') . "</a>';";
|
||||
echo "var actionsobj = '|';";
|
||||
if (AmpConfig::get('sociable')) {
|
||||
echo "actionsobj += ' <a href=\"javascript:NavigateTo(\'" . AmpConfig::get('web_path') . "/shout.php?action=show_add_shout&type=song&id=' + currenti.attr('data-song_id') + '\');\">" . UI::get_icon('comment', T_('Post Shout')) . "</a>';";
|
||||
echo "actionsobj += ' <a href=\"javascript:NavigateTo(\'" . AmpConfig::get('web_path') . "/shout.php?action=show_add_shout&type=song&id=' + currenti.attr('data-song_id') + '\');\">" . UI::get_icon('comment', T_('Post Shout')) . "</a> |';";
|
||||
}
|
||||
echo "actionsobj += '<div id=\'action_buttons\'></div>';";
|
||||
if (AmpConfig::get('waveform')) {
|
||||
|
|
|
@ -30,19 +30,21 @@ if (Preference::has_access('play_type')) {
|
|||
<form method="post" id="play_type_form" action="javascript.void(0);">
|
||||
<select id="play_type_select" name="type">
|
||||
<?php if (AmpConfig::get('allow_stream_playback')) { ?>
|
||||
<option value="stream" <?php echo $is_stream; ?>><?php echo T_('Stream'); ?></option>
|
||||
<option value="stream" <?php if (isset($is_stream)) { echo $is_stream; } ?>><?php echo T_('Stream'); ?></option>
|
||||
<?php } if (AmpConfig::get('allow_localplay_playback')) { ?>
|
||||
<option value="localplay" <?php echo $is_localplay; ?>><?php echo T_('Localplay'); ?></option>
|
||||
<option value="localplay" <?php if (isset($is_localplay)) {echo $is_localplay; } ?>><?php echo T_('Localplay'); ?></option>
|
||||
<?php } if (AmpConfig::get('allow_democratic_playback')) { ?>
|
||||
<option value="democratic" <?php echo $is_democratic; ?>><?php echo T_('Democratic'); ?></option>
|
||||
<option value="democratic" <?php if (isset($is_democratic)) {echo $is_democratic; } ?>><?php echo T_('Democratic'); ?></option>
|
||||
<?php } ?>
|
||||
<option value="web_player" <?php echo $is_web_player; ?>><?php echo T_('Web Player'); ?></option>
|
||||
<option value="web_player" <?php if (isset($is_web_player)) { echo $is_web_player; } ?>><?php echo T_('Web Player'); ?></option>
|
||||
</select>
|
||||
<?php echo Ajax::observe('play_type_select','change',Ajax::action('?page=stream&action=set_play_type','play_type_select','play_type_form')); ?>
|
||||
</form>
|
||||
<?php
|
||||
} // if they have access
|
||||
// Else just show what it currently is
|
||||
else { echo T_(ucwords(AmpConfig::get('play_type'))); }
|
||||
else {
|
||||
echo T_(ucwords(AmpConfig::get('play_type')));
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -125,7 +125,7 @@ UI::show_box_top(T_('Recently Played') . $link, 'box box_recently_played');
|
|||
<?php } ?>
|
||||
<?php if (!count($data)) { ?>
|
||||
<tr>
|
||||
<td colspan=""><span class="nodata"><?php echo T_('No recently item found'); ?></span></td>
|
||||
<td colspan="8"><span class="nodata"><?php echo T_('No recently item found'); ?></span></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
if (!$_SESSION['state']['sidebar_tab']) { $_SESSION['state']['sidebar_tab'] = 'home'; }
|
||||
if (!$_SESSION['state']['sidebar_tab']) {
|
||||
$_SESSION['state']['sidebar_tab'] = 'home';
|
||||
}
|
||||
$class_name = 'sidebar_' . $_SESSION['state']['sidebar_tab'];
|
||||
${$class_name} = ' active';
|
||||
|
||||
// List of buttons ( id, title, icon, access level)
|
||||
$sidebar_items[] = array('id'=>'home', 'title' => T_('Home'), 'icon'=>'home', 'access'=>5);
|
||||
|
@ -31,34 +32,36 @@ $sidebar_items[] = array('id'=>'preferences', 'title' => T_('Preferences'), 'ico
|
|||
$sidebar_items[] = array('id'=>'modules','title' => T_('Modules'),'icon'=>'plugin','access'=>100);
|
||||
$sidebar_items[] = array('id'=>'admin', 'title' => T_('Admin'), 'icon'=>'admin', 'access'=>100);
|
||||
|
||||
|
||||
$web_path = AmpConfig::get('web_path');
|
||||
|
||||
?>
|
||||
|
||||
<ul id="sidebar-tabs">
|
||||
<?php
|
||||
foreach ($sidebar_items as $item) {
|
||||
if (Access::check('interface',$item['access'])) {
|
||||
$li_params = "id='sb_tab_" . $item['id'] . "' class='sb1" . ${'sidebar_'.$item['id'] } . "'";
|
||||
?><li <?php echo $li_params; ?>>
|
||||
<?php
|
||||
// Button
|
||||
echo Ajax::button("?page=index&action=sidebar&button=".$item['id'],$item['icon'],$item['title'],'sidebar_'.$item['id']);
|
||||
foreach ($sidebar_items as $item) {
|
||||
if (Access::check('interface', $item['access'])) {
|
||||
|
||||
// Include subnav if it's the selected one
|
||||
// so that it's generated inside its parent li
|
||||
if ($item['id']==$_SESSION['state']['sidebar_tab']) {
|
||||
?><div id="sidebar-page" class="sidebar-page-<?php echo AmpConfig::get('ui_fixed') ? 'fixed' : 'float'; ?>"><?php
|
||||
require_once AmpConfig::get('prefix') . '/templates/sidebar_' . $_SESSION['state']['sidebar_tab'] . '.inc.php';
|
||||
?></div><?php
|
||||
}
|
||||
?></li><?php
|
||||
}
|
||||
}
|
||||
$active = ('sidebar_'.$item['id'] == $class_name) ? ' active' : '';
|
||||
$li_params = "id='sb_tab_" . $item['id'] . "' class='sb1" . $active . "'";
|
||||
?>
|
||||
<li id="sb_tab_logout" class="sb1">
|
||||
<a target="_top" href="<?php echo AmpConfig::get('web_path'); ?>/logout.php" id="sidebar_logout" >
|
||||
<?php echo UI::get_icon('logout', T_('Logout')); ?>
|
||||
</a>
|
||||
</li>
|
||||
<li <?php echo $li_params; ?>>
|
||||
<?php
|
||||
echo Ajax::button("?page=index&action=sidebar&button=".$item['id'], $item['icon'], $item['title'], 'sidebar_'.$item['id']);
|
||||
if ($item['id']==$_SESSION['state']['sidebar_tab']) {
|
||||
?>
|
||||
<div id="sidebar-page" class="sidebar-page-<?php echo AmpConfig::get('ui_fixed') ? 'fixed' : 'float'; ?>">
|
||||
<?php require_once AmpConfig::get('prefix') . '/templates/sidebar_' . $_SESSION['state']['sidebar_tab'] . '.inc.php'; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<li id="sb_tab_logout" class="sb1">
|
||||
<a target="_top" href="<?php echo AmpConfig::get('web_path'); ?>/logout.php" id="sidebar_logout" >
|
||||
<?php echo UI::get_icon('logout', T_('Logout')); ?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue