mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 01:39:28 +02:00
Merge pull request #1269 from Phyks/issue_1260
Fix coding guidelines incoherence (fix #160)
This commit is contained in:
commit
f76e7e6228
541 changed files with 1898 additions and 1898 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -25,3 +25,4 @@ web.config
|
|||
robots.txt
|
||||
php-cs-fixer.phar
|
||||
.php_cs.cache
|
||||
cs_fixer_tmp_*
|
||||
|
|
1
.php_cs
1
.php_cs
|
@ -14,6 +14,7 @@ $finder = Symfony\CS\Finder\DefaultFinder::create()
|
|||
;
|
||||
|
||||
return Symfony\CS\Config\Config::create()
|
||||
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
|
||||
->finder($finder)
|
||||
->setUsingCache(true)
|
||||
;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
require_once '../lib/init.php';
|
||||
|
||||
if (!Access::check('interface','100')) {
|
||||
if (!Access::check('interface', '100')) {
|
||||
UI::access_denied();
|
||||
exit();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
Access::delete($_REQUEST['access_id']);
|
||||
$url = AmpConfig::get('web_path') . '/admin/access.php';
|
||||
show_confirmation(T_('Deleted'), T_('Your Access List Entry has been removed'),$url);
|
||||
show_confirmation(T_('Deleted'), T_('Your Access List Entry has been removed'), $url);
|
||||
break;
|
||||
case 'show_delete_record':
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
|
@ -45,12 +45,12 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
$access = new Access($_GET['access_id']);
|
||||
show_confirmation(T_('Deletion Request'), T_('Are you sure you want to permanently delete') . ' ' . $access->name,
|
||||
'admin/access.php?action=delete_record&access_id=' . $access->id,1,'delete_access');
|
||||
'admin/access.php?action=delete_record&access_id=' . $access->id, 1, 'delete_access');
|
||||
break;
|
||||
case 'add_host':
|
||||
|
||||
// Make sure we've got a valid form submission
|
||||
if (!Core::form_verify('add_acl','post')) {
|
||||
if (!Core::form_verify('add_acl', 'post')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ switch ($_REQUEST['action']) {
|
|||
|
||||
if (!AmpError::occurred()) {
|
||||
$url = AmpConfig::get('web_path') . '/admin/access.php';
|
||||
show_confirmation(T_('Added'), T_('Your new Access Control List(s) have been created'),$url);
|
||||
show_confirmation(T_('Added'), T_('Your new Access Control List(s) have been created'), $url);
|
||||
} else {
|
||||
$action = 'show_add_' . $_POST['type'];
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_add_access.inc.php');
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -23,7 +23,7 @@
|
|||
require_once '../lib/init.php';
|
||||
require_once AmpConfig::get('prefix') . '/modules/catalog/local/local.catalog.php';
|
||||
|
||||
if (!Access::check('interface','100')) {
|
||||
if (!Access::check('interface', '100')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
case 'show_delete_catalog':
|
||||
$next_url = AmpConfig::get('web_path') . '/admin/catalog.php?action=delete_catalog&catalogs[]=' . implode(',', $catalogs);
|
||||
show_confirmation(T_('Catalog Delete'), T_('Confirm Deletion Request'),$next_url,1,'delete_catalog');
|
||||
show_confirmation(T_('Catalog Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_catalog');
|
||||
break;
|
||||
case 'enable_disabled':
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
|
@ -128,7 +128,7 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
$url = AmpConfig::get('web_path') . '/admin/catalog.php';
|
||||
$title = count($songs) . nT_(' Disabled Song Processed', ' Disabled Songs Processed', count($songs));
|
||||
show_confirmation($title,$body,$url);
|
||||
show_confirmation($title, $body, $url);
|
||||
break;
|
||||
case 'clean_all_catalogs':
|
||||
catalog_worker('clean_all_catalogs');
|
||||
|
@ -150,7 +150,7 @@ switch ($_REQUEST['action']) {
|
|||
$url = AmpConfig::get('web_path') . '/admin/catalog.php';
|
||||
$title = T_('Catalog Updated');
|
||||
$body = '';
|
||||
show_confirmation($title,$body,$url);
|
||||
show_confirmation($title, $body, $url);
|
||||
break;
|
||||
case 'update_from':
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
|
@ -176,7 +176,7 @@ switch ($_REQUEST['action']) {
|
|||
AmpError::add('general', T_('Error: Name not specified'));
|
||||
}
|
||||
|
||||
if (!Core::form_verify('add_catalog','post')) {
|
||||
if (!Core::form_verify('add_catalog', 'post')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
}
|
||||
Stream::clear_now_playing();
|
||||
show_confirmation(T_('Now Playing Cleared'), T_('All now playing data has been cleared'),AmpConfig::get('web_path') . '/admin/catalog.php');
|
||||
show_confirmation(T_('Now Playing Cleared'), T_('All now playing data has been cleared'), AmpConfig::get('web_path') . '/admin/catalog.php');
|
||||
break;
|
||||
case 'show_disabled':
|
||||
/* Stop the demo hippies */
|
||||
|
@ -241,7 +241,7 @@ switch ($_REQUEST['action']) {
|
|||
|
||||
$catalog = Catalog::create_from_id($_REQUEST['catalog_id']);
|
||||
$nexturl = AmpConfig::get('web_path') . '/admin/catalog.php?action=delete_catalog&catalog_id=' . scrub_out($_REQUEST['catalog_id']);
|
||||
show_confirmation(T_('Delete Catalog'), T_('Do you really want to delete this catalog?') . " -- $catalog->name ($catalog->path)",$nexturl,1);
|
||||
show_confirmation(T_('Delete Catalog'), T_('Do you really want to delete this catalog?') . " -- $catalog->name ($catalog->path)", $nexturl, 1);
|
||||
break;
|
||||
case 'show_customize_catalog':
|
||||
$catalog = Catalog::create_from_id($_REQUEST['catalog_id']);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
require_once '../lib/init.php';
|
||||
|
||||
if (!Access::check('interface','100')) {
|
||||
if (!Access::check('interface', '100')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
require_once '../lib/init.php';
|
||||
|
||||
if (!Access::check('interface','100')) {
|
||||
if (!Access::check('interface', '100')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ switch ($_REQUEST['action']) {
|
|||
header("Content-Transfer-Encoding: binary");
|
||||
header("Cache-control: public");
|
||||
|
||||
$date = date("d/m/Y",time());
|
||||
$date = date("d/m/Y", time());
|
||||
|
||||
switch ($_REQUEST['export_format']) {
|
||||
case 'itunes':
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
require_once '../lib/init.php';
|
||||
|
||||
if (!Access::check('interface',100)) {
|
||||
if (!Access::check('interface', 100)) {
|
||||
UI::access_denied();
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
require_once '../lib/init.php';
|
||||
|
||||
if (!Access::check('interface','100')) {
|
||||
if (!Access::check('interface', '100')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ switch ($_REQUEST['action']) {
|
|||
License::create($_POST);
|
||||
$text = T_('License Created');
|
||||
}
|
||||
show_confirmation($text,'',AmpConfig::get('web_path') . '/admin/license.php');
|
||||
show_confirmation($text, '', AmpConfig::get('web_path') . '/admin/license.php');
|
||||
break;
|
||||
case 'show_edit':
|
||||
$license = new License($_REQUEST['license_id']);
|
||||
|
@ -50,7 +50,7 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
case 'delete':
|
||||
License::delete($_REQUEST['license_id']);
|
||||
show_confirmation(T_('License Deleted'),'',AmpConfig::get('web_path') . '/admin/license.php');
|
||||
show_confirmation(T_('License Deleted'), '', AmpConfig::get('web_path') . '/admin/license.php');
|
||||
break;
|
||||
default:
|
||||
$browse = new Browse();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
require_once '../lib/init.php';
|
||||
|
||||
if (!Access::check('interface','75')) {
|
||||
if (!Access::check('interface', '75')) {
|
||||
UI::access_denied();
|
||||
exit();
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ switch ($_REQUEST['action']) {
|
|||
$body = T_('Your E-mail was not sent.');
|
||||
}
|
||||
$url = AmpConfig::get('web_path') . '/admin/mail.php';
|
||||
show_confirmation($title,$body,$url);
|
||||
show_confirmation($title, $body, $url);
|
||||
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -44,15 +44,15 @@ switch ($_REQUEST['action']) {
|
|||
|
||||
// Go ahead and enable Localplay (Admin->System) as we assume they want to do that
|
||||
// if they are enabling this
|
||||
Preference::update('allow_localplay_playback','-1','1');
|
||||
Preference::update('localplay_level',$GLOBALS['user']->id,'100');
|
||||
Preference::update('localplay_controller',$GLOBALS['user']->id,$localplay->type);
|
||||
Preference::update('allow_localplay_playback', '-1', '1');
|
||||
Preference::update('localplay_level', $GLOBALS['user']->id, '100');
|
||||
Preference::update('localplay_controller', $GLOBALS['user']->id, $localplay->type);
|
||||
|
||||
/* Show Confirmation */
|
||||
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_localplay';
|
||||
$title = T_('localplay enabled');
|
||||
$body = '';
|
||||
show_confirmation($title ,$body, $url);
|
||||
show_confirmation($title, $body, $url);
|
||||
break;
|
||||
case 'install_catalog_type':
|
||||
$type = (string) scrub_in($_REQUEST['type']);
|
||||
|
@ -69,21 +69,21 @@ switch ($_REQUEST['action']) {
|
|||
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_catalog_types';
|
||||
$title = T_('Module enabled');
|
||||
$body = '';
|
||||
show_confirmation($title ,$body, $url);
|
||||
show_confirmation($title, $body, $url);
|
||||
break;
|
||||
case 'confirm_uninstall_localplay':
|
||||
$type = (string) scrub_in($_REQUEST['type']);
|
||||
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=uninstall_localplay&type=' . $type;
|
||||
$title = T_('Are you sure you want to disable this module?');
|
||||
$body = '';
|
||||
show_confirmation($title,$body,$url,1);
|
||||
show_confirmation($title, $body, $url, 1);
|
||||
break;
|
||||
case 'confirm_uninstall_catalog_type':
|
||||
$type = (string) scrub_in($_REQUEST['type']);
|
||||
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=uninstall_catalog_type&type=' . $type;
|
||||
$title = T_('Are you sure you want to disable this module?');
|
||||
$body = '';
|
||||
show_confirmation($title,$body,$url,1);
|
||||
show_confirmation($title, $body, $url, 1);
|
||||
break;
|
||||
case 'uninstall_localplay':
|
||||
$type = (string) scrub_in($_REQUEST['type']);
|
||||
|
@ -95,7 +95,7 @@ switch ($_REQUEST['action']) {
|
|||
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_localplay';
|
||||
$title = T_('Module disabled');
|
||||
$body = '';
|
||||
show_confirmation($title,$body,$url);
|
||||
show_confirmation($title, $body, $url);
|
||||
break;
|
||||
case 'uninstall_catalog_type':
|
||||
$type = (string) scrub_in($_REQUEST['type']);
|
||||
|
@ -117,17 +117,17 @@ switch ($_REQUEST['action']) {
|
|||
case 'install_plugin':
|
||||
/* Verify that this plugin exists */
|
||||
$plugins = Plugin::get_plugins();
|
||||
if (!array_key_exists($_REQUEST['plugin'],$plugins)) {
|
||||
debug_event('plugins','Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected','1');
|
||||
if (!array_key_exists($_REQUEST['plugin'], $plugins)) {
|
||||
debug_event('plugins', 'Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected', '1');
|
||||
break;
|
||||
}
|
||||
$plugin = new Plugin($_REQUEST['plugin']);
|
||||
if (!$plugin->install()) {
|
||||
debug_event('plugins','Error: Plugin Install Failed, ' . $_REQUEST['plugin'],'1');
|
||||
debug_event('plugins', 'Error: Plugin Install Failed, ' . $_REQUEST['plugin'], '1');
|
||||
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins';
|
||||
$title = T_('Unable to Install Plugin');
|
||||
$body = '';
|
||||
show_confirmation($title,$body,$url);
|
||||
show_confirmation($title, $body, $url);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -138,20 +138,20 @@ switch ($_REQUEST['action']) {
|
|||
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins';
|
||||
$title = T_('Plugin enabled');
|
||||
$body = '';
|
||||
show_confirmation($title,$body,$url);
|
||||
show_confirmation($title, $body, $url);
|
||||
break;
|
||||
case 'confirm_uninstall_plugin':
|
||||
$plugin = scrub_in($_REQUEST['plugin']);
|
||||
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=uninstall_plugin&plugin=' . $plugin;
|
||||
$title = T_('Are you sure you want to disable this plugin?');
|
||||
$body = '';
|
||||
show_confirmation($title,$body,$url,1);
|
||||
show_confirmation($title, $body, $url, 1);
|
||||
break;
|
||||
case 'uninstall_plugin':
|
||||
/* Verify that this plugin exists */
|
||||
$plugins = Plugin::get_plugins();
|
||||
if (!array_key_exists($_REQUEST['plugin'],$plugins)) {
|
||||
debug_event('plugins','Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected','1');
|
||||
if (!array_key_exists($_REQUEST['plugin'], $plugins)) {
|
||||
debug_event('plugins', 'Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected', '1');
|
||||
break;
|
||||
}
|
||||
$plugin = new Plugin($_REQUEST['plugin']);
|
||||
|
@ -164,13 +164,13 @@ switch ($_REQUEST['action']) {
|
|||
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins';
|
||||
$title = T_('Plugin disabled');
|
||||
$body = '';
|
||||
show_confirmation($title,$body,$url);
|
||||
show_confirmation($title, $body, $url);
|
||||
break;
|
||||
case 'upgrade_plugin':
|
||||
/* Verify that this plugin exists */
|
||||
$plugins = Plugin::get_plugins();
|
||||
if (!array_key_exists($_REQUEST['plugin'],$plugins)) {
|
||||
debug_event('plugins','Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected','1');
|
||||
if (!array_key_exists($_REQUEST['plugin'], $plugins)) {
|
||||
debug_event('plugins', 'Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected', '1');
|
||||
break;
|
||||
}
|
||||
$plugin = new Plugin($_REQUEST['plugin']);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
require_once '../lib/init.php';
|
||||
|
||||
if (!Access::check('interface','100')) {
|
||||
if (!Access::check('interface', '100')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
@ -36,11 +36,11 @@ switch ($_REQUEST['action']) {
|
|||
if ($shout->id) {
|
||||
$shout->update($_POST);
|
||||
}
|
||||
show_confirmation(T_('Shoutbox Post Updated'),'',AmpConfig::get('web_path') . '/admin/shout.php');
|
||||
show_confirmation(T_('Shoutbox Post Updated'), '', AmpConfig::get('web_path') . '/admin/shout.php');
|
||||
break;
|
||||
case 'show_edit':
|
||||
$shout = new Shoutbox($_REQUEST['shout_id']);
|
||||
$object = Shoutbox::get_object($shout->object_type,$shout->object_id);
|
||||
$object = Shoutbox::get_object($shout->object_type, $shout->object_id);
|
||||
$object->format();
|
||||
$client = new User($shout->user);
|
||||
$client->format();
|
||||
|
@ -48,7 +48,7 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
case 'delete':
|
||||
Shoutbox::delete($_REQUEST['shout_id']);
|
||||
show_confirmation(T_('Shoutbox Post Deleted'),'',AmpConfig::get('web_path') . '/admin/shout.php');
|
||||
show_confirmation(T_('Shoutbox Post Deleted'), '', AmpConfig::get('web_path') . '/admin/shout.php');
|
||||
break;
|
||||
default:
|
||||
$browse = new Browse();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
require_once '../lib/init.php';
|
||||
|
||||
if (!Access::check('interface',100) or AmpConfig::get('demo_mode')) {
|
||||
if (!Access::check('interface', 100) or AmpConfig::get('demo_mode')) {
|
||||
UI::access_denied();
|
||||
exit();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ switch ($_REQUEST['action']) {
|
|||
$current = parse_ini_file(AmpConfig::get('prefix') . '/config/ampache.cfg.php');
|
||||
$final = generate_config($current);
|
||||
$browser = new Horde_Browser();
|
||||
$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;
|
||||
exit;
|
||||
case 'write_config':
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
require_once '../lib/init.php';
|
||||
|
||||
if (!Access::check('interface','100')) {
|
||||
if (!Access::check('interface', '100')) {
|
||||
UI::access_denied();
|
||||
exit();
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
}
|
||||
|
||||
if (!Core::form_verify('edit_user','post')) {
|
||||
if (!Core::form_verify('edit_user', 'post')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
}
|
||||
|
||||
if (!Core::form_verify('add_user','post')) {
|
||||
if (!Core::form_verify('add_user', 'post')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
|
||||
/* HINT: %1 Username, %2 Access num */
|
||||
show_confirmation(T_('New User Added'),sprintf(T_('%1$s has been created with an access level of %2$s'), $username, $access), AmpConfig::get('web_path') . '/admin/users.php');
|
||||
show_confirmation(T_('New User Added'), sprintf(T_('%1$s has been created with an access level of %2$s'), $username, $access), AmpConfig::get('web_path') . '/admin/users.php');
|
||||
break;
|
||||
case 'enable':
|
||||
$client = new User($_REQUEST['user_id']);
|
||||
|
@ -182,12 +182,12 @@ switch ($_REQUEST['action']) {
|
|||
if (!AmpConfig::get('user_no_email_confirm')) {
|
||||
Registration::send_account_enabled($client->username, $client->fullname, $client->email);
|
||||
}
|
||||
show_confirmation(T_('User Enabled'),$client->fullname . ' (' . $client->username . ')', AmpConfig::get('web_path') . '/admin/users.php');
|
||||
show_confirmation(T_('User Enabled'), $client->fullname . ' (' . $client->username . ')', AmpConfig::get('web_path') . '/admin/users.php');
|
||||
break;
|
||||
case 'disable':
|
||||
$client = new User($_REQUEST['user_id']);
|
||||
if ($client->disable()) {
|
||||
show_confirmation(T_('User Disabled'),$client->fullname . ' (' . $client->username . ')', AmpConfig::get('web_path') . '/admin/users.php');
|
||||
show_confirmation(T_('User Disabled'), $client->fullname . ' (' . $client->username . ')', AmpConfig::get('web_path') . '/admin/users.php');
|
||||
} else {
|
||||
show_confirmation(T_('Error'), T_('Unable to Disabled last Administrator'), AmpConfig::get('web_path') . '/admin/users.php');
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ switch ($_REQUEST['action']) {
|
|||
$client = new User($_REQUEST['user_id']);
|
||||
show_confirmation(T_('Deletion Request'),
|
||||
sprintf(T_('Are you sure you want to permanently delete %s?'), $client->fullname),
|
||||
AmpConfig::get('web_path') . "/admin/users.php?action=confirm_delete&user_id=" . $_REQUEST['user_id'],1,'delete_user');
|
||||
AmpConfig::get('web_path') . "/admin/users.php?action=confirm_delete&user_id=" . $_REQUEST['user_id'], 1, 'delete_user');
|
||||
break;
|
||||
case 'show_delete_avatar':
|
||||
$user_id = $_REQUEST['user_id'];
|
||||
|
@ -234,7 +234,7 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
}
|
||||
|
||||
if (!Core::form_verify('delete_avatar','post')) {
|
||||
if (!Core::form_verify('delete_avatar', 'post')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
}
|
||||
|
||||
if (!Core::form_verify('generate_apikey','post')) {
|
||||
if (!Core::form_verify('generate_apikey', 'post')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ switch ($_REQUEST['action']) {
|
|||
$working_user = new User($_REQUEST['user_id']);
|
||||
|
||||
if (!isset($_REQUEST['all'])) {
|
||||
$history = $working_user->get_ip_history(0,1);
|
||||
$history = $working_user->get_ip_history(0, 1);
|
||||
} else {
|
||||
$history = $working_user->get_ip_history();
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ switch ($_REQUEST['action']) {
|
|||
$browse->reset_filters();
|
||||
$browse->set_type('user');
|
||||
$browse->set_simple_browse(true);
|
||||
$browse->set_sort('name','ASC');
|
||||
$browse->set_sort('name', 'ASC');
|
||||
$user_ids = $browse->get_objects();
|
||||
$browse->show_objects($user_ids);
|
||||
$browse->store();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -60,7 +60,7 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
case 'update_from_tags':
|
||||
// Make sure they are a 'power' user at least
|
||||
if (!Access::check('interface','75')) {
|
||||
if (!Access::check('interface', '75')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ switch ($_REQUEST['action']) {
|
|||
case 'set_track_numbers':
|
||||
debug_event('albums', 'Set track numbers called.', '5');
|
||||
|
||||
if (!Access::check('interface','75')) {
|
||||
if (!Access::check('interface', '75')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -94,8 +94,8 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
/* Enclose this in the purty box! */
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_box_top.inc.php');
|
||||
show_alphabet_list('artists','artists.php',$match);
|
||||
show_alphabet_form($chr, T_('Show Artists starting with'),"artists.php?action=match");
|
||||
show_alphabet_list('artists', 'artists.php', $match);
|
||||
show_alphabet_form($chr, T_('Show Artists starting with'), "artists.php?action=match");
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_box_bottom.inc.php');
|
||||
|
||||
if ($match === "Browse") {
|
||||
|
|
6
arts.php
6
arts.php
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -64,7 +64,7 @@ switch ($_REQUEST['action']) {
|
|||
// If we got something back insert it
|
||||
if ($image_data) {
|
||||
$art = new Art($object_id, $object_type);
|
||||
$art->insert($image_data,$_FILES['file']['type']);
|
||||
$art->insert($image_data, $_FILES['file']['type']);
|
||||
show_confirmation(T_('Art Inserted'), '', $burl);
|
||||
}
|
||||
// Else it failed
|
||||
|
@ -90,7 +90,7 @@ switch ($_REQUEST['action']) {
|
|||
$image_data = Art::get_from_source($upload, $object_type);
|
||||
|
||||
if ($image_data) {
|
||||
$art->insert($image_data,$upload['0']['mime']);
|
||||
$art->insert($image_data, $upload['0']['mime']);
|
||||
show_confirmation(T_('Art Inserted'), '', $burl);
|
||||
break;
|
||||
} // if image data
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -96,7 +96,7 @@ if (Core::is_playable_item($_REQUEST['action'])) {
|
|||
break;
|
||||
} // switch on type
|
||||
} // foreach media_id
|
||||
$name = 'Batch-' . date("dmY",time());
|
||||
$name = 'Batch-' . date("dmY", time());
|
||||
default:
|
||||
// Rien a faire
|
||||
break;
|
||||
|
@ -118,6 +118,6 @@ session_write_close();
|
|||
$song_files = get_media_files($media_ids);
|
||||
if (is_array($song_files['0'])) {
|
||||
set_memory_limit($song_files['1']+32);
|
||||
send_zip($name,$song_files['0']);
|
||||
send_zip($name, $song_files['0']);
|
||||
}
|
||||
exit;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
40
browse.php
40
browse.php
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -73,17 +73,17 @@ switch ($_REQUEST['action']) {
|
|||
case 'file':
|
||||
break;
|
||||
case 'album':
|
||||
$browse->set_filter('catalog',$_SESSION['catalog']);
|
||||
$browse->set_filter('catalog', $_SESSION['catalog']);
|
||||
if (AmpConfig::get('catalog_disable')) {
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
}
|
||||
$browse->set_sort('name','ASC');
|
||||
$browse->set_sort('name', 'ASC');
|
||||
$browse->update_browse_from_session(); // Update current index depending on what is in session.
|
||||
$browse->show_objects();
|
||||
break;
|
||||
case 'tag':
|
||||
//FIXME: This whole thing is ugly, even though it works.
|
||||
$browse->set_sort('count','ASC');
|
||||
$browse->set_sort('count', 'ASC');
|
||||
// This one's a doozy
|
||||
$browse_type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'artist';
|
||||
$browse->set_simple_browse(false);
|
||||
|
@ -101,20 +101,20 @@ switch ($_REQUEST['action']) {
|
|||
require_once AmpConfig::get('prefix') . UI::find_template('browse_content.inc.php');
|
||||
break;
|
||||
case 'artist':
|
||||
$browse->set_filter('catalog',$_SESSION['catalog']);
|
||||
$browse->set_filter('catalog', $_SESSION['catalog']);
|
||||
if (AmpConfig::get('catalog_disable')) {
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
}
|
||||
$browse->set_sort('name','ASC');
|
||||
$browse->set_sort('name', 'ASC');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
case 'song':
|
||||
$browse->set_filter('catalog',$_SESSION['catalog']);
|
||||
$browse->set_filter('catalog', $_SESSION['catalog']);
|
||||
if (AmpConfig::get('catalog_disable')) {
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
}
|
||||
$browse->set_sort('title','ASC');
|
||||
$browse->set_sort('title', 'ASC');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
|
@ -122,7 +122,7 @@ switch ($_REQUEST['action']) {
|
|||
if (AmpConfig::get('catalog_disable')) {
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
}
|
||||
$browse->set_sort('name','ASC');
|
||||
$browse->set_sort('name', 'ASC');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
|
@ -130,15 +130,15 @@ switch ($_REQUEST['action']) {
|
|||
|
||||
break;
|
||||
case 'playlist':
|
||||
$browse->set_sort('type','ASC');
|
||||
$browse->set_sort('last_update','DESC');
|
||||
$browse->set_filter('playlist_type','1');
|
||||
$browse->set_sort('type', 'ASC');
|
||||
$browse->set_sort('last_update', 'DESC');
|
||||
$browse->set_filter('playlist_type', '1');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
case 'smartplaylist':
|
||||
$browse->set_sort('type', 'ASC');
|
||||
$browse->set_filter('playlist_type','1');
|
||||
$browse->set_filter('playlist_type', '1');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
|
@ -156,7 +156,7 @@ switch ($_REQUEST['action']) {
|
|||
if (AmpConfig::get('catalog_disable')) {
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
}
|
||||
$browse->set_sort('title','ASC');
|
||||
$browse->set_sort('title', 'ASC');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
|
@ -164,7 +164,7 @@ switch ($_REQUEST['action']) {
|
|||
if (AmpConfig::get('catalog_disable')) {
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
}
|
||||
$browse->set_sort('name','ASC');
|
||||
$browse->set_sort('name', 'ASC');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
|
@ -172,7 +172,7 @@ switch ($_REQUEST['action']) {
|
|||
if (AmpConfig::get('catalog_disable')) {
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
}
|
||||
$browse->set_sort('season_number','ASC');
|
||||
$browse->set_sort('season_number', 'ASC');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
|
@ -190,12 +190,12 @@ switch ($_REQUEST['action']) {
|
|||
if (AmpConfig::get('catalog_disable')) {
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
}
|
||||
$browse->set_sort('name','ASC');
|
||||
$browse->set_sort('name', 'ASC');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
case 'pvmsg':
|
||||
$browse->set_sort('creation_date','DESC');
|
||||
$browse->set_sort('creation_date', 'DESC');
|
||||
$folder = $_REQUEST['folder'];
|
||||
if ($folder === "sent") {
|
||||
$browse->set_filter('user', $GLOBALS['user']->id);
|
||||
|
@ -209,7 +209,7 @@ switch ($_REQUEST['action']) {
|
|||
if (AmpConfig::get('catalog_disable')) {
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
}
|
||||
$browse->set_sort('title','ASC');
|
||||
$browse->set_sort('title', 'ASC');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
|
@ -217,7 +217,7 @@ switch ($_REQUEST['action']) {
|
|||
if (AmpConfig::get('catalog_disable')) {
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
}
|
||||
$browse->set_sort('pubdate','DESC');
|
||||
$browse->set_sort('pubdate', 'DESC');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -48,7 +48,7 @@ switch ($_REQUEST['action']) {
|
|||
exit;
|
||||
}
|
||||
|
||||
if (!Core::form_verify('add_channel','post')) {
|
||||
if (!Core::form_verify('add_channel', 'post')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -27,7 +27,7 @@
|
|||
the case. Also this will update local statistics for songs as well.
|
||||
This is also where it decides if you need to be downsampled.
|
||||
*/
|
||||
define('NO_SESSION','1');
|
||||
define('NO_SESSION', '1');
|
||||
require_once '../lib/init.php';
|
||||
ob_end_clean();
|
||||
|
||||
|
@ -59,9 +59,9 @@ if ($channel->is_private) {
|
|||
Preference::init();
|
||||
|
||||
if (AmpConfig::get('access_control')) {
|
||||
if (!Access::check_network('stream',$GLOBALS['user']->id,'25') and
|
||||
!Access::check_network('network',$GLOBALS['user']->id,'25')) {
|
||||
debug_event('UI::access_denied', "Streaming Access Denied: " . $_SERVER['REMOTE_ADDR'] . " does not have stream level access",'3');
|
||||
if (!Access::check_network('stream', $GLOBALS['user']->id, '25') and
|
||||
!Access::check_network('network', $GLOBALS['user']->id, '25')) {
|
||||
debug_event('UI::access_denied', "Streaming Access Denied: " . $_SERVER['REMOTE_ADDR'] . " does not have stream level access", '3');
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
define('NO_SESSION','1');
|
||||
define('NO_SESSION', '1');
|
||||
require_once '../lib/init.php';
|
||||
|
||||
if (!AmpConfig::get('daap_backend')) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -37,7 +37,7 @@ switch ($_REQUEST['action']) {
|
|||
$democratic->set_parent();
|
||||
$democratic->format();
|
||||
case 'show_create':
|
||||
if (!Access::check('interface','75')) {
|
||||
if (!Access::check('interface', '75')) {
|
||||
UI::access_denied();
|
||||
break;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ switch ($_REQUEST['action']) {
|
|||
require_once AmpConfig::get('prefix') . UI::find_template('show_create_democratic.inc.php');
|
||||
break;
|
||||
case 'delete':
|
||||
if (!Access::check('interface','75')) {
|
||||
if (!Access::check('interface', '75')) {
|
||||
UI::access_denied();
|
||||
break;
|
||||
}
|
||||
|
@ -56,11 +56,11 @@ switch ($_REQUEST['action']) {
|
|||
$title = '';
|
||||
$text = T_('The Requested Playlist has been deleted.');
|
||||
$url = AmpConfig::get('web_path') . '/democratic.php?action=manage_playlists';
|
||||
show_confirmation($title,$text,$url);
|
||||
show_confirmation($title, $text, $url);
|
||||
break;
|
||||
case 'create':
|
||||
// Only power users here
|
||||
if (!Access::check('interface','75')) {
|
||||
if (!Access::check('interface', '75')) {
|
||||
UI::access_denied();
|
||||
break;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ switch ($_REQUEST['action']) {
|
|||
header("Location: " . AmpConfig::get('web_path') . "/democratic.php?action=show");
|
||||
break;
|
||||
case 'manage_playlists':
|
||||
if (!Access::check('interface','75')) {
|
||||
if (!Access::check('interface', '75')) {
|
||||
UI::access_denied();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
// This file is a little weird it needs to allow API session
|
||||
// this needs to be done a little better, but for now... eah
|
||||
define('NO_SESSION','1');
|
||||
define('NO_SESSION', '1');
|
||||
require_once 'lib/init.php';
|
||||
|
||||
// Check to see if they've got an interface session or a valid API session, if not GTFO
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -29,13 +29,13 @@
|
|||
|
||||
// This file is a little weird it needs to allow API session
|
||||
// this needs to be done a little better, but for now... eah
|
||||
define('NO_SESSION','1');
|
||||
define('NO_SESSION', '1');
|
||||
require_once 'lib/init.php';
|
||||
|
||||
if (AmpConfig::get('use_auth') && AmpConfig::get('require_session')) {
|
||||
// Check to see if they've got an interface session or a valid API session, if not GTFO
|
||||
if (!Session::exists('interface', $_COOKIE[AmpConfig::get('session_name')]) && !Session::exists('api', $_REQUEST['auth'])) {
|
||||
debug_event('image','Access denied, checked cookie session:' . $_COOKIE[AmpConfig::get('session_name')] . ' and auth:' . $_REQUEST['auth'], 1);
|
||||
debug_event('image', 'Access denied, checked cookie session:' . $_COOKIE[AmpConfig::get('session_name')] . ' and auth:' . $_REQUEST['auth'], 1);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -101,7 +101,7 @@ if (!$htmllang) {
|
|||
AmpConfig::set('lang', $htmllang, true);
|
||||
AmpConfig::set('site_charset', $charset ?: 'UTF-8', true);
|
||||
load_gettext();
|
||||
header ('Content-Type: text/html; charset=' . AmpConfig::get('site_charset'));
|
||||
header('Content-Type: text/html; charset=' . AmpConfig::get('site_charset'));
|
||||
|
||||
// Correct potential \ or / in the dirname
|
||||
$safe_dirname = get_web_path();
|
||||
|
@ -182,7 +182,7 @@ switch ($_REQUEST['action']) {
|
|||
if (install_check_status($configfile)) {
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_install_account.inc.php');
|
||||
} else {
|
||||
header ("Location: " . $web_path . '/login.php');
|
||||
header("Location: " . $web_path . '/login.php');
|
||||
}
|
||||
break;
|
||||
case 'create_account':
|
||||
|
@ -196,7 +196,7 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
}
|
||||
|
||||
header ("Location: " . $web_path . '/index.php');
|
||||
header("Location: " . $web_path . '/index.php');
|
||||
break;
|
||||
case 'init':
|
||||
require_once 'templates/show_install.inc.php';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -60,12 +60,12 @@ switch ($_REQUEST['action']) {
|
|||
break;
|
||||
case 'add_label':
|
||||
// Must be at least a content manager or edit upload enabled
|
||||
if (!Access::check('interface','50') && !AmpConfig::get('upload_allow_edit')) {
|
||||
if (!Access::check('interface', '50') && !AmpConfig::get('upload_allow_edit')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!Core::form_verify('add_label','post')) {
|
||||
if (!Core::form_verify('add_label', 'post')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ switch ($_REQUEST['action']) {
|
|||
exit;
|
||||
}
|
||||
case 'show_add_label':
|
||||
if (Access::check('interface','50') || AmpConfig::get('upload_allow_edit')) {
|
||||
if (Access::check('interface', '50') || AmpConfig::get('upload_allow_edit')) {
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_add_label.inc.php');
|
||||
} else {
|
||||
echo T_('Label cannot be found.');
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -47,7 +47,7 @@ function get_media_files($media_ids)
|
|||
}
|
||||
if ($media->enabled) {
|
||||
$media->format();
|
||||
$total_size += sprintf("%.2f",($media->size/1048576));
|
||||
$total_size += sprintf("%.2f", ($media->size/1048576));
|
||||
$dirname = '';
|
||||
$parent = $media->get_parent();
|
||||
if ($parent != null) {
|
||||
|
@ -81,7 +81,7 @@ function send_zip($name, $media_files)
|
|||
throw new Exception('Missing ZipStream dependency.');
|
||||
}
|
||||
|
||||
$arc = new ZipStream\ZipStream($name . ".zip" );
|
||||
$arc = new ZipStream\ZipStream($name . ".zip");
|
||||
$options = array(
|
||||
'comment' => AmpConfig::get('file_zip_comment'),
|
||||
);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -102,7 +102,7 @@ class Repository
|
|||
$nameParts = explode('\\', $className);
|
||||
$tableName = preg_replace_callback(
|
||||
'/(?<=.)([A-Z])/',
|
||||
function($m) {
|
||||
function ($m) {
|
||||
return '_' . strtolower($m[0]);
|
||||
}, end($nameParts));
|
||||
return lcfirst($tableName);
|
||||
|
@ -225,6 +225,6 @@ class Repository
|
|||
|
||||
public function camelCaseToUnderscore($string)
|
||||
{
|
||||
return strtolower(preg_replace('/(?<=\\w)(?=[A-Z])/','_$1', $string));
|
||||
return strtolower(preg_replace('/(?<=\\w)(?=[A-Z])/', '_$1', $string));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -56,7 +56,7 @@ class Ajax
|
|||
{
|
||||
$non_quoted = array('document', 'window');
|
||||
|
||||
if (in_array($source,$non_quoted)) {
|
||||
if (in_array($source, $non_quoted)) {
|
||||
$source_txt = $source;
|
||||
} else {
|
||||
$source_txt = "'#$source'";
|
||||
|
@ -105,7 +105,7 @@ class Ajax
|
|||
|
||||
$non_quoted = array('document','window');
|
||||
|
||||
if (in_array($source,$non_quoted)) {
|
||||
if (in_array($source, $non_quoted)) {
|
||||
$source_txt = $source;
|
||||
} else {
|
||||
$source_txt = "'$source'";
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -475,7 +475,7 @@ class Album extends database_object implements library_item
|
|||
* @param string $artist
|
||||
* @return int[]
|
||||
*/
|
||||
public function get_songs($limit = 0,$artist='')
|
||||
public function get_songs($limit = 0, $artist='')
|
||||
{
|
||||
$results = array();
|
||||
|
||||
|
@ -881,7 +881,7 @@ class Album extends database_object implements library_item
|
|||
// Update every song
|
||||
$songs = $this->get_songs();
|
||||
foreach ($songs as $song_id) {
|
||||
Song::update_artist($artist,$song_id);
|
||||
Song::update_artist($artist, $song_id);
|
||||
}
|
||||
$updated = true;
|
||||
Artist::gc();
|
||||
|
@ -898,8 +898,8 @@ class Album extends database_object implements library_item
|
|||
$songs = $this->get_songs();
|
||||
}
|
||||
foreach ($songs as $song_id) {
|
||||
Song::update_album($album_id,$song_id);
|
||||
Song::update_year($year,$song_id);
|
||||
Song::update_album($album_id, $song_id);
|
||||
Song::update_year($year, $song_id);
|
||||
Song::write_id3_for_song($song_id);
|
||||
}
|
||||
$current_id = $album_id;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -66,7 +66,7 @@ class Ampache_RSS
|
|||
$data_function = 'load_' . $this->type;
|
||||
$pub_date_function = 'pubdate_' . $this->type;
|
||||
|
||||
$data = call_user_func(array('Ampache_RSS',$data_function));
|
||||
$data = call_user_func(array('Ampache_RSS', $data_function));
|
||||
$pub_date = null;
|
||||
if (method_exists('Ampache_RSS', $pub_date_function)) {
|
||||
$pub_date = call_user_func(array('Ampache_RSS', $pub_date_function));
|
||||
|
@ -119,7 +119,7 @@ class Ampache_RSS
|
|||
{
|
||||
$valid_types = array('now_playing','recently_played','latest_album','latest_artist','latest_shout','podcast');
|
||||
|
||||
if (!in_array($type,$valid_types)) {
|
||||
if (!in_array($type, $valid_types)) {
|
||||
return 'now_playing';
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ class Ampache_RSS
|
|||
$amount = floor($amount/4);
|
||||
}
|
||||
if ($time_place == '6') {
|
||||
$amount = floor ($amount/12);
|
||||
$amount = floor($amount/12);
|
||||
}
|
||||
if ($time_place > '6') {
|
||||
$final = $amount . '+';
|
||||
|
@ -266,7 +266,7 @@ class Ampache_RSS
|
|||
'link'=>str_replace('&', '&', $song->link),
|
||||
'description'=>$song->title . ' - ' . $song->f_artist_full . ' - ' . $song->f_album_full . ' - ' . $time_string,
|
||||
'comments'=>$client->username,
|
||||
'pubDate'=>date("r",$item['date']));
|
||||
'pubDate'=>date("r", $item['date']));
|
||||
$results[] = $xml_array;
|
||||
}
|
||||
} // end foreach
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -57,7 +57,7 @@ class AmpError
|
|||
* This is a public static function it adds a new error message to the array
|
||||
* It can optionally clobber rather then adding to the error message
|
||||
*/
|
||||
public static function add($name,$message,$clobber=0)
|
||||
public static function add($name, $message, $clobber=0)
|
||||
{
|
||||
// Make sure its set first
|
||||
if (!isset(AmpError::$errors[$name])) {
|
||||
|
@ -139,7 +139,7 @@ class AmpError
|
|||
|
||||
// Re-insert them
|
||||
foreach ($_SESSION['errors'] as $key=>$error) {
|
||||
self::add($key,$error);
|
||||
self::add($key, $error);
|
||||
}
|
||||
} // auto_init
|
||||
} // Error
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -74,7 +74,7 @@ class Api
|
|||
* @param int|string|boolean|null $value
|
||||
* @return boolean
|
||||
*/
|
||||
public static function set_filter($filter,$value)
|
||||
public static function set_filter($filter, $value)
|
||||
{
|
||||
if (!strlen($value)) {
|
||||
return false;
|
||||
|
@ -83,32 +83,32 @@ class Api
|
|||
switch ($filter) {
|
||||
case 'add':
|
||||
// Check for a range, if no range default to gt
|
||||
if (strpos($value,'/')) {
|
||||
$elements = explode('/',$value);
|
||||
self::$browse->set_filter('add_lt',strtotime($elements['1']));
|
||||
self::$browse->set_filter('add_gt',strtotime($elements['0']));
|
||||
if (strpos($value, '/')) {
|
||||
$elements = explode('/', $value);
|
||||
self::$browse->set_filter('add_lt', strtotime($elements['1']));
|
||||
self::$browse->set_filter('add_gt', strtotime($elements['0']));
|
||||
} else {
|
||||
self::$browse->set_filter('add_gt',strtotime($value));
|
||||
self::$browse->set_filter('add_gt', strtotime($value));
|
||||
}
|
||||
break;
|
||||
case 'update':
|
||||
// Check for a range, if no range default to gt
|
||||
if (strpos($value,'/')) {
|
||||
$elements = explode('/',$value);
|
||||
self::$browse->set_filter('update_lt',strtotime($elements['1']));
|
||||
self::$browse->set_filter('update_gt',strtotime($elements['0']));
|
||||
if (strpos($value, '/')) {
|
||||
$elements = explode('/', $value);
|
||||
self::$browse->set_filter('update_lt', strtotime($elements['1']));
|
||||
self::$browse->set_filter('update_gt', strtotime($elements['0']));
|
||||
} else {
|
||||
self::$browse->set_filter('update_gt',strtotime($value));
|
||||
self::$browse->set_filter('update_gt', strtotime($value));
|
||||
}
|
||||
break;
|
||||
case 'alpha_match':
|
||||
self::$browse->set_filter('alpha_match',$value);
|
||||
self::$browse->set_filter('alpha_match', $value);
|
||||
break;
|
||||
case 'exact_match':
|
||||
self::$browse->set_filter('exact_match',$value);
|
||||
self::$browse->set_filter('exact_match', $value);
|
||||
break;
|
||||
case 'enabled':
|
||||
self::$browse->set_filter('enabled',$value);
|
||||
self::$browse->set_filter('enabled', $value);
|
||||
break;
|
||||
default:
|
||||
// Rien a faire
|
||||
|
@ -259,10 +259,10 @@ class Api
|
|||
|
||||
echo XML_Data::keyed_array(array('auth'=>$token,
|
||||
'api'=>self::$version,
|
||||
'session_expire'=>date("c",time()+AmpConfig::get('session_length')-60),
|
||||
'update'=>date("c",$row['update']),
|
||||
'add'=>date("c",$row['add']),
|
||||
'clean'=>date("c",$row['clean']),
|
||||
'session_expire'=>date("c", time()+AmpConfig::get('session_length')-60),
|
||||
'update'=>date("c", $row['update']),
|
||||
'add'=>date("c", $row['add']),
|
||||
'clean'=>date("c", $row['clean']),
|
||||
'songs'=>$song['song'],
|
||||
'albums'=>$album['album'],
|
||||
'artists'=>$artist['artist'],
|
||||
|
@ -273,7 +273,7 @@ class Api
|
|||
} // match
|
||||
} // end while
|
||||
|
||||
debug_event('API','Login Failed, unable to match passphrase','1');
|
||||
debug_event('API', 'Login Failed, unable to match passphrase', '1');
|
||||
echo XML_Data::error('401', T_('Error Invalid Handshake - ') . T_('Invalid Username/Password'));
|
||||
|
||||
return false;
|
||||
|
@ -292,10 +292,10 @@ class Api
|
|||
// Check and see if we should extend the api sessions (done if valid sess is passed)
|
||||
if (Session::exists('api', $input['auth'])) {
|
||||
Session::extend($input['auth']);
|
||||
$xmldata = array_merge(array('session_expire'=>date("c",time()+AmpConfig::get('session_length')-60)),$xmldata);
|
||||
$xmldata = array_merge(array('session_expire'=>date("c", time()+AmpConfig::get('session_length')-60)), $xmldata);
|
||||
}
|
||||
|
||||
debug_event('API','Ping Received from ' . $_SERVER['REMOTE_ADDR'] . ' :: ' . $input['auth'],'5');
|
||||
debug_event('API', 'Ping Received from ' . $_SERVER['REMOTE_ADDR'] . ' :: ' . $input['auth'], '5');
|
||||
|
||||
ob_end_clean();
|
||||
echo XML_Data::keyed_array($xmldata);
|
||||
|
@ -312,12 +312,12 @@ class Api
|
|||
{
|
||||
self::$browse->reset_filters();
|
||||
self::$browse->set_type('artist');
|
||||
self::$browse->set_sort('name','ASC');
|
||||
self::$browse->set_sort('name', 'ASC');
|
||||
|
||||
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
||||
Api::set_filter($method,$input['filter']);
|
||||
Api::set_filter('add',$input['add']);
|
||||
Api::set_filter('update',$input['update']);
|
||||
Api::set_filter($method, $input['filter']);
|
||||
Api::set_filter('add', $input['add']);
|
||||
Api::set_filter('update', $input['update']);
|
||||
|
||||
// Set the offset
|
||||
XML_Data::set_offset($input['offset']);
|
||||
|
@ -385,11 +385,11 @@ class Api
|
|||
{
|
||||
self::$browse->reset_filters();
|
||||
self::$browse->set_type('album');
|
||||
self::$browse->set_sort('name','ASC');
|
||||
self::$browse->set_sort('name', 'ASC');
|
||||
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
||||
Api::set_filter($method,$input['filter']);
|
||||
Api::set_filter('add',$input['add']);
|
||||
Api::set_filter('update',$input['update']);
|
||||
Api::set_filter($method, $input['filter']);
|
||||
Api::set_filter('add', $input['add']);
|
||||
Api::set_filter('update', $input['update']);
|
||||
|
||||
$albums = self::$browse->get_objects();
|
||||
|
||||
|
@ -438,10 +438,10 @@ class Api
|
|||
{
|
||||
self::$browse->reset_filters();
|
||||
self::$browse->set_type('tag');
|
||||
self::$browse->set_sort('name','ASC');
|
||||
self::$browse->set_sort('name', 'ASC');
|
||||
|
||||
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
||||
Api::set_filter($method,$input['filter']);
|
||||
Api::set_filter($method, $input['filter']);
|
||||
$tags = self::$browse->get_objects();
|
||||
|
||||
// Set the offset
|
||||
|
@ -471,7 +471,7 @@ class Api
|
|||
*/
|
||||
public static function tag_artists($input)
|
||||
{
|
||||
$artists = Tag::get_tag_objects('artist',$input['filter']);
|
||||
$artists = Tag::get_tag_objects('artist', $input['filter']);
|
||||
if ($artists) {
|
||||
XML_Data::set_offset($input['offset']);
|
||||
XML_Data::set_limit($input['limit']);
|
||||
|
@ -488,7 +488,7 @@ class Api
|
|||
*/
|
||||
public static function tag_albums($input)
|
||||
{
|
||||
$albums = Tag::get_tag_objects('album',$input['filter']);
|
||||
$albums = Tag::get_tag_objects('album', $input['filter']);
|
||||
if ($albums) {
|
||||
XML_Data::set_offset($input['offset']);
|
||||
XML_Data::set_limit($input['limit']);
|
||||
|
@ -505,7 +505,7 @@ class Api
|
|||
*/
|
||||
public static function tag_songs($input)
|
||||
{
|
||||
$songs = Tag::get_tag_objects('song',$input['filter']);
|
||||
$songs = Tag::get_tag_objects('song', $input['filter']);
|
||||
|
||||
XML_Data::set_offset($input['offset']);
|
||||
XML_Data::set_limit($input['limit']);
|
||||
|
@ -523,14 +523,14 @@ class Api
|
|||
{
|
||||
self::$browse->reset_filters();
|
||||
self::$browse->set_type('song');
|
||||
self::$browse->set_sort('title','ASC');
|
||||
self::$browse->set_sort('title', 'ASC');
|
||||
|
||||
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
||||
Api::set_filter($method,$input['filter']);
|
||||
Api::set_filter('add',$input['add']);
|
||||
Api::set_filter('update',$input['update']);
|
||||
Api::set_filter($method, $input['filter']);
|
||||
Api::set_filter('add', $input['add']);
|
||||
Api::set_filter('update', $input['update']);
|
||||
// Filter out disabled songs
|
||||
Api::set_filter('enabled','1');
|
||||
Api::set_filter('enabled', '1');
|
||||
|
||||
$songs = self::$browse->get_objects();
|
||||
|
||||
|
@ -578,10 +578,10 @@ class Api
|
|||
{
|
||||
self::$browse->reset_filters();
|
||||
self::$browse->set_type('playlist');
|
||||
self::$browse->set_sort('name','ASC');
|
||||
self::$browse->set_sort('name', 'ASC');
|
||||
|
||||
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
||||
Api::set_filter($method,$input['filter']);
|
||||
Api::set_filter($method, $input['filter']);
|
||||
self::$browse->set_filter('playlist_type', '1');
|
||||
|
||||
$playlist_ids = self::$browse->get_objects();
|
||||
|
@ -625,7 +625,7 @@ class Api
|
|||
XML_Data::set_offset($input['offset']);
|
||||
XML_Data::set_limit($input['limit']);
|
||||
ob_end_clean();
|
||||
echo XML_Data::songs($songs,$items);
|
||||
echo XML_Data::songs($songs, $items);
|
||||
} // playlist_songs
|
||||
|
||||
/**
|
||||
|
@ -762,10 +762,10 @@ class Api
|
|||
{
|
||||
self::$browse->reset_filters();
|
||||
self::$browse->set_type('video');
|
||||
self::$browse->set_sort('title','ASC');
|
||||
self::$browse->set_sort('title', 'ASC');
|
||||
|
||||
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
||||
Api::set_filter($method,$input['filter']);
|
||||
Api::set_filter($method, $input['filter']);
|
||||
|
||||
$video_ids = self::$browse->get_objects();
|
||||
|
||||
|
@ -851,7 +851,7 @@ class Api
|
|||
echo XML_Data::error('400', T_('Media Object Invalid or Not Specified'));
|
||||
}
|
||||
|
||||
$uid = $democratic->get_uid_from_object_id($media->id,$type);
|
||||
$uid = $democratic->get_uid_from_object_id($media->id, $type);
|
||||
$democratic->remove_vote($uid);
|
||||
|
||||
// Everything was ok
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -211,7 +211,7 @@ class Art extends database_object
|
|||
if (function_exists('ImageCreateFromString')) {
|
||||
$image = @ImageCreateFromString($source);
|
||||
if (!$image || imagesx($image) < 5 || imagesy($image) < 5) {
|
||||
debug_event('Art', 'Image failed PHP-GD test',1);
|
||||
debug_event('Art', 'Image failed PHP-GD test', 1);
|
||||
$test = false;
|
||||
}
|
||||
@imagedestroy($image);
|
||||
|
@ -291,7 +291,7 @@ class Art extends database_object
|
|||
$this->thumb = $data['thumb'];
|
||||
$this->thumb_mime = $data['thumb_mime'];
|
||||
} else {
|
||||
debug_event('Art','Unable to retrieve or generate thumbnail for ' . $this->type . '::' . $this->id,1);
|
||||
debug_event('Art', 'Unable to retrieve or generate thumbnail for ' . $this->type . '::' . $this->id, 1);
|
||||
}
|
||||
} // if no thumb, but art and we want to resize
|
||||
|
||||
|
@ -514,7 +514,7 @@ class Art extends database_object
|
|||
}
|
||||
$fp = fopen($path, "wb");
|
||||
fwrite($fp, $source);
|
||||
fclose ($fp);
|
||||
fclose($fp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ class Art extends database_object
|
|||
*/
|
||||
public function generate_thumb($image, $size, $mime)
|
||||
{
|
||||
$data = explode("/",$mime);
|
||||
$data = explode("/", $mime);
|
||||
$type = strtolower($data['1']);
|
||||
|
||||
if (!self::test_image($image)) {
|
||||
|
@ -671,32 +671,32 @@ class Art extends database_object
|
|||
}
|
||||
|
||||
if (!function_exists('gd_info')) {
|
||||
debug_event('Art','PHP-GD Not found - unable to resize art',1);
|
||||
debug_event('Art', 'PHP-GD Not found - unable to resize art', 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check and make sure we can resize what you've asked us to
|
||||
if (($type == 'jpg' or $type == 'jpeg') and !(imagetypes() & IMG_JPG)) {
|
||||
debug_event('Art','PHP-GD Does not support JPGs - unable to resize',1);
|
||||
debug_event('Art', 'PHP-GD Does not support JPGs - unable to resize', 1);
|
||||
return false;
|
||||
}
|
||||
if ($type == 'png' and !imagetypes() & IMG_PNG) {
|
||||
debug_event('Art','PHP-GD Does not support PNGs - unable to resize',1);
|
||||
debug_event('Art', 'PHP-GD Does not support PNGs - unable to resize', 1);
|
||||
return false;
|
||||
}
|
||||
if ($type == 'gif' and !imagetypes() & IMG_GIF) {
|
||||
debug_event('Art','PHP-GD Does not support GIFs - unable to resize',1);
|
||||
debug_event('Art', 'PHP-GD Does not support GIFs - unable to resize', 1);
|
||||
return false;
|
||||
}
|
||||
if ($type == 'bmp' and !imagetypes() & IMG_WBMP) {
|
||||
debug_event('Art','PHP-GD Does not support BMPs - unable to resize',1);
|
||||
debug_event('Art', 'PHP-GD Does not support BMPs - unable to resize', 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
$source = imagecreatefromstring($image);
|
||||
|
||||
if (!$source) {
|
||||
debug_event('Art','Failed to create Image from string - Source Image is damaged / malformed',1);
|
||||
debug_event('Art', 'Failed to create Image from string - Source Image is damaged / malformed', 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -706,7 +706,7 @@ class Art extends database_object
|
|||
$thumbnail = imagecreatetruecolor($size['width'], $size['height']);
|
||||
|
||||
if (!imagecopyresampled($thumbnail, $source, 0, 0, 0, 0, $size['width'], $size['height'], $source_size['width'], $source_size['height'])) {
|
||||
debug_event('Art','Unable to create resized image',1);
|
||||
debug_event('Art', 'Unable to create resized image', 1);
|
||||
imagedestroy($source);
|
||||
imagedestroy($thumbnail);
|
||||
return false;
|
||||
|
@ -796,8 +796,8 @@ class Art extends database_object
|
|||
|
||||
// Check to see if it's a FILE
|
||||
if (isset($data['file'])) {
|
||||
$handle = fopen($data['file'],'rb');
|
||||
$image_data = fread($handle,Core::get_filesize($data['file']));
|
||||
$handle = fopen($data['file'], 'rb');
|
||||
$image_data = fread($handle, Core::get_filesize($data['file']));
|
||||
fclose($handle);
|
||||
return $image_data;
|
||||
}
|
||||
|
@ -830,7 +830,7 @@ class Art extends database_object
|
|||
* @param int|null $thumb
|
||||
* @return string
|
||||
*/
|
||||
public static function url($uid,$type,$sid=null,$thumb=null)
|
||||
public static function url($uid, $type, $sid=null, $thumb=null)
|
||||
{
|
||||
if (!self::is_valid_type($type)) {
|
||||
return null;
|
||||
|
@ -1006,7 +1006,7 @@ class Art extends database_object
|
|||
$config = array($config);
|
||||
}
|
||||
|
||||
debug_event('Art','Searching using:' . json_encode($config), 3);
|
||||
debug_event('Art', 'Searching using:' . json_encode($config), 3);
|
||||
|
||||
$plugin_names = Plugin::get_plugins('gather_arts');
|
||||
foreach ($config as $method) {
|
||||
|
@ -1044,7 +1044,7 @@ class Art extends database_object
|
|||
// Add the results we got to the current set
|
||||
$results = array_merge($results, (array) $data);
|
||||
|
||||
debug_event('Art','results:' . json_encode($results), 3);
|
||||
debug_event('Art', 'results:' . json_encode($results), 3);
|
||||
|
||||
if ($limit && count($results) >= $limit) {
|
||||
return array_slice($results, 0, $limit);
|
||||
|
@ -1200,7 +1200,7 @@ class Art extends database_object
|
|||
);
|
||||
foreach ($release->relations as $ar) {
|
||||
$arurl = $ar->url->resource;
|
||||
debug_event('mbz-gatherart', "Found URL AR: " . $arurl , '5');
|
||||
debug_event('mbz-gatherart', "Found URL AR: " . $arurl, '5');
|
||||
foreach ($coverartsites as $casite) {
|
||||
if (strpos($arurl, $casite['domain']) !== false) {
|
||||
debug_event('mbz-gatherart', "Matched coverart site: " . $casite['name'], '5');
|
||||
|
@ -1263,12 +1263,12 @@ class Art extends database_object
|
|||
$songs = $media->get_songs();
|
||||
foreach ($songs as $song_id) {
|
||||
$song = new Song($song_id);
|
||||
$dirs[] = Core::conv_lc_file( dirname($song->file) );
|
||||
$dirs[] = Core::conv_lc_file(dirname($song->file));
|
||||
}
|
||||
} else {
|
||||
if ($this->type == 'video') {
|
||||
$media = new Video($this->uid);
|
||||
$dirs[] = Core::conv_lc_file( dirname($media->file) );
|
||||
$dirs[] = Core::conv_lc_file(dirname($media->file));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -140,7 +140,7 @@ class Artist extends database_object implements library_item
|
|||
* @param int|null $id
|
||||
* @param int $catalog_init
|
||||
*/
|
||||
public function __construct($id=null,$catalog_init=0)
|
||||
public function __construct($id=null, $catalog_init=0)
|
||||
{
|
||||
/* If they failed to pass in an id, just run for it */
|
||||
if (!$id) {
|
||||
|
@ -210,7 +210,7 @@ class Artist extends database_object implements library_item
|
|||
$db_results = Dba::read($sql);
|
||||
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
parent::add_to_cache('artist',$row['id'],$row);
|
||||
parent::add_to_cache('artist', $row['id'], $row);
|
||||
}
|
||||
|
||||
// If we need to also pull the extra information, this is normally only used when we are doing the human display
|
||||
|
@ -224,7 +224,7 @@ class Artist extends database_object implements library_item
|
|||
if (AmpConfig::get('show_played_times')) {
|
||||
$row['object_cnt'] = Stats::get_object_count('artist', $row['artist'], $limit_threshold);
|
||||
}
|
||||
parent::add_to_cache('artist_extra',$row['artist'],$row);
|
||||
parent::add_to_cache('artist_extra', $row['artist'], $row);
|
||||
}
|
||||
} // end if extra
|
||||
|
||||
|
@ -391,8 +391,8 @@ class Artist extends database_object implements library_item
|
|||
private function _get_extra_info($catalog=0, $limit_threshold ='')
|
||||
{
|
||||
// Try to find it in the cache and save ourselves the trouble
|
||||
if (parent::is_cached('artist_extra',$this->id) ) {
|
||||
$row = parent::get_from_cache('artist_extra',$this->id);
|
||||
if (parent::is_cached('artist_extra', $this->id)) {
|
||||
$row = parent::get_from_cache('artist_extra', $this->id);
|
||||
} else {
|
||||
$params = array($this->id);
|
||||
// Calculation
|
||||
|
@ -421,7 +421,7 @@ class Artist extends database_object implements library_item
|
|||
if (AmpConfig::get('show_played_times')) {
|
||||
$row['object_cnt'] = Stats::get_object_count('artist', $row['artist'], $limit_threshold);
|
||||
}
|
||||
parent::add_to_cache('artist_extra',$row['artist'],$row);
|
||||
parent::add_to_cache('artist_extra', $row['artist'], $row);
|
||||
}
|
||||
|
||||
/* Set Object Vars */
|
||||
|
@ -466,12 +466,12 @@ class Artist extends database_object implements library_item
|
|||
$extra_info = $this->_get_extra_info($this->catalog_id, $limit_threshold);
|
||||
|
||||
//Format the new time thingy that we just got
|
||||
$min = sprintf("%02d",(floor($extra_info['time']/60)%60));
|
||||
$min = sprintf("%02d", (floor($extra_info['time']/60)%60));
|
||||
|
||||
$sec = sprintf("%02d",($extra_info['time']%60));
|
||||
$sec = sprintf("%02d", ($extra_info['time']%60));
|
||||
$hours = floor($extra_info['time']/3600);
|
||||
|
||||
$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->f_tags = Tag::get_display($this->tags, true, 'artist');
|
||||
|
@ -775,7 +775,7 @@ class Artist extends database_object implements library_item
|
|||
if ($artist_id != null && $artist_id != $this->id) {
|
||||
$songs = $this->get_songs();
|
||||
foreach ($songs as $song_id) {
|
||||
Song::update_artist($artist_id,$song_id);
|
||||
Song::update_artist($artist_id, $song_id);
|
||||
}
|
||||
$updated = true;
|
||||
$current_id = $artist_id;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -45,7 +45,7 @@ class Bookmark extends database_object
|
|||
* This is run every time a new object is created, and requires
|
||||
* the id and type of object that we need to pull for
|
||||
*/
|
||||
public function __construct ($object_id, $object_type = null, $user_id = null)
|
||||
public function __construct($object_id, $object_type = null, $user_id = null)
|
||||
{
|
||||
if (!$object_id) {
|
||||
return false;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -1225,7 +1225,7 @@ abstract class Catalog extends database_object
|
|||
// If they've enabled resizing of images generate a thumbnail
|
||||
if (AmpConfig::get('resize_images')) {
|
||||
$size = array('width' => 275, 'height' => 275);
|
||||
$thumb = $art->generate_thumb($image,$size ,$result['mime']);
|
||||
$thumb = $art->generate_thumb($image, $size, $result['mime']);
|
||||
if (is_array($thumb)) {
|
||||
$art->save_thumb($thumb['thumb'], $thumb['thumb_mime'], $size);
|
||||
}
|
||||
|
@ -2293,7 +2293,7 @@ abstract class Catalog extends database_object
|
|||
return false;
|
||||
}
|
||||
|
||||
return (Access::check('interface','75') || ($libitem->get_user_owner() == $user && AmpConfig::get('upload_allow_remove')));
|
||||
return (Access::check('interface', '75') || ($libitem->get_user_owner() == $user && AmpConfig::get('upload_allow_remove')));
|
||||
}
|
||||
|
||||
public static function process_action($action, $catalogs, $options = null)
|
||||
|
@ -2377,7 +2377,7 @@ abstract class Catalog extends database_object
|
|||
if ($catalog_id = Catalog_local::get_from_path($options['update_path'])) {
|
||||
$songs = Song::get_from_path($options['update_path']);
|
||||
foreach ($songs as $song_id) {
|
||||
Catalog::update_single_item('song',$song_id);
|
||||
Catalog::update_single_item('song', $song_id);
|
||||
}
|
||||
}
|
||||
} // end if update
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -181,8 +181,8 @@ class Channel extends database_object implements media, library_item
|
|||
{
|
||||
if ($this->id) {
|
||||
if ($GLOBALS['user']->has_access('75')) {
|
||||
echo Ajax::button('?page=index&action=start_channel&id=' . $this->id,'run', T_('Start Channel'),'channel_start_' . $this->id);
|
||||
echo " " . Ajax::button('?page=index&action=stop_channel&id=' . $this->id,'stop', T_('Stop Channel'),'channel_stop_' . $this->id);
|
||||
echo Ajax::button('?page=index&action=start_channel&id=' . $this->id, 'run', T_('Start Channel'), 'channel_start_' . $this->id);
|
||||
echo " " . Ajax::button('?page=index&action=stop_channel&id=' . $this->id, 'stop', T_('Stop Channel'), 'channel_stop_' . $this->id);
|
||||
echo " <a id=\"edit_channel_ " . $this->id . "\" onclick=\"showEditDialog('channel_row', '" . $this->id . "', 'edit_channel_" . $this->id . "', '" . T_('Channel edit') . "', 'channel_row_', 'refresh_channel')\">" . UI::get_icon('edit', T_('Edit')) . "</a>";
|
||||
echo " <a href=\"" . AmpConfig::get('web_path') . "/channel.php?action=show_delete&id=" . $this->id . "\">" . UI::get_icon('delete', T_('Delete')) . "</a>";
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ class Channel extends database_object implements media, library_item
|
|||
{
|
||||
$s='';
|
||||
foreach (str_split($x) as $c) {
|
||||
$s.=sprintf("%02X",ord($c));
|
||||
$s.=sprintf("%02X", ord($c));
|
||||
}
|
||||
return($s);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -338,8 +338,8 @@ class Core
|
|||
*/
|
||||
public static function is_session_started()
|
||||
{
|
||||
if (php_sapi_name() !== 'cli' ) {
|
||||
if (version_compare(phpversion(), '5.4.0', '>=') ) {
|
||||
if (php_sapi_name() !== 'cli') {
|
||||
if (version_compare(phpversion(), '5.4.0', '>=')) {
|
||||
return session_status() === PHP_SESSION_ACTIVE ? true : false;
|
||||
} else {
|
||||
return session_id() === '' ? false : true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -40,7 +40,7 @@ abstract class database_object
|
|||
* get_info
|
||||
* retrieves the info from the database and puts it in the cache
|
||||
*/
|
||||
public function get_info($id,$table_name='')
|
||||
public function get_info($id, $table_name='')
|
||||
{
|
||||
$table_name = $table_name ? Dba::escape($table_name) : Dba::escape(strtolower(get_class($this)));
|
||||
|
||||
|
@ -49,8 +49,8 @@ abstract class database_object
|
|||
return array();
|
||||
}
|
||||
|
||||
if (self::is_cached($table_name,$id)) {
|
||||
return self::get_from_cache($table_name,$id);
|
||||
if (self::is_cached($table_name, $id)) {
|
||||
return self::get_from_cache($table_name, $id);
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `$table_name` WHERE `id`='$id'";
|
||||
|
@ -62,7 +62,7 @@ abstract class database_object
|
|||
|
||||
$row = Dba::fetch_assoc($db_results);
|
||||
|
||||
self::add_to_cache($table_name,$id,$row);
|
||||
self::add_to_cache($table_name, $id, $row);
|
||||
|
||||
return $row;
|
||||
} // get_info
|
||||
|
@ -123,7 +123,7 @@ abstract class database_object
|
|||
* This function clears something from the cache, there are a few places we need to do this
|
||||
* in order to have things display correctly
|
||||
*/
|
||||
public static function remove_from_cache($index,$id)
|
||||
public static function remove_from_cache($index, $id)
|
||||
{
|
||||
if (isset(self::$object_cache[$index]) && isset(self::$object_cache[$index][$id])) {
|
||||
unset(self::$object_cache[$index][$id]);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -532,11 +532,11 @@ class Dba
|
|||
if (
|
||||
(strpos($table['Type'], 'varchar') !== false) ||
|
||||
(strpos($table['Type'], 'enum') !== false) ||
|
||||
(strpos($table['Table'],'text') !== false)) {
|
||||
(strpos($table['Table'], 'text') !== false)) {
|
||||
$sql = "ALTER TABLE `" . $row['0'] . "` MODIFY `" . $table['Field'] . "` " . $table['Type'] . " CHARACTER SET " . $target_charset;
|
||||
$charset_results = Dba::write($sql);
|
||||
if (!$charset_results) {
|
||||
debug_event('CHARSET','Unable to update the charset of ' . $table['Field'] . '.' . $table['Type'] . ' to ' . $target_charset,'3');
|
||||
debug_event('CHARSET', 'Unable to update the charset of ' . $table['Field'] . '.' . $table['Type'] . ' to ' . $target_charset, '3');
|
||||
} // if it fails
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -132,14 +132,14 @@ class Democratic extends Tmp_Playlist
|
|||
//FIXME: Code in single user stuff
|
||||
|
||||
$preference_id = Preference::id_from_name('play_type');
|
||||
Preference::update_level($preference_id,'75');
|
||||
Preference::update_all($preference_id,'democratic');
|
||||
Preference::update_level($preference_id, '75');
|
||||
Preference::update_all($preference_id, 'democratic');
|
||||
|
||||
$allow_demo = Preference::id_from_name('allow_democratic_playback');
|
||||
Preference::update_all($allow_demo,'1');
|
||||
Preference::update_all($allow_demo, '1');
|
||||
|
||||
$play_method = Preference::id_from_name('playlist_method');
|
||||
Preference::update_all($play_method,'clear');
|
||||
Preference::update_all($play_method, 'clear');
|
||||
|
||||
return true;
|
||||
} // set_user_preferences
|
||||
|
@ -470,14 +470,14 @@ class Democratic extends Tmp_Playlist
|
|||
* delete_from_oid
|
||||
* This takes an OID and type and removes the object from the democratic playlist
|
||||
*/
|
||||
public function delete_from_oid($oid,$object_type)
|
||||
public function delete_from_oid($oid, $object_type)
|
||||
{
|
||||
$row_id = $this->get_uid_from_object_id($oid,$object_type);
|
||||
$row_id = $this->get_uid_from_object_id($oid, $object_type);
|
||||
if ($row_id) {
|
||||
debug_event('Democratic','Removing Votes for ' . $oid . ' of type ' . $object_type,'5');
|
||||
debug_event('Democratic', 'Removing Votes for ' . $oid . ' of type ' . $object_type, '5');
|
||||
$this->delete_votes($row_id);
|
||||
} else {
|
||||
debug_event('Democratic','Unable to find Votes for ' . $oid . ' of type ' . $object_type,'3');
|
||||
debug_event('Democratic', 'Unable to find Votes for ' . $oid . ' of type ' . $object_type, '3');
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -300,51 +300,51 @@ class Graph
|
|||
$height = 260;
|
||||
}
|
||||
|
||||
$MyData->setSerieDescription("TimeStamp","time");
|
||||
$MyData->setSerieDescription("TimeStamp", "time");
|
||||
$MyData->setAbscissa("TimeStamp");
|
||||
switch ($zoom) {
|
||||
case 'hour':
|
||||
$MyData->setXAxisDisplay(AXIS_FORMAT_TIME,"H:00");
|
||||
$MyData->setXAxisDisplay(AXIS_FORMAT_TIME, "H:00");
|
||||
break;
|
||||
case 'year':
|
||||
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE,"Y");
|
||||
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE, "Y");
|
||||
break;
|
||||
case 'month':
|
||||
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE,"Y-m");
|
||||
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE, "Y-m");
|
||||
break;
|
||||
case 'day':
|
||||
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE,"Y-m-d");
|
||||
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE, "Y-m-d");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Create the pChart object */
|
||||
$myPicture = new CpChart\Classes\pImage($width,$height,$MyData);
|
||||
$myPicture = new CpChart\Classes\pImage($width, $height, $MyData);
|
||||
|
||||
/* Turn of Antialiasing */
|
||||
$myPicture->Antialias = false;
|
||||
|
||||
/* Draw a background */
|
||||
$Settings = array("R"=>90, "G"=>90, "B"=>90, "Dash"=>1, "DashR"=>120, "DashG"=>120, "DashB"=>120);
|
||||
$myPicture->drawFilledRectangle(0,0,$width,$height,$Settings);
|
||||
$myPicture->drawFilledRectangle(0, 0, $width, $height, $Settings);
|
||||
|
||||
/* Overlay with a gradient */
|
||||
$Settings = array("StartR"=>200, "StartG"=>200, "StartB"=>200, "EndR"=>50, "EndG"=>50, "EndB"=>50, "Alpha"=>50);
|
||||
$myPicture->drawGradientArea(0,0,$width,$height,DIRECTION_VERTICAL,$Settings);
|
||||
$myPicture->drawGradientArea(0,0,$width,$height,DIRECTION_HORIZONTAL,$Settings);
|
||||
$myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_VERTICAL, $Settings);
|
||||
$myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_HORIZONTAL, $Settings);
|
||||
|
||||
/* Add a border to the picture */
|
||||
$myPicture->drawRectangle(0,0,$width-1,$height-1,array("R"=>0,"G"=>0,"B"=>0));
|
||||
$myPicture->drawRectangle(0, 0, $width-1, $height-1, array("R"=>0, "G"=>0, "B"=>0));
|
||||
|
||||
$font_path = AmpConfig::get('prefix') . "/lib/vendor/szymach/c-pchart/src/Resources/fonts";
|
||||
/* Write the chart title */
|
||||
$myPicture->setFontProperties(array("FontName"=>$font_path . "/Forgotte.ttf","FontSize"=>11));
|
||||
$myPicture->drawText(150,35,$title,array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
|
||||
$myPicture->setFontProperties(array("FontName"=>$font_path . "/Forgotte.ttf", "FontSize"=>11));
|
||||
$myPicture->drawText(150, 35, $title, array("FontSize"=>20, "Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
|
||||
|
||||
/* Set the default font */
|
||||
$myPicture->setFontProperties(array("FontName"=>$font_path . "/pf_arma_five.ttf","FontSize"=>6));
|
||||
$myPicture->setFontProperties(array("FontName"=>$font_path . "/pf_arma_five.ttf", "FontSize"=>6));
|
||||
|
||||
/* Define the chart area */
|
||||
$myPicture->setGraphArea(60,40,$width-20,$height-50);
|
||||
$myPicture->setGraphArea(60, 40, $width-20, $height-50);
|
||||
|
||||
/* Draw the scale */
|
||||
$scaleSettings = array("XMargin"=>10,"YMargin"=>10,"Floating"=>true,"GridR"=>200,"GridG"=>200,"GridB"=>200,"RemoveSkippedAxis"=>true,"DrawSubTicks"=>false,"Mode"=>SCALE_MODE_START0,"LabelRotation"=>45,"LabelingMethod"=>LABELING_DIFFERENT);
|
||||
|
@ -354,14 +354,14 @@ class Graph
|
|||
$myPicture->Antialias = true;
|
||||
|
||||
/* Draw the line chart */
|
||||
$myPicture->setShadow(true,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
|
||||
$myPicture->setShadow(true, array("X"=>1, "Y"=>1, "R"=>0, "G"=>0, "B"=>0, "Alpha"=>10));
|
||||
$myPicture->drawLineChart();
|
||||
|
||||
/* Write a label over the chart */
|
||||
$myPicture->writeLabel("Inbound",720);
|
||||
$myPicture->writeLabel("Inbound", 720);
|
||||
|
||||
/* Write the chart legend */
|
||||
$myPicture->drawLegend(280,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
|
||||
$myPicture->drawLegend(280, 20, array("Style"=>LEGEND_NOBORDER, "Mode"=>LEGEND_HORIZONTAL));
|
||||
|
||||
header("Content-Disposition: filename=\"ampache-graph.png\"");
|
||||
/* Render the picture (choose the best way) */
|
||||
|
@ -474,7 +474,7 @@ class Graph
|
|||
}
|
||||
}
|
||||
|
||||
if (($owner_id <= 0 || $owner_id != $GLOBALS['user']->id) && !Access::check('interface','50')) {
|
||||
if (($owner_id <= 0 || $owner_id != $GLOBALS['user']->id) && !Access::check('interface', '50')) {
|
||||
UI::access_denied();
|
||||
} else {
|
||||
$user_id = $_REQUEST['user_id'];
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -27,11 +27,11 @@
|
|||
* This function is here for retrocompatibility with PHP < 5.6.
|
||||
* For PHP >= 5.6, one can use array_filter with flag ARRAY_FILTER_USE_KEY.
|
||||
*/
|
||||
function array_filter_key ($array, $callback)
|
||||
function array_filter_key($array, $callback)
|
||||
{
|
||||
foreach ($array as $key => $value) {
|
||||
if (! call_user_func ($callback, $key)) {
|
||||
unset ($array[$key]);
|
||||
if (! call_user_func($callback, $key)) {
|
||||
unset($array[$key]);
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
|
@ -60,14 +60,14 @@ class LDAPException extends Exception
|
|||
*
|
||||
* @param mixed $message
|
||||
*/
|
||||
public function __construct ($message)
|
||||
public function __construct($message)
|
||||
{
|
||||
if (is_int ($message)) {
|
||||
if (is_int($message)) {
|
||||
$message = 'LDAP error: [' . $message . '] ' . ldap_err2str($message);
|
||||
}
|
||||
|
||||
debug_event('LDAP', 'Exception: ' . $message, 6);
|
||||
parent::__construct ($message);
|
||||
parent::__construct($message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ class LDAP
|
|||
* This function is here to return a real array {number} => {field} => {value array}
|
||||
* instead of the custom LDAP search results provided by the ldap_* library.
|
||||
*/
|
||||
private static function clean_search_results ($sr)
|
||||
private static function clean_search_results($sr)
|
||||
{
|
||||
$sr_clean = [];
|
||||
|
||||
|
@ -106,7 +106,7 @@ class LDAP
|
|||
$sr_clean[$i] = [];
|
||||
|
||||
foreach ($result as $field => $values) {
|
||||
if ($field == 'count' || is_int ($field)) {
|
||||
if ($field == 'count' || is_int($field)) {
|
||||
continue;
|
||||
} elseif ($field == 'dn') {
|
||||
$sr_clean[$i][$field] = $values;
|
||||
|
@ -129,23 +129,23 @@ class LDAP
|
|||
* the given parameters are plausibe and can be used to open a
|
||||
* connection as soon as one is needed.
|
||||
*/
|
||||
private static function connect ()
|
||||
private static function connect()
|
||||
{
|
||||
if (! $url = AmpConfig::get('ldap_url')) {
|
||||
throw new LDAPException('Required configuration value missing: ldap_url');
|
||||
}
|
||||
|
||||
if (! $link = ldap_connect ($url)) {
|
||||
if (! $link = ldap_connect($url)) {
|
||||
throw new LDAPException('Could not connect to ' . $url);
|
||||
}
|
||||
|
||||
$protocol_version = AmpConfig::get('ldap_protocol_version', 3);
|
||||
if (! ldap_set_option ($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version)) {
|
||||
if (! ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version)) {
|
||||
throw new LDAPException('Could not set option PROTOCOL_VERSION to ' . $protocol_version);
|
||||
}
|
||||
|
||||
if (AmpConfig::get('ldap_start_tls', "false") != "false") {
|
||||
if (! ldap_start_tls ($link)) {
|
||||
if (! ldap_start_tls($link)) {
|
||||
throw new LDAPException('Could not use StartTLS');
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ class LDAP
|
|||
/**
|
||||
* Binds to the LDAP
|
||||
*/
|
||||
private static function bind ($link, $username = null, $password = null)
|
||||
private static function bind($link, $username = null, $password = null)
|
||||
{
|
||||
debug_event('LDAP', "binding with username `$username`", 5);
|
||||
|
||||
|
@ -166,7 +166,7 @@ class LDAP
|
|||
$password = AmpConfig::get('ldap_password', '');
|
||||
}
|
||||
|
||||
if (! ldap_bind ($link, $username, $password)) {
|
||||
if (! ldap_bind($link, $username, $password)) {
|
||||
throw new LDAPException("Could not bind to server using username `$username`");
|
||||
}
|
||||
}
|
||||
|
@ -175,25 +175,25 @@ class LDAP
|
|||
/**
|
||||
* Unbinds from the LDAP
|
||||
*/
|
||||
private static function unbind ($link)
|
||||
private static function unbind($link)
|
||||
{
|
||||
ldap_unbind ($link);
|
||||
ldap_unbind($link);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read attributes for a DN from the LDAP
|
||||
*/
|
||||
private static function read ($link, $dn, $attrs = [], $filter='objectClass=*')
|
||||
private static function read($link, $dn, $attrs = [], $filter='objectClass=*')
|
||||
{
|
||||
$attrs_json = json_encode ($attrs);
|
||||
$attrs_json = json_encode($attrs);
|
||||
debug_event('LDAP', "reading attributes $attrs_json in `$dn`", 5);
|
||||
|
||||
if (! $result = ldap_read ($link, $dn, $filter, $attrs)) {
|
||||
if (! $result = ldap_read($link, $dn, $filter, $attrs)) {
|
||||
throw new LDAPException("Could not read attributes `$attrs_json` for dn `$dn`");
|
||||
}
|
||||
|
||||
if (! $infos = ldap_get_entries ($link, $result)) {
|
||||
if (! $infos = ldap_get_entries($link, $result)) {
|
||||
throw new LDAPException("Empty search result for dn `$dn`");
|
||||
}
|
||||
|
||||
|
@ -204,24 +204,24 @@ class LDAP
|
|||
/**
|
||||
* Search for a DN in the LDAP
|
||||
*/
|
||||
private static function search ($link, $base_dn, $filter, $only_one_result = true)
|
||||
private static function search($link, $base_dn, $filter, $only_one_result = true)
|
||||
{
|
||||
debug_event('LDAP', "searching in `$base_dn` for `$filter`", 5);
|
||||
|
||||
if (! $result = ldap_search ($link, $base_dn, $filter)) {
|
||||
if (! $result = ldap_search($link, $base_dn, $filter)) {
|
||||
throw new LDAPException(ldap_errno($link));
|
||||
}
|
||||
|
||||
$entries = ldap_get_entries ($link, $result);
|
||||
$entries = ldap_get_entries($link, $result);
|
||||
|
||||
$entries = self::clean_search_results($entries);
|
||||
|
||||
if ($only_one_result) {
|
||||
if (count ($entries) < 1) {
|
||||
if (count($entries) < 1) {
|
||||
throw new LDAPException("Empty search results for filter `$filter`");
|
||||
}
|
||||
|
||||
if (count ($entries) > 1) {
|
||||
if (count($entries) > 1) {
|
||||
throw new LDAPException("Too many search results for filter `$filter`");
|
||||
}
|
||||
|
||||
|
@ -243,10 +243,10 @@ class LDAP
|
|||
* @param string $password
|
||||
* @return array
|
||||
*/
|
||||
public static function auth ($username, $password)
|
||||
public static function auth($username, $password)
|
||||
{
|
||||
try {
|
||||
$link = self::connect ();
|
||||
$link = self::connect();
|
||||
self::bind($link);
|
||||
|
||||
/* Search for the user with given base_dn, filter, objectclass and username */
|
||||
|
@ -255,7 +255,7 @@ class LDAP
|
|||
throw new LDAPException('Required configuration value missing: ldap_filter');
|
||||
}
|
||||
|
||||
if (strpos ($filter, '%v') !== false) {
|
||||
if (strpos($filter, '%v') !== false) {
|
||||
$filter = str_replace('%v', $username, $filter);
|
||||
} else {
|
||||
$filter = "($filter=$username)"; // Backward compatibility
|
||||
|
@ -266,23 +266,23 @@ class LDAP
|
|||
}
|
||||
|
||||
$search = "(&(objectclass=$objectclass)$filter)";
|
||||
debug_event ('LDAP', 'search: ' . $search, 5);
|
||||
debug_event('LDAP', 'search: ' . $search, 5);
|
||||
|
||||
if (! $base_dn = AmpConfig::get('ldap_search_dn')) {
|
||||
throw new LDAPException('Required configuration value missing: ldap_search_dn');
|
||||
}
|
||||
|
||||
$user_entry = self::search ($link, $base_dn, $search, true);
|
||||
$user_entry = self::search($link, $base_dn, $search, true);
|
||||
$user_dn = $user_entry['dn'];
|
||||
|
||||
self::bind ($link, $user_dn, $password);
|
||||
self::bind($link, $user_dn, $password);
|
||||
|
||||
/* Test if the user is in the required group (optional) */
|
||||
|
||||
if ($group_dn = AmpConfig::get('ldap_require_group')) {
|
||||
$member_attribute = AmpConfig::get('ldap_member_attribute', 'member');
|
||||
|
||||
$group_infos = self::read ($link, $group_dn, [$member_attribute]);
|
||||
$group_infos = self::read($link, $group_dn, [$member_attribute]);
|
||||
|
||||
if (! preg_grep("/^$user_dn\$/i", $group_infos[$member_attribute])) {
|
||||
throw new LDAPException("`$user_dn` is not member of the group `$group_dn`");
|
||||
|
@ -331,8 +331,8 @@ class LDAP
|
|||
];
|
||||
}
|
||||
|
||||
if (isset ($link)) {
|
||||
self::unbind ($link);
|
||||
if (isset($link)) {
|
||||
self::unbind($link);
|
||||
}
|
||||
|
||||
debug_event('LDAP', 'Return value of authentication: ' . json_encode($return_value), 5);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -193,9 +193,9 @@ class Live_Stream extends database_object implements media, library_item
|
|||
|
||||
$allowed_array = array('https','http','mms','mmsh','mmsu','mmst','rtsp','rtmp');
|
||||
|
||||
$elements = explode(":",$data['url']);
|
||||
$elements = explode(":", $data['url']);
|
||||
|
||||
if (!in_array($elements['0'],$allowed_array)) {
|
||||
if (!in_array($elements['0'], $allowed_array)) {
|
||||
AmpError::add('general', T_('Invalid URL must be mms:// , https:// or http://'));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -104,14 +104,14 @@ class Localplay
|
|||
|
||||
if (!$include) {
|
||||
/* Throw Error Here */
|
||||
debug_event('localplay','Unable to load ' . $this->type . ' controller','2');
|
||||
debug_event('localplay', 'Unable to load ' . $this->type . ' controller', '2');
|
||||
return false;
|
||||
} // include
|
||||
else {
|
||||
$class_name = "Ampache" . $this->type;
|
||||
$this->_player = new $class_name();
|
||||
if (!($this->_player instanceof localplay_controller)) {
|
||||
debug_event('Localplay',$this->type . ' not an instance of controller abstract, unable to load','1');
|
||||
debug_event('Localplay', $this->type . ' not an instance of controller abstract, unable to load', '1');
|
||||
unset($this->_player);
|
||||
return false;
|
||||
}
|
||||
|
@ -124,10 +124,10 @@ class Localplay
|
|||
* is supported in the current player, if so it returns a 'skip to'
|
||||
* link, otherwise it returns just the text
|
||||
*/
|
||||
public function format_name($name,$id)
|
||||
public function format_name($name, $id)
|
||||
{
|
||||
$name = scrub_out($name);
|
||||
$name = Ajax::text('?page=localplay&action=command&command=skip&id=' . $id,$name,'localplay_skip_' . $id);
|
||||
$name = Ajax::text('?page=localplay&action=command&command=skip&id=' . $id, $name, 'localplay_skip_' . $id);
|
||||
return $name;
|
||||
} // format_name
|
||||
|
||||
|
@ -142,7 +142,7 @@ class Localplay
|
|||
$handle = opendir($basedir);
|
||||
|
||||
if (!is_resource($handle)) {
|
||||
debug_event('Localplay','Error: Unable to read localplay controller directory','1');
|
||||
debug_event('Localplay', 'Error: Unable to read localplay controller directory', '1');
|
||||
return array();
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ class Localplay
|
|||
|
||||
// If its our current player, reset player to nothing
|
||||
if (AmpConfig::get('localplay_controller') == $this->type) {
|
||||
Preference::update('localplay_controller',$GLOBALS['user']->id,'');
|
||||
Preference::update('localplay_controller', $GLOBALS['user']->id, '');
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -226,7 +226,7 @@ class Localplay
|
|||
public function connect()
|
||||
{
|
||||
if (!$this->_player->connect()) {
|
||||
debug_event('localplay','Error Unable to connect, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error Unable to connect, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ class Localplay
|
|||
public function play()
|
||||
{
|
||||
if (!$this->_player->play()) {
|
||||
debug_event('localplay','Error Unable to start playback, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error Unable to start playback, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ class Localplay
|
|||
public function stop()
|
||||
{
|
||||
if (!$this->_player->stop()) {
|
||||
debug_event('localplay','Error Unable to stop playback, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error Unable to stop playback, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ class Localplay
|
|||
$data = $this->_player->repeat($state);
|
||||
|
||||
if (!$data) {
|
||||
debug_event('localplay',"Error Unable to set Repeat to $state",'1');
|
||||
debug_event('localplay', "Error Unable to set Repeat to $state", '1');
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
@ -312,7 +312,7 @@ class Localplay
|
|||
$data = $this->_player->random($state);
|
||||
|
||||
if (!$data) {
|
||||
debug_event('localplay',"Error Unable to set Random to $state",'1');
|
||||
debug_event('localplay', "Error Unable to set Random to $state", '1');
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
@ -328,7 +328,7 @@ class Localplay
|
|||
$data = $this->_player->status();
|
||||
|
||||
if (!count($data)) {
|
||||
debug_event('localplay','Error Unable to get status, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error Unable to get status, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ class Localplay
|
|||
$data = $this->_player->get();
|
||||
|
||||
if (!count($data) or !is_array($data)) {
|
||||
debug_event('localplay','Error Unable to get song info, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error Unable to get song info, check ' . $this->type . ' controller', '1');
|
||||
return array();
|
||||
}
|
||||
|
||||
|
@ -370,7 +370,7 @@ class Localplay
|
|||
}
|
||||
|
||||
if (!$this->_player->volume($value)) {
|
||||
debug_event('localplay','Error: Unable to set volume, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error: Unable to set volume, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -385,7 +385,7 @@ class Localplay
|
|||
public function volume_up()
|
||||
{
|
||||
if (!$this->_player->volume_up()) {
|
||||
debug_event('localplay','Error: Unable to increase volume, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error: Unable to increase volume, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,7 @@ class Localplay
|
|||
public function volume_down()
|
||||
{
|
||||
if (!$this->_player->volume_down()) {
|
||||
debug_event('localplay','Error: Unable to decrese volume, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error: Unable to decrese volume, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -415,7 +415,7 @@ class Localplay
|
|||
public function volume_mute()
|
||||
{
|
||||
if (!$this->_player->volume(0)) {
|
||||
debug_event('localplay','Error: Unable to mute volume, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error: Unable to mute volume, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -429,7 +429,7 @@ class Localplay
|
|||
public function skip($track_id)
|
||||
{
|
||||
if (!$this->_player->skip($track_id)) {
|
||||
debug_event('localplay','Error: Unable to skip to next song, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error: Unable to skip to next song, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ class Localplay
|
|||
public function next()
|
||||
{
|
||||
if (!$this->_player->next()) {
|
||||
debug_event('localplay','Error: Unable to skip to next song, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error: Unable to skip to next song, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ class Localplay
|
|||
public function prev()
|
||||
{
|
||||
if (!$this->_player->prev()) {
|
||||
debug_event('localplay','Error: Unable to skip to previous song, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error: Unable to skip to previous song, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ class Localplay
|
|||
public function pause()
|
||||
{
|
||||
if (!$this->_player->pause()) {
|
||||
debug_event('localplay','Error: Unable to pause song, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error: Unable to pause song, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -518,9 +518,9 @@ class Localplay
|
|||
* update_instance
|
||||
* This updates the specified instance with a named array of data (_POST most likely)
|
||||
*/
|
||||
public function update_instance($uid,$data)
|
||||
public function update_instance($uid, $data)
|
||||
{
|
||||
$data = $this->_player->update_instance($uid,$data);
|
||||
$data = $this->_player->update_instance($uid, $data);
|
||||
|
||||
return $data;
|
||||
} // update_instance
|
||||
|
@ -560,7 +560,7 @@ class Localplay
|
|||
public function delete_track($object_id)
|
||||
{
|
||||
if (!$this->_player->delete_track($object_id)) {
|
||||
debug_event('localplay','Error: Unable to remove songs, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error: Unable to remove songs, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -576,7 +576,7 @@ class Localplay
|
|||
public function delete_all()
|
||||
{
|
||||
if (!$this->_player->clear_playlist()) {
|
||||
debug_event('localplay','Error: Unable to delete entire playlist, check ' . $this->type . ' controller','1');
|
||||
debug_event('localplay', 'Error: Unable to delete entire playlist, check ' . $this->type . ' controller', '1');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -629,7 +629,7 @@ class Localplay
|
|||
/* This is a cheezball fix for when we were unable to find a
|
||||
* artist/album (or one wasn't provided)
|
||||
*/
|
||||
$track_name = ltrim(ltrim($track_name,' - '),' - ');
|
||||
$track_name = ltrim(ltrim($track_name, ' - '), ' - ');
|
||||
|
||||
$track_name = "[" . $status['track'] . "] - " . $track_name;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -45,7 +45,7 @@ abstract class localplay_controller
|
|||
// For display we need the following 'instance' functions
|
||||
abstract public function add_instance($data);
|
||||
abstract public function delete_instance($id);
|
||||
abstract public function update_instance($id,$post);
|
||||
abstract public function update_instance($id, $post);
|
||||
abstract public function get_instances();
|
||||
abstract public function instance_fields();
|
||||
abstract public function set_active_instance($uid);
|
||||
|
@ -65,7 +65,7 @@ abstract class localplay_controller
|
|||
|
||||
$class = get_class($object);
|
||||
|
||||
$url = call_user_func(array($class,'play_url'),$object->id);
|
||||
$url = call_user_func(array($class, 'play_url'), $object->id);
|
||||
|
||||
return $url;
|
||||
} // get_url
|
||||
|
@ -92,9 +92,9 @@ abstract class localplay_controller
|
|||
$primary_array = array('oid','demo_id','random');
|
||||
$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) {
|
||||
if ($data[$pkey]) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -78,13 +78,13 @@ class Playlist extends playlist_object
|
|||
return false;
|
||||
}
|
||||
|
||||
$idlist = '(' . implode(',',$ids) . ')';
|
||||
$idlist = '(' . implode(',', $ids) . ')';
|
||||
|
||||
$sql = "SELECT * FROM `playlist` WHERE `id` IN $idlist";
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
parent::add_to_cache('playlist',$row['id'],$row);
|
||||
parent::add_to_cache('playlist', $row['id'], $row);
|
||||
}
|
||||
} // build_cache
|
||||
|
||||
|
@ -300,7 +300,7 @@ class Playlist extends playlist_object
|
|||
*/
|
||||
private function update_type($new_type)
|
||||
{
|
||||
if ($this->_update_item('type',$new_type,50)) {
|
||||
if ($this->_update_item('type', $new_type, 50)) {
|
||||
$this->type = $new_type;
|
||||
}
|
||||
} // update_type
|
||||
|
@ -311,7 +311,7 @@ class Playlist extends playlist_object
|
|||
*/
|
||||
private function update_name($new_name)
|
||||
{
|
||||
if ($this->_update_item('name',$new_name,50)) {
|
||||
if ($this->_update_item('name', $new_name, 50)) {
|
||||
$this->name = $new_name;
|
||||
}
|
||||
} // update_name
|
||||
|
@ -323,7 +323,7 @@ class Playlist extends playlist_object
|
|||
private function update_last_update()
|
||||
{
|
||||
$last_update = time();
|
||||
if ($this->_update_item('last_update',$last_update,50)) {
|
||||
if ($this->_update_item('last_update', $last_update, 50)) {
|
||||
$this->last_update = $last_update;
|
||||
}
|
||||
} // update_last_update
|
||||
|
@ -332,9 +332,9 @@ class Playlist extends playlist_object
|
|||
* _update_item
|
||||
* This is the generic update function, it does the escaping and error checking
|
||||
*/
|
||||
private function _update_item($field,$value,$level)
|
||||
private function _update_item($field, $value, $level)
|
||||
{
|
||||
if ($GLOBALS['user']->id != $this->user && !Access::check('interface',$level)) {
|
||||
if ($GLOBALS['user']->id != $this->user && !Access::check('interface', $level)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -119,7 +119,7 @@ class Plex_Api
|
|||
// Need to get a match between Plex and Ampache users
|
||||
if ($match_users) {
|
||||
if (!AmpConfig::get('access_control')) {
|
||||
debug_event('Access Control', 'Error Attempted to use Plex with Access Control turned off and plex/ampache link enabled.','3');
|
||||
debug_event('Access Control', 'Error Attempted to use Plex with Access Control turned off and plex/ampache link enabled.', '3');
|
||||
self::createError(401);
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@ class Plex_Api
|
|||
|
||||
public static function registerMyPlex($authtoken)
|
||||
{
|
||||
$headers = array (
|
||||
$headers = array(
|
||||
'Content-Type: text/xml'
|
||||
);
|
||||
$action = 'servers.xml?auth_token=' . $authtoken;
|
||||
|
@ -352,7 +352,7 @@ class Plex_Api
|
|||
|
||||
public static function publishDeviceConnection($authtoken)
|
||||
{
|
||||
$headers = array ();
|
||||
$headers = array();
|
||||
$action = 'devices/' . Plex_XML_Data::getMachineIdentifier() . '?Connection[][uri]=' . Plex_XML_Data::getServerUri() . '&X-Plex-Token=' . $authtoken;
|
||||
$curlopts = array(
|
||||
CURLOPT_CUSTOMREQUEST => "PUT"
|
||||
|
@ -363,7 +363,7 @@ class Plex_Api
|
|||
|
||||
public static function unregisterMyPlex($authtoken)
|
||||
{
|
||||
$headers = array (
|
||||
$headers = array(
|
||||
'Content-Type: text/xml'
|
||||
);
|
||||
$action = 'servers/' . Plex_XML_Data::getMachineIdentifier() . '.xml?auth_token=' . $authtoken;
|
||||
|
@ -1092,7 +1092,7 @@ class Plex_Api
|
|||
CURLOPT_TIMEOUT => 0
|
||||
));
|
||||
if (curl_exec($ch) === false) {
|
||||
debug_event('plex-api', 'Curl error: ' . curl_error($ch),1);
|
||||
debug_event('plex-api', 'Curl error: ' . curl_error($ch), 1);
|
||||
}
|
||||
curl_close($ch);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -98,7 +98,7 @@ class Plugin
|
|||
$handle = opendir($basedir);
|
||||
|
||||
if (!is_resource($handle)) {
|
||||
debug_event('Plugins','Unable to read plugins directory','1');
|
||||
debug_event('Plugins', 'Unable to read plugins directory', '1');
|
||||
}
|
||||
|
||||
// Recurse the directory
|
||||
|
@ -172,15 +172,15 @@ class Plugin
|
|||
}
|
||||
|
||||
/* Make sure we've got the required methods */
|
||||
if (!method_exists($this->_plugin,'install')) {
|
||||
if (!method_exists($this->_plugin, 'install')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!method_exists($this->_plugin,'uninstall')) {
|
||||
if (!method_exists($this->_plugin, 'uninstall')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!method_exists($this->_plugin,'load')) {
|
||||
if (!method_exists($this->_plugin, 'load')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -125,7 +125,7 @@ class Podcast extends database_object implements library_item
|
|||
private function _get_extra_info()
|
||||
{
|
||||
// Try to find it in the cache and save ourselves the trouble
|
||||
if (parent::is_cached('podcast_extra', $this->id) ) {
|
||||
if (parent::is_cached('podcast_extra', $this->id)) {
|
||||
$row = parent::get_from_cache('podcast_extra', $this->id);
|
||||
} else {
|
||||
$sql = "SELECT COUNT(`podcast_episode`.`id`) AS `episode_count` FROM `podcast_episode` " .
|
||||
|
@ -133,7 +133,7 @@ class Podcast extends database_object implements library_item
|
|||
$db_results = Dba::read($sql, array($this->id));
|
||||
$row = Dba::fetch_assoc($db_results);
|
||||
|
||||
parent::add_to_cache('podcast_extra',$this->id,$row);
|
||||
parent::add_to_cache('podcast_extra', $this->id, $row);
|
||||
}
|
||||
|
||||
/* Set Object Vars */
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -282,7 +282,7 @@ class Podcast_Episode extends database_object implements media, library_item
|
|||
*/
|
||||
public static function update_played($new_played, $id)
|
||||
{
|
||||
self::_update_item('played', ($new_played ? 1 : 0),$id,'25');
|
||||
self::_update_item('played', ($new_played ? 1 : 0), $id, '25');
|
||||
} // update_played
|
||||
|
||||
/**
|
||||
|
@ -300,7 +300,7 @@ class Podcast_Episode extends database_object implements media, library_item
|
|||
private static function _update_item($field, $value, $song_id, $level)
|
||||
{
|
||||
/* Check them Rights! */
|
||||
if (!Access::check('interface',$level)) {
|
||||
if (!Access::check('interface', $level)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
* Copyright 2001 - 2016 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -70,7 +70,7 @@ class Preference extends database_object
|
|||
* update
|
||||
* This updates a single preference from the given name or id
|
||||
*/
|
||||
public static function update($preference,$user_id,$value,$applytoall=false,$applytodefault=false)
|
||||
public static function update($preference, $user_id, $value, $applytoall=false, $applytodefault=false)
|
||||
{
|
||||
// First prepare
|
||||
if (!is_numeric($preference)) {
|
||||
|
@ -80,7 +80,7 @@ class Preference extends database_object
|
|||
$name = self::name_from_id($preference);
|
||||
$id = $preference;
|
||||
}
|
||||
if ($applytoall and Access::check('interface','100')) {
|
||||
if ($applytoall and Access::check('interface', '100')) {
|
||||
$user_check = "";
|
||||
} else {
|
||||
$user_check = " AND `user`='$user_id'";
|
||||
|
@ -117,7 +117,7 @@ class Preference extends database_object
|
|||
* update_level
|
||||
* This takes a preference ID and updates the level required to update it (performed by an admin)
|
||||
*/
|
||||
public static function update_level($preference,$level)
|
||||
public static function update_level($preference, $level)
|
||||
{
|
||||
// First prepare
|
||||
if (!is_numeric($preference)) {
|
||||
|
@ -139,7 +139,7 @@ class Preference extends database_object
|
|||
* update_all
|
||||
* This takes a preference id and a value and updates all users with the new info
|
||||
*/
|
||||
public static function update_all($preference_id,$value)
|
||||
public static function update_all($preference_id, $value)
|
||||
{
|
||||
$preference_id = Dba::escape($preference_id);
|
||||
$value = Dba::escape($value);
|
||||
|
@ -184,7 +184,7 @@ class Preference extends database_object
|
|||
$db_results = Dba::read($sql);
|
||||
$data = Dba::fetch_assoc($db_results);
|
||||
|
||||
if (Access::check('interface',$data['level'])) {
|
||||
if (Access::check('interface', $data['level'])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ class Preference extends database_object
|
|||
* This inserts a new preference into the preference table
|
||||
* it does NOT sync up the users, that should be done independently
|
||||
*/
|
||||
public static function insert($name,$description,$default,$level,$type,$catagory,$subcatagory=null)
|
||||
public static function insert($name, $description, $default, $level, $type, $catagory, $subcatagory=null)
|
||||
{
|
||||
if ($subcatagory !== null) {
|
||||
$subcatagory = strtolower($subcatagory);
|
||||
|
@ -374,10 +374,10 @@ class Preference extends database_object
|
|||
|
||||
foreach ($results as $key=>$data) {
|
||||
if (!is_array($data)) {
|
||||
if (strcasecmp($data,"true") == "0") {
|
||||
if (strcasecmp($data, "true") == "0") {
|
||||
$results[$key] = 1;
|
||||
}
|
||||
if (strcasecmp($data,"false") == "0") {
|
||||
if (strcasecmp($data, "false") == "0") {
|
||||
$results[$key] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ class Preference extends database_object
|
|||
'transcode_m4a','transcode_mp3','transcode_ogg','transcode_flac',
|
||||
'shoutcast_active','httpq_active','show_lyrics');
|
||||
|
||||
if (in_array($key,$boolean_array)) {
|
||||
if (in_array($key, $boolean_array)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue