1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 09:49:30 +02:00

Fix Scrutinizer reported errors

This commit is contained in:
Afterster 2014-07-09 23:27:14 +02:00
parent 4a2d7b97f6
commit 80cd08ed04
29 changed files with 117 additions and 92 deletions

View file

@ -39,18 +39,19 @@ $default_name = "Unknown.zip";
$name = $default_name; $name = $default_name;
if (Core::is_playable_item($_REQUEST['action'])) { if (Core::is_playable_item($_REQUEST['action'])) {
$id = $_REQUEST['id']; $id = $_REQUEST['id'];
if (!is_array($id)) { if (!is_array($id)) {
$id = array($id); $id = array($id);
} }
$media_ids = array(); $media_ids = array();
foreach ($id as $i) { foreach ($id as $i) {
$libitem = new $_REQUEST['action']($i); $libitem = new $_REQUEST['action']($i);
if ($libitem->id) { if ($libitem->id) {
$name = $libitem->get_fullname(); $libitem->format();
$media_ids = array_merge($media_ids, $libitem->get_medias()); $name = $libitem->get_fullname();
} $media_ids = array_merge($media_ids, $libitem->get_medias());
} }
}
} else { } else {
switch ($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'tmp_playlist': case 'tmp_playlist':

View file

@ -468,7 +468,7 @@ class Album extends database_object implements library_item
$keywords = array(); $keywords = array();
$keywords['artist'] = array('important' => true, $keywords['artist'] = array('important' => true,
'label' => T_('Artist'), 'label' => T_('Artist'),
'value' => (($album->artist_count < 2) ? $this->f_artist_name : '')); 'value' => (($this->artist_count < 2) ? $this->f_artist_name : ''));
$keywords['album'] = array('important' => true, $keywords['album'] = array('important' => true,
'label' => T_('Album'), 'label' => T_('Album'),
'value' => $this->f_name); 'value' => $this->f_name);
@ -483,8 +483,8 @@ class Album extends database_object implements library_item
public function get_parent() public function get_parent()
{ {
if ($album->artist_count == 1) { if ($this->artist_count == 1) {
return array('object_type' => 'artist', 'object_id' => $album->artist_id); return array('object_type' => 'artist', 'object_id' => $this->artist_id);
} }
return null; return null;

View file

@ -429,12 +429,13 @@ class Api
public static function tag_artists($input) public static function tag_artists($input)
{ {
$artists = Tag::get_tag_objects('artist',$input['filter']); $artists = Tag::get_tag_objects('artist',$input['filter']);
if ($artists) {
XML_Data::set_offset($input['offset']);
XML_Data::set_limit($input['limit']);
XML_Data::set_offset($input['offset']); ob_end_clean();
XML_Data::set_limit($input['limit']); echo XML_Data::artists($artists);
}
ob_end_clean();
echo XML_Data::artists($artists);
} // tag_artists } // tag_artists
@ -445,12 +446,13 @@ class Api
public static function tag_albums($input) public static function tag_albums($input)
{ {
$albums = Tag::get_tag_objects('album',$input['filter']); $albums = Tag::get_tag_objects('album',$input['filter']);
if ($albums) {
XML_Data::set_offset($input['offset']);
XML_Data::set_limit($input['limit']);
XML_Data::set_offset($input['offset']); ob_end_clean();
XML_Data::set_limit($input['limit']); echo XML_Data::albums($albums);
}
ob_end_clean();
echo XML_Data::albums($albums);
} // tag_albums } // tag_albums

View file

@ -451,10 +451,6 @@ class Art extends database_object
// If it came from the database // If it came from the database
if (isset($data['db'])) { if (isset($data['db'])) {
// Repull it
$uid = Dba::escape($data['db']);
$type = Dba::escape($type);
$sql = "SELECT * FROM `image` WHERE `object_type` = ? AND `object_id` =? AND `size`='original'"; $sql = "SELECT * FROM `image` WHERE `object_type` = ? AND `object_id` =? AND `size`='original'";
$db_results = Dba::read($sql, array($type, $data['db'])); $db_results = Dba::read($sql, array($type, $data['db']));
$row = Dba::fetch_assoc($db_results); $row = Dba::fetch_assoc($db_results);
@ -586,7 +582,7 @@ class Art extends database_object
* gather * gather
* This tries to get the art in question * This tries to get the art in question
*/ */
public function gather($options = array(), $limit = false, $gather_parent = false) public function gather($options = array(), $limit = 0)
{ {
// Define vars // Define vars
$results = array(); $results = array();
@ -1151,6 +1147,8 @@ class Art extends database_object
public static function get_thumb_size($thumb) public static function get_thumb_size($thumb)
{ {
$size = array();
switch ($thumb) { switch ($thumb) {
case '1': case '1':
/* This is used by the now_playing / browse stuff */ /* This is used by the now_playing / browse stuff */

View file

@ -266,7 +266,7 @@ class Artist extends database_object implements library_item
* _get_extra info * _get_extra info
* This returns the extra information for the artist, this means totals etc * This returns the extra information for the artist, this means totals etc
*/ */
private function _get_extra_info($catalog=FALSE) private function _get_extra_info($catalog=0)
{ {
// Try to find it in the cache and save ourselves the trouble // Try to find it in the cache and save ourselves the trouble
if (parent::is_cached('artist_extra',$this->id) ) { if (parent::is_cached('artist_extra',$this->id) ) {
@ -367,6 +367,7 @@ class Artist extends database_object implements library_item
public function get_childrens() public function get_childrens()
{ {
$medias = array();
$albums = $this->get_albums(); $albums = $this->get_albums();
foreach ($albums as $album_id) { foreach ($albums as $album_id) {
$medias[] = array( $medias[] = array(
@ -374,7 +375,7 @@ class Artist extends database_object implements library_item
'object_id' => $album_id 'object_id' => $album_id
); );
} }
return array('album' => $this->get_albums()); return array('album' => $medias);
} }
public function get_medias($filter_type = null) public function get_medias($filter_type = null)

View file

@ -163,7 +163,7 @@ class Browse extends Query
break; break;
case 'artist': case 'artist':
$box_title = T_('Artists') . $match; $box_title = T_('Artists') . $match;
Artist::build_cache($object_ids, 'extra'); Artist::build_cache($object_ids, true);
$box_req = AmpConfig::get('prefix') . '/templates/show_artists.inc.php'; $box_req = AmpConfig::get('prefix') . '/templates/show_artists.inc.php';
break; break;
case 'live_stream': case 'live_stream':

View file

@ -369,10 +369,12 @@ abstract class Catalog extends database_object
return $results; return $results;
} }
public static function getLastUpdate() public static function getLastUpdate($catalogs = null)
{ {
$last_update = 0; $last_update = 0;
$catalogs = self::get_catalogs(); if ($catalogs == null || !is_array($catalogs)) {
$catalogs = self::get_catalogs();
}
foreach ($catalogs as $id) { foreach ($catalogs as $id) {
$catalog = Catalog::create_from_id($id); $catalog = Catalog::create_from_id($id);
if ($catalog->last_add > $last_update) { if ($catalog->last_add > $last_update) {
@ -636,7 +638,7 @@ abstract class Catalog extends database_object
if (!empty($type)) { if (!empty($type)) {
$sql .= "JOIN `" . $type . "` ON `" . $type . "`.`id` = `video`.`id` "; $sql .= "JOIN `" . $type . "` ON `" . $type . "`.`id` = `video`.`id` ";
} }
if ($catalogs) { if ($catalog_id) {
$sql .= "WHERE `video`.`catalog` = `" . intval($catalog_id) . "`"; $sql .= "WHERE `video`.`catalog` = `" . intval($catalog_id) . "`";
} }
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
@ -680,7 +682,7 @@ abstract class Catalog extends database_object
$results = array(); $results = array();
foreach ($catalogs as $catalog_id) { foreach ($catalogs as $catalog_id) {
$catalog = Catalog::create_from_id($catalog_id); $catalog = Catalog::create_from_id($catalog_id);
$tvshow_ids = $catalog->get_tvshow_ids($type); $tvshow_ids = $catalog->get_tvshow_ids();
foreach ($tvshow_ids as $tvshow_id) { foreach ($tvshow_ids as $tvshow_id) {
$results[] = new TVShow($tvshow_id); $results[] = new TVShow($tvshow_id);
} }
@ -870,6 +872,13 @@ abstract class Catalog extends database_object
if ($type == 'video' && AmpConfig::get('generate_video_preview')) { if ($type == 'video' && AmpConfig::get('generate_video_preview')) {
Video::generate_preview($id); Video::generate_preview($id);
} }
// Stupid little cutesie thing
$search_count++;
if (UI::check_ticker()) {
UI::update_text('count_art_' . $this->id, $search_count);
UI::update_text('read_art_' . $this->id, $libitem->get_fullname());
}
} }
/** /**
@ -921,13 +930,6 @@ abstract class Catalog extends database_object
foreach ($searches as $key => $values) { foreach ($searches as $key => $values) {
foreach ($values as $id) { foreach ($values as $id) {
$this->gather_art_item($key, $id); $this->gather_art_item($key, $id);
// Stupid little cutesie thing
$search_count++;
if (UI::check_ticker()) {
UI::update_text('count_art_' . $this->id, $search_count);
UI::update_text('read_art_' . $this->id, scrub_out($album->name));
}
} }
} }
@ -1648,7 +1650,7 @@ abstract class Catalog extends database_object
$xml['dict']['Play Count'] = intval($song->played); $xml['dict']['Play Count'] = intval($song->played);
$xml['dict']['Track Type'] = "URL"; $xml['dict']['Track Type'] = "URL";
$xml['dict']['Location'] = Song::play_url($song->id); $xml['dict']['Location'] = Song::play_url($song->id);
echo xoutput_from_array($xml, 1, 'itunes'); echo xoutput_from_array($xml, true, 'itunes');
// flush output buffer // flush output buffer
} // while result } // while result
echo xml_get_footer('itunes'); echo xml_get_footer('itunes');

View file

@ -100,10 +100,12 @@ class Channel extends database_object implements media, library_item
{ {
$tags = Tag::get_object_tags('channel', $this->id); $tags = Tag::get_object_tags('channel', $this->id);
$genre = ""; $genre = "";
foreach ($tags as $tag) { if ($tags) {
$genre .= $tag['name'] . ' '; foreach ($tags as $tag) {
$genre .= $tag['name'] . ' ';
}
$genre = trim($genre);
} }
$genre = trim($genre);
return $genre; return $genre;
} }
@ -447,4 +449,14 @@ class Channel extends database_object implements media, library_item
// Do nothing // Do nothing
} }
public function get_transcode_settings($array, $callback = false, $type = '')
{
return false;
}
public static function gc()
{
}
} // end of channel class } // end of channel class

View file

@ -64,18 +64,18 @@ class Error
// Make sure its set first // Make sure its set first
if (!isset(Error::$errors[$name])) { if (!isset(Error::$errors[$name])) {
Error::$errors[$name] = $message; Error::$errors[$name] = $message;
Error::$state = 1; Error::$state = true;
$_SESSION['errors'][$name] = $message; $_SESSION['errors'][$name] = $message;
} }
// They want us to clobber it // They want us to clobber it
elseif ($clobber) { elseif ($clobber) {
Error::$state = 1; Error::$state = true;
Error::$errors[$name] = $message; Error::$errors[$name] = $message;
$_SESSION['errors'][$name] = $message; $_SESSION['errors'][$name] = $message;
} }
// They want us to append the error, add a BR\n and then the message // They want us to append the error, add a BR\n and then the message
else { else {
Error::$state = 1; Error::$state = true;
Error::$errors[$name] .= "<br />\n" . $message; Error::$errors[$name] .= "<br />\n" . $message;
$_SESSION['errors'][$name] .= "<br />\n" . $message; $_SESSION['errors'][$name] .= "<br />\n" . $message;
} }

View file

@ -69,7 +69,7 @@ class Preference extends database_object
* update * update
* This updates a single preference from the given name or id * This updates a single preference from the given name or id
*/ */
public static function update($preference,$user_id,$value,$applytoall='',$applytodefault='') public static function update($preference,$user_id,$value,$applytoall=false,$applytodefault=false)
{ {
// First prepare // First prepare
if (!is_numeric($preference)) { if (!is_numeric($preference)) {

View file

@ -1015,7 +1015,7 @@ class Query
*/ */
private function get_select() private function get_select()
{ {
$select_string = implode($this->_state['select'], ", "); $select_string = implode(", ", $this->_state['select']);
return $select_string; return $select_string;
} // get_select } // get_select

View file

@ -33,7 +33,7 @@ class scrobbler_async extends Thread
spl_autoload_register(array('Core', 'autoload'), true, true); spl_autoload_register(array('Core', 'autoload'), true, true);
Requests::register_autoloader(); Requests::register_autoloader();
if ($this->song_info) { if ($this->song_info) {
User::save_songplay($this->user, $this->song_info); User::save_mediaplay($this->user, $this->song_info);
} }
} }
} }

View file

@ -374,7 +374,7 @@ class Session
// Set up the cookie prefs before we throw down, this is very important // Set up the cookie prefs before we throw down, this is very important
$cookie_life = AmpConfig::get('cookie_life'); $cookie_life = AmpConfig::get('cookie_life');
$cookie_path = AmpConfig::get('cookie_path'); $cookie_path = AmpConfig::get('cookie_path');
$cookie_domain = false; $cookie_domain = null;
$cookie_secure = AmpConfig::get('cookie_secure'); $cookie_secure = AmpConfig::get('cookie_secure');
session_set_cookie_params($cookie_life, $cookie_path, $cookie_domain, $cookie_secure); session_set_cookie_params($cookie_life, $cookie_path, $cookie_domain, $cookie_secure);

View file

@ -222,7 +222,7 @@ class Song_Preview extends database_object implements media, playable_item
public function get_fullname() public function get_fullname()
{ {
return $this->f_name; return $this->f_title;
} }
public function get_parent() public function get_parent()

View file

@ -194,7 +194,7 @@ class Tag extends database_object implements library_item
if ($data['select_tags']) { if ($data['select_tags']) {
$merge_to = Tag::construct_from_name($data['select_tags']); $merge_to = Tag::construct_from_name($data['select_tags']);
if ($merge_to->id) { if ($merge_to->id) {
$tag->merge($merge_to->id, ($data['merge_persist'] == '1')); $this->merge($merge_to->id, ($data['merge_persist'] == '1'));
} }
} }
@ -241,9 +241,12 @@ class Tag extends database_object implements library_item
$db_results = Dba::read($sql, array($this->id)); $db_results = Dba::read($sql, array($this->id));
$results = array();
while ($row = Dba::fetch_assoc($db_results)) { while ($row = Dba::fetch_assoc($db_results)) {
$results[$row['id']] = array('id'=>$row['id'], 'name'=>$row['name']); $results[$row['id']] = array('id'=>$row['id'], 'name'=>$row['name']);
} }
return $results;
} }
/** /**
@ -654,11 +657,13 @@ class Tag extends database_object implements library_item
$medias = array(); $medias = array();
if ($filter_type) { if ($filter_type) {
$ids = Tag::get_tag_objects($filter_type, $this->id); $ids = Tag::get_tag_objects($filter_type, $this->id);
foreach ($ids as $id) { if ($ids) {
$medias[] = array( foreach ($ids as $id) {
'object_type' => $filter_type, $medias[] = array(
'object_id' => $id 'object_type' => $filter_type,
); 'object_id' => $id
);
}
} }
} }
return $medias; return $medias;

View file

@ -177,7 +177,7 @@ class TVShow extends database_object implements library_item
$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($this->catalog_id); $this->_get_extra_info();
$this->tags = Tag::get_top_tags('tvshow', $this->id); $this->tags = Tag::get_top_tags('tvshow', $this->id);
$this->f_tags = Tag::get_display($this->tags, true, 'tvshow'); $this->f_tags = Tag::get_display($this->tags, true, 'tvshow');
@ -343,10 +343,9 @@ class TVShow extends database_object implements library_item
Tag::update_tag_list($tags_comma, 'tvshow', $current_id); Tag::update_tag_list($tags_comma, 'tvshow', $current_id);
if ($override_childs) { if ($override_childs) {
$seasons = $this->get_albums(null, true); $episodes = $this->get_episodes();
foreach ($seasons as $season_id) { foreach ($episodes as $ep_id) {
$season = new TVShow_Season($season_id); Tag::update_tag_list($data['edit_tags'], 'episode', $ep_id);
$season->update_tags($tags_comma, $override_childs);
} }
} }
} }

View file

@ -125,6 +125,8 @@ class TVShow_Episode extends Video
$sql = "UPDATE `tvshow_episode` SET `original_name` = ?, `season` = ?, `episode_number` = ?, `summary` = ? WHERE `id` = ?"; $sql = "UPDATE `tvshow_episode` SET `original_name` = ?, `season` = ?, `episode_number` = ?, `summary` = ? WHERE `id` = ?";
Dba::write($sql, array($data['original_name'], $data['tvshow_season'], $data['tvshow_episode'], $data['summary'], $this->id)); Dba::write($sql, array($data['original_name'], $data['tvshow_season'], $data['tvshow_episode'], $data['summary'], $this->id));
Tag::update_tag_list($data['edit_tags'], 'episode', $this->id);
return $this->id; return $this->id;
} }

View file

@ -138,7 +138,7 @@ class TVShow_Season extends database_object implements library_item
$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($this->catalog_id); $this->_get_extra_info();
return true; return true;
} }

View file

@ -1867,7 +1867,7 @@ class Update
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'0')"; $sql = "INSERT INTO `user_preference` VALUES (-1,?,'0')";
$retval = Dba::write($sql, array($id)) ? $retval : false; $retval = Dba::write($sql, array($id)) ? $retval : false;
return true; return $retval;
} }
/** /**
@ -1908,7 +1908,7 @@ class Update
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')"; $sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')";
$retval = Dba::write($sql, array($id)) ? $retval : false; $retval = Dba::write($sql, array($id)) ? $retval : false;
return true; return $retval;
} }
/** /**
@ -2158,7 +2158,7 @@ class Update
$sql = "DELETE FROM `preference` WHERE `name` = 'tags_userlist'"; $sql = "DELETE FROM `preference` WHERE `name` = 'tags_userlist'";
$retval = Dba::write($sql) ? $retval : false; $retval = Dba::write($sql) ? $retval : false;
return true; return $retval;
} }
/** /**
@ -2550,7 +2550,7 @@ class Update
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'0')"; $sql = "INSERT INTO `user_preference` VALUES (-1,?,'0')";
$retval = Dba::write($sql, array($id)) ? $retval : false; $retval = Dba::write($sql, array($id)) ? $retval : false;
return true; return $retval;
} }
/** /**

View file

@ -95,6 +95,7 @@ class Upnp_Api
public static function parseUPnPRequest($prmRequest) public static function parseUPnPRequest($prmRequest)
{ {
$retArr = array();
$reader = new XMLReader(); $reader = new XMLReader();
$reader->XML($prmRequest); $reader->XML($prmRequest);
while ($reader->read()) { while ($reader->read()) {
@ -559,8 +560,6 @@ class Upnp_Api
break; break;
default: default:
$counts = Catalog::count_medias();
$mediaItems[] = self::_musicMetadata('artists'); $mediaItems[] = self::_musicMetadata('artists');
$mediaItems[] = self::_musicMetadata('albums'); $mediaItems[] = self::_musicMetadata('albums');
$mediaItems[] = self::_musicMetadata('songs'); $mediaItems[] = self::_musicMetadata('songs');

View file

@ -39,7 +39,7 @@ class vainfo
public $gather_types = array(); public $gather_types = array();
protected $_raw = array(); protected $_raw = array();
protected $_getID3 = ''; protected $_getID3 = null;
protected $_forcedSize = 0; protected $_forcedSize = 0;
protected $_file_encoding = ''; protected $_file_encoding = '';
@ -169,7 +169,7 @@ class vainfo
} }
if ($encoding != 'ASCII' && $encoding != '0') { if ($encoding != 'ASCII' && $encoding != '0') {
return $encoding; return (string) $encoding;
} else { } else {
return 'ISO-8859-1'; return 'ISO-8859-1';
} }
@ -897,10 +897,12 @@ class vainfo
} else { } else {
// Or we assume each parent folder contains one missing information // Or we assume each parent folder contains one missing information
if (preg_match('/[\/\\\\]([^\/\\\\]*)[\/\\\\]Season (\d{1,2})[\/\\\\]((E|Ep|Episode)\s?(\d{1,2})[\/\\\\])?/i', $filename, $matches)) { if (preg_match('/[\/\\\\]([^\/\\\\]*)[\/\\\\]Season (\d{1,2})[\/\\\\]((E|Ep|Episode)\s?(\d{1,2})[\/\\\\])?/i', $filename, $matches)) {
$results['tvshow'] = $this->fixSerieName($matches[1]); if ($matches != null) {
$results['tvshow_season'] = $matches[2]; $results['tvshow'] = $this->fixSerieName($matches[1]);
if (isset($matches[5])) { $results['tvshow_season'] = $matches[2];
$results['tvshow_episode'] = $matches[5]; if (isset($matches[5])) {
$results['tvshow_episode'] = $matches[5];
}
} }
} }
} }

View file

@ -31,8 +31,8 @@
class XML_Data class XML_Data
{ {
// This is added so that we don't pop any webservers // This is added so that we don't pop any webservers
private static $limit = '5000'; private static $limit = 5000;
private static $offset = '0'; private static $offset = 0;
private static $type = ''; private static $type = '';
/** /**

View file

@ -189,7 +189,7 @@ if (!defined('NO_SESSION') && AmpConfig::get('use_auth')) {
$GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']); $GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']);
} else { } else {
$GLOBALS['user'] = new User($auth['username']); $GLOBALS['user'] = new User($auth['username']);
$GLOBALS['user']->id = '-1'; $GLOBALS['user']->id = -1;
$GLOBALS['user']->username = $auth['username']; $GLOBALS['user']->username = $auth['username'];
$GLOBALS['user']->fullname = $auth['fullname']; $GLOBALS['user']->fullname = $auth['fullname'];
$GLOBALS['user']->access = $auth['access']; $GLOBALS['user']->access = $auth['access'];

View file

@ -185,7 +185,7 @@ function show_preference_box($preferences)
* This displays a select of every album that we've got in Ampache (which can be * This displays a select of every album that we've got in Ampache (which can be
* hella long). It's used by the Edit page and takes a $name and a $album_id * hella long). It's used by the Edit page and takes a $name and a $album_id
*/ */
function show_album_select($name='album',$album_id=0,$allow_add=0,$song_id=0) function show_album_select($name='album',$album_id=0,$allow_add=false,$song_id=0)
{ {
static $album_id_cnt = 0; static $album_id_cnt = 0;
@ -527,7 +527,7 @@ function xml_from_array($array, $callback = false, $type = '')
case 'itunes': case 'itunes':
foreach ($array as $key=>$value) { foreach ($array as $key=>$value) {
if (is_array($value)) { if (is_array($value)) {
$value = xoutput_from_array($value,1,$type); $value = xoutput_from_array($value, true, $type);
$string .= "\t\t<$key>\n$value\t\t</$key>\n"; $string .= "\t\t<$key>\n$value\t\t</$key>\n";
} else { } else {
if ($key == "key") { if ($key == "key") {
@ -548,7 +548,7 @@ function xml_from_array($array, $callback = false, $type = '')
case 'xspf': case 'xspf':
foreach ($array as $key=>$value) { foreach ($array as $key=>$value) {
if (is_array($value)) { if (is_array($value)) {
$value = xoutput_from_array($value,1,$type); $value = xoutput_from_array($value, true, $type);
$string .= "\t\t<$key>\n$value\t\t</$key>\n"; $string .= "\t\t<$key>\n$value\t\t</$key>\n";
} else { } else {
if ($key == "key") { if ($key == "key") {

View file

@ -44,7 +44,7 @@ if (AmpConfig::get('transcode_player_customize')) {
$transcode_to = null; $transcode_to = null;
$bitrate = 0; $bitrate = 0;
} }
$share_id = scrub_in($_REQUEST['share_id']); $share_id = intval($_REQUEST['share_id']);
if (!$type) { if (!$type) {
$type = 'song'; $type = 'song';
@ -82,7 +82,7 @@ if (empty($uid)) {
} }
} }
if (empty($share_id)) { if (!$share_id) {
$GLOBALS['user'] = new User($uid); $GLOBALS['user'] = new User($uid);
Preference::init(); Preference::init();
@ -446,7 +446,7 @@ if ($range_values > 0 && ($start > 0 || $end > 0)) {
if ($start > 0) { if ($start > 0) {
debug_event('play', 'Content-Range doesn\'t start from 0, stats should already be registered previously; not collecting stats', 5); debug_event('play', 'Content-Range doesn\'t start from 0, stats should already be registered previously; not collecting stats', 5);
} else { } else {
if (empty($share_id)) { if (!$share_id) {
if ($_SERVER['REQUEST_METHOD'] != 'HEAD') { if ($_SERVER['REQUEST_METHOD'] != 'HEAD') {
debug_event('play', 'Registering stats for {'.$media->get_stream_name() .'}...', '5'); debug_event('play', 'Registering stats for {'.$media->get_stream_name() .'}...', '5');
$sessionkey = Stream::$session; $sessionkey = Stream::$session;

View file

@ -122,7 +122,7 @@ switch ($_REQUEST['action']) {
break; break;
} }
$playlist->add_songs(array($_REQUEST['song_id']), 'ORDERED'); $playlist->add_songs(array($_REQUEST['song_id']), true);
break; break;
case 'prune_empty': case 'prune_empty':
if (!$GLOBALS['user']->has_access(100)) { if (!$GLOBALS['user']->has_access(100)) {

View file

@ -38,7 +38,7 @@ switch ($_REQUEST['action']) {
} }
break; break;
case 'random_videos': case 'random_videos':
$videos = Video::get_random(6, true); $videos = Video::get_random(6);
if (count($videos) AND is_array($videos)) { if (count($videos) AND is_array($videos)) {
ob_start(); ob_start();
require_once AmpConfig::get('prefix') . '/templates/show_random_videos.inc.php'; require_once AmpConfig::get('prefix') . '/templates/show_random_videos.inc.php';

View file

@ -120,7 +120,7 @@ switch ($_REQUEST['action']) {
if (count($songs) > 0) { if (count($songs) > 0) {
Ajax::set_include_override(true); Ajax::set_include_override(true);
$playlist->add_songs($songs, 'ORDERED'); $playlist->add_songs($songs, true);
/*$playlist->format(); /*$playlist->format();
$object_ids = $playlist->get_items(); $object_ids = $playlist->get_items();

View file

@ -25,6 +25,8 @@ $rootMediaItems[] = Upnp_Api::_videoMetadata('');
exit; exit;
} }
$items = array();
$responseType = "u:Error";
switch ($upnpRequest['action']) { switch ($upnpRequest['action']) {
case 'search': case 'search':
$responseType = 'u:SearchResponse'; $responseType = 'u:SearchResponse';