mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
Remove old code and fix old php errors
This commit is contained in:
parent
59d038335f
commit
b16958f44e
92 changed files with 576 additions and 706 deletions
|
@ -243,7 +243,6 @@ switch ($_REQUEST['action']) {
|
||||||
$body = '';
|
$body = '';
|
||||||
show_confirmation($title, $body, $url);
|
show_confirmation($title, $body, $url);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
case 'show_catalogs':
|
case 'show_catalogs':
|
||||||
require_once AmpConfig::get('prefix') . '/templates/show_manage_catalogs.inc.php';
|
require_once AmpConfig::get('prefix') . '/templates/show_manage_catalogs.inc.php';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -64,8 +64,6 @@ switch ($_REQUEST['action']) {
|
||||||
|
|
||||||
// We don't want the footer so we're done here
|
// We don't want the footer so we're done here
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
require_once AmpConfig::get('prefix') . '/templates/show_export.inc.php';
|
require_once AmpConfig::get('prefix') . '/templates/show_export.inc.php';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -42,7 +42,6 @@ switch ($_REQUEST['action']) {
|
||||||
$browser->downloadHeaders('ampache.cfg.php','text/plain',false,filesize(AmpConfig::get('prefix') . '/config/ampache.cfg.php.dist'));
|
$browser->downloadHeaders('ampache.cfg.php','text/plain',false,filesize(AmpConfig::get('prefix') . '/config/ampache.cfg.php.dist'));
|
||||||
echo $final;
|
echo $final;
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'reset_db_charset':
|
case 'reset_db_charset':
|
||||||
Dba::reset_db_charset();
|
Dba::reset_db_charset();
|
||||||
show_confirmation(T_('Database Charset Updated'), T_('Your Database and associated tables have been updated to match your currently configured charset'), AmpConfig::get('web_path').'/admin/system.php?action=show_debug');
|
show_confirmation(T_('Database Charset Updated'), T_('Your Database and associated tables have been updated to match your currently configured charset'), AmpConfig::get('web_path').'/admin/system.php?action=show_debug');
|
||||||
|
|
|
@ -40,7 +40,7 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clean up the variables */
|
/* Clean up the variables */
|
||||||
$user_id = scrub_in($_POST['user_id']);
|
$user_id = intval($_POST['user_id']);
|
||||||
$username = scrub_in($_POST['username']);
|
$username = scrub_in($_POST['username']);
|
||||||
$fullname = scrub_in($_POST['fullname']);
|
$fullname = scrub_in($_POST['fullname']);
|
||||||
$email = scrub_in($_POST['email']);
|
$email = scrub_in($_POST['email']);
|
||||||
|
|
|
@ -108,7 +108,7 @@ switch ($_REQUEST['action']) {
|
||||||
$options['keyword'] = trim($artist . " " . $album_name);
|
$options['keyword'] = trim($artist . " " . $album_name);
|
||||||
|
|
||||||
// Attempt to find the art.
|
// Attempt to find the art.
|
||||||
$images = $art->gather($options,'6');
|
$images = $art->gather($options);
|
||||||
|
|
||||||
if (!empty($_REQUEST['cover'])) {
|
if (!empty($_REQUEST['cover'])) {
|
||||||
$path_info = pathinfo($_REQUEST['cover']);
|
$path_info = pathinfo($_REQUEST['cover']);
|
||||||
|
|
53
artists.php
53
artists.php
|
@ -48,59 +48,6 @@ switch ($_REQUEST['action']) {
|
||||||
$target_url = AmpConfig::get('web_path') . "/artists.php?action=show&artist=" . $object_id;
|
$target_url = AmpConfig::get('web_path') . "/artists.php?action=show&artist=" . $object_id;
|
||||||
require_once AmpConfig::get('prefix') . '/templates/show_update_items.inc.php';
|
require_once AmpConfig::get('prefix') . '/templates/show_update_items.inc.php';
|
||||||
break;
|
break;
|
||||||
case 'rename':
|
|
||||||
//die if not enough permissions
|
|
||||||
if (!$user->has_access('100')) { UI::access_denied(); }
|
|
||||||
|
|
||||||
/* Get the artist */
|
|
||||||
$artist = new Artist($_REQUEST['artist']);
|
|
||||||
|
|
||||||
//check if we've been given a target
|
|
||||||
if ((isset($_POST['artist_id']) && $_POST['artist_id'] != $artist->id ) || (isset($_POST['artist_name']) && $_POST['artist_name'] != "")) {
|
|
||||||
|
|
||||||
//if we want to update id3 tags, then get the array of ids now, it's too late afterwards
|
|
||||||
if (make_bool($_POST['update_id3']))
|
|
||||||
$songs = $artist->get_songs();
|
|
||||||
|
|
||||||
$ret = 0;
|
|
||||||
$newname = "";
|
|
||||||
$newid = 0;
|
|
||||||
//the manual rename takes priority, but if they tested out the insert thing ignore
|
|
||||||
if ($_POST['artist_name'] != "" && $_POST['artist_name'] != $artist->name) {
|
|
||||||
//then just change the name of the artist in the db
|
|
||||||
$ret = $artist->rename($_POST['artist_name']);
|
|
||||||
$newid = $ret;
|
|
||||||
$newname = $_POST['artist_name'];
|
|
||||||
}
|
|
||||||
//new id?
|
|
||||||
elseif ($_POST['artist_id'] != $artist->id) {
|
|
||||||
//merge with other artist
|
|
||||||
$ret = $artist->merge($_POST['artist_id']);
|
|
||||||
$newid = $_POST['artist_id'];
|
|
||||||
$newname = $ret;
|
|
||||||
} // elseif different artist and id
|
|
||||||
//if no changes, no changes
|
|
||||||
|
|
||||||
// show something other than a blank screen after this
|
|
||||||
if ($ret) {
|
|
||||||
show_confirmation (
|
|
||||||
T_('Renamed artist'),
|
|
||||||
sprintf(T_('%1$s is now known as %2$s'), $artist->name, $newname),
|
|
||||||
AmpConfig::get('web_path') . "/artists.php?action=show&artist=" . $newid
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // if we've got the needed variables
|
|
||||||
|
|
||||||
/* Else we've got an error! But be lenient, and just show the form again */
|
|
||||||
else {
|
|
||||||
require AmpConfig::get('prefix') . '/templates/show_rename_artist.inc.php';
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'show_rename':
|
|
||||||
$artist = new Artist($_REQUEST['artist']);
|
|
||||||
require AmpConfig::get('prefix') . '/templates/show_rename_artist.inc.php';
|
|
||||||
break;
|
|
||||||
case 'match':
|
case 'match':
|
||||||
case 'Match':
|
case 'Match':
|
||||||
$match = scrub_in($_REQUEST['match']);
|
$match = scrub_in($_REQUEST['match']);
|
||||||
|
|
|
@ -101,6 +101,8 @@ switch ($_REQUEST['action']) {
|
||||||
|
|
||||||
// Take whatever we've got and send the zip
|
// Take whatever we've got and send the zip
|
||||||
$song_files = get_song_files($media_ids);
|
$song_files = get_song_files($media_ids);
|
||||||
set_memory_limit($song_files['1']+32);
|
if (is_array($song_files['0'])) {
|
||||||
send_zip($name,$song_files['0']);
|
set_memory_limit($song_files['1']+32);
|
||||||
|
send_zip($name,$song_files['0']);
|
||||||
|
}
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -33,8 +33,7 @@ switch ($_REQUEST['action']) {
|
||||||
$next_url = AmpConfig::get('web_path') . '/broadcast.php?action=delete&id=' . scrub_out($id);
|
$next_url = AmpConfig::get('web_path') . '/broadcast.php?action=delete&id=' . scrub_out($id);
|
||||||
show_confirmation(T_('Broadcast Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_broadcast');
|
show_confirmation(T_('Broadcast Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_broadcast');
|
||||||
UI::show_footer();
|
UI::show_footer();
|
||||||
exit();
|
exit;
|
||||||
break;
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if (AmpConfig::get('demo_mode')) {
|
if (AmpConfig::get('demo_mode')) {
|
||||||
UI::access_denied();
|
UI::access_denied();
|
||||||
|
@ -49,8 +48,7 @@ switch ($_REQUEST['action']) {
|
||||||
show_confirmation(T_('Broadcast Deleted'), T_('The Broadcast has been deleted'), $next_url);
|
show_confirmation(T_('Broadcast Deleted'), T_('The Broadcast has been deleted'), $next_url);
|
||||||
}
|
}
|
||||||
UI::show_footer();
|
UI::show_footer();
|
||||||
exit();
|
exit;
|
||||||
break;
|
|
||||||
} // switch on the action
|
} // switch on the action
|
||||||
|
|
||||||
UI::show_footer();
|
UI::show_footer();
|
||||||
|
|
12
channel.php
12
channel.php
|
@ -38,8 +38,7 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UI::show_footer();
|
UI::show_footer();
|
||||||
exit();
|
exit;
|
||||||
break;
|
|
||||||
case 'create':
|
case 'create':
|
||||||
if (AmpConfig::get('demo_mode')) {
|
if (AmpConfig::get('demo_mode')) {
|
||||||
UI::access_denied();
|
UI::access_denied();
|
||||||
|
@ -61,8 +60,7 @@ switch ($_REQUEST['action']) {
|
||||||
show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=channel');
|
show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=channel');
|
||||||
}
|
}
|
||||||
UI::show_footer();
|
UI::show_footer();
|
||||||
exit();
|
exit;
|
||||||
break;
|
|
||||||
case 'show_delete':
|
case 'show_delete':
|
||||||
UI::show_header();
|
UI::show_header();
|
||||||
$id = $_REQUEST['id'];
|
$id = $_REQUEST['id'];
|
||||||
|
@ -70,8 +68,7 @@ switch ($_REQUEST['action']) {
|
||||||
$next_url = AmpConfig::get('web_path') . '/channel.php?action=delete&id=' . scrub_out($id);
|
$next_url = AmpConfig::get('web_path') . '/channel.php?action=delete&id=' . scrub_out($id);
|
||||||
show_confirmation(T_('Channel Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_channel');
|
show_confirmation(T_('Channel Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_channel');
|
||||||
UI::show_footer();
|
UI::show_footer();
|
||||||
exit();
|
exit;
|
||||||
break;
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if (AmpConfig::get('demo_mode')) {
|
if (AmpConfig::get('demo_mode')) {
|
||||||
UI::access_denied();
|
UI::access_denied();
|
||||||
|
@ -86,8 +83,7 @@ switch ($_REQUEST['action']) {
|
||||||
show_confirmation(T_('Channel Deleted'), T_('The Channel has been deleted'), $next_url);
|
show_confirmation(T_('Channel Deleted'), T_('The Channel has been deleted'), $next_url);
|
||||||
}
|
}
|
||||||
UI::show_footer();
|
UI::show_footer();
|
||||||
exit();
|
exit;
|
||||||
break;
|
|
||||||
} // switch on the action
|
} // switch on the action
|
||||||
|
|
||||||
UI::show_footer();
|
UI::show_footer();
|
||||||
|
|
|
@ -99,11 +99,17 @@ curl_setopt_array($ch, array(
|
||||||
curl_exec($ch);
|
curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings("unused")
|
||||||
|
*/
|
||||||
function progress($totaldownload, $downloaded, $us, $ud)
|
function progress($totaldownload, $downloaded, $us, $ud)
|
||||||
{
|
{
|
||||||
ob_flush();
|
ob_flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @SuppressWarnings("unused")
|
||||||
|
*/
|
||||||
function output_header($ch, $header)
|
function output_header($ch, $header)
|
||||||
{
|
{
|
||||||
$th = trim($header);
|
$th = trim($header);
|
||||||
|
|
|
@ -145,7 +145,7 @@ class Access
|
||||||
|
|
||||||
$sql = 'UPDATE `access_list` SET `start` = ?, `end` = ?, `level` = ?, ' .
|
$sql = 'UPDATE `access_list` SET `start` = ?, `end` = ?, `level` = ?, ' .
|
||||||
'`user` = ?, `name` = ?, `type` = ?, `enabled` = ? WHERE `id` = ?';
|
'`user` = ?, `name` = ?, `type` = ?, `enabled` = ? WHERE `id` = ?';
|
||||||
$db_results = Dba::write($sql,
|
Dba::write($sql,
|
||||||
array($start, $end, $level, $user, $name, $type, $enabled, $this->id));
|
array($start, $end, $level, $user, $name, $type, $enabled, $this->id));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -180,7 +180,7 @@ class Access
|
||||||
|
|
||||||
$sql = 'INSERT INTO `access_list` (`name`, `level`, `start`, `end`, ' .
|
$sql = 'INSERT INTO `access_list` (`name`, `level`, `start`, `end`, ' .
|
||||||
'`user`,`type`,`enabled`) VALUES (?, ?, ?, ?, ?, ?, ?)';
|
'`user`,`type`,`enabled`) VALUES (?, ?, ?, ?, ?, ?, ?)';
|
||||||
$db_results = Dba::write($sql, array($name, $level, $start, $end, $user, $type, $enabled));
|
Dba::write($sql, array($name, $level, $start, $end, $user, $type, $enabled));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -230,7 +230,6 @@ class Access
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'download':
|
case 'download':
|
||||||
return AmpConfig::get('download');
|
return AmpConfig::get('download');
|
||||||
break ;
|
|
||||||
case 'batch_download':
|
case 'batch_download':
|
||||||
if (!function_exists('gzcompress')) {
|
if (!function_exists('gzcompress')) {
|
||||||
debug_event('access', 'ZLIB extension not loaded, batch download disabled', 3);
|
debug_event('access', 'ZLIB extension not loaded, batch download disabled', 3);
|
||||||
|
@ -242,7 +241,6 @@ class Access
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +257,6 @@ class Access
|
||||||
case 'interface':
|
case 'interface':
|
||||||
case 'stream':
|
case 'stream':
|
||||||
return true;
|
return true;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -283,7 +280,6 @@ class Access
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
break;
|
|
||||||
} // end switch on type
|
} // end switch on type
|
||||||
|
|
||||||
$sql = 'SELECT `id` FROM `access_list` ' .
|
$sql = 'SELECT `id` FROM `access_list` ' .
|
||||||
|
@ -333,24 +329,13 @@ class Access
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'localplay':
|
case 'localplay':
|
||||||
// Check their localplay_level
|
// Check their localplay_level
|
||||||
if (AmpConfig::get('localplay_level') >= $level
|
return (AmpConfig::get('localplay_level') >= $level
|
||||||
|| $GLOBALS['user']->access >= 100) {
|
|| $GLOBALS['user']->access >= 100);
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'interface':
|
case 'interface':
|
||||||
// Check their standard user level
|
// Check their standard user level
|
||||||
if ($GLOBALS['user']->access >= $level) {
|
return ($GLOBALS['user']->access >= $level);
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -369,10 +354,8 @@ class Access
|
||||||
case 'interface':
|
case 'interface':
|
||||||
case 'network':
|
case 'network':
|
||||||
return $type;
|
return $type;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return 'stream';
|
return 'stream';
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,17 +422,13 @@ class Access
|
||||||
switch ($this->type) {
|
switch ($this->type) {
|
||||||
case 'rpc':
|
case 'rpc':
|
||||||
return T_('API/RPC');
|
return T_('API/RPC');
|
||||||
break;
|
|
||||||
case 'network':
|
case 'network':
|
||||||
return T_('Local Network Definition');
|
return T_('Local Network Definition');
|
||||||
break;
|
|
||||||
case 'interface':
|
case 'interface':
|
||||||
return T_('Web Interface');
|
return T_('Web Interface');
|
||||||
break;
|
|
||||||
case 'stream':
|
case 'stream':
|
||||||
default:
|
default:
|
||||||
return T_('Stream Access');
|
return T_('Stream Access');
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ class Album extends database_object
|
||||||
public $prefix;
|
public $prefix;
|
||||||
public $mbid; // MusicBrainz ID
|
public $mbid; // MusicBrainz ID
|
||||||
|
|
||||||
|
public $song_count;
|
||||||
public $artist_prefix;
|
public $artist_prefix;
|
||||||
public $artist_name;
|
public $artist_name;
|
||||||
public $artist_id;
|
public $artist_id;
|
||||||
|
@ -52,6 +53,7 @@ class Album extends database_object
|
||||||
public $f_link_src;
|
public $f_link_src;
|
||||||
public $f_link;
|
public $f_link;
|
||||||
public $f_tags;
|
public $f_tags;
|
||||||
|
public $f_title;
|
||||||
|
|
||||||
// cached information
|
// cached information
|
||||||
public $_fake;
|
public $_fake;
|
||||||
|
@ -445,7 +447,7 @@ class Album extends database_object
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->tags = Tag::get_top_tags('album', $this->id);
|
$this->tags = Tag::get_top_tags('album', $this->id);
|
||||||
$this->f_tags = Tag::get_display($this->tags, $this->id, 'album');
|
$this->f_tags = Tag::get_display($this->tags);
|
||||||
|
|
||||||
} // format
|
} // format
|
||||||
|
|
||||||
|
@ -490,7 +492,7 @@ class Album extends database_object
|
||||||
|
|
||||||
$current_id = $this->id;
|
$current_id = $this->id;
|
||||||
|
|
||||||
$updated = 0;
|
$updated = false;
|
||||||
$songs = null;
|
$songs = null;
|
||||||
if ($artist != $this->artist_id AND $artist) {
|
if ($artist != $this->artist_id AND $artist) {
|
||||||
// Update every song
|
// Update every song
|
||||||
|
@ -498,7 +500,7 @@ class Album extends database_object
|
||||||
foreach ($songs as $song_id) {
|
foreach ($songs as $song_id) {
|
||||||
Song::update_artist($artist,$song_id);
|
Song::update_artist($artist,$song_id);
|
||||||
}
|
}
|
||||||
$updated = 1;
|
$updated = true;
|
||||||
Artist::gc();
|
Artist::gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,11 +512,11 @@ class Album extends database_object
|
||||||
Song::update_year($year,$song_id);
|
Song::update_year($year,$song_id);
|
||||||
}
|
}
|
||||||
$current_id = $album_id;
|
$current_id = $album_id;
|
||||||
$updated = 1;
|
$updated = true;
|
||||||
self::gc();
|
self::gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($updated) {
|
if ($updated && is_array($songs)) {
|
||||||
foreach ($songs as $song_id) {
|
foreach ($songs as $song_id) {
|
||||||
Song::update_utime($song_id);
|
Song::update_utime($song_id);
|
||||||
} // foreach song of album
|
} // foreach song of album
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
*/
|
*/
|
||||||
class AmpConfig
|
class AmpConfig
|
||||||
{
|
{
|
||||||
private $_local = array();
|
|
||||||
private static $_global = array();
|
private static $_global = array();
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
|
|
@ -135,10 +135,8 @@ class Art extends database_object
|
||||||
case 'video':
|
case 'video':
|
||||||
case 'user':
|
case 'user':
|
||||||
return $type;
|
return $type;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return 'album';
|
return 'album';
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // validate_type
|
} // validate_type
|
||||||
|
@ -278,7 +276,7 @@ class Art extends database_object
|
||||||
|
|
||||||
// Insert it!
|
// Insert it!
|
||||||
$sql = "INSERT INTO `image` (`image`, `mime`, `size`, `object_type`, `object_id`) VALUES('$image', '$mime', 'original', '$type', '$uid')";
|
$sql = "INSERT INTO `image` (`image`, `mime`, `size`, `object_type`, `object_id`) VALUES('$image', '$mime', 'original', '$type', '$uid')";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -291,8 +289,7 @@ class Art extends database_object
|
||||||
public function reset()
|
public function reset()
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM `image` WHERE `object_id` = ? AND `object_type` = ?";
|
$sql = "DELETE FROM `image` WHERE `object_id` = ? AND `object_type` = ?";
|
||||||
$db_results = Dba::write($sql, array($this->uid, $this->type));
|
Dba::write($sql, array($this->uid, $this->type));
|
||||||
|
|
||||||
} // reset
|
} // reset
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -317,8 +314,7 @@ class Art extends database_object
|
||||||
$db_results = Dba::write($sql);
|
$db_results = Dba::write($sql);
|
||||||
|
|
||||||
$sql = "INSERT INTO `image` (`image`, `mime`, `size`, `object_type`, `object_id`) VALUES('$source', '$mime', '$size', '$type', '$uid')";
|
$sql = "INSERT INTO `image` (`image`, `mime`, `size`, `object_type`, `object_id`) VALUES('$source', '$mime', '$size', '$type', '$uid')";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
} // save_thumb
|
} // save_thumb
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -424,13 +420,17 @@ class Art extends database_object
|
||||||
break;
|
break;
|
||||||
// Turn bmps into pngs
|
// Turn bmps into pngs
|
||||||
case 'bmp':
|
case 'bmp':
|
||||||
$type = 'png';
|
|
||||||
case 'png':
|
case 'png':
|
||||||
imagepng($thumbnail);
|
imagepng($thumbnail);
|
||||||
$mime_type = image_type_to_mime_type(IMAGETYPE_PNG);
|
$mime_type = image_type_to_mime_type(IMAGETYPE_PNG);
|
||||||
break;
|
break;
|
||||||
} // resized
|
} // resized
|
||||||
|
|
||||||
|
if (!isset($mime_type)) {
|
||||||
|
debug_event('Art', 'Eror: No mime type found.', 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$data = ob_get_contents();
|
$data = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
|
@ -533,13 +533,9 @@ class Art extends database_object
|
||||||
$row = parent::get_from_cache('art', $key . 'original');
|
$row = parent::get_from_cache('art', $key . 'original');
|
||||||
$thumb_mime = $row['mime'];
|
$thumb_mime = $row['mime'];
|
||||||
}
|
}
|
||||||
if (!$mime && !$thumb_mime) {
|
if (!isset($mime) && !isset($thumb_mime)) {
|
||||||
|
$sql = "SELECT `object_type`, `object_id`, `mime`, `size` FROM `image` WHERE `object_type` = ? AND `object_id` = ?";
|
||||||
$type = Dba::escape($type);
|
$db_results = Dba::read($sql, array($type, $uid));
|
||||||
$uid = Dba::escape($uid);
|
|
||||||
|
|
||||||
$sql = "SELECT `object_type`, `object_id`, `mime`, `size` FROM `image` WHERE `object_type`='$type' AND `object_id`='$uid'";
|
|
||||||
$db_results = Dba::read($sql);
|
|
||||||
|
|
||||||
while ($row = Dba::fetch_assoc($db_results)) {
|
while ($row = Dba::fetch_assoc($db_results)) {
|
||||||
parent::add_to_cache('art', $key . $row['size'], $row);
|
parent::add_to_cache('art', $key . $row['size'], $row);
|
||||||
|
@ -551,7 +547,7 @@ class Art extends database_object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$mime = $thumb_mime ? $thumb_mime : $mime;
|
$mime = isset($thumb_mime) ? $thumb_mime : $mime;
|
||||||
$extension = self::extension($mime);
|
$extension = self::extension($mime);
|
||||||
|
|
||||||
$name = 'art.' . $extension;
|
$name = 'art.' . $extension;
|
||||||
|
@ -573,7 +569,7 @@ class Art extends database_object
|
||||||
$type . "` ON `" . $type . "`.`id`=" .
|
$type . "` ON `" . $type . "`.`id`=" .
|
||||||
"`image`.`object_id` WHERE `object_type`='" .
|
"`image`.`object_id` WHERE `object_type`='" .
|
||||||
$type . "' AND `" . $type . "`.`id` IS NULL";
|
$type . "' AND `" . $type . "`.`id` IS NULL";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
} // foreach
|
} // foreach
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,9 +587,8 @@ class Art extends database_object
|
||||||
$allowed_methods = array('db','lastfm','folder','amazon','google','musicbrainz','tags');
|
$allowed_methods = array('db','lastfm','folder','amazon','google','musicbrainz','tags');
|
||||||
break;
|
break;
|
||||||
case 'artist':
|
case 'artist':
|
||||||
$allowed_methods = array();
|
|
||||||
break;
|
|
||||||
case 'video':
|
case 'video':
|
||||||
|
default:
|
||||||
$allowed_methods = array();
|
$allowed_methods = array();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -614,8 +609,6 @@ class Art extends database_object
|
||||||
|
|
||||||
foreach ($config as $method) {
|
foreach ($config as $method) {
|
||||||
|
|
||||||
$data = array();
|
|
||||||
|
|
||||||
if (!in_array($method, $allowed_methods)) {
|
if (!in_array($method, $allowed_methods)) {
|
||||||
debug_event('Art', "$method not in allowed_methods, skipping", 3);
|
debug_event('Art', "$method not in allowed_methods, skipping", 3);
|
||||||
continue;
|
continue;
|
||||||
|
@ -844,13 +837,19 @@ class Art extends database_object
|
||||||
'SmallImage'
|
'SmallImage'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($this->type == 'album') {
|
||||||
|
$album = new Album($this->uid);
|
||||||
|
} else {
|
||||||
|
return $images;
|
||||||
|
}
|
||||||
|
|
||||||
// Prevent the script from timing out
|
// Prevent the script from timing out
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
if (empty($keywords)) {
|
if (empty($keywords)) {
|
||||||
$keywords = $this->full_name;
|
$keywords = $album->full_name;
|
||||||
/* If this isn't a various album combine with artist name */
|
/* If this isn't a various album combine with artist name */
|
||||||
if ($this->artist_count == '1') { $keywords .= ' ' . $this->artist_name; }
|
if ($album->artist_count == '1') { $keywords .= ' ' . $album->artist_name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attempt to retrieve the album art order */
|
/* Attempt to retrieve the album art order */
|
||||||
|
@ -879,11 +878,9 @@ class Art extends database_object
|
||||||
|
|
||||||
/* Set up the needed variables */
|
/* Set up the needed variables */
|
||||||
$max_pages_to_search = max(AmpConfig::get('max_amazon_results_pages'),$amazon->_default_results_pages);
|
$max_pages_to_search = max(AmpConfig::get('max_amazon_results_pages'),$amazon->_default_results_pages);
|
||||||
$pages_to_search = $max_pages_to_search; //init to max until we know better.
|
|
||||||
// while we have pages to search
|
// while we have pages to search
|
||||||
do {
|
do {
|
||||||
$raw_results = $amazon->search(array('artist'=>$artist,'album'=>$albumname,'keywords'=>$keywords));
|
$raw_results = $amazon->search(array('artist'=>'', 'album'=>'', 'keywords'=>$keywords));
|
||||||
|
|
||||||
$total = count($raw_results) + count($search_results);
|
$total = count($raw_results) + count($search_results);
|
||||||
|
|
||||||
// If we've gotten more then we wanted
|
// If we've gotten more then we wanted
|
||||||
|
@ -922,9 +919,11 @@ class Art extends database_object
|
||||||
/* Foreach through what we've found */
|
/* Foreach through what we've found */
|
||||||
foreach ($final_results as $result) {
|
foreach ($final_results as $result) {
|
||||||
|
|
||||||
|
$key = '';
|
||||||
/* Recurse through the images found */
|
/* Recurse through the images found */
|
||||||
foreach ($possible_keys as $key) {
|
foreach ($possible_keys as $k) {
|
||||||
if (strlen($result[$key])) {
|
if (strlen($result[$k])) {
|
||||||
|
$key = $k;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} // foreach
|
} // foreach
|
||||||
|
@ -941,6 +940,7 @@ class Art extends database_object
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data = array();
|
||||||
$data['url'] = $result[$key];
|
$data['url'] = $result[$key];
|
||||||
$data['mime'] = $mime;
|
$data['mime'] = $mime;
|
||||||
|
|
||||||
|
@ -987,7 +987,6 @@ class Art extends database_object
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($songs as $song_id) {
|
foreach ($songs as $song_id) {
|
||||||
$data = array();
|
|
||||||
$song = new Song($song_id);
|
$song = new Song($song_id);
|
||||||
$dir = dirname($song->file);
|
$dir = dirname($song->file);
|
||||||
|
|
||||||
|
@ -1165,6 +1164,7 @@ class Art extends database_object
|
||||||
*/
|
*/
|
||||||
public function gather_lastfm($limit, $options = false)
|
public function gather_lastfm($limit, $options = false)
|
||||||
{
|
{
|
||||||
|
$data = array();
|
||||||
// Create the parser object
|
// Create the parser object
|
||||||
$lastfm = new LastFMSearch();
|
$lastfm = new LastFMSearch();
|
||||||
|
|
||||||
|
@ -1180,6 +1180,9 @@ class Art extends database_object
|
||||||
$album = $media->full_name;
|
$album = $media->full_name;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return $data;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AmpConfig::get('proxy_host') AND AmpConfig::get('proxy_port')) {
|
if (AmpConfig::get('proxy_host') AND AmpConfig::get('proxy_port')) {
|
||||||
|
|
|
@ -36,6 +36,8 @@ class Artist extends database_object
|
||||||
public $catalog_id;
|
public $catalog_id;
|
||||||
public $time;
|
public $time;
|
||||||
|
|
||||||
|
public $tags;
|
||||||
|
public $f_tags;
|
||||||
public $object_cnt;
|
public $object_cnt;
|
||||||
public $f_name;
|
public $f_name;
|
||||||
public $f_full_name;
|
public $f_full_name;
|
||||||
|
@ -330,7 +332,7 @@ class Artist extends database_object
|
||||||
$this->f_time = ltrim($hours . ':' . $min . ':' . $sec,'0:');
|
$this->f_time = ltrim($hours . ':' . $min . ':' . $sec,'0:');
|
||||||
|
|
||||||
$this->tags = Tag::get_top_tags('artist', $this->id);
|
$this->tags = Tag::get_top_tags('artist', $this->id);
|
||||||
$this->f_tags = Tag::get_display($this->tags, $this->id, 'artist');
|
$this->f_tags = Tag::get_display($this->tags);
|
||||||
|
|
||||||
$this->object_cnt = $extra_info['object_cnt'];
|
$this->object_cnt = $extra_info['object_cnt'];
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ class Auth
|
||||||
*/
|
*/
|
||||||
public static function login($username, $password, $allow_ui = false)
|
public static function login($username, $password, $allow_ui = false)
|
||||||
{
|
{
|
||||||
|
$results = array();
|
||||||
foreach (AmpConfig::get('auth_methods') as $method) {
|
foreach (AmpConfig::get('auth_methods') as $method) {
|
||||||
$function_name = $method . '_auth';
|
$function_name = $method . '_auth';
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ class Broadcast extends database_object
|
||||||
$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);
|
$this->tags = Tag::get_top_tags('broadcast', $this->id);
|
||||||
$this->f_tags = Tag::get_display($this->tags, $this->id, 'broadcast');
|
$this->f_tags = Tag::get_display($this->tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_broadcast_list_sql()
|
public static function get_broadcast_list_sql()
|
||||||
|
|
|
@ -243,12 +243,12 @@ class Browse extends Query
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($box_req) {
|
if (isset($box_req)) {
|
||||||
require $box_req;
|
require $box_req;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->get_show_header()) {
|
if ($this->get_show_header()) {
|
||||||
if ($box_req) {
|
if (isset($box_req)) {
|
||||||
UI::show_box_bottom();
|
UI::show_box_bottom();
|
||||||
}
|
}
|
||||||
echo '<script type="text/javascript">';
|
echo '<script type="text/javascript">';
|
||||||
|
|
|
@ -76,10 +76,10 @@ abstract class Catalog extends database_object
|
||||||
public function uninstall()
|
public function uninstall()
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM `catalog` WHERE `catalog_type` = ?";
|
$sql = "DELETE FROM `catalog` WHERE `catalog_type` = ?";
|
||||||
$db_results = Dba::query($sql, array($this->get_type()));
|
Dba::query($sql, array($this->get_type()));
|
||||||
|
|
||||||
$sql = "DROP TABLE `catalog_" . $this->get_type() ."`";
|
$sql = "DROP TABLE `catalog_" . $this->get_type() ."`";
|
||||||
$db_results = Dba::query($sql);
|
Dba::query($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ abstract class Catalog extends database_object
|
||||||
$value = Dba::escape($value);
|
$value = Dba::escape($value);
|
||||||
|
|
||||||
$sql = "UPDATE `catalog` SET `$field`='$value' WHERE `id`='$catalog_id'";
|
$sql = "UPDATE `catalog` SET `$field`='$value' WHERE `id`='$catalog_id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ abstract class Catalog extends database_object
|
||||||
if ($include) {
|
if ($include) {
|
||||||
$sql = 'INSERT INTO `catalog` (`name`, `catalog_type`, ' .
|
$sql = 'INSERT INTO `catalog` (`name`, `catalog_type`, ' .
|
||||||
'`rename_pattern`, `sort_pattern`) VALUES (?, ?, ?, ?)';
|
'`rename_pattern`, `sort_pattern`) VALUES (?, ?, ?, ?)';
|
||||||
$db_results = Dba::write($sql, array(
|
Dba::write($sql, array(
|
||||||
$name,
|
$name,
|
||||||
$type,
|
$type,
|
||||||
$rename_pattern,
|
$rename_pattern,
|
||||||
|
@ -466,7 +466,7 @@ abstract class Catalog extends database_object
|
||||||
*
|
*
|
||||||
* This returns the current number of unique tags in the database.
|
* This returns the current number of unique tags in the database.
|
||||||
*/
|
*/
|
||||||
public static function count_tags($id = null)
|
public static function count_tags()
|
||||||
{
|
{
|
||||||
// FIXME: Ignores catalog_id
|
// FIXME: Ignores catalog_id
|
||||||
$sql = "SELECT COUNT(`id`) FROM `tag`";
|
$sql = "SELECT COUNT(`id`) FROM `tag`";
|
||||||
|
@ -573,6 +573,7 @@ abstract class Catalog extends database_object
|
||||||
$sql_where = "WHERE `song`.`catalog` IN $catlist";
|
$sql_where = "WHERE `song`.`catalog` IN $catlist";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql_limit = "";
|
||||||
if ($offset > 0 && $size > 0) {
|
if ($offset > 0 && $size > 0) {
|
||||||
$sql_limit = "LIMIT $offset, $size";
|
$sql_limit = "LIMIT $offset, $size";
|
||||||
} else if ($size > 0) {
|
} else if ($size > 0) {
|
||||||
|
@ -601,11 +602,13 @@ abstract class Catalog extends database_object
|
||||||
*/
|
*/
|
||||||
public static function get_albums_by_artist($size = 0, $offset = 0, $catalogs = null)
|
public static function get_albums_by_artist($size = 0, $offset = 0, $catalogs = null)
|
||||||
{
|
{
|
||||||
|
$sql_where = "";
|
||||||
if (is_array($catalogs) && count($catalogs)) {
|
if (is_array($catalogs) && count($catalogs)) {
|
||||||
$catlist = '(' . implode(',', $catalogs) . ')';
|
$catlist = '(' . implode(',', $catalogs) . ')';
|
||||||
$sql_where = "WHERE `song`.`catalog` IN $catlist";
|
$sql_where = "WHERE `song`.`catalog` IN $catlist";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql_limit = "";
|
||||||
if ($offset > 0 && $size > 0) {
|
if ($offset > 0 && $size > 0) {
|
||||||
$sql_limit = "LIMIT $offset, $size";
|
$sql_limit = "LIMIT $offset, $size";
|
||||||
} else if ($size > 0) {
|
} else if ($size > 0) {
|
||||||
|
@ -620,7 +623,7 @@ abstract class Catalog extends database_object
|
||||||
"LEFT JOIN `artist` ON `artist`.`id` = `song`.`artist` $sql_where GROUP BY `song`.`album` ORDER BY `artist`.`name`, `artist`.`id`, `album`.`name` $sql_limit";
|
"LEFT JOIN `artist` ON `artist`.`id` = `song`.`artist` $sql_where GROUP BY `song`.`album` ORDER BY `artist`.`name`, `artist`.`id`, `album`.`name` $sql_limit";
|
||||||
|
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
|
$results = array();
|
||||||
while ($r = Dba::fetch_assoc($db_results)) {
|
while ($r = Dba::fetch_assoc($db_results)) {
|
||||||
$results[] = $r['id'];
|
$results[] = $r['id'];
|
||||||
}
|
}
|
||||||
|
@ -771,8 +774,8 @@ abstract class Catalog extends database_object
|
||||||
$meta_file = $dir . '/desktop.ini';
|
$meta_file = $dir . '/desktop.ini';
|
||||||
$string = "[.ShellClassInfo]\nIconFile=$file\nIconIndex=0\nInfoTip=$album->full_name";
|
$string = "[.ShellClassInfo]\nIconFile=$file\nIconIndex=0\nInfoTip=$album->full_name";
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
case 'linux':
|
case 'linux':
|
||||||
|
default:
|
||||||
$meta_file = $dir . '/.directory';
|
$meta_file = $dir . '/.directory';
|
||||||
$string = "Name=$album->full_name\nIcon=$file";
|
$string = "Name=$album->full_name\nIcon=$file";
|
||||||
break;
|
break;
|
||||||
|
@ -819,7 +822,7 @@ abstract class Catalog extends database_object
|
||||||
{
|
{
|
||||||
$date = time();
|
$date = time();
|
||||||
$sql = "UPDATE `catalog` SET `last_add` = ? WHERE `id` = ?";
|
$sql = "UPDATE `catalog` SET `last_add` = ? WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($date, $this->id));
|
Dba::write($sql, array($date, $this->id));
|
||||||
|
|
||||||
} // update_last_add
|
} // update_last_add
|
||||||
|
|
||||||
|
@ -831,7 +834,7 @@ abstract class Catalog extends database_object
|
||||||
{
|
{
|
||||||
$date = time();
|
$date = time();
|
||||||
$sql = "UPDATE `catalog` SET `last_clean` = ? WHERE `id` = ?";
|
$sql = "UPDATE `catalog` SET `last_clean` = ? WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($date, $this->id));
|
Dba::write($sql, array($date, $this->id));
|
||||||
|
|
||||||
} // update_last_clean
|
} // update_last_clean
|
||||||
|
|
||||||
|
@ -843,7 +846,7 @@ abstract class Catalog extends database_object
|
||||||
{
|
{
|
||||||
$sql = "UPDATE `catalog` SET `name` = ?, `rename_pattern` = ?, `sort_pattern` = ? WHERE `id` = ?";
|
$sql = "UPDATE `catalog` SET `name` = ?, `rename_pattern` = ?, `sort_pattern` = ? WHERE `id` = ?";
|
||||||
$params = array($data['name'], $data['rename_pattern'], $data['sort_pattern'], $data['catalog_id']);
|
$params = array($data['name'], $data['rename_pattern'], $data['sort_pattern'], $data['catalog_id']);
|
||||||
$db_results = Dba::write($sql, $params);
|
Dba::write($sql, $params);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1008,7 +1011,7 @@ abstract class Catalog extends database_object
|
||||||
debug_event('update', "$song->file : differences found, updating database", 5);
|
debug_event('update', "$song->file : differences found, updating database", 5);
|
||||||
$song->update_song($song->id,$new_song);
|
$song->update_song($song->id,$new_song);
|
||||||
// Refine our reference
|
// Refine our reference
|
||||||
$song = $new_song;
|
//$song = $new_song;
|
||||||
} else {
|
} else {
|
||||||
debug_event('update', "$song->file : no differences found", 5);
|
debug_event('update', "$song->file : no differences found", 5);
|
||||||
}
|
}
|
||||||
|
@ -1183,7 +1186,6 @@ abstract class Catalog extends database_object
|
||||||
$songs[] = $results['id'];
|
$songs[] = $results['id'];
|
||||||
} else {
|
} else {
|
||||||
// Not found in absolute path, create it from relative path
|
// Not found in absolute path, create it from relative path
|
||||||
$finfo = pathinfo($file);
|
|
||||||
$file = $pinfo['dirname'] . DIRECTORY_SEPARATOR . $file;
|
$file = $pinfo['dirname'] . DIRECTORY_SEPARATOR . $file;
|
||||||
// Normalize the file path. realpath requires the files to exists.
|
// Normalize the file path. realpath requires the files to exists.
|
||||||
$file = realpath($file);
|
$file = realpath($file);
|
||||||
|
@ -1344,7 +1346,7 @@ abstract class Catalog extends database_object
|
||||||
|
|
||||||
// Next Remove the Catalog Entry it's self
|
// Next Remove the Catalog Entry it's self
|
||||||
$sql = "DELETE FROM `catalog` WHERE `id` = ?";
|
$sql = "DELETE FROM `catalog` WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($catalog_id));
|
Dba::write($sql, array($catalog_id));
|
||||||
|
|
||||||
// Run the cleaners...
|
// Run the cleaners...
|
||||||
self::gc();
|
self::gc();
|
||||||
|
|
|
@ -28,6 +28,7 @@ class Channel extends database_object
|
||||||
public $port;
|
public $port;
|
||||||
public $start_date;
|
public $start_date;
|
||||||
public $pid;
|
public $pid;
|
||||||
|
public $listeners;
|
||||||
public $peak_listeners;
|
public $peak_listeners;
|
||||||
public $object_type;
|
public $object_type;
|
||||||
public $object_id;
|
public $object_id;
|
||||||
|
@ -180,7 +181,7 @@ class Channel extends database_object
|
||||||
public function format()
|
public function format()
|
||||||
{
|
{
|
||||||
$this->tags = Tag::get_top_tags('channel', $this->id);
|
$this->tags = Tag::get_top_tags('channel', $this->id);
|
||||||
$this->f_tags = Tag::get_display($this->tags, $this->id, 'channel');
|
$this->f_tags = Tag::get_display($this->tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_target_object()
|
public function get_target_object()
|
||||||
|
@ -260,8 +261,6 @@ class Channel extends database_object
|
||||||
|
|
||||||
public function get_channel_state()
|
public function get_channel_state()
|
||||||
{
|
{
|
||||||
$state = T_("Unknown");
|
|
||||||
|
|
||||||
if ($this->check_channel()) {
|
if ($this->check_channel()) {
|
||||||
$state = T_("Running");
|
$state = T_("Running");
|
||||||
} else {
|
} else {
|
||||||
|
@ -359,7 +358,7 @@ class Channel extends database_object
|
||||||
if (feof($this->transcoder['handle'])) {
|
if (feof($this->transcoder['handle'])) {
|
||||||
$this->media->set_played();
|
$this->media->set_played();
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||||
$stderr = fread($this->transcoder['stderr'], 4096);
|
fread($this->transcoder['stderr'], 4096);
|
||||||
fclose($this->transcoder['stderr']);
|
fclose($this->transcoder['stderr']);
|
||||||
}
|
}
|
||||||
fclose($this->transcoder['handle']);
|
fclose($this->transcoder['handle']);
|
||||||
|
|
|
@ -100,8 +100,8 @@ class Core
|
||||||
debug_event('Core', "Registered $type form $name with SID $sid and expiration $expire ($window seconds from now)", 5);
|
debug_event('Core', "Registered $type form $name with SID $sid and expiration $expire ($window seconds from now)", 5);
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
default:
|
|
||||||
case 'post':
|
case 'post':
|
||||||
|
default:
|
||||||
$string = '<input type="hidden" name="form_validation" value="' . $sid . '" />';
|
$string = '<input type="hidden" name="form_validation" value="' . $sid . '" />';
|
||||||
break;
|
break;
|
||||||
case 'get':
|
case 'get':
|
||||||
|
|
|
@ -40,7 +40,6 @@ class Dba
|
||||||
|
|
||||||
private static $_sql;
|
private static $_sql;
|
||||||
private static $_error;
|
private static $_error;
|
||||||
private static $config;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
|
@ -93,12 +92,10 @@ class Dba
|
||||||
if (!$stmt) {
|
if (!$stmt) {
|
||||||
self::$_error = json_encode($dbh->errorInfo());
|
self::$_error = json_encode($dbh->errorInfo());
|
||||||
debug_event('Dba', 'Error: ' . json_encode($dbh->errorInfo()), 1);
|
debug_event('Dba', 'Error: ' . json_encode($dbh->errorInfo()), 1);
|
||||||
$dbh = null;
|
|
||||||
self::disconnect();
|
self::disconnect();
|
||||||
} else if ($stmt->errorCode() && $stmt->errorCode() != '00000') {
|
} else if ($stmt->errorCode() && $stmt->errorCode() != '00000') {
|
||||||
self::$_error = json_encode($stmt->errorInfo());
|
self::$_error = json_encode($stmt->errorInfo());
|
||||||
debug_event('Dba', 'Error: ' . json_encode($stmt->errorInfo()), 1);
|
debug_event('Dba', 'Error: ' . json_encode($stmt->errorInfo()), 1);
|
||||||
$dbh = null;
|
|
||||||
self::disconnect();
|
self::disconnect();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -458,8 +455,8 @@ class Dba
|
||||||
$target_charset = 'koi8r';
|
$target_charset = 'koi8r';
|
||||||
$target_collation = 'koi8r_general_ci';
|
$target_collation = 'koi8r_general_ci';
|
||||||
break;
|
break;
|
||||||
default;
|
|
||||||
case 'UTF-8':
|
case 'UTF-8':
|
||||||
|
default:
|
||||||
$target_charset = 'utf8';
|
$target_charset = 'utf8';
|
||||||
$target_collation = 'utf8_unicode_ci';
|
$target_collation = 'utf8_unicode_ci';
|
||||||
break;
|
break;
|
||||||
|
@ -487,7 +484,7 @@ class Dba
|
||||||
|
|
||||||
// Alter the charset for the entire database
|
// Alter the charset for the entire database
|
||||||
$sql = "ALTER DATABASE `" . AmpConfig::get('database_name') . "` DEFAULT CHARACTER SET $target_charset COLLATE $target_collation";
|
$sql = "ALTER DATABASE `" . AmpConfig::get('database_name') . "` DEFAULT CHARACTER SET $target_charset COLLATE $target_collation";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "SHOW TABLES";
|
$sql = "SHOW TABLES";
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
|
@ -499,7 +496,7 @@ class Dba
|
||||||
|
|
||||||
// Change the tables default charset and colliation
|
// Change the tables default charset and colliation
|
||||||
$sql = "ALTER TABLE `" . $row['0'] . "` DEFAULT CHARACTER SET $target_charset COLLATE $target_collation";
|
$sql = "ALTER TABLE `" . $row['0'] . "` DEFAULT CHARACTER SET $target_charset COLLATE $target_collation";
|
||||||
$alter_table = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Iterate through the columns of the table
|
// Iterate through the columns of the table
|
||||||
while ($table = Dba::fetch_assoc($describe_results)) {
|
while ($table = Dba::fetch_assoc($describe_results)) {
|
||||||
|
@ -533,10 +530,10 @@ class Dba
|
||||||
|
|
||||||
while ($row = Dba::fetch_row($db_results)) {
|
while ($row = Dba::fetch_row($db_results)) {
|
||||||
$sql = "OPTIMIZE TABLE `" . $row[0] . "`";
|
$sql = "OPTIMIZE TABLE `" . $row[0] . "`";
|
||||||
$db_results_inner = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "ANALYZE TABLE `" . $row[0] . "`";
|
$sql = "ANALYZE TABLE `" . $row[0] . "`";
|
||||||
$db_results_inner = Dba::write($sql);
|
Dba::write($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,8 +299,6 @@ class Democratic extends Tmp_Playlist
|
||||||
return $results['id'];
|
return $results['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
} // get_next_object
|
} // get_next_object
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -411,7 +409,7 @@ class Democratic extends Tmp_Playlist
|
||||||
if (!$results = Dba::fetch_assoc($db_results)) {
|
if (!$results = Dba::fetch_assoc($db_results)) {
|
||||||
$sql = "INSERT INTO `tmp_playlist_data` (`tmp_playlist`,`object_id`,`object_type`,`track`) " .
|
$sql = "INSERT INTO `tmp_playlist_data` (`tmp_playlist`,`object_id`,`object_type`,`track`) " .
|
||||||
"VALUES ('$tmp_playlist','$object_id','$object_type',$track)";
|
"VALUES ('$tmp_playlist','$object_id','$object_type',$track)";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
$results['id'] = Dba::insert_id();
|
$results['id'] = Dba::insert_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +417,7 @@ class Democratic extends Tmp_Playlist
|
||||||
$time = time();
|
$time = time();
|
||||||
$sql = "INSERT INTO user_vote (`user`,`object_id`,`date`) " .
|
$sql = "INSERT INTO user_vote (`user`,`object_id`,`date`) " .
|
||||||
"VALUES ('" . Dba::escape($GLOBALS['user']->id) . "','" . $results['id'] . "','$time')";
|
"VALUES ('" . Dba::escape($GLOBALS['user']->id) . "','" . $results['id'] . "','$time')";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -436,7 +434,7 @@ class Democratic extends Tmp_Playlist
|
||||||
$user_id = Dba::escape($GLOBALS['user']->id);
|
$user_id = Dba::escape($GLOBALS['user']->id);
|
||||||
|
|
||||||
$sql = "DELETE FROM `user_vote` WHERE `object_id`='$object_id' AND `user`='$user_id'";
|
$sql = "DELETE FROM `user_vote` WHERE `object_id`='$object_id' AND `user`='$user_id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
/* Clean up anything that has no votes */
|
/* Clean up anything that has no votes */
|
||||||
self::prune_tracks();
|
self::prune_tracks();
|
||||||
|
@ -454,10 +452,10 @@ class Democratic extends Tmp_Playlist
|
||||||
$row_id = Dba::escape($row_id);
|
$row_id = Dba::escape($row_id);
|
||||||
|
|
||||||
$sql = "DELETE FROM `user_vote` WHERE `object_id`='$row_id'";
|
$sql = "DELETE FROM `user_vote` WHERE `object_id`='$row_id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "DELETE FROM `tmp_playlist_data` WHERE `id`='$row_id'";
|
$sql = "DELETE FROM `tmp_playlist_data` WHERE `id`='$row_id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -488,10 +486,10 @@ class Democratic extends Tmp_Playlist
|
||||||
$democratic_id = Dba::escape($democratic_id);
|
$democratic_id = Dba::escape($democratic_id);
|
||||||
|
|
||||||
$sql = "DELETE FROM `democratic` WHERE `id`='$democratic_id'";
|
$sql = "DELETE FROM `democratic` WHERE `id`='$democratic_id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "DELETE FROM `tmp_playlist` WHERE `session`='$democratic_id'";
|
$sql = "DELETE FROM `tmp_playlist` WHERE `session`='$democratic_id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
self::prune_tracks();
|
self::prune_tracks();
|
||||||
|
|
||||||
|
@ -513,7 +511,7 @@ class Democratic extends Tmp_Playlist
|
||||||
$id = Dba::escape($this->id);
|
$id = Dba::escape($this->id);
|
||||||
|
|
||||||
$sql = "UPDATE `democratic` SET `name` = ?, `base_playlist` = ?,`cooldown` = ?, `primary` = ?, `level` = ? WHERE `id` = ?";
|
$sql = "UPDATE `democratic` SET `name` = ?, `base_playlist` = ?,`cooldown` = ?, `primary` = ?, `level` = ? WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($name, $base, $cool, $default, $level, $id));
|
Dba::write($sql, array($name, $base, $cool, $default, $level, $id));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -562,7 +560,7 @@ class Democratic extends Tmp_Playlist
|
||||||
"LEFT JOIN `user_vote` ON `tmp_playlist_data`.`id`=`user_vote`.`object_id` " .
|
"LEFT JOIN `user_vote` ON `tmp_playlist_data`.`id`=`user_vote`.`object_id` " .
|
||||||
"LEFT JOIN `tmp_playlist` ON `tmp_playlist`.`id`=`tmp_playlist_data`.`tmp_playlist` " .
|
"LEFT JOIN `tmp_playlist` ON `tmp_playlist`.`id`=`tmp_playlist_data`.`tmp_playlist` " .
|
||||||
"WHERE `user_vote`.`object_id` IS NULL AND `tmp_playlist`.`type` = 'vote'";
|
"WHERE `user_vote`.`object_id` IS NULL AND `tmp_playlist`.`type` = 'vote'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -581,7 +579,7 @@ class Democratic extends Tmp_Playlist
|
||||||
$sql = "DELETE FROM `user_vote` USING `user_vote` " .
|
$sql = "DELETE FROM `user_vote` USING `user_vote` " .
|
||||||
"LEFT JOIN `tmp_playlist_data` ON `user_vote`.`object_id` = `tmp_playlist_data`.`id` " .
|
"LEFT JOIN `tmp_playlist_data` ON `user_vote`.`object_id` = `tmp_playlist_data`.`id` " .
|
||||||
"WHERE `tmp_playlist_data`.`tmp_playlist`='$tmp_id'";
|
"WHERE `tmp_playlist_data`.`tmp_playlist`='$tmp_id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Prune!
|
// Prune!
|
||||||
self::prune_tracks();
|
self::prune_tracks();
|
||||||
|
@ -602,7 +600,7 @@ class Democratic extends Tmp_Playlist
|
||||||
$sql = "DELETE FROM `user_vote` USING `user_vote` " .
|
$sql = "DELETE FROM `user_vote` USING `user_vote` " .
|
||||||
"LEFT JOIN `tmp_playlist_data` ON `user_vote`.`object_id`=`tmp_playlist_data`.`id` " .
|
"LEFT JOIN `tmp_playlist_data` ON `user_vote`.`object_id`=`tmp_playlist_data`.`id` " .
|
||||||
"WHERE `tmp_playlist_data`.`id` IS NULL";
|
"WHERE `tmp_playlist_data`.`id` IS NULL";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,11 @@ class Localplay
|
||||||
/* Base Variables */
|
/* Base Variables */
|
||||||
public $type;
|
public $type;
|
||||||
|
|
||||||
|
public $f_name;
|
||||||
|
public $f_description;
|
||||||
|
public $f_version;
|
||||||
|
|
||||||
/* Built Variables */
|
/* Built Variables */
|
||||||
private $_template;
|
|
||||||
private $_preferences = array();
|
|
||||||
private $_player;
|
private $_player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -625,16 +627,12 @@ class Localplay
|
||||||
switch ($state) {
|
switch ($state) {
|
||||||
case 'play':
|
case 'play':
|
||||||
return T_('Now Playing');
|
return T_('Now Playing');
|
||||||
break;
|
|
||||||
case 'stop':
|
case 'stop':
|
||||||
return T_('Stopped');
|
return T_('Stopped');
|
||||||
break;
|
|
||||||
case 'pause':
|
case 'pause':
|
||||||
return T_('Paused');
|
return T_('Paused');
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return T_('Unknown');
|
return T_('Unknown');
|
||||||
break;
|
|
||||||
} // switch on state
|
} // switch on state
|
||||||
|
|
||||||
} // get_user_state
|
} // get_user_state
|
||||||
|
|
|
@ -92,6 +92,7 @@ abstract class localplay_controller
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
$variables = parse_url($url,PHP_URL_QUERY);
|
$variables = parse_url($url,PHP_URL_QUERY);
|
||||||
|
if ($variables) {
|
||||||
parse_str($variables,$data);
|
parse_str($variables,$data);
|
||||||
|
|
||||||
foreach ($primary_array as $pkey) {
|
foreach ($primary_array as $pkey) {
|
||||||
|
@ -101,6 +102,7 @@ abstract class localplay_controller
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end foreach
|
} // end foreach
|
||||||
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,8 @@ class Mailer
|
||||||
public static function get_users($filter)
|
public static function get_users($filter)
|
||||||
{
|
{
|
||||||
switch ($filter) {
|
switch ($filter) {
|
||||||
default:
|
|
||||||
case 'all':
|
case 'all':
|
||||||
|
default:
|
||||||
$sql = "SELECT * FROM `user` WHERE `email` IS NOT NULL";
|
$sql = "SELECT * FROM `user` WHERE `email` IS NOT NULL";
|
||||||
break;
|
break;
|
||||||
case 'users':
|
case 'users':
|
||||||
|
@ -120,15 +120,6 @@ class Mailer
|
||||||
|
|
||||||
} // get_users
|
} // get_users
|
||||||
|
|
||||||
/**
|
|
||||||
* add_statistics
|
|
||||||
* This should be run if we want to add some statistics to this e-mail,
|
|
||||||
* appends to self::$message
|
|
||||||
*/
|
|
||||||
public function add_statistics($methods)
|
|
||||||
{
|
|
||||||
} // add_statistics
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* send
|
* send
|
||||||
* This actually sends the mail, how amazing
|
* This actually sends the mail, how amazing
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Openid
|
||||||
if (strpos(PHP_OS, 'WIN') === 0) {
|
if (strpos(PHP_OS, 'WIN') === 0) {
|
||||||
$store_path = $_ENV['TMP'];
|
$store_path = $_ENV['TMP'];
|
||||||
if (!isset($store_path)) {
|
if (!isset($store_path)) {
|
||||||
$dir = 'C:\Windows\Temp';
|
$store_path = 'C:\Windows\Temp';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$store_path = @$_ENV['TMPDIR'];
|
$store_path = @$_ENV['TMPDIR'];
|
||||||
|
@ -67,6 +67,7 @@ class Openid
|
||||||
|
|
||||||
public static function get_consumer()
|
public static function get_consumer()
|
||||||
{
|
{
|
||||||
|
$consumer = null;
|
||||||
$store = self::get_store();
|
$store = self::get_store();
|
||||||
if ($store) {
|
if ($store) {
|
||||||
$consumer = new Auth_OpenID_Consumer($store);
|
$consumer = new Auth_OpenID_Consumer($store);
|
||||||
|
@ -76,7 +77,7 @@ class Openid
|
||||||
|
|
||||||
public static function get_return_url()
|
public static function get_return_url()
|
||||||
{
|
{
|
||||||
return $return_to = AmpConfig::get('web_path') . '/login.php?auth_mod=openid&step=2';
|
return AmpConfig::get('web_path') . '/login.php?auth_mod=openid&step=2';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_policies()
|
public static function get_policies()
|
||||||
|
|
|
@ -33,6 +33,9 @@ class Playlist extends playlist_object
|
||||||
public $genre;
|
public $genre;
|
||||||
public $date;
|
public $date;
|
||||||
|
|
||||||
|
public $f_link;
|
||||||
|
public $f_name_link;
|
||||||
|
|
||||||
/* Generated Elements */
|
/* Generated Elements */
|
||||||
public $items = array();
|
public $items = array();
|
||||||
|
|
||||||
|
@ -129,7 +132,7 @@ class Playlist extends playlist_object
|
||||||
public function get_track($track_id)
|
public function get_track($track_id)
|
||||||
{
|
{
|
||||||
$sql = "SELECT * FROM `playlist_data` WHERE `id` = ? AND `playlist` = ?";
|
$sql = "SELECT * FROM `playlist_data` WHERE `id` = ? AND `playlist` = ?";
|
||||||
$db_results = Dba::read($sql, array($track_id, $playlist_id));
|
$db_results = Dba::read($sql, array($track_id, $this->id));
|
||||||
|
|
||||||
$row = Dba::fetch_assoc($db_results);
|
$row = Dba::fetch_assoc($db_results);
|
||||||
|
|
||||||
|
@ -202,13 +205,7 @@ class Playlist extends playlist_object
|
||||||
$db_results = Dba::read($sql, array($this->id));
|
$db_results = Dba::read($sql, array($this->id));
|
||||||
|
|
||||||
while ($r = Dba::fetch_assoc($db_results)) {
|
while ($r = Dba::fetch_assoc($db_results)) {
|
||||||
if ($r['dyn_song']) {
|
|
||||||
$array = $this->get_dyn_songs($r['dyn_song']);
|
|
||||||
$results = array_merge($array,$results);
|
|
||||||
} else {
|
|
||||||
$results[] = $r['object_id'];
|
$results[] = $r['object_id'];
|
||||||
}
|
|
||||||
|
|
||||||
} // end while
|
} // end while
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
|
@ -332,15 +329,13 @@ class Playlist extends playlist_object
|
||||||
public function update_track_number($track_id, $index)
|
public function update_track_number($track_id, $index)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE `playlist_data` SET `track` = ? WHERE `id` = ?";
|
$sql = "UPDATE `playlist_data` SET `track` = ? WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($index, $track_id));
|
Dba::write($sql, array($index, $track_id));
|
||||||
|
|
||||||
} // update_track_number
|
} // update_track_number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add_songs
|
* add_songs
|
||||||
* This takes an array of song_ids and then adds it to the playlist
|
* This takes an array of song_ids and then adds it to the playlist
|
||||||
* if you want to add a dyn_song you need to use the one shot function
|
|
||||||
* add_dyn_song
|
|
||||||
*/
|
*/
|
||||||
public function add_songs($song_ids=array(),$ordered=false)
|
public function add_songs($song_ids=array(),$ordered=false)
|
||||||
{
|
{
|
||||||
|
@ -354,6 +349,7 @@ class Playlist extends playlist_object
|
||||||
$base_track = $data['track'];
|
$base_track = $data['track'];
|
||||||
debug_event('add_songs', 'Track number: '.$base_track, '5');
|
debug_event('add_songs', 'Track number: '.$base_track, '5');
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
foreach ($song_ids as $song_id) {
|
foreach ($song_ids as $song_id) {
|
||||||
/* We need the songs track */
|
/* We need the songs track */
|
||||||
$song = new Song($song_id);
|
$song = new Song($song_id);
|
||||||
|
@ -370,7 +366,7 @@ class Playlist extends playlist_object
|
||||||
if ($song->id) {
|
if ($song->id) {
|
||||||
$sql = "INSERT INTO `playlist_data` (`playlist`,`object_id`,`object_type`,`track`) " .
|
$sql = "INSERT INTO `playlist_data` (`playlist`,`object_id`,`object_type`,`track`) " .
|
||||||
" VALUES (?, ?, 'song', ?)";
|
" VALUES (?, ?, 'song', ?)";
|
||||||
$db_results = Dba::write($sql, array($this->id, $song->id, $track));
|
Dba::write($sql, array($this->id, $song->id, $track));
|
||||||
} // if valid id
|
} // if valid id
|
||||||
|
|
||||||
} // end foreach songs
|
} // end foreach songs
|
||||||
|
@ -385,10 +381,9 @@ class Playlist extends playlist_object
|
||||||
public static function create($name,$type)
|
public static function create($name,$type)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO `playlist` (`name`,`user`,`type`,`date`) VALUES (?, ?, ?, ?)";
|
$sql = "INSERT INTO `playlist` (`name`,`user`,`type`,`date`) VALUES (?, ?, ?, ?)";
|
||||||
$db_results = Dba::write($sql, array($name, $GLOBALS['user']->id, $type, time()));
|
Dba::write($sql, array($name, $GLOBALS['user']->id, $type, time()));
|
||||||
|
|
||||||
$insert_id = Dba::insert_id();
|
$insert_id = Dba::insert_id();
|
||||||
|
|
||||||
return $insert_id;
|
return $insert_id;
|
||||||
|
|
||||||
} // create
|
} // create
|
||||||
|
@ -410,7 +405,7 @@ class Playlist extends playlist_object
|
||||||
public function delete_track($id)
|
public function delete_track($id)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM `playlist_data` WHERE `playlist_data`.`playlist` = ? AND `playlist_data`.`id` = ? LIMIT 1";
|
$sql = "DELETE FROM `playlist_data` WHERE `playlist_data`.`playlist` = ? AND `playlist_data`.`id` = ? LIMIT 1";
|
||||||
$db_results = Dba::write($sql, array($this->id, $id));
|
Dba::write($sql, array($this->id, $id));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -423,7 +418,7 @@ class Playlist extends playlist_object
|
||||||
public function delete_track_number($track)
|
public function delete_track_number($track)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM `playlist_data` WHERE `playlist_data`.`playlist` = ? AND `playlist_data`.`track` = ? LIMIT 1";
|
$sql = "DELETE FROM `playlist_data` WHERE `playlist_data`.`playlist` = ? AND `playlist_data`.`track` = ? LIMIT 1";
|
||||||
$db_results = Dba::write($sql, array($this->id, $track));
|
Dba::write($sql, array($this->id, $track));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -436,13 +431,13 @@ class Playlist extends playlist_object
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM `playlist_data` WHERE `playlist` = ?";
|
$sql = "DELETE FROM `playlist_data` WHERE `playlist` = ?";
|
||||||
$db_results = Dba::write($sql, array($this->id));
|
Dba::write($sql, array($this->id));
|
||||||
|
|
||||||
$sql = "DELETE FROM `playlist` WHERE `id` = ?";
|
$sql = "DELETE FROM `playlist` WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($this->id));
|
Dba::write($sql, array($this->id));
|
||||||
|
|
||||||
$sql = "DELETE FROM `object_count` WHERE `object_type`='playlist' AND `object_id` = ?";
|
$sql = "DELETE FROM `object_count` WHERE `object_type`='playlist' AND `object_id` = ?";
|
||||||
$db_results = Dba::write($sql, array($this->id));
|
Dba::write($sql, array($this->id));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,10 @@ abstract class playlist_object extends database_object
|
||||||
public $user;
|
public $user;
|
||||||
public $type;
|
public $type;
|
||||||
|
|
||||||
|
public $f_type;
|
||||||
|
public $f_name;
|
||||||
|
public $f_user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* format
|
* format
|
||||||
* This takes the current playlist object and gussies it up a little
|
* This takes the current playlist object and gussies it up a little
|
||||||
|
@ -64,8 +68,6 @@ abstract class playlist_object extends database_object
|
||||||
return Access::check('interface','100');
|
return Access::check('interface','100');
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} // has_access
|
} // has_access
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -596,7 +596,7 @@ class Plex_Api
|
||||||
} elseif ($view == "albums") {
|
} elseif ($view == "albums") {
|
||||||
Plex_XML_Data::setSectionAlbums($r, $catalog);
|
Plex_XML_Data::setSectionAlbums($r, $catalog);
|
||||||
} elseif ($view == "recentlyadded") {
|
} elseif ($view == "recentlyadded") {
|
||||||
Plex_XML_Data::setCustomSectionView($r, $catalog, Stats::get_recent('album', 25, 0, $key));
|
Plex_XML_Data::setCustomSectionView($r, $catalog, Stats::get_recent('album', 25, $key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -945,7 +945,7 @@ class Plex_Api
|
||||||
$robj = new Rating(Plex_XML_Data::getAmpacheId($id), "artist");
|
$robj = new Rating(Plex_XML_Data::getAmpacheId($id), "artist");
|
||||||
} else if (Plex_XML_Data::isAlbum($id)) {
|
} else if (Plex_XML_Data::isAlbum($id)) {
|
||||||
$robj = new Rating(Plex_XML_Data::getAmpacheId($id), "album");
|
$robj = new Rating(Plex_XML_Data::getAmpacheId($id), "album");
|
||||||
} else if (Plex_XML_Data::isSong($id)) {
|
} else if (Plex_XML_Data::isTrack($id)) {
|
||||||
$robj = new Rating(Plex_XML_Data::getAmpacheId($id), "song");
|
$robj = new Rating(Plex_XML_Data::getAmpacheId($id), "song");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,20 +169,6 @@ class Plex_XML_Data
|
||||||
return AmpConfig::get('myplex_published');
|
return AmpConfig::get('myplex_published');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createFailedResponse($version = "")
|
|
||||||
{
|
|
||||||
$response = self::createResponse($version);
|
|
||||||
$response->addAttribute('status', 'failed');
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function createSuccessResponse($version = "")
|
|
||||||
{
|
|
||||||
$response = self::createResponse($version);
|
|
||||||
$response->addAttribute('status', 'ok');
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function createContainer()
|
public static function createContainer()
|
||||||
{
|
{
|
||||||
$response = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><MediaContainer/>');
|
$response = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><MediaContainer/>');
|
||||||
|
@ -651,12 +637,14 @@ class Plex_XML_Data
|
||||||
self::addArtistMeta($xdir, $artist);
|
self::addArtistMeta($xdir, $artist);
|
||||||
|
|
||||||
$tags = Tag::get_top_tags('artist', $artist->id);
|
$tags = Tag::get_top_tags('artist', $artist->id);
|
||||||
|
if (is_array($tags)) {
|
||||||
foreach ($tags as $tag_id=>$value) {
|
foreach ($tags as $tag_id=>$value) {
|
||||||
$tag = new Tag($tag_id);
|
$tag = new Tag($tag_id);
|
||||||
$xgenre = $xdir->addChild('Genre');
|
$xgenre = $xdir->addChild('Genre');
|
||||||
$xgenre->addAttribute('tag', $tag->name);
|
$xgenre->addAttribute('tag', $tag->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function addArtistMeta($xml, $artist)
|
public static function addArtistMeta($xml, $artist)
|
||||||
{
|
{
|
||||||
|
@ -703,12 +691,14 @@ class Plex_XML_Data
|
||||||
}
|
}
|
||||||
|
|
||||||
$tags = Tag::get_top_tags('album', $album->id);
|
$tags = Tag::get_top_tags('album', $album->id);
|
||||||
|
if (is_array($tags)) {
|
||||||
foreach ($tags as $tag_id=>$value) {
|
foreach ($tags as $tag_id=>$value) {
|
||||||
$tag = new Tag($tag_id);
|
$tag = new Tag($tag_id);
|
||||||
$xgenre = $xdir->addChild('Genre');
|
$xgenre = $xdir->addChild('Genre');
|
||||||
$xgenre->addAttribute('tag', $tag->name);
|
$xgenre->addAttribute('tag', $tag->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function addAlbumMeta($xml, $album)
|
public static function addAlbumMeta($xml, $album)
|
||||||
{
|
{
|
||||||
|
@ -789,6 +779,7 @@ class Plex_XML_Data
|
||||||
$time = $song->time * 1000;
|
$time = $song->time * 1000;
|
||||||
$xdir->addAttribute('title', $song->title);
|
$xdir->addAttribute('title', $song->title);
|
||||||
$albumid = self::getAlbumId($song->album);
|
$albumid = self::getAlbumId($song->album);
|
||||||
|
$album = new Album($song->album);
|
||||||
$xdir->addAttribute('parentRatingKey', $albumid);
|
$xdir->addAttribute('parentRatingKey', $albumid);
|
||||||
$xdir->addAttribute('parentKey', self::getMetadataUri($albumid));
|
$xdir->addAttribute('parentKey', self::getMetadataUri($albumid));
|
||||||
$xdir->addAttribute('originalTitle', $album->f_artist_full);
|
$xdir->addAttribute('originalTitle', $album->f_artist_full);
|
||||||
|
@ -831,7 +822,7 @@ class Plex_XML_Data
|
||||||
$xml->addAttribute('ratingKey', $id);
|
$xml->addAttribute('ratingKey', $id);
|
||||||
$xml->addAttribute('key', self::getMetadataUri($id));
|
$xml->addAttribute('key', self::getMetadataUri($id));
|
||||||
|
|
||||||
return $xsong;
|
return $xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createMyPlexAccount()
|
public static function createMyPlexAccount()
|
||||||
|
|
|
@ -272,7 +272,7 @@ class Plugin
|
||||||
$version = Dba::escape($version);
|
$version = Dba::escape($version);
|
||||||
|
|
||||||
$sql = "REPLACE INTO `update_info` SET `key`='$name', `value`='$version'";
|
$sql = "REPLACE INTO `update_info` SET `key`='$name', `value`='$version'";
|
||||||
$db_results = Dba::read($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ class Plugin
|
||||||
$name = Dba::escape('Plugin_' . $this->_plugin->name);
|
$name = Dba::escape('Plugin_' . $this->_plugin->name);
|
||||||
|
|
||||||
$sql = "DELETE FROM `update_info` WHERE `key`='$name'";
|
$sql = "DELETE FROM `update_info` WHERE `key`='$name'";
|
||||||
$db_results = Dba::read($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ class Preference extends database_object
|
||||||
|
|
||||||
if ($applytodefault AND Access::check('interface', '100')) {
|
if ($applytodefault AND Access::check('interface', '100')) {
|
||||||
$sql = "UPDATE `preference` SET `value`='$value' WHERE `id`='$id'";
|
$sql = "UPDATE `preference` SET `value`='$value' WHERE `id`='$id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = Dba::escape($value);
|
$value = Dba::escape($value);
|
||||||
|
@ -95,10 +95,10 @@ class Preference extends database_object
|
||||||
if (self::has_access($name)) {
|
if (self::has_access($name)) {
|
||||||
$user_id = Dba::escape($user_id);
|
$user_id = Dba::escape($user_id);
|
||||||
$sql = "UPDATE `user_preference` SET `value`='$value' WHERE `preference`='$id'$user_check";
|
$sql = "UPDATE `user_preference` SET `value`='$value' WHERE `preference`='$id'$user_check";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
Preference::clear_from_session();
|
Preference::clear_from_session();
|
||||||
|
|
||||||
parent::remove_from_cache('get_by_user', user_id);
|
parent::remove_from_cache('get_by_user', $user_id);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -125,7 +125,7 @@ class Preference extends database_object
|
||||||
$level = Dba::escape($level);
|
$level = Dba::escape($level);
|
||||||
|
|
||||||
$sql = "UPDATE `preference` SET `level`='$level' WHERE `id`='$preference_id'";
|
$sql = "UPDATE `preference` SET `level`='$level' WHERE `id`='$preference_id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class Preference extends database_object
|
||||||
$value = Dba::escape($value);
|
$value = Dba::escape($value);
|
||||||
|
|
||||||
$sql = "UPDATE `user_preference` SET `value`='$value' WHERE `preference`='$preference_id'";
|
$sql = "UPDATE `user_preference` SET `value`='$value' WHERE `preference`='$preference_id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
parent::clear_cache();
|
parent::clear_cache();
|
||||||
|
|
||||||
|
@ -258,6 +258,7 @@ class Preference extends database_object
|
||||||
{
|
{
|
||||||
$user_id = Dba::escape($user_id);
|
$user_id = Dba::escape($user_id);
|
||||||
|
|
||||||
|
$user_limit = "";
|
||||||
if ($user_id != '-1') {
|
if ($user_id != '-1') {
|
||||||
$user_limit = "AND `preference`.`catagory` != 'system'";
|
$user_limit = "AND `preference`.`catagory` != 'system'";
|
||||||
}
|
}
|
||||||
|
@ -318,7 +319,7 @@ class Preference extends database_object
|
||||||
$sql = "DELETE FROM `preference` WHERE `id`='$id'";
|
$sql = "DELETE FROM `preference` WHERE `id`='$id'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
self::rebuild_preferences();
|
self::rebuild_preferences();
|
||||||
|
|
||||||
|
@ -334,7 +335,7 @@ class Preference extends database_object
|
||||||
$new = Dba::escape($new);
|
$new = Dba::escape($new);
|
||||||
|
|
||||||
$sql = "UPDATE `preference` SET `name`='$new' WHERE `name`='$old'";
|
$sql = "UPDATE `preference` SET `name`='$new' WHERE `name`='$old'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -346,10 +347,10 @@ class Preference extends database_object
|
||||||
// First remove garbage
|
// First remove garbage
|
||||||
$sql = "DELETE FROM `user_preference` USING `user_preference` LEFT JOIN `preference` ON `preference`.`id`=`user_preference`.`preference` " .
|
$sql = "DELETE FROM `user_preference` USING `user_preference` LEFT JOIN `preference` ON `preference`.`id`=`user_preference`.`preference` " .
|
||||||
"WHERE `preference`.`id` IS NULL";
|
"WHERE `preference`.`id` IS NULL";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Now add anything that we are missing back in, except System
|
// Now add anything that we are missing back in, except System
|
||||||
$sql = "SELECT * FROM `preference` WHERE `type`!='system'";
|
//$sql = "SELECT * FROM `preference` WHERE `type`!='system'";
|
||||||
//FIXME: Uhh WTF shouldn't there be something here??
|
//FIXME: Uhh WTF shouldn't there be something here??
|
||||||
|
|
||||||
} // rebuild_preferences
|
} // rebuild_preferences
|
||||||
|
@ -457,6 +458,7 @@ class Preference extends database_object
|
||||||
"LEFT JOIN `user_preference` ON `user_preference`.`preference`=`preference`.`id` AND `user_preference`.`user`='$user_id' AND `preference`.`catagory`!='system'";
|
"LEFT JOIN `user_preference` ON `user_preference`.`preference`=`preference`.`id` AND `user_preference`.`user`='$user_id' AND `preference`.`catagory`!='system'";
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
|
|
||||||
|
$results = array();
|
||||||
while ($row = Dba::fetch_assoc($db_results)) {
|
while ($row = Dba::fetch_assoc($db_results)) {
|
||||||
$value = $row['system_value'] ? $row['system_value'] : $row['value'];
|
$value = $row['system_value'] ? $row['system_value'] : $row['value'];
|
||||||
$name = $row['name'];
|
$name = $row['name'];
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Query
|
||||||
|
|
||||||
$sql = 'INSERT INTO `tmp_browse` (`sid`, `data`) ' .
|
$sql = 'INSERT INTO `tmp_browse` (`sid`, `data`) ' .
|
||||||
'VALUES(?, ?)';
|
'VALUES(?, ?)';
|
||||||
$db_results = Dba::write($sql, array($sid, $data));
|
Dba::write($sql, array($sid, $data));
|
||||||
$this->id = Dba::insert_id();
|
$this->id = Dba::insert_id();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -277,7 +277,7 @@ class Query
|
||||||
$sql = 'DELETE FROM `tmp_browse` USING `tmp_browse` LEFT JOIN ' .
|
$sql = 'DELETE FROM `tmp_browse` USING `tmp_browse` LEFT JOIN ' .
|
||||||
'`session` ON `session`.`id` = `tmp_browse`.`sid` ' .
|
'`session` ON `session`.`id` = `tmp_browse`.`sid` ' .
|
||||||
'WHERE `session`.`id` IS NULL';
|
'WHERE `session`.`id` IS NULL';
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -390,7 +390,6 @@ class Query
|
||||||
default:
|
default:
|
||||||
// Rien a faire
|
// Rien a faire
|
||||||
return false;
|
return false;
|
||||||
break;
|
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
// If we've set a filter we need to reset the totals
|
// If we've set a filter we need to reset the totals
|
||||||
|
@ -1049,6 +1048,10 @@ class Query
|
||||||
{
|
{
|
||||||
$sql = $this->get_base_sql();
|
$sql = $this->get_base_sql();
|
||||||
|
|
||||||
|
$filter_sql = "";
|
||||||
|
$join_sql = "";
|
||||||
|
$having_sql = "";
|
||||||
|
$order_sql = "";
|
||||||
if (!isset($this->_state['custom']) || !$this->_state['custom']) {
|
if (!isset($this->_state['custom']) || !$this->_state['custom']) {
|
||||||
$filter_sql = $this->get_filter_sql();
|
$filter_sql = $this->get_filter_sql();
|
||||||
$join_sql = $this->get_join_sql();
|
$join_sql = $this->get_join_sql();
|
||||||
|
@ -1508,7 +1511,6 @@ class Query
|
||||||
case 'codec':
|
case 'codec':
|
||||||
$sql = "`live_stream`.`codec`";
|
$sql = "`live_stream`.`codec`";
|
||||||
break;
|
break;
|
||||||
break;
|
|
||||||
} // end switch
|
} // end switch
|
||||||
break;
|
break;
|
||||||
case 'genre':
|
case 'genre':
|
||||||
|
@ -1643,9 +1645,9 @@ class Query
|
||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
if ($sql) { $sql_sort = "$sql $order,"; }
|
if (isset($sql)) { return "$sql $order,"; }
|
||||||
|
|
||||||
return $sql_sort;
|
return "";
|
||||||
|
|
||||||
} // sql_sort
|
} // sql_sort
|
||||||
|
|
||||||
|
@ -1698,6 +1700,7 @@ class Query
|
||||||
|
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
|
|
||||||
|
$results = array();
|
||||||
while ($row = Dba::fetch_assoc($db_results)) {
|
while ($row = Dba::fetch_assoc($db_results)) {
|
||||||
$results[] = $row['id'];
|
$results[] = $row['id'];
|
||||||
}
|
}
|
||||||
|
@ -1720,8 +1723,7 @@ class Query
|
||||||
|
|
||||||
$sql = 'UPDATE `tmp_browse` SET `data` = ? ' .
|
$sql = 'UPDATE `tmp_browse` SET `data` = ? ' .
|
||||||
'WHERE `sid` = ? AND `id` = ?';
|
'WHERE `sid` = ? AND `id` = ?';
|
||||||
$db_results = Dba::write($sql,
|
Dba::write($sql, array($data, session_id(), $id));
|
||||||
array($data, session_id(), $id));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1746,8 +1748,7 @@ class Query
|
||||||
|
|
||||||
$sql = 'UPDATE `tmp_browse` SET `object_data` = ? ' .
|
$sql = 'UPDATE `tmp_browse` SET `object_data` = ? ' .
|
||||||
'WHERE `sid` = ? AND `id` = ?';
|
'WHERE `sid` = ? AND `id` = ?';
|
||||||
$db_results = Dba::write($sql,
|
Dba::write($sql, array($data, session_id(), $id));
|
||||||
array($data, session_id(), $id));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,10 @@ class Radio extends database_object implements media
|
||||||
public $codec;
|
public $codec;
|
||||||
public $catalog;
|
public $catalog;
|
||||||
|
|
||||||
|
public $f_link;
|
||||||
|
public $f_name_link;
|
||||||
|
public $f_url_link;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* This takes a flagged.id and then pulls in the information for said flag entry
|
* This takes a flagged.id and then pulls in the information for said flag entry
|
||||||
|
@ -152,7 +156,7 @@ class Radio extends database_object implements media
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM `live_stream` WHERE `id` = ?";
|
$sql = "DELETE FROM `live_stream` WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($this->id));
|
Dba::write($sql, array($this->id));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -206,7 +210,7 @@ class Radio extends database_object implements media
|
||||||
$db_results = Dba::read($sql, $params);
|
$db_results = Dba::read($sql, $params);
|
||||||
$radios = array();
|
$radios = array();
|
||||||
|
|
||||||
while ($results = Dba::featch_assoc($db_results)) {
|
while ($results = Dba::fetch_assoc($db_results)) {
|
||||||
$radios[] = $results['id'];
|
$radios[] = $results['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ class Random
|
||||||
*/
|
*/
|
||||||
public static function get_single_song($type)
|
public static function get_single_song($type)
|
||||||
{
|
{
|
||||||
|
$song_id = 0;
|
||||||
$method_name = 'get_' . $type;
|
$method_name = 'get_' . $type;
|
||||||
|
|
||||||
if (method_exists('Random', $method_name)) {
|
if (method_exists('Random', $method_name)) {
|
||||||
|
@ -125,6 +126,7 @@ class Random
|
||||||
|
|
||||||
// Get the last album played by us
|
// Get the last album played by us
|
||||||
$data = $GLOBALS['user']->get_recently_played('1', 'album');
|
$data = $GLOBALS['user']->get_recently_played('1', 'album');
|
||||||
|
$where_sql = "";
|
||||||
if ($data[0]) {
|
if ($data[0]) {
|
||||||
$where_sql = " AND `song`.`album`='" . $data[0] . "' ";
|
$where_sql = " AND `song`.`album`='" . $data[0] . "' ";
|
||||||
}
|
}
|
||||||
|
@ -157,6 +159,7 @@ class Random
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
$data = $GLOBALS['user']->get_recently_played('1','artist');
|
$data = $GLOBALS['user']->get_recently_played('1','artist');
|
||||||
|
$where_sql = "";
|
||||||
if ($data[0]) {
|
if ($data[0]) {
|
||||||
$where_sql = " AND `song`.`artist`='" . $data[0] . "' ";
|
$where_sql = " AND `song`.`artist`='" . $data[0] . "' ";
|
||||||
}
|
}
|
||||||
|
@ -192,6 +195,7 @@ class Random
|
||||||
// Generate our matchlist
|
// Generate our matchlist
|
||||||
|
|
||||||
/* If they've passed -1 as limit then get everything */
|
/* If they've passed -1 as limit then get everything */
|
||||||
|
$limit_sql = "";
|
||||||
if ($data['random'] == "-1") { unset($data['random']); } else { $limit_sql = "LIMIT " . Dba::escape($limit); }
|
if ($data['random'] == "-1") { unset($data['random']); } else { $limit_sql = "LIMIT " . Dba::escape($limit); }
|
||||||
|
|
||||||
$search_data = Search::clean_request($data);
|
$search_data = Search::clean_request($data);
|
||||||
|
@ -204,6 +208,7 @@ class Random
|
||||||
$search_info = $search->to_sql();
|
$search_info = $search->to_sql();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql = "";
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'song':
|
case 'song':
|
||||||
$sql = "SELECT `song`.`id`, `size`, `time` " .
|
$sql = "SELECT `song`.`id`, `size`, `time` " .
|
||||||
|
@ -272,6 +277,10 @@ class Random
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
|
$size_total = 0;
|
||||||
|
$fuzzy_size = 0;
|
||||||
|
$time_total = 0;
|
||||||
|
$fuzzy_time = 0;
|
||||||
while ($row = Dba::fetch_assoc($db_results)) {
|
while ($row = Dba::fetch_assoc($db_results)) {
|
||||||
|
|
||||||
// If size limit is specified
|
// If size limit is specified
|
||||||
|
@ -331,7 +340,6 @@ class Random
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'song':
|
case 'song':
|
||||||
return $results;
|
return $results;
|
||||||
break;
|
|
||||||
case 'album':
|
case 'album':
|
||||||
$songs = array();
|
$songs = array();
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
|
@ -339,7 +347,6 @@ class Random
|
||||||
$songs = array_merge($songs, $album->get_songs());
|
$songs = array_merge($songs, $album->get_songs());
|
||||||
}
|
}
|
||||||
return $songs;
|
return $songs;
|
||||||
break;
|
|
||||||
case 'artist':
|
case 'artist':
|
||||||
$songs = array();
|
$songs = array();
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
|
@ -347,10 +354,8 @@ class Random
|
||||||
$songs = array_merge($songs, $artist->get_songs());
|
$songs = array_merge($songs, $artist->get_songs());
|
||||||
}
|
}
|
||||||
return $songs;
|
return $songs;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} // advanced
|
} // advanced
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ class Rating extends database_object
|
||||||
}
|
}
|
||||||
$user_id = intval($user_id);
|
$user_id = intval($user_id);
|
||||||
|
|
||||||
debug_event('Rating', "Setting rating for $type $id to $rating", 5);
|
debug_event('Rating', "Setting rating for $this->type $this->id to $rating", 5);
|
||||||
|
|
||||||
// If score is -1, then remove rating
|
// If score is -1, then remove rating
|
||||||
if ($rating == '-1') {
|
if ($rating == '-1') {
|
||||||
|
@ -238,7 +238,7 @@ class Rating extends database_object
|
||||||
"VALUES (?, ?, ?, ?)";
|
"VALUES (?, ?, ?, ?)";
|
||||||
$params = array($this->id, $this->type, $rating, $user_id);
|
$params = array($this->id, $this->type, $rating, $user_id);
|
||||||
}
|
}
|
||||||
$db_results = Dba::write($sql, $params);
|
Dba::write($sql, $params);
|
||||||
|
|
||||||
parent::add_to_cache('rating_' . $type . '_user' . $user_id, $id, $rating);
|
parent::add_to_cache('rating_' . $type . '_user' . $user_id, $id, $rating);
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ class Recommendation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$similars || count($similars) == 0) {
|
if (!isset($similars) || count($similars) == 0) {
|
||||||
$similars = $cache['items'];
|
$similars = $cache['items'];
|
||||||
}
|
}
|
||||||
if ($similars) {
|
if ($similars) {
|
||||||
|
@ -274,7 +274,7 @@ class Recommendation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$similars || count($similars) == 0) {
|
if (!isset($similars) || count($similars) == 0) {
|
||||||
$similars = $cache['items'];
|
$similars = $cache['items'];
|
||||||
}
|
}
|
||||||
if ($similars) {
|
if ($similars) {
|
||||||
|
|
|
@ -35,6 +35,9 @@ class Search extends playlist_object
|
||||||
public $basetypes;
|
public $basetypes;
|
||||||
public $types;
|
public $types;
|
||||||
|
|
||||||
|
public $f_link;
|
||||||
|
public $f_name_link;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
*/
|
*/
|
||||||
|
@ -469,6 +472,7 @@ class Search extends playlist_object
|
||||||
*/
|
*/
|
||||||
public static function clean_request($data)
|
public static function clean_request($data)
|
||||||
{
|
{
|
||||||
|
$request = array();
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
$prefix = substr($key, 0, 4);
|
$prefix = substr($key, 0, 4);
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
|
@ -554,8 +558,8 @@ class Search extends playlist_object
|
||||||
|
|
||||||
// Generate BASE SQL
|
// Generate BASE SQL
|
||||||
|
|
||||||
|
$limit_sql = "";
|
||||||
if ($limit > 0) {
|
if ($limit > 0) {
|
||||||
$limit_sql = ' LIMIT ' . $limit;
|
|
||||||
$offset = intval($data['offset']);
|
$offset = intval($data['offset']);
|
||||||
$limit_sql = ' LIMIT ';
|
$limit_sql = ' LIMIT ';
|
||||||
if ($offset) $limit_sql .= $offset . ",";
|
if ($offset) $limit_sql .= $offset . ",";
|
||||||
|
@ -586,7 +590,7 @@ class Search extends playlist_object
|
||||||
{
|
{
|
||||||
$id = Dba::escape($this->id);
|
$id = Dba::escape($this->id);
|
||||||
$sql = "DELETE FROM `search` WHERE `id` = ?";
|
$sql = "DELETE FROM `search` WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($id));
|
Dba::write($sql, array($id));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -715,7 +719,7 @@ class Search extends playlist_object
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO `search` (`name`, `type`, `user`, `rules`, `logic_operator`) VALUES (?, ?, ?, ?, ?)";
|
$sql = "INSERT INTO `search` (`name`, `type`, `user`, `rules`, `logic_operator`) VALUES (?, ?, ?, ?, ?)";
|
||||||
$db_results = Dba::write($sql, array($this->name, $this->type, $GLOBALS['user']->id, serialize($this->rules), $this->logic_operator));
|
Dba::write($sql, array($this->name, $this->type, $GLOBALS['user']->id, serialize($this->rules), $this->logic_operator));
|
||||||
$insert_id = Dba::insert_id();
|
$insert_id = Dba::insert_id();
|
||||||
$this->id = $insert_id;
|
$this->id = $insert_id;
|
||||||
return $insert_id;
|
return $insert_id;
|
||||||
|
@ -729,6 +733,7 @@ class Search extends playlist_object
|
||||||
*/
|
*/
|
||||||
public function to_js()
|
public function to_js()
|
||||||
{
|
{
|
||||||
|
$js = "";
|
||||||
foreach ($this->rules as $rule) {
|
foreach ($this->rules as $rule) {
|
||||||
$js .= '<script type="text/javascript">' .
|
$js .= '<script type="text/javascript">' .
|
||||||
'SearchRow.add("' . $rule[0] . '","' .
|
'SearchRow.add("' . $rule[0] . '","' .
|
||||||
|
@ -785,7 +790,7 @@ class Search extends playlist_object
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 'boolean') {
|
if ($type == 'boolean') {
|
||||||
return make_bool($input);
|
return make_bool($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -807,8 +812,10 @@ class Search extends playlist_object
|
||||||
|
|
||||||
foreach ($this->rules as $rule) {
|
foreach ($this->rules as $rule) {
|
||||||
$type = $this->name_to_basetype($rule[0]);
|
$type = $this->name_to_basetype($rule[0]);
|
||||||
foreach ($this->basetypes[$type] as $operator) {
|
$operator = array();
|
||||||
if ($operator['name'] == $rule[1]) {
|
foreach ($this->basetypes[$type] as $op) {
|
||||||
|
if ($op['name'] == $rule[1]) {
|
||||||
|
$operator = $op;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1037,7 +1044,6 @@ class Search extends playlist_object
|
||||||
"WHERE `object_count`.`object_type` = 'song'" .
|
"WHERE `object_count`.`object_type` = 'song'" .
|
||||||
"GROUP BY `object_count`.`object_id` HAVING COUNT(*) $sql_match_operator '$input')";
|
"GROUP BY `object_count`.`object_id` HAVING COUNT(*) $sql_match_operator '$input')";
|
||||||
break;
|
break;
|
||||||
break;
|
|
||||||
case 'catalog':
|
case 'catalog':
|
||||||
$where[] = "`song`.`catalog` $sql_match_operator '$input'";
|
$where[] = "`song`.`catalog` $sql_match_operator '$input'";
|
||||||
break;
|
break;
|
||||||
|
@ -1076,7 +1082,7 @@ class Search extends playlist_object
|
||||||
|
|
||||||
$join['catalog'] = AmpConfig::get('catalog_disable');
|
$join['catalog'] = AmpConfig::get('catalog_disable');
|
||||||
|
|
||||||
$where_sql = implode(" $sql_logic_operator ", $where) . $group;
|
$where_sql = implode(" $sql_logic_operator ", $where);
|
||||||
|
|
||||||
// now that we know which things we want to JOIN...
|
// now that we know which things we want to JOIN...
|
||||||
if ($join['artist']) {
|
if ($join['artist']) {
|
||||||
|
@ -1145,8 +1151,10 @@ class Search extends playlist_object
|
||||||
|
|
||||||
foreach ($this->rules as $rule) {
|
foreach ($this->rules as $rule) {
|
||||||
$type = $this->name_to_basetype($rule[0]);
|
$type = $this->name_to_basetype($rule[0]);
|
||||||
foreach ($this->basetypes[$type] as $operator) {
|
$operator = array();
|
||||||
if ($operator['name'] == $rule[1]) {
|
foreach ($this->basetypes[$type] as $op) {
|
||||||
|
if ($op['name'] == $rule[1]) {
|
||||||
|
$operator = $op;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,22 +36,6 @@ class Session
|
||||||
// Rien a faire
|
// Rien a faire
|
||||||
} // __construct
|
} // __construct
|
||||||
|
|
||||||
/**
|
|
||||||
* open
|
|
||||||
*
|
|
||||||
* This function is for opening a new session so we just verify that we
|
|
||||||
* have a database connection, nothing more is needed.
|
|
||||||
*/
|
|
||||||
public static function open($save_path, $session_name)
|
|
||||||
{
|
|
||||||
if (!Dba::dbh()) {
|
|
||||||
debug_event('session', 'Could not start session, no database connection', 1);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* close
|
* close
|
||||||
*
|
*
|
||||||
|
@ -73,8 +57,6 @@ class Session
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$length = AmpConfig::get('session_length');
|
|
||||||
|
|
||||||
// Check to see if remember me cookie is set, if so use remember
|
// Check to see if remember me cookie is set, if so use remember
|
||||||
// length, otherwise use the session length
|
// length, otherwise use the session length
|
||||||
$expire = isset($_COOKIE[AmpConfig::get('session_name') . '_remember'])
|
$expire = isset($_COOKIE[AmpConfig::get('session_name') . '_remember'])
|
||||||
|
@ -82,7 +64,7 @@ class Session
|
||||||
: time() + AmpConfig::get('session_length');
|
: time() + AmpConfig::get('session_length');
|
||||||
|
|
||||||
$sql = 'UPDATE `session` SET `value` = ?, `expire` = ? WHERE `id` = ?';
|
$sql = 'UPDATE `session` SET `value` = ?, `expire` = ? WHERE `id` = ?';
|
||||||
$db_results = Dba::read($sql, array($value, $expire, $key));
|
Dba::write($sql, array($value, $expire, $key));
|
||||||
|
|
||||||
debug_event('session', 'Writing to ' . $key . ' with expiration ' . $expire, 6);
|
debug_event('session', 'Writing to ' . $key . ' with expiration ' . $expire, 6);
|
||||||
|
|
||||||
|
@ -100,7 +82,7 @@ class Session
|
||||||
|
|
||||||
// Remove anything and EVERYTHING
|
// Remove anything and EVERYTHING
|
||||||
$sql = 'DELETE FROM `session` WHERE `id` = ?';
|
$sql = 'DELETE FROM `session` WHERE `id` = ?';
|
||||||
$db_results = Dba::write($sql, array($key));
|
Dba::write($sql, array($key));
|
||||||
|
|
||||||
debug_event('SESSION', 'Deleting Session with key:' . $key, 6);
|
debug_event('SESSION', 'Deleting Session with key:' . $key, 6);
|
||||||
|
|
||||||
|
@ -118,7 +100,7 @@ class Session
|
||||||
public static function gc()
|
public static function gc()
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM `session` WHERE `expire` < ?';
|
$sql = 'DELETE FROM `session` WHERE `expire` < ?';
|
||||||
$db_results = Dba::write($sql, array(time()));
|
Dba::write($sql, array(time()));
|
||||||
|
|
||||||
// Also clean up things that use sessions as keys
|
// Also clean up things that use sessions as keys
|
||||||
Query::gc();
|
Query::gc();
|
||||||
|
@ -279,10 +261,10 @@ class Session
|
||||||
* exists
|
* exists
|
||||||
*
|
*
|
||||||
* This checks to see if the specified session of the specified type
|
* This checks to see if the specified session of the specified type
|
||||||
* exists, it also provides an array of keyed data that may be required
|
* exists
|
||||||
* based on the type.
|
* based on the type.
|
||||||
*/
|
*/
|
||||||
public static function exists($type, $key, $data=array())
|
public static function exists($type, $key)
|
||||||
{
|
{
|
||||||
// Switch on the type they pass
|
// Switch on the type they pass
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
@ -312,7 +294,6 @@ class Session
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default to false
|
// Default to false
|
||||||
|
|
|
@ -22,6 +22,27 @@
|
||||||
|
|
||||||
class Share extends database_object
|
class Share extends database_object
|
||||||
{
|
{
|
||||||
|
public $id;
|
||||||
|
public $user;
|
||||||
|
public $object_type;
|
||||||
|
public $object_id;
|
||||||
|
public $allow_stream;
|
||||||
|
public $allow_download;
|
||||||
|
public $creation_date;
|
||||||
|
public $lastvisit_date;
|
||||||
|
public $expire_days;
|
||||||
|
public $max_counter;
|
||||||
|
public $counter;
|
||||||
|
public $secret;
|
||||||
|
public $public_url;
|
||||||
|
|
||||||
|
public $f_object_link;
|
||||||
|
public $f_user;
|
||||||
|
public $f_allow_stream;
|
||||||
|
public $f_allow_download;
|
||||||
|
public $f_creation_date;
|
||||||
|
public $f_lastvisite_date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
|
@ -77,7 +98,6 @@ class Share extends database_object
|
||||||
case 'song':
|
case 'song':
|
||||||
case 'playlist':
|
case 'playlist':
|
||||||
return $type;
|
return $type;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -108,7 +128,7 @@ class Share extends database_object
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exeption $e) {
|
} catch (Exception $e) {
|
||||||
debug_event('share', 'Share plugin error: ' . $e->getMessage(), '1');
|
debug_event('share', 'Share plugin error: ' . $e->getMessage(), '1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,11 @@ class Shoutbox
|
||||||
public $object_type;
|
public $object_type;
|
||||||
public $object_id;
|
public $object_id;
|
||||||
public $user;
|
public $user;
|
||||||
|
public $sticky;
|
||||||
|
public $text;
|
||||||
|
public $data;
|
||||||
|
|
||||||
|
public $f_link;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -170,7 +175,7 @@ class Shoutbox
|
||||||
$image_string = "<img class=\"shoutboximage\" height=\"75\" width=\"75\" src=\"" . AmpConfig::get('web_path') . "/image.php?id=" . $song->album . "&thumb=1\" />";
|
$image_string = "<img class=\"shoutboximage\" height=\"75\" width=\"75\" src=\"" . AmpConfig::get('web_path') . "/image.php?id=" . $song->album . "&thumb=1\" />";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Rien a faire
|
$image_string = "";
|
||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
|
@ -187,7 +192,7 @@ class Shoutbox
|
||||||
$sticky = isset($data['sticky']) ? 1 : 0;
|
$sticky = isset($data['sticky']) ? 1 : 0;
|
||||||
$sql = "INSERT INTO `user_shout` (`user`,`date`,`text`,`sticky`,`object_id`,`object_type`, `data`) " .
|
$sql = "INSERT INTO `user_shout` (`user`,`date`,`text`,`sticky`,`object_id`,`object_type`, `data`) " .
|
||||||
"VALUES (? , ?, ?, ?, ?, ?, ?)";
|
"VALUES (? , ?, ?, ?, ?, ?, ?)";
|
||||||
$db_results = Dba::write($sql, array($GLOBALS['user']->id, time(), strip_tags($data['comment']), $sticky, $data['object_id'], $data['object_type'], $data['data']));
|
Dba::write($sql, array($GLOBALS['user']->id, time(), strip_tags($data['comment']), $sticky, $data['object_id'], $data['object_type'], $data['data']));
|
||||||
|
|
||||||
$insert_id = Dba::insert_id();
|
$insert_id = Dba::insert_id();
|
||||||
|
|
||||||
|
@ -206,7 +211,7 @@ class Shoutbox
|
||||||
$sticky = make_bool($data['sticky']);
|
$sticky = make_bool($data['sticky']);
|
||||||
|
|
||||||
$sql = "UPDATE `user_shout` SET `text`='$text', `sticky`='$sticky' WHERE `id`='$id'";
|
$sql = "UPDATE `user_shout` SET `text`='$text', `sticky`='$sticky' WHERE `id`='$id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -235,7 +240,7 @@ class Shoutbox
|
||||||
// Delete the shoutbox post
|
// Delete the shoutbox post
|
||||||
$shout_id = Dba::escape($shout_id);
|
$shout_id = Dba::escape($shout_id);
|
||||||
$sql = "DELETE FROM `user_shout` WHERE `id`='$shout_id'";
|
$sql = "DELETE FROM `user_shout` WHERE `id`='$shout_id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
} // delete
|
} // delete
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,9 @@ class Song extends database_object implements media
|
||||||
public $update_time;
|
public $update_time;
|
||||||
public $mbid; // MusicBrainz ID
|
public $mbid; // MusicBrainz ID
|
||||||
public $catalog;
|
public $catalog;
|
||||||
|
public $waveform;
|
||||||
|
|
||||||
|
public $tags;
|
||||||
public $language;
|
public $language;
|
||||||
public $comment;
|
public $comment;
|
||||||
public $lyrics;
|
public $lyrics;
|
||||||
|
@ -58,6 +60,16 @@ class Song extends database_object implements media
|
||||||
public $f_track;
|
public $f_track;
|
||||||
public $f_bitrate;
|
public $f_bitrate;
|
||||||
public $link;
|
public $link;
|
||||||
|
public $f_file;
|
||||||
|
public $f_title_full;
|
||||||
|
public $f_link;
|
||||||
|
public $f_album_link;
|
||||||
|
public $f_artist_link;
|
||||||
|
public $f_tags;
|
||||||
|
public $f_size;
|
||||||
|
public $f_lyrics;
|
||||||
|
public $f_pattern;
|
||||||
|
public $count;
|
||||||
|
|
||||||
/* Setting Variables */
|
/* Setting Variables */
|
||||||
public $_fake = false; // If this is a 'construct_from_array' object
|
public $_fake = false; // If this is a 'construct_from_array' object
|
||||||
|
@ -327,39 +339,29 @@ class Song extends database_object implements media
|
||||||
case 'spx':
|
case 'spx':
|
||||||
case 'ogg':
|
case 'ogg':
|
||||||
return 'application/ogg';
|
return 'application/ogg';
|
||||||
break;
|
|
||||||
case 'wma':
|
case 'wma':
|
||||||
case 'asf':
|
case 'asf':
|
||||||
return 'audio/x-ms-wma';
|
return 'audio/x-ms-wma';
|
||||||
break;
|
|
||||||
case 'mp3':
|
case 'mp3':
|
||||||
case 'mpeg3':
|
case 'mpeg3':
|
||||||
return 'audio/mpeg';
|
return 'audio/mpeg';
|
||||||
break;
|
|
||||||
case 'rm':
|
case 'rm':
|
||||||
case 'ra':
|
case 'ra':
|
||||||
return 'audio/x-realaudio';
|
return 'audio/x-realaudio';
|
||||||
break;
|
|
||||||
case 'flac';
|
case 'flac';
|
||||||
return 'audio/x-flac';
|
return 'audio/x-flac';
|
||||||
break;
|
|
||||||
case 'wv':
|
case 'wv':
|
||||||
return 'audio/x-wavpack';
|
return 'audio/x-wavpack';
|
||||||
break;
|
|
||||||
case 'aac':
|
case 'aac':
|
||||||
case 'mp4':
|
case 'mp4':
|
||||||
case 'm4a':
|
case 'm4a':
|
||||||
return 'audio/mp4';
|
return 'audio/mp4';
|
||||||
break;
|
|
||||||
case 'aacp':
|
case 'aacp':
|
||||||
return 'audio/aacp';
|
return 'audio/aacp';
|
||||||
break;
|
|
||||||
case 'mpc':
|
case 'mpc':
|
||||||
return 'audio/x-musepack';
|
return 'audio/x-musepack';
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return 'audio/mpeg';
|
return 'audio/mpeg';
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -423,14 +425,14 @@ class Song extends database_object implements media
|
||||||
public static function get_duplicate_info($dupe, $search_type)
|
public static function get_duplicate_info($dupe, $search_type)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT `id` FROM `song` ' .
|
$sql = 'SELECT `id` FROM `song` ' .
|
||||||
"WHERE `title`='" . Dba::escape($item['title']) . "' ";
|
"WHERE `title`='" . Dba::escape($dupe['title']) . "' ";
|
||||||
|
|
||||||
if ($search_type == 'artist_title' ||
|
if ($search_type == 'artist_title' ||
|
||||||
$search_type == 'artist_album_title') {
|
$search_type == 'artist_album_title') {
|
||||||
$sql .= "AND `artist`='" . Dba::escape($item['artist']) . "' ";
|
$sql .= "AND `artist`='" . Dba::escape($dupe['artist']) . "' ";
|
||||||
}
|
}
|
||||||
if ($search_type == 'artist_album_title') {
|
if ($search_type == 'artist_album_title') {
|
||||||
$sql .= "AND `album` = '" . Dba::escape($item['album']) . "' ";
|
$sql .= "AND `album` = '" . Dba::escape($dupe['album']) . "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= 'ORDER BY `time`,`bitrate`,`size`';
|
$sql .= 'ORDER BY `time`,`bitrate`,`size`';
|
||||||
|
@ -504,6 +506,7 @@ class Song extends database_object implements media
|
||||||
// Remove some stuff we don't care about
|
// Remove some stuff we don't care about
|
||||||
unset($song->catalog,$song->played,$song->enabled,$song->addition_time,$song->update_time,$song->type);
|
unset($song->catalog,$song->played,$song->enabled,$song->addition_time,$song->update_time,$song->type);
|
||||||
|
|
||||||
|
$array = array();
|
||||||
$string_array = array('title','comment','lyrics');
|
$string_array = array('title','comment','lyrics');
|
||||||
$skip_array = array('id','tag_id','mime','mb_artistid','mbid');
|
$skip_array = array('id','tag_id','mime','mb_artistid','mbid');
|
||||||
|
|
||||||
|
@ -569,7 +572,6 @@ class Song extends database_object implements media
|
||||||
$function = 'update_' . $key;
|
$function = 'update_' . $key;
|
||||||
self::$function($value, $this->id);
|
self::$function($value, $this->id);
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
$updated = 1;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'edit_tags':
|
case 'edit_tags':
|
||||||
|
@ -612,7 +614,7 @@ class Song extends database_object implements media
|
||||||
"`mbid`='$mbid', " .
|
"`mbid`='$mbid', " .
|
||||||
"`update_time`='$update_time' WHERE `id`='$song_id'";
|
"`update_time`='$update_time' WHERE `id`='$song_id'";
|
||||||
|
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$comment = Dba::escape($new_song->comment);
|
$comment = Dba::escape($new_song->comment);
|
||||||
$language = Dba::escape($new_song->language);
|
$language = Dba::escape($new_song->language);
|
||||||
|
@ -620,7 +622,7 @@ class Song extends database_object implements media
|
||||||
|
|
||||||
$sql = "UPDATE `song_data` SET `lyrics`='$lyrics', `language`='$language', `comment`='$comment' " .
|
$sql = "UPDATE `song_data` SET `lyrics`='$lyrics', `language`='$language', `comment`='$comment' " .
|
||||||
"WHERE `song_id`='$song_id'";
|
"WHERE `song_id`='$song_id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
} // update_song
|
} // update_song
|
||||||
|
|
||||||
|
@ -808,7 +810,7 @@ class Song extends database_object implements media
|
||||||
if (!strlen(trim($value)) && $field != 'comment') { return false; }
|
if (!strlen(trim($value)) && $field != 'comment') { return false; }
|
||||||
|
|
||||||
$sql = "UPDATE `song` SET `$field` = ? WHERE `id` = ?";
|
$sql = "UPDATE `song` SET `$field` = ? WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($value, $song_id));
|
Dba::write($sql, array($value, $song_id));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -825,7 +827,7 @@ class Song extends database_object implements media
|
||||||
if (!Access::check('interface',$level)) { return false; }
|
if (!Access::check('interface',$level)) { return false; }
|
||||||
|
|
||||||
$sql = "UPDATE `song_data` SET `$field` = ? WHERE `song_id` = ?";
|
$sql = "UPDATE `song_data` SET `$field` = ? WHERE `song_id` = ?";
|
||||||
$db_results = Dba::write($sql, array($value, $song_id));
|
Dba::write($sql, array($value, $song_id));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -878,7 +880,7 @@ class Song extends database_object implements media
|
||||||
|
|
||||||
// Get the top tags
|
// Get the top tags
|
||||||
$this->tags = Tag::get_top_tags('song', $this->id);
|
$this->tags = Tag::get_top_tags('song', $this->id);
|
||||||
$this->f_tags = Tag::get_display($this->tags, $this->id, 'song');
|
$this->f_tags = Tag::get_display($this->tags);
|
||||||
|
|
||||||
// Format the size
|
// Format the size
|
||||||
$this->f_size = UI::format_bytes($this->size);
|
$this->f_size = UI::format_bytes($this->size);
|
||||||
|
@ -977,12 +979,16 @@ class Song extends database_object implements media
|
||||||
*/
|
*/
|
||||||
public function get_rel_path($file_path=0,$catalog_id=0)
|
public function get_rel_path($file_path=0,$catalog_id=0)
|
||||||
{
|
{
|
||||||
|
$info = null;
|
||||||
if (!$file_path) {
|
if (!$file_path) {
|
||||||
$info = $this->_get_info();
|
$info = $this->_get_info();
|
||||||
$file_path = $info->file;
|
$file_path = $info['file'];
|
||||||
}
|
}
|
||||||
if (!$catalog_id) {
|
if (!$catalog_id) {
|
||||||
$catalog_id = $info->catalog;
|
if (!is_array($info)) {
|
||||||
|
$info = $this->_get_info();
|
||||||
|
}
|
||||||
|
$catalog_id = $info['catalog'];
|
||||||
}
|
}
|
||||||
$catalog = Catalog::create_from_id( $catalog_id );
|
$catalog = Catalog::create_from_id( $catalog_id );
|
||||||
return $catalog->get_rel_path($file_path);
|
return $catalog->get_rel_path($file_path);
|
||||||
|
|
|
@ -35,6 +35,18 @@ class Song_Preview extends database_object implements media
|
||||||
public $mbid; // MusicBrainz ID
|
public $mbid; // MusicBrainz ID
|
||||||
public $enabled = true;
|
public $enabled = true;
|
||||||
|
|
||||||
|
public $f_file;
|
||||||
|
public $f_artist;
|
||||||
|
public $f_artist_full;
|
||||||
|
public $f_artist_link;
|
||||||
|
public $f_title;
|
||||||
|
public $f_title_full;
|
||||||
|
public $link;
|
||||||
|
public $f_link;
|
||||||
|
public $f_album_link;
|
||||||
|
public $f_album;
|
||||||
|
public $f_track;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
|
@ -114,6 +126,7 @@ class Song_Preview extends database_object implements media
|
||||||
"WHERE `id` IN $idlist";
|
"WHERE `id` IN $idlist";
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
|
|
||||||
|
$artists = array();
|
||||||
while ($row = Dba::fetch_assoc($db_results)) {
|
while ($row = Dba::fetch_assoc($db_results)) {
|
||||||
parent::add_to_cache('song_preview', $row['id'], $row);
|
parent::add_to_cache('song_preview', $row['id'], $row);
|
||||||
if ($row['artist']) {
|
if ($row['artist']) {
|
||||||
|
|
|
@ -244,16 +244,10 @@ class Stats
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_recent
|
* get_recent
|
||||||
* This returns the recent X for type Y from the
|
* This returns the recent X for type Y
|
||||||
* last stats_threshold days
|
|
||||||
*/
|
*/
|
||||||
public static function get_recent($type, $count='',$threshold = '',$offset='')
|
public static function get_recent($type, $count='',$offset='')
|
||||||
{
|
{
|
||||||
/* If they don't pass one, then use the preference */
|
|
||||||
if (!$threshold) {
|
|
||||||
$threshold = AmpConfig::get('stats_threshold');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$count) {
|
if (!$count) {
|
||||||
$count = AmpConfig::get('popular_threshold');
|
$count = AmpConfig::get('popular_threshold');
|
||||||
}
|
}
|
||||||
|
@ -329,7 +323,6 @@ class Stats
|
||||||
return $type;
|
return $type;
|
||||||
default:
|
default:
|
||||||
return 'song';
|
return 'song';
|
||||||
break;
|
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
} // validate_type
|
} // validate_type
|
||||||
|
@ -359,7 +352,7 @@ class Stats
|
||||||
* This returns an array of the newest artists/albums/whatever
|
* This returns an array of the newest artists/albums/whatever
|
||||||
* in this ampache instance
|
* in this ampache instance
|
||||||
*/
|
*/
|
||||||
public static function get_newest($type, $limit='', $offset='', $catalog=0)
|
public static function get_newest($type, $count='', $offset='', $catalog=0)
|
||||||
{
|
{
|
||||||
if (!$count) { $count = AmpConfig::get('popular_threshold'); }
|
if (!$count) { $count = AmpConfig::get('popular_threshold'); }
|
||||||
if (!$offset) {
|
if (!$offset) {
|
||||||
|
|
|
@ -186,7 +186,7 @@ class Stream
|
||||||
$sql = "DELETE FROM `now_playing` USING `now_playing` " .
|
$sql = "DELETE FROM `now_playing` USING `now_playing` " .
|
||||||
"LEFT JOIN `session` ON `session`.`id` = `now_playing`.`id` " .
|
"LEFT JOIN `session` ON `session`.`id` = `now_playing`.`id` " .
|
||||||
"WHERE `session`.`id` IS NULL OR `now_playing`.`expire` < '" . time() . "'";
|
"WHERE `session`.`id` IS NULL OR `now_playing`.`expire` < '" . time() . "'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -203,7 +203,7 @@ class Stream
|
||||||
$sql = 'REPLACE INTO `now_playing` ' .
|
$sql = 'REPLACE INTO `now_playing` ' .
|
||||||
'(`id`,`object_id`,`object_type`, `user`, `expire`, `insertion`) ' .
|
'(`id`,`object_id`,`object_type`, `user`, `expire`, `insertion`) ' .
|
||||||
'VALUES (?, ?, ?, ?, ?, ?)';
|
'VALUES (?, ?, ?, ?, ?, ?)';
|
||||||
$db_result = Dba::write($sql, array($sid, $oid, $type, $uid, $time, time()));
|
Dba::write($sql, array($sid, $oid, $type, $uid, $time, time()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -215,7 +215,7 @@ class Stream
|
||||||
public static function clear_now_playing()
|
public static function clear_now_playing()
|
||||||
{
|
{
|
||||||
$sql = 'TRUNCATE `now_playing`';
|
$sql = 'TRUNCATE `now_playing`';
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -227,10 +227,6 @@ class Stream
|
||||||
*/
|
*/
|
||||||
public static function get_now_playing()
|
public static function get_now_playing()
|
||||||
{
|
{
|
||||||
$maxsql = '';
|
|
||||||
if (AmpConfig::get('now_playing_per_user')) {
|
|
||||||
$maxsql = ', ';
|
|
||||||
}
|
|
||||||
$sql = 'SELECT `session`.`agent`, `np`.* FROM `now_playing` AS `np` ';
|
$sql = 'SELECT `session`.`agent`, `np`.* FROM `now_playing` AS `np` ';
|
||||||
$sql .= 'LEFT JOIN `session` ON `session`.`id` = `np`.`id` ';
|
$sql .= 'LEFT JOIN `session` ON `session`.`id` = `np`.`id` ';
|
||||||
|
|
||||||
|
@ -323,11 +319,10 @@ class Stream
|
||||||
if (!defined('AJAX_INCLUDE')) { return false; }
|
if (!defined('AJAX_INCLUDE')) { return false; }
|
||||||
|
|
||||||
switch (AmpConfig::get('playlist_method')) {
|
switch (AmpConfig::get('playlist_method')) {
|
||||||
default:
|
|
||||||
case 'clear':
|
case 'clear':
|
||||||
case 'default':
|
case 'default':
|
||||||
|
default:
|
||||||
return true;
|
return true;
|
||||||
break;
|
|
||||||
case 'send':
|
case 'send':
|
||||||
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=basket';
|
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=basket';
|
||||||
break;
|
break;
|
||||||
|
@ -349,6 +344,7 @@ class Stream
|
||||||
*/
|
*/
|
||||||
public static function get_base_url()
|
public static function get_base_url()
|
||||||
{
|
{
|
||||||
|
$session_string = '';
|
||||||
if (AmpConfig::get('require_session')) {
|
if (AmpConfig::get('require_session')) {
|
||||||
$session_string = 'ssid=' . self::$session . '&';
|
$session_string = 'ssid=' . self::$session . '&';
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,6 +191,7 @@ class Stream_Playlist
|
||||||
case 'localplay':
|
case 'localplay':
|
||||||
case 'web_player':
|
case 'web_player':
|
||||||
// These are valid, but witchy
|
// These are valid, but witchy
|
||||||
|
$ct = "";
|
||||||
$redirect = false;
|
$redirect = false;
|
||||||
unset($ext);
|
unset($ext);
|
||||||
break;
|
break;
|
||||||
|
@ -300,6 +301,7 @@ class Stream_Playlist
|
||||||
{
|
{
|
||||||
echo "[playlist]\n";
|
echo "[playlist]\n";
|
||||||
echo 'NumberOfEntries=' . count($this->urls) . "\n";
|
echo 'NumberOfEntries=' . count($this->urls) . "\n";
|
||||||
|
$i = 0;
|
||||||
foreach ($this->urls as $url) {
|
foreach ($this->urls as $url) {
|
||||||
$i++;
|
$i++;
|
||||||
echo 'File' . $i . '='. $url->url . "\n";
|
echo 'File' . $i . '='. $url->url . "\n";
|
||||||
|
@ -343,6 +345,7 @@ class Stream_Playlist
|
||||||
*/
|
*/
|
||||||
public function create_xspf()
|
public function create_xspf()
|
||||||
{
|
{
|
||||||
|
$result = "";
|
||||||
foreach ($this->urls as $url) {
|
foreach ($this->urls as $url) {
|
||||||
$xml = array();
|
$xml = array();
|
||||||
|
|
||||||
|
|
|
@ -530,6 +530,9 @@ class Subsonic_Api
|
||||||
$album = new Album(Subsonic_XML_Data::getAmpacheId($musicFolderId));
|
$album = new Album(Subsonic_XML_Data::getAmpacheId($musicFolderId));
|
||||||
$finput = $album->name;
|
$finput = $album->name;
|
||||||
$ftype = "artist";
|
$ftype = "artist";
|
||||||
|
} else {
|
||||||
|
$finput = "";
|
||||||
|
$ftype = "";
|
||||||
}
|
}
|
||||||
$search['rule_'.$i.'_input'] = $finput;
|
$search['rule_'.$i.'_input'] = $finput;
|
||||||
$search['rule_'.$i.'_operator'] = 4;
|
$search['rule_'.$i.'_operator'] = 4;
|
||||||
|
@ -579,6 +582,8 @@ class Subsonic_Api
|
||||||
$tag = Tag::construct_from_name($genre);
|
$tag = Tag::construct_from_name($genre);
|
||||||
if ($tag->id) {
|
if ($tag->id) {
|
||||||
$songs = Tag::get_tag_objects("song", $tag->id, $count, $offset);
|
$songs = Tag::get_tag_objects("song", $tag->id, $count, $offset);
|
||||||
|
} else {
|
||||||
|
$songs = array();
|
||||||
}
|
}
|
||||||
$r = Subsonic_XML_Data::createSuccessResponse();
|
$r = Subsonic_XML_Data::createSuccessResponse();
|
||||||
Subsonic_XML_Data::addSongsByGenre($r, $songs);
|
Subsonic_XML_Data::addSongsByGenre($r, $songs);
|
||||||
|
@ -1009,6 +1014,8 @@ class Subsonic_Api
|
||||||
$type = 'album';
|
$type = 'album';
|
||||||
} else if (Subsonic_XML_Data::isSong($i)) {
|
} else if (Subsonic_XML_Data::isSong($i)) {
|
||||||
$type = 'song';
|
$type = 'song';
|
||||||
|
} else {
|
||||||
|
$type = "";
|
||||||
}
|
}
|
||||||
$ids[] = array('id' => $aid, 'type' => $type);
|
$ids[] = array('id' => $aid, 'type' => $type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,14 +387,14 @@ class Subsonic_XML_Data
|
||||||
|
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
$otag = new Tag($tag['id']);
|
$otag = new Tag($tag['id']);
|
||||||
$xgenre = $xgenres->addChild('genre', $otag->name);
|
$xgenres->addChild('genre', $otag->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addVideos($xml)
|
public static function addVideos($xml)
|
||||||
{
|
{
|
||||||
// Not supported yet
|
// Not supported yet
|
||||||
$xvideos = $xml->addChild('videos');
|
$xml->addChild('videos');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function addPlaylists($xml, $playlists)
|
public static function addPlaylists($xml, $playlists)
|
||||||
|
|
|
@ -100,7 +100,7 @@ class Tag extends database_object
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
|
|
||||||
$tags = array();
|
$tags = array();
|
||||||
|
$tag_map = array();
|
||||||
while ($row = Dba::fetch_assoc($db_results)) {
|
while ($row = Dba::fetch_assoc($db_results)) {
|
||||||
$tags[$row['object_id']][$row['tag_id']] = array('user'=>$row['user'], 'id'=>$row['tag_id'], 'name'=>$row['name']);
|
$tags[$row['object_id']][$row['tag_id']] = array('user'=>$row['user'], 'id'=>$row['tag_id'], 'name'=>$row['name']);
|
||||||
$tag_map[$row['object_id']] = array('id'=>$row['id'],'tag_id'=>$row['tag_id'],'user'=>$row['user'],'object_type'=>$type,'object_id'=>$row['object_id']);
|
$tag_map[$row['object_id']] = array('id'=>$row['id'],'tag_id'=>$row['tag_id'],'user'=>$row['user'],'object_type'=>$type,'object_id'=>$row['object_id']);
|
||||||
|
@ -150,8 +150,8 @@ class Tag extends database_object
|
||||||
}
|
}
|
||||||
|
|
||||||
// We've got the tag id, let's see if it's already got a map, if not then create the map and return the value
|
// We've got the tag id, let's see if it's already got a map, if not then create the map and return the value
|
||||||
if (!$map_id = self::tag_map_exists($type,$id,$tag_id,$user)) {
|
if (!$map_id = self::tag_map_exists($type,$id,$tag_id,$uid)) {
|
||||||
$map_id = self::add_tag_map($type,$id,$tag_id,$user);
|
$map_id = self::add_tag_map($type,$id,$tag_id,$uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $map_id;
|
return $map_id;
|
||||||
|
@ -169,7 +169,7 @@ class Tag extends database_object
|
||||||
$value = Dba::escape($value);
|
$value = Dba::escape($value);
|
||||||
|
|
||||||
$sql = "REPLACE INTO `tag` SET `name`='$value'";
|
$sql = "REPLACE INTO `tag` SET `name`='$value'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
$insert_id = Dba::insert_id();
|
$insert_id = Dba::insert_id();
|
||||||
|
|
||||||
parent::add_to_cache('tag_name', $value, $insert_id);
|
parent::add_to_cache('tag_name', $value, $insert_id);
|
||||||
|
@ -209,7 +209,7 @@ class Tag extends database_object
|
||||||
|
|
||||||
$sql = "INSERT INTO `tag_map` (`tag_id`,`user`,`object_type`,`object_id`) " .
|
$sql = "INSERT INTO `tag_map` (`tag_id`,`user`,`object_type`,`object_id`) " .
|
||||||
"VALUES ('$tag_id','$uid','$type','$id')";
|
"VALUES ('$tag_id','$uid','$type','$id')";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
$insert_id = Dba::insert_id();
|
$insert_id = Dba::insert_id();
|
||||||
|
|
||||||
parent::add_to_cache('tag_map_' . $type,$insert_id,array('tag_id'=>$tag_id,'user'=>$uid,'object_type'=>$type,'object_id'=>$id));
|
parent::add_to_cache('tag_map_' . $type,$insert_id,array('tag_id'=>$tag_id,'user'=>$uid,'object_type'=>$type,'object_id'=>$id));
|
||||||
|
@ -228,24 +228,24 @@ class Tag extends database_object
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `song` ON `song`.`id`=`tag_map`.`object_id` " .
|
$sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `song` ON `song`.`id`=`tag_map`.`object_id` " .
|
||||||
"WHERE `tag_map`.`object_type`='song' AND `song`.`id` IS NULL";
|
"WHERE `tag_map`.`object_type`='song' AND `song`.`id` IS NULL";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `album` ON `album`.`id`=`tag_map`.`object_id` " .
|
$sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `album` ON `album`.`id`=`tag_map`.`object_id` " .
|
||||||
"WHERE `tag_map`.`object_type`='album' AND `album`.`id` IS NULL";
|
"WHERE `tag_map`.`object_type`='album' AND `album`.`id` IS NULL";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `artist` ON `artist`.`id`=`tag_map`.`object_id` " .
|
$sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `artist` ON `artist`.`id`=`tag_map`.`object_id` " .
|
||||||
"WHERE `tag_map`.`object_type`='artist' AND `artist`.`id` IS NULL";
|
"WHERE `tag_map`.`object_type`='artist' AND `artist`.`id` IS NULL";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `video` ON `video`.`id`=`tag_map`.`object_id` " .
|
$sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `video` ON `video`.`id`=`tag_map`.`object_id` " .
|
||||||
"WHERE `tag_map`.`object_type`='video' AND `video`.`id` IS NULL";
|
"WHERE `tag_map`.`object_type`='video' AND `video`.`id` IS NULL";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Now nuke the tags themselves
|
// Now nuke the tags themselves
|
||||||
$sql = "DELETE FROM `tag` USING `tag` LEFT JOIN `tag_map` ON `tag`.`id`=`tag_map`.`tag_id` " .
|
$sql = "DELETE FROM `tag` USING `tag` LEFT JOIN `tag_map` ON `tag`.`id`=`tag_map`.`tag_id` " .
|
||||||
"WHERE `tag_map`.`id` IS NULL";
|
"WHERE `tag_map`.`id` IS NULL";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -256,10 +256,10 @@ class Tag extends database_object
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM `tag_map` WHERE `tag_map`.`tag_id`='".$this->id."'";
|
$sql = "DELETE FROM `tag_map` WHERE `tag_map`.`tag_id`='".$this->id."'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "DELETE FROM `tag` WHERE `tag`.`id`='".$this->id."'";
|
$sql = "DELETE FROM `tag` WHERE `tag`.`id`='".$this->id."'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Call the garbage collector to clean everything
|
// Call the garbage collector to clean everything
|
||||||
Tag::gc();
|
Tag::gc();
|
||||||
|
@ -374,6 +374,7 @@ class Tag extends database_object
|
||||||
{
|
{
|
||||||
if (!self::validate_type($type)) { return array(); }
|
if (!self::validate_type($type)) { return array(); }
|
||||||
|
|
||||||
|
$limit_sql = "";
|
||||||
if ($count) {
|
if ($count) {
|
||||||
$limit_sql = "LIMIT ";
|
$limit_sql = "LIMIT ";
|
||||||
if ($offset) $limit_sql .= intval($offset) . ',';
|
if ($offset) $limit_sql .= intval($offset) . ',';
|
||||||
|
@ -470,6 +471,7 @@ class Tag extends database_object
|
||||||
$ctags = Tag::get_top_tags($type, $object_id);
|
$ctags = Tag::get_top_tags($type, $object_id);
|
||||||
$editedTags = explode(",", $tags_comma);
|
$editedTags = explode(",", $tags_comma);
|
||||||
|
|
||||||
|
if (is_array($ctags)) {
|
||||||
foreach ($ctags as $ctid => $ctv) {
|
foreach ($ctags as $ctid => $ctv) {
|
||||||
if ($ctv['id'] != '') {
|
if ($ctv['id'] != '') {
|
||||||
$ctag = new Tag($ctv['id']);
|
$ctag = new Tag($ctv['id']);
|
||||||
|
@ -492,6 +494,7 @@ class Tag extends database_object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Look if we need to add some new tags
|
// Look if we need to add some new tags
|
||||||
foreach ($editedTags as $tk => $tv) {
|
foreach ($editedTags as $tk => $tv) {
|
||||||
|
@ -509,6 +512,7 @@ class Tag extends database_object
|
||||||
*/
|
*/
|
||||||
public function count($type='')
|
public function count($type='')
|
||||||
{
|
{
|
||||||
|
$filter_sql = "";
|
||||||
if ($type) {
|
if ($type) {
|
||||||
$filter_sql = " AND `object_type`='" . Dba::escape($type) . "'";
|
$filter_sql = " AND `object_type`='" . Dba::escape($type) . "'";
|
||||||
}
|
}
|
||||||
|
@ -534,13 +538,8 @@ class Tag extends database_object
|
||||||
{
|
{
|
||||||
if (!self::validate_type($type)) { return false; }
|
if (!self::validate_type($type)) { return false; }
|
||||||
|
|
||||||
$type = Dba::escape($type);
|
$sql = "DELETE FROM `tag_map` WHERE `tag_id` = ? AND `object_type` = ? AND `object_id` = ? AND `user` = ?";
|
||||||
$tag_id = Dba::escape($this->id);
|
Dba::write($sql, array($this->id, $type, $object_id, $GLOBALS['user']->id));
|
||||||
$object_id = Dba::escape($object_id);
|
|
||||||
$user_id = Dba::escape($GLOBALS['user']->id);
|
|
||||||
|
|
||||||
$sql = "DELETE FROM `tag_map` WHERE `tag_id`='$tag_id' AND `object_type`='$type' AND `object_id`='$object_id' AND `user`='$user_id'";
|
|
||||||
$db_results = Dba::write($sql);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -203,11 +203,8 @@ class Tmp_Playlist extends database_object
|
||||||
*/
|
*/
|
||||||
public function clear()
|
public function clear()
|
||||||
{
|
{
|
||||||
$id = Dba::escape($this->id);
|
$sql = "DELETE FROM `tmp_playlist_data` WHERE `tmp_playlist` = ?";
|
||||||
|
Dba::write($sql, array($this->id));
|
||||||
$sql = "DELETE FROM `tmp_playlist_data` WHERE " .
|
|
||||||
"`tmp_playlist`='$id'";
|
|
||||||
$db_results = Dba::write($sql);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -221,14 +218,10 @@ class Tmp_Playlist extends database_object
|
||||||
*/
|
*/
|
||||||
public static function create($data)
|
public static function create($data)
|
||||||
{
|
{
|
||||||
$sessid = Dba::escape($data['session_id']);
|
|
||||||
$type = Dba::escape($data['type']);
|
|
||||||
$object_type = Dba::escape($data['object_type']);
|
|
||||||
|
|
||||||
$sql = "INSERT INTO `tmp_playlist` " .
|
$sql = "INSERT INTO `tmp_playlist` " .
|
||||||
"(`session`,`type`,`object_type`) " .
|
"(`session`,`type`,`object_type`) " .
|
||||||
" VALUES ('$sessid','$type','$object_type')";
|
" VALUES (?, ?, ?)";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql, array($data['session_id'], $data['type'], $data['object_type']));
|
||||||
|
|
||||||
$id = Dba::insert_id();
|
$id = Dba::insert_id();
|
||||||
|
|
||||||
|
@ -247,7 +240,7 @@ class Tmp_Playlist extends database_object
|
||||||
{
|
{
|
||||||
$sql = "UPDATE `tmp_playlist` SET " .
|
$sql = "UPDATE `tmp_playlist` SET " .
|
||||||
"`base_playlist`= ? WHERE `id`= ?";
|
"`base_playlist`= ? WHERE `id`= ?";
|
||||||
$db_results = Dba::write($sql, array($playlist_id, $id));
|
Dba::write($sql, array($playlist_id, $this->id));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -261,7 +254,7 @@ class Tmp_Playlist extends database_object
|
||||||
public static function session_clean($sessid, $id)
|
public static function session_clean($sessid, $id)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM `tmp_playlist` WHERE `session`= ? AND `id` != ?";
|
$sql = "DELETE FROM `tmp_playlist` WHERE `session`= ? AND `id` != ?";
|
||||||
$db_results = Dba::write($sql, array($sessid, $id));
|
Dba::write($sql, array($sessid, $id));
|
||||||
|
|
||||||
/* Remove associated tracks */
|
/* Remove associated tracks */
|
||||||
self::prune_tracks();
|
self::prune_tracks();
|
||||||
|
@ -293,7 +286,7 @@ class Tmp_Playlist extends database_object
|
||||||
"ON `session`.`id`=`tmp_playlist`.`session` " .
|
"ON `session`.`id`=`tmp_playlist`.`session` " .
|
||||||
"WHERE `session`.`id` IS NULL " .
|
"WHERE `session`.`id` IS NULL " .
|
||||||
"AND `tmp_playlist`.`type` != 'vote'";
|
"AND `tmp_playlist`.`type` != 'vote'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -311,7 +304,7 @@ class Tmp_Playlist extends database_object
|
||||||
"`tmp_playlist_data` LEFT JOIN `tmp_playlist` ON " .
|
"`tmp_playlist_data` LEFT JOIN `tmp_playlist` ON " .
|
||||||
"`tmp_playlist_data`.`tmp_playlist`=`tmp_playlist`.`id` " .
|
"`tmp_playlist_data`.`tmp_playlist`=`tmp_playlist`.`id` " .
|
||||||
"WHERE `tmp_playlist`.`id` IS NULL";
|
"WHERE `tmp_playlist`.`id` IS NULL";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
} // prune_tracks
|
} // prune_tracks
|
||||||
|
|
||||||
|
@ -325,7 +318,7 @@ class Tmp_Playlist extends database_object
|
||||||
$sql = "INSERT INTO `tmp_playlist_data` " .
|
$sql = "INSERT INTO `tmp_playlist_data` " .
|
||||||
"(`object_id`,`tmp_playlist`,`object_type`) " .
|
"(`object_id`,`tmp_playlist`,`object_type`) " .
|
||||||
" VALUES (?, ?, ?)";
|
" VALUES (?, ?, ?)";
|
||||||
$db_results = Dba::write($sql, array($object_id, $this->id, $object_type));
|
Dba::write($sql, array($object_id, $this->id, $object_type));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -353,7 +346,7 @@ class Tmp_Playlist extends database_object
|
||||||
{
|
{
|
||||||
/* delete the track its self */
|
/* delete the track its self */
|
||||||
$sql = "DELETE FROM `tmp_playlist_data` WHERE `id` = ?";
|
$sql = "DELETE FROM `tmp_playlist_data` WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($id));
|
Dba::write($sql, array($id));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class UI
|
||||||
private static $_ticker;
|
private static $_ticker;
|
||||||
private static $_icon_cache;
|
private static $_icon_cache;
|
||||||
|
|
||||||
public function __construct($data)
|
public function __construct()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ END;
|
||||||
|
|
||||||
$icon_url = self::_find_icon($name);
|
$icon_url = self::_find_icon($name);
|
||||||
if (isset($hover_name)) {
|
if (isset($hover_name)) {
|
||||||
$hover_url = self::_find_icon($hover_text);
|
$hover_url = self::_find_icon($hover_name);
|
||||||
}
|
}
|
||||||
if ($bUseSprite) {
|
if ($bUseSprite) {
|
||||||
$tag = '<span class="sprite sprite-icon_'.$name.'"';
|
$tag = '<span class="sprite sprite-icon_'.$name.'"';
|
||||||
|
@ -232,7 +232,7 @@ END;
|
||||||
$tag .= 'alt="' . $title . '" ';
|
$tag .= 'alt="' . $title . '" ';
|
||||||
$tag .= 'title="' . $title . '" ';
|
$tag .= 'title="' . $title . '" ';
|
||||||
|
|
||||||
if (isset($hover_name)) {
|
if (isset($hover_name) && isset($hover_url)) {
|
||||||
$tag .= 'onmouseover="this.src=\'' . $hover_url . '\'; return true;"';
|
$tag .= 'onmouseover="this.src=\'' . $hover_url . '\'; return true;"';
|
||||||
$tag .= 'onmouseout="this.src=\'' . $icon_url . '\'; return true;" ';
|
$tag .= 'onmouseout="this.src=\'' . $icon_url . '\'; return true;" ';
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ class Update
|
||||||
*/
|
*/
|
||||||
public static function get_version()
|
public static function get_version()
|
||||||
{
|
{
|
||||||
|
$version = "";
|
||||||
/* Make sure that update_info exits */
|
/* Make sure that update_info exits */
|
||||||
$sql = "SHOW TABLES LIKE 'update_info'";
|
$sql = "SHOW TABLES LIKE 'update_info'";
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
|
@ -67,7 +68,6 @@ class Update
|
||||||
if (!Dba::num_rows($db_results)) {
|
if (!Dba::num_rows($db_results)) {
|
||||||
// They can't upgrade, they are too old
|
// They can't upgrade, they are too old
|
||||||
header("Location: test.php");
|
header("Location: test.php");
|
||||||
|
|
||||||
} // if table isn't found
|
} // if table isn't found
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
@ -459,13 +459,11 @@ class Update
|
||||||
{
|
{
|
||||||
/* Nuke All Active session before we start the mojo */
|
/* Nuke All Active session before we start the mojo */
|
||||||
$sql = "TRUNCATE session";
|
$sql = "TRUNCATE session";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Prevent the script from timing out, which could be bad
|
// Prevent the script from timing out, which could be bad
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
$methods = array();
|
|
||||||
|
|
||||||
$current_version = self::get_version();
|
$current_version = self::get_version();
|
||||||
|
|
||||||
// Run a check to make sure that they don't try to upgrade from a version that
|
// Run a check to make sure that they don't try to upgrade from a version that
|
||||||
|
@ -870,13 +868,13 @@ class Update
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM `preference` WHERE `name`='localplay_mpd_hostname' OR `name`='localplay_mpd_port' " .
|
$sql = "DELETE FROM `preference` WHERE `name`='localplay_mpd_hostname' OR `name`='localplay_mpd_port' " .
|
||||||
"OR `name`='direct_link' OR `name`='localplay_mpd_password' OR `name`='catalog_echo_count'";
|
"OR `name`='direct_link' OR `name`='localplay_mpd_password' OR `name`='catalog_echo_count'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "UPDATE `preference` SET `description`='Localplay Access' WHERE `name`='localplay_level'";
|
$sql = "UPDATE `preference` SET `description`='Localplay Access' WHERE `name`='localplay_level'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "UPDATE `access_list` SET `type`='rpc' WHERE `type`='xml-rpc'";
|
$sql = "UPDATE `access_list` SET `type`='rpc' WHERE `type`='xml-rpc'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// We're not manipulating the structure, so we'll pretend it always works
|
// We're not manipulating the structure, so we'll pretend it always works
|
||||||
return true;
|
return true;
|
||||||
|
@ -944,7 +942,7 @@ class Update
|
||||||
$rating = Dba::escape($row['rating']);
|
$rating = Dba::escape($row['rating']);
|
||||||
$id = Dba::escape($row['id']);
|
$id = Dba::escape($row['id']);
|
||||||
$sql = "UPDATE `rating` SET `rating`='$rating' WHERE `id`='$id'";
|
$sql = "UPDATE `rating` SET `rating`='$rating' WHERE `id`='$id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $retval;
|
return $retval;
|
||||||
|
@ -1442,7 +1440,7 @@ class Update
|
||||||
"', '" . $row['art_mime'] .
|
"', '" . $row['art_mime'] .
|
||||||
"', 'original', '" . $type . "', '" .
|
"', 'original', '" . $type . "', '" .
|
||||||
$row['object_id'] . "')";
|
$row['object_id'] . "')";
|
||||||
$db_other_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
}
|
}
|
||||||
$sql = "DROP TABLE `" . $type . "_data`";
|
$sql = "DROP TABLE `" . $type . "_data`";
|
||||||
$retval = Dba::write($sql) ? $retval : false;
|
$retval = Dba::write($sql) ? $retval : false;
|
||||||
|
@ -1746,10 +1744,10 @@ class Update
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "ALTER TABLE `catalog` DROP `path`, DROP `remote_username`, DROP `remote_password`";
|
$sql = "ALTER TABLE `catalog` DROP `path`, DROP `remote_username`, DROP `remote_password`";
|
||||||
$retval = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "ALTER TABLE `catalog` MODIFY COLUMN `catalog_type` varchar(128)";
|
$sql = "ALTER TABLE `catalog` MODIFY COLUMN `catalog_type` varchar(128)";
|
||||||
$retval = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "UPDATE `artist` SET `mbid` = null WHERE `mbid` = ''";
|
$sql = "UPDATE `artist` SET `mbid` = null WHERE `mbid` = ''";
|
||||||
Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
@ -1775,14 +1773,14 @@ class Update
|
||||||
|
|
||||||
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
|
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
|
||||||
"VALUES ('song_page_title','1','Show current song in Web player page title',25,'boolean','interface')";
|
"VALUES ('song_page_title','1','Show current song in Web player page title',25,'boolean','interface')";
|
||||||
$retval = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$id = Dba::insert_id();
|
$id = Dba::insert_id();
|
||||||
|
|
||||||
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')";
|
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')";
|
||||||
$retval = Dba::write($sql, array($id));
|
Dba::write($sql, array($id));
|
||||||
|
|
||||||
return $retval;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,6 +45,17 @@ class User extends database_object
|
||||||
|
|
||||||
// Constructed variables
|
// Constructed variables
|
||||||
public $prefs = array();
|
public $prefs = array();
|
||||||
|
public $playlist;
|
||||||
|
|
||||||
|
public $f_last_seen;
|
||||||
|
public $f_create_date;
|
||||||
|
public $link;
|
||||||
|
public $f_link;
|
||||||
|
public $f_useage;
|
||||||
|
public $ip_history;
|
||||||
|
public $f_avatar;
|
||||||
|
public $f_avatar_mini;
|
||||||
|
public $f_avatar_medium;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -202,6 +213,7 @@ class User extends database_object
|
||||||
*/
|
*/
|
||||||
public static function get_from_email($email)
|
public static function get_from_email($email)
|
||||||
{
|
{
|
||||||
|
$user = null;
|
||||||
$sql = "SELECT `id` FROM `user` WHERE `email` = ?";
|
$sql = "SELECT `id` FROM `user` WHERE `email` = ?";
|
||||||
$db_results = Dba::read($sql, array($email));
|
$db_results = Dba::read($sql, array($email));
|
||||||
if ($results = Dba::fetch_assoc($db_results)) {
|
if ($results = Dba::fetch_assoc($db_results)) {
|
||||||
|
@ -239,9 +251,10 @@ class User extends database_object
|
||||||
return parent::get_from_cache('user_catalog',$this->id);
|
return parent::get_from_cache('user_catalog',$this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT * FROM `user_catalog` WHERE `user`='$user_id'";
|
$sql = "SELECT * FROM `user_catalog` WHERE `user` = ?";
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql, array($this->id));
|
||||||
|
|
||||||
|
$catalogs = array();
|
||||||
while ($row = Dba::fetch_assoc($db_results)) {
|
while ($row = Dba::fetch_assoc($db_results)) {
|
||||||
$catalogs[] = $row['catalog'];
|
$catalogs[] = $row['catalog'];
|
||||||
}
|
}
|
||||||
|
@ -266,11 +279,10 @@ class User extends database_object
|
||||||
// Fill out the user id
|
// Fill out the user id
|
||||||
$user_id = $system ? Dba::escape(-1) : Dba::escape($this->id);
|
$user_id = $system ? Dba::escape(-1) : Dba::escape($this->id);
|
||||||
|
|
||||||
|
$user_limit = "";
|
||||||
if (!$system) {
|
if (!$system) {
|
||||||
$user_limit = "AND preference.catagory != 'system'";
|
$user_limit = "AND preference.catagory != 'system'";
|
||||||
}
|
} else if ($type != '0') {
|
||||||
|
|
||||||
if ($type != '0') {
|
|
||||||
$user_limit = "AND preference.catagory = '" . Dba::escape($type) . "'";
|
$user_limit = "AND preference.catagory = '" . Dba::escape($type) . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +293,7 @@ class User extends database_object
|
||||||
" ORDER BY preference.catagory, preference.description";
|
" ORDER BY preference.catagory, preference.description";
|
||||||
|
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
|
$results = array();
|
||||||
/* Ok this is crapy, need to clean this up or improve the code FIXME */
|
/* Ok this is crapy, need to clean this up or improve the code FIXME */
|
||||||
while ($r = Dba::fetch_assoc($db_results)) {
|
while ($r = Dba::fetch_assoc($db_results)) {
|
||||||
$type = $r['catagory'];
|
$type = $r['catagory'];
|
||||||
|
@ -319,8 +331,6 @@ class User extends database_object
|
||||||
*/
|
*/
|
||||||
public function get_favorites($type)
|
public function get_favorites($type)
|
||||||
{
|
{
|
||||||
$web_path = AmpConfig::get('web_path');
|
|
||||||
|
|
||||||
$results = Stats::get_user(AmpConfig::get('popular_threshold'),$type,$this->id,1);
|
$results = Stats::get_user(AmpConfig::get('popular_threshold'),$type,$this->id,1);
|
||||||
|
|
||||||
$items = array();
|
$items = array();
|
||||||
|
@ -523,7 +533,7 @@ class User extends database_object
|
||||||
{
|
{
|
||||||
$sql = "UPDATE `user` SET `username` = ? WHERE `id` = ?";
|
$sql = "UPDATE `user` SET `username` = ? WHERE `id` = ?";
|
||||||
$this->username = $new_username;
|
$this->username = $new_username;
|
||||||
$db_results = Dba::write($sql, array($new_username, $this->id));
|
Dba::write($sql, array($new_username, $this->id));
|
||||||
|
|
||||||
} // update_username
|
} // update_username
|
||||||
|
|
||||||
|
@ -550,7 +560,7 @@ class User extends database_object
|
||||||
public function update_fullname($new_fullname)
|
public function update_fullname($new_fullname)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE `user` SET `fullname` = ? WHERE `id` = ?";
|
$sql = "UPDATE `user` SET `fullname` = ? WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($new_fullname, $this->id));
|
Dba::write($sql, array($new_fullname, $this->id));
|
||||||
|
|
||||||
} // update_fullname
|
} // update_fullname
|
||||||
|
|
||||||
|
@ -561,7 +571,7 @@ class User extends database_object
|
||||||
public function update_email($new_email)
|
public function update_email($new_email)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE `user` SET `email` = ? WHERE `id` = ?";
|
$sql = "UPDATE `user` SET `email` = ? WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($new_email, $this->id));
|
Dba::write($sql, array($new_email, $this->id));
|
||||||
|
|
||||||
} // update_email
|
} // update_email
|
||||||
|
|
||||||
|
@ -573,7 +583,7 @@ class User extends database_object
|
||||||
{
|
{
|
||||||
$new_website = rtrim($new_website, "/");
|
$new_website = rtrim($new_website, "/");
|
||||||
$sql = "UPDATE `user` SET `website` = ? WHERE `id` = ?";
|
$sql = "UPDATE `user` SET `website` = ? WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($new_website, $this->id));
|
Dba::write($sql, array($new_website, $this->id));
|
||||||
|
|
||||||
} // update_website
|
} // update_website
|
||||||
|
|
||||||
|
@ -584,7 +594,7 @@ class User extends database_object
|
||||||
public function update_apikey($new_apikey)
|
public function update_apikey($new_apikey)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE `user` SET `apikey` = ? WHERE `id` = ?";
|
$sql = "UPDATE `user` SET `apikey` = ? WHERE `id` = ?";
|
||||||
$db_results = Dba::write($sql, array($new_apikey, $this->id));
|
Dba::write($sql, array($new_apikey, $this->id));
|
||||||
|
|
||||||
} // update_website
|
} // update_website
|
||||||
|
|
||||||
|
@ -624,11 +634,11 @@ class User extends database_object
|
||||||
if (!Dba::num_rows($db_results)) { return false; }
|
if (!Dba::num_rows($db_results)) { return false; }
|
||||||
|
|
||||||
$sql = "UPDATE `user` SET `disabled`='1' WHERE id='" . $this->id . "'";
|
$sql = "UPDATE `user` SET `disabled`='1' WHERE id='" . $this->id . "'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Delete any sessions they may have
|
// Delete any sessions they may have
|
||||||
$sql = "DELETE FROM `session` WHERE `username`='" . Dba::escape($this->username) . "'";
|
$sql = "DELETE FROM `session` WHERE `username`='" . Dba::escape($this->username) . "'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -641,7 +651,7 @@ class User extends database_object
|
||||||
public function enable()
|
public function enable()
|
||||||
{
|
{
|
||||||
$sql = "UPDATE `user` SET `disabled`='0' WHERE id='" . $this->id . "'";
|
$sql = "UPDATE `user` SET `disabled`='0' WHERE id='" . $this->id . "'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -662,7 +672,7 @@ class User extends database_object
|
||||||
|
|
||||||
$new_access = Dba::escape($new_access);
|
$new_access = Dba::escape($new_access);
|
||||||
$sql = "UPDATE `user` SET `access`='$new_access' WHERE `id`='$this->id'";
|
$sql = "UPDATE `user` SET `access`='$new_access' WHERE `id`='$this->id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
} // update_access
|
} // update_access
|
||||||
|
|
||||||
|
@ -673,7 +683,7 @@ class User extends database_object
|
||||||
public function update_last_seen()
|
public function update_last_seen()
|
||||||
{
|
{
|
||||||
$sql = "UPDATE user SET last_seen='" . time() . "' WHERE `id`='$this->id'";
|
$sql = "UPDATE user SET last_seen='" . time() . "' WHERE `id`='$this->id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
} // update_last_seen
|
} // update_last_seen
|
||||||
|
|
||||||
|
@ -722,7 +732,7 @@ class User extends database_object
|
||||||
if ($plugin->load($user)) {
|
if ($plugin->load($user)) {
|
||||||
$plugin->_plugin->save_songplay($song_info);
|
$plugin->_plugin->save_songplay($song_info);
|
||||||
}
|
}
|
||||||
} catch (Exeption $e) {
|
} catch (Exception $e) {
|
||||||
debug_event('user.class.php', 'Stats plugin error: ' . $e->getMessage(), '1');
|
debug_event('user.class.php', 'Stats plugin error: ' . $e->getMessage(), '1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -749,13 +759,13 @@ class User extends database_object
|
||||||
$agent = Dba::escape($_SERVER['HTTP_USER_AGENT']);
|
$agent = Dba::escape($_SERVER['HTTP_USER_AGENT']);
|
||||||
|
|
||||||
$sql = "INSERT INTO `ip_history` (`ip`,`user`,`date`,`agent`) VALUES ('$ip','$user','$date','$agent')";
|
$sql = "INSERT INTO `ip_history` (`ip`,`user`,`date`,`agent`) VALUES ('$ip','$user','$date','$agent')";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
/* Clean up old records... sometimes */
|
/* Clean up old records... sometimes */
|
||||||
if (rand(1,100) > 60) {
|
if (rand(1,100) > 60) {
|
||||||
$date = time() - (86400*AmpConfig::get('user_ip_cardinality'));
|
$date = time() - (86400*AmpConfig::get('user_ip_cardinality'));
|
||||||
$sql = "DELETE FROM `ip_history` WHERE `date` < $date";
|
$sql = "DELETE FROM `ip_history` WHERE `date` < $date";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -838,6 +848,7 @@ class User extends database_object
|
||||||
"WHERE `object_count`.`user`='$this->id' AND `object_count`.`object_type`='song'";
|
"WHERE `object_count`.`user`='$this->id' AND `object_count`.`object_type`='song'";
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
|
|
||||||
|
$total = 0;
|
||||||
while ($r = Dba::fetch_assoc($db_results)) {
|
while ($r = Dba::fetch_assoc($db_results)) {
|
||||||
$total = $total + $r['size'];
|
$total = $total + $r['size'];
|
||||||
}
|
}
|
||||||
|
@ -864,41 +875,6 @@ class User extends database_object
|
||||||
|
|
||||||
} // format_user
|
} // format_user
|
||||||
|
|
||||||
/**
|
|
||||||
* format_recommendations
|
|
||||||
* This takes an array of [object_id] = ratings
|
|
||||||
* and displays them in a semi-pretty format
|
|
||||||
*/
|
|
||||||
function format_recommendations($items,$type)
|
|
||||||
{
|
|
||||||
foreach ($items as $object_id=>$rating) {
|
|
||||||
|
|
||||||
switch ($type) {
|
|
||||||
case 'artist':
|
|
||||||
$object = new Artist($object_id);
|
|
||||||
$object->format_artist();
|
|
||||||
$name = $object->link;
|
|
||||||
break;
|
|
||||||
case 'album':
|
|
||||||
$object = new Album($object_id);
|
|
||||||
$object->format_album();
|
|
||||||
$name = $object->f_link;
|
|
||||||
break;
|
|
||||||
case 'song':
|
|
||||||
$object = new Song($object_id);
|
|
||||||
$object->format_song();
|
|
||||||
$name = $object->f_link;
|
|
||||||
break;
|
|
||||||
} // end switch on type
|
|
||||||
$results[] = "<li>$name -- " . get_rating_name($rating) . "<br />\n</li>";
|
|
||||||
|
|
||||||
} // end foreach items
|
|
||||||
|
|
||||||
|
|
||||||
return $results;
|
|
||||||
|
|
||||||
} // format_recommendations
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* access_name_to_level
|
* access_name_to_level
|
||||||
* This takes the access name for the user and returns the level
|
* This takes the access name for the user and returns the level
|
||||||
|
@ -908,23 +884,16 @@ class User extends database_object
|
||||||
switch ($level) {
|
switch ($level) {
|
||||||
case 'admin':
|
case 'admin':
|
||||||
return '100';
|
return '100';
|
||||||
break;
|
|
||||||
case 'user':
|
case 'user':
|
||||||
return '25';
|
return '25';
|
||||||
break;
|
|
||||||
case 'manager':
|
case 'manager':
|
||||||
return '75';
|
return '75';
|
||||||
break;
|
|
||||||
case 'guest':
|
case 'guest':
|
||||||
return '5';
|
return '5';
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return '0';
|
return '0';
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} // access_name_to_level
|
} // access_name_to_level
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -951,7 +920,7 @@ class User extends database_object
|
||||||
$r['value'] = Dba::escape($r['value']);
|
$r['value'] = Dba::escape($r['value']);
|
||||||
$sql = "DELETE FROM `user_preference` WHERE `user`='$user_id' AND `preference`='" . $r['preference'] . "' AND" .
|
$sql = "DELETE FROM `user_preference` WHERE `user`='$user_id' AND `preference`='" . $r['preference'] . "' AND" .
|
||||||
" `value`='" . Dba::escape($r['value']) . "'";
|
" `value`='" . Dba::escape($r['value']) . "'";
|
||||||
$delete_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
} // if its set
|
} // if its set
|
||||||
else {
|
else {
|
||||||
$results[$pref_id] = 1;
|
$results[$pref_id] = 1;
|
||||||
|
@ -990,7 +959,7 @@ class User extends database_object
|
||||||
}
|
}
|
||||||
$value = Dba::escape($r['value']);
|
$value = Dba::escape($r['value']);
|
||||||
$sql = "INSERT INTO user_preference (`user`,`preference`,`value`) VALUES ('$user_id','$key','$value')";
|
$sql = "INSERT INTO user_preference (`user`,`preference`,`value`) VALUES ('$user_id','$key','$value')";
|
||||||
$insert_db = Dba::write($sql);
|
Dba::write($sql);
|
||||||
}
|
}
|
||||||
} // while preferences
|
} // while preferences
|
||||||
|
|
||||||
|
@ -1008,7 +977,7 @@ class User extends database_object
|
||||||
|
|
||||||
foreach ($results as $data) {
|
foreach ($results as $data) {
|
||||||
$sql = "DELETE FROM user_preference WHERE user='$data'";
|
$sql = "DELETE FROM user_preference WHERE user='$data'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // fix_preferences
|
} // fix_preferences
|
||||||
|
@ -1034,56 +1003,56 @@ class User extends database_object
|
||||||
|
|
||||||
// Delete their playlists
|
// Delete their playlists
|
||||||
$sql = "DELETE FROM `playlist` WHERE `user`='$this->id'";
|
$sql = "DELETE FROM `playlist` WHERE `user`='$this->id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Clean up the playlist data table
|
// Clean up the playlist data table
|
||||||
$sql = "DELETE FROM `playlist_data` USING `playlist_data` " .
|
$sql = "DELETE FROM `playlist_data` USING `playlist_data` " .
|
||||||
"LEFT JOIN `playlist` ON `playlist`.`id`=`playlist_data`.`playlist` " .
|
"LEFT JOIN `playlist` ON `playlist`.`id`=`playlist_data`.`playlist` " .
|
||||||
"WHERE `playlist`.`id` IS NULL";
|
"WHERE `playlist`.`id` IS NULL";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Delete any stats they have
|
// Delete any stats they have
|
||||||
$sql = "DELETE FROM `object_count` WHERE `user`='$this->id'";
|
$sql = "DELETE FROM `object_count` WHERE `user`='$this->id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Clear the IP history for this user
|
// Clear the IP history for this user
|
||||||
$sql = "DELETE FROM `ip_history` WHERE `user`='$this->id'";
|
$sql = "DELETE FROM `ip_history` WHERE `user`='$this->id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Nuke any access lists that are specific to this user
|
// Nuke any access lists that are specific to this user
|
||||||
$sql = "DELETE FROM `access_list` WHERE `user`='$this->id'";
|
$sql = "DELETE FROM `access_list` WHERE `user`='$this->id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Delete their ratings
|
// Delete their ratings
|
||||||
$sql = "DELETE FROM `rating` WHERE `user`='$this->id'";
|
$sql = "DELETE FROM `rating` WHERE `user`='$this->id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Delete their tags
|
// Delete their tags
|
||||||
$sql = "DELETE FROM `tag_map` WHERE `user`='$this->id'";
|
$sql = "DELETE FROM `tag_map` WHERE `user`='$this->id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Clean out the tags
|
// Clean out the tags
|
||||||
$sql = "DELETE FROM `tags` USING `tag_map` LEFT JOIN `tag_map` ON tag_map.id=tags.map_id AND tag_map.id IS NULL";
|
$sql = "DELETE FROM `tags` USING `tag_map` LEFT JOIN `tag_map` ON tag_map.id=tags.map_id AND tag_map.id IS NULL";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Delete their preferences
|
// Delete their preferences
|
||||||
$sql = "DELETE FROM `user_preference` WHERE `user`='$this->id'";
|
$sql = "DELETE FROM `user_preference` WHERE `user`='$this->id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Delete their voted stuff in democratic play
|
// Delete their voted stuff in democratic play
|
||||||
$sql = "DELETE FROM `user_vote` WHERE `user`='$this->id'";
|
$sql = "DELETE FROM `user_vote` WHERE `user`='$this->id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Delete their shoutbox posts
|
// Delete their shoutbox posts
|
||||||
$sql = "DELETE FROM `user_shout` WHERE `user='$this->id'";
|
$sql = "DELETE FROM `user_shout` WHERE `user='$this->id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
// Delete the user itself
|
// Delete the user itself
|
||||||
$sql = "DELETE FROM `user` WHERE `id`='$this->id'";
|
$sql = "DELETE FROM `user` WHERE `id`='$this->id'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
$sql = "DELETE FROM `session` WHERE `username`='" . Dba::escape($this->username) . "'";
|
$sql = "DELETE FROM `session` WHERE `username`='" . Dba::escape($this->username) . "'";
|
||||||
$db_results = Dba::write($sql);
|
Dba::write($sql);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1107,10 +1076,8 @@ class User extends database_object
|
||||||
*/
|
*/
|
||||||
public static function get_validation($username)
|
public static function get_validation($username)
|
||||||
{
|
{
|
||||||
$usename = Dba::escape($username);
|
$sql = "SELECT `validation` FROM `user` WHERE `username` = ?";
|
||||||
|
$db_results = Dba::read($sql, array($username));
|
||||||
$sql = "SELECT `validation` FROM `user` WHERE `username`='$username'";
|
|
||||||
$db_results = Dba::read($sql);
|
|
||||||
|
|
||||||
$row = Dba::fetch_assoc($db_results);
|
$row = Dba::fetch_assoc($db_results);
|
||||||
|
|
||||||
|
@ -1131,6 +1098,7 @@ class User extends database_object
|
||||||
"ORDER BY `date` DESC LIMIT $limit";
|
"ORDER BY `date` DESC LIMIT $limit";
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
|
|
||||||
|
$results = array();
|
||||||
while ($row = Dba::fetch_assoc($db_results)) {
|
while ($row = Dba::fetch_assoc($db_results)) {
|
||||||
$results[] = $row['object_id'];
|
$results[] = $row['object_id'];
|
||||||
}
|
}
|
||||||
|
@ -1153,6 +1121,7 @@ class User extends database_object
|
||||||
if ($count < 1) { $count = '1'; }
|
if ($count < 1) { $count = '1'; }
|
||||||
$limit_sql = "LIMIT " . intval($count);
|
$limit_sql = "LIMIT " . intval($count);
|
||||||
|
|
||||||
|
$group_sql = "";
|
||||||
if ($distinct) { $group_sql = "GROUP BY `ip`"; }
|
if ($distinct) { $group_sql = "GROUP BY `ip`"; }
|
||||||
|
|
||||||
/* Select ip history */
|
/* Select ip history */
|
||||||
|
@ -1236,7 +1205,7 @@ class User extends database_object
|
||||||
$username = Dba::escape($username);
|
$username = Dba::escape($username);
|
||||||
|
|
||||||
$sql = "UPDATE `user` SET `disabled`='0' WHERE `username` = ?";
|
$sql = "UPDATE `user` SET `disabled`='0' WHERE `username` = ?";
|
||||||
$db_results = Dba::write($sql, array($username));
|
Dba::write($sql, array($username));
|
||||||
|
|
||||||
} // activate_user
|
} // activate_user
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ class Userflag extends database_object
|
||||||
if (!isset($userflags[$id])) {
|
if (!isset($userflags[$id])) {
|
||||||
$userflag = 0;
|
$userflag = 0;
|
||||||
} else {
|
} else {
|
||||||
$userflag = intval($user_ratings[$id]);
|
$userflag = intval($userflags[$id]);
|
||||||
}
|
}
|
||||||
parent::add_to_cache('userflag_' . $type . '_user' . $user_id, $id, $userflag);
|
parent::add_to_cache('userflag_' . $type . '_user' . $user_id, $id, $userflag);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ class Userflag extends database_object
|
||||||
$db_results = Dba::read($sql, array($user_id, $this->id, $this->type));
|
$db_results = Dba::read($sql, array($user_id, $this->id, $this->type));
|
||||||
|
|
||||||
$flagged = false;
|
$flagged = false;
|
||||||
if ($results = Dba::fetch_assoc($db_results)) {
|
if (Dba::fetch_assoc($db_results)) {
|
||||||
$flagged = true;
|
$flagged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ class Userflag extends database_object
|
||||||
"VALUES (?, ?, ?, ?)";
|
"VALUES (?, ?, ?, ?)";
|
||||||
$params = array($this->id, $this->type, $user_id, time());
|
$params = array($this->id, $this->type, $user_id, time());
|
||||||
}
|
}
|
||||||
$db_results = Dba::write($sql, $params);
|
Dba::write($sql, $params);
|
||||||
|
|
||||||
parent::add_to_cache('userflag_' . $this->type . '_user' . $user_id, $this->id, $flagged);
|
parent::add_to_cache('userflag_' . $this->type . '_user' . $user_id, $this->id, $flagged);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ class vainfo
|
||||||
public $filename = '';
|
public $filename = '';
|
||||||
public $type = '';
|
public $type = '';
|
||||||
public $tags = array();
|
public $tags = array();
|
||||||
|
public $islocal;
|
||||||
|
|
||||||
protected $_raw = array();
|
protected $_raw = array();
|
||||||
protected $_getID3 = '';
|
protected $_getID3 = '';
|
||||||
|
@ -106,6 +107,7 @@ class vainfo
|
||||||
if ($encoding_id3v1) {
|
if ($encoding_id3v1) {
|
||||||
$this->encoding_id3v1 = $encoding_id3v1;
|
$this->encoding_id3v1 = $encoding_id3v1;
|
||||||
} else {
|
} else {
|
||||||
|
$tags = array();
|
||||||
foreach ($test_tags as $tag) {
|
foreach ($test_tags as $tag) {
|
||||||
if ($value = $this->_raw['id3v1'][$tag]) {
|
if ($value = $this->_raw['id3v1'][$tag]) {
|
||||||
$tags[$tag] = $value;
|
$tags[$tag] = $value;
|
||||||
|
@ -117,6 +119,7 @@ class vainfo
|
||||||
|
|
||||||
if (AmpConfig::get('getid3_detect_id3v2_encoding')) {
|
if (AmpConfig::get('getid3_detect_id3v2_encoding')) {
|
||||||
// The user has told us to be moronic, so let's do that thing
|
// The user has told us to be moronic, so let's do that thing
|
||||||
|
$tags = array();
|
||||||
foreach ($test_tags as $tag) {
|
foreach ($test_tags as $tag) {
|
||||||
if ($value = $this->_raw['id3v2']['comments'][$tag]) {
|
if ($value = $this->_raw['id3v2']['comments'][$tag]) {
|
||||||
$tags[$tag] = $value;
|
$tags[$tag] = $value;
|
||||||
|
@ -154,6 +157,7 @@ class vainfo
|
||||||
|
|
||||||
debug_event('vainfo', 'encoding detection: ' . json_encode($encodings), 5);
|
debug_event('vainfo', 'encoding detection: ' . json_encode($encodings), 5);
|
||||||
$high = 0;
|
$high = 0;
|
||||||
|
$encoding = '';
|
||||||
foreach ($encodings as $key => $value) {
|
foreach ($encodings as $key => $value) {
|
||||||
if ($value > $high) {
|
if ($value > $high) {
|
||||||
$encoding = $key;
|
$encoding = $key;
|
||||||
|
@ -189,7 +193,7 @@ class vainfo
|
||||||
try {
|
try {
|
||||||
$this->_raw = $this->_getID3->analyze(Core::conv_lc_file($this->filename));
|
$this->_raw = $this->_getID3->analyze(Core::conv_lc_file($this->filename));
|
||||||
} catch (Exception $error) {
|
} catch (Exception $error) {
|
||||||
debug_event('getID2', 'Unable to catalog file: ' . $error->message, 1);
|
debug_event('getID2', 'Unable to catalog file: ' . $error->getMessage(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,10 +497,8 @@ class vainfo
|
||||||
case 'mp2':
|
case 'mp2':
|
||||||
case 'mpeg3':
|
case 'mpeg3':
|
||||||
return 'mp3';
|
return 'mp3';
|
||||||
break;
|
|
||||||
case 'vorbis':
|
case 'vorbis':
|
||||||
return 'ogg';
|
return 'ogg';
|
||||||
break;
|
|
||||||
case 'flac':
|
case 'flac':
|
||||||
case 'flv':
|
case 'flv':
|
||||||
case 'mpg':
|
case 'mpg':
|
||||||
|
@ -510,7 +512,6 @@ class vainfo
|
||||||
/* Log the fact that we couldn't figure it out */
|
/* Log the fact that we couldn't figure it out */
|
||||||
debug_event('vainfo','Unable to determine file type from ' . $type . ' on file ' . $this->filename,'5');
|
debug_event('vainfo','Unable to determine file type from ' . $type . ' on file ' . $this->filename,'5');
|
||||||
return $type;
|
return $type;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,6 +810,7 @@ class vainfo
|
||||||
// Pull out our actual matches
|
// Pull out our actual matches
|
||||||
preg_match($pattern, $filename, $matches);
|
preg_match($pattern, $filename, $matches);
|
||||||
|
|
||||||
|
if ($matches != null) {
|
||||||
// The first element is the full match text
|
// The first element is the full match text
|
||||||
$matched = array_shift($matches);
|
$matched = array_shift($matches);
|
||||||
debug_event('vainfo', $pattern . ' matched ' . $matched . ' on ' . $filename, 5);
|
debug_event('vainfo', $pattern . ' matched ' . $matched . ' on ' . $filename, 5);
|
||||||
|
@ -825,6 +827,7 @@ class vainfo
|
||||||
if ($this->islocal) {
|
if ($this->islocal) {
|
||||||
$results['size'] = filesize(Core::conv_lc_file($origin));
|
$results['size'] = filesize(Core::conv_lc_file($origin));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,20 @@ class Video extends database_object implements media
|
||||||
public $enabled;
|
public $enabled;
|
||||||
public $file;
|
public $file;
|
||||||
public $size;
|
public $size;
|
||||||
|
public $video_codec;
|
||||||
|
public $audio_codec;
|
||||||
|
public $resolution_x;
|
||||||
|
public $resolution_y;
|
||||||
|
public $time;
|
||||||
|
public $mime;
|
||||||
|
|
||||||
|
public $tags;
|
||||||
|
public $f_title;
|
||||||
|
public $f_link;
|
||||||
|
public $f_codec;
|
||||||
|
public $f_resolution;
|
||||||
|
public $f_tags;
|
||||||
|
public $f_length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|
|
@ -30,6 +30,16 @@ class Wanted extends database_object
|
||||||
public $mbid;
|
public $mbid;
|
||||||
public $artist;
|
public $artist;
|
||||||
public $artist_mbid;
|
public $artist_mbid;
|
||||||
|
public $name;
|
||||||
|
public $year;
|
||||||
|
public $accepted;
|
||||||
|
public $release_mbid;
|
||||||
|
public $user;
|
||||||
|
|
||||||
|
public $f_name_link;
|
||||||
|
public $f_artist_link;
|
||||||
|
public $f_user;
|
||||||
|
public $songs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -68,6 +78,7 @@ class Wanted extends database_object
|
||||||
}
|
}
|
||||||
|
|
||||||
$owngroups = array();
|
$owngroups = array();
|
||||||
|
$wartist = array();
|
||||||
if ($artist) {
|
if ($artist) {
|
||||||
$albums = $artist->get_albums();
|
$albums = $artist->get_albums();
|
||||||
foreach ($albums as $id) {
|
foreach ($albums as $id) {
|
||||||
|
@ -82,7 +93,6 @@ class Wanted extends database_object
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$wartist = array();
|
|
||||||
$wartist['mbid'] = $mbid;
|
$wartist['mbid'] = $mbid;
|
||||||
$wartist['name'] = $martist->name;
|
$wartist['name'] = $martist->name;
|
||||||
parent::add_to_cache('missing_artist', $mbid, $wartist);
|
parent::add_to_cache('missing_artist', $mbid, $wartist);
|
||||||
|
|
|
@ -77,6 +77,7 @@ class Waveform
|
||||||
$catalog = Catalog::create_from_id($song->catalog);
|
$catalog = Catalog::create_from_id($song->catalog);
|
||||||
if ($catalog->get_type() == 'local') {
|
if ($catalog->get_type() == 'local') {
|
||||||
$transcode_to = 'wav';
|
$transcode_to = 'wav';
|
||||||
|
$transcode_cfg = AmpConfig::get('transcode');
|
||||||
$valid_types = $song->get_stream_types();
|
$valid_types = $song->get_stream_types();
|
||||||
|
|
||||||
if ($song->type != $transcode_to) {
|
if ($song->type != $transcode_to) {
|
||||||
|
@ -231,6 +232,9 @@ class Waveform
|
||||||
$temp = chr((ord($bytes[1]) & 127) + $temp);
|
$temp = chr((ord($bytes[1]) & 127) + $temp);
|
||||||
$data = floor(self::findValues($bytes[0], $temp) / 256);
|
$data = floor(self::findValues($bytes[0], $temp) / 256);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
$data = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip bytes for memory optimization
|
// skip bytes for memory optimization
|
||||||
|
|
|
@ -24,7 +24,7 @@ class WebPlayer
|
||||||
{
|
{
|
||||||
public static function is_playlist_radio($playlist)
|
public static function is_playlist_radio($playlist)
|
||||||
{
|
{
|
||||||
$radioas = array();
|
$radios = array();
|
||||||
|
|
||||||
foreach ($playlist->urls as $item) {
|
foreach ($playlist->urls as $item) {
|
||||||
if ($item->type == "radio") {
|
if ($item->type == "radio") {
|
||||||
|
@ -67,6 +67,7 @@ class WebPlayer
|
||||||
$types = array('real' => 'mp3', 'player' => '');
|
$types = array('real' => 'mp3', 'player' => '');
|
||||||
|
|
||||||
$browsers = array_keys(self::browser_info());
|
$browsers = array_keys(self::browser_info());
|
||||||
|
$browser = '';
|
||||||
if (count($browsers) > 0 ) {
|
if (count($browsers) > 0 ) {
|
||||||
$browser = $browsers[0];
|
$browser = $browsers[0];
|
||||||
}
|
}
|
||||||
|
@ -229,7 +230,7 @@ class WebPlayer
|
||||||
$js['filetype'] = $types['player'];
|
$js['filetype'] = $types['player'];
|
||||||
$js['url'] = $url;
|
$js['url'] = $url;
|
||||||
if ($urlinfo['type'] == 'song') {
|
if ($urlinfo['type'] == 'song') {
|
||||||
$js['poster'] = $item->image_url . (!$iframed ? '&thumb=4' : '');
|
$js['poster'] = $item->image_url . (!AmpConfig::get('iframes') ? '&thumb=4' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_event("webplayer.class.php", "Return get_media_js_param {".json_encode($js)."}", 5);
|
debug_event("webplayer.class.php", "Return get_media_js_param {".json_encode($js)."}", 5);
|
||||||
|
|
|
@ -251,8 +251,8 @@ class XML_Data
|
||||||
"\t<artists>" . intval($counts['artist']) . "</artists>\n" .
|
"\t<artists>" . intval($counts['artist']) . "</artists>\n" .
|
||||||
"\t<songs>" . intval($counts['song']) . "</songs>\n" .
|
"\t<songs>" . intval($counts['song']) . "</songs>\n" .
|
||||||
"\t<videos>" . intval($counts['video']) . "</videos>\n" .
|
"\t<videos>" . intval($counts['video']) . "</videos>\n" .
|
||||||
"\t<playlists>" . intval($count['playlist']) . "</playlists>\n" .
|
"\t<playlists>" . intval($counts['playlist']) . "</playlists>\n" .
|
||||||
"\t<stream>" . intval($count['live_stream']) . "</stream>\n" .
|
"\t<stream>" . intval($counts['live_stream']) . "</stream>\n" .
|
||||||
"</tag>\n";
|
"</tag>\n";
|
||||||
} // end foreach
|
} // end foreach
|
||||||
|
|
||||||
|
@ -325,6 +325,7 @@ class XML_Data
|
||||||
|
|
||||||
Rating::build_cache('album',$albums);
|
Rating::build_cache('album',$albums);
|
||||||
|
|
||||||
|
$string = "";
|
||||||
foreach ($albums as $album_id) {
|
foreach ($albums as $album_id) {
|
||||||
$album = new Album($album_id);
|
$album = new Album($album_id);
|
||||||
$album->format();
|
$album->format();
|
||||||
|
@ -352,7 +353,7 @@ class XML_Data
|
||||||
"\t<preciserating>" . $rating->get_user_rating() . "</preciserating>\n" .
|
"\t<preciserating>" . $rating->get_user_rating() . "</preciserating>\n" .
|
||||||
"\t<rating>" . $rating->get_user_rating() . "</rating>\n" .
|
"\t<rating>" . $rating->get_user_rating() . "</rating>\n" .
|
||||||
"\t<averagerating>" . $rating->get_average_rating() . "</averagerating>\n" .
|
"\t<averagerating>" . $rating->get_average_rating() . "</averagerating>\n" .
|
||||||
"\t<mbid>" . $artist->mbid . "</mbid>\n" .
|
"\t<mbid>" . $album->mbid . "</mbid>\n" .
|
||||||
"</album>\n";
|
"</album>\n";
|
||||||
} // end foreach
|
} // end foreach
|
||||||
|
|
||||||
|
@ -417,6 +418,7 @@ class XML_Data
|
||||||
Song::build_cache($songs);
|
Song::build_cache($songs);
|
||||||
Stream::set_session($_REQUEST['auth']);
|
Stream::set_session($_REQUEST['auth']);
|
||||||
|
|
||||||
|
$string = "";
|
||||||
// Foreach the ids!
|
// Foreach the ids!
|
||||||
foreach ($songs as $song_id) {
|
foreach ($songs as $song_id) {
|
||||||
$song = new Song($song_id);
|
$song = new Song($song_id);
|
||||||
|
@ -476,7 +478,6 @@ class XML_Data
|
||||||
}
|
}
|
||||||
|
|
||||||
$string = '';
|
$string = '';
|
||||||
|
|
||||||
foreach ($videos as $video_id) {
|
foreach ($videos as $video_id) {
|
||||||
$video = new Video($video_id);
|
$video = new Video($video_id);
|
||||||
$video->format();
|
$video->format();
|
||||||
|
@ -520,15 +521,13 @@ class XML_Data
|
||||||
$song->format();
|
$song->format();
|
||||||
|
|
||||||
//FIXME: This is duplicate code and so wrong, functions need to be improved
|
//FIXME: This is duplicate code and so wrong, functions need to be improved
|
||||||
$tag_string = '';
|
|
||||||
|
|
||||||
$tag = new Tag($song->tags['0']);
|
$tag = new Tag($song->tags['0']);
|
||||||
$song->genre = $tag->id;
|
$song->genre = $tag->id;
|
||||||
$song->f_genre = $tag->name;
|
$song->f_genre = $tag->name;
|
||||||
|
|
||||||
$tag_string = self::tags_string($song->tags);
|
$tag_string = self::tags_string($song->tags);
|
||||||
|
|
||||||
$rating = new Rating($song_id,'song');
|
$rating = new Rating($song->id,'song');
|
||||||
|
|
||||||
$art_url = Art::url($song->album, 'album', $_REQUEST['auth']);
|
$art_url = Art::url($song->album, 'album', $_REQUEST['auth']);
|
||||||
|
|
||||||
|
|
|
@ -282,6 +282,7 @@ function generate_config($current)
|
||||||
|
|
||||||
$data = explode("\n",$dist);
|
$data = explode("\n",$dist);
|
||||||
|
|
||||||
|
$final = "";
|
||||||
foreach ($data as $line) {
|
foreach ($data as $line) {
|
||||||
if (preg_match("/^;?([\w\d]+)\s+=\s+[\"]{1}(.*?)[\"]{1}$/",$line,$matches)
|
if (preg_match("/^;?([\w\d]+)\s+=\s+[\"]{1}(.*?)[\"]{1}$/",$line,$matches)
|
||||||
|| preg_match("/^;?([\w\d]+)\s+=\s+[\']{1}(.*?)[\']{1}$/", $line, $matches)
|
|| preg_match("/^;?([\w\d]+)\s+=\s+[\']{1}(.*?)[\']{1}$/", $line, $matches)
|
||||||
|
|
|
@ -34,11 +34,13 @@ require_once $prefix . '/lib/class/session.class.php';
|
||||||
Session::_auto_init();
|
Session::_auto_init();
|
||||||
|
|
||||||
// Set up for redirection on important error cases
|
// Set up for redirection on important error cases
|
||||||
|
$http_type = "http://";
|
||||||
$path = preg_replace('#(.*)/(\w+\.php)$#', '$1', $_SERVER['PHP_SELF']);
|
$path = preg_replace('#(.*)/(\w+\.php)$#', '$1', $_SERVER['PHP_SELF']);
|
||||||
$path = $http_type . $_SERVER['HTTP_HOST'] . $path;
|
$path = $http_type . $_SERVER['HTTP_HOST'] . $path;
|
||||||
|
|
||||||
// Check to make sure the config file exists. If it doesn't then go ahead and
|
// Check to make sure the config file exists. If it doesn't then go ahead and
|
||||||
// send them over to the install script.
|
// send them over to the install script.
|
||||||
|
$results = array();
|
||||||
if (!file_exists($configfile)) {
|
if (!file_exists($configfile)) {
|
||||||
$link = $path . '/install.php';
|
$link = $path . '/install.php';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -99,9 +99,6 @@ function install_check_status($configfile)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Defaut to no */
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} // install_check_status
|
} // install_check_status
|
||||||
|
|
||||||
function install_check_server_apache()
|
function install_check_server_apache()
|
||||||
|
@ -176,7 +173,7 @@ function install_insert_db($db_user = null, $db_pass = null, $create_db = true,
|
||||||
{
|
{
|
||||||
$database = AmpConfig::get('database_name');
|
$database = AmpConfig::get('database_name');
|
||||||
// Make sure that the database name is valid
|
// Make sure that the database name is valid
|
||||||
$is_valid = preg_match('/([^\d\w\_\-])/', $database, $matches);
|
preg_match('/([^\d\w\_\-])/', $database, $matches);
|
||||||
|
|
||||||
if (count($matches)) {
|
if (count($matches)) {
|
||||||
Error::add('general', T_('Error: Invalid database name.'));
|
Error::add('general', T_('Error: Invalid database name.'));
|
||||||
|
@ -246,9 +243,9 @@ function install_insert_db($db_user = null, $db_pass = null, $create_db = true,
|
||||||
if (AmpConfig::get('lang') != 'en_US') {
|
if (AmpConfig::get('lang') != 'en_US') {
|
||||||
// FIXME: 31? I hate magic.
|
// FIXME: 31? I hate magic.
|
||||||
$sql = 'UPDATE `preference` SET `value`= ? WHERE `id` = 31';
|
$sql = 'UPDATE `preference` SET `value`= ? WHERE `id` = 31';
|
||||||
$db_results = Dba::write($sql, array(AmpConfig::get('lang')));
|
Dba::write($sql, array(AmpConfig::get('lang')));
|
||||||
$sql = 'UPDATE `user_preference` SET `value` = ? WHERE `preference` = 31';
|
$sql = 'UPDATE `user_preference` SET `value` = ? WHERE `preference` = 31';
|
||||||
$db_results = Dba::write($sql, array(AmpConfig::get('lang')));
|
Dba::write($sql, array(AmpConfig::get('lang')));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -264,7 +261,7 @@ function install_create_config($download = false)
|
||||||
$config_file = AmpConfig::get('prefix') . '/config/ampache.cfg.php';
|
$config_file = AmpConfig::get('prefix') . '/config/ampache.cfg.php';
|
||||||
|
|
||||||
/* Attempt to make DB connection */
|
/* Attempt to make DB connection */
|
||||||
$dbh = Dba::dbh();
|
Dba::dbh();
|
||||||
|
|
||||||
$params = AmpConfig::get_all();
|
$params = AmpConfig::get_all();
|
||||||
if (empty($params['database_username']) || empty($params['database_password'])) {
|
if (empty($params['database_username']) || empty($params['database_password'])) {
|
||||||
|
@ -364,7 +361,7 @@ function command_exists($command)
|
||||||
|
|
||||||
if ($process !== false) {
|
if ($process !== false) {
|
||||||
$stdout = stream_get_contents($pipes[1]);
|
$stdout = stream_get_contents($pipes[1]);
|
||||||
$stderr = stream_get_contents($pipes[2]);
|
stream_get_contents($pipes[2]);
|
||||||
fclose($pipes[1]);
|
fclose($pipes[1]);
|
||||||
fclose($pipes[2]);
|
fclose($pipes[2]);
|
||||||
proc_close($process);
|
proc_close($process);
|
||||||
|
|
|
@ -68,6 +68,9 @@ if (empty($_REQUEST['step'])) {
|
||||||
} elseif ($_SERVER['HTTP_REMOTE_USER']) {
|
} elseif ($_SERVER['HTTP_REMOTE_USER']) {
|
||||||
$username = $_SERVER['HTTP_REMOTE_USER'];
|
$username = $_SERVER['HTTP_REMOTE_USER'];
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$username = '';
|
||||||
|
}
|
||||||
$password = '';
|
$password = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +97,7 @@ if (empty($_REQUEST['step'])) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($username)) {
|
if (!empty($username) && isset($auth)) {
|
||||||
$user = User::get_from_username($username);
|
$user = User::get_from_username($username);
|
||||||
|
|
||||||
if ($user->disabled) {
|
if ($user->disabled) {
|
||||||
|
@ -134,13 +137,13 @@ if (!empty($username)) {
|
||||||
|
|
||||||
// This allows stealing passwords validated by external means
|
// This allows stealing passwords validated by external means
|
||||||
// such as LDAP
|
// such as LDAP
|
||||||
if (AmpConfig::get('auth_password_save') && $auth['success'] && $password) {
|
if (AmpConfig::get('auth_password_save') && $auth['success'] && isset($password)) {
|
||||||
$user->update_password($password);
|
$user->update_password($password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the authentication was a success */
|
/* If the authentication was a success */
|
||||||
if ($auth['success']) {
|
if ($auth['success'] && isset($user)) {
|
||||||
// $auth->info are the fields specified in the config file
|
// $auth->info are the fields specified in the config file
|
||||||
// to retrieve for each user
|
// to retrieve for each user
|
||||||
Session::create($auth);
|
Session::create($auth);
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
*/
|
*/
|
||||||
function update_preferences($pref_id=0)
|
function update_preferences($pref_id=0)
|
||||||
{
|
{
|
||||||
$pref_user = new User($pref_id);
|
|
||||||
|
|
||||||
/* Get current keys */
|
/* Get current keys */
|
||||||
$sql = "SELECT `id`,`name`,`type` FROM `preference`";
|
$sql = "SELECT `id`,`name`,`type` FROM `preference`";
|
||||||
|
|
||||||
|
@ -38,6 +36,7 @@ function update_preferences($pref_id=0)
|
||||||
|
|
||||||
$db_results = Dba::read($sql);
|
$db_results = Dba::read($sql);
|
||||||
|
|
||||||
|
$results = array();
|
||||||
// Collect the current possible keys
|
// Collect the current possible keys
|
||||||
while ($r = Dba::fetch_assoc($db_results)) {
|
while ($r = Dba::fetch_assoc($db_results)) {
|
||||||
$results[] = array('id' => $r['id'], 'name' => $r['name'],'type' => $r['type']);
|
$results[] = array('id' => $r['id'], 'name' => $r['name'],'type' => $r['type']);
|
||||||
|
@ -46,7 +45,6 @@ function update_preferences($pref_id=0)
|
||||||
/* Foreach through possible keys and assign them */
|
/* Foreach through possible keys and assign them */
|
||||||
foreach ($results as $data) {
|
foreach ($results as $data) {
|
||||||
/* Get the Value from POST/GET var called $data */
|
/* Get the Value from POST/GET var called $data */
|
||||||
$type = $data['type'];
|
|
||||||
$name = $data['name'];
|
$name = $data['name'];
|
||||||
$apply_to_all = 'check_' . $data['name'];
|
$apply_to_all = 'check_' . $data['name'];
|
||||||
$new_level = 'level_' . $data['name'];
|
$new_level = 'level_' . $data['name'];
|
||||||
|
@ -107,7 +105,7 @@ function update_preference($user_id,$name,$pref_id,$value)
|
||||||
/* Else make sure that the current users has the right to do this */
|
/* Else make sure that the current users has the right to do this */
|
||||||
if (Preference::has_access($name)) {
|
if (Preference::has_access($name)) {
|
||||||
$sql = "UPDATE `user_preference` SET `value` = ? WHERE `preference` = ? AND `user` = ?";
|
$sql = "UPDATE `user_preference` SET `value` = ? WHERE `preference` = ? AND `user` = ?";
|
||||||
$db_results = Dba::write($sql, array($value, $pref_id, $user_id));
|
Dba::write($sql, array($value, $pref_id, $user_id));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,9 +119,6 @@ function update_preference($user_id,$name,$pref_id,$value)
|
||||||
*/
|
*/
|
||||||
function create_preference_input($name,$value)
|
function create_preference_input($name,$value)
|
||||||
{
|
{
|
||||||
$len = strlen($value);
|
|
||||||
if ($len <= 1) { $len = 8; }
|
|
||||||
|
|
||||||
if (!Preference::has_access($name)) {
|
if (!Preference::has_access($name)) {
|
||||||
if ($value == '1') {
|
if ($value == '1') {
|
||||||
echo "Enabled";
|
echo "Enabled";
|
||||||
|
|
|
@ -41,26 +41,19 @@ function get_rating_name($score)
|
||||||
switch ($score) {
|
switch ($score) {
|
||||||
case '0':
|
case '0':
|
||||||
return T_("Don't Play");
|
return T_("Don't Play");
|
||||||
break;
|
|
||||||
case '1':
|
case '1':
|
||||||
return T_("It's Pretty Bad");
|
return T_("It's Pretty Bad");
|
||||||
break;
|
|
||||||
case '2':
|
case '2':
|
||||||
return T_("It's Ok");
|
return T_("It's Ok");
|
||||||
break;
|
|
||||||
case '3':
|
case '3':
|
||||||
return T_("It's Pretty Good");
|
return T_("It's Pretty Good");
|
||||||
break;
|
|
||||||
case '4':
|
case '4':
|
||||||
return T_("I Love It!");
|
return T_("I Love It!");
|
||||||
break;
|
|
||||||
case '5':
|
case '5':
|
||||||
return T_("It's Insane");
|
return T_("It's Insane");
|
||||||
break;
|
|
||||||
// I'm fired
|
// I'm fired
|
||||||
default:
|
default:
|
||||||
return T_("Off the Charts!");
|
return T_("Off the Charts!");
|
||||||
break;
|
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -81,7 +81,7 @@ function get_theme($name)
|
||||||
*/
|
*/
|
||||||
function get_theme_author($theme_name)
|
function get_theme_author($theme_name)
|
||||||
{
|
{
|
||||||
$theme_path = AmpConfig::get('prefix') . '/themes/' . AmpConfig::get('theme_name') . '/theme.cfg.php';
|
$theme_path = AmpConfig::get('prefix') . '/themes/' . $theme_name . '/theme.cfg.php';
|
||||||
$results = read_config($theme_path);
|
$results = read_config($theme_path);
|
||||||
|
|
||||||
return $results['author'];
|
return $results['author'];
|
||||||
|
|
|
@ -180,8 +180,6 @@ function show_preference_box($preferences)
|
||||||
|
|
||||||
} // show_preference_box
|
} // show_preference_box
|
||||||
|
|
||||||
static $album_id_cnt = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show_album_select
|
* show_album_select
|
||||||
* 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
|
||||||
|
@ -189,9 +187,11 @@ static $album_id_cnt = 0;
|
||||||
*/
|
*/
|
||||||
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=0,$song_id=0)
|
||||||
{
|
{
|
||||||
|
static $album_id_cnt = 0;
|
||||||
|
|
||||||
// Generate key to use for HTML element ID
|
// Generate key to use for HTML element ID
|
||||||
if ($song_id) {
|
if ($song_id) {
|
||||||
$key = "album_select_$song_id";
|
$key = "album_select_" . $song_id;
|
||||||
} else {
|
} else {
|
||||||
$key = "album_select_c" . ++$album_id_cnt;
|
$key = "album_select_c" . ++$album_id_cnt;
|
||||||
}
|
}
|
||||||
|
@ -225,8 +225,6 @@ function show_album_select($name='album',$album_id=0,$allow_add=0,$song_id=0)
|
||||||
|
|
||||||
} // show_album_select
|
} // show_album_select
|
||||||
|
|
||||||
static $artist_id_cnt = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show_artist_select
|
* show_artist_select
|
||||||
* This is the same as show_album_select except it's *gasp* for artists! How
|
* This is the same as show_album_select except it's *gasp* for artists! How
|
||||||
|
@ -234,9 +232,10 @@ static $artist_id_cnt = 0;
|
||||||
*/
|
*/
|
||||||
function show_artist_select($name='artist', $artist_id=0, $allow_add=0, $song_id=0)
|
function show_artist_select($name='artist', $artist_id=0, $allow_add=0, $song_id=0)
|
||||||
{
|
{
|
||||||
|
static $artist_id_cnt = 0;
|
||||||
// Generate key to use for HTML element ID
|
// Generate key to use for HTML element ID
|
||||||
if ($song_id) {
|
if ($song_id) {
|
||||||
$key = "artist_select_$song_id";
|
$key = "artist_select_" . $song_id;
|
||||||
} else {
|
} else {
|
||||||
$key = "artist_select_c" . ++$artist_id_cnt;
|
$key = "artist_select_c" . ++$artist_id_cnt;
|
||||||
}
|
}
|
||||||
|
@ -415,7 +414,6 @@ function xml_from_array($array, $callback = false, $type = '')
|
||||||
} // end foreach
|
} // end foreach
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
break;
|
|
||||||
case 'xspf':
|
case 'xspf':
|
||||||
foreach ($array as $key=>$value) {
|
foreach ($array as $key=>$value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
|
@ -435,7 +433,6 @@ function xml_from_array($array, $callback = false, $type = '')
|
||||||
} // end foreach
|
} // end foreach
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
foreach ($array as $key => $value) {
|
foreach ($array as $key => $value) {
|
||||||
// No numeric keys
|
// No numeric keys
|
||||||
|
@ -459,7 +456,6 @@ function xml_from_array($array, $callback = false, $type = '')
|
||||||
}
|
}
|
||||||
|
|
||||||
return UI::clean_utf8($string);
|
return UI::clean_utf8($string);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} // xml_from_array
|
} // xml_from_array
|
||||||
|
|
||||||
|
@ -489,7 +485,6 @@ function xml_get_header($type)
|
||||||
" <key>Tracks</key>\n" .
|
" <key>Tracks</key>\n" .
|
||||||
" <dict>\n";
|
" <dict>\n";
|
||||||
return $header;
|
return $header;
|
||||||
break;
|
|
||||||
case 'xspf':
|
case 'xspf':
|
||||||
$header = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" .
|
$header = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" .
|
||||||
"<!-- XML Generated by Ampache v." . AmpConfig::get('version') . " -->";
|
"<!-- XML Generated by Ampache v." . AmpConfig::get('version') . " -->";
|
||||||
|
@ -500,11 +495,9 @@ function xml_get_header($type)
|
||||||
"<info>". AmpConfig::get('web_path') ."</info>\n" .
|
"<info>". AmpConfig::get('web_path') ."</info>\n" .
|
||||||
"<trackList>\n\n\n\n";
|
"<trackList>\n\n\n\n";
|
||||||
return $header;
|
return $header;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
$header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
$header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||||
return $header;
|
return $header;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} //xml_get_header
|
} //xml_get_header
|
||||||
|
|
||||||
|
@ -520,12 +513,10 @@ function xml_get_footer($type)
|
||||||
"</dict>\n" .
|
"</dict>\n" .
|
||||||
"</plist>\n";
|
"</plist>\n";
|
||||||
return $footer;
|
return $footer;
|
||||||
break;
|
|
||||||
case 'xspf':
|
case 'xspf':
|
||||||
$footer = " </trackList>\n" .
|
$footer = " </trackList>\n" .
|
||||||
"</playlist>\n";
|
"</playlist>\n";
|
||||||
return $footer;
|
return $footer;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -571,7 +562,6 @@ function show_now_playing()
|
||||||
Session::gc();
|
Session::gc();
|
||||||
Stream::gc_now_playing();
|
Stream::gc_now_playing();
|
||||||
|
|
||||||
$web_path = AmpConfig::get('web_path');
|
|
||||||
$results = Stream::get_now_playing();
|
$results = Stream::get_now_playing();
|
||||||
require_once AmpConfig::get('prefix') . '/templates/show_now_playing.inc.php';
|
require_once AmpConfig::get('prefix') . '/templates/show_now_playing.inc.php';
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -3575,7 +3575,7 @@ msgstr "Partager"
|
||||||
#: ../../templates/show_album.inc.php:131
|
#: ../../templates/show_album.inc.php:131
|
||||||
#: ../../templates/show_album_row.inc.php:79
|
#: ../../templates/show_album_row.inc.php:79
|
||||||
msgid "Album edit"
|
msgid "Album edit"
|
||||||
msgstr "Edition de l'album"
|
msgstr "Edition album"
|
||||||
|
|
||||||
#: ../../templates/show_album.inc.php:66
|
#: ../../templates/show_album.inc.php:66
|
||||||
#: ../../templates/show_artist.inc.php:63
|
#: ../../templates/show_artist.inc.php:63
|
||||||
|
@ -3709,7 +3709,7 @@ msgstr "Tout ajouter aléatoirement à la liste de lecture temporaire"
|
||||||
#: ../../templates/show_artist.inc.php:122
|
#: ../../templates/show_artist.inc.php:122
|
||||||
#: ../../templates/show_artist_row.inc.php:61
|
#: ../../templates/show_artist_row.inc.php:61
|
||||||
msgid "Artist edit"
|
msgid "Artist edit"
|
||||||
msgstr "Edition de l'artiste"
|
msgstr "Edition artiste"
|
||||||
|
|
||||||
#: ../../templates/show_artist.inc.php:123
|
#: ../../templates/show_artist.inc.php:123
|
||||||
msgid "Edit Artist"
|
msgid "Edit Artist"
|
||||||
|
|
|
@ -71,8 +71,8 @@ switch ($_REQUEST['action']) {
|
||||||
$fields = $localplay->get_instance_fields();
|
$fields = $localplay->get_instance_fields();
|
||||||
require_once AmpConfig::get('prefix') . '/templates/show_localplay_instances.inc.php';
|
require_once AmpConfig::get('prefix') . '/templates/show_localplay_instances.inc.php';
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
case 'show_playlist':
|
case 'show_playlist':
|
||||||
|
default:
|
||||||
if (!Access::check('localplay','5')) { UI::access_denied(); break; }
|
if (!Access::check('localplay','5')) { UI::access_denied(); break; }
|
||||||
// Init and then connect to our localplay instance
|
// Init and then connect to our localplay instance
|
||||||
$localplay = new Localplay(AmpConfig::get('localplay_controller'));
|
$localplay = new Localplay(AmpConfig::get('localplay_controller'));
|
||||||
|
|
|
@ -68,8 +68,8 @@ if ($type == 'playlist') {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is specifically for tmp playlist requests */
|
/* This is specifically for tmp playlist requests */
|
||||||
$demo_id = scrub_in($_REQUEST['demo_id']);
|
$demo_id = Dba::escape($_REQUEST['demo_id']);
|
||||||
$random = scrub_in($_REQUEST['random']);
|
$random = Dba::escape($_REQUEST['random']);
|
||||||
|
|
||||||
/* First things first, if we don't have a uid/oid stop here */
|
/* First things first, if we don't have a uid/oid stop here */
|
||||||
if (empty($oid) && empty($demo_id) && empty($random)) {
|
if (empty($oid) && empty($demo_id) && empty($random)) {
|
||||||
|
@ -155,7 +155,7 @@ if (AmpConfig::get('access_control')) {
|
||||||
} // access_control is enabled
|
} // access_control is enabled
|
||||||
|
|
||||||
// Handle playlist downloads
|
// Handle playlist downloads
|
||||||
if ($type == 'playlist') {
|
if ($type == 'playlist' && isset($playlist_type)) {
|
||||||
$playlist = new Stream_Playlist($oid);
|
$playlist = new Stream_Playlist($oid);
|
||||||
// Some rudimentary security
|
// Some rudimentary security
|
||||||
if ($uid != $playlist->user) {
|
if ($uid != $playlist->user) {
|
||||||
|
@ -181,6 +181,7 @@ if ($demo_id) {
|
||||||
$oid = $democratic->get_next_object();
|
$oid = $democratic->get_next_object();
|
||||||
} else {
|
} else {
|
||||||
// Pull history
|
// Pull history
|
||||||
|
$song_cool_check = 0;
|
||||||
$oid = $democratic->get_next_object($song_cool_check);
|
$oid = $democratic->get_next_object($song_cool_check);
|
||||||
$oids = $democratic->get_cool_songs();
|
$oids = $democratic->get_cool_songs();
|
||||||
while (in_array($oid,$oids)) {
|
while (in_array($oid,$oids)) {
|
||||||
|
@ -196,7 +197,7 @@ if ($demo_id) {
|
||||||
* if we are doing random let's pull the random object
|
* if we are doing random let's pull the random object
|
||||||
*/
|
*/
|
||||||
if ($random) {
|
if ($random) {
|
||||||
if ($start < 1) {
|
if ($_REQUEST['start'] < 1) {
|
||||||
$oid = Random::get_single_song($_REQUEST['random_type']);
|
$oid = Random::get_single_song($_REQUEST['random_type']);
|
||||||
// Save this one in case we do a seek
|
// Save this one in case we do a seek
|
||||||
$_SESSION['random']['last'] = $oid;
|
$_SESSION['random']['last'] = $oid;
|
||||||
|
@ -225,7 +226,7 @@ if ($media->catalog) {
|
||||||
if (!make_bool($media->enabled)) {
|
if (!make_bool($media->enabled)) {
|
||||||
debug_event('Play', "Error: $media->file is currently disabled, song skipped", '5');
|
debug_event('Play', "Error: $media->file is currently disabled, song skipped", '5');
|
||||||
// Check to see if this is a democratic playlist, if so remove it completely
|
// Check to see if this is a democratic playlist, if so remove it completely
|
||||||
if ($demo_id) { $democratic->delete_from_oid($oid, 'song'); }
|
if ($demo_id && isset($democratic)) { $democratic->delete_from_oid($oid, 'song'); }
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,6 +414,8 @@ if (get_class($media) == 'Song') {
|
||||||
|
|
||||||
// Handle Content-Range
|
// Handle Content-Range
|
||||||
|
|
||||||
|
$start = 0;
|
||||||
|
$end = 0;
|
||||||
sscanf($_SERVER['HTTP_RANGE'], "bytes=%d-%d", $start, $end);
|
sscanf($_SERVER['HTTP_RANGE'], "bytes=%d-%d", $start, $end);
|
||||||
|
|
||||||
if ($start > 0 || $end > 0) {
|
if ($start > 0 || $end > 0) {
|
||||||
|
@ -449,7 +452,7 @@ if ($transcode) {
|
||||||
header('Accept-Ranges: bytes');
|
header('Accept-Ranges: bytes');
|
||||||
}
|
}
|
||||||
|
|
||||||
$mime = $transcode
|
$mime = ($transcode && isset($transcoder))
|
||||||
? $media->type_to_mime($transcoder['format'])
|
? $media->type_to_mime($transcoder['format'])
|
||||||
: $media->mime;
|
: $media->mime;
|
||||||
|
|
||||||
|
@ -498,7 +501,7 @@ if ($demo_id) { $democratic->delete_from_oid($oid,'song'); }
|
||||||
|
|
||||||
if ($transcode) {
|
if ($transcode) {
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||||
$stderr = fread($transcoder['stderr'], 8192);
|
fread($transcoder['stderr'], 8192);
|
||||||
fclose($transcoder['stderr']);
|
fclose($transcoder['stderr']);
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
18
playlist.php
18
playlist.php
|
@ -39,16 +39,6 @@ UI::show_header();
|
||||||
|
|
||||||
/* Switch on the action passed in */
|
/* Switch on the action passed in */
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'add_dyn_song':
|
|
||||||
/* Check Rights */
|
|
||||||
if (!$playlist->has_access()) {
|
|
||||||
UI::access_denied();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$playlist->add_dyn_song();
|
|
||||||
$_SESSION['data']['playlist_id'] = $playlist->id;
|
|
||||||
break;
|
|
||||||
case 'create_playlist':
|
case 'create_playlist':
|
||||||
/* Check rights */
|
/* Check rights */
|
||||||
if (!Access::check('interface','25')) {
|
if (!Access::check('interface','25')) {
|
||||||
|
@ -67,14 +57,6 @@ switch ($_REQUEST['action']) {
|
||||||
// If we made it here, we didn't have sufficient rights.
|
// If we made it here, we didn't have sufficient rights.
|
||||||
UI::access_denied();
|
UI::access_denied();
|
||||||
break;
|
break;
|
||||||
case 'remove_song':
|
|
||||||
/* Check em for rights */
|
|
||||||
if (!$playlist->has_access()) {
|
|
||||||
UI::access_denied();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$playlist->remove_songs($_REQUEST['song']);
|
|
||||||
break;
|
|
||||||
case 'show_playlist':
|
case 'show_playlist':
|
||||||
$playlist = new Playlist($_REQUEST['playlist_id']);
|
$playlist = new Playlist($_REQUEST['playlist_id']);
|
||||||
$playlist->format();
|
$playlist->format();
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
|
|
||||||
require_once 'lib/init.php';
|
require_once 'lib/init.php';
|
||||||
|
|
||||||
|
$title = "";
|
||||||
|
$text = "";
|
||||||
|
$next_url = "";
|
||||||
|
|
||||||
// Switch on the action
|
// Switch on the action
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'update_preferences':
|
case 'update_preferences':
|
||||||
|
@ -35,6 +39,7 @@ switch ($_REQUEST['action']) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$system = false;
|
||||||
/* Reset the Theme */
|
/* Reset the Theme */
|
||||||
if ($_POST['method'] == 'admin') {
|
if ($_POST['method'] == 'admin') {
|
||||||
$user_id = '-1';
|
$user_id = '-1';
|
||||||
|
|
|
@ -29,9 +29,11 @@ switch ($_REQUEST['action']) {
|
||||||
$object_ids = Random::advanced($_REQUEST['type'], $_POST);
|
$object_ids = Random::advanced($_REQUEST['type'], $_POST);
|
||||||
|
|
||||||
// We need to add them to the active playlist
|
// We need to add them to the active playlist
|
||||||
|
if (is_array($object_ids)) {
|
||||||
foreach ($object_ids as $object_id) {
|
foreach ($object_ids as $object_id) {
|
||||||
$GLOBALS['user']->playlist->add_object($object_id, 'song');
|
$GLOBALS['user']->playlist->add_object($object_id, 'song');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case 'advanced':
|
case 'advanced':
|
||||||
default:
|
default:
|
||||||
require_once AmpConfig::get('prefix') . '/templates/show_random.inc.php';
|
require_once AmpConfig::get('prefix') . '/templates/show_random.inc.php';
|
||||||
|
|
|
@ -122,8 +122,8 @@ switch ($_REQUEST['action']) {
|
||||||
case 'user':
|
case 'user':
|
||||||
$access = '25';
|
$access = '25';
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
case 'guest':
|
case 'guest':
|
||||||
|
default:
|
||||||
$access = '5';
|
$access = '5';
|
||||||
break;
|
break;
|
||||||
} // auto-user level
|
} // auto-user level
|
||||||
|
|
|
@ -46,14 +46,14 @@ switch ($_REQUEST['action']) {
|
||||||
$playlist = new Search();
|
$playlist = new Search();
|
||||||
$playlist->parse_rules(Search::clean_request($_REQUEST));
|
$playlist->parse_rules(Search::clean_request($_REQUEST));
|
||||||
$playlist->save();
|
$playlist->save();
|
||||||
default:
|
|
||||||
require_once AmpConfig::get('prefix') . '/templates/show_search.inc.php';
|
|
||||||
break;
|
break;
|
||||||
case 'descriptor':
|
case 'descriptor':
|
||||||
// This is a little special we don't want header/footers so trash what we've got in the OB
|
// This is a little special we don't want header/footers so trash what we've got in the OB
|
||||||
ob_clean();
|
ob_clean();
|
||||||
require_once AmpConfig::get('prefix') . '/templates/show_search_descriptor.inc.php';
|
require_once AmpConfig::get('prefix') . '/templates/show_search_descriptor.inc.php';
|
||||||
exit;
|
exit;
|
||||||
|
default:
|
||||||
|
require_once AmpConfig::get('prefix') . '/templates/show_search.inc.php';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,54 +38,42 @@ switch ($page) {
|
||||||
case 'stats':
|
case 'stats':
|
||||||
require_once AmpConfig::get('prefix') . '/server/stats.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/stats.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'browse':
|
case 'browse':
|
||||||
require_once AmpConfig::get('prefix') . '/server/browse.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/browse.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'random':
|
case 'random':
|
||||||
require_once AmpConfig::get('prefix') . '/server/random.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/random.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'playlist':
|
case 'playlist':
|
||||||
require_once AmpConfig::get('prefix') . '/server/playlist.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/playlist.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'localplay':
|
case 'localplay':
|
||||||
require_once AmpConfig::get('prefix') . '/server/localplay.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/localplay.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'tag':
|
case 'tag':
|
||||||
require_once AmpConfig::get('prefix') . '/server/tag.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/tag.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'stream':
|
case 'stream':
|
||||||
require_once AmpConfig::get('prefix') . '/server/stream.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/stream.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'song':
|
case 'song':
|
||||||
require_once AmpConfig::get('prefix') . '/server/song.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/song.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'democratic':
|
case 'democratic':
|
||||||
require_once AmpConfig::get('prefix') . '/server/democratic.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/democratic.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'index':
|
case 'index':
|
||||||
require_once AmpConfig::get('prefix') . '/server/index.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/index.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
case 'catalog':
|
case 'catalog':
|
||||||
require_once AmpConfig::get('prefix') . '/server/catalog.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/catalog.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'search':
|
case 'search':
|
||||||
require_once AmpConfig::get('prefix') . '/server/search.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/search.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'player':
|
case 'player':
|
||||||
require_once AmpConfig::get('prefix') . '/server/player.ajax.php';
|
require_once AmpConfig::get('prefix') . '/server/player.ajax.php';
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
// A taste of compatibility
|
// A taste of compatibility
|
||||||
break;
|
break;
|
||||||
|
@ -115,8 +103,8 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
if ($_POST['type'] == 'smartplaylist_row' ||
|
if ($_POST['type'] == 'smartplaylist_row' ||
|
||||||
$_POST['type'] == 'smartplaylist_title') {
|
$_POST['type'] == 'smartplaylist_title') {
|
||||||
$playlist = new Search('song', $_POST['id']);
|
$smartpl = new Search('song', $_POST['id']);
|
||||||
if ($GLOBALS['user']->id == $playlist->user) {
|
if ($GLOBALS['user']->id == $smartpl->user) {
|
||||||
$level = '25';
|
$level = '25';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,17 +146,21 @@ switch ($_REQUEST['action']) {
|
||||||
case 'playlist_row':
|
case 'playlist_row':
|
||||||
case 'playlist_title':
|
case 'playlist_title':
|
||||||
$key = 'playlist_row_' . $_POST['id'];
|
$key = 'playlist_row_' . $_POST['id'];
|
||||||
|
if (isset($playlist)) {
|
||||||
$playlist->update($_POST);
|
$playlist->update($_POST);
|
||||||
$playlist->format();
|
$playlist->format();
|
||||||
$count = $playlist->get_song_count();
|
$count = $playlist->get_song_count();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'smartplaylist_row':
|
case 'smartplaylist_row':
|
||||||
case 'smartplaylist_title':
|
case 'smartplaylist_title':
|
||||||
$key = 'smartplaylist_row_' . $_POST['id'];
|
$key = 'smartplaylist_row_' . $_POST['id'];
|
||||||
$playlist->name = $_POST['name'];
|
if (isset($smartpl)) {
|
||||||
$playlist->type = $_POST['pl_type'];
|
$smartpl->name = $_POST['name'];
|
||||||
$playlist->update();
|
$smartpl->type = $_POST['pl_type'];
|
||||||
$playlist->format();
|
$smartpl->update();
|
||||||
|
$smartpl->format();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'live_stream_row':
|
case 'live_stream_row':
|
||||||
$key = 'live_stream_' . $_POST['id'];
|
$key = 'live_stream_' . $_POST['id'];
|
||||||
|
@ -194,7 +186,6 @@ switch ($_REQUEST['action']) {
|
||||||
$key = 'rfc3514';
|
$key = 'rfc3514';
|
||||||
echo xoutput_from_array(array($key=>'0x1'));
|
echo xoutput_from_array(array($key=>'0x1'));
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
} // end switch on type
|
} // end switch on type
|
||||||
|
|
||||||
$results['id'] = $new_id;
|
$results['id'] = $new_id;
|
||||||
|
|
|
@ -45,6 +45,7 @@ if (isset($_REQUEST['show_header']) && $_REQUEST['show_header']) {
|
||||||
|
|
||||||
debug_event('browse.ajax.php', 'Called for action: {'.$_REQUEST['action'].'}', '5');
|
debug_event('browse.ajax.php', 'Called for action: {'.$_REQUEST['action'].'}', '5');
|
||||||
|
|
||||||
|
$results = array();
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'browse':
|
case 'browse':
|
||||||
$object_ids = array();
|
$object_ids = array();
|
||||||
|
@ -62,7 +63,7 @@ switch ($_REQUEST['action']) {
|
||||||
$browse->set_sort($_REQUEST['sort']);
|
$browse->set_sort($_REQUEST['sort']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST['catalog_key'] || $SESSION['catalog'] != 0) {
|
if ($_REQUEST['catalog_key'] || $_SESSION['catalog'] != 0) {
|
||||||
$browse->set_filter('catalog',$_REQUEST['catalog_key']);
|
$browse->set_filter('catalog',$_REQUEST['catalog_key']);
|
||||||
$_SESSION['catalog'] = $_REQUEST['catalog_key'];
|
$_SESSION['catalog'] = $_REQUEST['catalog_key'];
|
||||||
} elseif ($_REQUEST['catalog_key'] == 0) {
|
} elseif ($_REQUEST['catalog_key'] == 0) {
|
||||||
|
@ -115,8 +116,7 @@ switch ($_REQUEST['action']) {
|
||||||
$key = 'live_stream_' . $radio->id;
|
$key = 'live_stream_' . $radio->id;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
exit;
|
||||||
break;
|
|
||||||
} // end switch on type
|
} // end switch on type
|
||||||
|
|
||||||
$results[$key] = '';
|
$results[$key] = '';
|
||||||
|
|
|
@ -28,6 +28,8 @@ if (!defined('AJAX_INCLUDE')) { exit; }
|
||||||
$democratic = Democratic::get_current_playlist();
|
$democratic = Democratic::get_current_playlist();
|
||||||
$democratic->set_parent();
|
$democratic->set_parent();
|
||||||
|
|
||||||
|
$show_browse = false;
|
||||||
|
$results = array();
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'delete_vote':
|
case 'delete_vote':
|
||||||
$democratic->remove_vote($_REQUEST['row_id']);
|
$democratic->remove_vote($_REQUEST['row_id']);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
if (!defined('AJAX_INCLUDE')) { exit; }
|
if (!defined('AJAX_INCLUDE')) { exit; }
|
||||||
|
|
||||||
|
$results = array();
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'random_albums':
|
case 'random_albums':
|
||||||
$albums = Album::get_random(6, true);
|
$albums = Album::get_random(6, true);
|
||||||
|
@ -133,6 +134,7 @@ switch ($_REQUEST['action']) {
|
||||||
$mbid = $_REQUEST['mbid'];
|
$mbid = $_REQUEST['mbid'];
|
||||||
if (empty($_REQUEST['artist'])) {
|
if (empty($_REQUEST['artist'])) {
|
||||||
$artist_mbid = $_REQUEST['artist_mbid'];
|
$artist_mbid = $_REQUEST['artist_mbid'];
|
||||||
|
$artist = null;
|
||||||
} else {
|
} else {
|
||||||
$artist = $_REQUEST['artist'];
|
$artist = $_REQUEST['artist'];
|
||||||
$aobj = new Artist($artist);
|
$aobj = new Artist($artist);
|
||||||
|
@ -200,7 +202,6 @@ switch ($_REQUEST['action']) {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
} // end switch on button
|
} // end switch on button
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
if (!defined('AJAX_INCLUDE')) { exit; }
|
if (!defined('AJAX_INCLUDE')) { exit; }
|
||||||
|
|
||||||
|
$results = array();
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'set_instance':
|
case 'set_instance':
|
||||||
// Make sure they they are allowed to do this
|
// Make sure they they are allowed to do this
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
if (!defined('AJAX_INCLUDE')) { exit; }
|
if (!defined('AJAX_INCLUDE')) { exit; }
|
||||||
|
|
||||||
|
$results = array();
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'show_broadcasts':
|
case 'show_broadcasts':
|
||||||
ob_start();
|
ob_start();
|
||||||
|
@ -34,7 +35,6 @@ switch ($_REQUEST['action']) {
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
echo $results;
|
echo $results;
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'broadcast':
|
case 'broadcast':
|
||||||
$broadcast_id = $_GET['broadcast_id'];
|
$broadcast_id = $_GET['broadcast_id'];
|
||||||
if (empty($broadcast_id)) {
|
if (empty($broadcast_id)) {
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
if (!defined('AJAX_INCLUDE')) { exit; }
|
if (!defined('AJAX_INCLUDE')) { exit; }
|
||||||
|
|
||||||
|
$results = array();
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'delete_track':
|
case 'delete_track':
|
||||||
// Create the object and remove the track
|
// Create the object and remove the track
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
if (!defined('AJAX_INCLUDE')) { exit; }
|
if (!defined('AJAX_INCLUDE')) { exit; }
|
||||||
|
|
||||||
|
$results = array();
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'song':
|
case 'song':
|
||||||
$songs = Random::get_default();
|
$songs = Random::get_default();
|
||||||
|
@ -73,12 +74,14 @@ switch ($_REQUEST['action']) {
|
||||||
$results['rightbar'] = UI::ajax_include('rightbar.inc.php');
|
$results['rightbar'] = UI::ajax_include('rightbar.inc.php');
|
||||||
break;
|
break;
|
||||||
case 'advanced_random':
|
case 'advanced_random':
|
||||||
$object_ids = Random::advanced($_POST);
|
$object_ids = Random::advanced('song', $_POST);
|
||||||
|
|
||||||
// First add them to the active playlist
|
// First add them to the active playlist
|
||||||
|
if (is_array($object_ids)) {
|
||||||
foreach ($object_ids as $object_id) {
|
foreach ($object_ids as $object_id) {
|
||||||
$GLOBALS['user']->playlist->add_object($object_id,'song');
|
$GLOBALS['user']->playlist->add_object($object_id,'song');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$results['rightbar'] = UI::ajax_include('rightbar.inc.php');
|
$results['rightbar'] = UI::ajax_include('rightbar.inc.php');
|
||||||
|
|
||||||
// Now setup the browse and show them below!
|
// Now setup the browse and show them below!
|
||||||
|
|
|
@ -28,6 +28,7 @@ if (!defined('AJAX_INCLUDE')) { exit; }
|
||||||
|
|
||||||
debug_event('stream.ajax.php', 'Called for action {'.$_REQUEST['action'].'}', 5);
|
debug_event('stream.ajax.php', 'Called for action {'.$_REQUEST['action'].'}', 5);
|
||||||
|
|
||||||
|
$results = array();
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'set_play_type':
|
case 'set_play_type':
|
||||||
// Make sure they have the rights to do this
|
// Make sure they have the rights to do this
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
if (!defined('AJAX_INCLUDE')) { exit; }
|
if (!defined('AJAX_INCLUDE')) { exit; }
|
||||||
|
|
||||||
|
$results = array();
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'show_add_tag':
|
case 'show_add_tag':
|
||||||
|
|
||||||
|
@ -47,7 +48,6 @@ switch ($_REQUEST['action']) {
|
||||||
$tag->delete();
|
$tag->delete();
|
||||||
header('Location: ' . AmpConfig::get('web_path') . '/browse.php?action=tag');
|
header('Location: ' . AmpConfig::get('web_path') . '/browse.php?action=tag');
|
||||||
exit;
|
exit;
|
||||||
break;
|
|
||||||
case 'remove_tag_map':
|
case 'remove_tag_map':
|
||||||
debug_event('tag.ajax', 'Removing tag map...', '5');
|
debug_event('tag.ajax', 'Removing tag map...', '5');
|
||||||
$tag = new Tag($_GET['tag_id']);
|
$tag = new Tag($_GET['tag_id']);
|
||||||
|
|
12
share.php
12
share.php
|
@ -53,8 +53,7 @@ switch ($action) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UI::show_footer();
|
UI::show_footer();
|
||||||
exit();
|
exit;
|
||||||
break;
|
|
||||||
case 'create':
|
case 'create':
|
||||||
if (AmpConfig::get('demo_mode')) {
|
if (AmpConfig::get('demo_mode')) {
|
||||||
UI::access_denied();
|
UI::access_denied();
|
||||||
|
@ -86,8 +85,7 @@ switch ($action) {
|
||||||
show_confirmation($title, $body, AmpConfig::get('web_path') . '/stats.php?action=share');
|
show_confirmation($title, $body, AmpConfig::get('web_path') . '/stats.php?action=share');
|
||||||
}
|
}
|
||||||
UI::show_footer();
|
UI::show_footer();
|
||||||
exit();
|
exit;
|
||||||
break;
|
|
||||||
case 'show_delete':
|
case 'show_delete':
|
||||||
UI::show_header();
|
UI::show_header();
|
||||||
$id = $_REQUEST['id'];
|
$id = $_REQUEST['id'];
|
||||||
|
@ -95,8 +93,7 @@ switch ($action) {
|
||||||
$next_url = AmpConfig::get('web_path') . '/share.php?action=delete&id=' . scrub_out($id);
|
$next_url = AmpConfig::get('web_path') . '/share.php?action=delete&id=' . scrub_out($id);
|
||||||
show_confirmation(T_('Share Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_share');
|
show_confirmation(T_('Share Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_share');
|
||||||
UI::show_footer();
|
UI::show_footer();
|
||||||
exit();
|
exit;
|
||||||
break;
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if (AmpConfig::get('demo_mode')) {
|
if (AmpConfig::get('demo_mode')) {
|
||||||
UI::access_denied();
|
UI::access_denied();
|
||||||
|
@ -110,8 +107,7 @@ switch ($action) {
|
||||||
show_confirmation(T_('Share Deleted'), T_('The Share has been deleted'), $next_url);
|
show_confirmation(T_('Share Deleted'), T_('The Share has been deleted'), $next_url);
|
||||||
}
|
}
|
||||||
UI::show_footer();
|
UI::show_footer();
|
||||||
exit();
|
exit;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,7 +45,7 @@ switch ($_REQUEST['action']) {
|
||||||
// Get our object first
|
// Get our object first
|
||||||
$object = Shoutbox::get_object($_REQUEST['type'],$_REQUEST['id']);
|
$object = Shoutbox::get_object($_REQUEST['type'],$_REQUEST['id']);
|
||||||
|
|
||||||
if (!$object->id) {
|
if (!$object || !$object->id) {
|
||||||
Error::add('general', T_('Invalid Object Selected'));
|
Error::add('general', T_('Invalid Object Selected'));
|
||||||
Error::display('general');
|
Error::display('general');
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -100,7 +100,6 @@ switch ($_REQUEST['action']) {
|
||||||
break;
|
break;
|
||||||
case 'artist_random':
|
case 'artist_random':
|
||||||
$artist = new Artist($_REQUEST['artist_id']);
|
$artist = new Artist($_REQUEST['artist_id']);
|
||||||
$artist->get_count();
|
|
||||||
$media_ids = $artist->get_random_songs();
|
$media_ids = $artist->get_random_songs();
|
||||||
break;
|
break;
|
||||||
case 'album_random':
|
case 'album_random':
|
||||||
|
@ -123,7 +122,7 @@ switch ($_REQUEST['action']) {
|
||||||
break;
|
break;
|
||||||
case 'playlist':
|
case 'playlist':
|
||||||
$playlist = new Playlist($_REQUEST['playlist_id']);
|
$playlist = new Playlist($_REQUEST['playlist_id']);
|
||||||
$songs = $playlist->get_songs($_REQUEST['song']);
|
$songs = $playlist->get_songs();
|
||||||
foreach ($songs as $song) {
|
foreach ($songs as $song) {
|
||||||
$media_ids[] = array(
|
$media_ids[] = array(
|
||||||
'object_type' => 'song',
|
'object_type' => 'song',
|
||||||
|
@ -141,9 +140,10 @@ switch ($_REQUEST['action']) {
|
||||||
break;
|
break;
|
||||||
case 'playlist_random':
|
case 'playlist_random':
|
||||||
$playlist = new Playlist($_REQUEST['playlist_id']);
|
$playlist = new Playlist($_REQUEST['playlist_id']);
|
||||||
$media_ids = $playlist->get_random_songs();
|
$media_ids = $playlist->get_random_items();
|
||||||
break;
|
break;
|
||||||
case 'random':
|
case 'random':
|
||||||
|
$matchlist = array();
|
||||||
if ($_REQUEST['genre'][0] != '-1') {
|
if ($_REQUEST['genre'][0] != '-1') {
|
||||||
$matchlist['genre'] = $_REQUEST['genre'];
|
$matchlist['genre'] = $_REQUEST['genre'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
<?php
|
|
||||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
|
||||||
* Copyright 2001 - 2014 Ampache.org
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License v2
|
|
||||||
* as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<script type='text/javascript'>
|
|
||||||
function insert()
|
|
||||||
{
|
|
||||||
document.getElementById('artist_name').value = '<?php echo $artist->name; ?>';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php /* HINT: Artist Name */ UI::show_box_top(sprintf(T_('Rename %s'), $artist->name)); ?>
|
|
||||||
<form name="rename_artist" method="post" action="<?php echo AmpConfig::get('web_path'); ?>/artists.php?action=rename&artist=<?php echo $artist->id; ?>" style="Display:inline;">
|
|
||||||
<?php show_artist_pulldown($artist->id, "artist_id", 4); ?>
|
|
||||||
<br />
|
|
||||||
<?php echo T_('OR'); ?><br />
|
|
||||||
<input type="text" name="artist_name" value="<?php echo scrub_out($_REQUEST['artist_name']); ?>" id="artist_name" />
|
|
||||||
<a href="javascript:insert()">[<?php echo T_('Insert current'); ?>]</a><br />
|
|
||||||
<?php $GLOBALS['error']->print_error('artist_name'); ?>
|
|
||||||
<input type="checkbox" name="update_id3" value="yes" /> <?php echo T_('Update id3 tags') ?><br />
|
|
||||||
<input type="submit" value="<?php echo T_('Rename'); ?>" /><br />
|
|
||||||
</form>
|
|
||||||
<?php UI::show_box_bottom(); ?>
|
|
Loading…
Add table
Add a link
Reference in a new issue