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

Merge pull request #1269 from Phyks/issue_1260

Fix coding guidelines incoherence (fix #160)
This commit is contained in:
Afterster 2016-08-05 08:14:06 +02:00 committed by GitHub
commit f76e7e6228
541 changed files with 1898 additions and 1898 deletions

1
.gitignore vendored
View file

@ -25,3 +25,4 @@ web.config
robots.txt robots.txt
php-cs-fixer.phar php-cs-fixer.phar
.php_cs.cache .php_cs.cache
cs_fixer_tmp_*

View file

@ -14,6 +14,7 @@ $finder = Symfony\CS\Finder\DefaultFinder::create()
; ;
return Symfony\CS\Config\Config::create() return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->finder($finder) ->finder($finder)
->setUsingCache(true) ->setUsingCache(true)
; ;

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -22,7 +22,7 @@
require_once '../lib/init.php'; require_once '../lib/init.php';
if (!Access::check('interface','100')) { if (!Access::check('interface', '100')) {
UI::access_denied(); UI::access_denied();
exit(); exit();
} }
@ -37,7 +37,7 @@ switch ($_REQUEST['action']) {
} }
Access::delete($_REQUEST['access_id']); Access::delete($_REQUEST['access_id']);
$url = AmpConfig::get('web_path') . '/admin/access.php'; $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; break;
case 'show_delete_record': case 'show_delete_record':
if (AmpConfig::get('demo_mode')) { if (AmpConfig::get('demo_mode')) {
@ -45,12 +45,12 @@ switch ($_REQUEST['action']) {
} }
$access = new Access($_GET['access_id']); $access = new Access($_GET['access_id']);
show_confirmation(T_('Deletion Request'), T_('Are you sure you want to permanently delete') . ' ' . $access->name, 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; break;
case 'add_host': case 'add_host':
// Make sure we've got a valid form submission // 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(); UI::access_denied();
exit; exit;
} }
@ -71,7 +71,7 @@ switch ($_REQUEST['action']) {
if (!AmpError::occurred()) { if (!AmpError::occurred()) {
$url = AmpConfig::get('web_path') . '/admin/access.php'; $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 { } else {
$action = 'show_add_' . $_POST['type']; $action = 'show_add_' . $_POST['type'];
require_once AmpConfig::get('prefix') . UI::find_template('show_add_access.inc.php'); require_once AmpConfig::get('prefix') . UI::find_template('show_add_access.inc.php');

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 '../lib/init.php';
require_once AmpConfig::get('prefix') . '/modules/catalog/local/local.catalog.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(); UI::access_denied();
exit; exit;
} }
@ -109,7 +109,7 @@ switch ($_REQUEST['action']) {
break; break;
case 'show_delete_catalog': case 'show_delete_catalog':
$next_url = AmpConfig::get('web_path') . '/admin/catalog.php?action=delete_catalog&catalogs[]=' . implode(',', $catalogs); $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; break;
case 'enable_disabled': case 'enable_disabled':
if (AmpConfig::get('demo_mode')) { if (AmpConfig::get('demo_mode')) {
@ -128,7 +128,7 @@ switch ($_REQUEST['action']) {
} }
$url = AmpConfig::get('web_path') . '/admin/catalog.php'; $url = AmpConfig::get('web_path') . '/admin/catalog.php';
$title = count($songs) . nT_(' Disabled Song Processed', ' Disabled Songs Processed', count($songs)); $title = count($songs) . nT_(' Disabled Song Processed', ' Disabled Songs Processed', count($songs));
show_confirmation($title,$body,$url); show_confirmation($title, $body, $url);
break; break;
case 'clean_all_catalogs': case 'clean_all_catalogs':
catalog_worker('clean_all_catalogs'); catalog_worker('clean_all_catalogs');
@ -150,7 +150,7 @@ switch ($_REQUEST['action']) {
$url = AmpConfig::get('web_path') . '/admin/catalog.php'; $url = AmpConfig::get('web_path') . '/admin/catalog.php';
$title = T_('Catalog Updated'); $title = T_('Catalog Updated');
$body = ''; $body = '';
show_confirmation($title,$body,$url); show_confirmation($title, $body, $url);
break; break;
case 'update_from': case 'update_from':
if (AmpConfig::get('demo_mode')) { if (AmpConfig::get('demo_mode')) {
@ -176,7 +176,7 @@ switch ($_REQUEST['action']) {
AmpError::add('general', T_('Error: Name not specified')); 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(); UI::access_denied();
exit; exit;
} }
@ -217,7 +217,7 @@ switch ($_REQUEST['action']) {
break; break;
} }
Stream::clear_now_playing(); 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; break;
case 'show_disabled': case 'show_disabled':
/* Stop the demo hippies */ /* Stop the demo hippies */
@ -241,7 +241,7 @@ switch ($_REQUEST['action']) {
$catalog = Catalog::create_from_id($_REQUEST['catalog_id']); $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']); $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; break;
case 'show_customize_catalog': case 'show_customize_catalog':
$catalog = Catalog::create_from_id($_REQUEST['catalog_id']); $catalog = Catalog::create_from_id($_REQUEST['catalog_id']);

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -22,7 +22,7 @@
require_once '../lib/init.php'; require_once '../lib/init.php';
if (!Access::check('interface','100')) { if (!Access::check('interface', '100')) {
UI::access_denied(); UI::access_denied();
exit; exit;
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -22,7 +22,7 @@
require_once '../lib/init.php'; require_once '../lib/init.php';
if (!Access::check('interface','100')) { if (!Access::check('interface', '100')) {
UI::access_denied(); UI::access_denied();
exit; exit;
} }
@ -47,7 +47,7 @@ switch ($_REQUEST['action']) {
header("Content-Transfer-Encoding: binary"); header("Content-Transfer-Encoding: binary");
header("Cache-control: public"); header("Cache-control: public");
$date = date("d/m/Y",time()); $date = date("d/m/Y", time());
switch ($_REQUEST['export_format']) { switch ($_REQUEST['export_format']) {
case 'itunes': case 'itunes':

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -22,7 +22,7 @@
require_once '../lib/init.php'; require_once '../lib/init.php';
if (!Access::check('interface',100)) { if (!Access::check('interface', 100)) {
UI::access_denied(); UI::access_denied();
exit(); exit();
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -22,7 +22,7 @@
require_once '../lib/init.php'; require_once '../lib/init.php';
if (!Access::check('interface','100')) { if (!Access::check('interface', '100')) {
UI::access_denied(); UI::access_denied();
exit; exit;
} }
@ -41,7 +41,7 @@ switch ($_REQUEST['action']) {
License::create($_POST); License::create($_POST);
$text = T_('License Created'); $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; break;
case 'show_edit': case 'show_edit':
$license = new License($_REQUEST['license_id']); $license = new License($_REQUEST['license_id']);
@ -50,7 +50,7 @@ switch ($_REQUEST['action']) {
break; break;
case 'delete': case 'delete':
License::delete($_REQUEST['license_id']); 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; break;
default: default:
$browse = new Browse(); $browse = new Browse();

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -22,7 +22,7 @@
require_once '../lib/init.php'; require_once '../lib/init.php';
if (!Access::check('interface','75')) { if (!Access::check('interface', '75')) {
UI::access_denied(); UI::access_denied();
exit(); exit();
} }
@ -67,7 +67,7 @@ switch ($_REQUEST['action']) {
$body = T_('Your E-mail was not sent.'); $body = T_('Your E-mail was not sent.');
} }
$url = AmpConfig::get('web_path') . '/admin/mail.php'; $url = AmpConfig::get('web_path') . '/admin/mail.php';
show_confirmation($title,$body,$url); show_confirmation($title, $body, $url);
break; break;
default: default:

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 // Go ahead and enable Localplay (Admin->System) as we assume they want to do that
// if they are enabling this // if they are enabling this
Preference::update('allow_localplay_playback','-1','1'); Preference::update('allow_localplay_playback', '-1', '1');
Preference::update('localplay_level',$GLOBALS['user']->id,'100'); Preference::update('localplay_level', $GLOBALS['user']->id, '100');
Preference::update('localplay_controller',$GLOBALS['user']->id,$localplay->type); Preference::update('localplay_controller', $GLOBALS['user']->id, $localplay->type);
/* Show Confirmation */ /* Show Confirmation */
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_localplay'; $url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_localplay';
$title = T_('localplay enabled'); $title = T_('localplay enabled');
$body = ''; $body = '';
show_confirmation($title ,$body, $url); show_confirmation($title, $body, $url);
break; break;
case 'install_catalog_type': case 'install_catalog_type':
$type = (string) scrub_in($_REQUEST['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'; $url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_catalog_types';
$title = T_('Module enabled'); $title = T_('Module enabled');
$body = ''; $body = '';
show_confirmation($title ,$body, $url); show_confirmation($title, $body, $url);
break; break;
case 'confirm_uninstall_localplay': case 'confirm_uninstall_localplay':
$type = (string) scrub_in($_REQUEST['type']); $type = (string) scrub_in($_REQUEST['type']);
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=uninstall_localplay&type=' . $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?'); $title = T_('Are you sure you want to disable this module?');
$body = ''; $body = '';
show_confirmation($title,$body,$url,1); show_confirmation($title, $body, $url, 1);
break; break;
case 'confirm_uninstall_catalog_type': case 'confirm_uninstall_catalog_type':
$type = (string) scrub_in($_REQUEST['type']); $type = (string) scrub_in($_REQUEST['type']);
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=uninstall_catalog_type&type=' . $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?'); $title = T_('Are you sure you want to disable this module?');
$body = ''; $body = '';
show_confirmation($title,$body,$url,1); show_confirmation($title, $body, $url, 1);
break; break;
case 'uninstall_localplay': case 'uninstall_localplay':
$type = (string) scrub_in($_REQUEST['type']); $type = (string) scrub_in($_REQUEST['type']);
@ -95,7 +95,7 @@ switch ($_REQUEST['action']) {
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_localplay'; $url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_localplay';
$title = T_('Module disabled'); $title = T_('Module disabled');
$body = ''; $body = '';
show_confirmation($title,$body,$url); show_confirmation($title, $body, $url);
break; break;
case 'uninstall_catalog_type': case 'uninstall_catalog_type':
$type = (string) scrub_in($_REQUEST['type']); $type = (string) scrub_in($_REQUEST['type']);
@ -117,17 +117,17 @@ switch ($_REQUEST['action']) {
case 'install_plugin': case 'install_plugin':
/* Verify that this plugin exists */ /* Verify that this plugin exists */
$plugins = Plugin::get_plugins(); $plugins = Plugin::get_plugins();
if (!array_key_exists($_REQUEST['plugin'],$plugins)) { if (!array_key_exists($_REQUEST['plugin'], $plugins)) {
debug_event('plugins','Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected','1'); debug_event('plugins', 'Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected', '1');
break; break;
} }
$plugin = new Plugin($_REQUEST['plugin']); $plugin = new Plugin($_REQUEST['plugin']);
if (!$plugin->install()) { 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'; $url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins';
$title = T_('Unable to Install Plugin'); $title = T_('Unable to Install Plugin');
$body = ''; $body = '';
show_confirmation($title,$body,$url); show_confirmation($title, $body, $url);
break; break;
} }
@ -138,20 +138,20 @@ switch ($_REQUEST['action']) {
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins'; $url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins';
$title = T_('Plugin enabled'); $title = T_('Plugin enabled');
$body = ''; $body = '';
show_confirmation($title,$body,$url); show_confirmation($title, $body, $url);
break; break;
case 'confirm_uninstall_plugin': case 'confirm_uninstall_plugin':
$plugin = scrub_in($_REQUEST['plugin']); $plugin = scrub_in($_REQUEST['plugin']);
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=uninstall_plugin&plugin=' . $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?'); $title = T_('Are you sure you want to disable this plugin?');
$body = ''; $body = '';
show_confirmation($title,$body,$url,1); show_confirmation($title, $body, $url, 1);
break; break;
case 'uninstall_plugin': case 'uninstall_plugin':
/* Verify that this plugin exists */ /* Verify that this plugin exists */
$plugins = Plugin::get_plugins(); $plugins = Plugin::get_plugins();
if (!array_key_exists($_REQUEST['plugin'],$plugins)) { if (!array_key_exists($_REQUEST['plugin'], $plugins)) {
debug_event('plugins','Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected','1'); debug_event('plugins', 'Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected', '1');
break; break;
} }
$plugin = new Plugin($_REQUEST['plugin']); $plugin = new Plugin($_REQUEST['plugin']);
@ -164,13 +164,13 @@ switch ($_REQUEST['action']) {
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins'; $url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins';
$title = T_('Plugin disabled'); $title = T_('Plugin disabled');
$body = ''; $body = '';
show_confirmation($title,$body,$url); show_confirmation($title, $body, $url);
break; break;
case 'upgrade_plugin': case 'upgrade_plugin':
/* Verify that this plugin exists */ /* Verify that this plugin exists */
$plugins = Plugin::get_plugins(); $plugins = Plugin::get_plugins();
if (!array_key_exists($_REQUEST['plugin'],$plugins)) { if (!array_key_exists($_REQUEST['plugin'], $plugins)) {
debug_event('plugins','Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected','1'); debug_event('plugins', 'Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected', '1');
break; break;
} }
$plugin = new Plugin($_REQUEST['plugin']); $plugin = new Plugin($_REQUEST['plugin']);

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -22,7 +22,7 @@
require_once '../lib/init.php'; require_once '../lib/init.php';
if (!Access::check('interface','100')) { if (!Access::check('interface', '100')) {
UI::access_denied(); UI::access_denied();
exit; exit;
} }
@ -36,11 +36,11 @@ switch ($_REQUEST['action']) {
if ($shout->id) { if ($shout->id) {
$shout->update($_POST); $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; break;
case 'show_edit': case 'show_edit':
$shout = new Shoutbox($_REQUEST['shout_id']); $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(); $object->format();
$client = new User($shout->user); $client = new User($shout->user);
$client->format(); $client->format();
@ -48,7 +48,7 @@ switch ($_REQUEST['action']) {
break; break;
case 'delete': case 'delete':
Shoutbox::delete($_REQUEST['shout_id']); 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; break;
default: default:
$browse = new Browse(); $browse = new Browse();

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -22,7 +22,7 @@
require_once '../lib/init.php'; 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(); UI::access_denied();
exit(); exit();
} }
@ -39,7 +39,7 @@ switch ($_REQUEST['action']) {
$current = parse_ini_file(AmpConfig::get('prefix') . '/config/ampache.cfg.php'); $current = parse_ini_file(AmpConfig::get('prefix') . '/config/ampache.cfg.php');
$final = generate_config($current); $final = generate_config($current);
$browser = new Horde_Browser(); $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; echo $final;
exit; exit;
case 'write_config': case 'write_config':

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -22,7 +22,7 @@
require_once '../lib/init.php'; require_once '../lib/init.php';
if (!Access::check('interface','100')) { if (!Access::check('interface', '100')) {
UI::access_denied(); UI::access_denied();
exit(); exit();
} }
@ -36,7 +36,7 @@ switch ($_REQUEST['action']) {
break; break;
} }
if (!Core::form_verify('edit_user','post')) { if (!Core::form_verify('edit_user', 'post')) {
UI::access_denied(); UI::access_denied();
exit; exit;
} }
@ -118,7 +118,7 @@ switch ($_REQUEST['action']) {
break; break;
} }
if (!Core::form_verify('add_user','post')) { if (!Core::form_verify('add_user', 'post')) {
UI::access_denied(); UI::access_denied();
exit; exit;
} }
@ -174,7 +174,7 @@ switch ($_REQUEST['action']) {
} }
/* HINT: %1 Username, %2 Access num */ /* 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; break;
case 'enable': case 'enable':
$client = new User($_REQUEST['user_id']); $client = new User($_REQUEST['user_id']);
@ -182,12 +182,12 @@ switch ($_REQUEST['action']) {
if (!AmpConfig::get('user_no_email_confirm')) { if (!AmpConfig::get('user_no_email_confirm')) {
Registration::send_account_enabled($client->username, $client->fullname, $client->email); 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; break;
case 'disable': case 'disable':
$client = new User($_REQUEST['user_id']); $client = new User($_REQUEST['user_id']);
if ($client->disable()) { 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 { } else {
show_confirmation(T_('Error'), T_('Unable to Disabled last Administrator'), AmpConfig::get('web_path') . '/admin/users.php'); 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']); $client = new User($_REQUEST['user_id']);
show_confirmation(T_('Deletion Request'), show_confirmation(T_('Deletion Request'),
sprintf(T_('Are you sure you want to permanently delete %s?'), $client->fullname), 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; break;
case 'show_delete_avatar': case 'show_delete_avatar':
$user_id = $_REQUEST['user_id']; $user_id = $_REQUEST['user_id'];
@ -234,7 +234,7 @@ switch ($_REQUEST['action']) {
break; break;
} }
if (!Core::form_verify('delete_avatar','post')) { if (!Core::form_verify('delete_avatar', 'post')) {
UI::access_denied(); UI::access_denied();
exit; exit;
} }
@ -256,7 +256,7 @@ switch ($_REQUEST['action']) {
break; break;
} }
if (!Core::form_verify('generate_apikey','post')) { if (!Core::form_verify('generate_apikey', 'post')) {
UI::access_denied(); UI::access_denied();
exit; exit;
} }
@ -273,7 +273,7 @@ switch ($_REQUEST['action']) {
$working_user = new User($_REQUEST['user_id']); $working_user = new User($_REQUEST['user_id']);
if (!isset($_REQUEST['all'])) { if (!isset($_REQUEST['all'])) {
$history = $working_user->get_ip_history(0,1); $history = $working_user->get_ip_history(0, 1);
} else { } else {
$history = $working_user->get_ip_history(); $history = $working_user->get_ip_history();
} }
@ -295,7 +295,7 @@ switch ($_REQUEST['action']) {
$browse->reset_filters(); $browse->reset_filters();
$browse->set_type('user'); $browse->set_type('user');
$browse->set_simple_browse(true); $browse->set_simple_browse(true);
$browse->set_sort('name','ASC'); $browse->set_sort('name', 'ASC');
$user_ids = $browse->get_objects(); $user_ids = $browse->get_objects();
$browse->show_objects($user_ids); $browse->show_objects($user_ids);
$browse->store(); $browse->store();

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -60,7 +60,7 @@ switch ($_REQUEST['action']) {
break; break;
case 'update_from_tags': case 'update_from_tags':
// Make sure they are a 'power' user at least // Make sure they are a 'power' user at least
if (!Access::check('interface','75')) { if (!Access::check('interface', '75')) {
UI::access_denied(); UI::access_denied();
exit; exit;
} }
@ -73,7 +73,7 @@ switch ($_REQUEST['action']) {
case 'set_track_numbers': case 'set_track_numbers':
debug_event('albums', 'Set track numbers called.', '5'); debug_event('albums', 'Set track numbers called.', '5');
if (!Access::check('interface','75')) { if (!Access::check('interface', '75')) {
UI::access_denied(); UI::access_denied();
exit; exit;
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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! */ /* Enclose this in the purty box! */
require AmpConfig::get('prefix') . UI::find_template('show_box_top.inc.php'); require AmpConfig::get('prefix') . UI::find_template('show_box_top.inc.php');
show_alphabet_list('artists','artists.php',$match); show_alphabet_list('artists', 'artists.php', $match);
show_alphabet_form($chr, T_('Show Artists starting with'),"artists.php?action=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'); require AmpConfig::get('prefix') . UI::find_template('show_box_bottom.inc.php');
if ($match === "Browse") { if ($match === "Browse") {

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 we got something back insert it
if ($image_data) { if ($image_data) {
$art = new Art($object_id, $object_type); $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); show_confirmation(T_('Art Inserted'), '', $burl);
} }
// Else it failed // Else it failed
@ -90,7 +90,7 @@ switch ($_REQUEST['action']) {
$image_data = Art::get_from_source($upload, $object_type); $image_data = Art::get_from_source($upload, $object_type);
if ($image_data) { if ($image_data) {
$art->insert($image_data,$upload['0']['mime']); $art->insert($image_data, $upload['0']['mime']);
show_confirmation(T_('Art Inserted'), '', $burl); show_confirmation(T_('Art Inserted'), '', $burl);
break; break;
} // if image data } // if image data

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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; break;
} // switch on type } // switch on type
} // foreach media_id } // foreach media_id
$name = 'Batch-' . date("dmY",time()); $name = 'Batch-' . date("dmY", time());
default: default:
// Rien a faire // Rien a faire
break; break;
@ -118,6 +118,6 @@ session_write_close();
$song_files = get_media_files($media_ids); $song_files = get_media_files($media_ids);
if (is_array($song_files['0'])) { if (is_array($song_files['0'])) {
set_memory_limit($song_files['1']+32); set_memory_limit($song_files['1']+32);
send_zip($name,$song_files['0']); send_zip($name, $song_files['0']);
} }
exit; exit;

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -73,17 +73,17 @@ switch ($_REQUEST['action']) {
case 'file': case 'file':
break; break;
case 'album': case 'album':
$browse->set_filter('catalog',$_SESSION['catalog']); $browse->set_filter('catalog', $_SESSION['catalog']);
if (AmpConfig::get('catalog_disable')) { if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1'); $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->update_browse_from_session(); // Update current index depending on what is in session.
$browse->show_objects(); $browse->show_objects();
break; break;
case 'tag': case 'tag':
//FIXME: This whole thing is ugly, even though it works. //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 // This one's a doozy
$browse_type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'artist'; $browse_type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'artist';
$browse->set_simple_browse(false); $browse->set_simple_browse(false);
@ -101,20 +101,20 @@ switch ($_REQUEST['action']) {
require_once AmpConfig::get('prefix') . UI::find_template('browse_content.inc.php'); require_once AmpConfig::get('prefix') . UI::find_template('browse_content.inc.php');
break; break;
case 'artist': case 'artist':
$browse->set_filter('catalog',$_SESSION['catalog']); $browse->set_filter('catalog', $_SESSION['catalog']);
if (AmpConfig::get('catalog_disable')) { if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
} }
$browse->set_sort('name','ASC'); $browse->set_sort('name', 'ASC');
$browse->update_browse_from_session(); $browse->update_browse_from_session();
$browse->show_objects(); $browse->show_objects();
break; break;
case 'song': case 'song':
$browse->set_filter('catalog',$_SESSION['catalog']); $browse->set_filter('catalog', $_SESSION['catalog']);
if (AmpConfig::get('catalog_disable')) { if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
} }
$browse->set_sort('title','ASC'); $browse->set_sort('title', 'ASC');
$browse->update_browse_from_session(); $browse->update_browse_from_session();
$browse->show_objects(); $browse->show_objects();
break; break;
@ -122,7 +122,7 @@ switch ($_REQUEST['action']) {
if (AmpConfig::get('catalog_disable')) { if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
} }
$browse->set_sort('name','ASC'); $browse->set_sort('name', 'ASC');
$browse->update_browse_from_session(); $browse->update_browse_from_session();
$browse->show_objects(); $browse->show_objects();
break; break;
@ -130,15 +130,15 @@ switch ($_REQUEST['action']) {
break; break;
case 'playlist': case 'playlist':
$browse->set_sort('type','ASC'); $browse->set_sort('type', 'ASC');
$browse->set_sort('last_update','DESC'); $browse->set_sort('last_update', 'DESC');
$browse->set_filter('playlist_type','1'); $browse->set_filter('playlist_type', '1');
$browse->update_browse_from_session(); $browse->update_browse_from_session();
$browse->show_objects(); $browse->show_objects();
break; break;
case 'smartplaylist': case 'smartplaylist':
$browse->set_sort('type', 'ASC'); $browse->set_sort('type', 'ASC');
$browse->set_filter('playlist_type','1'); $browse->set_filter('playlist_type', '1');
$browse->update_browse_from_session(); $browse->update_browse_from_session();
$browse->show_objects(); $browse->show_objects();
break; break;
@ -156,7 +156,7 @@ switch ($_REQUEST['action']) {
if (AmpConfig::get('catalog_disable')) { if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
} }
$browse->set_sort('title','ASC'); $browse->set_sort('title', 'ASC');
$browse->update_browse_from_session(); $browse->update_browse_from_session();
$browse->show_objects(); $browse->show_objects();
break; break;
@ -164,7 +164,7 @@ switch ($_REQUEST['action']) {
if (AmpConfig::get('catalog_disable')) { if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
} }
$browse->set_sort('name','ASC'); $browse->set_sort('name', 'ASC');
$browse->update_browse_from_session(); $browse->update_browse_from_session();
$browse->show_objects(); $browse->show_objects();
break; break;
@ -172,7 +172,7 @@ switch ($_REQUEST['action']) {
if (AmpConfig::get('catalog_disable')) { if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
} }
$browse->set_sort('season_number','ASC'); $browse->set_sort('season_number', 'ASC');
$browse->update_browse_from_session(); $browse->update_browse_from_session();
$browse->show_objects(); $browse->show_objects();
break; break;
@ -190,12 +190,12 @@ switch ($_REQUEST['action']) {
if (AmpConfig::get('catalog_disable')) { if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
} }
$browse->set_sort('name','ASC'); $browse->set_sort('name', 'ASC');
$browse->update_browse_from_session(); $browse->update_browse_from_session();
$browse->show_objects(); $browse->show_objects();
break; break;
case 'pvmsg': case 'pvmsg':
$browse->set_sort('creation_date','DESC'); $browse->set_sort('creation_date', 'DESC');
$folder = $_REQUEST['folder']; $folder = $_REQUEST['folder'];
if ($folder === "sent") { if ($folder === "sent") {
$browse->set_filter('user', $GLOBALS['user']->id); $browse->set_filter('user', $GLOBALS['user']->id);
@ -209,7 +209,7 @@ switch ($_REQUEST['action']) {
if (AmpConfig::get('catalog_disable')) { if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
} }
$browse->set_sort('title','ASC'); $browse->set_sort('title', 'ASC');
$browse->update_browse_from_session(); $browse->update_browse_from_session();
$browse->show_objects(); $browse->show_objects();
break; break;
@ -217,7 +217,7 @@ switch ($_REQUEST['action']) {
if (AmpConfig::get('catalog_disable')) { if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1'); $browse->set_filter('catalog_enabled', '1');
} }
$browse->set_sort('pubdate','DESC'); $browse->set_sort('pubdate', 'DESC');
$browse->update_browse_from_session(); $browse->update_browse_from_session();
$browse->show_objects(); $browse->show_objects();
break; break;

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -48,7 +48,7 @@ switch ($_REQUEST['action']) {
exit; exit;
} }
if (!Core::form_verify('add_channel','post')) { if (!Core::form_verify('add_channel', 'post')) {
UI::access_denied(); UI::access_denied();
exit; exit;
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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. the case. Also this will update local statistics for songs as well.
This is also where it decides if you need to be downsampled. 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'; require_once '../lib/init.php';
ob_end_clean(); ob_end_clean();
@ -59,9 +59,9 @@ if ($channel->is_private) {
Preference::init(); Preference::init();
if (AmpConfig::get('access_control')) { if (AmpConfig::get('access_control')) {
if (!Access::check_network('stream',$GLOBALS['user']->id,'25') and if (!Access::check_network('stream', $GLOBALS['user']->id, '25') and
!Access::check_network('network',$GLOBALS['user']->id,'25')) { !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'); debug_event('UI::access_denied', "Streaming Access Denied: " . $_SERVER['REMOTE_ADDR'] . " does not have stream level access", '3');
UI::access_denied(); UI::access_denied();
exit; exit;
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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'; require_once '../lib/init.php';
if (!AmpConfig::get('daap_backend')) { if (!AmpConfig::get('daap_backend')) {

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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->set_parent();
$democratic->format(); $democratic->format();
case 'show_create': case 'show_create':
if (!Access::check('interface','75')) { if (!Access::check('interface', '75')) {
UI::access_denied(); UI::access_denied();
break; break;
} }
@ -46,7 +46,7 @@ switch ($_REQUEST['action']) {
require_once AmpConfig::get('prefix') . UI::find_template('show_create_democratic.inc.php'); require_once AmpConfig::get('prefix') . UI::find_template('show_create_democratic.inc.php');
break; break;
case 'delete': case 'delete':
if (!Access::check('interface','75')) { if (!Access::check('interface', '75')) {
UI::access_denied(); UI::access_denied();
break; break;
} }
@ -56,11 +56,11 @@ switch ($_REQUEST['action']) {
$title = ''; $title = '';
$text = T_('The Requested Playlist has been deleted.'); $text = T_('The Requested Playlist has been deleted.');
$url = AmpConfig::get('web_path') . '/democratic.php?action=manage_playlists'; $url = AmpConfig::get('web_path') . '/democratic.php?action=manage_playlists';
show_confirmation($title,$text,$url); show_confirmation($title, $text, $url);
break; break;
case 'create': case 'create':
// Only power users here // Only power users here
if (!Access::check('interface','75')) { if (!Access::check('interface', '75')) {
UI::access_denied(); UI::access_denied();
break; break;
} }
@ -89,7 +89,7 @@ switch ($_REQUEST['action']) {
header("Location: " . AmpConfig::get('web_path') . "/democratic.php?action=show"); header("Location: " . AmpConfig::get('web_path') . "/democratic.php?action=show");
break; break;
case 'manage_playlists': case 'manage_playlists':
if (!Access::check('interface','75')) { if (!Access::check('interface', '75')) {
UI::access_denied(); UI::access_denied();
break; break;
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 file is a little weird it needs to allow API session
// this needs to be done a little better, but for now... eah // 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'; require_once 'lib/init.php';
// Check to see if they've got an interface session or a valid API session, if not GTFO // Check to see if they've got an interface session or a valid API session, if not GTFO

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 file is a little weird it needs to allow API session
// this needs to be done a little better, but for now... eah // 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'; require_once 'lib/init.php';
if (AmpConfig::get('use_auth') && AmpConfig::get('require_session')) { 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 // 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'])) { 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; exit;
} }
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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('lang', $htmllang, true);
AmpConfig::set('site_charset', $charset ?: 'UTF-8', true); AmpConfig::set('site_charset', $charset ?: 'UTF-8', true);
load_gettext(); 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 // Correct potential \ or / in the dirname
$safe_dirname = get_web_path(); $safe_dirname = get_web_path();
@ -182,7 +182,7 @@ switch ($_REQUEST['action']) {
if (install_check_status($configfile)) { if (install_check_status($configfile)) {
require_once AmpConfig::get('prefix') . UI::find_template('show_install_account.inc.php'); require_once AmpConfig::get('prefix') . UI::find_template('show_install_account.inc.php');
} else { } else {
header ("Location: " . $web_path . '/login.php'); header("Location: " . $web_path . '/login.php');
} }
break; break;
case 'create_account': case 'create_account':
@ -196,7 +196,7 @@ switch ($_REQUEST['action']) {
break; break;
} }
header ("Location: " . $web_path . '/index.php'); header("Location: " . $web_path . '/index.php');
break; break;
case 'init': case 'init':
require_once 'templates/show_install.inc.php'; require_once 'templates/show_install.inc.php';

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -60,12 +60,12 @@ switch ($_REQUEST['action']) {
break; break;
case 'add_label': case 'add_label':
// Must be at least a content manager or edit upload enabled // 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(); UI::access_denied();
exit; exit;
} }
if (!Core::form_verify('add_label','post')) { if (!Core::form_verify('add_label', 'post')) {
UI::access_denied(); UI::access_denied();
exit; exit;
} }
@ -104,7 +104,7 @@ switch ($_REQUEST['action']) {
exit; exit;
} }
case 'show_add_label': 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'); require_once AmpConfig::get('prefix') . UI::find_template('show_add_label.inc.php');
} else { } else {
echo T_('Label cannot be found.'); echo T_('Label cannot be found.');

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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) { if ($media->enabled) {
$media->format(); $media->format();
$total_size += sprintf("%.2f",($media->size/1048576)); $total_size += sprintf("%.2f", ($media->size/1048576));
$dirname = ''; $dirname = '';
$parent = $media->get_parent(); $parent = $media->get_parent();
if ($parent != null) { if ($parent != null) {
@ -81,7 +81,7 @@ function send_zip($name, $media_files)
throw new Exception('Missing ZipStream dependency.'); throw new Exception('Missing ZipStream dependency.');
} }
$arc = new ZipStream\ZipStream($name . ".zip" ); $arc = new ZipStream\ZipStream($name . ".zip");
$options = array( $options = array(
'comment' => AmpConfig::get('file_zip_comment'), 'comment' => AmpConfig::get('file_zip_comment'),
); );

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -4,7 +4,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -102,7 +102,7 @@ class Repository
$nameParts = explode('\\', $className); $nameParts = explode('\\', $className);
$tableName = preg_replace_callback( $tableName = preg_replace_callback(
'/(?<=.)([A-Z])/', '/(?<=.)([A-Z])/',
function($m) { function ($m) {
return '_' . strtolower($m[0]); return '_' . strtolower($m[0]);
}, end($nameParts)); }, end($nameParts));
return lcfirst($tableName); return lcfirst($tableName);
@ -225,6 +225,6 @@ class Repository
public function camelCaseToUnderscore($string) public function camelCaseToUnderscore($string)
{ {
return strtolower(preg_replace('/(?<=\\w)(?=[A-Z])/','_$1', $string)); return strtolower(preg_replace('/(?<=\\w)(?=[A-Z])/', '_$1', $string));
} }
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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'); $non_quoted = array('document', 'window');
if (in_array($source,$non_quoted)) { if (in_array($source, $non_quoted)) {
$source_txt = $source; $source_txt = $source;
} else { } else {
$source_txt = "'#$source'"; $source_txt = "'#$source'";
@ -105,7 +105,7 @@ class Ajax
$non_quoted = array('document','window'); $non_quoted = array('document','window');
if (in_array($source,$non_quoted)) { if (in_array($source, $non_quoted)) {
$source_txt = $source; $source_txt = $source;
} else { } else {
$source_txt = "'$source'"; $source_txt = "'$source'";

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 * @param string $artist
* @return int[] * @return int[]
*/ */
public function get_songs($limit = 0,$artist='') public function get_songs($limit = 0, $artist='')
{ {
$results = array(); $results = array();
@ -881,7 +881,7 @@ class Album extends database_object implements library_item
// Update every song // Update every song
$songs = $this->get_songs(); $songs = $this->get_songs();
foreach ($songs as $song_id) { foreach ($songs as $song_id) {
Song::update_artist($artist,$song_id); Song::update_artist($artist, $song_id);
} }
$updated = true; $updated = true;
Artist::gc(); Artist::gc();
@ -898,8 +898,8 @@ class Album extends database_object implements library_item
$songs = $this->get_songs(); $songs = $this->get_songs();
} }
foreach ($songs as $song_id) { foreach ($songs as $song_id) {
Song::update_album($album_id,$song_id); Song::update_album($album_id, $song_id);
Song::update_year($year,$song_id); Song::update_year($year, $song_id);
Song::write_id3_for_song($song_id); Song::write_id3_for_song($song_id);
} }
$current_id = $album_id; $current_id = $album_id;

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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; $data_function = 'load_' . $this->type;
$pub_date_function = 'pubdate_' . $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; $pub_date = null;
if (method_exists('Ampache_RSS', $pub_date_function)) { if (method_exists('Ampache_RSS', $pub_date_function)) {
$pub_date = call_user_func(array('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'); $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'; return 'now_playing';
} }
@ -252,7 +252,7 @@ class Ampache_RSS
$amount = floor($amount/4); $amount = floor($amount/4);
} }
if ($time_place == '6') { if ($time_place == '6') {
$amount = floor ($amount/12); $amount = floor($amount/12);
} }
if ($time_place > '6') { if ($time_place > '6') {
$final = $amount . '+'; $final = $amount . '+';
@ -266,7 +266,7 @@ class Ampache_RSS
'link'=>str_replace('&amp;', '&', $song->link), 'link'=>str_replace('&amp;', '&', $song->link),
'description'=>$song->title . ' - ' . $song->f_artist_full . ' - ' . $song->f_album_full . ' - ' . $time_string, 'description'=>$song->title . ' - ' . $song->f_artist_full . ' - ' . $song->f_album_full . ' - ' . $time_string,
'comments'=>$client->username, 'comments'=>$client->username,
'pubDate'=>date("r",$item['date'])); 'pubDate'=>date("r", $item['date']));
$results[] = $xml_array; $results[] = $xml_array;
} }
} // end foreach } // end foreach

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 * 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 * 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 // Make sure its set first
if (!isset(AmpError::$errors[$name])) { if (!isset(AmpError::$errors[$name])) {
@ -139,7 +139,7 @@ class AmpError
// Re-insert them // Re-insert them
foreach ($_SESSION['errors'] as $key=>$error) { foreach ($_SESSION['errors'] as $key=>$error) {
self::add($key,$error); self::add($key, $error);
} }
} // auto_init } // auto_init
} // Error } // Error

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 * @param int|string|boolean|null $value
* @return boolean * @return boolean
*/ */
public static function set_filter($filter,$value) public static function set_filter($filter, $value)
{ {
if (!strlen($value)) { if (!strlen($value)) {
return false; return false;
@ -83,32 +83,32 @@ class Api
switch ($filter) { switch ($filter) {
case 'add': case 'add':
// Check for a range, if no range default to gt // Check for a range, if no range default to gt
if (strpos($value,'/')) { if (strpos($value, '/')) {
$elements = explode('/',$value); $elements = explode('/', $value);
self::$browse->set_filter('add_lt',strtotime($elements['1'])); self::$browse->set_filter('add_lt', strtotime($elements['1']));
self::$browse->set_filter('add_gt',strtotime($elements['0'])); self::$browse->set_filter('add_gt', strtotime($elements['0']));
} else { } else {
self::$browse->set_filter('add_gt',strtotime($value)); self::$browse->set_filter('add_gt', strtotime($value));
} }
break; break;
case 'update': case 'update':
// Check for a range, if no range default to gt // Check for a range, if no range default to gt
if (strpos($value,'/')) { if (strpos($value, '/')) {
$elements = explode('/',$value); $elements = explode('/', $value);
self::$browse->set_filter('update_lt',strtotime($elements['1'])); self::$browse->set_filter('update_lt', strtotime($elements['1']));
self::$browse->set_filter('update_gt',strtotime($elements['0'])); self::$browse->set_filter('update_gt', strtotime($elements['0']));
} else { } else {
self::$browse->set_filter('update_gt',strtotime($value)); self::$browse->set_filter('update_gt', strtotime($value));
} }
break; break;
case 'alpha_match': case 'alpha_match':
self::$browse->set_filter('alpha_match',$value); self::$browse->set_filter('alpha_match', $value);
break; break;
case 'exact_match': case 'exact_match':
self::$browse->set_filter('exact_match',$value); self::$browse->set_filter('exact_match', $value);
break; break;
case 'enabled': case 'enabled':
self::$browse->set_filter('enabled',$value); self::$browse->set_filter('enabled', $value);
break; break;
default: default:
// Rien a faire // Rien a faire
@ -259,10 +259,10 @@ class Api
echo XML_Data::keyed_array(array('auth'=>$token, echo XML_Data::keyed_array(array('auth'=>$token,
'api'=>self::$version, 'api'=>self::$version,
'session_expire'=>date("c",time()+AmpConfig::get('session_length')-60), 'session_expire'=>date("c", time()+AmpConfig::get('session_length')-60),
'update'=>date("c",$row['update']), 'update'=>date("c", $row['update']),
'add'=>date("c",$row['add']), 'add'=>date("c", $row['add']),
'clean'=>date("c",$row['clean']), 'clean'=>date("c", $row['clean']),
'songs'=>$song['song'], 'songs'=>$song['song'],
'albums'=>$album['album'], 'albums'=>$album['album'],
'artists'=>$artist['artist'], 'artists'=>$artist['artist'],
@ -273,7 +273,7 @@ class Api
} // match } // match
} // end while } // 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')); echo XML_Data::error('401', T_('Error Invalid Handshake - ') . T_('Invalid Username/Password'));
return false; return false;
@ -292,10 +292,10 @@ class Api
// Check and see if we should extend the api sessions (done if valid sess is passed) // Check and see if we should extend the api sessions (done if valid sess is passed)
if (Session::exists('api', $input['auth'])) { if (Session::exists('api', $input['auth'])) {
Session::extend($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(); ob_end_clean();
echo XML_Data::keyed_array($xmldata); echo XML_Data::keyed_array($xmldata);
@ -312,12 +312,12 @@ class Api
{ {
self::$browse->reset_filters(); self::$browse->reset_filters();
self::$browse->set_type('artist'); self::$browse->set_type('artist');
self::$browse->set_sort('name','ASC'); self::$browse->set_sort('name', 'ASC');
$method = $input['exact'] ? 'exact_match' : 'alpha_match'; $method = $input['exact'] ? 'exact_match' : 'alpha_match';
Api::set_filter($method,$input['filter']); Api::set_filter($method, $input['filter']);
Api::set_filter('add',$input['add']); Api::set_filter('add', $input['add']);
Api::set_filter('update',$input['update']); Api::set_filter('update', $input['update']);
// Set the offset // Set the offset
XML_Data::set_offset($input['offset']); XML_Data::set_offset($input['offset']);
@ -385,11 +385,11 @@ class Api
{ {
self::$browse->reset_filters(); self::$browse->reset_filters();
self::$browse->set_type('album'); self::$browse->set_type('album');
self::$browse->set_sort('name','ASC'); self::$browse->set_sort('name', 'ASC');
$method = $input['exact'] ? 'exact_match' : 'alpha_match'; $method = $input['exact'] ? 'exact_match' : 'alpha_match';
Api::set_filter($method,$input['filter']); Api::set_filter($method, $input['filter']);
Api::set_filter('add',$input['add']); Api::set_filter('add', $input['add']);
Api::set_filter('update',$input['update']); Api::set_filter('update', $input['update']);
$albums = self::$browse->get_objects(); $albums = self::$browse->get_objects();
@ -438,10 +438,10 @@ class Api
{ {
self::$browse->reset_filters(); self::$browse->reset_filters();
self::$browse->set_type('tag'); self::$browse->set_type('tag');
self::$browse->set_sort('name','ASC'); self::$browse->set_sort('name', 'ASC');
$method = $input['exact'] ? 'exact_match' : 'alpha_match'; $method = $input['exact'] ? 'exact_match' : 'alpha_match';
Api::set_filter($method,$input['filter']); Api::set_filter($method, $input['filter']);
$tags = self::$browse->get_objects(); $tags = self::$browse->get_objects();
// Set the offset // Set the offset
@ -471,7 +471,7 @@ class Api
*/ */
public static function tag_artists($input) public static function tag_artists($input)
{ {
$artists = Tag::get_tag_objects('artist',$input['filter']); $artists = Tag::get_tag_objects('artist', $input['filter']);
if ($artists) { if ($artists) {
XML_Data::set_offset($input['offset']); XML_Data::set_offset($input['offset']);
XML_Data::set_limit($input['limit']); XML_Data::set_limit($input['limit']);
@ -488,7 +488,7 @@ class Api
*/ */
public static function tag_albums($input) public static function tag_albums($input)
{ {
$albums = Tag::get_tag_objects('album',$input['filter']); $albums = Tag::get_tag_objects('album', $input['filter']);
if ($albums) { if ($albums) {
XML_Data::set_offset($input['offset']); XML_Data::set_offset($input['offset']);
XML_Data::set_limit($input['limit']); XML_Data::set_limit($input['limit']);
@ -505,7 +505,7 @@ class Api
*/ */
public static function tag_songs($input) 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_offset($input['offset']);
XML_Data::set_limit($input['limit']); XML_Data::set_limit($input['limit']);
@ -523,14 +523,14 @@ class Api
{ {
self::$browse->reset_filters(); self::$browse->reset_filters();
self::$browse->set_type('song'); self::$browse->set_type('song');
self::$browse->set_sort('title','ASC'); self::$browse->set_sort('title', 'ASC');
$method = $input['exact'] ? 'exact_match' : 'alpha_match'; $method = $input['exact'] ? 'exact_match' : 'alpha_match';
Api::set_filter($method,$input['filter']); Api::set_filter($method, $input['filter']);
Api::set_filter('add',$input['add']); Api::set_filter('add', $input['add']);
Api::set_filter('update',$input['update']); Api::set_filter('update', $input['update']);
// Filter out disabled songs // Filter out disabled songs
Api::set_filter('enabled','1'); Api::set_filter('enabled', '1');
$songs = self::$browse->get_objects(); $songs = self::$browse->get_objects();
@ -578,10 +578,10 @@ class Api
{ {
self::$browse->reset_filters(); self::$browse->reset_filters();
self::$browse->set_type('playlist'); self::$browse->set_type('playlist');
self::$browse->set_sort('name','ASC'); self::$browse->set_sort('name', 'ASC');
$method = $input['exact'] ? 'exact_match' : 'alpha_match'; $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'); self::$browse->set_filter('playlist_type', '1');
$playlist_ids = self::$browse->get_objects(); $playlist_ids = self::$browse->get_objects();
@ -625,7 +625,7 @@ class Api
XML_Data::set_offset($input['offset']); XML_Data::set_offset($input['offset']);
XML_Data::set_limit($input['limit']); XML_Data::set_limit($input['limit']);
ob_end_clean(); ob_end_clean();
echo XML_Data::songs($songs,$items); echo XML_Data::songs($songs, $items);
} // playlist_songs } // playlist_songs
/** /**
@ -762,10 +762,10 @@ class Api
{ {
self::$browse->reset_filters(); self::$browse->reset_filters();
self::$browse->set_type('video'); self::$browse->set_type('video');
self::$browse->set_sort('title','ASC'); self::$browse->set_sort('title', 'ASC');
$method = $input['exact'] ? 'exact_match' : 'alpha_match'; $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(); $video_ids = self::$browse->get_objects();
@ -851,7 +851,7 @@ class Api
echo XML_Data::error('400', T_('Media Object Invalid or Not Specified')); 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); $democratic->remove_vote($uid);
// Everything was ok // Everything was ok

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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')) { if (function_exists('ImageCreateFromString')) {
$image = @ImageCreateFromString($source); $image = @ImageCreateFromString($source);
if (!$image || imagesx($image) < 5 || imagesy($image) < 5) { 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; $test = false;
} }
@imagedestroy($image); @imagedestroy($image);
@ -291,7 +291,7 @@ class Art extends database_object
$this->thumb = $data['thumb']; $this->thumb = $data['thumb'];
$this->thumb_mime = $data['thumb_mime']; $this->thumb_mime = $data['thumb_mime'];
} else { } 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 } // if no thumb, but art and we want to resize
@ -514,7 +514,7 @@ class Art extends database_object
} }
$fp = fopen($path, "wb"); $fp = fopen($path, "wb");
fwrite($fp, $source); fwrite($fp, $source);
fclose ($fp); fclose($fp);
return true; return true;
} }
@ -662,7 +662,7 @@ class Art extends database_object
*/ */
public function generate_thumb($image, $size, $mime) public function generate_thumb($image, $size, $mime)
{ {
$data = explode("/",$mime); $data = explode("/", $mime);
$type = strtolower($data['1']); $type = strtolower($data['1']);
if (!self::test_image($image)) { if (!self::test_image($image)) {
@ -671,32 +671,32 @@ class Art extends database_object
} }
if (!function_exists('gd_info')) { 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; return false;
} }
// Check and make sure we can resize what you've asked us to // Check and make sure we can resize what you've asked us to
if (($type == 'jpg' or $type == 'jpeg') and !(imagetypes() & IMG_JPG)) { 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; return false;
} }
if ($type == 'png' and !imagetypes() & IMG_PNG) { 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; return false;
} }
if ($type == 'gif' and !imagetypes() & IMG_GIF) { 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; return false;
} }
if ($type == 'bmp' and !imagetypes() & IMG_WBMP) { 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; return false;
} }
$source = imagecreatefromstring($image); $source = imagecreatefromstring($image);
if (!$source) { 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; return false;
} }
@ -706,7 +706,7 @@ class Art extends database_object
$thumbnail = imagecreatetruecolor($size['width'], $size['height']); $thumbnail = imagecreatetruecolor($size['width'], $size['height']);
if (!imagecopyresampled($thumbnail, $source, 0, 0, 0, 0, $size['width'], $size['height'], $source_size['width'], $source_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($source);
imagedestroy($thumbnail); imagedestroy($thumbnail);
return false; return false;
@ -796,8 +796,8 @@ class Art extends database_object
// Check to see if it's a FILE // Check to see if it's a FILE
if (isset($data['file'])) { if (isset($data['file'])) {
$handle = fopen($data['file'],'rb'); $handle = fopen($data['file'], 'rb');
$image_data = fread($handle,Core::get_filesize($data['file'])); $image_data = fread($handle, Core::get_filesize($data['file']));
fclose($handle); fclose($handle);
return $image_data; return $image_data;
} }
@ -830,7 +830,7 @@ class Art extends database_object
* @param int|null $thumb * @param int|null $thumb
* @return string * @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)) { if (!self::is_valid_type($type)) {
return null; return null;
@ -1006,7 +1006,7 @@ class Art extends database_object
$config = array($config); $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'); $plugin_names = Plugin::get_plugins('gather_arts');
foreach ($config as $method) { foreach ($config as $method) {
@ -1044,7 +1044,7 @@ class Art extends database_object
// Add the results we got to the current set // Add the results we got to the current set
$results = array_merge($results, (array) $data); $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) { if ($limit && count($results) >= $limit) {
return array_slice($results, 0, $limit); return array_slice($results, 0, $limit);
@ -1200,7 +1200,7 @@ class Art extends database_object
); );
foreach ($release->relations as $ar) { foreach ($release->relations as $ar) {
$arurl = $ar->url->resource; $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) { foreach ($coverartsites as $casite) {
if (strpos($arurl, $casite['domain']) !== false) { if (strpos($arurl, $casite['domain']) !== false) {
debug_event('mbz-gatherart', "Matched coverart site: " . $casite['name'], '5'); debug_event('mbz-gatherart', "Matched coverart site: " . $casite['name'], '5');
@ -1263,12 +1263,12 @@ class Art extends database_object
$songs = $media->get_songs(); $songs = $media->get_songs();
foreach ($songs as $song_id) { foreach ($songs as $song_id) {
$song = new Song($song_id); $song = new Song($song_id);
$dirs[] = Core::conv_lc_file( dirname($song->file) ); $dirs[] = Core::conv_lc_file(dirname($song->file));
} }
} else { } else {
if ($this->type == 'video') { if ($this->type == 'video') {
$media = new Video($this->uid); $media = new Video($this->uid);
$dirs[] = Core::conv_lc_file( dirname($media->file) ); $dirs[] = Core::conv_lc_file(dirname($media->file));
} }
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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|null $id
* @param int $catalog_init * @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 they failed to pass in an id, just run for it */
if (!$id) { if (!$id) {
@ -210,7 +210,7 @@ class Artist extends database_object implements library_item
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) { 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 // 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')) { if (AmpConfig::get('show_played_times')) {
$row['object_cnt'] = Stats::get_object_count('artist', $row['artist'], $limit_threshold); $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 } // end if extra
@ -391,8 +391,8 @@ class Artist extends database_object implements library_item
private function _get_extra_info($catalog=0, $limit_threshold ='') private function _get_extra_info($catalog=0, $limit_threshold ='')
{ {
// Try to find it in the cache and save ourselves the trouble // Try to find it in the cache and save ourselves the trouble
if (parent::is_cached('artist_extra',$this->id) ) { if (parent::is_cached('artist_extra', $this->id)) {
$row = parent::get_from_cache('artist_extra',$this->id); $row = parent::get_from_cache('artist_extra', $this->id);
} else { } else {
$params = array($this->id); $params = array($this->id);
// Calculation // Calculation
@ -421,7 +421,7 @@ class Artist extends database_object implements library_item
if (AmpConfig::get('show_played_times')) { if (AmpConfig::get('show_played_times')) {
$row['object_cnt'] = Stats::get_object_count('artist', $row['artist'], $limit_threshold); $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 */ /* 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); $extra_info = $this->_get_extra_info($this->catalog_id, $limit_threshold);
//Format the new time thingy that we just got //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); $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->tags = Tag::get_top_tags('artist', $this->id);
$this->f_tags = Tag::get_display($this->tags, true, 'artist'); $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) { if ($artist_id != null && $artist_id != $this->id) {
$songs = $this->get_songs(); $songs = $this->get_songs();
foreach ($songs as $song_id) { foreach ($songs as $song_id) {
Song::update_artist($artist_id,$song_id); Song::update_artist($artist_id, $song_id);
} }
$updated = true; $updated = true;
$current_id = $artist_id; $current_id = $artist_id;

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 * This is run every time a new object is created, and requires
* the id and type of object that we need to pull for * 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) { if (!$object_id) {
return false; return false;

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 they've enabled resizing of images generate a thumbnail
if (AmpConfig::get('resize_images')) { if (AmpConfig::get('resize_images')) {
$size = array('width' => 275, 'height' => 275); $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)) { if (is_array($thumb)) {
$art->save_thumb($thumb['thumb'], $thumb['thumb_mime'], $size); $art->save_thumb($thumb['thumb'], $thumb['thumb_mime'], $size);
} }
@ -2293,7 +2293,7 @@ abstract class Catalog extends database_object
return false; 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) 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'])) { if ($catalog_id = Catalog_local::get_from_path($options['update_path'])) {
$songs = Song::get_from_path($options['update_path']); $songs = Song::get_from_path($options['update_path']);
foreach ($songs as $song_id) { foreach ($songs as $song_id) {
Catalog::update_single_item('song',$song_id); Catalog::update_single_item('song', $song_id);
} }
} }
} // end if update } // end if update

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 ($this->id) {
if ($GLOBALS['user']->has_access('75')) { 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=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=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 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>"; 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=''; $s='';
foreach (str_split($x) as $c) { foreach (str_split($x) as $c) {
$s.=sprintf("%02X",ord($c)); $s.=sprintf("%02X", ord($c));
} }
return($s); return($s);
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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() public static function is_session_started()
{ {
if (php_sapi_name() !== 'cli' ) { if (php_sapi_name() !== 'cli') {
if (version_compare(phpversion(), '5.4.0', '>=') ) { if (version_compare(phpversion(), '5.4.0', '>=')) {
return session_status() === PHP_SESSION_ACTIVE ? true : false; return session_status() === PHP_SESSION_ACTIVE ? true : false;
} else { } else {
return session_id() === '' ? false : true; return session_id() === '' ? false : true;

View file

@ -4,7 +4,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -40,7 +40,7 @@ abstract class database_object
* get_info * get_info
* retrieves the info from the database and puts it in the cache * 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))); $table_name = $table_name ? Dba::escape($table_name) : Dba::escape(strtolower(get_class($this)));
@ -49,8 +49,8 @@ abstract class database_object
return array(); return array();
} }
if (self::is_cached($table_name,$id)) { if (self::is_cached($table_name, $id)) {
return self::get_from_cache($table_name,$id); return self::get_from_cache($table_name, $id);
} }
$sql = "SELECT * FROM `$table_name` WHERE `id`='$id'"; $sql = "SELECT * FROM `$table_name` WHERE `id`='$id'";
@ -62,7 +62,7 @@ abstract class database_object
$row = Dba::fetch_assoc($db_results); $row = Dba::fetch_assoc($db_results);
self::add_to_cache($table_name,$id,$row); self::add_to_cache($table_name, $id, $row);
return $row; return $row;
} // get_info } // 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 * This function clears something from the cache, there are a few places we need to do this
* in order to have things display correctly * 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])) { if (isset(self::$object_cache[$index]) && isset(self::$object_cache[$index][$id])) {
unset(self::$object_cache[$index][$id]); unset(self::$object_cache[$index][$id]);

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -532,11 +532,11 @@ class Dba
if ( if (
(strpos($table['Type'], 'varchar') !== false) || (strpos($table['Type'], 'varchar') !== false) ||
(strpos($table['Type'], 'enum') !== 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; $sql = "ALTER TABLE `" . $row['0'] . "` MODIFY `" . $table['Field'] . "` " . $table['Type'] . " CHARACTER SET " . $target_charset;
$charset_results = Dba::write($sql); $charset_results = Dba::write($sql);
if (!$charset_results) { 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 } // if it fails
} }
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 //FIXME: Code in single user stuff
$preference_id = Preference::id_from_name('play_type'); $preference_id = Preference::id_from_name('play_type');
Preference::update_level($preference_id,'75'); Preference::update_level($preference_id, '75');
Preference::update_all($preference_id,'democratic'); Preference::update_all($preference_id, 'democratic');
$allow_demo = Preference::id_from_name('allow_democratic_playback'); $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'); $play_method = Preference::id_from_name('playlist_method');
Preference::update_all($play_method,'clear'); Preference::update_all($play_method, 'clear');
return true; return true;
} // set_user_preferences } // set_user_preferences
@ -470,14 +470,14 @@ class Democratic extends Tmp_Playlist
* delete_from_oid * delete_from_oid
* This takes an OID and type and removes the object from the democratic playlist * 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) { 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); $this->delete_votes($row_id);
} else { } 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; return true;

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -300,51 +300,51 @@ class Graph
$height = 260; $height = 260;
} }
$MyData->setSerieDescription("TimeStamp","time"); $MyData->setSerieDescription("TimeStamp", "time");
$MyData->setAbscissa("TimeStamp"); $MyData->setAbscissa("TimeStamp");
switch ($zoom) { switch ($zoom) {
case 'hour': case 'hour':
$MyData->setXAxisDisplay(AXIS_FORMAT_TIME,"H:00"); $MyData->setXAxisDisplay(AXIS_FORMAT_TIME, "H:00");
break; break;
case 'year': case 'year':
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE,"Y"); $MyData->setXAxisDisplay(AXIS_FORMAT_DATE, "Y");
break; break;
case 'month': case 'month':
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE,"Y-m"); $MyData->setXAxisDisplay(AXIS_FORMAT_DATE, "Y-m");
break; break;
case 'day': case 'day':
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE,"Y-m-d"); $MyData->setXAxisDisplay(AXIS_FORMAT_DATE, "Y-m-d");
break; break;
} }
/* Create the pChart object */ /* Create the pChart object */
$myPicture = new CpChart\Classes\pImage($width,$height,$MyData); $myPicture = new CpChart\Classes\pImage($width, $height, $MyData);
/* Turn of Antialiasing */ /* Turn of Antialiasing */
$myPicture->Antialias = false; $myPicture->Antialias = false;
/* Draw a background */ /* Draw a background */
$Settings = array("R"=>90, "G"=>90, "B"=>90, "Dash"=>1, "DashR"=>120, "DashG"=>120, "DashB"=>120); $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 */ /* Overlay with a gradient */
$Settings = array("StartR"=>200, "StartG"=>200, "StartB"=>200, "EndR"=>50, "EndG"=>50, "EndB"=>50, "Alpha"=>50); $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_VERTICAL, $Settings);
$myPicture->drawGradientArea(0,0,$width,$height,DIRECTION_HORIZONTAL,$Settings); $myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_HORIZONTAL, $Settings);
/* Add a border to the picture */ /* 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"; $font_path = AmpConfig::get('prefix') . "/lib/vendor/szymach/c-pchart/src/Resources/fonts";
/* Write the chart title */ /* Write the chart title */
$myPicture->setFontProperties(array("FontName"=>$font_path . "/Forgotte.ttf","FontSize"=>11)); $myPicture->setFontProperties(array("FontName"=>$font_path . "/Forgotte.ttf", "FontSize"=>11));
$myPicture->drawText(150,35,$title,array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); $myPicture->drawText(150, 35, $title, array("FontSize"=>20, "Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */ /* 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 */ /* Define the chart area */
$myPicture->setGraphArea(60,40,$width-20,$height-50); $myPicture->setGraphArea(60, 40, $width-20, $height-50);
/* Draw the scale */ /* 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); $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; $myPicture->Antialias = true;
/* Draw the line chart */ /* 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(); $myPicture->drawLineChart();
/* Write a label over the chart */ /* Write a label over the chart */
$myPicture->writeLabel("Inbound",720); $myPicture->writeLabel("Inbound", 720);
/* Write the chart legend */ /* 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\""); header("Content-Disposition: filename=\"ampache-graph.png\"");
/* Render the picture (choose the best way) */ /* 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(); UI::access_denied();
} else { } else {
$user_id = $_REQUEST['user_id']; $user_id = $_REQUEST['user_id'];

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -2,7 +2,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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. * 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. * 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) { foreach ($array as $key => $value) {
if (! call_user_func ($callback, $key)) { if (! call_user_func($callback, $key)) {
unset ($array[$key]); unset($array[$key]);
} }
} }
return $array; return $array;
@ -60,14 +60,14 @@ class LDAPException extends Exception
* *
* @param mixed $message * @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); $message = 'LDAP error: [' . $message . '] ' . ldap_err2str($message);
} }
debug_event('LDAP', 'Exception: ' . $message, 6); 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} * 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. * 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 = []; $sr_clean = [];
@ -106,7 +106,7 @@ class LDAP
$sr_clean[$i] = []; $sr_clean[$i] = [];
foreach ($result as $field => $values) { foreach ($result as $field => $values) {
if ($field == 'count' || is_int ($field)) { if ($field == 'count' || is_int($field)) {
continue; continue;
} elseif ($field == 'dn') { } elseif ($field == 'dn') {
$sr_clean[$i][$field] = $values; $sr_clean[$i][$field] = $values;
@ -129,23 +129,23 @@ class LDAP
* the given parameters are plausibe and can be used to open a * the given parameters are plausibe and can be used to open a
* connection as soon as one is needed. * connection as soon as one is needed.
*/ */
private static function connect () private static function connect()
{ {
if (! $url = AmpConfig::get('ldap_url')) { if (! $url = AmpConfig::get('ldap_url')) {
throw new LDAPException('Required configuration value missing: 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); throw new LDAPException('Could not connect to ' . $url);
} }
$protocol_version = AmpConfig::get('ldap_protocol_version', 3); $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); throw new LDAPException('Could not set option PROTOCOL_VERSION to ' . $protocol_version);
} }
if (AmpConfig::get('ldap_start_tls', "false") != "false") { 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'); throw new LDAPException('Could not use StartTLS');
} }
} }
@ -157,7 +157,7 @@ class LDAP
/** /**
* Binds to the 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); debug_event('LDAP', "binding with username `$username`", 5);
@ -166,7 +166,7 @@ class LDAP
$password = AmpConfig::get('ldap_password', ''); $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`"); throw new LDAPException("Could not bind to server using username `$username`");
} }
} }
@ -175,25 +175,25 @@ class LDAP
/** /**
* Unbinds from the 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 * 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); 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`"); 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`"); throw new LDAPException("Empty search result for dn `$dn`");
} }
@ -204,24 +204,24 @@ class LDAP
/** /**
* Search for a DN in the 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); 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)); throw new LDAPException(ldap_errno($link));
} }
$entries = ldap_get_entries ($link, $result); $entries = ldap_get_entries($link, $result);
$entries = self::clean_search_results($entries); $entries = self::clean_search_results($entries);
if ($only_one_result) { if ($only_one_result) {
if (count ($entries) < 1) { if (count($entries) < 1) {
throw new LDAPException("Empty search results for filter `$filter`"); 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`"); throw new LDAPException("Too many search results for filter `$filter`");
} }
@ -243,10 +243,10 @@ class LDAP
* @param string $password * @param string $password
* @return array * @return array
*/ */
public static function auth ($username, $password) public static function auth($username, $password)
{ {
try { try {
$link = self::connect (); $link = self::connect();
self::bind($link); self::bind($link);
/* Search for the user with given base_dn, filter, objectclass and username */ /* 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'); 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); $filter = str_replace('%v', $username, $filter);
} else { } else {
$filter = "($filter=$username)"; // Backward compatibility $filter = "($filter=$username)"; // Backward compatibility
@ -266,23 +266,23 @@ class LDAP
} }
$search = "(&(objectclass=$objectclass)$filter)"; $search = "(&(objectclass=$objectclass)$filter)";
debug_event ('LDAP', 'search: ' . $search, 5); debug_event('LDAP', 'search: ' . $search, 5);
if (! $base_dn = AmpConfig::get('ldap_search_dn')) { if (! $base_dn = AmpConfig::get('ldap_search_dn')) {
throw new LDAPException('Required configuration value missing: 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']; $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) */ /* Test if the user is in the required group (optional) */
if ($group_dn = AmpConfig::get('ldap_require_group')) { if ($group_dn = AmpConfig::get('ldap_require_group')) {
$member_attribute = AmpConfig::get('ldap_member_attribute', 'member'); $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])) { if (! preg_grep("/^$user_dn\$/i", $group_infos[$member_attribute])) {
throw new LDAPException("`$user_dn` is not member of the group `$group_dn`"); throw new LDAPException("`$user_dn` is not member of the group `$group_dn`");
@ -331,8 +331,8 @@ class LDAP
]; ];
} }
if (isset ($link)) { if (isset($link)) {
self::unbind ($link); self::unbind($link);
} }
debug_event('LDAP', 'Return value of authentication: ' . json_encode($return_value), 5); debug_event('LDAP', 'Return value of authentication: ' . json_encode($return_value), 5);

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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'); $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://')); AmpError::add('general', T_('Invalid URL must be mms:// , https:// or http://'));
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -104,14 +104,14 @@ class Localplay
if (!$include) { if (!$include) {
/* Throw Error Here */ /* 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; return false;
} // include } // include
else { else {
$class_name = "Ampache" . $this->type; $class_name = "Ampache" . $this->type;
$this->_player = new $class_name(); $this->_player = new $class_name();
if (!($this->_player instanceof localplay_controller)) { 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); unset($this->_player);
return false; return false;
} }
@ -124,10 +124,10 @@ class Localplay
* is supported in the current player, if so it returns a 'skip to' * is supported in the current player, if so it returns a 'skip to'
* link, otherwise it returns just the text * link, otherwise it returns just the text
*/ */
public function format_name($name,$id) public function format_name($name, $id)
{ {
$name = scrub_out($name); $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; return $name;
} // format_name } // format_name
@ -142,7 +142,7 @@ class Localplay
$handle = opendir($basedir); $handle = opendir($basedir);
if (!is_resource($handle)) { 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(); return array();
} }
@ -212,7 +212,7 @@ class Localplay
// If its our current player, reset player to nothing // If its our current player, reset player to nothing
if (AmpConfig::get('localplay_controller') == $this->type) { if (AmpConfig::get('localplay_controller') == $this->type) {
Preference::update('localplay_controller',$GLOBALS['user']->id,''); Preference::update('localplay_controller', $GLOBALS['user']->id, '');
} }
return true; return true;
@ -226,7 +226,7 @@ class Localplay
public function connect() public function connect()
{ {
if (!$this->_player->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; return false;
} }
@ -241,7 +241,7 @@ class Localplay
public function play() public function play()
{ {
if (!$this->_player->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; return false;
} }
@ -256,7 +256,7 @@ class Localplay
public function stop() public function stop()
{ {
if (!$this->_player->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; return false;
} }
@ -296,7 +296,7 @@ class Localplay
$data = $this->_player->repeat($state); $data = $this->_player->repeat($state);
if (!$data) { 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; return $data;
@ -312,7 +312,7 @@ class Localplay
$data = $this->_player->random($state); $data = $this->_player->random($state);
if (!$data) { 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; return $data;
@ -328,7 +328,7 @@ class Localplay
$data = $this->_player->status(); $data = $this->_player->status();
if (!count($data)) { 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; return false;
} }
@ -346,7 +346,7 @@ class Localplay
$data = $this->_player->get(); $data = $this->_player->get();
if (!count($data) or !is_array($data)) { 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(); return array();
} }
@ -370,7 +370,7 @@ class Localplay
} }
if (!$this->_player->volume($value)) { 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; return false;
} }
@ -385,7 +385,7 @@ class Localplay
public function volume_up() public function volume_up()
{ {
if (!$this->_player->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; return false;
} }
@ -400,7 +400,7 @@ class Localplay
public function volume_down() public function volume_down()
{ {
if (!$this->_player->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; return false;
} }
@ -415,7 +415,7 @@ class Localplay
public function volume_mute() public function volume_mute()
{ {
if (!$this->_player->volume(0)) { 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; return false;
} }
@ -429,7 +429,7 @@ class Localplay
public function skip($track_id) public function skip($track_id)
{ {
if (!$this->_player->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; return false;
} }
@ -444,7 +444,7 @@ class Localplay
public function next() public function next()
{ {
if (!$this->_player->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; return false;
} }
@ -459,7 +459,7 @@ class Localplay
public function prev() public function prev()
{ {
if (!$this->_player->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; return false;
} }
@ -474,7 +474,7 @@ class Localplay
public function pause() public function pause()
{ {
if (!$this->_player->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; return false;
} }
@ -518,9 +518,9 @@ class Localplay
* update_instance * update_instance
* This updates the specified instance with a named array of data (_POST most likely) * 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; return $data;
} // update_instance } // update_instance
@ -560,7 +560,7 @@ class Localplay
public function delete_track($object_id) public function delete_track($object_id)
{ {
if (!$this->_player->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; return false;
} }
@ -576,7 +576,7 @@ class Localplay
public function delete_all() public function delete_all()
{ {
if (!$this->_player->clear_playlist()) { 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; return false;
} }
@ -629,7 +629,7 @@ class Localplay
/* This is a cheezball fix for when we were unable to find a /* This is a cheezball fix for when we were unable to find a
* artist/album (or one wasn't provided) * 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; $track_name = "[" . $status['track'] . "] - " . $track_name;

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 // For display we need the following 'instance' functions
abstract public function add_instance($data); abstract public function add_instance($data);
abstract public function delete_instance($id); 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 get_instances();
abstract public function instance_fields(); abstract public function instance_fields();
abstract public function set_active_instance($uid); abstract public function set_active_instance($uid);
@ -65,7 +65,7 @@ abstract class localplay_controller
$class = get_class($object); $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; return $url;
} // get_url } // get_url
@ -92,9 +92,9 @@ abstract class localplay_controller
$primary_array = array('oid','demo_id','random'); $primary_array = array('oid','demo_id','random');
$data = array(); $data = array();
$variables = parse_url($url,PHP_URL_QUERY); $variables = parse_url($url, PHP_URL_QUERY);
if ($variables) { if ($variables) {
parse_str($variables,$data); parse_str($variables, $data);
foreach ($primary_array as $pkey) { foreach ($primary_array as $pkey) {
if ($data[$pkey]) { if ($data[$pkey]) {

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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; return false;
} }
$idlist = '(' . implode(',',$ids) . ')'; $idlist = '(' . implode(',', $ids) . ')';
$sql = "SELECT * FROM `playlist` WHERE `id` IN $idlist"; $sql = "SELECT * FROM `playlist` WHERE `id` IN $idlist";
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) { 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 } // build_cache
@ -300,7 +300,7 @@ class Playlist extends playlist_object
*/ */
private function update_type($new_type) 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; $this->type = $new_type;
} }
} // update_type } // update_type
@ -311,7 +311,7 @@ class Playlist extends playlist_object
*/ */
private function update_name($new_name) 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; $this->name = $new_name;
} }
} // update_name } // update_name
@ -323,7 +323,7 @@ class Playlist extends playlist_object
private function update_last_update() private function update_last_update()
{ {
$last_update = time(); $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; $this->last_update = $last_update;
} }
} // update_last_update } // update_last_update
@ -332,9 +332,9 @@ class Playlist extends playlist_object
* _update_item * _update_item
* This is the generic update function, it does the escaping and error checking * 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; return false;
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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 // Need to get a match between Plex and Ampache users
if ($match_users) { if ($match_users) {
if (!AmpConfig::get('access_control')) { 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); self::createError(401);
} }
@ -333,7 +333,7 @@ class Plex_Api
public static function registerMyPlex($authtoken) public static function registerMyPlex($authtoken)
{ {
$headers = array ( $headers = array(
'Content-Type: text/xml' 'Content-Type: text/xml'
); );
$action = 'servers.xml?auth_token=' . $authtoken; $action = 'servers.xml?auth_token=' . $authtoken;
@ -352,7 +352,7 @@ class Plex_Api
public static function publishDeviceConnection($authtoken) 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; $action = 'devices/' . Plex_XML_Data::getMachineIdentifier() . '?Connection[][uri]=' . Plex_XML_Data::getServerUri() . '&X-Plex-Token=' . $authtoken;
$curlopts = array( $curlopts = array(
CURLOPT_CUSTOMREQUEST => "PUT" CURLOPT_CUSTOMREQUEST => "PUT"
@ -363,7 +363,7 @@ class Plex_Api
public static function unregisterMyPlex($authtoken) public static function unregisterMyPlex($authtoken)
{ {
$headers = array ( $headers = array(
'Content-Type: text/xml' 'Content-Type: text/xml'
); );
$action = 'servers/' . Plex_XML_Data::getMachineIdentifier() . '.xml?auth_token=' . $authtoken; $action = 'servers/' . Plex_XML_Data::getMachineIdentifier() . '.xml?auth_token=' . $authtoken;
@ -1092,7 +1092,7 @@ class Plex_Api
CURLOPT_TIMEOUT => 0 CURLOPT_TIMEOUT => 0
)); ));
if (curl_exec($ch) === false) { 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); curl_close($ch);
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -98,7 +98,7 @@ class Plugin
$handle = opendir($basedir); $handle = opendir($basedir);
if (!is_resource($handle)) { 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 // Recurse the directory
@ -172,15 +172,15 @@ class Plugin
} }
/* Make sure we've got the required methods */ /* Make sure we've got the required methods */
if (!method_exists($this->_plugin,'install')) { if (!method_exists($this->_plugin, 'install')) {
return false; return false;
} }
if (!method_exists($this->_plugin,'uninstall')) { if (!method_exists($this->_plugin, 'uninstall')) {
return false; return false;
} }
if (!method_exists($this->_plugin,'load')) { if (!method_exists($this->_plugin, 'load')) {
return false; return false;
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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() private function _get_extra_info()
{ {
// Try to find it in the cache and save ourselves the trouble // Try to find it in the cache and save ourselves the trouble
if (parent::is_cached('podcast_extra', $this->id) ) { if (parent::is_cached('podcast_extra', $this->id)) {
$row = parent::get_from_cache('podcast_extra', $this->id); $row = parent::get_from_cache('podcast_extra', $this->id);
} else { } else {
$sql = "SELECT COUNT(`podcast_episode`.`id`) AS `episode_count` FROM `podcast_episode` " . $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)); $db_results = Dba::read($sql, array($this->id));
$row = Dba::fetch_assoc($db_results); $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 */ /* Set Object Vars */

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * 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) 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 } // 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) private static function _update_item($field, $value, $song_id, $level)
{ {
/* Check them Rights! */ /* Check them Rights! */
if (!Access::check('interface',$level)) { if (!Access::check('interface', $level)) {
return false; return false;
} }

View file

@ -3,7 +3,7 @@
/** /**
* *
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3) * 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 * 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 * it under the terms of the GNU Affero General Public License as published by
@ -70,7 +70,7 @@ class Preference extends database_object
* update * update
* This updates a single preference from the given name or id * This updates a single preference from the given name or id
*/ */
public static function update($preference,$user_id,$value,$applytoall=false,$applytodefault=false) public static function update($preference, $user_id, $value, $applytoall=false, $applytodefault=false)
{ {
// First prepare // First prepare
if (!is_numeric($preference)) { if (!is_numeric($preference)) {
@ -80,7 +80,7 @@ class Preference extends database_object
$name = self::name_from_id($preference); $name = self::name_from_id($preference);
$id = $preference; $id = $preference;
} }
if ($applytoall and Access::check('interface','100')) { if ($applytoall and Access::check('interface', '100')) {
$user_check = ""; $user_check = "";
} else { } else {
$user_check = " AND `user`='$user_id'"; $user_check = " AND `user`='$user_id'";
@ -117,7 +117,7 @@ class Preference extends database_object
* update_level * update_level
* This takes a preference ID and updates the level required to update it (performed by an admin) * 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 // First prepare
if (!is_numeric($preference)) { if (!is_numeric($preference)) {
@ -139,7 +139,7 @@ class Preference extends database_object
* update_all * update_all
* This takes a preference id and a value and updates all users with the new info * 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); $preference_id = Dba::escape($preference_id);
$value = Dba::escape($value); $value = Dba::escape($value);
@ -184,7 +184,7 @@ class Preference extends database_object
$db_results = Dba::read($sql); $db_results = Dba::read($sql);
$data = Dba::fetch_assoc($db_results); $data = Dba::fetch_assoc($db_results);
if (Access::check('interface',$data['level'])) { if (Access::check('interface', $data['level'])) {
return true; return true;
} }
@ -283,7 +283,7 @@ class Preference extends database_object
* This inserts a new preference into the preference table * This inserts a new preference into the preference table
* it does NOT sync up the users, that should be done independently * 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) { if ($subcatagory !== null) {
$subcatagory = strtolower($subcatagory); $subcatagory = strtolower($subcatagory);
@ -374,10 +374,10 @@ class Preference extends database_object
foreach ($results as $key=>$data) { foreach ($results as $key=>$data) {
if (!is_array($data)) { if (!is_array($data)) {
if (strcasecmp($data,"true") == "0") { if (strcasecmp($data, "true") == "0") {
$results[$key] = 1; $results[$key] = 1;
} }
if (strcasecmp($data,"false") == "0") { if (strcasecmp($data, "false") == "0") {
$results[$key] = 0; $results[$key] = 0;
} }
} }
@ -431,7 +431,7 @@ class Preference extends database_object
'transcode_m4a','transcode_mp3','transcode_ogg','transcode_flac', 'transcode_m4a','transcode_mp3','transcode_ogg','transcode_flac',
'shoutcast_active','httpq_active','show_lyrics'); 'shoutcast_active','httpq_active','show_lyrics');
if (in_array($key,$boolean_array)) { if (in_array($key, $boolean_array)) {
return true; return true;
} }

Some files were not shown because too many files have changed in this diff Show more