mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 01:39:28 +02:00
major corrections to reading of preferences and a few misc fixes which I have now forgotten
This commit is contained in:
parent
c1f2b35e2a
commit
2c337852cf
27 changed files with 329 additions and 478 deletions
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
v.3.4-Beta2
|
v.3.4-Beta2
|
||||||
|
- Added Catalog Last Update and Last Add times to API Handshake.
|
||||||
|
- Fixed Remember Me Cookie so it's actually set
|
||||||
- Removed some invalid queries that were not needed, tweaked logic
|
- Removed some invalid queries that were not needed, tweaked logic
|
||||||
of no_session to avoid useless query
|
of no_session to avoid useless query
|
||||||
- Added Greek Translation ( Thx Panayotis Tsirigotis )
|
- Added Greek Translation ( Thx Panayotis Tsirigotis )
|
||||||
|
|
|
@ -145,7 +145,7 @@ class Access {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Config::get('allow_zip_download') AND $GLOBALS['user']->has_access(25)) {
|
if (Config::get('allow_zip_download') AND $GLOBALS['user']->has_access(25)) {
|
||||||
return $GLOBALS['user']->prefs['download'];
|
return Config::get('download');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -237,7 +237,7 @@ class Access {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'localplay':
|
case 'localplay':
|
||||||
// Check their localplay_level
|
// Check their localplay_level
|
||||||
if ($GLOBALS['user']->prefs['localplay_level'] >= $level) {
|
if (Config::get('localplay_level') >= $level) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -86,13 +86,19 @@ class Api {
|
||||||
$data['type'] = 'api';
|
$data['type'] = 'api';
|
||||||
$data['value'] = $timestamp;
|
$data['value'] = $timestamp;
|
||||||
$token = vauth::session_create($data);
|
$token = vauth::session_create($data);
|
||||||
|
|
||||||
// Insert the token into the streamer
|
// Insert the token into the streamer
|
||||||
$stream = new Stream();
|
$stream = new Stream();
|
||||||
$stream->user_id = $client->id;
|
$stream->user_id = $client->id;
|
||||||
$stream->insert_session($token);
|
$stream->insert_session($token);
|
||||||
debug_event('API','Login Success, passphrase matched','1');
|
debug_event('API','Login Success, passphrase matched','1');
|
||||||
|
|
||||||
return array('auth'=>$token,'api'=>self::$version);
|
// We need to also get the 'last update' of the catalog information in an RFC 2822 Format
|
||||||
|
$sql = "SELECT MAX(`last_update`) AS `update`,MAX(`last_add`) AS `add` FROM `catalog`";
|
||||||
|
$db_results = Dba::query($sql);
|
||||||
|
$row = Dba::fetch_assoc($db_results);
|
||||||
|
|
||||||
|
return array('auth'=>$token,'api'=>self::$version,'update'=>date("r",$row['update']),'add'=>date("r",$row['add']));
|
||||||
} // match
|
} // match
|
||||||
|
|
||||||
} // end while
|
} // end while
|
||||||
|
|
|
@ -671,7 +671,7 @@ class Browse {
|
||||||
self::$total_objects = count($object_ids);
|
self::$total_objects = count($object_ids);
|
||||||
|
|
||||||
// Limit is based on the users preferences
|
// Limit is based on the users preferences
|
||||||
$limit = $GLOBALS['user']->prefs['offset_limit'] ? $GLOBALS['user']->prefs['offset_limit'] : '25';
|
$limit = Config::get('offset_limit') ? Config::get('offset_limit') : '25';
|
||||||
|
|
||||||
if (count($object_ids) > self::$start) {
|
if (count($object_ids) > self::$start) {
|
||||||
$object_ids = array_slice($object_ids,self::$start,$limit);
|
$object_ids = array_slice($object_ids,self::$start,$limit);
|
||||||
|
|
|
@ -206,7 +206,7 @@ class Localplay {
|
||||||
$this->_player->uninstall();
|
$this->_player->uninstall();
|
||||||
|
|
||||||
// If its our current player, reset player to nothing
|
// If its our current player, reset player to nothing
|
||||||
if ($GLOBALS['user']->prefs['localplay_controller'] == $this->type) {
|
if (Config::get('localplay_controller') == $this->type) {
|
||||||
Preference::update('localplay_controller',$GLOBALS['user']->id,'');
|
Preference::update('localplay_controller',$GLOBALS['user']->id,'');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class metadata {
|
||||||
|
|
||||||
// For now it's only mystrands
|
// For now it's only mystrands
|
||||||
OpenStrands::set_auth_token(Config::get('mystrands_developer_key'));
|
OpenStrands::set_auth_token(Config::get('mystrands_developer_key'));
|
||||||
$openstrands = new OpenStrands($GLOBALS['user']->prefs['mystrands_user'],$GLOBALS['user']->prefs['mystrands_pass']);
|
$openstrands = new OpenStrands(Config::get('mystrands_user'),Config::get('mystrands_pass'));
|
||||||
|
|
||||||
// Make sure auth worked
|
// Make sure auth worked
|
||||||
if (!$openstrands) { return false; }
|
if (!$openstrands) { return false; }
|
||||||
|
@ -101,7 +101,7 @@ class metadata {
|
||||||
|
|
||||||
// For now it's only mystrands
|
// For now it's only mystrands
|
||||||
OpenStrands::set_auth_token(Config::get('mystrands_developer_key'));
|
OpenStrands::set_auth_token(Config::get('mystrands_developer_key'));
|
||||||
$openstrands = new OpenStrands($GLOBALS['user']->prefs['mystrands_user'],$GLOBALS['user']->prefs['mystrands_pass']);
|
$openstrands = new OpenStrands(Config::get('mystrands_user'),Config::get('mystrands_pass'));
|
||||||
|
|
||||||
if (!$openstrands) { return false; }
|
if (!$openstrands) { return false; }
|
||||||
|
|
||||||
|
|
|
@ -223,9 +223,6 @@ class Stream {
|
||||||
}
|
}
|
||||||
$song = new Song($song_id);
|
$song = new Song($song_id);
|
||||||
if ($song->type == ".flac") { $song->type = ".ogg"; }
|
if ($song->type == ".flac") { $song->type = ".ogg"; }
|
||||||
if ($GLOBALS['user']->prefs['play_type'] == 'downsample') {
|
|
||||||
$ds = $GLOBALS['user']->prefs['sample_rate'];
|
|
||||||
}
|
|
||||||
echo $song->get_url();
|
echo $song->get_url();
|
||||||
} // end foreach
|
} // end foreach
|
||||||
|
|
||||||
|
@ -408,7 +405,7 @@ class Stream {
|
||||||
//FIXME: This needs to go in a template, here for now though
|
//FIXME: This needs to go in a template, here for now though
|
||||||
//FIXME: This preference doesn't even exists, we'll eventually
|
//FIXME: This preference doesn't even exists, we'll eventually
|
||||||
//FIXME: just make it the default
|
//FIXME: just make it the default
|
||||||
if ($GLOBALS['user']->prefs['embed_xspf'] == 1 ){
|
if (Config::get('embed_xspf') == 1 ){
|
||||||
header("Location: ".Config::get('web_path')."/index.php?xspf&play_info=".$GLOBALS['user']->playlist->id);
|
header("Location: ".Config::get('web_path')."/index.php?xspf&play_info=".$GLOBALS['user']->playlist->id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -446,7 +443,7 @@ class Stream {
|
||||||
function create_localplay() {
|
function create_localplay() {
|
||||||
|
|
||||||
// First figure out what their current one is and create the object
|
// First figure out what their current one is and create the object
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$localplay->connect();
|
$localplay->connect();
|
||||||
//HACK!!!
|
//HACK!!!
|
||||||
// Yea.. you know the baby jesus... he's crying right meow
|
// Yea.. you know the baby jesus... he's crying right meow
|
||||||
|
@ -526,7 +523,7 @@ class Stream {
|
||||||
$max_bitrate = Config::get('max_bit_rate');
|
$max_bitrate = Config::get('max_bit_rate');
|
||||||
$min_bitrate = Config::get('min_bit_rate');
|
$min_bitrate = Config::get('min_bit_rate');
|
||||||
$time = time();
|
$time = time();
|
||||||
$user_sample_rate = $GLOBALS['user']->prefs['sample_rate'];
|
$user_sample_rate = Config::get('sample_rate');
|
||||||
$browser = new Browser();
|
$browser = new Browser();
|
||||||
|
|
||||||
if (!$song_name) {
|
if (!$song_name) {
|
||||||
|
@ -705,9 +702,9 @@ class Stream {
|
||||||
if (AJAX_INCLUDE != '1') { return false; }
|
if (AJAX_INCLUDE != '1') { return false; }
|
||||||
|
|
||||||
// If we're doin the flash magic then run away as well
|
// If we're doin the flash magic then run away as well
|
||||||
if ($GLOBALS['user']->prefs['play_type'] == 'xspf_player') { return false; }
|
if (Config::get('play_type') == 'xspf_player') { return false; }
|
||||||
|
|
||||||
switch ($GLOBALS['user']->prefs['playlist_method']) {
|
switch (Config::get('playlist_method')) {
|
||||||
default:
|
default:
|
||||||
case 'clear':
|
case 'clear':
|
||||||
case 'default':
|
case 'default':
|
||||||
|
|
|
@ -236,7 +236,7 @@ class vauth {
|
||||||
$session_name = Config::get('session_name');
|
$session_name = Config::get('session_name');
|
||||||
|
|
||||||
Config::set('cookie_life',$remember_length,'1');
|
Config::set('cookie_life',$remember_length,'1');
|
||||||
setcookie($session_name . '_remember',"Rappelez-vous, rappelez-vous le 27 mars",time() + $remember_length,'/',Config::get('cookie_domain'));
|
setcookie($session_name . '_remember',"Rappelez-vous, rappelez-vous le 27 mars",time() + $remember_length,'/');
|
||||||
|
|
||||||
} // create_remember_cookie
|
} // create_remember_cookie
|
||||||
|
|
||||||
|
@ -301,13 +301,6 @@ class vauth {
|
||||||
// No cookie n go!
|
// No cookie n go!
|
||||||
if (!isset($_COOKIE[$session_name])) { return false; }
|
if (!isset($_COOKIE[$session_name])) { return false; }
|
||||||
|
|
||||||
$key = scrub_in($_COOKIE[$session_name]);
|
|
||||||
$data = self::get_session_data($key);
|
|
||||||
|
|
||||||
if (!is_array($data)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for a remember me
|
// Check for a remember me
|
||||||
if (isset($_COOKIE[$session_name . '_remember'])) {
|
if (isset($_COOKIE[$session_name . '_remember'])) {
|
||||||
self::create_remember_cookie();
|
self::create_remember_cookie();
|
||||||
|
|
|
@ -144,6 +144,7 @@ require_once $prefix . '/modules/infotools/openstrands.class.php';
|
||||||
$results = Preference::fix_preferences($results);
|
$results = Preference::fix_preferences($results);
|
||||||
|
|
||||||
Config::set_by_array($results,1);
|
Config::set_by_array($results,1);
|
||||||
|
debug_event('ZZWANG IS',$wang,'1');
|
||||||
|
|
||||||
// Modules (These are conditionaly included depending upon config values)
|
// Modules (These are conditionaly included depending upon config values)
|
||||||
if (Config::get('ratings')) {
|
if (Config::get('ratings')) {
|
||||||
|
@ -219,11 +220,10 @@ elseif (!Config::get('use_auth')) {
|
||||||
// If Auth, but no session is set
|
// If Auth, but no session is set
|
||||||
else {
|
else {
|
||||||
if (isset($_REQUEST['sessid'])) {
|
if (isset($_REQUEST['sessid'])) {
|
||||||
$sess_results = vauth::get_session_data($_REQUEST['sessid']);
|
|
||||||
session_name(Config::get('session_name'));
|
session_name(Config::get('session_name'));
|
||||||
session_id(scrub_in($_REQUEST['sessid']));
|
session_id(scrub_in($_REQUEST['sessid']));
|
||||||
session_start();
|
session_start();
|
||||||
$GLOBALS['user'] = User::get_from_username($sess_results['username']);
|
$GLOBALS['user'] = User::get_from_username($_SESSION['userdata']['username']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$GLOBALS['user'] = new User();
|
$GLOBALS['user'] = new User();
|
||||||
|
@ -264,5 +264,4 @@ if (! preg_match('/update\.php/', $_SERVER['PHP_SELF'])) {
|
||||||
|
|
||||||
// For the XMLRPC stuff
|
// For the XMLRPC stuff
|
||||||
$GLOBALS['xmlrpc_internalencoding'] = Config::get('site_charset');
|
$GLOBALS['xmlrpc_internalencoding'] = Config::get('site_charset');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,136 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) 2001 - 2006 Ampache.org
|
|
||||||
All Rights Reserved
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* insert_locaplay_preferences
|
|
||||||
* This takes a controller type and inserts the preferences
|
|
||||||
* Into the database, it is able to handle existing preferences
|
|
||||||
* It checks before inserting...
|
|
||||||
*/
|
|
||||||
function insert_localplay_preferences($type) {
|
|
||||||
|
|
||||||
/* We can't assume the connect so let's just
|
|
||||||
* create it then get the preferences
|
|
||||||
*/
|
|
||||||
$localplay = new Localplay($type);
|
|
||||||
|
|
||||||
$preferences = $localplay->get_preferences();
|
|
||||||
|
|
||||||
foreach ($preferences as $preference) {
|
|
||||||
$name = 'localplay_' . $type . '_' . $preference['name'];
|
|
||||||
/* Check for an existing record */
|
|
||||||
$sql = "SELECT id FROM preferences WHERE name = '" . sql_escape($name) . "'";
|
|
||||||
$db_results = mysql_query($sql, dbh());
|
|
||||||
|
|
||||||
if (mysql_num_rows($db_results)) { continue; }
|
|
||||||
|
|
||||||
insert_preference($name,$preference['description'],$preference['default'],'25',$preference['type'],'streaming');
|
|
||||||
|
|
||||||
} // end foreach preferences
|
|
||||||
|
|
||||||
/* Fix everyones preferences */
|
|
||||||
$sql = "SELECT * FROM `user`";
|
|
||||||
$db_results = Dba::query($sql);
|
|
||||||
|
|
||||||
$temp_user = new User();
|
|
||||||
$temp_user->fix_preferences('-1');
|
|
||||||
|
|
||||||
while ($r = mysql_fetch_assoc($db_results)) {
|
|
||||||
$temp_user->fix_preferences($r['username']);
|
|
||||||
} // end while
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} // insert_localplay_preferences
|
|
||||||
|
|
||||||
/**
|
|
||||||
* remove_localplay_preferences
|
|
||||||
* This function has two uses, if it is called with a specific type then it
|
|
||||||
* just removes the preferences for that type, however it if its called with
|
|
||||||
* nothing then it removes any set of preferences where the module no longer
|
|
||||||
* exists
|
|
||||||
*/
|
|
||||||
function remove_localplay_preferences($type=0) {
|
|
||||||
|
|
||||||
/* If we've gotten a type wipe and go! */
|
|
||||||
if ($type) {
|
|
||||||
$sql = "DELETE FROM preferences WHERE name LIKE 'localplay_" . sql_escape($type) . "_%'";
|
|
||||||
$db_results = mysql_query($sql, dbh());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Select everything but our two built-in ones
|
|
||||||
$sql = "SELECT * FROM preferences WHERE name != 'localplay_level' AND name != 'localplay_controller' AND name LIKE 'localplay_%'";
|
|
||||||
$db_results = mysql_query($sql, dbh());
|
|
||||||
|
|
||||||
$results = array();
|
|
||||||
|
|
||||||
/* We need to organize by module to make it easy
|
|
||||||
* to figure out which modules no longer exist
|
|
||||||
* and wack the preferences... unless we've
|
|
||||||
* specified a name then just wack those
|
|
||||||
* preferences
|
|
||||||
*/
|
|
||||||
while ($r = mysql_fetch_assoc($db_results)) {
|
|
||||||
|
|
||||||
$name = $r['name'];
|
|
||||||
preg_match("/localplay_([\w\d\-\]+)_.+/",$name,$matches);
|
|
||||||
$key = $matches['1'];
|
|
||||||
|
|
||||||
$results[$key] = $r;
|
|
||||||
|
|
||||||
} // end while
|
|
||||||
|
|
||||||
/* If we've got a type */
|
|
||||||
//FIXME!!!
|
|
||||||
|
|
||||||
|
|
||||||
} // remove_localplay_preferences
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function stores the Localplay object
|
|
||||||
* It checks to see what access level you have
|
|
||||||
* and creates the localplay object based on that
|
|
||||||
* @package Local Play
|
|
||||||
*/
|
|
||||||
function init_localplay($reload=0) {
|
|
||||||
|
|
||||||
static $localplay;
|
|
||||||
if ($GLOBALS['user']->prefs['localplay_level'] == '0') { return false; }
|
|
||||||
|
|
||||||
if (!strlen($GLOBALS['user']->prefs['localplay_controller'])) { return false; }
|
|
||||||
|
|
||||||
if ($GLOBALS['user']->prefs['localplay_level'] == '1' AND !is_object($localplay)) {
|
|
||||||
$localplay = new Localplay(conf('localplay_controller'));
|
|
||||||
$localplay->connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($GLOBALS['user']->prefs['localplay_level'] == '2' AND !is_object($localplay)) {
|
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
|
||||||
$localplay->connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $localplay;
|
|
||||||
|
|
||||||
} // function init_localplay
|
|
||||||
|
|
||||||
?>
|
|
|
@ -35,7 +35,7 @@ switch ($_REQUEST['action']) {
|
||||||
if (!Access::check('localplay','75')) { access_denied(); break; }
|
if (!Access::check('localplay','75')) { access_denied(); break; }
|
||||||
|
|
||||||
// Get the current localplay fields
|
// Get the current localplay fields
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$fields = $localplay->get_instance_fields();
|
$fields = $localplay->get_instance_fields();
|
||||||
require_once Config::get('prefix') . '/templates/show_localplay_add_instance.inc.php';
|
require_once Config::get('prefix') . '/templates/show_localplay_add_instance.inc.php';
|
||||||
break;
|
break;
|
||||||
|
@ -44,20 +44,20 @@ switch ($_REQUEST['action']) {
|
||||||
if (!Access::check('localplay','75')) { access_denied(); break; }
|
if (!Access::check('localplay','75')) { access_denied(); break; }
|
||||||
|
|
||||||
// Setup the object
|
// Setup the object
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$localplay->add_instance($_POST);
|
$localplay->add_instance($_POST);
|
||||||
break;
|
break;
|
||||||
case 'update_instance':
|
case 'update_instance':
|
||||||
// Make sure they gots them rights
|
// Make sure they gots them rights
|
||||||
if (!Access::check('localplay','75')) { access_denied(); break; }
|
if (!Access::check('localplay','75')) { access_denied(); break; }
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$localplay->update_instance($_REQUEST['instance'],$_POST);
|
$localplay->update_instance($_REQUEST['instance'],$_POST);
|
||||||
header("Location:" . Config::get('web_path') . "/localplay.php?action=show_instances");
|
header("Location:" . Config::get('web_path') . "/localplay.php?action=show_instances");
|
||||||
break;
|
break;
|
||||||
case 'edit_instance':
|
case 'edit_instance':
|
||||||
// Check to make sure they've got the access
|
// Check to make sure they've got the access
|
||||||
if (!Access::check('localplay','75')) { access_denied(); break; }
|
if (!Access::check('localplay','75')) { access_denied(); break; }
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$instance = $localplay->get_instance($_REQUEST['instance']);
|
$instance = $localplay->get_instance($_REQUEST['instance']);
|
||||||
$fields = $localplay->get_instance_fields();
|
$fields = $localplay->get_instance_fields();
|
||||||
require_once Config::get('prefix') . '/templates/show_localplay_edit_instance.inc.php';
|
require_once Config::get('prefix') . '/templates/show_localplay_edit_instance.inc.php';
|
||||||
|
@ -65,7 +65,7 @@ switch ($_REQUEST['action']) {
|
||||||
case 'show_instances':
|
case 'show_instances':
|
||||||
// First build the localplay object and then get the instances
|
// First build the localplay object and then get the instances
|
||||||
if (!Access::check('localplay','5')) { access_denied(); break; }
|
if (!Access::check('localplay','5')) { access_denied(); break; }
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$instances = $localplay->get_instances();
|
$instances = $localplay->get_instances();
|
||||||
$fields = $localplay->get_instance_fields();
|
$fields = $localplay->get_instance_fields();
|
||||||
require_once Config::get('prefix') . '/templates/show_localplay_instances.inc.php';
|
require_once Config::get('prefix') . '/templates/show_localplay_instances.inc.php';
|
||||||
|
@ -74,7 +74,7 @@ switch ($_REQUEST['action']) {
|
||||||
case 'show_playlist':
|
case 'show_playlist':
|
||||||
if (!Access::check('localplay','5')) { access_denied(); break; }
|
if (!Access::check('localplay','5')) { access_denied(); break; }
|
||||||
// Init and then connect to our localplay instance
|
// Init and then connect to our localplay instance
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$localplay->connect();
|
$localplay->connect();
|
||||||
|
|
||||||
// Pull the current playlist and require the template
|
// Pull the current playlist and require the template
|
||||||
|
|
|
@ -228,7 +228,7 @@ class AmpacheHttpq extends localplay_controller {
|
||||||
*/
|
*/
|
||||||
public function get_instance($instance='') {
|
public function get_instance($instance='') {
|
||||||
|
|
||||||
$instance = $instance ? $instance : $GLOBALS['user']->prefs['httpq_active'];
|
$instance = $instance ? $instance : Config::get('httpq_active');
|
||||||
$instance = Dba::escape($instance);
|
$instance = Dba::escape($instance);
|
||||||
|
|
||||||
$sql = "SELECT * FROM `localplay_httpq` WHERE `id`='$instance'";
|
$sql = "SELECT * FROM `localplay_httpq` WHERE `id`='$instance'";
|
||||||
|
|
|
@ -191,7 +191,7 @@ class AmpacheMpd extends localplay_controller {
|
||||||
*/
|
*/
|
||||||
public function get_instance($instance='') {
|
public function get_instance($instance='') {
|
||||||
|
|
||||||
$instance = $instance ? $instance : $GLOBALS['user']->prefs['mpd_active'];
|
$instance = $instance ? $instance : Config::get('mpd_active');
|
||||||
$instance = Dba::escape($instance);
|
$instance = Dba::escape($instance);
|
||||||
|
|
||||||
$sql = "SELECT * FROM `localplay_mpd` WHERE `id`='$instance'";
|
$sql = "SELECT * FROM `localplay_mpd` WHERE `id`='$instance'";
|
||||||
|
|
499
modules/prototype/prototype.js
vendored
499
modules/prototype/prototype.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -181,7 +181,7 @@ $song_name = $song->f_artist_full . " - " . $song->title . "." . $song->type;
|
||||||
/* If they are just trying to download make sure they have rights
|
/* If they are just trying to download make sure they have rights
|
||||||
* and then present them with the download file
|
* and then present them with the download file
|
||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'download' AND $GLOBALS['user']->prefs['download']) {
|
if ($_GET['action'] == 'download' AND Config::get('download')) {
|
||||||
|
|
||||||
// STUPID IE
|
// STUPID IE
|
||||||
$song->format_pattern();
|
$song->format_pattern();
|
||||||
|
@ -199,9 +199,9 @@ if ($_GET['action'] == 'download' AND $GLOBALS['user']->prefs['download']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if we should be throttling because we can get away with it
|
// Check to see if we should be throttling because we can get away with it
|
||||||
if ($GLOBALS['user']->prefs['rate_limit'] > 0) {
|
if (Config::get('rate_limit') > 0) {
|
||||||
while (!feof($fp)) {
|
while (!feof($fp)) {
|
||||||
echo fread($fp,round($GLOBALS['user']->prefs['rate_limit']*1024));
|
echo fread($fp,round(Config::get('rate_limit')*1024));
|
||||||
flush();
|
flush();
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ if (Config::get('downsample_remote')) {
|
||||||
} // if downsample remote is enabled
|
} // if downsample remote is enabled
|
||||||
|
|
||||||
// If they are downsampling, or if the song is not a native stream or it's non-local
|
// If they are downsampling, or if the song is not a native stream or it's non-local
|
||||||
if (($GLOBALS['user']->prefs['transcode'] == 'always' || !$song->native_stream() || $not_local) && $GLOBALS['user']->prefs['transcode'] != 'never') {
|
if ((Config::get('transcode') == 'always' || !$song->native_stream() || $not_local) && Config::get('transcode') != 'never') {
|
||||||
debug_event('downsample','Starting Downsample...','5');
|
debug_event('downsample','Starting Downsample...','5');
|
||||||
$fp = Stream::start_downsample($song,$lastid,$song_name,$start);
|
$fp = Stream::start_downsample($song,$lastid,$song_name,$start);
|
||||||
$song_name = $song->f_artist_full . " - " . $song->title . "." . $song->type;
|
$song_name = $song->f_artist_full . " - " . $song->title . "." . $song->type;
|
||||||
|
@ -340,7 +340,7 @@ else {
|
||||||
|
|
||||||
|
|
||||||
/* Clean up any open ends */
|
/* Clean up any open ends */
|
||||||
if ($GLOBALS['user']->prefs['play_type'] == 'downsample' || !$song->native_stream()) {
|
if (Config::get('play_type') == 'downsample' || !$song->native_stream()) {
|
||||||
@pclose($fp);
|
@pclose($fp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2001 - 2007 Ampache.org
|
Copyright (c) 2001 - 2008 Ampache.org
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
|
|
|
@ -34,7 +34,7 @@ switch ($_REQUEST['action']) {
|
||||||
|
|
||||||
$type = $_REQUEST['instance'] ? 'localplay' : 'stream';
|
$type = $_REQUEST['instance'] ? 'localplay' : 'stream';
|
||||||
|
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$localplay->set_active_instance($_REQUEST['instance']);
|
$localplay->set_active_instance($_REQUEST['instance']);
|
||||||
Preference::update('play_type',$GLOBALS['user']->id,$type);
|
Preference::update('play_type',$GLOBALS['user']->id,$type);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ switch ($_REQUEST['action']) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$localplay->connect();
|
$localplay->connect();
|
||||||
|
|
||||||
// Switch on valid commands
|
// Switch on valid commands
|
||||||
|
@ -102,7 +102,7 @@ switch ($_REQUEST['action']) {
|
||||||
debug_event('DENIED','Attempted to delete track without access','1');
|
debug_event('DENIED','Attempted to delete track without access','1');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$localplay->connect();
|
$localplay->connect();
|
||||||
|
|
||||||
// Scrub in the delete request
|
// Scrub in the delete request
|
||||||
|
@ -129,7 +129,7 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scrub it in
|
// Scrub it in
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$localplay->delete_instance($_REQUEST['instance']);
|
$localplay->delete_instance($_REQUEST['instance']);
|
||||||
|
|
||||||
$key = 'localplay_instance_' . $_REQUEST['instance'];
|
$key = 'localplay_instance_' . $_REQUEST['instance'];
|
||||||
|
@ -143,7 +143,7 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scrub her in
|
// Scrub her in
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$localplay->connect();
|
$localplay->connect();
|
||||||
$localplay->repeat(make_bool($_REQUEST['value']));
|
$localplay->repeat(make_bool($_REQUEST['value']));
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ switch ($_REQUEST['action']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scrub her in
|
// Scrub her in
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$localplay->connect();
|
$localplay->connect();
|
||||||
$localplay->random(make_bool($_REQUEST['value']));
|
$localplay->random(make_bool($_REQUEST['value']));
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ switch ($_REQUEST['action']) {
|
||||||
case 'basket':
|
case 'basket':
|
||||||
// We need to set the basket up!
|
// We need to set the basket up!
|
||||||
$_SESSION['iframe']['target'] = Config::get('web_path') . '/stream.php?action=basket&playlist_method=' . scrub_out($_REQUEST['playlist_method']);
|
$_SESSION['iframe']['target'] = Config::get('web_path') . '/stream.php?action=basket&playlist_method=' . scrub_out($_REQUEST['playlist_method']);
|
||||||
$results['rfc3514'] = '<script type="text/javascript">reload_util("'.$_SESSION['iframe']['target'].'")</script>';
|
$results['rfc3514'] = '<script type="text/javascript">reload_util(\''.$_SESSION['iframe']['target'] . '\');</script>';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$results['rfc3514'] = '0x1';
|
$results['rfc3514'] = '0x1';
|
||||||
|
|
16
stream.php
16
stream.php
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (c) 2001 - 2007 ampache.org
|
Copyright (c) 2001 - 2008 ampache.org
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
|
@ -18,11 +18,11 @@
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'lib/init.php';
|
require_once 'lib/init.php';
|
||||||
|
|
||||||
/* If we are running a demo, quick while you still can! */
|
/* If we are running a demo, quick while you still can! */
|
||||||
if (Config::get('demo_mode') || !$GLOBALS['user']->has_access('25')) {
|
if (Config::get('demo_mode') || !$GLOBALS['user']->has_access('25')) {
|
||||||
|
|
||||||
access_denied();
|
access_denied();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ switch ($_REQUEST['action']) {
|
||||||
} // end foreach
|
} // end foreach
|
||||||
|
|
||||||
// Check to see if 'clear' was passed if it was then we need to reset the basket
|
// Check to see if 'clear' was passed if it was then we need to reset the basket
|
||||||
if ( ($_REQUEST['playlist_method'] == 'clear' || $GLOBALS['user']->prefs['playlist_method'] == 'clear') AND $GLOBALS['user']->prefs['play_method'] != 'xspf_player') {
|
if ( ($_REQUEST['playlist_method'] == 'clear' || Config::get('playlist_method') == 'clear') AND Config::get('play_method') != 'xspf_player') {
|
||||||
$GLOBALS['user']->playlist->clear();
|
$GLOBALS['user']->playlist->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,15 +179,15 @@ switch ($_REQUEST['method']) {
|
||||||
break;
|
break;
|
||||||
case 'democratic':
|
case 'democratic':
|
||||||
// Don't let them loop it
|
// Don't let them loop it
|
||||||
if ($GLOBALS['user']->prefs['play_type'] == 'democratic') {
|
if (Config::get('play_type') == 'democratic') {
|
||||||
$GLOBALS['user']->prefs['play_type'] = 'stream';
|
Config::set('play_type','stream','1');
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if ($GLOBALS['user']->prefs['play_type'] == 'stream') {
|
if (Config::get('play_type') == 'stream') {
|
||||||
$stream_type = $GLOBALS['user']->prefs['playlist_type'];
|
$stream_type = Config::get('playlist_type');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$stream_type = $GLOBALS['user']->prefs['play_type'];
|
$stream_type = Config::get('play_type');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Pull these variables out to allow shorthand (easier for lazy programmers)
|
// Pull these variables out to allow shorthand (easier for lazy programmers)
|
||||||
$limit = $GLOBALS['user']->prefs['offset_limit'] ? $GLOBALS['user']->prefs['offset_limit'] : '25';
|
$limit = Config::get('offset_limit') ? Config::get('offset_limit') : '25';
|
||||||
$start = Browse::$start;
|
$start = Browse::$start;
|
||||||
$total = Browse::$total_objects;
|
$total = Browse::$total_objects;
|
||||||
$uid = Config::get('list_header_uid');
|
$uid = Config::get('list_header_uid');
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<?php if ($GLOBALS['user']->prefs['play_type'] == 'localplay') { require_once Config::get('prefix') . '/templates/show_localplay_control.inc.php'; } ?>
|
<?php if (Config::get('play_type') == 'localplay') { require_once Config::get('prefix') . '/templates/show_localplay_control.inc.php'; } ?>
|
||||||
<ul id="rb_current_playlist">
|
<ul id="rb_current_playlist">
|
||||||
<?php
|
<?php
|
||||||
//FIXME :: this feels kludgy
|
//FIXME :: this feels kludgy
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
|
|
||||||
Copyright (c) 2001 - 2006 Ampache.org
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
$web_path = conf('web_path');
|
|
||||||
$localplay = init_localplay();
|
|
||||||
?>
|
|
||||||
<?php show_box_top(ucfirst($localplay->type) . ' ' . _('Localplay')); ?>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td valign="top">
|
|
||||||
<strong><?php echo _('Actions'); ?>:</strong><br />
|
|
||||||
<?php if ($localplay->has_function('delete_all')) { ?>
|
|
||||||
<div><a class="button" href="<?php echo $web_path; ?>/localplay.php?action=delete_all"><?php echo _('Clear Playlist'); ?></a></div>
|
|
||||||
<?php } ?>
|
|
||||||
</td><td>
|
|
||||||
<?php $add_info = "&return=1"; ?>
|
|
||||||
<?php require_once(conf('prefix') . '/templates/show_localplay_status.inc.php'); ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<?php show_box_bottom(); ?>
|
|
||||||
|
|
||||||
|
|
||||||
<?php show_box_top(_('Current Playlist')); ?>
|
|
||||||
<div id="lp_playlist">
|
|
||||||
<?php require_once(conf('prefix') . '/templates/show_localplay_playlist.inc.php'); ?>
|
|
||||||
</div>
|
|
||||||
<?php show_box_bottom(); ?>
|
|
|
@ -28,7 +28,7 @@
|
||||||
<td class="cel_track"><?php echo $song->f_track; ?></td>
|
<td class="cel_track"><?php echo $song->f_track; ?></td>
|
||||||
<td class="cel_time"><?php echo $song->f_time; ?></td>
|
<td class="cel_time"><?php echo $song->f_time; ?></td>
|
||||||
<td class="cel_action">
|
<td class="cel_action">
|
||||||
<?php if ($GLOBALS['user']->prefs['download']) { ?>
|
<?php if (Config::get('download')) { ?>
|
||||||
<a href="<?php echo Config::get('web_path'); ?>/stream.php?action=download&song_id=<?php echo $song->id; ?>">
|
<a href="<?php echo Config::get('web_path'); ?>/stream.php?action=download&song_id=<?php echo $song->id; ?>">
|
||||||
<?php echo get_user_icon('download',_('Download')); ?>
|
<?php echo get_user_icon('download',_('Download')); ?>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
$name = "is_" . $GLOBALS['user']->prefs['play_type'];
|
$name = "is_" . Config::get('play_type');
|
||||||
${$name} = 'selected="selected" ';
|
${$name} = 'selected="selected" ';
|
||||||
|
|
||||||
if (Preference::has_access('play_type')) {
|
if (Preference::has_access('play_type')) {
|
||||||
|
@ -42,6 +42,6 @@ if (Preference::has_access('play_type')) {
|
||||||
<?php
|
<?php
|
||||||
} // if they have access
|
} // if they have access
|
||||||
// Else just show what it currently is
|
// Else just show what it currently is
|
||||||
else { echo ucwords($GLOBALS['user']->prefs['play_type']);}
|
else { echo ucwords(Config::get('play_type'));}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<?php echo get_user_icon('comment',_('Post Shout')); ?>
|
<?php echo get_user_icon('comment',_('Post Shout')); ?>
|
||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ($GLOBALS['user']->prefs['download']) { ?>
|
<?php if (Config::get('download')) { ?>
|
||||||
<a href="<?php echo Config::get('web_path'); ?>/stream.php?action=download&song_id=<?php echo $song->id; ?>">
|
<a href="<?php echo Config::get('web_path'); ?>/stream.php?action=download&song_id=<?php echo $song->id; ?>">
|
||||||
<?php echo get_user_icon('download',_('Download')); ?>
|
<?php echo get_user_icon('download',_('Download')); ?>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -18,14 +18,13 @@
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<ul class="sb2" id="sb_localplay">
|
<ul class="sb2" id="sb_localplay">
|
||||||
<?php if (Config::get('allow_localplay_playback') AND $GLOBALS['user']->prefs['localplay_controller'] AND Access::check('localplay','5')) { ?>
|
<?php if (Config::get('allow_localplay_playback') AND Config::get('localplay_controller') AND Access::check('localplay','5')) { ?>
|
||||||
<?php
|
<?php
|
||||||
// Little bit of work to be done here
|
// Little bit of work to be done here
|
||||||
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
|
$localplay = new Localplay(Config::get('localplay_controller'));
|
||||||
$current_instance = $localplay->current_instance();
|
$current_instance = $localplay->current_instance();
|
||||||
$class = $current_instance ? '' : ' class="active_instance"';
|
$class = $current_instance ? '' : ' class="active_instance"';
|
||||||
?>
|
?>
|
||||||
|
|
1
util.php
1
util.php
|
@ -18,6 +18,7 @@
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
$wang = 'util';
|
||||||
require_once 'lib/init.php';
|
require_once 'lib/init.php';
|
||||||
|
|
||||||
header("Expires: Tuesday, 27 Mar 1984 05:00:00 GMT");
|
header("Expires: Tuesday, 27 Mar 1984 05:00:00 GMT");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue