mirror of
https://github.com/YunoHost-Apps/ampache_ynh.git
synced 2024-09-03 18:15:55 +02:00
update ampache to 3.8.2 and do yunohost 2.4 compatibility
This commit is contained in:
parent
9fc961558c
commit
dbe010e230
2480 changed files with 89257 additions and 402259 deletions
|
@ -12,6 +12,9 @@
|
|||
"email": "beudbeud@beudibox.fr"
|
||||
},
|
||||
"multi_instance": "true",
|
||||
"requirements": {
|
||||
"yunohost": ">> 2.3.12.1"
|
||||
},
|
||||
"services" : [
|
||||
"nginx",
|
||||
"php5-fpm",
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Retrieve arguments
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$1
|
||||
path=$2
|
||||
admin_ampache=$3
|
||||
|
||||
debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}')
|
||||
# Source YunoHost helpers
|
||||
. /usr/share/yunohost/helpers
|
||||
|
||||
#debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}')
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain$path -a ampache
|
||||
sudo yunohost app checkurl $domain$path -a $app
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
@ -26,14 +30,16 @@ sudo yunohost app setting ampache admin -v $admin_ampache
|
|||
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||
|
||||
# Use 'ampache' as database name and user
|
||||
db_user=ampache
|
||||
db_user=$app
|
||||
|
||||
# Initialize database and store mysql password for upgrade
|
||||
sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../sources/sql/ampache.sql)
|
||||
sudo yunohost app setting ampache mysqlpwd -v $db_pwd
|
||||
#sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../sources/sql/ampache.sql)
|
||||
sudo yunohost app setting $app mysqlpwd -v $db_pwd
|
||||
ynh_mysql_create_db "$app" "$db_user" "$db_pwd"
|
||||
ynh_mysql_connect_as "$db_user" "$db_pwd" "$app" < "../sources/sql/ampache.sql"
|
||||
|
||||
# Copy files to the right place
|
||||
final_path=/var/www/ampache
|
||||
final_path=/var/www/$app
|
||||
sudo mkdir -p $final_path/log
|
||||
sudo cp -a ../sources/* $final_path
|
||||
sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php
|
||||
|
@ -55,29 +61,32 @@ sudo chown -R www-data: $final_path
|
|||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
sed -i "s@PATHTOCHANGE@${path%/}@g" ../conf/nginx.conf*
|
||||
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/ampache.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
sudo service nginx reload
|
||||
sudo yunohost app setting ampache skipped_uris -v "/"
|
||||
sudo yunohost app setting $app skipped_uris -v "/"
|
||||
sudo yunohost app ssowatconf
|
||||
|
||||
# Install dependency
|
||||
sudo apt-get install ffmpeg -y
|
||||
sudo apt-get install libav-tools -y
|
||||
|
||||
# Ampache installation
|
||||
cd /var/www/$app
|
||||
sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
sudo php composer-setup.php
|
||||
sudo php composer.phar install --prefer-source --no-interaction
|
||||
|
||||
echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts
|
||||
sleep 1
|
||||
curl -kL -X POST http://$domain${path%/}/update.php?action=update > /dev/null 2>&1
|
||||
sleep 5
|
||||
[ "$debianversionname" == "wheezy" ] && \
|
||||
sudo sed -i 's/;transcode_cmd = "ffmpeg"/transcode_cmd = "ffmpeg"/g' /var/www/ampache/config/ampache.cfg.php && \
|
||||
sudo sed -i 's/^transcode_cmd = "avconv"/;transcode_cmd = "avconv"/g' /var/www/ampache/config/ampache.cfg.php
|
||||
sudo yunohost app setting ampache skipped_uris -d
|
||||
sudo yunohost app setting ampache skipped_uris -v "/rest"
|
||||
|
||||
sudo yunohost app setting $app skipped_uris -d
|
||||
sudo yunohost app setting $app skipped_uris -v "/rest"
|
||||
sudo yunohost app ssowatconf
|
||||
sudo sed '/yunoampache/d' /etc/hosts > /tmp/hosts.tmp
|
||||
sudo cp /tmp/hosts.tmp /etc/hosts ; sudo rm -f /tmp/hosts.tmp
|
||||
mysql -u $db_user -p$db_pwd $db_user < /tmp/admin.sql
|
||||
ynh_mysql_connect_as "$db_user" "$db_pwd" "$app" < /tmp/admin.sql
|
||||
sudo rm /tmp/admin.sql
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
db_user=ampache
|
||||
db_name=ampache
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
db_user=$app
|
||||
db_name=$app
|
||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||
domain=$(sudo yunohost app setting ampache domain)
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
|
||||
# Drop MySQL database
|
||||
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
||||
|
||||
# Remove sources
|
||||
sudo rm -rf /var/www/ampache
|
||||
sudo rm -rf /var/www/$app
|
||||
|
||||
# Remove Nginx configuration and reload Nginx conf
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/ampache.conf
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo service nginx reload
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}')
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$(sudo yunohost app setting ampache domain)
|
||||
path=$(sudo yunohost app setting ampache path)
|
||||
db_user=ampache
|
||||
db_pwd=$(sudo yunohost app setting ampache mysqlpwd)
|
||||
admin_ampache=$(sudo yunohost app setting ampache admin)
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
path=$(sudo yunohost app setting $app path)
|
||||
db_user=$app
|
||||
db_pwd=$(sudo yunohost app setting $app mysqlpwd)
|
||||
admin_ampache=$(sudo yunohost app setting $app admin)
|
||||
|
||||
# first make a copy of the db
|
||||
# mysqldump -u $db_user -p$db_pwd --add-drop-table --allow-keywords ampache > $final_path/ampache-db-backup.sql
|
||||
# mysqldump -u $db_user -p$db_pwd --add-drop-table --allow-keywords $app > $final_path/ampache-db-backup.sql
|
||||
|
||||
# Copy files to the right place
|
||||
final_path=/var/www/ampache
|
||||
final_path=/var/www/$app
|
||||
sudo cp -a ../sources/* $final_path
|
||||
sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php
|
||||
|
||||
|
@ -32,12 +30,12 @@ sudo chown -R www-data: $final_path
|
|||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
sed -i "s@PATHTOCHANGE@${path%/}@g" ../conf/nginx.conf*
|
||||
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/ampache.conf
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
sudo service nginx reload
|
||||
sudo yunohost app setting ampache skipped_uris -v "/"
|
||||
sudo yunohost app setting $app skipped_uris -v "/"
|
||||
sudo yunohost app ssowatconf
|
||||
|
||||
# Ampache installation
|
||||
|
@ -45,11 +43,9 @@ echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts
|
|||
sleep 1
|
||||
curl -kL -X POST http://$domain${path%/}/update.php?action=update > /dev/null 2>&1
|
||||
sleep 5
|
||||
[ "$debianversionname" == "wheezy" ] && \
|
||||
sudo sed -i 's/;transcode_cmd = "ffmpeg"/transcode_cmd = "ffmpeg"/g' /var/www/ampache/config/ampache.cfg.php && \
|
||||
sudo sed -i 's/^transcode_cmd = "avconv"/;transcode_cmd = "avconv"/g' /var/www/ampache/config/ampache.cfg.php
|
||||
sudo yunohost app setting ampache skipped_uris -d
|
||||
sudo yunohost app setting ampache skipped_uris -v "/rest"
|
||||
|
||||
sudo yunohost app setting $app skipped_uris -d
|
||||
sudo yunohost app setting $app skipped_uris -v "/rest"
|
||||
sudo yunohost app ssowatconf
|
||||
sudo sed '/yunoampache/d' /etc/hosts > /tmp/hosts.tmp
|
||||
sudo cp /tmp/hosts.tmp /etc/hosts ; sudo rm -f /tmp/hosts.tmp
|
||||
|
|
24
sources/.gitignore
vendored
24
sources/.gitignore
vendored
|
@ -1,12 +1,24 @@
|
|||
config/ampache.cfg.php
|
||||
config/ampache-doped.cfg.php
|
||||
rest/.htaccess
|
||||
play/.htaccess
|
||||
/config/ampache.cfg.php
|
||||
/config/ampache-doped.cfg.php
|
||||
/rest/.htaccess
|
||||
/play/.htaccess
|
||||
/channel/.htaccess
|
||||
*.phpproj
|
||||
*.sln
|
||||
*.v11.suo
|
||||
*.suo
|
||||
logs
|
||||
/logs/
|
||||
/log/
|
||||
/nbproject/private/
|
||||
.pc
|
||||
/tmp
|
||||
/tmp/
|
||||
*~
|
||||
*#
|
||||
*.log
|
||||
/lib/vendor/
|
||||
/lib/components/
|
||||
web.config
|
||||
/config/motd.php
|
||||
/config/registration_agreement.php
|
||||
/.maintenance
|
||||
/modules/plugins/ampache-*
|
||||
|
|
|
@ -3,12 +3,14 @@
|
|||
use Symfony\CS\FixerInterface;
|
||||
|
||||
$finder = Symfony\CS\Finder\DefaultFinder::create()
|
||||
->exclude('lib/components')
|
||||
->exclude('lib/vendor')
|
||||
->exclude('modules')
|
||||
->exclude('nbproject')
|
||||
->in(__DIR__)
|
||||
->in(__DIR__ . '/modules/localplay')
|
||||
->in(__DIR__ . '/modules/catalog')
|
||||
->in(__DIR__ . '/modules/ampacheapi')
|
||||
->in(__DIR__ . '/modules/plugins')
|
||||
;
|
||||
|
||||
return Symfony\CS\Config\Config::create()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
filter:
|
||||
excluded_paths:
|
||||
- 'lib/components/*'
|
||||
- 'lib/vendor/*'
|
||||
- 'modules/*'
|
||||
paths: { }
|
||||
|
||||
|
@ -8,6 +10,8 @@ tools:
|
|||
enabled: true
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'lib/components/*'
|
||||
- 'lib/vendor/*'
|
||||
- 'modules/*'
|
||||
- 'themes/*'
|
||||
paths: { }
|
||||
|
@ -21,6 +25,8 @@ tools:
|
|||
excluded_dirs: { }
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'lib/components/*'
|
||||
- 'lib/vendor/*'
|
||||
- 'modules/*'
|
||||
paths: { }
|
||||
php_analyzer:
|
||||
|
@ -28,9 +34,13 @@ tools:
|
|||
extensions:
|
||||
- php
|
||||
dependency_paths:
|
||||
- 'lib/components/*'
|
||||
- 'lib/vendor/*'
|
||||
- 'modules/*'
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'lib/components/*'
|
||||
- 'lib/vendor/*'
|
||||
- 'modules/*'
|
||||
- 'themes/*'
|
||||
paths: { }
|
||||
|
@ -44,16 +54,22 @@ tools:
|
|||
- '\bimplement(?:s|ed)?\b'
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'lib/components/*'
|
||||
- 'lib/vendor/*'
|
||||
- 'modules/*'
|
||||
paths: { }
|
||||
php_loc:
|
||||
enabled: true
|
||||
excluded_dirs:
|
||||
- 'lib/components/*'
|
||||
- 'lib/vendor/*'
|
||||
- 'modules/*'
|
||||
php_cpd:
|
||||
enabled: true
|
||||
excluded_dirs: { }
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'lib/components/*'
|
||||
- 'lib/vendor/*'
|
||||
- 'modules/*'
|
||||
paths: { }
|
|
@ -4,9 +4,10 @@ php:
|
|||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
|
||||
before_install:
|
||||
- wget http://cs.sensiolabs.org/get/php-cs-fixer.phar
|
||||
- wget http://get.sensiolabs.org/php-cs-fixer.phar
|
||||
|
||||
before_script:
|
||||
- chmod +x scripts/tests/syntax.sh
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
ampache.org
|
76
sources/README.md
Executable file → Normal file
76
sources/README.md
Executable file → Normal file
|
@ -1,6 +1,6 @@
|
|||
Ampache
|
||||
 Ampache
|
||||
=======
|
||||
[www.ampache.org](http://www.ampache.org) |
|
||||
[www.ampache.org](http://ampache.org/) |
|
||||
[ampache.github.io](http://ampache.github.io)
|
||||
|
||||
Basics
|
||||
|
@ -11,7 +11,7 @@ manager allowing you to access your music & videos from anywhere,
|
|||
using almost any internet enabled device.
|
||||
|
||||
Ampache's usefulness is heavily dependent on being able to extract
|
||||
correct metadata from embedded tags in your files and/or the filename.
|
||||
correct metadata from embedded tags in your files and/or the file name.
|
||||
Ampache is not a media organiser; it is meant to be a tool which
|
||||
presents an already organised collection in a useful way. It assumes
|
||||
that you know best how to manage your files and are capable of
|
||||
|
@ -20,15 +20,14 @@ choosing a suitable method for doing so.
|
|||
Recommended Version
|
||||
-------------------
|
||||
|
||||
Currently, the recommended version is [git HEAD](https://github.com/ampache/ampache/archive/master.tar.gz).
|
||||
The recommended and most stable version is [git HEAD](https://github.com/ampache/ampache/archive/master.tar.gz).
|
||||
[](https://travis-ci.org/ampache/ampache)
|
||||
|
||||
Latest changes but unstable is [develop branch](https://github.com/ampache/ampache/archive/develop.tar.gz).
|
||||
You get the latest version with recent changes and fixes but maybe in an unstable state from our [develop branch](https://github.com/ampache/ampache/archive/develop.tar.gz).
|
||||
[](https://travis-ci.org/ampache/ampache)
|
||||
[](https://scrutinizer-ci.com/g/ampache/ampache/?branch=develop)
|
||||
[](https://www.codacy.com/app/afterster_2222/ampache)
|
||||
[](https://www.codacy.com/app/afterster_2222/ampache)
|
||||
[](https://codeclimate.com/github/ampache/ampache)
|
||||
[](https://insight.sensiolabs.com/projects/ee067d0e-3432-4062-a969-01b4ee037f48)
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
@ -63,34 +62,33 @@ Upgrading
|
|||
|
||||
If you are upgrading from an older version of Ampache we recommend
|
||||
moving the old directory out of the way, extracting the new copy in
|
||||
its place and then copying the old config/ampache.cfg.php, /rest/.htaccess,
|
||||
its place and then copying the old /config/ampache.cfg.php, /rest/.htaccess,
|
||||
and /play/.htaccess files if any. All database updates will be handled by Ampache.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Ampache is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License v2
|
||||
modify it under the terms of the GNU Affero General Public License v3 (AGPLv3)
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
Ampache includes some external modules that carry their own licensing.
|
||||
|
||||
* [getID3](http://getid3.sourceforge.net): GPL v2
|
||||
* [Horde_Browser](http://www.horde.org): LGPL v2.1
|
||||
* [PHP-gettext](https://launchpad.net/php-gettext): GPL v2
|
||||
* [Gettext](https://github.com/oscarotero/Gettext): MIT
|
||||
* [MusicBrainz](https://github.com/mikealmond/MusicBrainz): MIT
|
||||
* PHP MPD interface: GPL v2
|
||||
* [PHPMailer](https://github.com/PHPMailer/PHPMailer): LGPL v2.1
|
||||
* [jQuery](http://jquery.org): MIT
|
||||
* [jQuery](https://jquery.org/): MIT
|
||||
* [Requests](http://requests.ryanmccue.info): ISC Licensed
|
||||
* [Whatever:hover](http://www.xs4all.nl/~peterned): LGPL v2.1
|
||||
* [xbmc-php-rpc](https://github.com/karlrixon/xbmc-php-rpc): GPL v3
|
||||
* [xbmc-php-rpc](https://github.com/krixon/xbmc-php-rpc): GPL v3
|
||||
* [Dropbox SDK](https://github.com/dropbox/dropbox-sdk-php): MIT
|
||||
* [jPlayer](http://jplayer.org): MIT
|
||||
* [prettyPhoto](http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone): GPL v2
|
||||
* [Tag-it!] (http://aehlke.github.io/tag-it): MIT
|
||||
* [PHP Echo Nest API] (https://github.com/bshaffer/php-echonest-api): MIT
|
||||
* [Noty] (http://ned.im/noty): MIT
|
||||
* [Noty] (http://ned.im/noty/): MIT
|
||||
* [jScroll] (https://github.com/pklauzinski/jscroll): MIT
|
||||
* [jquery.qrcode] (http://jeromeetienne.github.io/jquery-qrcode): MIT
|
||||
* [PHP OpenID] (https://github.com/openid/php-openid): Apache License
|
||||
|
@ -99,14 +97,14 @@ Ampache includes some external modules that carry their own licensing.
|
|||
* [Guzzle] (https://github.com/guzzle/guzzle): MIT
|
||||
* [Symfony Components] (https://github.com/symfony): MIT
|
||||
* [Evenement] (https://github.com/igorw/evenement): MIT
|
||||
* [RhinoSlider] (http://rhinoslider.com): MIT
|
||||
* [RhinoSlider] (http://www.rhinoslider.com/): MIT
|
||||
* [MediaTable] (https://github.com/edenspiekermann/MediaTable): MIT
|
||||
* [Responsive Elements] (https://github.com/kumailht/responsive-elements): MIT
|
||||
* [Bootstrap] (http://getbootstrap.com): MIT
|
||||
* [jQuery Knob] (https://github.com/aterrien/jQuery-Knob): MIT
|
||||
* [jQuery File Upload] (https://github.com/blueimp/jQuery-File-Upload): MIT
|
||||
* [jsTree] (http://www.jstree.com): MIT
|
||||
* [php-tmdb-api] (https://github.com/wtfzdotnet/php-tmdb-api) : MIT
|
||||
* [jsTree] (https://www.jstree.com/): MIT
|
||||
* [php-tmdb-api] (https://github.com/php-tmdb/api) : MIT
|
||||
* [TvDb] (https://github.com/Moinax/TvDb) : MIT
|
||||
* [jQuery DateTimePicker] (https://github.com/xdan/datetimepicker) : MIT
|
||||
* [pChart] (http://www.pchart.net) : GPL v3
|
||||
|
@ -119,27 +117,13 @@ Translations
|
|||
|
||||
Ampache is currently translated (at least partially) into the
|
||||
following languages. If you are interested in updating an existing
|
||||
translation or adding a new one please see /locale/base/TRANSLATIONS
|
||||
translation, simply visit us on [Transifex](https://www.transifex.com/ampache/ampache).
|
||||
If you prefer it old school or want to work offline, take a look at [/locale/base/TRANSLATIONS](https://github.com/ampache/ampache/blob/develop/locale/base/TRANSLATIONS.md)
|
||||
for more instructions.
|
||||
|
||||
* English (en_US)
|
||||
* Arabic (ar_SA)
|
||||
* Catalan (ca_ES)
|
||||
* Catalan (ca_ES)
|
||||
* Czech (cs_CZ)
|
||||
* Dutch (nl_NL)
|
||||
* French (fr_FR)
|
||||
* German (de_DE)
|
||||
* Greek (el_GR)
|
||||
* Italian (it_IT)
|
||||
* Japanese (ja_JP)
|
||||
* Norwegian (nb_NO)
|
||||
* Persian (fa_IR)
|
||||
* Polish (pl_PL)
|
||||
* Russian (ru_RU)
|
||||
* Spanish (es_ES)
|
||||
* Swedish (sv_SE)
|
||||
* UK English (en_GB)
|
||||
Translation progress so far:
|
||||
|
||||
[](https://www.transifex.com/projects/p/ampache/)
|
||||
|
||||
Credits
|
||||
-------
|
||||
|
@ -150,12 +134,18 @@ Thanks to all those who have helped make Ampache awesome: [Credits](docs/ACKNOWL
|
|||
Contact Us
|
||||
----------
|
||||
|
||||
Hate it? Love it? Let us know. Also let us know if you think of any
|
||||
more features, encounter bugs, etc.
|
||||
Hate it? Love it? Let us know! Dozens of people send ideas for amazing new features, report bugs and further develop Ampache actively. Be a part of Ampache with it's more than 10 years long history and get in touch with an awesome and friendly community!
|
||||
|
||||
* [Public Repository](http://github.com/ampache)
|
||||
* IRC: chat.freenode.net #ampache
|
||||
* [Forum](https://groups.google.com/forum/#!forum/ampache)
|
||||
* [Issue Tracker](https://github.com/ampache/ampache/issues)
|
||||
* [Documentation](https://github.com/ampache/ampache/wiki)
|
||||
* For Live discussions, visit us on our IRC Channel at chat.freenode.net #ampache or alternative via a [web based chat client](https://webchat.freenode.net)
|
||||
* For harder cases or general discussion about Ampache take a look at our [Google Groups Forum](https://groups.google.com/forum/#!forum/ampache)
|
||||
* Found a bug or Ampache isn't working as expected? Head over to our [Issue Tracker](https://github.com/ampache/ampache/issues)
|
||||
|
||||
Further Information and basic Help
|
||||
----------------------------------
|
||||
|
||||
* Everything related to the Ampache Project can be found on our [Public Repository](https://github.com/ampache)
|
||||
* Want to know, how to get Apache to work or learn more about the functions? See our [Documentation](https://github.com/ampache/ampache/wiki)
|
||||
|
||||
We hope to see you soon and that you have fun with this Project!
|
||||
|
||||
[Team Ampache](docs/ACKNOWLEDGEMENTS)
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -40,7 +40,9 @@ switch ($_REQUEST['action']) {
|
|||
show_confirmation(T_('Deleted'), T_('Your Access List Entry has been removed'),$url);
|
||||
break;
|
||||
case 'show_delete_record':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
$access = new Access($_GET['access_id']);
|
||||
show_confirmation(T_('Deletion Request'), T_('Are you sure you want to permanently delete') . ' ' . $access->name,
|
||||
'admin/access.php?action=delete_record&access_id=' . $access->id,1,'delete_access');
|
||||
|
@ -67,12 +69,12 @@ switch ($_REQUEST['action']) {
|
|||
Access::create($_POST);
|
||||
}
|
||||
|
||||
if (!Error::occurred()) {
|
||||
if (!AmpError::occurred()) {
|
||||
$url = AmpConfig::get('web_path') . '/admin/access.php';
|
||||
show_confirmation(T_('Added'), T_('Your new Access Control List(s) have been created'),$url);
|
||||
} else {
|
||||
$action = 'show_add_' . $_POST['type'];
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_add_access.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_add_access.inc.php');
|
||||
}
|
||||
break;
|
||||
case 'update_record':
|
||||
|
@ -82,11 +84,11 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
$access = new Access($_REQUEST['access_id']);
|
||||
$access->update($_POST);
|
||||
if (!Error::occurred()) {
|
||||
show_confirmation(T_('Updated'), T_('Access List Entry updated'), AmpConfig::get('web_path').'/admin/access.php');
|
||||
if (!AmpError::occurred()) {
|
||||
show_confirmation(T_('Updated'), T_('Access List Entry updated'), AmpConfig::get('web_path') . '/admin/access.php');
|
||||
} else {
|
||||
$access->format();
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_edit_access.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_edit_access.inc.php');
|
||||
}
|
||||
break;
|
||||
case 'show_add_current':
|
||||
|
@ -94,17 +96,17 @@ switch ($_REQUEST['action']) {
|
|||
case 'show_add_local':
|
||||
case 'show_add_advanced':
|
||||
$action = $_REQUEST['action'];
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_add_access.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_add_access.inc.php');
|
||||
break;
|
||||
case 'show_edit_record':
|
||||
$access = new Access($_REQUEST['access_id']);
|
||||
$access->format();
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_edit_access.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_edit_access.inc.php');
|
||||
break;
|
||||
default:
|
||||
$list = array();
|
||||
$list = Access::get_access_lists();
|
||||
require_once AmpConfig::get('prefix') .'/templates/show_access_list.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_access_list.inc.php');
|
||||
break;
|
||||
} // end switch on action
|
||||
UI::show_footer();
|
||||
|
|
|
@ -2,26 +2,26 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once '../lib/init.php';
|
||||
require_once AmpConfig::get('prefix') . '/modules/catalog/local.catalog.php';
|
||||
require_once AmpConfig::get('prefix') . '/modules/catalog/local/local.catalog.php';
|
||||
|
||||
if (!Access::check('interface','100')) {
|
||||
UI::access_denied();
|
||||
|
@ -45,43 +45,47 @@ if (is_array($catalogs) && count($catalogs) == 1 && $_REQUEST['action'] !== 'del
|
|||
}
|
||||
}
|
||||
}
|
||||
$sse_catalogs = urlencode(serialize($catalogs));
|
||||
|
||||
|
||||
/* Big switch statement to handle various actions */
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'add_to_all_catalogs':
|
||||
$sse_url = AmpConfig::get('web_path') . "/server/sse.server.php?worker=catalog&action=add_to_all_catalogs";
|
||||
sse_worker($sse_url);
|
||||
catalog_worker('add_to_all_catalogs');
|
||||
show_confirmation(T_('Catalog Update started...'), '', AmpConfig::get('web_path') . '/admin/catalog.php', 0, 'confirmation', false);
|
||||
break;
|
||||
case 'add_to_catalog':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$sse_url = AmpConfig::get('web_path') . "/server/sse.server.php?worker=catalog&action=add_to_catalog&catalogs=" . $sse_catalogs;
|
||||
sse_worker($sse_url);
|
||||
catalog_worker('add_to_catalog', $catalogs);
|
||||
show_confirmation(T_('Catalog Update started...'), '', AmpConfig::get('web_path') . '/admin/catalog.php', 0, 'confirmation', false);
|
||||
break;
|
||||
case 'update_all_catalogs':
|
||||
$sse_url = AmpConfig::get('web_path') . "/server/sse.server.php?worker=catalog&action=update_all_catalogs";
|
||||
sse_worker($sse_url);
|
||||
catalog_worker('update_all_catalogs');
|
||||
show_confirmation(T_('Catalog Update started...'), '', AmpConfig::get('web_path') . '/admin/catalog.php', 0, 'confirmation', false);
|
||||
break;
|
||||
case 'update_catalog':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$sse_url = AmpConfig::get('web_path') . "/server/sse.server.php?worker=catalog&action=update_catalog&catalogs=" . $sse_catalogs;
|
||||
sse_worker($sse_url);
|
||||
catalog_worker('update_catalog', $catalogs);
|
||||
show_confirmation(T_('Catalog Update started...'), '', AmpConfig::get('web_path') . '/admin/catalog.php', 0, 'confirmation', false);
|
||||
break;
|
||||
case 'full_service':
|
||||
if (AmpConfig::get('demo_mode')) { UI::access_denied(); break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
UI::access_denied();
|
||||
break;
|
||||
}
|
||||
|
||||
$sse_url = AmpConfig::get('web_path') . "/server/sse.server.php?worker=catalog&action=full_service&catalogs=" . $sse_catalogs;
|
||||
sse_worker($sse_url);
|
||||
catalog_worker('full_service', $catalogs);
|
||||
show_confirmation(T_('Catalog Update started...'), '', AmpConfig::get('web_path') . '/admin/catalog.php', 0, 'confirmation', false);
|
||||
break;
|
||||
case 'delete_catalog':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Core::form_verify('delete_catalog')) {
|
||||
UI::access_denied();
|
||||
|
@ -92,7 +96,9 @@ switch ($_REQUEST['action']) {
|
|||
/* Delete the sucker, we don't need to check perms as thats done above */
|
||||
foreach ($catalogs as $catalog_id) {
|
||||
$deleted = Catalog::delete($catalog_id);
|
||||
if (!$deleted) break;
|
||||
if (!$deleted) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
$next_url = AmpConfig::get('web_path') . '/admin/catalog.php';
|
||||
if ($deleted) {
|
||||
|
@ -106,7 +112,9 @@ switch ($_REQUEST['action']) {
|
|||
show_confirmation(T_('Catalog Delete'), T_('Confirm Deletion Request'),$next_url,1,'delete_catalog');
|
||||
break;
|
||||
case 'enable_disabled':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$songs = $_REQUEST['song'];
|
||||
|
||||
|
@ -123,18 +131,18 @@ switch ($_REQUEST['action']) {
|
|||
show_confirmation($title,$body,$url);
|
||||
break;
|
||||
case 'clean_all_catalogs':
|
||||
$sse_url = AmpConfig::get('web_path') . "/server/sse.server.php?worker=catalog&action=clean_all_catalogs";
|
||||
sse_worker($sse_url);
|
||||
catalog_worker('clean_all_catalogs');
|
||||
show_confirmation(T_('Catalog Clean started...'), '', AmpConfig::get('web_path') . '/admin/catalog.php', 0, 'confirmation', false);
|
||||
break;
|
||||
case 'clean_catalog':
|
||||
$sse_url = AmpConfig::get('web_path') . "/server/sse.server.php?worker=catalog&action=clean_catalog&catalogs=" . $sse_catalogs;
|
||||
sse_worker($sse_url);
|
||||
catalog_worker('clean_catalog', $catalogs);
|
||||
show_confirmation(T_('Catalog Clean started...'), '', AmpConfig::get('web_path') . '/admin/catalog.php', 0, 'confirmation', false);
|
||||
break;
|
||||
case 'update_catalog_settings':
|
||||
/* No Demo Here! */
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Update the catalog */
|
||||
Catalog::update_settings($_POST);
|
||||
|
@ -145,24 +153,27 @@ switch ($_REQUEST['action']) {
|
|||
show_confirmation($title,$body,$url);
|
||||
break;
|
||||
case 'update_from':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$sse_url = AmpConfig::get('web_path') . "/server/sse.server.php?worker=catalog&action=update_from&add_path=" . scrub_in($_POST['add_path']) . "&update_path=" . $_POST['update_path'];
|
||||
sse_worker($sse_url);
|
||||
catalog_worker('update_from', null, $_POST);
|
||||
show_confirmation(T_('Subdirectory update started...'), '', AmpConfig::get('web_path') . '/admin/catalog.php', 0, 'confirmation', false);
|
||||
break;
|
||||
case 'add_catalog':
|
||||
/* Wah Demo! */
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
ob_end_flush();
|
||||
|
||||
if (!strlen($_POST['type']) || $_POST['type'] == 'none') {
|
||||
Error::add('general', T_('Error: Please select a catalog type'));
|
||||
AmpError::add('general', T_('Error: Please select a catalog type'));
|
||||
}
|
||||
|
||||
if (!strlen($_POST['name'])) {
|
||||
Error::add('general', T_('Error: Name not specified'));
|
||||
AmpError::add('general', T_('Error: Name not specified'));
|
||||
}
|
||||
|
||||
if (!Core::form_verify('add_catalog','post')) {
|
||||
|
@ -171,25 +182,26 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
|
||||
// If an error hasn't occured
|
||||
if (!Error::occurred()) {
|
||||
|
||||
if (!AmpError::occurred()) {
|
||||
$catalog_id = Catalog::create($_POST);
|
||||
|
||||
if (!$catalog_id) {
|
||||
require AmpConfig::get('prefix') . '/templates/show_add_catalog.inc.php';
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_add_catalog.inc.php');
|
||||
break;
|
||||
}
|
||||
|
||||
$sse_url = AmpConfig::get('web_path') . "/server/sse.server.php?worker=catalog&action=add_catalog&catalog_id=" . $catalog_id . "&options=" . urlencode(serialize($_POST));
|
||||
sse_worker($sse_url);
|
||||
|
||||
$catalogs[] = $catalog_id;
|
||||
catalog_worker('add_to_catalog', $catalogs, $_POST);
|
||||
show_confirmation(T_('Catalog Creation started...'), '', AmpConfig::get('web_path') . '/admin/catalog.php', 0, 'confirmation', false);
|
||||
} else {
|
||||
require AmpConfig::get('prefix') . '/templates/show_add_catalog.inc.php';
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_add_catalog.inc.php');
|
||||
}
|
||||
break;
|
||||
case 'clear_stats':
|
||||
if (AmpConfig::get('demo_mode')) { UI::access_denied(); break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
UI::access_denied();
|
||||
break;
|
||||
}
|
||||
Stats::clear();
|
||||
$url = AmpConfig::get('web_path') . '/admin/catalog.php';
|
||||
$title = T_('Catalog statistics cleared');
|
||||
|
@ -197,27 +209,35 @@ switch ($_REQUEST['action']) {
|
|||
show_confirmation($title, $body, $url);
|
||||
break;
|
||||
case 'show_add_catalog':
|
||||
require AmpConfig::get('prefix') . '/templates/show_add_catalog.inc.php';
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_add_catalog.inc.php');
|
||||
break;
|
||||
case 'clear_now_playing':
|
||||
if (AmpConfig::get('demo_mode')) { UI::access_denied(); break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
UI::access_denied();
|
||||
break;
|
||||
}
|
||||
Stream::clear_now_playing();
|
||||
show_confirmation(T_('Now Playing Cleared'), T_('All now playing data has been cleared'),AmpConfig::get('web_path') . '/admin/catalog.php');
|
||||
break;
|
||||
case 'show_disabled':
|
||||
/* Stop the demo hippies */
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$songs = Song::get_disabled();
|
||||
if (count($songs)) {
|
||||
require AmpConfig::get('prefix') . '/templates/show_disabled_songs.inc.php';
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_disabled_songs.inc.php');
|
||||
} else {
|
||||
echo "<div class=\"error\" align=\"center\">" . T_('No Disabled songs found') . "</div>";
|
||||
}
|
||||
break;
|
||||
case 'show_delete_catalog':
|
||||
/* Stop the demo hippies */
|
||||
if (AmpConfig::get('demo_mode')) { UI::access_denied(); break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
UI::access_denied();
|
||||
break;
|
||||
}
|
||||
|
||||
$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']);
|
||||
|
@ -226,16 +246,15 @@ switch ($_REQUEST['action']) {
|
|||
case 'show_customize_catalog':
|
||||
$catalog = Catalog::create_from_id($_REQUEST['catalog_id']);
|
||||
$catalog->format();
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_edit_catalog.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_edit_catalog.inc.php');
|
||||
break;
|
||||
case 'gather_media_art':
|
||||
$sse_url = AmpConfig::get('web_path') . "/server/sse.server.php?worker=catalog&action=gather_media_art&catalogs=" . $sse_catalogs;
|
||||
sse_worker($sse_url);
|
||||
catalog_worker('gather_media_art', $catalogs);
|
||||
show_confirmation(T_('Media Art Search started...'), '', AmpConfig::get('web_path') . '/admin/catalog.php', 0, 'confirmation', false);
|
||||
break;
|
||||
case 'show_catalogs':
|
||||
default:
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_manage_catalogs.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_manage_catalogs.inc.php');
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -34,11 +34,11 @@ switch ($_REQUEST['action']) {
|
|||
case 'find_duplicates':
|
||||
$search_type = $_REQUEST['search_type'];
|
||||
$duplicates = Song::find_duplicates($search_type);
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_duplicate.inc.php';
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_duplicates.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_duplicate.inc.php');
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_duplicates.inc.php');
|
||||
break;
|
||||
default:
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_duplicate.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_duplicate.inc.php');
|
||||
break;
|
||||
} // end switch on action
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -65,7 +65,7 @@ switch ($_REQUEST['action']) {
|
|||
// We don't want the footer so we're done here
|
||||
exit;
|
||||
default:
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_export.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_export.inc.php');
|
||||
break;
|
||||
} // end switch on action
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -41,16 +41,16 @@ switch ($_REQUEST['action']) {
|
|||
License::create($_POST);
|
||||
$text = T_('License Created');
|
||||
}
|
||||
show_confirmation($text,'',AmpConfig::get('web_path').'/admin/license.php');
|
||||
show_confirmation($text,'',AmpConfig::get('web_path') . '/admin/license.php');
|
||||
break;
|
||||
case 'show_edit':
|
||||
$license = new License($_REQUEST['license_id']);
|
||||
case 'show_create':
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_edit_license.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_edit_license.inc.php');
|
||||
break;
|
||||
case 'delete':
|
||||
License::delete($_REQUEST['license_id']);
|
||||
show_confirmation(T_('License Deleted'),'',AmpConfig::get('web_path').'/admin/license.php');
|
||||
show_confirmation(T_('License Deleted'),'',AmpConfig::get('web_path') . '/admin/license.php');
|
||||
break;
|
||||
default:
|
||||
$browse = new Browse();
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -71,7 +71,7 @@ switch ($_REQUEST['action']) {
|
|||
|
||||
break;
|
||||
default:
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_mail_users.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_mail_users.inc.php');
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -35,8 +35,8 @@ switch ($_REQUEST['action']) {
|
|||
case 'install_localplay':
|
||||
$localplay = new Localplay($_REQUEST['type']);
|
||||
if (!$localplay->player_loaded()) {
|
||||
Error::add('general', T_('Install Failed, Controller Error'));
|
||||
Error::display('general');
|
||||
AmpError::add('general', T_('Install Failed, Controller Error'));
|
||||
AmpError::display('general');
|
||||
break;
|
||||
}
|
||||
// Install it!
|
||||
|
@ -58,8 +58,8 @@ switch ($_REQUEST['action']) {
|
|||
$type = (string) scrub_in($_REQUEST['type']);
|
||||
$catalog = Catalog::create_catalog_type($type);
|
||||
if ($catalog == null) {
|
||||
Error::add('general', T_('Install Failed, Catalog Error'));
|
||||
Error::display('general');
|
||||
AmpError::add('general', T_('Install Failed, Catalog Error'));
|
||||
AmpError::display('general');
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,8 @@ switch ($_REQUEST['action']) {
|
|||
|
||||
$catalog = Catalog::create_catalog_type($type);
|
||||
if ($catalog == null) {
|
||||
Error::add('general', T_('Uninstall Failed, Catalog Error'));
|
||||
Error::display('general');
|
||||
AmpError::add('general', T_('Uninstall Failed, Catalog Error'));
|
||||
AmpError::display('general');
|
||||
break;
|
||||
}
|
||||
$catalog->uninstall();
|
||||
|
@ -184,19 +184,19 @@ switch ($_REQUEST['action']) {
|
|||
case 'show_plugins':
|
||||
$plugins = Plugin::get_plugins();
|
||||
UI::show_box_top(T_('Plugins'), 'box box_localplay_plugins');
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_plugins.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_plugins.inc.php');
|
||||
UI::show_box_bottom();
|
||||
break;
|
||||
case 'show_localplay':
|
||||
$controllers = Localplay::get_controllers();
|
||||
UI::show_box_top(T_('Localplay Controllers'), 'box box_localplay_controllers');
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_localplay_controllers.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_localplay_controllers.inc.php');
|
||||
UI::show_box_bottom();
|
||||
break;
|
||||
case 'show_catalog_types':
|
||||
$catalogs = Catalog::get_catalog_types();
|
||||
UI::show_box_top(T_('Catalog Types'), 'box box_catalog_types');
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_catalog_types.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_catalog_types.inc.php');
|
||||
UI::show_box_bottom();
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -36,7 +36,7 @@ switch ($_REQUEST['action']) {
|
|||
if ($shout->id) {
|
||||
$shout->update($_POST);
|
||||
}
|
||||
show_confirmation(T_('Shoutbox Post Updated'),'',AmpConfig::get('web_path').'/admin/shout.php');
|
||||
show_confirmation(T_('Shoutbox Post Updated'),'',AmpConfig::get('web_path') . '/admin/shout.php');
|
||||
break;
|
||||
case 'show_edit':
|
||||
$shout = new Shoutbox($_REQUEST['shout_id']);
|
||||
|
@ -44,11 +44,11 @@ switch ($_REQUEST['action']) {
|
|||
$object->format();
|
||||
$client = new User($shout->user);
|
||||
$client->format();
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_edit_shout.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_edit_shout.inc.php');
|
||||
break;
|
||||
case 'delete':
|
||||
Shoutbox::delete($_REQUEST['shout_id']);
|
||||
show_confirmation(T_('Shoutbox Post Deleted'),'',AmpConfig::get('web_path').'/admin/shout.php');
|
||||
show_confirmation(T_('Shoutbox Post Deleted'),'',AmpConfig::get('web_path') . '/admin/shout.php');
|
||||
break;
|
||||
default:
|
||||
$browse = new Browse();
|
||||
|
|
|
@ -2,27 +2,27 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once '../lib/init.php';
|
||||
|
||||
if (!Access::check('interface',100) OR AmpConfig::get('demo_mode')) {
|
||||
if (!Access::check('interface',100) or AmpConfig::get('demo_mode')) {
|
||||
UI::access_denied();
|
||||
exit();
|
||||
}
|
||||
|
@ -44,18 +44,18 @@ switch ($_REQUEST['action']) {
|
|||
exit;
|
||||
case 'write_config':
|
||||
write_config(AmpConfig::get('prefix') . '/config/ampache.cfg.php');
|
||||
header('Location: '. AmpConfig::get('web_path') . '/index.php');
|
||||
header('Location: ' . AmpConfig::get('web_path') . '/index.php');
|
||||
exit;
|
||||
case 'reset_db_charset':
|
||||
Dba::reset_db_charset();
|
||||
show_confirmation(T_('Database Charset Updated'), T_('Your Database and associated tables have been updated to match your currently configured charset'), AmpConfig::get('web_path').'/admin/system.php?action=show_debug');
|
||||
show_confirmation(T_('Database Charset Updated'), T_('Your Database and associated tables have been updated to match your currently configured charset'), AmpConfig::get('web_path') . '/admin/system.php?action=show_debug');
|
||||
break;
|
||||
case 'show_debug':
|
||||
$configuration = AmpConfig::get_all();
|
||||
if ($_REQUEST['autoupdate'] == 'force') {
|
||||
$version = AutoUpdate::get_latest_version(true);
|
||||
}
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_debug.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_debug.inc.php');
|
||||
break;
|
||||
case 'clear_cache':
|
||||
switch ($_REQUEST['type']) {
|
||||
|
@ -63,7 +63,7 @@ switch ($_REQUEST['action']) {
|
|||
case 'artist' : Artist::clear_cache(); break;
|
||||
case 'album' : Album::clear_cache(); break;
|
||||
}
|
||||
show_confirmation(T_('Cache cleared'), T_('Your cache has been cleared successfully.'), AmpConfig::get('web_path').'/admin/system.php?action=show_debug');
|
||||
show_confirmation(T_('Cache cleared'), T_('Your cache has been cleared successfully.'), AmpConfig::get('web_path') . '/admin/system.php?action=show_debug');
|
||||
break;
|
||||
default:
|
||||
// Rien a faire
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -32,7 +32,9 @@ UI::show_header();
|
|||
// Switch on the actions
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'update_user':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Core::form_verify('edit_user','post')) {
|
||||
UI::access_denied();
|
||||
|
@ -57,26 +59,26 @@ switch ($_REQUEST['action']) {
|
|||
|
||||
/* Verify Input */
|
||||
if (empty($username)) {
|
||||
Error::add('username', T_("Error Username Required"));
|
||||
AmpError::add('username', T_("Error Username Required"));
|
||||
} else {
|
||||
if ($username != $client->username) {
|
||||
if (!User::check_username($username)) {
|
||||
Error::add('username', T_("Error Username already exists"));
|
||||
AmpError::add('username', T_("Error Username already exists"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($pass1 !== $pass2 && !empty($pass1)) {
|
||||
Error::add('password', T_("Error Passwords don't match"));
|
||||
AmpError::add('password', T_("Error Passwords don't match"));
|
||||
}
|
||||
|
||||
// Check the mail for correct address formation.
|
||||
if (!Mailer::validate_address($email)) {
|
||||
Error::add('email', T_('Invalid email address'));
|
||||
AmpError::add('email', T_('Invalid email address'));
|
||||
}
|
||||
|
||||
/* If we've got an error then show edit form! */
|
||||
if (Error::occurred()) {
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_edit_user.inc.php';
|
||||
if (AmpError::occurred()) {
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_edit_user.inc.php');
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -109,10 +111,12 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
$client->upload_avatar();
|
||||
|
||||
show_confirmation(T_('User Updated'), $client->fullname . "(" . $client->username . ")" . T_('updated'), AmpConfig::get('web_path'). '/admin/users.php');
|
||||
show_confirmation(T_('User Updated'), $client->fullname . "(" . $client->username . ")" . T_('updated'), AmpConfig::get('web_path') . '/admin/users.php');
|
||||
break;
|
||||
case 'add_user':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Core::form_verify('add_user','post')) {
|
||||
UI::access_denied();
|
||||
|
@ -130,41 +134,47 @@ switch ($_REQUEST['action']) {
|
|||
$city = (string) scrub_in($_POST['city']);
|
||||
|
||||
if ($pass1 !== $pass2 || !strlen($pass1)) {
|
||||
Error::add('password', T_("Error Passwords don't match"));
|
||||
AmpError::add('password', T_("Error Passwords don't match"));
|
||||
}
|
||||
|
||||
if (empty($username)) {
|
||||
Error::add('username', T_('Error Username Required'));
|
||||
AmpError::add('username', T_('Error Username Required'));
|
||||
}
|
||||
|
||||
/* make sure the username doesn't already exist */
|
||||
if (!User::check_username($username)) {
|
||||
Error::add('username', T_('Error Username already exists'));
|
||||
AmpError::add('username', T_('Error Username already exists'));
|
||||
}
|
||||
|
||||
// Check the mail for correct address formation.
|
||||
if (!Mailer::validate_address($email)) {
|
||||
Error::add('email', T_('Invalid email address'));
|
||||
AmpError::add('email', T_('Invalid email address'));
|
||||
}
|
||||
|
||||
/* If we've got an error then show add form! */
|
||||
if (Error::occurred()) {
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_add_user.inc.php';
|
||||
if (AmpError::occurred()) {
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_add_user.inc.php');
|
||||
break;
|
||||
}
|
||||
|
||||
/* Attempt to create the user */
|
||||
$user_id = User::create($username, $fullname, $email, $website, $pass1, $access, $state, $city);
|
||||
if (!$user_id) {
|
||||
Error::add('general', T_("Error: Insert Failed"));
|
||||
AmpError::add('general', T_("Error: Insert Failed"));
|
||||
}
|
||||
$user = new User($user_id);
|
||||
$user->upload_avatar();
|
||||
|
||||
if ($access == 5) { $access = T_('Guest');} elseif ($access == 25) { $access = T_('User');} elseif ($access == 100) { $access = T_('Admin');}
|
||||
if ($access == 5) {
|
||||
$access = T_('Guest');
|
||||
} elseif ($access == 25) {
|
||||
$access = T_('User');
|
||||
} elseif ($access == 100) {
|
||||
$access = T_('Admin');
|
||||
}
|
||||
|
||||
/* HINT: %1 Username, %2 Access num */
|
||||
show_confirmation(T_('New User Added'),sprintf(T_('%1$s has been created with an access level of %2$s'), $username, $access), AmpConfig::get('web_path').'/admin/users.php');
|
||||
show_confirmation(T_('New User Added'),sprintf(T_('%1$s has been created with an access level of %2$s'), $username, $access), AmpConfig::get('web_path') . '/admin/users.php');
|
||||
break;
|
||||
case 'enable':
|
||||
$client = new User($_REQUEST['user_id']);
|
||||
|
@ -172,40 +182,46 @@ switch ($_REQUEST['action']) {
|
|||
if (!AmpConfig::get('user_no_email_confirm')) {
|
||||
Registration::send_account_enabled($client->username, $client->fullname, $client->email);
|
||||
}
|
||||
show_confirmation(T_('User Enabled'),$client->fullname . ' (' . $client->username . ')', AmpConfig::get('web_path'). '/admin/users.php');
|
||||
show_confirmation(T_('User Enabled'),$client->fullname . ' (' . $client->username . ')', AmpConfig::get('web_path') . '/admin/users.php');
|
||||
break;
|
||||
case 'disable':
|
||||
$client = new User($_REQUEST['user_id']);
|
||||
if ($client->disable()) {
|
||||
show_confirmation(T_('User Disabled'),$client->fullname . ' (' . $client->username . ')', AmpConfig::get('web_path'). '/admin/users.php');
|
||||
show_confirmation(T_('User Disabled'),$client->fullname . ' (' . $client->username . ')', AmpConfig::get('web_path') . '/admin/users.php');
|
||||
} else {
|
||||
show_confirmation(T_('Error'), T_('Unable to Disabled last Administrator'), AmpConfig::get('web_path').'/admin/users.php');
|
||||
show_confirmation(T_('Error'), T_('Unable to Disabled last Administrator'), AmpConfig::get('web_path') . '/admin/users.php');
|
||||
}
|
||||
break;
|
||||
case 'show_edit':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
$client = new User($_REQUEST['user_id']);
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_edit_user.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_edit_user.inc.php');
|
||||
break;
|
||||
case 'confirm_delete':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
if (!Core::form_verify('delete_user')) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
$client = new User($_REQUEST['user_id']);
|
||||
if ($client->delete()) {
|
||||
show_confirmation(T_('User Deleted'), sprintf(T_('%s has been Deleted'), $client->username), AmpConfig::get('web_path'). "/admin/users.php");
|
||||
show_confirmation(T_('User Deleted'), sprintf(T_('%s has been Deleted'), $client->username), AmpConfig::get('web_path') . "/admin/users.php");
|
||||
} else {
|
||||
show_confirmation(T_('Delete Error'), T_("Unable to delete last Admin User"), AmpConfig::get('web_path')."/admin/users.php");
|
||||
show_confirmation(T_('Delete Error'), T_("Unable to delete last Admin User"), AmpConfig::get('web_path') . "/admin/users.php");
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
$client = new User($_REQUEST['user_id']);
|
||||
show_confirmation(T_('Deletion Request'),
|
||||
sprintf(T_('Are you sure you want to permanently delete %s?'), $client->fullname),
|
||||
AmpConfig::get('web_path')."/admin/users.php?action=confirm_delete&user_id=" . $_REQUEST['user_id'],1,'delete_user');
|
||||
AmpConfig::get('web_path') . "/admin/users.php?action=confirm_delete&user_id=" . $_REQUEST['user_id'],1,'delete_user');
|
||||
break;
|
||||
case 'show_delete_avatar':
|
||||
$user_id = $_REQUEST['user_id'];
|
||||
|
@ -214,7 +230,9 @@ switch ($_REQUEST['action']) {
|
|||
show_confirmation(T_('User Avatar Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_avatar');
|
||||
break;
|
||||
case 'delete_avatar':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Core::form_verify('delete_avatar','post')) {
|
||||
UI::access_denied();
|
||||
|
@ -225,7 +243,7 @@ switch ($_REQUEST['action']) {
|
|||
$client->delete_avatar();
|
||||
|
||||
$next_url = AmpConfig::get('web_path') . '/admin/users.php';
|
||||
show_confirmation(T_('User Avater Deleted'), T_('User Avatar has been deleted'), $next_url);
|
||||
show_confirmation(T_('User Avatar Deleted'), T_('User Avatar has been deleted'), $next_url);
|
||||
break;
|
||||
case 'show_generate_apikey':
|
||||
$user_id = $_REQUEST['user_id'];
|
||||
|
@ -234,7 +252,9 @@ switch ($_REQUEST['action']) {
|
|||
show_confirmation(T_('Generate new API Key'), T_('Confirm API Key Generation'), $next_url, 1, 'generate_apikey');
|
||||
break;
|
||||
case 'generate_apikey':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Core::form_verify('generate_apikey','post')) {
|
||||
UI::access_denied();
|
||||
|
@ -257,16 +277,18 @@ switch ($_REQUEST['action']) {
|
|||
} else {
|
||||
$history = $working_user->get_ip_history();
|
||||
}
|
||||
require AmpConfig::get('prefix') . '/templates/show_ip_history.inc.php';
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_ip_history.inc.php');
|
||||
break;
|
||||
case 'show_add_user':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_add_user.inc.php';
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_add_user.inc.php');
|
||||
break;
|
||||
case 'show_preferences':
|
||||
$client = new User($_REQUEST['user_id']);
|
||||
$preferences = Preference::get_all($client->id);
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_user_preferences.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_user_preferences.inc.php');
|
||||
break;
|
||||
default:
|
||||
$browse = new Browse();
|
||||
|
|
|
@ -2,44 +2,48 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once 'lib/init.php';
|
||||
|
||||
require_once AmpConfig::get('prefix') . '/templates/header.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('header.inc.php');
|
||||
|
||||
/* Switch on Action */
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'delete':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$album_id = scrub_in($_REQUEST['album_id']);
|
||||
show_confirmation(
|
||||
T_('Album Deletion'),
|
||||
T_('Are you sure you want to permanently delete this album?'),
|
||||
AmpConfig::get('web_path')."/albums.php?action=confirm_delete&album_id=" . $album_id,
|
||||
AmpConfig::get('web_path') . "/albums.php?action=confirm_delete&album_id=" . $album_id,
|
||||
1,
|
||||
'delete_album'
|
||||
);
|
||||
break;
|
||||
case 'confirm_delete':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$album = new Album($_REQUEST['album_id']);
|
||||
if (!Catalog::can_remove($album)) {
|
||||
|
@ -64,7 +68,7 @@ switch ($_REQUEST['action']) {
|
|||
$type = 'album';
|
||||
$object_id = intval($_REQUEST['album_id']);
|
||||
$target_url = AmpConfig::get('web_path') . '/albums.php?action=show&album=' . $object_id;
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_update_items.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_update_items.inc.php');
|
||||
break;
|
||||
case 'set_track_numbers':
|
||||
debug_event('albums', 'Set track numbers called.', '5');
|
||||
|
@ -77,7 +81,7 @@ switch ($_REQUEST['action']) {
|
|||
// Retrieving final song order from url
|
||||
foreach ($_GET as $key => $data) {
|
||||
$_GET[$key] = unhtmlentities(scrub_in($data));
|
||||
debug_event('albums', $key.'='.$_GET[$key], '5');
|
||||
debug_event('albums', $key . '=' . $_GET[$key], '5');
|
||||
}
|
||||
|
||||
if (isset($_GET['order'])) {
|
||||
|
@ -108,7 +112,7 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
$walbum->load_all();
|
||||
$walbum->format();
|
||||
require AmpConfig::get('prefix') . '/templates/show_missing_album.inc.php';
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_missing_album.inc.php');
|
||||
break;
|
||||
// Browse by Album
|
||||
case 'show':
|
||||
|
@ -117,9 +121,9 @@ switch ($_REQUEST['action']) {
|
|||
$album->format();
|
||||
|
||||
if (!count($album->album_suite)) {
|
||||
require AmpConfig::get('prefix') . '/templates/show_album.inc.php';
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_album.inc.php');
|
||||
} else {
|
||||
require AmpConfig::get('prefix') . '/templates/show_album_group_disks.inc.php';
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_album_group_disks.inc.php');
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -29,19 +29,23 @@ UI::show_header();
|
|||
*/
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'delete':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$artist_id = scrub_in($_REQUEST['artist_id']);
|
||||
show_confirmation(
|
||||
T_('Artist Deletion'),
|
||||
T_('Are you sure you want to permanently delete this artist?'),
|
||||
AmpConfig::get('web_path')."/artists.php?action=confirm_delete&artist_id=" . $artist_id,
|
||||
AmpConfig::get('web_path') . "/artists.php?action=confirm_delete&artist_id=" . $artist_id,
|
||||
1,
|
||||
'delete_artist'
|
||||
);
|
||||
break;
|
||||
case 'confirm_delete':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$artist = new Artist($_REQUEST['artist_id']);
|
||||
if (!Catalog::can_remove($artist)) {
|
||||
|
@ -65,30 +69,34 @@ switch ($_REQUEST['action']) {
|
|||
$object_ids = $artist->get_albums($_REQUEST['catalog']);
|
||||
}
|
||||
$object_type = 'album';
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_artist.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_artist.inc.php');
|
||||
break;
|
||||
case 'show_all_songs':
|
||||
$artist = new Artist($_REQUEST['artist']);
|
||||
$artist->format();
|
||||
$object_type = 'song';
|
||||
$object_ids = $artist->get_songs();
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_artist.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_artist.inc.php');
|
||||
break;
|
||||
case 'update_from_tags':
|
||||
$type = 'artist';
|
||||
$object_id = intval($_REQUEST['artist']);
|
||||
$target_url = AmpConfig::get('web_path') . "/artists.php?action=show&artist=" . $object_id;
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_update_items.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_update_items.inc.php');
|
||||
break;
|
||||
case 'match':
|
||||
case 'Match':
|
||||
$match = scrub_in($_REQUEST['match']);
|
||||
if ($match == "Browse" || $match == "Show_all") { $chr = ""; } else { $chr = $match; }
|
||||
if ($match == "Browse" || $match == "Show_all") {
|
||||
$chr = "";
|
||||
} else {
|
||||
$chr = $match;
|
||||
}
|
||||
/* Enclose this in the purty box! */
|
||||
require AmpConfig::get('prefix') . '/templates/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_form($chr, T_('Show Artists starting with'),"artists.php?action=match");
|
||||
require AmpConfig::get('prefix') . '/templates/show_box_bottom.inc.php';
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_box_bottom.inc.php');
|
||||
|
||||
if ($match === "Browse") {
|
||||
show_artists();
|
||||
|
@ -108,7 +116,7 @@ switch ($_REQUEST['action']) {
|
|||
$mbid = $_REQUEST['mbid'];
|
||||
$wartist = Wanted::get_missing_artist($mbid);
|
||||
|
||||
require AmpConfig::get('prefix') . '/templates/show_missing_artist.inc.php';
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_missing_artist.inc.php');
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
|
|
|
@ -2,31 +2,34 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once 'lib/init.php';
|
||||
|
||||
require_once AmpConfig::get('prefix') . '/templates/header.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('header.inc.php');
|
||||
|
||||
$object_type = $_GET['object_type'];
|
||||
$object_id = $_GET['object_id'];
|
||||
if (!Core::is_library_item($object_type)) { UI::access_denied(); exit; }
|
||||
if (!Core::is_library_item($object_type)) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
$burl = '';
|
||||
if (isset($_GET['burl'])) {
|
||||
$burl = base64_decode($_GET['burl']);
|
||||
|
@ -34,7 +37,10 @@ if (isset($_GET['burl'])) {
|
|||
$item = new $object_type($object_id);
|
||||
|
||||
// If not a content manager user then kick em out
|
||||
if (!Access::check('interface', 50) && (!Access::check('interface', 25) || $item->get_user_owner() != $GLOBALS['user']->id)) { UI::access_denied(); exit; }
|
||||
if (!Access::check('interface', 50) && (!Access::check('interface', 25) || $item->get_user_owner() != $GLOBALS['user']->id)) {
|
||||
UI::access_denied();
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Switch on Action */
|
||||
switch ($_REQUEST['action']) {
|
||||
|
@ -87,9 +93,7 @@ switch ($_REQUEST['action']) {
|
|||
$art->insert($image_data,$upload['0']['mime']);
|
||||
show_confirmation(T_('Art Inserted'), '', $burl);
|
||||
break;
|
||||
|
||||
} // if image data
|
||||
|
||||
} // if it's an upload
|
||||
|
||||
$keywords = $item->get_keywords();
|
||||
|
@ -128,14 +132,14 @@ switch ($_REQUEST['action']) {
|
|||
} // end foreach
|
||||
// Store the results for further use
|
||||
$_SESSION['form']['images'] = $images;
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_arts.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_arts.inc.php');
|
||||
}
|
||||
// Else nothing
|
||||
else {
|
||||
show_confirmation(T_('Art Not Located'), T_('Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'), $burl);
|
||||
}
|
||||
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_get_art.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_get_art.inc.php');
|
||||
|
||||
break;
|
||||
case 'select_art':
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -28,12 +28,18 @@ require_once $prefix . '/lib/init.php';
|
|||
// Turn off output buffering we don't need it for a command line script
|
||||
ob_end_clean();
|
||||
|
||||
$sql = "SELECT `image`,`id` FROM `image`";
|
||||
$inDisk = AmpConfig::get('album_art_store_disk');
|
||||
|
||||
$sql = "SELECT `image`,`id`,object_id,object_type,size FROM `image`";
|
||||
$db_results = Dba::read($sql);
|
||||
$results = array();
|
||||
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
if ($inDisk)
|
||||
$source = Art::get_from_source(array('file' => Art::get_dir_on_disk($row['object_type'], $row['object_id'], 'default').'art-'.$row['size'].'.jpg'), $row['object_type']);
|
||||
else
|
||||
$source = $row['image'];
|
||||
|
||||
$id = $row['id'];
|
||||
$dimensions = Core::image_dimensions($source);
|
||||
if ($dimensions) {
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
5
sources/bin/daap_register.bat
Normal file
5
sources/bin/daap_register.bat
Normal file
|
@ -0,0 +1,5 @@
|
|||
start dns-sd -R Ampache _http._tcp local 3689
|
||||
start dns-sd -R Ampache _daap._tcp local 3689 txtvers=1 "Machine ID"=AC630E6FB504 "iTSh Version"=196619 "Media Kinds Shared"=1 dmv=131082 Version=196620 "Machine Name"=Ampache Password=0 OSsi=0x10313 "Database ID"=416D7061636865 MID=0xAD12C5B9B9D839F2
|
||||
start dns-sd -R Ampache _dacp._tcp local 3689
|
||||
start dns-sd -R Ampache _touch-able._tcp local 3689 txtvers=1 OSsi=0x10313 CtlN=Ampache Ver=131073 DvSv=2305 DvTy=iTunes DbId=416D7061636865
|
||||
start dns-sd -R Ampache _rsp._tcp local 3689
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -87,7 +87,7 @@ AmpConfig::set_by_array(array(
|
|||
// Install the database
|
||||
if (!install_insert_db($new_db_user, $new_db_pass, true, $force, true)) {
|
||||
echo T_('Database creation failed'), "\n";
|
||||
echo Error::get('general'), "\n\n";
|
||||
echo AmpError::get('general'), "\n\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ AmpConfig::set_by_array(array(
|
|||
// Write the config file
|
||||
if (!install_create_config()) {
|
||||
echo T_('Config file creation failed'), "\n";
|
||||
echo Error::get('general') . "\n\n";
|
||||
echo AmpError::get('general') . "\n\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,35 +2,37 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Use with caution, this hasn't been heavily tested!!!
|
||||
*/
|
||||
|
||||
define('NO_SESSION','1');
|
||||
require_once '../lib/init.php';
|
||||
|
||||
$valid_exts = array ('m3u', 'xspf', 'pls');
|
||||
|
||||
if (!$GLOBALS['argv']['1'] || $GLOBALS['argv']['1'] == '-h') { usage(); }
|
||||
else {
|
||||
$dirname = $GLOBALS['argv']['1'];
|
||||
$type = $GLOBALS['argv']['2'];
|
||||
$ext = $GLOBALS['argv']['3'];
|
||||
if (!$ext || !in_array($ext, $valid_exts)) {
|
||||
$ext = 'm3u';
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the output dir is valid and writeable
|
||||
|
@ -42,35 +44,68 @@ if (!is_writeable($dirname)) {
|
|||
// Switch on the type of playlist dump we want to do
|
||||
// here
|
||||
switch ($type) {
|
||||
case 'playlists':
|
||||
|
||||
case 'albums':
|
||||
$ids = Catalog::get_albums();
|
||||
$items = array();
|
||||
foreach ($ids as $id) {
|
||||
$items[] = new Album($id);
|
||||
}
|
||||
break;
|
||||
case 'artist':
|
||||
|
||||
case 'artists':
|
||||
$items = Catalog::get_artists();
|
||||
break;
|
||||
default:
|
||||
|
||||
$ids = Playlist::get_playlists(false, -1);
|
||||
$items = array();
|
||||
foreach ($ids as $id) {
|
||||
$items[] = new Playlist($id);
|
||||
}
|
||||
break;
|
||||
} // end type switch
|
||||
|
||||
foreach ($items as $item) {
|
||||
$item->format();
|
||||
$name = $item->get_fullname();
|
||||
// We don't know about file system encoding / specificity
|
||||
// For now, we only keep simple characters to be sure it will work everywhere
|
||||
$name = preg_replace('/[:]/', '.', $name);
|
||||
$name = preg_replace('/[^a-zA-Z0-9. -]/', '', $name);
|
||||
$filename = $dirname . DIRECTORY_SEPARATOR . $item->id . '. ' . $name . '.' . $ext;
|
||||
$medias = $item->get_medias();
|
||||
$pl = new Stream_Playlist(-1);
|
||||
$pl->title = $item->get_fullname();
|
||||
foreach ($medias as $media) {
|
||||
$pl->urls[] = Stream_Playlist::media_to_url($media, $dirname, 'file');
|
||||
}
|
||||
|
||||
$plstr = $pl->{'get_' . $ext . '_string'}();
|
||||
if (file_put_contents($filename, $plstr) === false) {
|
||||
echo "Error: cannot write playlist file `" . $filename . "`.\n";
|
||||
} else {
|
||||
echo "Playlist file `" . $filename . "` created.\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "Playlist export completed.\n";
|
||||
|
||||
/* FUNCTIONS */
|
||||
function usage() {
|
||||
$desc1 = T_("This will dump a collection of playlists files based on type");
|
||||
$desc2 = T_("Types:");
|
||||
$desc3 = T_("Dumps all of your Playlists");
|
||||
$desc4 = T_("Dumps all Albums as individual playlists");
|
||||
$desc5 = T_("Dumps all Artists as individual playlists");
|
||||
$desc6 = T_("Extensions: m3u (default), xspf, pls");
|
||||
|
||||
$desc1 = T_("This will dump a collection of m3u playlists based on type");
|
||||
$desc2 = T_("Types:");
|
||||
$desc3 = T_("Dumps all Albums as individual playlists");
|
||||
$desc4 = T_("Dumps all of your Playlists as m3u's");
|
||||
$desc5 = T_("Dumps all Artists as individual playlists");
|
||||
|
||||
$string = "write_playlists.php.inc [-h] <DIRNAME> <TYPE>
|
||||
$string = "write_playlists.php.inc [-h] <DIRNAME> <TYPE> [<EXT>]
|
||||
|
||||
$desc1
|
||||
$desc2
|
||||
default $desc3
|
||||
playlists $desc4
|
||||
artist $desc5\n\n";
|
||||
albums $desc4
|
||||
artists $desc5
|
||||
$desc6\n\n";
|
||||
|
||||
exit($string);
|
||||
|
||||
} // useage
|
||||
} // usage
|
||||
?>
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -57,6 +57,8 @@ switch ($_REQUEST['action']) {
|
|||
case 'personal_video':
|
||||
case 'label':
|
||||
case 'pvmsg':
|
||||
case 'podcast':
|
||||
case 'podcast_episode':
|
||||
$browse->set_type($_REQUEST['action']);
|
||||
$browse->set_simple_browse(true);
|
||||
break;
|
||||
|
@ -83,7 +85,7 @@ switch ($_REQUEST['action']) {
|
|||
//FIXME: This whole thing is ugly, even though it works.
|
||||
$browse->set_sort('count','ASC');
|
||||
// This one's a doozy
|
||||
$browse_type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'song';
|
||||
$browse_type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 'artist';
|
||||
$browse->set_simple_browse(false);
|
||||
$browse->save_objects(Tag::get_tags($browse_type, 0, 'name')); // Should add a pager?
|
||||
$object_ids = $browse->get_saved();
|
||||
|
@ -93,10 +95,10 @@ switch ($_REQUEST['action']) {
|
|||
$browse2 = new Browse();
|
||||
$browse2->set_type($browse_type);
|
||||
$browse2->store();
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_tagcloud.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_tagcloud.inc.php');
|
||||
UI::show_box_bottom();
|
||||
$type = $browse2->get_type();
|
||||
require_once AmpConfig::get('prefix') . '/templates/browse_content.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('browse_content.inc.php');
|
||||
break;
|
||||
case 'artist':
|
||||
$browse->set_filter('catalog',$_SESSION['catalog']);
|
||||
|
@ -202,8 +204,23 @@ switch ($_REQUEST['action']) {
|
|||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
case 'podcast':
|
||||
if (AmpConfig::get('catalog_disable')) {
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
}
|
||||
$browse->set_sort('title','ASC');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
case 'podcast_episode':
|
||||
if (AmpConfig::get('catalog_disable')) {
|
||||
$browse->set_filter('catalog_enabled', '1');
|
||||
}
|
||||
$browse->set_sort('pubdate','DESC');
|
||||
$browse->update_browse_from_session();
|
||||
$browse->show_objects();
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
} // end Switch $action
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -37,7 +37,7 @@ switch ($_REQUEST['action']) {
|
|||
$object = new $type($_REQUEST['id']);
|
||||
if ($object->id) {
|
||||
$object->format();
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_add_channel.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_add_channel.inc.php');
|
||||
}
|
||||
}
|
||||
UI::show_footer();
|
||||
|
@ -56,7 +56,7 @@ switch ($_REQUEST['action']) {
|
|||
$created = Channel::create($_REQUEST['name'], $_REQUEST['description'], $_REQUEST['url'], $_REQUEST['type'], $_REQUEST['id'], $_REQUEST['interface'], $_REQUEST['port'], $_REQUEST['admin_password'], $_REQUEST['private'] ?: 0, $_REQUEST['max_listeners'], $_REQUEST['random'] ?: 0, $_REQUEST['loop'] ?: 0, $_REQUEST['stream_type'], $_REQUEST['bitrate']);
|
||||
|
||||
if (!$created) {
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_add_channel.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_add_channel.inc.php');
|
||||
} else {
|
||||
$title = T_('Channel Created');
|
||||
show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=channel');
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -59,7 +59,7 @@ if ($channel->is_private) {
|
|||
Preference::init();
|
||||
|
||||
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')) {
|
||||
debug_event('UI::access_denied', "Streaming Access Denied: " . $_SERVER['REMOTE_ADDR'] . " does not have stream level access",'3');
|
||||
UI::access_denied();
|
||||
|
|
330
sources/composer.json
Normal file
330
sources/composer.json
Normal file
|
@ -0,0 +1,330 @@
|
|||
{
|
||||
"name": "ampache/ampache",
|
||||
"description": "A web based audio/video streaming application and file manager allowing you to access your music & videos from anywhere, using almost any internet enabled device.",
|
||||
"homepage": "http://ampache.org",
|
||||
"keywords": ["php", "music", "video", "player", "stream"],
|
||||
"type": "project",
|
||||
"license": "AGPL-3.0",
|
||||
"config":
|
||||
{
|
||||
"vendor-dir": "lib/vendor",
|
||||
"component-dir": "lib/components",
|
||||
|
||||
"platform": {
|
||||
"ext-curl": "1.0",
|
||||
"ext-gd": "1.0",
|
||||
"ext-gmp": "1.0",
|
||||
"ext-dom": "1.0",
|
||||
"ext-pcre": "1.0",
|
||||
"ext-spl": "1.0",
|
||||
"ext-simplexml": "1.0",
|
||||
"ext-ctype": "1.0",
|
||||
"ext-date": "1.0",
|
||||
"ext-iconv": "1.0",
|
||||
"ext-libxml": "1.0",
|
||||
"ext-mbstring": "1.0",
|
||||
"ext-xmlwriter": "1.0",
|
||||
"ext-xmlreader": "1.0",
|
||||
"lib-libxml": "2.6.20"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"symfony/process": "~2.1",
|
||||
"wikimedia/composer-merge-plugin": "1.*",
|
||||
|
||||
"doctrine/cache": "1.5.4",
|
||||
"gettext/gettext": "3.5.*",
|
||||
"james-heinrich/getid3": "1.9.*",
|
||||
"mikealmond/musicbrainz": "dev-master",
|
||||
"phpmailer/phpmailer": "5.2.*",
|
||||
"rmccue/requests": "1.6.*",
|
||||
"react/react": "0.4.*",
|
||||
"cboden/ratchet": "0.3.*",
|
||||
"symfony/event-dispatcher": "2.7.*",
|
||||
"symfony/routing": "2.7.*",
|
||||
"symfony/http-foundation": "2.7.*",
|
||||
"szymach/c-pchart": "1.*",
|
||||
"evenement/evenement": "2.*",
|
||||
"happyworm/jplayer": "2.*",
|
||||
"needim/noty": "2.3.*",
|
||||
"openid/php-openid": "2.*",
|
||||
"sabre/dav": "3.0.5",
|
||||
"maennchen/zipstream-php": "0.*",
|
||||
|
||||
"Afterster/php-echonest-api": "dev-master",
|
||||
|
||||
"components/jquery": "2.0.*",
|
||||
"components/jqueryui": "1.*",
|
||||
"vakata/jstree": "3.*",
|
||||
"components/bootstrap": "3.*",
|
||||
"aehlke/tag-it": "2.*",
|
||||
"scaron/prettyphoto": "3.*",
|
||||
"jeromeetienne/jquery-qrcode": "dev-master",
|
||||
"carhartl/jquery-cookie": "1.*",
|
||||
"xdan/datetimepicker": "2.*",
|
||||
"blueimp/jQuery-File-Upload": "9.*",
|
||||
"aterrien/jQuery-Knob": "1.2.*",
|
||||
"pklauzinski/jscroll": "2.*",
|
||||
"kumailht/responsive-elements": "dev-master"
|
||||
},
|
||||
|
||||
"repositories":
|
||||
[
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "Afterster/php-echonest-api",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"url": "https://github.com/Afterster/php-echonest-api.git",
|
||||
"type": "git",
|
||||
"reference": "master"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "jeromeetienne/jquery-qrcode",
|
||||
"type": "component",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"url": "https://github.com/jeromeetienne/jquery-qrcode.git",
|
||||
"type": "git",
|
||||
"reference": "master"
|
||||
},
|
||||
"extra": {
|
||||
"component": {
|
||||
"scripts": [
|
||||
"src/jquery.qrcode.js",
|
||||
"src/qrcode.js"
|
||||
]
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"robloach/component-installer": "*"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "carhartl/jquery-cookie",
|
||||
"type": "component",
|
||||
"version": "1.4.1",
|
||||
"source": {
|
||||
"url": "https://github.com/carhartl/jquery-cookie.git",
|
||||
"type": "git",
|
||||
"reference": "v1.4.1"
|
||||
},
|
||||
"extra": {
|
||||
"component": {
|
||||
"scripts": [
|
||||
"jquery.cookie.js"
|
||||
]
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"robloach/component-installer": "*"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "aehlke/tag-it",
|
||||
"type": "component",
|
||||
"version": "2.0",
|
||||
"source": {
|
||||
"url": "https://github.com/aehlke/tag-it.git",
|
||||
"type": "git",
|
||||
"reference": "v2.0"
|
||||
},
|
||||
"extra": {
|
||||
"component": {
|
||||
"scripts": [
|
||||
"js/tag-it.js"
|
||||
],
|
||||
"styles": [
|
||||
"css/jquery.tagit.css"
|
||||
],
|
||||
"files": [
|
||||
"js/tag-it.min.js"
|
||||
]
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"robloach/component-installer": "*"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "scaron/prettyphoto",
|
||||
"type": "component",
|
||||
"version": "3.1.6",
|
||||
"source": {
|
||||
"url": "https://github.com/scaron/prettyphoto.git",
|
||||
"type": "git",
|
||||
"reference": "3.1.6"
|
||||
},
|
||||
"extra": {
|
||||
"component": {
|
||||
"scripts": [
|
||||
"js/jquery.prettyPhoto.js"
|
||||
],
|
||||
"styles": [
|
||||
"css/prettyPhoto.css"
|
||||
]
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"robloach/component-installer": "*"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "xdan/datetimepicker",
|
||||
"type": "component",
|
||||
"version": "2.4.5",
|
||||
"source": {
|
||||
"url": "https://github.com/xdan/datetimepicker.git",
|
||||
"type": "git",
|
||||
"reference": "2.4.5"
|
||||
},
|
||||
"extra": {
|
||||
"component": {
|
||||
"scripts": [
|
||||
"jquery.datetimepicker.js"
|
||||
],
|
||||
"styles": [
|
||||
"jquery.datetimepicker.css"
|
||||
]
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"robloach/component-installer": "*"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "blueimp/jQuery-File-Upload",
|
||||
"type": "component",
|
||||
"version": "9.11.2",
|
||||
"source": {
|
||||
"url": "https://github.com/blueimp/jQuery-File-Upload.git",
|
||||
"type": "git",
|
||||
"reference": "9.11.2"
|
||||
},
|
||||
"extra": {
|
||||
"component": {
|
||||
"scripts": [
|
||||
"js/jquery.fileupload.js",
|
||||
"js/jquery.iframe-transport.js"
|
||||
]
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"robloach/component-installer": "*"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "aterrien/jQuery-Knob",
|
||||
"type": "component",
|
||||
"version": "1.2.11",
|
||||
"source": {
|
||||
"url": "https://github.com/aterrien/jQuery-Knob.git",
|
||||
"type": "git",
|
||||
"reference": "1.2.11"
|
||||
},
|
||||
"extra": {
|
||||
"component": {
|
||||
"scripts": [
|
||||
"js/jquery.knob.js"
|
||||
]
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"robloach/component-installer": "*"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "pklauzinski/jscroll",
|
||||
"type": "component",
|
||||
"version": "2.3.4",
|
||||
"source": {
|
||||
"url": "https://github.com/pklauzinski/jscroll.git",
|
||||
"type": "git",
|
||||
"reference": "v2.3.4"
|
||||
},
|
||||
"extra": {
|
||||
"component": {
|
||||
"scripts": [
|
||||
"jquery.jscroll.js"
|
||||
],
|
||||
"files": [
|
||||
"jquery.jscroll.min.js"
|
||||
]
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"robloach/component-installer": "*"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"package": {
|
||||
"name": "kumailht/responsive-elements",
|
||||
"type": "component",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"url": "https://github.com/kumailht/responsive-elements.git",
|
||||
"type": "git",
|
||||
"reference": "master"
|
||||
},
|
||||
"extra": {
|
||||
"component": {
|
||||
"scripts": [
|
||||
"responsive-elements.js"
|
||||
]
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"robloach/component-installer": "*"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"extra": {
|
||||
"merge-plugin": {
|
||||
"include": [
|
||||
"modules/catalog/*/composer.module.json",
|
||||
"modules/localplay/*/composer.module.json",
|
||||
"modules/plugins/*/composer.module.json"
|
||||
],
|
||||
"recurse": false,
|
||||
"replace": false,
|
||||
"merge-extra": false
|
||||
}
|
||||
},
|
||||
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Lib\\": "lib/class"
|
||||
}
|
||||
}
|
||||
}
|
3406
sources/composer.lock
generated
Normal file
3406
sources/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,17 +1,17 @@
|
|||
;#<?php exit(); ?>##
|
||||
;###################
|
||||
;#########################################################
|
||||
; General Config #
|
||||
;###################
|
||||
;#########################################################
|
||||
|
||||
; This value is used to detect quickly
|
||||
; if this config file is up to date
|
||||
; this is compared against a value hard-coded
|
||||
; into the init script
|
||||
config_version = 29
|
||||
config_version = 33
|
||||
|
||||
;###################
|
||||
;#########################################################
|
||||
; Path Vars #
|
||||
;###################
|
||||
;#########################################################
|
||||
|
||||
; The public http host of your server.
|
||||
; If not set, retrieved automatically from client request.
|
||||
|
@ -19,6 +19,11 @@ config_version = 29
|
|||
; DEFAULT: ""
|
||||
;http_host = "localhost"
|
||||
|
||||
; The public http port of your server.
|
||||
; If not set, retrieved automatically from client request.
|
||||
; DEFAULT:
|
||||
;http_port = 80
|
||||
|
||||
; The public path to your ampache install
|
||||
; Do not put a trailing / on this path
|
||||
; For example if your site is located at http://localhost
|
||||
|
@ -33,9 +38,10 @@ config_version = 29
|
|||
; DEFAULT: ""
|
||||
;local_web_path = "http://localhost/ampache"
|
||||
|
||||
;##############################
|
||||
; Session and Login Variables #
|
||||
;##############################
|
||||
|
||||
;#########################################################
|
||||
; Database #
|
||||
;#########################################################
|
||||
|
||||
; Hostname of your database
|
||||
; For socket authentication, set the path to socket file (e.g. /var/run/mysqld/mysqld.sock)
|
||||
|
@ -60,6 +66,11 @@ database_username = username
|
|||
; DEFAULT: ""
|
||||
database_password = password
|
||||
|
||||
|
||||
;#########################################################
|
||||
; Session and Security #
|
||||
;#########################################################
|
||||
|
||||
; Cryptographic secret
|
||||
; This MUST BE changed with your own secret key. Ampache-specific, just pick any random string you want.
|
||||
secret_key = "abcdefghijklmnoprqstuvwyz0123456"
|
||||
|
@ -122,43 +133,6 @@ auth_methods = "mysql"
|
|||
; we want to redirect to an SSO provider instead.
|
||||
; logout_redirect = "http://sso.example.com/logout"
|
||||
|
||||
;#####################
|
||||
; Program Settings #
|
||||
;#####################
|
||||
|
||||
; File Pattern
|
||||
; This defines which file types Ampache will attempt to catalog
|
||||
; You can specify any file extension you want in here separating them
|
||||
; with a |
|
||||
; DEFAULT: mp3|mpc|m4p|m4a|aac|ogg|oga|wav|aif|aiff|rm|wma|asf|flac|opus|spx|ra|ape|shn|wv
|
||||
catalog_file_pattern = "mp3|mpc|m4p|m4a|aac|ogg|oga|wav|aif|aiff|rm|wma|asf|flac|opus|spx|ra|ape|shn|wv"
|
||||
|
||||
; Video Pattern
|
||||
; This defines which video file types Ampache will attempt to catalog
|
||||
; You can specify any file extension you want in here seperating them with
|
||||
; a | but ampache may not be able to parse them
|
||||
; DEAFULT: avi|mpg|mpeg|flv|m4v|mp4|webm|mkv|wmv|ogv|mov|divx|m2ts
|
||||
catalog_video_pattern = "avi|mpg|mpeg|flv|m4v|mp4|webm|mkv|wmv|ogv|mov|divx|m2ts"
|
||||
|
||||
; Playlist Pattern
|
||||
; This defines which playlist types Ampache will attempt to catalog
|
||||
; You can specify any file extension you want in here seperating them with
|
||||
; a | but ampache may not be able to parse them
|
||||
; DEFAULT: m3u|pls|asx|xspf
|
||||
catalog_playlist_pattern = "m3u|pls|asx|xspf"
|
||||
|
||||
; Prefix Pattern
|
||||
; This defines which prefix Ampache will ignore when importing tags from
|
||||
; your music. You may add any prefix you want seperating them with a |
|
||||
; DEFAULT: The|An|A|Die|Das|Ein|Eine|Les|Le|La
|
||||
catalog_prefix_pattern = "The|An|A|Die|Das|Ein|Eine|Les|Le|La"
|
||||
|
||||
; Catalog disable
|
||||
; This defines if catalog can be disabled without removing database entries
|
||||
; WARNING: this increase sensibly sql requests and slow down Ampache a lot
|
||||
; DEFAULT: false
|
||||
;catalog_disable = "false"
|
||||
|
||||
; Use Access List
|
||||
; Toggle this on if you want ampache to pay attention to the access list
|
||||
; and only allow streaming/downloading/api-rpc from known hosts api-rpc
|
||||
|
@ -189,6 +163,115 @@ require_localnet_session = "true"
|
|||
; DEFAULT: false
|
||||
;prevent_multiple_logins = "false"
|
||||
|
||||
|
||||
;#########################################################
|
||||
; Metadata #
|
||||
;#########################################################
|
||||
|
||||
; This determines the tag order for all cataloged
|
||||
; music. If none of the listed tags are found then
|
||||
; ampache will randomly use whatever was found.
|
||||
; POSSIBLE VALUES: ape asf avi id3v1 id3v2 lyrics3 matroska mpeg quicktime riff
|
||||
; vorbiscomment
|
||||
; DEFAULT: id3v2 id3v1 vorbiscomment quicktime matroska ape asf avi mpeg riff
|
||||
getid3_tag_order = "id3v2,id3v1,vorbiscomment,quicktime,matroska,ape,asf,avi,mpeg,riff"
|
||||
|
||||
; Determines whether we try to autodetect the encoding for id3v2 tags.
|
||||
; May break valid tags.
|
||||
; DEFAULT: false
|
||||
;getid3_detect_id3v2_encoding = "false"
|
||||
|
||||
; This determines if file metadata should be write back to files
|
||||
; as id3 metadata when updated.
|
||||
; DEFAULT: false
|
||||
;write_id3 = "false"
|
||||
|
||||
; This determines if album art should be write back to files
|
||||
; as id3 metadata when updated.
|
||||
; DEFAULT: false
|
||||
;write_id3_art = "false"
|
||||
|
||||
; This determines the order in which metadata sources are used (and in the
|
||||
; case of plugins, checked)
|
||||
; POSSIBLE VALUES (builtins): filename and getID3
|
||||
; POSSIBLE VALUES (plugins): MusicBrainz,TheAudioDb, plus any others you've installed.
|
||||
; DEFAULT: getID3 filename
|
||||
metadata_order = "getID3,filename"
|
||||
|
||||
; This determines the order in which metadata sources are used (and in the
|
||||
; case of plugins, checked) for video files
|
||||
; POSSIBLE VALUES (builtins): filename and getID3
|
||||
; POSSIBLE VALUES (plugins): Tvdb,Tmdb,Omdb, plus any others you've installed.
|
||||
; DEFAULT: filename getID3
|
||||
metadata_order_video = "filename,getID3"
|
||||
|
||||
; This determines if extended metadata grabbed from external services should be deferred.
|
||||
; If enabled, extended metadata is retrieved when browsing the library item.
|
||||
; If disabled, extended metadata is retrieved at catalog update.
|
||||
; Today, only Artist information (summary, place formed, ...) can be deferred.
|
||||
; DEFAULT: true
|
||||
deferred_ext_metadata = "true"
|
||||
|
||||
; Some taggers use delimiters other than \0 for fields
|
||||
; This list specifies possible delimiters additional to \0
|
||||
; This setting takes a regex pattern.
|
||||
; DEFAULT: // / \ | , ;
|
||||
additional_genre_delimiters = "[/]{2}|[/|\\\\|\|,|;]"
|
||||
|
||||
; Enable importing custom metadata from files.
|
||||
; This will need a bit of time during the import. So you may want to disable this
|
||||
; if you have troubles with huge databases.
|
||||
; DEFAULT: false
|
||||
;enable_custom_metadata = "false"
|
||||
|
||||
|
||||
;#########################################################
|
||||
; Catalog #
|
||||
;#########################################################
|
||||
|
||||
; File Pattern
|
||||
; This defines which file types Ampache will attempt to catalog
|
||||
; You can specify any file extension you want in here separating them
|
||||
; with a |
|
||||
; DEFAULT: mp3|mpc|m4p|m4a|aac|ogg|oga|wav|aif|aiff|rm|wma|asf|flac|opus|spx|ra|ape|shn|wv
|
||||
catalog_file_pattern = "mp3|mpc|m4p|m4a|aac|ogg|oga|wav|aif|aiff|rm|wma|asf|flac|opus|spx|ra|ape|shn|wv"
|
||||
|
||||
; Video Pattern
|
||||
; This defines which video file types Ampache will attempt to catalog
|
||||
; You can specify any file extension you want in here separating them with
|
||||
; a | but ampache may not be able to parse them
|
||||
; DEAFULT: avi|mpg|mpeg|flv|m4v|mp4|webm|mkv|wmv|ogv|mov|divx|m2ts
|
||||
catalog_video_pattern = "avi|mpg|mpeg|flv|m4v|mp4|webm|mkv|wmv|ogv|mov|divx|m2ts"
|
||||
|
||||
; Playlist Pattern
|
||||
; This defines which playlist types Ampache will attempt to catalog
|
||||
; You can specify any file extension you want in here separating them with
|
||||
; a | but ampache may not be able to parse them
|
||||
; DEFAULT: m3u|m3u8|pls|asx|xspf
|
||||
catalog_playlist_pattern = "m3u|m3u8|pls|asx|xspf"
|
||||
|
||||
; Prefix Pattern
|
||||
; This defines which prefix Ampache will ignore when importing tags from
|
||||
; your music. You may add any prefix you want separating them with a |
|
||||
; DEFAULT: The|An|A|Die|Das|Ein|Eine|Les|Le|La
|
||||
catalog_prefix_pattern = "The|An|A|Die|Das|Ein|Eine|Les|Le|La"
|
||||
|
||||
; Catalog disable
|
||||
; This defines if catalog can be disabled without removing database entries
|
||||
; WARNING: this increase sensibly sql requests and slow down Ampache a lot
|
||||
; DEFAULT: false
|
||||
;catalog_disable = "false"
|
||||
|
||||
; Delete from disk
|
||||
; This determines if catalog manager users can delete medias from disk.
|
||||
; DEFAULT: false
|
||||
;delete_from_disk = "false"
|
||||
|
||||
|
||||
;#########################################################
|
||||
; Program Settings #
|
||||
;#########################################################
|
||||
|
||||
; Downsample Remote
|
||||
; If this is set to true and access control is on any users who are not
|
||||
; coming from a defined 'network' ACL will be automatically downsampled
|
||||
|
@ -259,60 +342,6 @@ Allow Zip Types
|
|||
; VALUES: any whole number (in bytes per second)
|
||||
;throttle_download = 10
|
||||
|
||||
; This determines the tag order for all cataloged
|
||||
; music. If none of the listed tags are found then
|
||||
; ampache will randomly use whatever was found.
|
||||
; POSSIBLE VALUES: ape asf avi id3v1 id3v2 lyrics3 matroska mpeg quicktime riff
|
||||
; vorbiscomment
|
||||
; DEFAULT: id3v2 id3v1 vorbiscomment quicktime matroska ape asf avi mpeg riff
|
||||
getid3_tag_order = "id3v2,id3v1,vorbiscomment,quicktime,matroska,ape,asf,avi,mpeg,riff"
|
||||
|
||||
; Determines whether we try to autodetect the encoding for id3v2 tags.
|
||||
; May break valid tags.
|
||||
; DEFAULT: false
|
||||
;getid3_detect_id3v2_encoding = "false"
|
||||
|
||||
; This determines if file metadata should be write back to files
|
||||
; as id3 metadata when updated.
|
||||
; DEFAULT: false
|
||||
;write_id3 = "false"
|
||||
|
||||
; This determines if album art should be write back to files
|
||||
; as id3 metadata when updated.
|
||||
; DEFAULT: false
|
||||
;write_id3_art = "false"
|
||||
|
||||
; This determines if catalog manager users can delete medias from disk.
|
||||
; DEFAULT: false
|
||||
;delete_from_disk = "false"
|
||||
|
||||
; This determines the order in which metadata sources are used (and in the
|
||||
; case of plugins, checked)
|
||||
; POSSIBLE VALUES (builtins): filename and getID3
|
||||
; POSSIBLE VALUES (plugins): MusicBrainz,TheAudioDb, plus any others you've installed.
|
||||
; DEFAULT: getID3 filename
|
||||
metadata_order = "getID3,filename"
|
||||
|
||||
; This determines the order in which metadata sources are used (and in the
|
||||
; case of plugins, checked) for video files
|
||||
; POSSIBLE VALUES (builtins): filename and getID3
|
||||
; POSSIBLE VALUES (plugins): Tvdb,Tmdb,Omdb, plus any others you've installed.
|
||||
; DEFAULT: filename getID3
|
||||
metadata_order_video = "filename,getID3"
|
||||
|
||||
; This determines if extended metadata grabbed from external services should be deferred.
|
||||
; If enabled, extended metadata is retrieved when browsing the library item.
|
||||
; If disabled, extended metadata is retrieved at catalog update.
|
||||
; Today, only Artist information (summary, place formed, ...) can be deferred.
|
||||
; DEFAULT: true
|
||||
deferred_ext_metadata = "true"
|
||||
|
||||
; Some taggers use delimiters other than \0 for fields
|
||||
; This list specifies possible delimiters additional to \0
|
||||
; This setting takes a regex pattern.
|
||||
; DEFAULT: // / \ | , ;
|
||||
additional_genre_delimiters = "[/]{2}|[/|\\\\|\|,|;]"
|
||||
|
||||
; This determines if a preview image should be retrieved from video files
|
||||
; It requires encode_get_image transcode settings.
|
||||
; DEFAULT: false
|
||||
|
@ -477,6 +506,11 @@ art_order = "db,tags,folder,musicbrainz,lastfm,google"
|
|||
; recommendations and metadata.
|
||||
lastfm_api_key = "d5df942424c71b754e54ce1832505ae2"
|
||||
|
||||
; Last.FM API secret
|
||||
; Set this to your Last.FM api secret to actually use Last.FM for
|
||||
; scrobbling.
|
||||
lastfm_api_secret = ""
|
||||
|
||||
; Wanted
|
||||
; Set this to true to enable display missing albums and the
|
||||
; possibility for users to mark it as wanted.
|
||||
|
@ -520,11 +554,48 @@ channel = "true"
|
|||
; DEFAULT: true
|
||||
live_stream = "true"
|
||||
|
||||
; Podcasts
|
||||
; Set this to true to enable podcasts and the
|
||||
; possibility for admins to subscribe to new podcasts.
|
||||
; DEFAULT: false
|
||||
;podcast = "false"
|
||||
|
||||
; Web Socket address
|
||||
; Declare the web socket server address
|
||||
; DEFAULT: determined automatically
|
||||
;websocket_address = "ws://localhost:8100"
|
||||
|
||||
; Refresh Limit
|
||||
; This defines the default refresh limit in seconds for
|
||||
; pages with dynamic content, such as now playing
|
||||
; DEFAULT: 60
|
||||
; Possible Values: Int > 5
|
||||
refresh_limit = "60"
|
||||
|
||||
; Footer Statistics
|
||||
; This defines whether statistics (Queries, Cache Hits, Load Time)
|
||||
; are shown in the page footer.
|
||||
; DEFAULT: true
|
||||
; Possible values: true, false
|
||||
show_footer_statistics = "true"
|
||||
|
||||
; RSS Feeds
|
||||
; Set this to true to enable rss feeds.
|
||||
; (latest albums, shouts, albums of artist, ...)
|
||||
; use_rss = false (values true | false)
|
||||
;DEFAULT: use_rss = false
|
||||
;use_rss = "false"
|
||||
|
||||
; This setting allows themes to overwrite PHP template files. This can be really
|
||||
; dangerous. Do this only if you trust every theme in your themes/ directory.
|
||||
; DEFAULT: false
|
||||
;allow_php_themes = "false"
|
||||
|
||||
|
||||
;#########################################################
|
||||
; Debugging #
|
||||
;#########################################################
|
||||
|
||||
; Debug
|
||||
; If this is enabled Ampache will write debugging information to the log file
|
||||
; DEFAULT: false
|
||||
|
@ -548,15 +619,20 @@ debug_level = 5
|
|||
; include trailing slash. You will need to make sure that
|
||||
; the specified directory exists and your HTTP server has
|
||||
; write access.
|
||||
; DEFAULT: NULL
|
||||
; DEFAULT: none
|
||||
;log_path = "/var/log/ampache"
|
||||
|
||||
; Log filename pattern
|
||||
; This defines where the log file name pattern.
|
||||
; This defines where the log file name pattern
|
||||
; %name.%Y%m%d.log will create a different log file every day.
|
||||
; DEFAULT: %name.%Y%m%d.log
|
||||
log_filename = "%name.%Y%m%d.log"
|
||||
|
||||
|
||||
;#########################################################
|
||||
; Encoding Settings #
|
||||
;#########################################################
|
||||
|
||||
; Charset of generated HTML pages
|
||||
; Default of UTF-8 should work for most people
|
||||
; DEFAULT: UTF-8
|
||||
|
@ -570,19 +646,13 @@ site_charset = UTF-8
|
|||
; DEFAULT: ISO8859-1
|
||||
;lc_charset = "ISO8859-1"
|
||||
|
||||
; Refresh Limit
|
||||
; This defines the default refresh limit in seconds for
|
||||
; pages with dynamic content, such as now playing
|
||||
; DEFAULT: 60
|
||||
; Possible Values: Int > 5
|
||||
refresh_limit = "60"
|
||||
; Multibyte
|
||||
; See http://php.net/manual/mbstring.supported-encodings.php
|
||||
; If you want ID3v1 encoding detection to work, you should uncomment this line
|
||||
; so that the ordering is sane.
|
||||
; DEFAULT: auto
|
||||
;mb_detect_order = "ASCII,UTF-8,EUC-JP,ISO-2022-JP,SJIS,JIS"
|
||||
|
||||
; Footer Statistics
|
||||
; This defines whether statistics (Queries, Cache Hits, Load Time)
|
||||
; are shown in the page footer.
|
||||
; DEFAULT: true
|
||||
; Possible values: true, false
|
||||
show_footer_statistics = "true"
|
||||
|
||||
;#########################################################
|
||||
; Custom actions (optional) #
|
||||
|
@ -605,6 +675,7 @@ show_footer_statistics = "true"
|
|||
;custom_play_action_icon_0 = "microphone"
|
||||
;custom_play_action_run_0 = "sox \"%f\" -p oops | ffmpeg -i pipe:0 -f %c pipe:1"
|
||||
|
||||
|
||||
;#########################################################
|
||||
; LDAP login info (optional) #
|
||||
;#########################################################
|
||||
|
@ -612,7 +683,7 @@ show_footer_statistics = "true"
|
|||
; LDAP filter string to use (required)
|
||||
; For OpenLDAP use "uid"
|
||||
; For Microsoft Active Directory (MAD) use "sAMAccountName"
|
||||
; DEFAULT: null
|
||||
; DEFAULT: none
|
||||
;ldap_filter = "(sAMAccountName=%v)"
|
||||
|
||||
; LDAP objectclass (required)
|
||||
|
@ -622,38 +693,40 @@ show_footer_statistics = "true"
|
|||
;ldap_objectclass = "organizationalPerson"
|
||||
|
||||
; Initial credentials to bind with for searching (optional)
|
||||
; DEFAULT: null
|
||||
; DEFAULT: none
|
||||
;ldap_username = ""
|
||||
;ldap_password = ""
|
||||
|
||||
; Require that the user is in a specific group (optional)
|
||||
; DEFAULT: null
|
||||
; DEFAULT: none
|
||||
;ldap_require_group = "cn=yourgroup,ou=yourorg,dc=yoursubdomain,dc=yourdomain,dc=yourtld"
|
||||
|
||||
; This is the search dn used to find users (required)
|
||||
; DEFAULT: null
|
||||
; DEFAULT: none
|
||||
;ldap_search_dn = "ou=People,dc=yoursubdomain,dc=yourdomain,dc=yourtld"
|
||||
|
||||
; This is the address of your ldap server (required)
|
||||
; DEFAULT: null
|
||||
; DEFAULT: none
|
||||
;ldap_url = ""
|
||||
|
||||
; Attributes where additional user information is stored (optional)
|
||||
; OpenLDAP ldap_name_field = "cn"
|
||||
; MAD ldap_name_field = "displayname"
|
||||
; DEFAULT: null
|
||||
; DEFAULT: none
|
||||
;ldap_email_field = "mail"
|
||||
;ldap_name_field = "cn"
|
||||
|
||||
|
||||
;#########################################################
|
||||
; OpenID login info (optional) #
|
||||
;#########################################################
|
||||
|
||||
; Requires specific OpenID Provider Authentication Policy
|
||||
; DEFAULT: null
|
||||
; DEFAULT: none
|
||||
; VALUES: PAPE_AUTH_MULTI_FACTOR_PHYSICAL,PAPE_AUTH_MULTI_FACTOR,PAPE_AUTH_PHISHING_RESISTANT
|
||||
;openid_required_pape = ""
|
||||
|
||||
|
||||
;#########################################################
|
||||
; Public Registration settings, defaults to disabled #
|
||||
;#########################################################
|
||||
|
@ -725,6 +798,7 @@ registration_display_fields = "fullname,website"
|
|||
; DEFAULT: fullname
|
||||
registration_mandatory_fields = "fullname"
|
||||
|
||||
|
||||
;########################################################
|
||||
; These options control the dynamic downsampling based #
|
||||
; on current usage #
|
||||
|
@ -823,7 +897,7 @@ transcode_player_customize = "true"
|
|||
|
||||
; Command configuration. Substitutions will be made as follows:
|
||||
; %FILE% => filename
|
||||
; %SAMPLE% => target sample rate
|
||||
; %BITRATE% => target bit rate
|
||||
; You can do fancy things like VBR, but consider whether the consequences are
|
||||
; acceptable in your environment.
|
||||
|
||||
|
@ -852,11 +926,11 @@ transcode_input = "-i %FILE%"
|
|||
; For each output format, you should provide the necessary arguments for
|
||||
; your transcode_cmd.
|
||||
; encode_args_TYPE = TRANSCODE_CMD_ARGS
|
||||
encode_args_mp3 = "-vn -b:a %SAMPLE%K -c:a libmp3lame -f mp3 pipe:1"
|
||||
encode_args_ogg = "-vn -b:a %SAMPLE%K -c:a libvorbis -f ogg pipe:1"
|
||||
encode_args_m4a = "-vn -b:a %SAMPLE%K -c:a libfdk_aac -f adts pipe:1"
|
||||
encode_args_wav = "-vn -b:a %SAMPLE%K -c:a pcm_s16le -f wav pipe:1"
|
||||
encode_args_flv = "-b:a %SAMPLE%K -ar 44100 -ac 2 -v 0 -f flv -c:v libx264 -preset superfast -threads 0 pipe:1"
|
||||
encode_args_mp3 = "-vn -b:a %BITRATE%K -c:a libmp3lame -f mp3 pipe:1"
|
||||
encode_args_ogg = "-vn -b:a %BITRATE%K -c:a libvorbis -f ogg pipe:1"
|
||||
encode_args_m4a = "-vn -b:a %BITRATE%K -c:a libfdk_aac -f adts pipe:1"
|
||||
encode_args_wav = "-vn -b:a %BITRATE%K -c:a pcm_s16le -f wav pipe:1"
|
||||
encode_args_flv = "-b:a %BITRATE%K -ar 44100 -ac 2 -v 0 -f flv -c:v libx264 -preset superfast -threads 0 pipe:1"
|
||||
encode_args_webm = "-q %QUALITY% -f webm -c:v libvpx -maxrate %MAXBITRATE%k -preset superfast -threads 0 pipe:1"
|
||||
encode_args_ts = "-q %QUALITY% -s %RESOLUTION% -f mpegts -c:v libx264 -c:a libmp3lame -maxrate %MAXBITRATE%k -preset superfast -threads 0 pipe:1"
|
||||
|
||||
|
@ -873,18 +947,10 @@ encode_ss_frame = "-ss %TIME%"
|
|||
encode_ss_duration = "-t %DURATION%"
|
||||
|
||||
|
||||
;######################################################
|
||||
; these options allow you to configure your rss-feed
|
||||
; layout. rss exists of two parts, main and song main is the information about the feed
|
||||
; song is the information in the feed. can be multiple items.
|
||||
; use_rss = false (values true | false)
|
||||
;DEFAULT: use_rss = false
|
||||
;use_rss = "false"
|
||||
;#####################################################
|
||||
|
||||
;#############################
|
||||
;#########################################################
|
||||
; Proxy Settings (optional) #
|
||||
;#############################
|
||||
;#########################################################
|
||||
|
||||
; If Ampache is behind an http proxy, specifiy the hostname or IP address
|
||||
; port, proxyusername, and proxypassword here.
|
||||
;DEFAULT: not in use
|
||||
|
@ -897,9 +963,10 @@ encode_ss_duration = "-t %DURATION%"
|
|||
;Default: false
|
||||
;force_ssl = "true"
|
||||
|
||||
;#############################
|
||||
|
||||
;#########################################################
|
||||
; Mail Settings #
|
||||
;#############################
|
||||
;#########################################################
|
||||
|
||||
;Method used to send mail
|
||||
;POSSIBLE VALUES: smtp sendmail php
|
||||
|
@ -928,16 +995,17 @@ encode_ss_duration = "-t %DURATION%"
|
|||
;mail_check = "strict"
|
||||
|
||||
|
||||
;############################
|
||||
;#########################################################
|
||||
; sendmail Settings #
|
||||
;############################
|
||||
;#########################################################
|
||||
|
||||
;DEFAULT: /usr/sbin/sendmail
|
||||
;sendmail_path = "/usr/sbin/sendmail"
|
||||
|
||||
;#############################
|
||||
|
||||
;#########################################################
|
||||
; SMTP Settings #
|
||||
;#############################
|
||||
;#########################################################
|
||||
|
||||
;Mail server (hostname or IP address)
|
||||
;DEFAULT: localhost
|
||||
|
@ -965,10 +1033,8 @@ encode_ss_duration = "-t %DURATION%"
|
|||
;mail_auth_pass = ""
|
||||
|
||||
;#############################
|
||||
; Multibyte Settings #
|
||||
; Abbreviation Filter #
|
||||
;#############################
|
||||
; See http://php.net/manual/mbstring.supported-encodings.php
|
||||
; If you want ID3v1 encoding detection to work, you should uncomment this line
|
||||
; so that the ordering is sane.
|
||||
; DEFAULT: auto
|
||||
;mb_detect_order = "ASCII,UTF-8,EUC-JP,ISO-2022-JP,SJIS,JIS"
|
||||
; For file name parsing. Any unecessary abbreviations in file names can be removed during parsing
|
||||
; by adding them to the list below so that they will be removed during the parsing process.
|
||||
common_abbr = "divx,xvid,dvdrip,hdtv,lol,axxo,repack,xor,pdtv,real,vtv,caph,2hd,proper,fqm,uncut,topaz,tvt,notv,fpn,fov,orenji,0tv,omicron,dsr,ws,sys,crimson,wat,hiqt,internal,brrip,boheme,vost,vostfr,fastsub,addiction,x264,LOL,720p,1080p,YIFY,evolve,fihtv,first,bokutox,bluray,tvboom,info"
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -24,6 +24,6 @@ require_once 'lib/init.php';
|
|||
|
||||
UI::show_header();
|
||||
|
||||
require_once AmpConfig::get('prefix') . '/templates/cookie_disclaimer.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('cookie_disclaimer.inc.php');
|
||||
|
||||
UI::show_footer();
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -34,7 +34,7 @@ $headers = apache_request_headers();
|
|||
//$daapAccessIndex = $headers['Client-DAAP-Access-Index'];
|
||||
//$daapVersion = $headers['Client-DAAP-Version'];
|
||||
//$daapValidation = $headers['Client-DAAP-Validation']; // That's header hash, we don't care about it (only required by iTunes >= 7.0)
|
||||
debug_event('daap', 'Request headers: '. print_r($headers, true), '5');
|
||||
debug_event('daap', 'Request headers: ' . print_r($headers, true), '5');
|
||||
|
||||
// Get the list of possible methods for the Plex API
|
||||
$methods = get_class_methods('daap_api');
|
||||
|
@ -50,7 +50,9 @@ if (count($params) > 0) {
|
|||
$act = strtolower(implode('_', array_slice($params, 0, $i)));
|
||||
$act = str_replace("-", "_", $act);
|
||||
foreach ($methods as $method) {
|
||||
if (in_array($method, $internal_functions)) { continue; }
|
||||
if (in_array($method, $internal_functions)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the method is the same as the action being called
|
||||
// Then let's call this function!
|
||||
|
@ -59,7 +61,6 @@ if (count($params) > 0) {
|
|||
// We only allow a single function to be called, and we assume it's cleaned up!
|
||||
exit();
|
||||
}
|
||||
|
||||
} // end foreach methods in API
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -43,7 +43,7 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
|
||||
// Show the create page
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_create_democratic.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_create_democratic.inc.php');
|
||||
break;
|
||||
case 'delete':
|
||||
if (!Access::check('interface','75')) {
|
||||
|
@ -96,20 +96,20 @@ switch ($_REQUEST['action']) {
|
|||
// Get all of the non-user playlists
|
||||
$playlists = Democratic::get_playlists();
|
||||
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_manage_democratic.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_manage_democratic.inc.php');
|
||||
|
||||
break;
|
||||
case 'show_playlist':
|
||||
default:
|
||||
$democratic = Democratic::get_current_playlist();
|
||||
if (!$democratic->id) {
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_democratic.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_democratic.inc.php');
|
||||
break;
|
||||
}
|
||||
|
||||
$democratic->set_parent();
|
||||
$democratic->format();
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_democratic.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_democratic.inc.php');
|
||||
$objects = $democratic->get_items();
|
||||
Song::build_cache($democratic->object_ids);
|
||||
Democratic::build_vote_cache($democratic->vote_ids);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
|
@ -7,17 +7,15 @@
|
|||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
|
@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you
|
|||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
@ -72,7 +60,7 @@ modification follow.
|
|||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey
|
|||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
|
@ -635,40 +633,29 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
@ -1,6 +1,98 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
3.8.2
|
||||
----------
|
||||
- Fixed potential security vulnerability on smartplaylist search rule and catalog management actions (thanks Roman Ammann)
|
||||
- Fixed song comparison issue on arrays (genre ...) when updating from tag
|
||||
- Fixed song insertion issue if track year is out of range
|
||||
- Fixed unexpected artist summary autoupdate
|
||||
- Improved generated playlist filename (thanks yam655)
|
||||
- Fixed user avatar upload (thanks vader083)
|
||||
- Fixed waveform temporary file deletion issue if GD library is unavailable
|
||||
- Fixed max number of items returned from Subsonic getStarred.view (thanks zerodogg)
|
||||
- Fixed video update from tags (thanks stebe)
|
||||
- Reverted PHP 5.5.9 dependency to PHP 5.4
|
||||
- Added video playlist support (thanks SurvivalHive)
|
||||
- Added preference subcategory
|
||||
- Added prompt for new playlist name
|
||||
- Fixed page refresh when canceling album art change (thanks EvilLivesHere)
|
||||
- Added /play htaccess rewrite rule to avoid default max limit redirection
|
||||
- Fixed Subsonic artist/album/song name JSON parsing if the name is numeric only
|
||||
- Added ignored articles and cover art to Subsonic getArtists.view function
|
||||
- Fixed MySQL requests to support ONLY_FULL_GROUP_BY mode
|
||||
- Fixed Ajax art refresh after changing it (thanks gnujeremie)
|
||||
- Fixed playlist creation from smartplaylist (thanks stebe)
|
||||
- Added SQL unique constraint on tag map
|
||||
- Fixed Subsonic genres with JSON format
|
||||
- Added Bookmarks feature on Subsonic API
|
||||
- Fixed thumb art regeneration if entry found in database without data (thanks s4astliv)
|
||||
- Added Podcast feature
|
||||
- Added large view / grid view option on artist and albums collection
|
||||
- Moved from php-gettext to oscarotero/Gettext
|
||||
- Added `Access-Control-Allow-Origin: *` header on Subsonic images & streams
|
||||
- Fixed Subsonic item identifier parsing
|
||||
- Added logic for external plugin directories (ampache-*)
|
||||
- Added Discogs metadata plugin
|
||||
|
||||
3.8.1
|
||||
----------
|
||||
- Fixed PHP7 Error class conflict (thanks trampi)
|
||||
- Fixed user password with special characters at install time (thanks jagerman)
|
||||
- Moved Ampache project license from GPLv2 to AGPLv3
|
||||
- Added Ampache specific information on Subsonic API getAlbum using a new `ampache` parameter (thanks nicklan)
|
||||
- Added 'album tag' option in song search (thanks DanielMaly)
|
||||
- Added Message of the Day plugin to display MOTD at home page
|
||||
- Moved AmpacheApi class to a separate ampacheapi-php git repository
|
||||
- Added timeline / friends timeline feature
|
||||
- Fixed disabled song display to regular users (thanks shangril)
|
||||
- Fixed random albums art size (thanks Bidules079)
|
||||
- Moved tag cloud to artist browsing by default
|
||||
- Fixed utf8 BOM empty string on song comparison
|
||||
- Improved recently played and user stats queries performance (thanks thinca)
|
||||
- Renamed SAMPLE_RATE to TRANSCODE_BITRATE on transcoding
|
||||
- Fixed tag deletion sql error (thanks stebe)
|
||||
- Moved to PNG default blank image instead of JPG (thanks Psy-Virus)
|
||||
- Fixed temporary playlist initial position when scrolling down (thanks RobertoCarlo)
|
||||
- Added Radio stations to UPnP backend
|
||||
- Fixed Subsonic API art to use album art if song doesn't have a custom art (thanks hypfvieh)
|
||||
- Fixed Subsonic API search when object count parameter is 0 (thanks hypfvieh)
|
||||
- Fixed UPnP UUID to be based on host information
|
||||
- Moved to Composer for dependencies management
|
||||
- Fixed catalog action when not using Ajax page loading (thanks Razrael)
|
||||
- Fixed unrated song default value (thanks Combustible)
|
||||
- Added custom metadata support from files (thanks Razrael)
|
||||
- Improved Subsonic API getArtists performance (thanks nicklan)
|
||||
- Fixed theme color setting behavior
|
||||
- Moved audioscrobbler API to v2
|
||||
- Added m3u8 playlist import
|
||||
- Fixed utf8 id3v2 comments support
|
||||
- Added write_playlists script to export playlists to file
|
||||
- Fixed Tvdb and Tmdb plugins (thanks wagnered)
|
||||
- Improved Video filename parsing (thanks wagnered)
|
||||
- Fixed non scalar settings value printing on debug page
|
||||
- Improved Subsonic API getAlbumList error handling
|
||||
- Fixed user login with browser used during the installation
|
||||
- Fixed iTunes 12 browsing when using DAAP (thanks Chattaway83)
|
||||
- Moved http_port user preference to ampache.cfg.php
|
||||
- Upgraded last.fm and libre.fm scrobbling to latest API version (thanks nioc)
|
||||
- Added missing space between track and album in localplay playlist (thanks arnaudbey)
|
||||
- Added check fo mbstring.func_overload support before using id3 write functionality (thanks anonymous2ch)
|
||||
- Fixed file size calculation when using id3v2 tag (thanks hypfvieh)
|
||||
- Added rating from id3 tag (thanks nioc)
|
||||
- Added track number on streaming playlist (thanks Fondor1)
|
||||
- Fixed catalog export (thanks shellshocker)
|
||||
- Fixed file change detection
|
||||
- Improved XML API with more information and new functions (advanced_search, toggle_follow, last_shouts, rate, timeline, friends_timeline)
|
||||
- Fixed 'Next' button when browsing start offset is aligned to offset limit (thanks wagnered)
|
||||
- Fixed stream kill OS detection (thanks nan4k7)
|
||||
- Fixed calculate_art_size script to support storage on disk (thanks nan4k7)
|
||||
- Fixed sql script semicolon typo (thanks jack)
|
||||
- Added support for .opus files (thanks mrpi)
|
||||
- Fixed podcast owner xml information
|
||||
- Fixed ldap filter parameter check (thanks ChrGeiss)
|
||||
- Fixed 'Add to existing playlist' link for regular users (thanks Niols)
|
||||
|
||||
3.8.0
|
||||
----------
|
||||
- Added Portuguese (Brasil) language (thanks Ione Souza Junior)
|
||||
|
|
|
@ -1,280 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
^L
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
-------------------------------------------------------------------------------
|
||||
----------------- PLUGINS - Ampache v.3.6 ----------------------
|
||||
----------------- PLUGINS - Ampache v.3.8.1 ----------------------
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Plugins are placed in modules/plugins; the name of the file must be
|
||||
<Name>.plugin.php, e.g. Dummy.plugin.php. The file must declare a
|
||||
<Name>/<Name>.plugin.php, e.g. Dummay/Dummy.plugin.php. The file must declare a
|
||||
corresponding class and the name of the class must be prefixed with
|
||||
Ampache, e.g. AmpacheDummy.
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -41,7 +41,9 @@ if (AmpConfig::get('use_auth') && AmpConfig::get('require_session')) {
|
|||
}
|
||||
|
||||
// If we aren't resizing just trash thumb
|
||||
if (!AmpConfig::get('resize_images')) { $_GET['thumb'] = null; }
|
||||
if (!AmpConfig::get('resize_images')) {
|
||||
$_GET['thumb'] = null;
|
||||
}
|
||||
|
||||
// FIXME: Legacy stuff - should be removed after a version or so
|
||||
if (!isset($_GET['object_type'])) {
|
||||
|
@ -49,8 +51,9 @@ if (!isset($_GET['object_type'])) {
|
|||
}
|
||||
|
||||
$type = $_GET['object_type'];
|
||||
if (!Core::is_library_item($type))
|
||||
if (!Art::is_valid_type($type)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Decide what size this image is */
|
||||
$size = Art::get_thumb_size($_GET['thumb']);
|
||||
|
@ -65,7 +68,7 @@ if (isset($_GET['type'])) {
|
|||
switch ($_GET['type']) {
|
||||
case 'popup':
|
||||
$typeManaged = true;
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_big_art.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_big_art.inc.php');
|
||||
break;
|
||||
case 'session':
|
||||
// If we need to pull the data out of the session
|
||||
|
@ -110,8 +113,8 @@ if (!$typeManaged) {
|
|||
$defaultimg .= "blankmovie.png";
|
||||
break;
|
||||
default:
|
||||
$mime = 'image/jpeg';
|
||||
$defaultimg .= "blankalbum.jpg";
|
||||
$mime = 'image/png';
|
||||
$defaultimg .= "blankalbum.png";
|
||||
break;
|
||||
}
|
||||
$image = file_get_contents($defaultimg);
|
||||
|
@ -135,8 +138,9 @@ if (!empty($image)) {
|
|||
if (!empty($etag)) {
|
||||
header('ETag: ' . $etag);
|
||||
header('Cache-Control: private');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s \G\M\T', time()));
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', time()));
|
||||
}
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
$browser->downloadHeaders($filename, $mime, true);
|
||||
echo $image;
|
||||
}
|
||||
|
|
BIN
sources/images/background.light.png
Normal file
BIN
sources/images/background.light.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.8 KiB |
BIN
sources/images/blankalbum.png
Normal file
BIN
sources/images/blankalbum.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -39,9 +39,9 @@ $_SESSION['catalog'] = 0;
|
|||
if (AmpConfig::get('refresh_limit') > 5 && AmpConfig::get('home_now_playing')) {
|
||||
$refresh_limit = AmpConfig::get('refresh_limit');
|
||||
$ajax_url = '?page=index&action=reloadnp';
|
||||
require_once AmpConfig::get('prefix') . '/templates/javascript_refresh.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('javascript_refresh.inc.php');
|
||||
}
|
||||
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_index.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_index.inc.php');
|
||||
|
||||
UI::show_footer();
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -29,7 +29,7 @@ set_error_handler('ampache_error_handler');
|
|||
// Redirect if installation is already complete.
|
||||
if (!install_check_status($configfile)) {
|
||||
$redirect_url = 'login.php';
|
||||
require_once AmpConfig::get('prefix') . '/templates/error_page.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('error_page.inc.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ switch ($_REQUEST['action']) {
|
|||
$new_pass = $_POST['db_password'];
|
||||
|
||||
if (!strlen($new_user) || !strlen($new_pass)) {
|
||||
Error::add('general', T_('Error: Ampache SQL Username or Password missing'));
|
||||
AmpError::add('general', T_('Error: Ampache SQL Username or Password missing'));
|
||||
require_once 'templates/show_install.inc.php';
|
||||
break;
|
||||
}
|
||||
|
@ -166,18 +166,20 @@ switch ($_REQUEST['action']) {
|
|||
}
|
||||
case 'show_create_account':
|
||||
$results = parse_ini_file($configfile);
|
||||
if (!isset($created_config)) $created_config = true;
|
||||
if (!isset($created_config)) {
|
||||
$created_config = true;
|
||||
}
|
||||
|
||||
/* Make sure we've got a valid config file */
|
||||
if (!check_config_values($results) || !$created_config) {
|
||||
Error::add('general', T_('Error: Config files not found or unreadable'));
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_install_config.inc.php';
|
||||
AmpError::add('general', T_('Error: Config files not found or unreadable'));
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_install_config.inc.php');
|
||||
break;
|
||||
}
|
||||
|
||||
// Don't try to add administrator user on existing database
|
||||
if (install_check_status($configfile)) {
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_install_account.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_install_account.inc.php');
|
||||
} else {
|
||||
header ("Location: " . $web_path . '/login.php');
|
||||
}
|
||||
|
@ -186,19 +188,13 @@ switch ($_REQUEST['action']) {
|
|||
$results = parse_ini_file($configfile);
|
||||
AmpConfig::set_by_array($results, true);
|
||||
|
||||
$password2 = scrub_in($_REQUEST['local_pass2']);
|
||||
$password2 = $_REQUEST['local_pass2'];
|
||||
|
||||
if (!install_create_account($username, $password, $password2)) {
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_install_account.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_install_account.inc.php');
|
||||
break;
|
||||
}
|
||||
|
||||
// Automatically log-in the newly created user
|
||||
Session::create_cookie();
|
||||
Session::create(array('type' => 'mysql', 'username' => $username));
|
||||
$_SESSION['userdata']['username'] = $username;
|
||||
Session::check();
|
||||
|
||||
header ("Location: " . $web_path . '/index.php');
|
||||
break;
|
||||
case 'init':
|
||||
|
@ -212,3 +208,4 @@ switch ($_REQUEST['action']) {
|
|||
require_once 'templates/show_install_lang.inc.php';
|
||||
break;
|
||||
} // end action switch
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -27,19 +27,23 @@ UI::show_header();
|
|||
// Switch on the incomming action
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'delete':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$label_id = scrub_in($_REQUEST['label_id']);
|
||||
show_confirmation(
|
||||
T_('Label Deletion'),
|
||||
T_('Are you sure you want to permanently delete this label?'),
|
||||
AmpConfig::get('web_path')."/labels.php?action=confirm_delete&label_id=" . $label_id,
|
||||
AmpConfig::get('web_path') . "/labels.php?action=confirm_delete&label_id=" . $label_id,
|
||||
1,
|
||||
'delete_label'
|
||||
);
|
||||
break;
|
||||
case 'confirm_delete':
|
||||
if (AmpConfig::get('demo_mode')) { break; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$label = new Label($_REQUEST['label_id']);
|
||||
if (!Catalog::can_remove($label)) {
|
||||
|
@ -76,7 +80,7 @@ switch ($_REQUEST['action']) {
|
|||
|
||||
$label_id = Label::create($_POST);
|
||||
if (!$label_id) {
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_add_label.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_add_label.inc.php');
|
||||
} else {
|
||||
$body = T_('Label Added');
|
||||
$title = '';
|
||||
|
@ -95,13 +99,13 @@ switch ($_REQUEST['action']) {
|
|||
$label->format();
|
||||
$object_ids = $label->get_artists();
|
||||
$object_type = 'artist';
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_label.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_label.inc.php');
|
||||
UI::show_footer();
|
||||
exit;
|
||||
}
|
||||
case 'show_add_label':
|
||||
if (Access::check('interface','50') || AmpConfig::get('upload_allow_edit')) {
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_add_label.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_add_label.inc.php');
|
||||
} else {
|
||||
echo T_('Label cannot be found.');
|
||||
}
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
# Apache 2.4
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all denied
|
||||
<FilesMatch "\.css$|\.js$|\.png$|\.gif$|\.jpg$|\.swf$|\.ttf$|\.json$|\.xml$|\.htc$|\.map$|\.woff$">
|
||||
Require all granted
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
|
||||
# Apache 2.2
|
||||
<IfModule mod_access.c>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
<Files ~ "\.css$|\.js$|\.png$|\.gif$|\.jpg$|\.swf$|\.ttf$|\.json$|\.xml$|\.htc$|\.map$|\.woff$">
|
||||
Allow from all
|
||||
</Files>
|
||||
</IfModule>
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -77,7 +77,10 @@ function get_media_files($media_ids)
|
|||
function send_zip($name, $media_files)
|
||||
{
|
||||
/* Require needed library */
|
||||
require_once AmpConfig::get('prefix') . '/modules/ZipStream/ZipStream.php';
|
||||
if (!@include_once(AmpConfig::get('prefix') . '/lib/vendor/maennchen/zipstream-php/src/ZipStream.php')) {
|
||||
throw new Exception('Missing ZipStream dependency.');
|
||||
}
|
||||
|
||||
$arc = new ZipStream\ZipStream($name . ".zip" );
|
||||
$options = array(
|
||||
'comment' => AmpConfig::get('file_zip_comment'),
|
||||
|
|
117
sources/lib/class/DatabaseObject.php
Normal file
117
sources/lib/class/DatabaseObject.php
Normal file
|
@ -0,0 +1,117 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Lib;
|
||||
|
||||
/**
|
||||
* Description of Model
|
||||
*
|
||||
* @author raziel
|
||||
*/
|
||||
abstract class DatabaseObject
|
||||
{
|
||||
protected $id;
|
||||
//private $originalData;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array Stores relation between SQL field name and class name so we
|
||||
* can initialize objects the right way
|
||||
*/
|
||||
protected $fieldClassRelations = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->remapCamelcase();
|
||||
$this->initializeChildObjects();
|
||||
//$this->originalData = get_object_vars($this);
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
protected function isPropertyDirty($property)
|
||||
{
|
||||
return $this->originalData->$property !== $this->$property;
|
||||
}
|
||||
|
||||
public function isDirty()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all changed properties
|
||||
* TODO: we get all properties for now...need more logic here...
|
||||
* @return array
|
||||
*/
|
||||
public function getDirtyProperties()
|
||||
{
|
||||
$properties = get_object_vars($this);
|
||||
unset($properties['id']);
|
||||
unset($properties['fieldClassRelations']);
|
||||
return $this->fromCamelCase($properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the object properties to camelCase.
|
||||
* This works in constructor because the properties are here from
|
||||
* fetch_object before the constructor get called.
|
||||
*/
|
||||
protected function remapCamelcase()
|
||||
{
|
||||
foreach (get_object_vars($this) as $key => $val) {
|
||||
if (strpos($key, '_') !== false) {
|
||||
$camelCaseKey = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $key))));
|
||||
$this->$camelCaseKey = $val;
|
||||
unset($this->$key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function fromCamelCase($properties)
|
||||
{
|
||||
$data = array();
|
||||
foreach ($properties as $propertie => $value) {
|
||||
$newPropertyKey = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $propertie));
|
||||
$data[$newPropertyKey] = $value;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds child Objects based of the Model Information
|
||||
* TODO: Someday we might need lazy loading, but for now it should be ok.
|
||||
*/
|
||||
public function initializeChildObjects()
|
||||
{
|
||||
foreach ($this->fieldClassRelations as $field => $repositoryName) {
|
||||
if (class_exists($repositoryName)) {
|
||||
/* @var $repository Repository */
|
||||
$repository = new $repositoryName;
|
||||
$this->$field = $repository->findById($this->$field);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
sources/lib/class/Interfaces/Model.php
Normal file
37
sources/lib/class/Interfaces/Model.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Lib\Interfaces;
|
||||
|
||||
/**
|
||||
* Description of Model
|
||||
*
|
||||
* @author raziel
|
||||
*/
|
||||
interface Model
|
||||
{
|
||||
/**
|
||||
* Get ID of Database Object
|
||||
*/
|
||||
public function getId();
|
||||
}
|
176
sources/lib/class/Metadata/Metadata.php
Normal file
176
sources/lib/class/Metadata/Metadata.php
Normal file
|
@ -0,0 +1,176 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Lib\Metadata;
|
||||
|
||||
/**
|
||||
* Description of metadata
|
||||
*
|
||||
* @author raziel
|
||||
*/
|
||||
trait Metadata
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var Repository\Metadata
|
||||
*/
|
||||
protected $metadataRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Repository\MetadataField
|
||||
*/
|
||||
protected $metadataFieldRepository;
|
||||
|
||||
/**
|
||||
* Determines if the functionality is enabled or not.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $enableCustomMetadata;
|
||||
|
||||
/**
|
||||
* Cache variable for disabled metadata field names
|
||||
* @var array
|
||||
*/
|
||||
protected $disabledMetadataFields = array();
|
||||
|
||||
/**
|
||||
* Initialize the repository variables. Needs to be called first if the trait should do something.
|
||||
*/
|
||||
protected function initializeMetadata()
|
||||
{
|
||||
$this->metadataRepository = new \Lib\Metadata\Repository\Metadata();
|
||||
$this->metadataFieldRepository = new \Lib\Metadata\Repository\MetadataField();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Model\Metadata
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->metadataRepository->findByObjectIdAndType($this->id, get_class($this));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Model\Metadata $metadata
|
||||
*/
|
||||
public function deleteMetadata(Model\Metadata $metadata)
|
||||
{
|
||||
$this->metadataRepository->remove($metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Lib\Metadata\Model\MetadataField $field
|
||||
* @param type $data
|
||||
*/
|
||||
public function addMetadata(\Lib\Metadata\Model\MetadataField $field, $data)
|
||||
{
|
||||
$metadata = new \Lib\Metadata\Model\Metadata();
|
||||
$metadata->setField($field);
|
||||
$metadata->setObjectId($this->id);
|
||||
$metadata->setType(get_class($this));
|
||||
$metadata->setData($data);
|
||||
$this->metadataRepository->add($metadata);
|
||||
}
|
||||
|
||||
public function updateOrInsertMetadata(\Lib\Metadata\Model\MetadataField $field, $data)
|
||||
{
|
||||
/* @var $metadata Model\Metadata */
|
||||
$metadata = $this->metadataRepository->findByObjectIdAndFieldAndType($this->id, $field, get_class($this));
|
||||
if ($metadata) {
|
||||
$object = reset($metadata);
|
||||
$object->setData($data);
|
||||
$this->metadataRepository->update($object);
|
||||
} else {
|
||||
$this->addMetadata($field, $data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $name
|
||||
* @param type $public
|
||||
* @return \Lib\Metadata\Model\MetadataField
|
||||
*/
|
||||
protected function createField($name, $public)
|
||||
{
|
||||
$field = new \Lib\Metadata\Model\MetadataField();
|
||||
$field->setName($name);
|
||||
if (!$public) {
|
||||
$field->hide();
|
||||
}
|
||||
$this->metadataFieldRepository->add($field);
|
||||
return $field;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $propertie
|
||||
* @param boolean $public
|
||||
* @return Model\MetadataField
|
||||
*/
|
||||
public function getField($propertie, $public = true)
|
||||
{
|
||||
$fields = $this->metadataFieldRepository->findByName($propertie);
|
||||
if (count($fields)) {
|
||||
$field = reset($fields);
|
||||
} else {
|
||||
$field = $this->createField($propertie, $public);
|
||||
}
|
||||
return $field;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isCustomMetadataEnabled()
|
||||
{
|
||||
return (boolean) \AmpConfig::get('enable_custom_metadata');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all disabled Metadata field names
|
||||
* @return array
|
||||
*/
|
||||
public function getDisabledMetadataFields()
|
||||
{
|
||||
if (!$this->disabledMetadataFields) {
|
||||
$fields = array();
|
||||
$ids = explode(',', \AmpConfig::get('disabled_custom_metadata_fields'));
|
||||
foreach ($ids as $id) {
|
||||
$field = $this->metadataFieldRepository->findById($id);
|
||||
if ($field) {
|
||||
$fields[] = $field->getName();
|
||||
}
|
||||
}
|
||||
$this->disabledMetadataFields = array_merge(
|
||||
$fields, explode(',', \AmpConfig::get('disabled_custom_metadata_fields_input'))
|
||||
);
|
||||
}
|
||||
return $this->disabledMetadataFields;
|
||||
}
|
||||
}
|
142
sources/lib/class/Metadata/Model/Metadata.php
Normal file
142
sources/lib/class/Metadata/Model/Metadata.php
Normal file
|
@ -0,0 +1,142 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Lib\Metadata\Model;
|
||||
|
||||
/**
|
||||
* Description of metadata
|
||||
*
|
||||
* @author raziel
|
||||
*/
|
||||
class Metadata extends \Lib\DatabaseObject implements \Lib\Interfaces\Model
|
||||
{
|
||||
/**
|
||||
* Database ID
|
||||
* @var integer
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* A library item like song or video
|
||||
* @var \library_item
|
||||
*/
|
||||
protected $objectId;
|
||||
|
||||
/**
|
||||
* Tag Field
|
||||
* @var MetadataField
|
||||
*/
|
||||
protected $field;
|
||||
|
||||
/**
|
||||
* Tag Data
|
||||
* @var string
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array Stores relation between SQL field name and repository class name so we
|
||||
* can initialize objects the right way
|
||||
*/
|
||||
protected $fieldClassRelations = array(
|
||||
'field' => '\Lib\Metadata\Repository\MetadataField'
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return \library_item
|
||||
*/
|
||||
public function getObjectId()
|
||||
{
|
||||
return $this->objectId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return MetadataField
|
||||
*/
|
||||
public function getField()
|
||||
{
|
||||
return $this->field;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param integer $object
|
||||
*/
|
||||
public function setObjectId($object)
|
||||
{
|
||||
$this->objectId = $object;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param MetadataField $field
|
||||
*/
|
||||
public function setField(MetadataField $field)
|
||||
{
|
||||
$this->field = $field;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $data
|
||||
*/
|
||||
public function setData($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $type
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
}
|
102
sources/lib/class/Metadata/Model/MetadataField.php
Normal file
102
sources/lib/class/Metadata/Model/MetadataField.php
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Lib\Metadata\Model;
|
||||
|
||||
/**
|
||||
* Description of metadata_field
|
||||
*
|
||||
* @author raziel
|
||||
*/
|
||||
class MetadataField extends \Lib\DatabaseObject implements \Lib\Interfaces\Model
|
||||
{
|
||||
/**
|
||||
* Database ID
|
||||
* @var integer
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* Tag name
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Is the Tag public?
|
||||
* @var boolean
|
||||
*/
|
||||
protected $public = true;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormattedName()
|
||||
{
|
||||
return ucwords(str_replace("_", " ", $this->name));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPublic()
|
||||
{
|
||||
return $this->public;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set public to false
|
||||
*/
|
||||
public function hide()
|
||||
{
|
||||
$this->public = false;
|
||||
}
|
||||
}
|
40
sources/lib/class/Metadata/Repository/Metadata.php
Normal file
40
sources/lib/class/Metadata/Repository/Metadata.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Lib\Metadata\Repository;
|
||||
|
||||
/**
|
||||
* Description of Metadata
|
||||
*
|
||||
* @author raziel
|
||||
*/
|
||||
class Metadata extends \Lib\Repository
|
||||
{
|
||||
protected $modelClassName = '\Lib\Metadata\Model\Metadata';
|
||||
|
||||
public static function gc()
|
||||
{
|
||||
\Dba::write('DELETE FROM `metadata` USING `metadata` LEFT JOIN `song` ON `song`.`id` = `metadata`.`object_id` WHERE `song`.`id` IS NULL');
|
||||
}
|
||||
|
||||
//put your code here
|
||||
}
|
38
sources/lib/class/Metadata/Repository/MetadataField.php
Normal file
38
sources/lib/class/Metadata/Repository/MetadataField.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Lib\Metadata\Repository;
|
||||
|
||||
/**
|
||||
* Description of Metadata_field
|
||||
*
|
||||
* @author raziel
|
||||
*/
|
||||
class MetadataField extends \Lib\Repository
|
||||
{
|
||||
protected $modelClassName = '\Lib\Metadata\Model\MetadataField';
|
||||
|
||||
public static function gc()
|
||||
{
|
||||
\Dba::write('DELETE FROM `metadata_field` USING `metadata_field` LEFT JOIN `metadata` ON `metadata`.`field` = `metadata_field`.`id` WHERE `metadata`.`id` IS NULL');
|
||||
}
|
||||
}
|
230
sources/lib/class/Repository.php
Normal file
230
sources/lib/class/Repository.php
Normal file
|
@ -0,0 +1,230 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Lib;
|
||||
|
||||
use Lib\Interfaces\Model;
|
||||
|
||||
/**
|
||||
* Description of Repository
|
||||
*
|
||||
* @author raziel
|
||||
*/
|
||||
class Repository
|
||||
{
|
||||
protected $modelClassName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array Stores relation between SQL field name and class name so we
|
||||
* can initialize objects the right way
|
||||
*/
|
||||
protected $fieldClassRelations = array();
|
||||
|
||||
protected function findBy($fields, $values)
|
||||
{
|
||||
$table = $this->getTableName();
|
||||
return $this->getRecords($table, $fields, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return DatabaseObject[]
|
||||
*/
|
||||
public function findAll()
|
||||
{
|
||||
$table = $this->getTableName();
|
||||
return $this->getRecords($table);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $id
|
||||
* @return DatabaseObject
|
||||
*/
|
||||
public function findById($id)
|
||||
{
|
||||
$rows = $this->findBy(array('id'), array($id));
|
||||
return count($rows) ? reset($rows) : null;
|
||||
}
|
||||
|
||||
private function getRecords($table, $field = null, $value = null)
|
||||
{
|
||||
$data = array();
|
||||
$sql = $this->assembleQuery($table, $field);
|
||||
|
||||
$statement = \Dba::read($sql, is_array($value) ? $value : array($value));
|
||||
while ($object = \Dba::fetch_object($statement, $this->modelClassName)) {
|
||||
$data[$object->getId()] = $object;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
* @return DatabaseObject
|
||||
*/
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
if (preg_match('/^findBy(.*)$/', $name, $matches)) {
|
||||
$parts = explode('And', $matches[1]);
|
||||
return $this->findBy(
|
||||
$parts,
|
||||
$this->resolveObjects($arguments)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function getTableName()
|
||||
{
|
||||
$className = get_called_class();
|
||||
$nameParts = explode('\\', $className);
|
||||
$tableName = preg_replace_callback(
|
||||
'/(?<=.)([A-Z])/',
|
||||
function($m) {
|
||||
return '_' . strtolower($m[0]);
|
||||
}, end($nameParts));
|
||||
return lcfirst($tableName);
|
||||
}
|
||||
|
||||
public function add(DatabaseObject $object)
|
||||
{
|
||||
$properties = $object->getDirtyProperties();
|
||||
$this->setPrivateProperty(
|
||||
$object,
|
||||
'id',
|
||||
$this->insertRecord($properties)
|
||||
);
|
||||
}
|
||||
|
||||
public function update(DatabaseObject $object)
|
||||
{
|
||||
if ($object->isDirty()) {
|
||||
$properties = $object->getDirtyProperties();
|
||||
$this->updateRecord($object->getId(), $properties);
|
||||
}
|
||||
}
|
||||
|
||||
public function remove(DatabaseObject $object)
|
||||
{
|
||||
$id = $object->getId();
|
||||
$this->deleteRecord($id);
|
||||
}
|
||||
|
||||
protected function insertRecord($properties)
|
||||
{
|
||||
$sql = 'INSERT INTO ' . $this->getTableName() . ' (' . implode(',', array_keys($properties)) . ')'
|
||||
. ' VALUES(' . implode(',', array_fill(0, count($properties), '?')) . ')';
|
||||
//print_r($properties);
|
||||
\Dba::write(
|
||||
$sql,
|
||||
array_values($this->resolveObjects($properties))
|
||||
);
|
||||
return \Dba::insert_id();
|
||||
}
|
||||
|
||||
protected function updateRecord($id, $properties)
|
||||
{
|
||||
$sql = 'UPDATE ' . $this->getTableName()
|
||||
. ' SET ' . implode(',', $this->getKeyValuePairs($properties))
|
||||
. ' WHERE id = ?';
|
||||
$properties[] = $id;
|
||||
\Dba::write(
|
||||
$sql,
|
||||
array_values($this->resolveObjects($properties))
|
||||
);
|
||||
}
|
||||
|
||||
protected function deleteRecord($id)
|
||||
{
|
||||
$sql = 'DELETE FROM ' . $this->getTableName()
|
||||
. ' WHERE id = ?';
|
||||
\Dba::write($sql, array($id));
|
||||
}
|
||||
|
||||
protected function getKeyValuePairs($properties)
|
||||
{
|
||||
$pairs = array();
|
||||
foreach ($properties as $property => $value) {
|
||||
$pairs[] = $property . '= ?';
|
||||
}
|
||||
return $pairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a private or protected variable.
|
||||
* Only used in case where a property should not publicly writable
|
||||
* @param Object $object
|
||||
* @param string $property
|
||||
* @param mixed $value
|
||||
*/
|
||||
protected function setPrivateProperty(Model $object, $property, $value)
|
||||
{
|
||||
$reflectionClass = new \ReflectionClass(get_class($object));
|
||||
$ReflectionProperty = $reflectionClass->getProperty($property);
|
||||
$ReflectionProperty->setAccessible(true);
|
||||
$ReflectionProperty->setValue($object, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve all objects into id's
|
||||
* @param array $properties
|
||||
* @return array
|
||||
*/
|
||||
protected function resolveObjects(array $properties)
|
||||
{
|
||||
foreach ($properties as $property => $value) {
|
||||
if (is_object($value)) {
|
||||
$properties[$property] = $value->getId();
|
||||
}
|
||||
}
|
||||
return $properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create query for one or multiple fields
|
||||
* @param string $table
|
||||
* @param array $fields
|
||||
* @return string
|
||||
*/
|
||||
public function assembleQuery($table, $fields)
|
||||
{
|
||||
$sql = 'SELECT * FROM ' . $table;
|
||||
if ($fields) {
|
||||
$sql .= ' WHERE ';
|
||||
$sqlParts = array();
|
||||
foreach ($fields as $field) {
|
||||
$sqlParts[] = '`' . $this->camelCaseToUnderscore($field) . '` = ?';
|
||||
}
|
||||
$sql .= implode(' and ', $sqlParts);
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
public function camelCaseToUnderscore($string)
|
||||
{
|
||||
return strtolower(preg_replace('/(?<=\\w)(?=[A-Z])/','_$1', $string));
|
||||
}
|
||||
}
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -93,7 +93,9 @@ class Access
|
|||
*/
|
||||
public function __construct($access_id = null)
|
||||
{
|
||||
if (!$access_id) { return false; }
|
||||
if (!$access_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Assign id for use in get_info() */
|
||||
$this->id = intval($access_id);
|
||||
|
@ -152,16 +154,16 @@ class Access
|
|||
$endn = @inet_pton($endp);
|
||||
|
||||
if (!$startn && $startp != '0.0.0.0' && $startp != '::') {
|
||||
Error::add('start', T_('Invalid IPv4 / IPv6 Address Entered'));
|
||||
AmpError::add('start', T_('Invalid IPv4 / IPv6 Address Entered'));
|
||||
return false;
|
||||
}
|
||||
if (!$endn) {
|
||||
Error::add('end', T_('Invalid IPv4 / IPv6 Address Entered'));
|
||||
AmpError::add('end', T_('Invalid IPv4 / IPv6 Address Entered'));
|
||||
}
|
||||
|
||||
if (strlen(bin2hex($startn)) != strlen(bin2hex($endn))) {
|
||||
Error::add('start', T_('IP Address Version Mismatch'));
|
||||
Error::add('end', T_('IP Address Version Mismatch'));
|
||||
AmpError::add('start', T_('IP Address Version Mismatch'));
|
||||
AmpError::add('end', T_('IP Address Version Mismatch'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -215,7 +217,7 @@ class Access
|
|||
// Check existing ACLs to make sure we're not duplicating values here
|
||||
if (self::exists($data)) {
|
||||
debug_event('ACL Create', 'Error: An ACL equal to the created one already exists. Not adding another one: ' . $data['start'] . ' - ' . $data['end'], 1);
|
||||
Error::add('general', T_('Duplicate ACL defined'));
|
||||
AmpError::add('general', T_('Duplicate ACL defined'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -232,7 +234,6 @@ class Access
|
|||
Dba::write($sql, array($name, $level, $start, $end, $user, $type, $enabled));
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -289,7 +290,7 @@ class Access
|
|||
debug_event('access', 'ZLIB extension not loaded, batch download disabled', 3);
|
||||
return false;
|
||||
}
|
||||
if (AmpConfig::get('allow_zip_download') AND $GLOBALS['user']->has_access('5')) {
|
||||
if (AmpConfig::get('allow_zip_download') and $GLOBALS['user']->has_access('5')) {
|
||||
return make_bool(AmpConfig::get('download'));
|
||||
}
|
||||
break;
|
||||
|
@ -476,7 +477,9 @@ class Access
|
|||
*/
|
||||
public function get_user_name()
|
||||
{
|
||||
if ($this->user == '-1') { return T_('All'); }
|
||||
if ($this->user == '-1') {
|
||||
return T_('All');
|
||||
}
|
||||
|
||||
$user = new User($this->user);
|
||||
return $user->fullname . " (" . $user->username . ")";
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -40,7 +40,6 @@ class Ajax
|
|||
public function __construct()
|
||||
{
|
||||
// Rien a faire
|
||||
|
||||
} // constructor
|
||||
|
||||
/**
|
||||
|
@ -68,17 +67,16 @@ class Ajax
|
|||
if (AmpConfig::get('ajax_load') && $method == 'load') {
|
||||
$source_txt = "$( document ).ready(";
|
||||
} else {
|
||||
$source_txt = "$(".$source_txt.").on('".$method."', ";
|
||||
$source_txt = "$(" . $source_txt . ").on('" . $method . "', ";
|
||||
}
|
||||
if (!empty($confirm)) {
|
||||
$observe .= $source_txt . "function(){ ".$methodact." if (confirm(\"".$confirm."\")) { ".$action." }});";
|
||||
$observe .= $source_txt . "function(){ " . $methodact . " if (confirm(\"" . $confirm . "\")) { " . $action . " }});";
|
||||
} else {
|
||||
$observe .= $source_txt . "function(){ ".$methodact." ".$action.";});";
|
||||
$observe .= $source_txt . "function(){ " . $methodact . " " . $action . ";});";
|
||||
}
|
||||
$observe .= "</script>";
|
||||
|
||||
return $observe;
|
||||
|
||||
} // observe
|
||||
|
||||
/**
|
||||
|
@ -120,7 +118,6 @@ class Ajax
|
|||
}
|
||||
|
||||
return $ajax_string;
|
||||
|
||||
} // action
|
||||
|
||||
/**
|
||||
|
@ -143,7 +140,7 @@ class Ajax
|
|||
|
||||
// If they passed a span class
|
||||
if ($class) {
|
||||
$class = ' class="'.$class.'"';
|
||||
$class = ' class="' . $class . '"';
|
||||
}
|
||||
|
||||
$string = UI::get_icon($icon, $alt);
|
||||
|
@ -151,12 +148,11 @@ class Ajax
|
|||
// Generate an <a> so that it's more compliant with older
|
||||
// browsers (ie :hover actions) and also to unify linkbuttons
|
||||
// (w/o ajax) display
|
||||
$string = "<a href=\"javascript:void(0);\" id=\"$source\" $class>".$string."</a>\n";
|
||||
$string = "<a href=\"javascript:void(0);\" id=\"$source\" $class>" . $string . "</a>\n";
|
||||
|
||||
$string .= self::observe($source, 'click', $ajax_string, $confirm);
|
||||
|
||||
return $string;
|
||||
|
||||
} // button
|
||||
|
||||
/**
|
||||
|
@ -193,7 +189,6 @@ class Ajax
|
|||
}
|
||||
|
||||
return $string;
|
||||
|
||||
} // text
|
||||
|
||||
/**
|
||||
|
@ -206,7 +201,6 @@ class Ajax
|
|||
echo "<script type=\"text/javascript\"><!--\n";
|
||||
echo "$action";
|
||||
echo "\n--></script>";
|
||||
|
||||
} // run
|
||||
|
||||
/**
|
||||
|
@ -218,7 +212,6 @@ class Ajax
|
|||
public static function set_include_override($value)
|
||||
{
|
||||
self::$include_override = make_bool($value);
|
||||
|
||||
} // set_include_override
|
||||
|
||||
/**
|
||||
|
@ -230,14 +223,15 @@ class Ajax
|
|||
*/
|
||||
public static function start_container($name, $class = '')
|
||||
{
|
||||
if (defined('AJAX_INCLUDE') && !self::$include_override) { return true; }
|
||||
if (defined('AJAX_INCLUDE') && !self::$include_override) {
|
||||
return true;
|
||||
}
|
||||
|
||||
echo '<div id="' . scrub_out($name) . '"';
|
||||
if (!empty($class)) {
|
||||
echo ' class="' . scrub_out($class) . '"';
|
||||
}
|
||||
echo '>';
|
||||
|
||||
} // start_container
|
||||
|
||||
/**
|
||||
|
@ -246,12 +240,13 @@ class Ajax
|
|||
*/
|
||||
public static function end_container()
|
||||
{
|
||||
if (defined('AJAX_INCLUDE') && !self::$include_override) { return true; }
|
||||
if (defined('AJAX_INCLUDE') && !self::$include_override) {
|
||||
return true;
|
||||
}
|
||||
|
||||
echo "</div>";
|
||||
|
||||
self::$include_override = false;
|
||||
|
||||
} // end_container
|
||||
|
||||
} // end Ajax class
|
||||
|
||||
|
|
|
@ -2,22 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -187,7 +186,9 @@ class Album extends database_object implements library_item
|
|||
*/
|
||||
public function __construct($id=null)
|
||||
{
|
||||
if (!$id) { return false; }
|
||||
if (!$id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Get the information from the db */
|
||||
$info = $this->get_info($id);
|
||||
|
@ -206,7 +207,6 @@ class Album extends database_object implements library_item
|
|||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // constructor
|
||||
|
||||
/**
|
||||
|
@ -226,7 +226,6 @@ class Album extends database_object implements library_item
|
|||
$album->_fake = true; // Make sure that we tell em it's fake
|
||||
|
||||
return $album;
|
||||
|
||||
} // construct_from_array
|
||||
|
||||
/**
|
||||
|
@ -249,7 +248,7 @@ class Album extends database_object implements library_item
|
|||
public static function build_cache(array $ids)
|
||||
{
|
||||
// Nothing to do if they pass us nothing
|
||||
if (!is_array($ids) OR !count($ids)) {
|
||||
if (!is_array($ids) or !count($ids)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -263,7 +262,6 @@ class Album extends database_object implements library_item
|
|||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // build_cache
|
||||
|
||||
/**
|
||||
|
@ -282,19 +280,16 @@ class Album extends database_object implements library_item
|
|||
return parent::get_from_cache('album_extra', $this->id);
|
||||
}
|
||||
|
||||
// Calculation
|
||||
$sql = "SELECT " .
|
||||
"COUNT(DISTINCT(`song`.`artist`)) AS `artist_count`, " .
|
||||
"COUNT(`song`.`id`) AS `song_count`, " .
|
||||
"SUM(`song`.`time`) as `total_duration`," .
|
||||
"`song`.`catalog` as `catalog_id`,".
|
||||
"`artist`.`name` AS `artist_name`, " .
|
||||
"`artist`.`prefix` AS `artist_prefix`, " .
|
||||
"`artist`.`id` AS `artist_id` " .
|
||||
"FROM `song` INNER JOIN `artist` " .
|
||||
"ON `artist`.`id`=`song`.`artist` ";
|
||||
"SUM(`song`.`time`) as `total_duration` " .
|
||||
"FROM `song` ";
|
||||
|
||||
$sqlj = '';
|
||||
if (AmpConfig::get('catalog_disable')) {
|
||||
$sql .= "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` ";
|
||||
$sqlj = "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` ";
|
||||
}
|
||||
|
||||
$suite_array = array();
|
||||
|
@ -306,21 +301,35 @@ class Album extends database_object implements library_item
|
|||
}
|
||||
|
||||
$idlist = '(' . implode(',', $suite_array) . ')';
|
||||
$sql .= "WHERE `song`.`album` IN $idlist ";
|
||||
$sqlw = "WHERE `song`.`album` IN $idlist ";
|
||||
|
||||
if (AmpConfig::get('catalog_disable')) {
|
||||
$sql .= "AND `catalog`.`enabled` = '1' ";
|
||||
$sqlw .= "AND `catalog`.`enabled` = '1' ";
|
||||
}
|
||||
$sql .= $sqlj . $sqlw;
|
||||
if (!count($this->album_suite)) {
|
||||
$sql .= "GROUP BY `song`.`album`";
|
||||
$sql .= "GROUP BY `song`.`album` ";
|
||||
} else {
|
||||
$sql .= "GROUP BY `song`.`artist`";
|
||||
$sql .= "GROUP BY `song`.`artist` ";
|
||||
}
|
||||
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
$results = Dba::fetch_assoc($db_results);
|
||||
|
||||
|
||||
// Get associated information from first song only
|
||||
$sql = "SELECT " .
|
||||
"`song`.`catalog` as `catalog_id`," .
|
||||
"`artist`.`name` AS `artist_name`, " .
|
||||
"`artist`.`prefix` AS `artist_prefix`, " .
|
||||
"`artist`.`id` AS `artist_id` " .
|
||||
"FROM `song` INNER JOIN `artist` " .
|
||||
"ON `artist`.`id`=`song`.`artist` ";
|
||||
$sql .= $sqlj . $sqlw . "LIMIT 1";
|
||||
|
||||
$db_results = Dba::read($sql);
|
||||
$results = array_merge($results, Dba::fetch_assoc($db_results));
|
||||
|
||||
$art = new Art($this->id, 'album');
|
||||
$art->get_db();
|
||||
$results['has_art'] = make_bool($art->raw);
|
||||
|
@ -333,7 +342,6 @@ class Album extends database_object implements library_item
|
|||
parent::add_to_cache('album_extra', $this->id, $results);
|
||||
|
||||
return $results;
|
||||
|
||||
} // _get_extra_info
|
||||
|
||||
public function can_edit($user = null)
|
||||
|
@ -342,20 +350,25 @@ class Album extends database_object implements library_item
|
|||
$user = $GLOBALS['user']->id;
|
||||
}
|
||||
|
||||
if (!$user)
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->user !== null && $user == $this->user)
|
||||
if ($this->user !== null && $user == $this->user) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Access::check('interface', 50, $user))
|
||||
if (Access::check('interface', 50, $user)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$this->album_artist)
|
||||
if (!$this->album_artist) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AmpConfig::get('upload_allow_edit'))
|
||||
if (!AmpConfig::get('upload_allow_edit')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$owner = $this->get_user_owner();
|
||||
return ($owner && $owner === $user);
|
||||
|
@ -387,7 +400,7 @@ class Album extends database_object implements library_item
|
|||
$release_type = empty($release_type) ? null : $release_type;
|
||||
|
||||
// Not even sure if these can be negative, but better safe than llama.
|
||||
$year = abs(intval($year));
|
||||
$year = Catalog::normalize_year($year);
|
||||
$disk = abs(intval($disk));
|
||||
|
||||
if (!$name) {
|
||||
|
@ -490,7 +503,6 @@ class Album extends database_object implements library_item
|
|||
}
|
||||
|
||||
return $results;
|
||||
|
||||
} // get_songs
|
||||
|
||||
/**
|
||||
|
@ -544,7 +556,7 @@ class Album extends database_object implements library_item
|
|||
$catalog_where .= " AND `catalog`.`enabled` = '1'";
|
||||
}
|
||||
|
||||
$sql = "SELECT DISTINCT `album`.`id` FROM album LEFT JOIN `song` ON `song`.`album`=`album`.`id` $catalog_join " .
|
||||
$sql = "SELECT DISTINCT `album`.`id`, `album`.`disk` FROM album LEFT JOIN `song` ON `song`.`album`=`album`.`id` $catalog_join " .
|
||||
"WHERE `album`.`mbid`='$this->mbid' $catalog_where ORDER BY `album`.`disk` ASC";
|
||||
|
||||
$db_results = Dba::read($sql);
|
||||
|
@ -554,7 +566,6 @@ class Album extends database_object implements library_item
|
|||
}
|
||||
|
||||
return $results;
|
||||
|
||||
} // get_album_suite
|
||||
|
||||
/**
|
||||
|
@ -571,7 +582,6 @@ class Album extends database_object implements library_item
|
|||
$data = Dba::fetch_assoc($db_results);
|
||||
|
||||
return $data;
|
||||
|
||||
} // has_track
|
||||
|
||||
/**
|
||||
|
@ -605,7 +615,9 @@ class Album extends database_object implements library_item
|
|||
if ($details) {
|
||||
/* Pull the advanced information */
|
||||
$data = $this->_get_extra_info($limit_threshold);
|
||||
foreach ($data as $key=>$value) { $this->$key = $value; }
|
||||
foreach ($data as $key=>$value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
|
||||
if ($this->album_artist) {
|
||||
$Album_artist = new Artist($this->album_artist);
|
||||
|
@ -649,7 +661,6 @@ class Album extends database_object implements library_item
|
|||
}
|
||||
|
||||
$this->f_release_type = ucwords($this->release_type);
|
||||
|
||||
} // format
|
||||
|
||||
/**
|
||||
|
@ -773,8 +784,9 @@ class Album extends database_object implements library_item
|
|||
*/
|
||||
public function get_user_owner()
|
||||
{
|
||||
if (!$this->album_artist)
|
||||
if (!$this->album_artist) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$artist = new Artist($this->album_artist);
|
||||
return $artist->get_user_owner();
|
||||
|
@ -804,10 +816,12 @@ class Album extends database_object implements library_item
|
|||
if (Art::has_db($this->id, 'album')) {
|
||||
$id = $this->id;
|
||||
$type = 'album';
|
||||
} else if (Art::has_db($this->artist_id, 'artist')) {
|
||||
} else {
|
||||
if (Art::has_db($this->artist_id, 'artist')) {
|
||||
$id = $this->artist_id;
|
||||
$type = 'artist';
|
||||
}
|
||||
}
|
||||
|
||||
if ($id !== null && $type !== null) {
|
||||
Art::display($type, $id, $this->get_fullname(), $thumb, $this->link);
|
||||
|
@ -838,7 +852,6 @@ class Album extends database_object implements library_item
|
|||
}
|
||||
|
||||
return $results;
|
||||
|
||||
} // get_random_songs
|
||||
|
||||
/**
|
||||
|
@ -861,14 +874,9 @@ class Album extends database_object implements library_item
|
|||
|
||||
$current_id = $this->id;
|
||||
|
||||
if (!empty($data['album_artist_name'])) {
|
||||
// Need to create new artist according the name
|
||||
$album_artist = Artist::check($data['album_artist_name']);
|
||||
}
|
||||
|
||||
$updated = false;
|
||||
$songs = null;
|
||||
if ($artist != $this->artist_id AND $artist) {
|
||||
if ($artist != $this->artist_id && $artist) {
|
||||
// Update every song
|
||||
$songs = $this->get_songs();
|
||||
foreach ($songs as $song_id) {
|
||||
|
@ -878,9 +886,16 @@ class Album extends database_object implements library_item
|
|||
Artist::gc();
|
||||
}
|
||||
|
||||
if (!empty($data['album_artist_name'])) {
|
||||
// Need to create new artist according the name
|
||||
$album_artist = Artist::check($data['album_artist_name']);
|
||||
}
|
||||
|
||||
$album_id = self::check($name, $year, $disk, $mbid, $mbid_group, $album_artist, $release_type);
|
||||
if ($album_id != $this->id) {
|
||||
if (!is_array($songs)) { $songs = $this->get_songs(); }
|
||||
if (!is_array($songs)) {
|
||||
$songs = $this->get_songs();
|
||||
}
|
||||
foreach ($songs as $song_id) {
|
||||
Song::update_album($album_id,$song_id);
|
||||
Song::update_year($year,$song_id);
|
||||
|
@ -911,6 +926,7 @@ class Album extends database_object implements library_item
|
|||
Stats::gc();
|
||||
Rating::gc();
|
||||
Userflag::gc();
|
||||
Useractivity::gc();
|
||||
} // if updated
|
||||
|
||||
$override_childs = false;
|
||||
|
@ -928,7 +944,6 @@ class Album extends database_object implements library_item
|
|||
}
|
||||
|
||||
return $current_id;
|
||||
|
||||
} // update
|
||||
|
||||
/**
|
||||
|
@ -965,7 +980,7 @@ class Album extends database_object implements library_item
|
|||
$song = new Song($id);
|
||||
$deleted = $song->remove_from_disk();
|
||||
if (!$deleted) {
|
||||
debug_event('album', 'Error when deleting the song `' . $id .'`.', 1);
|
||||
debug_event('album', 'Error when deleting the song `' . $id . '`.', 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -978,6 +993,7 @@ class Album extends database_object implements library_item
|
|||
Userflag::gc('album', $this->id);
|
||||
Rating::gc('album', $this->id);
|
||||
Shoutbox::gc('album', $this->id);
|
||||
Useractivity::gc('album', $this->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1067,5 +1083,5 @@ class Album extends database_object implements library_item
|
|||
|
||||
return $results;
|
||||
}
|
||||
|
||||
} //end of album class
|
||||
|
||||
|
|
|
@ -2,22 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* of the License.
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -40,7 +39,6 @@ class Ampache_RSS
|
|||
public function __construct($type)
|
||||
{
|
||||
$this->type = self::validate_type($type);
|
||||
|
||||
} // constructor
|
||||
|
||||
/**
|
||||
|
@ -81,7 +79,6 @@ class Ampache_RSS
|
|||
}
|
||||
|
||||
return null;
|
||||
|
||||
} // get_xml
|
||||
|
||||
/**
|
||||
|
@ -99,7 +96,6 @@ class Ampache_RSS
|
|||
);
|
||||
|
||||
return scrub_out(AmpConfig::get('site_title')) . ' - ' . $titles[$this->type];
|
||||
|
||||
} // get_title
|
||||
|
||||
/**
|
||||
|
@ -111,7 +107,6 @@ class Ampache_RSS
|
|||
{
|
||||
//FIXME: For now don't do any kind of translating
|
||||
return 'Ampache RSS Feeds';
|
||||
|
||||
} // get_description
|
||||
|
||||
/**
|
||||
|
@ -129,7 +124,6 @@ class Ampache_RSS
|
|||
}
|
||||
|
||||
return $type;
|
||||
|
||||
} // validate_type
|
||||
|
||||
/**
|
||||
|
@ -159,7 +153,6 @@ class Ampache_RSS
|
|||
$string .= '</a>';
|
||||
|
||||
return $string;
|
||||
|
||||
} // get_display
|
||||
|
||||
// type specific functions below, these are called semi-dynamically based on the current type //
|
||||
|
@ -203,7 +196,6 @@ class Ampache_RSS
|
|||
} // end foreach
|
||||
|
||||
return $results;
|
||||
|
||||
} // load_now_playing
|
||||
|
||||
/**
|
||||
|
@ -220,7 +212,6 @@ class Ampache_RSS
|
|||
$element = array_shift($data);
|
||||
|
||||
return $element['expire'];
|
||||
|
||||
} // pubdate_now_playing
|
||||
|
||||
/**
|
||||
|
@ -240,6 +231,7 @@ class Ampache_RSS
|
|||
foreach ($data as $item) {
|
||||
$client = new User($item['user']);
|
||||
$song = new Song($item['object_id']);
|
||||
if ($song->enabled) {
|
||||
$song->format();
|
||||
$amount = intval(time() - $item['date']+2);
|
||||
$final = '0';
|
||||
|
@ -276,11 +268,10 @@ class Ampache_RSS
|
|||
'comments'=>$client->username,
|
||||
'pubDate'=>date("r",$item['date']));
|
||||
$results[] = $xml_array;
|
||||
|
||||
}
|
||||
} // end foreach
|
||||
|
||||
return $results;
|
||||
|
||||
} // load_recently_played
|
||||
|
||||
/**
|
||||
|
@ -306,11 +297,9 @@ class Ampache_RSS
|
|||
'pubDate' => date("c", $album->get_addtime_first_song())
|
||||
);
|
||||
$results[] = $xml_array;
|
||||
|
||||
} // end foreach
|
||||
|
||||
return $results;
|
||||
|
||||
} // load_latest_album
|
||||
|
||||
/**
|
||||
|
@ -336,11 +325,9 @@ class Ampache_RSS
|
|||
'pubDate' => ''
|
||||
);
|
||||
$results[] = $xml_array;
|
||||
|
||||
} // end foreach
|
||||
|
||||
return $results;
|
||||
|
||||
} // load_latest_artist
|
||||
|
||||
/**
|
||||
|
@ -358,6 +345,7 @@ class Ampache_RSS
|
|||
$shout = new Shoutbox($id);
|
||||
$shout->format();
|
||||
$object = Shoutbox::get_object($shout->object_type, $shout->object_id);
|
||||
if ($object !== null) {
|
||||
$object->format();
|
||||
$user = new User($shout->user);
|
||||
$user->format();
|
||||
|
@ -370,11 +358,10 @@ class Ampache_RSS
|
|||
'pubDate' => date("c", $shout->date)
|
||||
);
|
||||
$results[] = $xml_array;
|
||||
|
||||
}
|
||||
} // end foreach
|
||||
|
||||
return $results;
|
||||
|
||||
} // load_latest_shout
|
||||
|
||||
/**
|
||||
|
@ -389,7 +376,6 @@ class Ampache_RSS
|
|||
$element = array_shift($data);
|
||||
|
||||
return $element['date'];
|
||||
|
||||
} // pubdate_recently_played
|
||||
|
||||
} // end Ampache_RSS class
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -82,7 +82,7 @@ class AmpConfig
|
|||
{
|
||||
if (isset(self::$_global[$name]) && !$clobber) {
|
||||
debug_event('Config', "Tried to overwrite existing key $name without setting clobber", 5);
|
||||
Error::add('Config Global', sprintf(T_('Trying to clobber \'%s\' without setting clobber'), $name));
|
||||
AmpError::add('Config Global', sprintf(T_('Trying to clobber \'%s\' without setting clobber'), $name));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANT ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
|||
* hello static functions and variables
|
||||
*
|
||||
*/
|
||||
class Error
|
||||
class AmpError
|
||||
{
|
||||
private static $state = false; // set to one when an error occurs
|
||||
private static $errors = array(); // Errors array key'd array with errors that have occured
|
||||
|
@ -39,7 +39,6 @@ class Error
|
|||
private function __construct()
|
||||
{
|
||||
// Rien a faire
|
||||
|
||||
} // __construct
|
||||
|
||||
/**
|
||||
|
@ -51,7 +50,6 @@ class Error
|
|||
foreach (self::$errors as $key=>$error) {
|
||||
$_SESSION['errors'][$key] = $error;
|
||||
}
|
||||
|
||||
} // __destruct
|
||||
|
||||
/**
|
||||
|
@ -62,21 +60,21 @@ class Error
|
|||
public static function add($name,$message,$clobber=0)
|
||||
{
|
||||
// Make sure its set first
|
||||
if (!isset(Error::$errors[$name])) {
|
||||
Error::$errors[$name] = $message;
|
||||
Error::$state = true;
|
||||
if (!isset(AmpError::$errors[$name])) {
|
||||
AmpError::$errors[$name] = $message;
|
||||
AmpError::$state = true;
|
||||
$_SESSION['errors'][$name] = $message;
|
||||
}
|
||||
// They want us to clobber it
|
||||
elseif ($clobber) {
|
||||
Error::$state = true;
|
||||
Error::$errors[$name] = $message;
|
||||
AmpError::$state = true;
|
||||
AmpError::$errors[$name] = $message;
|
||||
$_SESSION['errors'][$name] = $message;
|
||||
}
|
||||
// They want us to append the error, add a BR\n and then the message
|
||||
else {
|
||||
Error::$state = true;
|
||||
Error::$errors[$name] .= "<br />\n" . $message;
|
||||
AmpError::$state = true;
|
||||
AmpError::$errors[$name] .= "<br />\n" . $message;
|
||||
$_SESSION['errors'][$name] .= "<br />\n" . $message;
|
||||
}
|
||||
|
||||
|
@ -86,7 +84,6 @@ class Error
|
|||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
|
||||
} // add
|
||||
|
||||
/**
|
||||
|
@ -95,10 +92,11 @@ class Error
|
|||
*/
|
||||
public static function occurred()
|
||||
{
|
||||
if (self::$state == '1') { return true; }
|
||||
if (self::$state == '1') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
} // occurred
|
||||
|
||||
/**
|
||||
|
@ -107,10 +105,11 @@ class Error
|
|||
*/
|
||||
public static function get($name)
|
||||
{
|
||||
if (!isset(Error::$errors[$name])) { return ''; }
|
||||
|
||||
return Error::$errors[$name];
|
||||
if (!isset(AmpError::$errors[$name])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return AmpError::$errors[$name];
|
||||
} // get
|
||||
|
||||
/**
|
||||
|
@ -121,10 +120,11 @@ class Error
|
|||
public static function display($name)
|
||||
{
|
||||
// Be smart about this, if no error don't print
|
||||
if (!isset(Error::$errors[$name])) { return ''; }
|
||||
|
||||
echo '<p class="alert alert-danger">' . T_(Error::$errors[$name]) . '</p>';
|
||||
if (!isset(AmpError::$errors[$name])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
echo '<p class="alert alert-danger">' . T_(AmpError::$errors[$name]) . '</p>';
|
||||
} // display
|
||||
|
||||
/**
|
||||
|
@ -133,13 +133,14 @@ class Error
|
|||
*/
|
||||
public static function auto_init()
|
||||
{
|
||||
if (!is_array($_SESSION['errors'])) { return false; }
|
||||
if (!is_array($_SESSION['errors'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Re-insert them
|
||||
foreach ($_SESSION['errors'] as $key=>$error) {
|
||||
self::add($key,$error);
|
||||
}
|
||||
|
||||
} // auto_init
|
||||
|
||||
} // Error
|
||||
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -51,7 +51,6 @@ class Api
|
|||
private function __construct()
|
||||
{
|
||||
// Rien a faire
|
||||
|
||||
} // constructor
|
||||
|
||||
/**
|
||||
|
@ -77,7 +76,9 @@ class Api
|
|||
*/
|
||||
public static function set_filter($filter,$value)
|
||||
{
|
||||
if (!strlen($value)) { return false; }
|
||||
if (!strlen($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ($filter) {
|
||||
case 'add':
|
||||
|
@ -112,7 +113,6 @@ class Api
|
|||
} // end filter
|
||||
|
||||
return true;
|
||||
|
||||
} // set_filter
|
||||
|
||||
/**
|
||||
|
@ -140,7 +140,7 @@ class Api
|
|||
// Version check shouldn't be soo restrictive... only check with initial version to not break clients compatibility
|
||||
if (intval($version) < self::$auth_version) {
|
||||
debug_event('API', 'Login Failed: version too old', 1);
|
||||
Error::add('api', T_('Login Failed: version too old'));
|
||||
AmpError::add('api', T_('Login Failed: version too old'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ class Api
|
|||
if (($timestamp < (time() - 1800)) ||
|
||||
($timestamp > (time() + 1800))) {
|
||||
debug_event('API', 'Login Failed: timestamp out of range ' . $timestamp . '/' . time(), 1);
|
||||
Error::add('api', T_('Login Failed: timestamp out of range'));
|
||||
AmpError::add('api', T_('Login Failed: timestamp out of range'));
|
||||
echo XML_Data::error('401', T_('Error Invalid Handshake - ') . T_('Login Failed: timestamp out of range'));
|
||||
return false;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ class Api
|
|||
|
||||
if (!$realpwd) {
|
||||
debug_event('API', 'Unable to find user with userid of ' . $user_id, 1);
|
||||
Error::add('api', T_('Invalid Username/Password'));
|
||||
AmpError::add('api', T_('Invalid Username/Password'));
|
||||
echo XML_Data::error('401', T_('Error Invalid Handshake - ') . T_('Invalid Username/Password'));
|
||||
return false;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ class Api
|
|||
|
||||
// Now we need to quickly get the song totals
|
||||
$sql = 'SELECT COUNT(`id`) AS `song`, ' .
|
||||
'COUNT(DISTINCT(`album`)) AS `album`, '.
|
||||
'COUNT(DISTINCT(`album`)) AS `album`, ' .
|
||||
'COUNT(DISTINCT(`artist`)) AS `artist` ' .
|
||||
'FROM `song`';
|
||||
$db_results = Dba::read($sql);
|
||||
|
@ -257,7 +257,6 @@ class Api
|
|||
'catalogs'=>$catalog['catalog']));
|
||||
return true;
|
||||
} // match
|
||||
|
||||
} // end while
|
||||
|
||||
debug_event('API','Login Failed, unable to match passphrase','1');
|
||||
|
@ -286,7 +285,6 @@ class Api
|
|||
|
||||
ob_end_clean();
|
||||
echo XML_Data::keyed_array($xmldata);
|
||||
|
||||
} // ping
|
||||
|
||||
/**
|
||||
|
@ -315,7 +313,6 @@ class Api
|
|||
// echo out the resulting xml document
|
||||
ob_end_clean();
|
||||
echo XML_Data::artists($artists);
|
||||
|
||||
} // artists
|
||||
|
||||
/**
|
||||
|
@ -328,7 +325,6 @@ class Api
|
|||
{
|
||||
$uid = scrub_in($input['filter']);
|
||||
echo XML_Data::artists(array($uid));
|
||||
|
||||
} // artist
|
||||
|
||||
/**
|
||||
|
@ -347,7 +343,6 @@ class Api
|
|||
XML_Data::set_limit($input['limit']);
|
||||
ob_end_clean();
|
||||
echo XML_Data::albums($albums);
|
||||
|
||||
} // artist_albums
|
||||
|
||||
/**
|
||||
|
@ -365,7 +360,6 @@ class Api
|
|||
XML_Data::set_limit($input['limit']);
|
||||
ob_end_clean();
|
||||
echo XML_Data::songs($songs);
|
||||
|
||||
} // artist_songs
|
||||
|
||||
/**
|
||||
|
@ -390,7 +384,6 @@ class Api
|
|||
XML_Data::set_limit($input['limit']);
|
||||
ob_end_clean();
|
||||
echo XML_Data::albums($albums);
|
||||
|
||||
} // albums
|
||||
|
||||
/**
|
||||
|
@ -402,7 +395,6 @@ class Api
|
|||
{
|
||||
$uid = scrub_in($input['filter']);
|
||||
echo XML_Data::albums(array($uid));
|
||||
|
||||
} // album
|
||||
|
||||
/**
|
||||
|
@ -421,7 +413,6 @@ class Api
|
|||
|
||||
ob_end_clean();
|
||||
echo XML_Data::songs($songs);
|
||||
|
||||
} // album_songs
|
||||
|
||||
/**
|
||||
|
@ -445,7 +436,6 @@ class Api
|
|||
|
||||
ob_end_clean();
|
||||
echo XML_Data::tags($tags);
|
||||
|
||||
} // tags
|
||||
|
||||
/**
|
||||
|
@ -458,7 +448,6 @@ class Api
|
|||
$uid = scrub_in($input['filter']);
|
||||
ob_end_clean();
|
||||
echo XML_Data::tags(array($uid));
|
||||
|
||||
} // tag
|
||||
|
||||
/**
|
||||
|
@ -476,7 +465,6 @@ class Api
|
|||
ob_end_clean();
|
||||
echo XML_Data::artists($artists);
|
||||
}
|
||||
|
||||
} // tag_artists
|
||||
|
||||
/**
|
||||
|
@ -494,7 +482,6 @@ class Api
|
|||
ob_end_clean();
|
||||
echo XML_Data::albums($albums);
|
||||
}
|
||||
|
||||
} // tag_albums
|
||||
|
||||
/**
|
||||
|
@ -511,7 +498,6 @@ class Api
|
|||
|
||||
ob_end_clean();
|
||||
echo XML_Data::songs($songs);
|
||||
|
||||
} // tag_songs
|
||||
|
||||
/**
|
||||
|
@ -538,7 +524,6 @@ class Api
|
|||
|
||||
ob_end_clean();
|
||||
echo XML_Data::songs($songs);
|
||||
|
||||
} // songs
|
||||
|
||||
/**
|
||||
|
@ -552,7 +537,6 @@ class Api
|
|||
|
||||
ob_end_clean();
|
||||
echo XML_Data::songs(array($uid));
|
||||
|
||||
} // song
|
||||
|
||||
/**
|
||||
|
@ -590,7 +574,6 @@ class Api
|
|||
|
||||
ob_end_clean();
|
||||
echo XML_Data::playlists($playlist_ids);
|
||||
|
||||
} // playlists
|
||||
|
||||
/**
|
||||
|
@ -604,7 +587,6 @@ class Api
|
|||
|
||||
ob_end_clean();
|
||||
echo XML_Data::playlists(array($uid));
|
||||
|
||||
} // playlist
|
||||
|
||||
/**
|
||||
|
@ -628,7 +610,6 @@ class Api
|
|||
XML_Data::set_limit($input['limit']);
|
||||
ob_end_clean();
|
||||
echo XML_Data::songs($songs,$items);
|
||||
|
||||
} // playlist_songs
|
||||
|
||||
/**
|
||||
|
@ -681,7 +662,6 @@ class Api
|
|||
$playlist->add_songs(array($song));
|
||||
echo XML_Data::single_string('success');
|
||||
}
|
||||
|
||||
} // playlist_add_song
|
||||
|
||||
/**
|
||||
|
@ -700,7 +680,6 @@ class Api
|
|||
$playlist->delete_track_number($track);
|
||||
echo XML_Data::single_string('success');
|
||||
}
|
||||
|
||||
} // playlist_remove_song
|
||||
|
||||
/**
|
||||
|
@ -724,9 +703,40 @@ class Api
|
|||
$results = Search::run($array);
|
||||
|
||||
echo XML_Data::songs($results);
|
||||
|
||||
} // search_songs
|
||||
|
||||
/**
|
||||
* advanced_search
|
||||
* Perform an advanced search given passed rules
|
||||
* @param array $input
|
||||
*/
|
||||
public static function advanced_search($input)
|
||||
{
|
||||
ob_end_clean();
|
||||
|
||||
XML_Data::set_offset($input['offset']);
|
||||
XML_Data::set_limit($input['limit']);
|
||||
|
||||
$results = Search::run($input);
|
||||
|
||||
$type = 'song';
|
||||
if (isset($input['type'])) {
|
||||
$type = $input['type'];
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'artist':
|
||||
echo XML_Data::artists($results);
|
||||
break;
|
||||
case 'album':
|
||||
echo XML_Data::albums($results);
|
||||
break;
|
||||
default:
|
||||
echo XML_Data::songs($results);
|
||||
break;
|
||||
}
|
||||
} // advanced_search
|
||||
|
||||
/**
|
||||
* videos
|
||||
* This returns video objects!
|
||||
|
@ -747,7 +757,6 @@ class Api
|
|||
XML_Data::set_limit($input['limit']);
|
||||
|
||||
echo XML_Data::videos($video_ids);
|
||||
|
||||
} // videos
|
||||
|
||||
/**
|
||||
|
@ -760,8 +769,6 @@ class Api
|
|||
$video_id = scrub_in($input['filter']);
|
||||
|
||||
echo XML_Data::videos(array($video_id));
|
||||
|
||||
|
||||
} // video
|
||||
|
||||
/**
|
||||
|
@ -789,7 +796,6 @@ class Api
|
|||
echo XML_Data::error('405', T_('Invalid Request'));
|
||||
break;
|
||||
} // end switch on command
|
||||
|
||||
} // localplay
|
||||
|
||||
/**
|
||||
|
@ -851,7 +857,6 @@ class Api
|
|||
echo XML_Data::error('405', T_('Invalid Request'));
|
||||
break;
|
||||
} // switch on method
|
||||
|
||||
} // democratic
|
||||
|
||||
/**
|
||||
|
@ -868,11 +873,14 @@ class Api
|
|||
$albums = null;
|
||||
if ($type == "newest") {
|
||||
$albums = Stats::get_newest("album", $limit, $offset);
|
||||
} else if ($type == "highest") {
|
||||
} else {
|
||||
if ($type == "highest") {
|
||||
$albums = Rating::get_highest("album", $limit, $offset);
|
||||
} else if ($type == "frequent") {
|
||||
} else {
|
||||
if ($type == "frequent") {
|
||||
$albums = Stats::get_top("album", $limit, '', $offset);
|
||||
} else if ($type == "recent") {
|
||||
} else {
|
||||
if ($type == "recent") {
|
||||
if (!empty($username)) {
|
||||
$user = User::get_from_username($username);
|
||||
if ($user !== null) {
|
||||
|
@ -883,7 +891,8 @@ class Api
|
|||
} else {
|
||||
$albums = Stats::get_recent("album", $limit, $offset);
|
||||
}
|
||||
} else if ($type == "flagged") {
|
||||
} else {
|
||||
if ($type == "flagged") {
|
||||
$albums = Userflag::get_latest('album');
|
||||
} else {
|
||||
if (!$limit) {
|
||||
|
@ -891,6 +900,10 @@ class Api
|
|||
}
|
||||
$albums = Album::get_random($limit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($albums !== null) {
|
||||
ob_end_clean();
|
||||
|
@ -971,6 +984,30 @@ class Api
|
|||
}
|
||||
} // following
|
||||
|
||||
/**
|
||||
* toggle_follow
|
||||
* This follow/unfollow an user
|
||||
* @param array $input
|
||||
*/
|
||||
public static function toggle_follow($input)
|
||||
{
|
||||
if (AmpConfig::get('sociable')) {
|
||||
$username = $input['username'];
|
||||
if (!empty($username)) {
|
||||
$user = User::get_from_username($username);
|
||||
if ($user !== null) {
|
||||
$GLOBALS['user']->toggle_follow($user->id);
|
||||
ob_end_clean();
|
||||
echo XML_Data::single_string('success');
|
||||
}
|
||||
} else {
|
||||
debug_event('api', 'Username to toggle required on follow function call.', 1);
|
||||
}
|
||||
} else {
|
||||
debug_event('api', 'Sociable feature is not enabled.', 3);
|
||||
}
|
||||
} // toggle_follow
|
||||
|
||||
/**
|
||||
* last_shouts
|
||||
* This get the latest posted shouts
|
||||
|
@ -997,4 +1034,80 @@ class Api
|
|||
}
|
||||
} // last_shouts
|
||||
|
||||
/**
|
||||
* rate
|
||||
* This rate a library item
|
||||
* @param array $input
|
||||
*/
|
||||
public static function rate($input)
|
||||
{
|
||||
ob_end_clean();
|
||||
$type = $input['type'];
|
||||
$id = $input['id'];
|
||||
$rating = $input['rating'];
|
||||
|
||||
if (!Core::is_library_item($type) || !$id) {
|
||||
echo XML_Data::error('401', T_('Wrong library item type.'));
|
||||
} else {
|
||||
$item = new $type($id);
|
||||
if (!$item->id) {
|
||||
echo XML_Data::error('404', T_('Library item not found.'));
|
||||
} else {
|
||||
$r = new Rating($id, $type);
|
||||
$r->set_rating($rating);
|
||||
echo XML_Data::single_string('success');
|
||||
}
|
||||
}
|
||||
} // rate
|
||||
|
||||
/**
|
||||
* timeline
|
||||
* This get an user timeline
|
||||
* @param array $input
|
||||
*/
|
||||
public static function timeline($input)
|
||||
{
|
||||
if (AmpConfig::get('sociable')) {
|
||||
$username = $input['username'];
|
||||
$limit = intval($input['limit']);
|
||||
$since = intval($input['since']);
|
||||
|
||||
if (!empty($username)) {
|
||||
$user = User::get_from_username($username);
|
||||
if ($user !== null) {
|
||||
if (Preference::get_by_user($user->id, 'allow_personal_info_recent')) {
|
||||
$activities = Useractivity::get_activities($user->id, $limit, $since);
|
||||
ob_end_clean();
|
||||
echo XML_Data::timeline($activities);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
debug_event('api', 'Username required on timeline function call.', 1);
|
||||
}
|
||||
} else {
|
||||
debug_event('api', 'Sociable feature is not enabled.', 3);
|
||||
}
|
||||
} // timeline
|
||||
|
||||
/**
|
||||
* timeline
|
||||
* This get current user friends timeline
|
||||
* @param array $input
|
||||
*/
|
||||
public static function friends_timeline($input)
|
||||
{
|
||||
if (AmpConfig::get('sociable')) {
|
||||
$limit = intval($input['limit']);
|
||||
$since = intval($input['since']);
|
||||
|
||||
if ($GLOBALS['user']->id > 0) {
|
||||
$activities = Useractivity::get_friends_activities($GLOBALS['user']->id, $limit, $since);
|
||||
ob_end_clean();
|
||||
echo XML_Data::timeline($activities);
|
||||
}
|
||||
} else {
|
||||
debug_event('api', 'Sociable feature is not enabled.', 3);
|
||||
}
|
||||
} // friends_timeline
|
||||
} // API class
|
||||
|
||||
|
|
|
@ -2,26 +2,26 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
use MusicBrainz\MusicBrainz;
|
||||
use MusicBrainz\Clients\RequestsMbClient;
|
||||
use MusicBrainz\HttpAdapters\RequestsHttpAdapter;
|
||||
|
||||
/**
|
||||
* Art Class
|
||||
|
@ -81,14 +81,19 @@ class Art extends database_object
|
|||
*/
|
||||
public function __construct($uid, $type = 'album', $kind = 'default')
|
||||
{
|
||||
if (!Core::is_library_item($type))
|
||||
if (!Art::is_valid_type($type)) {
|
||||
return false;
|
||||
}
|
||||
$this->type = $type;
|
||||
$this->uid = intval($uid);
|
||||
$this->kind = $kind;
|
||||
|
||||
} // constructor
|
||||
|
||||
public static function is_valid_type($type)
|
||||
{
|
||||
return (Core::is_library_item($type) || $type == 'user');
|
||||
}
|
||||
|
||||
/**
|
||||
* build_cache
|
||||
* This attempts to reduce # of queries by asking for everything in the
|
||||
|
@ -99,7 +104,9 @@ class Art extends database_object
|
|||
*/
|
||||
public static function build_cache($object_ids)
|
||||
{
|
||||
if (!is_array($object_ids) || !count($object_ids)) { return false; }
|
||||
if (!is_array($object_ids) || !count($object_ids)) {
|
||||
return false;
|
||||
}
|
||||
$uidlist = '(' . implode(',', $object_ids) . ')';
|
||||
$sql = "SELECT `object_type`, `object_id`, `mime`, `size` FROM `image` WHERE `object_id` IN $uidlist";
|
||||
$db_results = Dba::read($sql);
|
||||
|
@ -110,7 +117,6 @@ class Art extends database_object
|
|||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // build_cache
|
||||
|
||||
/**
|
||||
|
@ -173,10 +179,11 @@ class Art extends database_object
|
|||
$data = explode("/", $mime);
|
||||
$extension = $data['1'];
|
||||
|
||||
if ($extension == 'jpeg') { $extension = 'jpg'; }
|
||||
if ($extension == 'jpeg') {
|
||||
$extension = 'jpg';
|
||||
}
|
||||
|
||||
return $extension;
|
||||
|
||||
} // extension
|
||||
|
||||
/**
|
||||
|
@ -202,7 +209,7 @@ class Art extends database_object
|
|||
// Check to make sure PHP:GD exists. If so, we can sanity check
|
||||
// the image.
|
||||
if (function_exists('ImageCreateFromString')) {
|
||||
$image = ImageCreateFromString($source);
|
||||
$image = @ImageCreateFromString($source);
|
||||
if (!$image || imagesx($image) < 5 || imagesy($image) < 5) {
|
||||
debug_event('Art', 'Image failed PHP-GD test',1);
|
||||
$test = false;
|
||||
|
@ -234,7 +241,6 @@ class Art extends database_object
|
|||
} else {
|
||||
return $this->thumb;
|
||||
}
|
||||
|
||||
} // get
|
||||
|
||||
|
||||
|
@ -258,7 +264,8 @@ class Art extends database_object
|
|||
$this->raw = $results['image'];
|
||||
}
|
||||
$this->raw_mime = $results['mime'];
|
||||
} else if (AmpConfig::get('resize_images') && $results['size'] == '275x275') {
|
||||
} else {
|
||||
if (AmpConfig::get('resize_images') && $results['size'] == '275x275') {
|
||||
if (AmpConfig::get('album_art_store_disk')) {
|
||||
$this->thumb = self::read_from_dir($results['size'], $this->type, $this->uid, $this->kind);
|
||||
} else {
|
||||
|
@ -266,10 +273,13 @@ class Art extends database_object
|
|||
}
|
||||
$this->raw_mime = $results['mime'];
|
||||
}
|
||||
}
|
||||
$this->id = $results['id'];
|
||||
}
|
||||
// If we get nothing return false
|
||||
if (!$this->raw) { return false; }
|
||||
if (!$this->raw) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there is no thumb and we want thumbs
|
||||
if (!$this->thumb && AmpConfig::get('resize_images')) {
|
||||
|
@ -286,7 +296,6 @@ class Art extends database_object
|
|||
} // if no thumb, but art and we want to resize
|
||||
|
||||
return true;
|
||||
|
||||
} // get_db
|
||||
|
||||
/**
|
||||
|
@ -345,7 +354,9 @@ class Art extends database_object
|
|||
public function insert($source, $mime = '')
|
||||
{
|
||||
// Disabled in demo mode cause people suck and upload porn
|
||||
if (AmpConfig::get('demo_mode')) { return false; }
|
||||
if (AmpConfig::get('demo_mode')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check to make sure we like this image
|
||||
if (!self::test_image($source)) {
|
||||
|
@ -379,6 +390,7 @@ class Art extends database_object
|
|||
$ndata['APIC']['mime'] = $mime;
|
||||
$ndata = array_merge($ndata, $song->get_metadata());
|
||||
$id3->write_id3($ndata);
|
||||
Catalog::update_media_from_tags($song);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +416,6 @@ class Art extends database_object
|
|||
Dba::write($sql, array($source, $mime, $sizetext, $width, $height, $this->type, $this->uid, $this->kind));
|
||||
|
||||
return true;
|
||||
|
||||
} // insert
|
||||
|
||||
public static function check_dimensions($dimensions)
|
||||
|
@ -432,7 +443,7 @@ class Art extends database_object
|
|||
return true;
|
||||
}
|
||||
|
||||
private static function get_dir_on_disk($type, $uid, $kind = '', $autocreate = false)
|
||||
public static function get_dir_on_disk($type, $uid, $kind = '', $autocreate = false)
|
||||
{
|
||||
$path = AmpConfig::get('local_metadata_dir');
|
||||
if (!$path) {
|
||||
|
@ -521,9 +532,13 @@ class Art extends database_object
|
|||
|
||||
if (Core::is_readable($path)) {
|
||||
foreach (scandir($path) as $file) {
|
||||
if ('.' === $file || '..' === $file) continue;
|
||||
elseif (is_dir($path . '/' . $file)) self::delete_rec_dir($path . '/' . $file);
|
||||
else unlink($path . '/' . $file);
|
||||
if ('.' === $file || '..' === $file) {
|
||||
continue;
|
||||
} elseif (is_dir($path . '/' . $file)) {
|
||||
self::delete_rec_dir($path . '/' . $file);
|
||||
} else {
|
||||
unlink($path . '/' . $file);
|
||||
}
|
||||
}
|
||||
rmdir($path);
|
||||
}
|
||||
|
@ -587,9 +602,20 @@ class Art extends database_object
|
|||
|
||||
$results = Dba::fetch_assoc($db_results);
|
||||
if (count($results)) {
|
||||
$image = null;
|
||||
if (AmpConfig::get('album_art_store_disk')) {
|
||||
$image = self::read_from_dir($sizetext, $this->type, $this->uid, $this->kind);
|
||||
} else {
|
||||
$image = $results['image'];
|
||||
}
|
||||
|
||||
if ($image != null) {
|
||||
return array(
|
||||
'thumb' => (AmpConfig::get('album_art_store_disk')) ? self::read_from_dir($sizetext, $this->type, $this->uid, $this->kind) : $results['image'],
|
||||
'thumb_mime' => $results['mime']);
|
||||
} else {
|
||||
debug_event('art', 'Thumb entry found in database but associated data cannot be found.', 3);
|
||||
}
|
||||
}
|
||||
|
||||
// If we didn't get a result
|
||||
|
@ -599,7 +625,6 @@ class Art extends database_object
|
|||
}
|
||||
|
||||
return $results;
|
||||
|
||||
} // get_thumb
|
||||
|
||||
/**
|
||||
|
@ -628,19 +653,19 @@ class Art extends database_object
|
|||
}
|
||||
|
||||
// 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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
return false;
|
||||
}
|
||||
|
@ -702,7 +727,6 @@ class Art extends database_object
|
|||
}
|
||||
|
||||
return array('thumb' => $data, 'thumb_mime' => $mime_type);
|
||||
|
||||
} // generate_thumb
|
||||
|
||||
/**
|
||||
|
@ -772,7 +796,6 @@ class Art extends database_object
|
|||
} // if data song
|
||||
|
||||
return null;
|
||||
|
||||
} // get_from_source
|
||||
|
||||
/**
|
||||
|
@ -786,8 +809,9 @@ class Art extends database_object
|
|||
*/
|
||||
public static function url($uid,$type,$sid=null,$thumb=null)
|
||||
{
|
||||
if (!Core::is_library_item($type))
|
||||
if (!self::is_valid_type($type)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (AmpConfig::get('use_auth') && AmpConfig::get('require_session')) {
|
||||
$sid = $sid ? scrub_out($sid) : scrub_out(session_id());
|
||||
|
@ -816,11 +840,13 @@ class Art extends database_object
|
|||
parent::add_to_cache('art', $key . $row['size'], $row);
|
||||
if ($row['size'] == 'original') {
|
||||
$mime = $row['mime'];
|
||||
} else if ($row['size'] == '275x275' && AmpConfig::get('resize_images')) {
|
||||
} else {
|
||||
if ($row['size'] == '275x275' && AmpConfig::get('resize_images')) {
|
||||
$thumb_mime = $row['mime'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$mime = isset($thumb_mime) ? $thumb_mime : (isset($mime) ? $mime : null);
|
||||
$extension = self::extension($mime);
|
||||
|
@ -846,7 +872,6 @@ class Art extends database_object
|
|||
}
|
||||
|
||||
return $url;
|
||||
|
||||
} // url
|
||||
|
||||
/**
|
||||
|
@ -973,7 +998,8 @@ class Art extends database_object
|
|||
$data = $plugin->_plugin->gather_arts($type, $options, $limit);
|
||||
}
|
||||
}
|
||||
} else if (in_array($method_name, $methods)) {
|
||||
} else {
|
||||
if (in_array($method_name, $methods)) {
|
||||
debug_event('Art', "Method used: $method_name", 3);
|
||||
// Some of these take options!
|
||||
switch ($method_name) {
|
||||
|
@ -990,6 +1016,7 @@ class Art extends database_object
|
|||
} else {
|
||||
debug_event("Art", $method_name . " not defined", 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the results we got to the current set
|
||||
$results = array_merge($results, (array) $data);
|
||||
|
@ -997,11 +1024,9 @@ class Art extends database_object
|
|||
if ($limit && count($results) >= $limit) {
|
||||
return array_slice($results, 0, $limit);
|
||||
}
|
||||
|
||||
} // end foreach
|
||||
|
||||
return $results;
|
||||
|
||||
} // gather
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
@ -1047,7 +1072,7 @@ class Art extends database_object
|
|||
return $images;
|
||||
}
|
||||
|
||||
$mb = new MusicBrainz(new RequestsMbClient());
|
||||
$mb = new MusicBrainz(new RequestsHttpAdapter());
|
||||
$includes = array(
|
||||
'url-rels'
|
||||
);
|
||||
|
@ -1057,7 +1082,7 @@ class Art extends database_object
|
|||
return $images;
|
||||
}
|
||||
|
||||
$asin = $release['asin'];
|
||||
$asin = $release->asin;
|
||||
|
||||
if ($asin) {
|
||||
debug_event('mbz-gatherart', "Found ASIN: " . $asin, '5');
|
||||
|
@ -1173,7 +1198,6 @@ class Art extends database_object
|
|||
} // end foreach
|
||||
|
||||
return $images;
|
||||
|
||||
} // gather_musicbrainz
|
||||
|
||||
/**
|
||||
|
@ -1216,10 +1240,12 @@ class Art extends database_object
|
|||
$song = new Song($song_id);
|
||||
$dirs[] = Core::conv_lc_file( dirname($song->file) );
|
||||
}
|
||||
} else if ($this->type == 'video') {
|
||||
} else {
|
||||
if ($this->type == 'video') {
|
||||
$media = new Video($this->uid);
|
||||
$dirs[] = Core::conv_lc_file( dirname($media->file) );
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($dirs as $dir) {
|
||||
if (isset($processed[$dir])) {
|
||||
|
@ -1232,7 +1258,7 @@ class Art extends database_object
|
|||
$handle = opendir($dir);
|
||||
|
||||
if (!$handle) {
|
||||
Error::add('general', T_('Error: Unable to open') . ' ' . $dir);
|
||||
AmpError::add('general', T_('Error: Unable to open') . ' ' . $dir);
|
||||
debug_event('folder_art', "Error: Unable to open $dir for album art read", 2);
|
||||
continue;
|
||||
}
|
||||
|
@ -1284,10 +1310,8 @@ class Art extends database_object
|
|||
'mime' => 'image/' . $extension,
|
||||
'title' => 'Folder'
|
||||
);
|
||||
|
||||
} // end while reading dir
|
||||
closedir($handle);
|
||||
|
||||
} // end foreach dirs
|
||||
|
||||
if (is_array($preferred)) {
|
||||
|
@ -1302,7 +1326,6 @@ class Art extends database_object
|
|||
}
|
||||
|
||||
return array_values($results);
|
||||
|
||||
} // gather_folder
|
||||
|
||||
/**
|
||||
|
@ -1376,7 +1399,9 @@ class Art extends database_object
|
|||
$mtype = strtolower(get_class($media));
|
||||
$data = array();
|
||||
$getID3 = new getID3();
|
||||
try { $id3 = $getID3->analyze($media->file); } catch (Exception $error) {
|
||||
try {
|
||||
$id3 = $getID3->analyze($media->file);
|
||||
} catch (Exception $error) {
|
||||
debug_event('getid3', $error->getMessage(), 1);
|
||||
}
|
||||
|
||||
|
@ -1411,7 +1436,6 @@ class Art extends database_object
|
|||
}
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1452,16 +1476,16 @@ class Art extends database_object
|
|||
$mime = 'image/' . $results['extension'];
|
||||
|
||||
$images[] = array('url' => $match, 'mime' => $mime, 'title' => 'Google');
|
||||
if ($limit > 0 && count($images) >= $limit)
|
||||
if ($limit > 0 && count($images) >= $limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
debug_event('Art', 'Error getting google images: ' . $e->getMessage(), '1');
|
||||
}
|
||||
|
||||
return $images;
|
||||
|
||||
} // gather_google
|
||||
|
||||
/**
|
||||
|
@ -1487,15 +1511,24 @@ class Art extends database_object
|
|||
try {
|
||||
$xmldata = Recommendation::album_search($data['artist'], $data['album']);
|
||||
|
||||
if (!count($xmldata)) { return array(); }
|
||||
if (!count($xmldata)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$coverart = (array) $xmldata->coverart;
|
||||
if (!$coverart) { return array(); }
|
||||
$xalbum = $xmldata->album;
|
||||
if (!$xalbum) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$coverart = (array) $xalbum->image;
|
||||
if (!$coverart) {
|
||||
return array();
|
||||
}
|
||||
|
||||
ksort($coverart);
|
||||
foreach ($coverart as $url) {
|
||||
// We need to check the URL for the /noimage/ stuff
|
||||
if (strpos($url, '/noimage/') !== false) {
|
||||
if (is_array($url) || strpos($url, '/noimage/') !== false) {
|
||||
debug_event('LastFM', 'Detected as noimage, skipped ' . $url, 3);
|
||||
continue;
|
||||
}
|
||||
|
@ -1513,7 +1546,6 @@ class Art extends database_object
|
|||
}
|
||||
|
||||
return $images;
|
||||
|
||||
} // gather_lastfm
|
||||
|
||||
/**
|
||||
|
@ -1608,11 +1640,6 @@ class Art extends database_object
|
|||
$size['height'] = 80;
|
||||
$size['width'] = 80;
|
||||
break;
|
||||
case 4:
|
||||
/* Web Player size */
|
||||
$size['height'] = 200;
|
||||
$size['width'] = 200; // 200px width, set via CSS
|
||||
break;
|
||||
case 5:
|
||||
/* Web Player size */
|
||||
$size['height'] = 32;
|
||||
|
@ -1643,9 +1670,13 @@ class Art extends database_object
|
|||
$size['height'] = 24;
|
||||
$size['width'] = 24;
|
||||
break;
|
||||
case 4:
|
||||
/* Popup Web Player size */
|
||||
case 11:
|
||||
/* Large view browse size */
|
||||
default:
|
||||
$size['height'] = 275;
|
||||
$size['width'] = 275;
|
||||
$size['height'] = 200;
|
||||
$size['width'] = 200;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1661,7 +1692,7 @@ class Art extends database_object
|
|||
*/
|
||||
public static function display_item($item, $thumb, $link = null)
|
||||
{
|
||||
return self::display($item->type, $item->id, $item->get_fullname(), $thumb, $link);
|
||||
return self::display($item->type ?: strtolower(get_class($item)), $item->id, $item->get_fullname(), $thumb, $link);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1677,8 +1708,9 @@ class Art extends database_object
|
|||
*/
|
||||
public static function display($object_type, $object_id, $name, $thumb, $link = null, $show_default = true, $kind = 'default')
|
||||
{
|
||||
if (!Core::is_library_item($object_type))
|
||||
if (!self::is_valid_type($object_type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$show_default) {
|
||||
// Don't show any image if not available
|
||||
|
@ -1707,14 +1739,22 @@ class Art extends database_object
|
|||
if ($kind != 'default') {
|
||||
$imgurl .= '&kind=' . $kind;
|
||||
}
|
||||
// This to keep browser cache feature but force a refresh in case image just changed
|
||||
if (Art::has_db($object_id, $object_type)) {
|
||||
$art = new Art($object_id, $object_type);
|
||||
if ($art->get_db()) {
|
||||
$imgurl .= '&fooid=' . $art->id;
|
||||
}
|
||||
}
|
||||
echo "<img src=\"" . $imgurl . "\" alt=\"" . $name . "\" height=\"" . $size['height'] . "\" width=\"" . $size['width'] . "\" />";
|
||||
if ($prettyPhoto) {
|
||||
if ($size['width'] >= 150) {
|
||||
|
||||
if ($size['height'] > 150) {
|
||||
echo "<div class=\"item_art_play\">";
|
||||
echo Ajax::text('?page=stream&action=directplay&object_type=' . $object_type . '&object_id=' . $object_id . '\' + getPagePlaySettings() + \'', '<span class="item_art_play_icon" title="' . T_('Play') . '" />', 'directplay_art_' . $object_type . '_' .$object_id);
|
||||
echo Ajax::text('?page=stream&action=directplay&object_type=' . $object_type . '&object_id=' . $object_id . '\' + getPagePlaySettings() + \'', '<span class="item_art_play_icon" title="' . T_('Play') . '" />', 'directplay_art_' . $object_type . '_' . $object_id);
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
if ($prettyPhoto) {
|
||||
$libitem = new $object_type($object_id);
|
||||
echo "<div class=\"item_art_actions\">";
|
||||
if ($GLOBALS['user']->has_access(50) || ($GLOBALS['user']->has_access(25) && $GLOBALS['user']->id == $libitem->get_user_owner())) {
|
||||
|
@ -1728,10 +1768,11 @@ class Art extends database_object
|
|||
}
|
||||
echo"</div>";
|
||||
}
|
||||
|
||||
echo "</a>\n";
|
||||
echo "</div>";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // Art
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -76,6 +76,10 @@ class Artist extends database_object implements library_item
|
|||
* @var int $user
|
||||
*/
|
||||
public $user;
|
||||
/**
|
||||
* @var boolean $manual_update
|
||||
*/
|
||||
public $manual_update;
|
||||
|
||||
/**
|
||||
* @var array $tags
|
||||
|
@ -139,7 +143,9 @@ class Artist extends database_object implements library_item
|
|||
public function __construct($id=null,$catalog_init=0)
|
||||
{
|
||||
/* If they failed to pass in an id, just run for it */
|
||||
if (!$id) { return false; }
|
||||
if (!$id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->catalog_id = $catalog_init;
|
||||
/* Get the information from the db */
|
||||
|
@ -150,7 +156,6 @@ class Artist extends database_object implements library_item
|
|||
} // foreach info
|
||||
|
||||
return true;
|
||||
|
||||
} //constructor
|
||||
|
||||
/**
|
||||
|
@ -171,7 +176,6 @@ class Artist extends database_object implements library_item
|
|||
$artist->_fake = true;
|
||||
|
||||
return $artist;
|
||||
|
||||
} // construct_from_array
|
||||
|
||||
/**
|
||||
|
@ -196,7 +200,9 @@ class Artist extends database_object implements library_item
|
|||
*/
|
||||
public static function build_cache($ids, $extra=false, $limit_threshold = '')
|
||||
{
|
||||
if (!is_array($ids) OR !count($ids)) { return false; }
|
||||
if (!is_array($ids) or !count($ids)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$idlist = '(' . implode(',', $ids) . ')';
|
||||
|
||||
|
@ -220,11 +226,9 @@ class Artist extends database_object implements library_item
|
|||
}
|
||||
parent::add_to_cache('artist_extra',$row['artist'],$row);
|
||||
}
|
||||
|
||||
} // end if extra
|
||||
|
||||
return true;
|
||||
|
||||
} // build_cache
|
||||
|
||||
/**
|
||||
|
@ -243,7 +247,6 @@ class Artist extends database_object implements library_item
|
|||
$object = new Artist($row['id']);
|
||||
|
||||
return $object;
|
||||
|
||||
} // get_from_name
|
||||
|
||||
/**
|
||||
|
@ -280,19 +283,18 @@ class Artist extends database_object implements library_item
|
|||
$sql_sort = '`album`.`name` DESC';
|
||||
}
|
||||
|
||||
$sql_group_type = '`album`.`id`';
|
||||
if (!$ignoreAlbumGroups && AmpConfig::get('album_group')) {
|
||||
$sql_group_type = '`album`.`mbid`';
|
||||
if (!$ignoreAlbumGroups) {
|
||||
$ignoreAlbumGroups = !AmpConfig::get('album_group');
|
||||
}
|
||||
$sql_group = "COALESCE($sql_group_type, `album`.`id`)";
|
||||
|
||||
$sql = "SELECT `album`.`id`, `album`.`release_type` FROM album LEFT JOIN `song` ON `song`.`album`=`album`.`id` $catalog_join " .
|
||||
"WHERE (`song`.`artist`='$this->id' OR `album`.`album_artist`='$this->id') $catalog_where GROUP BY $sql_group ORDER BY $sql_sort";
|
||||
$sql = "SELECT `album`.`id`, `album`.`release_type`,`album`.`mbid` FROM album LEFT JOIN `song` ON `song`.`album`=`album`.`id` $catalog_join " .
|
||||
"WHERE (`song`.`artist`='$this->id' OR `album`.`album_artist`='$this->id') $catalog_where GROUP BY `album`.`id`, `album`.`release_type`,`album`.`mbid` ORDER BY $sql_sort";
|
||||
|
||||
debug_event("Artist", "$sql", "6");
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
$mbids = array();
|
||||
while ($r = Dba::fetch_assoc($db_results)) {
|
||||
if ($ignoreAlbumGroups || empty($r['mbid']) || !in_array($r['mbid'], $mbids)) {
|
||||
if ($group_release_type) {
|
||||
// We assume undefined release type is album
|
||||
$rtype = $r['release_type'] ?: 'album';
|
||||
|
@ -318,10 +320,13 @@ class Artist extends database_object implements library_item
|
|||
} else {
|
||||
$results[] = $r['id'];
|
||||
}
|
||||
if (!empty($r['mbid'])) {
|
||||
$mbids[] = $r['mbid'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
||||
} // get_albums
|
||||
|
||||
/**
|
||||
|
@ -348,7 +353,6 @@ class Artist extends database_object implements library_item
|
|||
}
|
||||
|
||||
return $results;
|
||||
|
||||
} // get_songs
|
||||
|
||||
/**
|
||||
|
@ -376,7 +380,6 @@ class Artist extends database_object implements library_item
|
|||
}
|
||||
|
||||
return $results;
|
||||
|
||||
} // get_random_songs
|
||||
|
||||
/**
|
||||
|
@ -391,20 +394,30 @@ class Artist extends database_object implements library_item
|
|||
if (parent::is_cached('artist_extra',$this->id) ) {
|
||||
$row = parent::get_from_cache('artist_extra',$this->id);
|
||||
} else {
|
||||
$uid = Dba::escape($this->id);
|
||||
$sql = "SELECT `song`.`artist`,COUNT(DISTINCT `song`.`id`) AS `song_count`, COUNT(DISTINCT `song`.`album`) AS `album_count`, SUM(`song`.`time`) AS `time`, `song`.`catalog` as `catalog_id` FROM `song` LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` " .
|
||||
"WHERE `song`.`artist`='$uid' ";
|
||||
$params = array($this->id);
|
||||
// Calculation
|
||||
$sql = "SELECT COUNT(DISTINCT `song`.`id`) AS `song_count`, COUNT(DISTINCT `song`.`album`) AS `album_count`, SUM(`song`.`time`) AS `time` FROM `song` LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` ";
|
||||
$sqlw = "WHERE `song`.`artist` = ? ";
|
||||
if ($catalog) {
|
||||
$sql .= "AND (`song`.`catalog` = '$catalog') ";
|
||||
$params[] = $catalog;
|
||||
$sqlw .= "AND (`song`.`catalog` = ?) ";
|
||||
}
|
||||
if (AmpConfig::get('catalog_disable')) {
|
||||
$sql .= " AND `catalog`.`enabled` = '1'";
|
||||
$sqlw .= " AND `catalog`.`enabled` = '1' ";
|
||||
}
|
||||
$sql .= $sqlw . "GROUP BY `song`.`artist`";
|
||||
|
||||
$sql .= "GROUP BY `song`.`artist`";
|
||||
|
||||
$db_results = Dba::read($sql);
|
||||
$db_results = Dba::read($sql, $params);
|
||||
$row = Dba::fetch_assoc($db_results);
|
||||
|
||||
|
||||
// Get associated information from first song only
|
||||
$sql = "SELECT `song`.`artist`, `song`.`catalog` as `catalog_id` FROM `song` LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog` ";
|
||||
$sql .= $sqlw . "LIMIT 1";
|
||||
|
||||
$db_results = Dba::read($sql, $params);
|
||||
$row = array_merge($row, Dba::fetch_assoc($db_results));
|
||||
|
||||
if (AmpConfig::get('show_played_times')) {
|
||||
$row['object_cnt'] = Stats::get_object_count('artist', $row['artist'], $limit_threshold);
|
||||
}
|
||||
|
@ -418,7 +431,6 @@ class Artist extends database_object implements library_item
|
|||
$this->catalog_id = $row['catalog_id'];
|
||||
|
||||
return $row;
|
||||
|
||||
} // _get_extra_info
|
||||
|
||||
/**
|
||||
|
@ -437,7 +449,9 @@ class Artist extends database_object implements library_item
|
|||
$this->f_full_name = trim(trim($this->prefix) . ' ' . trim($this->name));
|
||||
|
||||
// If this is a memory-only object, we're done here
|
||||
if (!$this->id) { return true; }
|
||||
if (!$this->id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->catalog_id) {
|
||||
$this->link = AmpConfig::get('web_path') . '/artists.php?action=show&catalog=' . $this->catalog_id . '&artist=' . $this->id;
|
||||
|
@ -471,7 +485,6 @@ class Artist extends database_object implements library_item
|
|||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // format
|
||||
|
||||
/**
|
||||
|
@ -627,13 +640,15 @@ class Artist extends database_object implements library_item
|
|||
$user = $GLOBALS['user']->id;
|
||||
}
|
||||
|
||||
if (!$user)
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AmpConfig::get('upload_allow_edit')) {
|
||||
if ($this->user !== null && $user == $this->user)
|
||||
if ($this->user !== null && $user == $this->user) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return Access::check('interface', 50, $user);
|
||||
}
|
||||
|
@ -652,8 +667,13 @@ class Artist extends database_object implements library_item
|
|||
$trimmed = Catalog::trim_prefix(trim($name));
|
||||
$name = $trimmed['string'];
|
||||
$prefix = $trimmed['prefix'];
|
||||
// If Ampache support multiple artists per song one day, we should also handle other artists here
|
||||
$trimmed = Catalog::trim_featuring($name);
|
||||
$name = $trimmed[0];
|
||||
|
||||
if ($mbid == '') $mbid = null;
|
||||
if ($mbid == '') {
|
||||
$mbid = null;
|
||||
}
|
||||
|
||||
if (!$name) {
|
||||
$name = T_('Unknown (Orphaned)');
|
||||
|
@ -725,7 +745,6 @@ class Artist extends database_object implements library_item
|
|||
|
||||
self::$_mapcache[$name][$mbid] = $id;
|
||||
return $id;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -772,11 +791,14 @@ class Artist extends database_object implements library_item
|
|||
Stats::gc();
|
||||
Rating::gc();
|
||||
Userflag::gc();
|
||||
Useractivity::gc();
|
||||
} // if updated
|
||||
} else if ($this->mbid != $mbid) {
|
||||
} else {
|
||||
if ($this->mbid != $mbid) {
|
||||
$sql = 'UPDATE `artist` SET `mbid` = ? WHERE `id` = ?';
|
||||
Dba::write($sql, array($mbid, $current_id));
|
||||
}
|
||||
}
|
||||
|
||||
// Update artist name (if we don't want to use the MusicBrainz name)
|
||||
$trimmed = Catalog::trim_prefix(trim($name));
|
||||
|
@ -786,7 +808,7 @@ class Artist extends database_object implements library_item
|
|||
Dba::write($sql, array($name, $current_id));
|
||||
}
|
||||
|
||||
$this->update_artist_info($summary, $placeformed, $yearformed);
|
||||
$this->update_artist_info($summary, $placeformed, $yearformed, true);
|
||||
|
||||
$this->name = $name;
|
||||
$this->mbid = $mbid;
|
||||
|
@ -810,7 +832,6 @@ class Artist extends database_object implements library_item
|
|||
}
|
||||
|
||||
return $current_id;
|
||||
|
||||
} // update
|
||||
|
||||
/**
|
||||
|
@ -845,10 +866,10 @@ class Artist extends database_object implements library_item
|
|||
* @param int $yearformed
|
||||
* @return boolean
|
||||
*/
|
||||
public function update_artist_info($summary, $placeformed, $yearformed)
|
||||
public function update_artist_info($summary, $placeformed, $yearformed, $manual = false)
|
||||
{
|
||||
$sql = "UPDATE `artist` SET `summary` = ?, `placeformed` = ?, `yearformed` = ?, `last_update` = ? WHERE `id` = ?";
|
||||
$sqlret = Dba::write($sql, array($summary, $placeformed, $yearformed, time(), $this->id));
|
||||
$sql = "UPDATE `artist` SET `summary` = ?, `placeformed` = ?, `yearformed` = ?, `last_update` = ?, `manual_update` = ? WHERE `id` = ?";
|
||||
$sqlret = Dba::write($sql, array($summary, $placeformed, Catalog::normalize_year($yearformed), time(), $manual ? 1 : 0, $this->id));
|
||||
|
||||
$this->summary = $summary;
|
||||
$this->placeformed = $placeformed;
|
||||
|
@ -876,7 +897,7 @@ class Artist extends database_object implements library_item
|
|||
$album = new Album($id);
|
||||
$deleted = $album->remove_from_disk();
|
||||
if (!$deleted) {
|
||||
debug_event('artist', 'Error when deleting the album `' . $id .'`.', 1);
|
||||
debug_event('artist', 'Error when deleting the album `' . $id . '`.', 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -889,10 +910,11 @@ class Artist extends database_object implements library_item
|
|||
Userflag::gc('artist', $this->id);
|
||||
Rating::gc('artist', $this->id);
|
||||
Shoutbox::gc('artist', $this->id);
|
||||
Useractivity::gc('artist', $this->id);
|
||||
}
|
||||
}
|
||||
|
||||
return $deleted;
|
||||
}
|
||||
|
||||
} // end of artist class
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -85,5 +85,5 @@ class Artist_Event
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // end of recommendation class
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -100,7 +100,9 @@ class Auth
|
|||
}
|
||||
|
||||
$results = self::$function_name($username, $password);
|
||||
if ($results['success'] || ($allow_ui && !empty($results['ui_required']))) { break; }
|
||||
if ($results['success'] || ($allow_ui && !empty($results['ui_required']))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
@ -234,7 +236,7 @@ class Auth
|
|||
), $pipes);
|
||||
|
||||
if (is_resource($proc)) {
|
||||
fwrite($pipes[0], $username."\n".$password."\n");
|
||||
fwrite($pipes[0], $username . "\n" . $password . "\n");
|
||||
fclose($pipes[0]);
|
||||
fclose($pipes[1]);
|
||||
if ($stderr = fread($pipes[2], 8192)) {
|
||||
|
@ -305,7 +307,7 @@ class Auth
|
|||
return $results;
|
||||
}
|
||||
|
||||
if (strpos($ldap_filter, "%v") >= 0) {
|
||||
if (strpos($ldap_filter, "%v") !== false) {
|
||||
$ldap_filter = str_replace("%v", $username, $ldap_filter);
|
||||
} else {
|
||||
// This to support previous configuration where only the fieldname was set
|
||||
|
@ -377,11 +379,8 @@ class Auth
|
|||
$results['email'] = $info[0][$ldap_email_field][0];
|
||||
|
||||
return $results;
|
||||
|
||||
} // if we get something good back
|
||||
|
||||
} // if something was sent back
|
||||
|
||||
} // if failed connect
|
||||
|
||||
/* Default to bad news */
|
||||
|
@ -389,7 +388,6 @@ class Auth
|
|||
$results['error'] = 'LDAP login attempt failed';
|
||||
|
||||
return $results;
|
||||
|
||||
} // ldap_auth
|
||||
|
||||
/**
|
||||
|
@ -516,10 +514,12 @@ class Auth
|
|||
if ($response->status == Auth_OpenID_CANCEL) {
|
||||
$results['success'] = false;
|
||||
$results['error'] = 'OpenID verification cancelled.';
|
||||
} else if ($response->status == Auth_OpenID_FAILURE) {
|
||||
} else {
|
||||
if ($response->status == Auth_OpenID_FAILURE) {
|
||||
$results['success'] = false;
|
||||
$results['error'] = 'OpenID authentication failed: ' . $response->message;
|
||||
} else if ($response->status == Auth_OpenID_SUCCESS) {
|
||||
} else {
|
||||
if ($response->status == Auth_OpenID_SUCCESS) {
|
||||
// Extract the identity URL and Simple Registration data (if it was returned).
|
||||
$sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response);
|
||||
$sreg = $sreg_resp->contents();
|
||||
|
@ -567,6 +567,8 @@ class Auth
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -243,12 +243,27 @@ class AutoUpdate
|
|||
*/
|
||||
public static function update_files()
|
||||
{
|
||||
echo T_('Updating Ampache sources with `git pull` ...') . '<br />';
|
||||
$cmd = 'git pull https://github.com/ampache/ampache.git';
|
||||
echo T_('Updating Ampache sources with `' . $cmd . '` ...') . '<br />';
|
||||
ob_flush();
|
||||
chdir(AmpConfig::get('prefix'));
|
||||
exec('git pull https://github.com/ampache/ampache.git');
|
||||
exec($cmd);
|
||||
echo T_('Done') . '<br />';
|
||||
ob_flush();
|
||||
self::get_latest_version(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update project dependencies.
|
||||
*/
|
||||
public static function update_dependencies()
|
||||
{
|
||||
$cmd = 'composer install --prefer-source --no-interaction';
|
||||
echo T_('Updating dependencies with `' . $cmd . '` ...') . '<br />';
|
||||
ob_flush();
|
||||
chdir(AmpConfig::get('prefix'));
|
||||
exec($cmd);
|
||||
echo T_('Done') . '<br />';
|
||||
ob_flush();
|
||||
}
|
||||
}
|
||||
|
|
156
sources/lib/class/bookmark.class.php
Normal file
156
sources/lib/class/bookmark.class.php
Normal file
|
@ -0,0 +1,156 @@
|
|||
<?php
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Bookmark class
|
||||
*
|
||||
* This manage bookmark on playable items
|
||||
*
|
||||
*/
|
||||
class Bookmark extends database_object
|
||||
{
|
||||
// Public variables
|
||||
public $id;
|
||||
public $user;
|
||||
public $object_id;
|
||||
public $object_type;
|
||||
public $position;
|
||||
public $comment;
|
||||
public $creation_date;
|
||||
public $update_date;
|
||||
|
||||
public $f_user;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* This is run every time a new object is created, and requires
|
||||
* the id and type of object that we need to pull for
|
||||
*/
|
||||
public function __construct ($object_id, $object_type = null, $user_id = null)
|
||||
{
|
||||
if (!$object_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$object_type) {
|
||||
$info = $this->get_info($object_id);
|
||||
} else {
|
||||
if ($user_id == null) {
|
||||
$user_id = $GLOBALS['user']->id;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `bookmark` WHERE `object_type` = ? AND `object_id` = ? AND `user` = ?";
|
||||
$db_results = Dba::read($sql, array($object_type, $object_id, $user_id));
|
||||
|
||||
if (!$db_results) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$info = Dba::fetch_assoc($db_results);
|
||||
}
|
||||
|
||||
// Foreach what we've got
|
||||
foreach ($info as $key=>$value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* gc
|
||||
*
|
||||
* Remove bookmark for items that no longer exist.
|
||||
*/
|
||||
public static function gc($object_type = null, $object_id = null)
|
||||
{
|
||||
$types = array('song', 'video', 'podcast_episode');
|
||||
|
||||
if ($object_type != null) {
|
||||
if (in_array($object_type, $types)) {
|
||||
$sql = "DELETE FROM `bookmark` WHERE `object_type` = ? AND `object_id` = ?";
|
||||
Dba::write($sql, array($object_type, $object_id));
|
||||
} else {
|
||||
debug_event('bookmark', 'Garbage collect on type `' . $object_type . '` is not supported.', 1);
|
||||
}
|
||||
} else {
|
||||
foreach ($types as $type) {
|
||||
Dba::write("DELETE FROM `bookmark` USING `bookmark` LEFT JOIN `$type` ON `$type`.`id` = `bookmark`.`object_id` WHERE `bookmark`.`object_type` = '$type' AND `$type`.`id` IS NULL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function get_bookmarks_ids($user = null)
|
||||
{
|
||||
$ids = array();
|
||||
if ($user == null) {
|
||||
$user = $GLOBALS['user'];
|
||||
}
|
||||
|
||||
$sql = "SELECT `id` FROM `bookmark` WHERE `user` = ?";
|
||||
$db_results = Dba::read($sql, array($user->id));
|
||||
while ($results = Dba::fetch_assoc($db_results)) {
|
||||
$ids[] = $results['id'];
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
public static function get_bookmarks($user = null)
|
||||
{
|
||||
$bookmarks = array();
|
||||
$ids = self::get_bookmarks_ids($user);
|
||||
foreach ($ids as $id) {
|
||||
$bookmarks[] = new Bookmark($id);
|
||||
}
|
||||
return $bookmarks;
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$user = $data['user'] ?: $GLOBALS['user']->id;
|
||||
$position = $data['position'] ?: 0;
|
||||
$comment = scrub_in($data['comment']);
|
||||
|
||||
$sql = "INSERT INTO `bookmark` (`user`, `position`, `comment`, `object_type`, `object_id`, `creation_date`, `update_date`) VALUES (?, ?, ?, ?, ?, ?, ?)";
|
||||
return Dba::write($sql, array($user, $position, $comment, $data['object_type'], $data['object_id'], time(), time()));
|
||||
}
|
||||
|
||||
public function update($position)
|
||||
{
|
||||
$sql = "UPDATE `bookmark` SET `position` = ?, `update_date` = ? WHERE `id` = ?";
|
||||
return Dba::write($sql, array($position, time(), $this->id));
|
||||
}
|
||||
|
||||
public function remove()
|
||||
{
|
||||
$sql = "DELETE FROM `bookmark` WHERE `id` = ?";
|
||||
return Dba::write($sql, array($this->id));
|
||||
}
|
||||
|
||||
public function format()
|
||||
{
|
||||
$user = new User($this->user);
|
||||
$f_user = $user->username;
|
||||
}
|
||||
} //end bookmark class
|
||||
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -78,7 +78,9 @@ class Broadcast extends database_object implements library_item
|
|||
*/
|
||||
public function __construct($id=0)
|
||||
{
|
||||
if (!$id) { return true; }
|
||||
if (!$id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Get the information from the db */
|
||||
$info = $this->get_info($id);
|
||||
|
@ -354,7 +356,7 @@ class Broadcast extends database_object implements library_item
|
|||
if ($this->id) {
|
||||
if ($GLOBALS['user']->has_access('75')) {
|
||||
echo "<a id=\"edit_broadcast_ " . $this->id . "\" onclick=\"showEditDialog('broadcast_row', '" . $this->id . "', 'edit_broadcast_" . $this->id . "', '" . T_('Broadcast edit') . "', 'broadcast_row_')\">" . UI::get_icon('edit', T_('Edit')) . "</a>";
|
||||
echo " <a href=\"" . AmpConfig::get('web_path') . "/broadcast.php?action=show_delete&id=" . $this->id ."\">" . UI::get_icon('delete', T_('Delete')) . "</a>";
|
||||
echo " <a href=\"" . AmpConfig::get('web_path') . "/broadcast.php?action=show_delete&id=" . $this->id . "\">" . UI::get_icon('delete', T_('Delete')) . "</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +406,6 @@ class Broadcast extends database_object implements library_item
|
|||
|
||||
public static function gc()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -421,5 +422,5 @@ class Broadcast extends database_object implements library_item
|
|||
{
|
||||
return $oid;
|
||||
}
|
||||
|
||||
} // end of broadcast class
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -109,13 +109,13 @@ class Broadcast_Server implements MessageComponentInterface
|
|||
break;
|
||||
default:
|
||||
if ($this->verbose) {
|
||||
echo "[" . time() ."][warning]Unknown message code." . "\r\n";
|
||||
echo "[" . time() . "][warning]Unknown message code." . "\r\n";
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if ($this->verbose) {
|
||||
echo "[" . time() ."][error]Wrong message format (" . $command . ")." . "\r\n";
|
||||
echo "[" . time() . "][error]Wrong message format (" . $command . ")." . "\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ class Broadcast_Server implements MessageComponentInterface
|
|||
$this->broadcastMessage($clients, self::BROADCAST_SONG, base64_encode($this->getSongJS($song_id)));
|
||||
|
||||
if ($this->verbose) {
|
||||
echo "[" . time() ."][info]Broadcast " . $broadcast->id . " now playing song " . $song_id . "." . "\r\n";
|
||||
echo "[" . time() . "][info]Broadcast " . $broadcast->id . " now playing song " . $song_id . "." . "\r\n";
|
||||
}
|
||||
} else {
|
||||
debug_event('broadcast', 'Action unauthorized.', '3');
|
||||
|
@ -180,7 +180,7 @@ class Broadcast_Server implements MessageComponentInterface
|
|||
$broadcast->song_position = $song_position;
|
||||
|
||||
if ($this->verbose) {
|
||||
echo "[" . time() ."][info]Broadcast " . $broadcast->id . " has song position to " . $song_position . "." . "\r\n";
|
||||
echo "[" . time() . "][info]Broadcast " . $broadcast->id . " has song position to " . $song_position . "." . "\r\n";
|
||||
}
|
||||
} else {
|
||||
debug_event('broadcast', 'Action unauthorized.', '3');
|
||||
|
@ -200,7 +200,7 @@ class Broadcast_Server implements MessageComponentInterface
|
|||
$this->broadcastMessage($clients, self::BROADCAST_PLAYER_PLAY, $play ? 'true' : 'false');
|
||||
|
||||
if ($this->verbose) {
|
||||
echo "[" . time() ."][info]Broadcast " . $broadcast->id . " player state: " . $play . "." . "\r\n";
|
||||
echo "[" . time() . "][info]Broadcast " . $broadcast->id . " player state: " . $play . "." . "\r\n";
|
||||
}
|
||||
} else {
|
||||
debug_event('broadcast', 'Action unauthorized.', '3');
|
||||
|
@ -219,7 +219,7 @@ class Broadcast_Server implements MessageComponentInterface
|
|||
$this->broadcastMessage($clients, self::BROADCAST_ENDED);
|
||||
|
||||
if ($this->verbose) {
|
||||
echo "[" . time() ."][info]Broadcast " . $broadcast->id . " ended." . "\r\n";
|
||||
echo "[" . time() . "][info]Broadcast " . $broadcast->id . " ended." . "\r\n";
|
||||
}
|
||||
} else {
|
||||
debug_event('broadcast', 'Action unauthorized.', '3');
|
||||
|
@ -259,7 +259,7 @@ class Broadcast_Server implements MessageComponentInterface
|
|||
unset($this->broadcasters[$conn->resourceId]);
|
||||
|
||||
if ($this->verbose) {
|
||||
echo "[" . time() ."][info]Broadcast " . $broadcast->id . " unregistered." . "\r\n";
|
||||
echo "[" . time() . "][info]Broadcast " . $broadcast->id . " unregistered." . "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -433,10 +433,10 @@ class Broadcast_Server implements MessageComponentInterface
|
|||
{
|
||||
$websocket_address = AmpConfig::get('websocket_address');
|
||||
if (empty($websocket_address)) {
|
||||
$websocket_address = 'ws://' . $_SERVER['HTTP_HOST'] . ':8100';
|
||||
$websocket_address = 'ws://' . $_SERVER['SERVER_NAME'] . ':8100';
|
||||
}
|
||||
|
||||
return $websocket_address . '/broadcast';
|
||||
}
|
||||
|
||||
} // end of broadcast_server class
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -49,6 +49,7 @@ class Browse extends Query
|
|||
if (!$id) {
|
||||
$this->set_use_pages(true);
|
||||
$this->set_use_alpha(false);
|
||||
$this->set_grid_view(true);
|
||||
}
|
||||
$this->show_header = true;
|
||||
}
|
||||
|
@ -63,7 +64,6 @@ class Browse extends Query
|
|||
public function set_simple_browse($value)
|
||||
{
|
||||
$this->set_is_simple($value);
|
||||
|
||||
} // set_simple_browse
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,6 @@ class Browse extends Query
|
|||
$_SESSION['browse']['supplemental'][$this->id][$class] = intval($uid);
|
||||
|
||||
return true;
|
||||
|
||||
} // add_supplemental_object
|
||||
|
||||
/**
|
||||
|
@ -97,7 +96,6 @@ class Browse extends Query
|
|||
}
|
||||
|
||||
return $objects;
|
||||
|
||||
} // get_supplemental_objects
|
||||
|
||||
/**
|
||||
|
@ -113,7 +111,6 @@ class Browse extends Query
|
|||
// Checking if value is suitable
|
||||
$start = $_SESSION[$name]['start'];
|
||||
if ($this->get_offset() > 0) {
|
||||
|
||||
$set_page = floor($start / $this->get_offset());
|
||||
if ($this->get_total() > $this->get_offset()) {
|
||||
$total_pages = ceil($this->get_total() / $this->get_offset());
|
||||
|
@ -155,9 +152,11 @@ class Browse extends Query
|
|||
$this->get_offset(),
|
||||
true
|
||||
);
|
||||
} else if (!count($object_ids)) {
|
||||
} else {
|
||||
if (!count($object_ids)) {
|
||||
$this->set_total(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Load any additional object we need for this
|
||||
$extra_objects = $this->get_supplemental_objects();
|
||||
|
@ -195,7 +194,7 @@ class Browse extends Query
|
|||
|
||||
$argument_param = ($argument ? '&argument=' . scrub_in($argument) : '');
|
||||
|
||||
debug_event('browse', 'Show objects called for type {'.$type.'}', '5');
|
||||
debug_event('browse', 'Show objects called for type {' . $type . '}', '5');
|
||||
|
||||
$limit_threshold = $this->get_threshold();
|
||||
|
||||
|
@ -204,7 +203,7 @@ class Browse extends Query
|
|||
case 'song':
|
||||
$box_title = T_('Songs') . $match;
|
||||
Song::build_cache($object_ids, $limit_threshold);
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_songs.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_songs.inc.php');
|
||||
break;
|
||||
case 'album':
|
||||
Album::build_cache($object_ids);
|
||||
|
@ -217,122 +216,130 @@ class Browse extends Query
|
|||
} else {
|
||||
$allow_group_disks = false;
|
||||
}
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_albums.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_albums.inc.php');
|
||||
break;
|
||||
case 'user':
|
||||
$box_title = T_('Users') . $match;
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_users.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_users.inc.php');
|
||||
break;
|
||||
case 'artist':
|
||||
$box_title = T_('Artists') . $match;
|
||||
Artist::build_cache($object_ids, true, $limit_threshold);
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_artists.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_artists.inc.php');
|
||||
break;
|
||||
case 'live_stream':
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_live_stream.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_live_stream.inc.php');
|
||||
$box_title = T_('Radio Stations') . $match;
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_live_streams.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_live_streams.inc.php');
|
||||
break;
|
||||
case 'playlist':
|
||||
Playlist::build_cache($object_ids);
|
||||
$box_title = T_('Playlists') . $match;
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_playlists.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_playlists.inc.php');
|
||||
break;
|
||||
case 'playlist_song':
|
||||
$box_title = T_('Playlist Songs') . $match;
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_playlist_songs.inc.php';
|
||||
case 'playlist_media':
|
||||
$box_title = T_('Playlist Medias') . $match;
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_playlist_medias.inc.php');
|
||||
break;
|
||||
case 'playlist_localplay':
|
||||
$box_title = T_('Current Playlist');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_localplay_playlist.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_localplay_playlist.inc.php');
|
||||
UI::show_box_bottom();
|
||||
break;
|
||||
case 'smartplaylist':
|
||||
$box_title = T_('Smart Playlists') . $match;
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_searches.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_searches.inc.php');
|
||||
break;
|
||||
case 'catalog':
|
||||
$box_title = T_('Catalogs');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_catalogs.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_catalogs.inc.php');
|
||||
break;
|
||||
case 'shoutbox':
|
||||
$box_title = T_('Shoutbox Records');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_manage_shoutbox.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_manage_shoutbox.inc.php');
|
||||
break;
|
||||
case 'tag':
|
||||
Tag::build_cache($object_ids);
|
||||
$box_title = T_('Tag Cloud');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_tagcloud.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_tagcloud.inc.php');
|
||||
break;
|
||||
case 'video':
|
||||
Video::build_cache($object_ids);
|
||||
$video_type = 'video';
|
||||
$box_title = T_('Videos');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_videos.inc.php');
|
||||
break;
|
||||
case 'democratic':
|
||||
$box_title = T_('Democratic Playlist');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_democratic_playlist.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_democratic_playlist.inc.php');
|
||||
break;
|
||||
case 'wanted':
|
||||
$box_title = T_('Wanted Albums');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_wanted_albums.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_wanted_albums.inc.php');
|
||||
break;
|
||||
case 'share':
|
||||
$box_title = T_('Shared Objects');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_shared_objects.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_shared_objects.inc.php');
|
||||
break;
|
||||
case 'song_preview':
|
||||
$box_title = T_('Songs');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_song_previews.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_song_previews.inc.php');
|
||||
break;
|
||||
case 'channel':
|
||||
$box_title = T_('Channels');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_channels.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_channels.inc.php');
|
||||
break;
|
||||
case 'broadcast':
|
||||
$box_title = T_('Broadcasts');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_broadcasts.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_broadcasts.inc.php');
|
||||
break;
|
||||
case 'license':
|
||||
$box_title = T_('Media Licenses');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_manage_license.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_manage_license.inc.php');
|
||||
break;
|
||||
case 'tvshow':
|
||||
$box_title = T_('TV Shows');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_tvshows.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_tvshows.inc.php');
|
||||
break;
|
||||
case 'tvshow_season':
|
||||
$box_title = T_('Seasons');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_tvshow_seasons.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_tvshow_seasons.inc.php');
|
||||
break;
|
||||
case 'tvshow_episode':
|
||||
$box_title = T_('Episodes');
|
||||
$video_type = $type;
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_videos.inc.php');
|
||||
break;
|
||||
case 'movie':
|
||||
$box_title = T_('Movies');
|
||||
$video_type = $type;
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_videos.inc.php');
|
||||
break;
|
||||
case 'clip':
|
||||
$box_title = T_('Clips');
|
||||
$video_type = $type;
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_videos.inc.php');
|
||||
break;
|
||||
case 'personal_video':
|
||||
$box_title = T_('Personal Videos');
|
||||
$video_type = $type;
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_videos.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_videos.inc.php');
|
||||
break;
|
||||
case 'label':
|
||||
$box_title = T_('Labels');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_labels.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_labels.inc.php');
|
||||
break;
|
||||
case 'pvmsg':
|
||||
$box_title = T_('Private Messages');
|
||||
$box_req = AmpConfig::get('prefix') . '/templates/show_pvmsgs.inc.php';
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_pvmsgs.inc.php');
|
||||
break;
|
||||
case 'podcast':
|
||||
$box_title = T_('Podcasts');
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_podcasts.inc.php');
|
||||
break;
|
||||
case 'podcast_episode':
|
||||
$box_title = T_('Podcast Episodes');
|
||||
$box_req = AmpConfig::get('prefix') . UI::find_template('show_podcast_episodes.inc.php');
|
||||
break;
|
||||
default:
|
||||
// Rien a faire
|
||||
|
@ -363,7 +370,6 @@ class Browse extends Query
|
|||
}
|
||||
}
|
||||
Ajax::end_container();
|
||||
|
||||
} // show_object
|
||||
|
||||
public function show_next_link($argument = null)
|
||||
|
@ -373,7 +379,7 @@ class Browse extends Query
|
|||
$total = $this->get_total();
|
||||
$next_offset = $start + $limit;
|
||||
if ($next_offset <= $total) {
|
||||
echo '<a class="jscroll-next" href="' . AmpConfig::get('ajax_url') . '?page=browse&action=page&browse_id=' . $this->id . '&start=' . $next_offset . '&xoutput=raw&xoutputnode='. $this->get_content_div() . '&show_header=false' . $argument . '">' . T_('More') . '</a>';
|
||||
echo '<a class="jscroll-next" href="' . AmpConfig::get('ajax_url') . '?page=browse&action=page&browse_id=' . $this->id . '&start=' . $next_offset . '&xoutput=raw&xoutputnode=' . $this->get_content_div() . '&show_header=false' . $argument . '">' . T_('More') . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -426,6 +432,10 @@ class Browse extends Query
|
|||
$this->set_filter('regex_not_match', '');
|
||||
}
|
||||
}
|
||||
$cn = 'browse_' . $type . '_grid_view';
|
||||
if (isset($_COOKIE[$cn])) {
|
||||
$this->set_grid_view($_COOKIE[$cn] == 'true');
|
||||
}
|
||||
|
||||
parent::set_type($type, $custom_base);
|
||||
}
|
||||
|
@ -461,6 +471,25 @@ class Browse extends Query
|
|||
return $this->_state['use_pages'];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param boolean $grid_view
|
||||
*/
|
||||
public function set_grid_view($grid_view)
|
||||
{
|
||||
$this->save_cookie_params('grid_view', $grid_view ? 'true' : 'false');
|
||||
$this->_state['grid_view'] = $grid_view;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function get_grid_view()
|
||||
{
|
||||
return $this->_state['grid_view'];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param boolean $use_alpha
|
||||
|
@ -534,4 +563,17 @@ class Browse extends Query
|
|||
return $this->_state['threshold'];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_css_class()
|
||||
{
|
||||
$css = '';
|
||||
if (!$this->_state['grid_view']) {
|
||||
$css = 'disablegv';
|
||||
}
|
||||
return $css;
|
||||
}
|
||||
} // browse
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -196,7 +196,7 @@ abstract class Catalog extends database_object
|
|||
$sql = "DELETE FROM `catalog` WHERE `catalog_type` = ?";
|
||||
Dba::query($sql, array($this->get_type()));
|
||||
|
||||
$sql = "DROP TABLE `catalog_" . $this->get_type() ."`";
|
||||
$sql = "DROP TABLE `catalog_" . $this->get_type() . "`";
|
||||
Dba::query($sql);
|
||||
|
||||
return true;
|
||||
|
@ -221,7 +221,7 @@ abstract class Catalog extends database_object
|
|||
/**
|
||||
* create_catalog_type
|
||||
* This function attempts to create a catalog type
|
||||
* all Catalog modules should be located in /modules/catalog/<name>.class.php
|
||||
* all Catalog modules should be located in /modules/catalog/<name>/<name>.class.php
|
||||
* @param string $type
|
||||
* @param int $id
|
||||
* @return Catalog|null
|
||||
|
@ -232,7 +232,7 @@ abstract class Catalog extends database_object
|
|||
return false;
|
||||
}
|
||||
|
||||
$filename = AmpConfig::get('prefix') . '/modules/catalog/' . $type . '.catalog.php';
|
||||
$filename = AmpConfig::get('prefix') . '/modules/catalog/' . $type . '/' . $type . '.catalog.php';
|
||||
$include = require_once $filename;
|
||||
|
||||
if (!$include) {
|
||||
|
@ -313,7 +313,8 @@ abstract class Catalog extends database_object
|
|||
public static function get_catalog_types()
|
||||
{
|
||||
/* First open the dir */
|
||||
$handle = opendir(AmpConfig::get('prefix') . '/modules/catalog');
|
||||
$basedir = AmpConfig::get('prefix') . '/modules/catalog';
|
||||
$handle = opendir($basedir);
|
||||
|
||||
if (!is_resource($handle)) {
|
||||
debug_event('catalog', 'Error: Unable to read catalog types directory', '1');
|
||||
|
@ -323,16 +324,22 @@ abstract class Catalog extends database_object
|
|||
$results = array();
|
||||
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if (substr($file, -11, 11) != 'catalog.php') {
|
||||
if ($file === '.' || $file === '..') {
|
||||
continue;
|
||||
}
|
||||
/* Make sure it is a dir */
|
||||
if (! is_dir($basedir . '/' . $file)) {
|
||||
debug_event('catalog', $file . ' is not a directory.', 3);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Make sure it isn't a dir */
|
||||
if (!is_dir($file)) {
|
||||
/* Get the basename and then everything before catalog */
|
||||
$filename = basename($file, '.catalog.php');
|
||||
$results[] = $filename;
|
||||
// Make sure the plugin base file exists inside the plugin directory
|
||||
if (! file_exists($basedir . '/' . $file . '/' . $file . '.catalog.php')) {
|
||||
debug_event('catalog', 'Missing class for ' . $file, 3);
|
||||
continue;
|
||||
}
|
||||
|
||||
$results[] = $file;
|
||||
} // end while
|
||||
|
||||
return $results;
|
||||
|
@ -519,10 +526,16 @@ abstract class Catalog extends database_object
|
|||
* of what you find
|
||||
* @return int[]
|
||||
*/
|
||||
public static function get_catalogs()
|
||||
public static function get_catalogs($filter_type='')
|
||||
{
|
||||
$sql = "SELECT `id` FROM `catalog` ORDER BY `name`";
|
||||
$db_results = Dba::read($sql);
|
||||
$params = array();
|
||||
$sql = "SELECT `id` FROM `catalog` ";
|
||||
if (!empty($filter_type)) {
|
||||
$sql .= "WHERE `gather_types` = ? ";
|
||||
$params[] = $filter_type;
|
||||
}
|
||||
$sql .= "ORDER BY `name`";
|
||||
$db_results = Dba::read($sql, $params);
|
||||
|
||||
$results = array();
|
||||
|
||||
|
@ -608,12 +621,12 @@ abstract class Catalog extends database_object
|
|||
$gather_types = $data['gather_media'];
|
||||
|
||||
// Should it be an array? Not now.
|
||||
if (!in_array($gather_types, array('music', 'clip', 'tvshow', 'movie', 'personal_video'))) {
|
||||
if (!in_array($gather_types, array('music', 'clip', 'tvshow', 'movie', 'personal_video', 'podcast'))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$insert_id = 0;
|
||||
$filename = AmpConfig::get('prefix') . '/modules/catalog/' . $type . '.catalog.php';
|
||||
$filename = AmpConfig::get('prefix') . '/modules/catalog/' . $type . '/' . $type . '.catalog.php';
|
||||
$include = require_once $filename;
|
||||
|
||||
if ($include) {
|
||||
|
@ -630,7 +643,7 @@ abstract class Catalog extends database_object
|
|||
$insert_id = Dba::insert_id();
|
||||
|
||||
if (!$insert_id) {
|
||||
Error::add('general', T_('Catalog Insert Failed check debug logs'));
|
||||
AmpError::add('general', T_('Catalog Insert Failed check debug logs'));
|
||||
debug_event('catalog', 'Insert failed: ' . json_encode($data), 2);
|
||||
return 0;
|
||||
}
|
||||
|
@ -711,6 +724,16 @@ abstract class Catalog extends database_object
|
|||
$data = Dba::fetch_row($db_results);
|
||||
$playlists = $data[0];
|
||||
|
||||
$sql = 'SELECT COUNT(`id`) FROM `live_stream`';
|
||||
$db_results = Dba::read($sql, $params);
|
||||
$data = Dba::fetch_row($db_results);
|
||||
$live_streams = $data[0];
|
||||
|
||||
$sql = 'SELECT COUNT(`id`) FROM `podcast`';
|
||||
$db_results = Dba::read($sql, $params);
|
||||
$data = Dba::fetch_row($db_results);
|
||||
$podcasts = $data[0];
|
||||
|
||||
$results = array();
|
||||
$results['songs'] = $songs;
|
||||
$results['videos'] = $videos;
|
||||
|
@ -718,6 +741,7 @@ abstract class Catalog extends database_object
|
|||
$results['artists'] = $artists;
|
||||
$results['playlists'] = $playlists;
|
||||
$results['smartplaylists'] = $smartplaylists;
|
||||
$results['podcasts'] = $podcasts;
|
||||
$results['size'] = $size;
|
||||
$results['time'] = $time;
|
||||
|
||||
|
@ -929,7 +953,7 @@ abstract class Catalog extends database_object
|
|||
$sql_where = "";
|
||||
if (is_array($catalogs) && count($catalogs)) {
|
||||
$catlist = '(' . implode(',', $catalogs) . ')';
|
||||
$sql_where = "WHERE `song`.`catalog` IN $catlist";
|
||||
$sql_where = "WHERE `song`.`catalog` IN $catlist ";
|
||||
}
|
||||
|
||||
$sql_limit = "";
|
||||
|
@ -943,9 +967,10 @@ abstract class Catalog extends database_object
|
|||
$sql_limit = "LIMIT " . $offset . ", 18446744073709551615";
|
||||
}
|
||||
|
||||
$sql = "SELECT `artist`.id, `artist`.`name`, `artist`.`summary` FROM `song` LEFT JOIN `artist` ON `artist`.`id` = `song`.`artist` " .
|
||||
$sql = "SELECT `artist`.`id`, `artist`.`name`, `artist`.`summary`, (SELECT COUNT(DISTINCT album) from `song` as `inner_song` WHERE `inner_song`.`artist` = `song`.`artist`) AS `albums`" .
|
||||
"FROM `song` LEFT JOIN `artist` ON `artist`.`id` = `song`.`artist` " .
|
||||
$sql_where .
|
||||
"GROUP BY `song`.artist ORDER BY `artist`.`name` " .
|
||||
"GROUP BY `artist`.`id`, `artist`.`name`, `artist`.`summary`, `song`.`artist` ORDER BY `artist`.`name` " .
|
||||
$sql_limit;
|
||||
|
||||
$results = array();
|
||||
|
@ -1010,7 +1035,7 @@ abstract class Catalog extends database_object
|
|||
$sql_limit = "LIMIT $offset, 18446744073709551615";
|
||||
}
|
||||
|
||||
$sql = "SELECT `album`.`id` FROM `song` LEFT JOIN `album` ON `album`.`id` = `song`.`album` $sql_where GROUP BY `song`.`album` ORDER BY `album`.`name` $sql_limit";
|
||||
$sql = "SELECT `album`.`id` FROM `song` LEFT JOIN `album` ON `album`.`id` = `song`.`album` $sql_where GROUP BY `album`.`id` ORDER BY `album`.`name` $sql_limit";
|
||||
|
||||
$db_results = Dba::read($sql);
|
||||
$results = array();
|
||||
|
@ -1049,7 +1074,7 @@ abstract class Catalog extends database_object
|
|||
$sql_limit = "LIMIT $offset, 18446744073709551615";
|
||||
}
|
||||
|
||||
$sql = "SELECT `album`.`id` FROM `song` LEFT JOIN `album` ON `album`.`id` = `song`.`album` " .
|
||||
$sql = "SELECT `song`.`album` FROM `song` LEFT JOIN `album` ON `album`.`id` = `song`.`album` " .
|
||||
"LEFT JOIN `artist` ON `artist`.`id` = `song`.`artist` $sql_where GROUP BY `song`.`album` ORDER BY `artist`.`name`, `artist`.`id`, `album`.`name` $sql_limit";
|
||||
|
||||
$db_results = Dba::read($sql);
|
||||
|
@ -1061,6 +1086,94 @@ abstract class Catalog extends database_object
|
|||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_podcast_ids
|
||||
*
|
||||
* This returns an array of ids of podcasts in this catalog
|
||||
* @return int[]
|
||||
*/
|
||||
public function get_podcast_ids()
|
||||
{
|
||||
$results = array();
|
||||
|
||||
$sql = 'SELECT `podcast`.`id` FROM `podcast` ';
|
||||
$sql .= 'WHERE `podcast`.`catalog` = ?';
|
||||
$db_results = Dba::read($sql, array($this->id));
|
||||
while ($r = Dba::fetch_assoc($db_results)) {
|
||||
$results[] = $r['id'];
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int[]|null $catalogs
|
||||
* @return \Podcast[]
|
||||
*/
|
||||
public static function get_podcasts($catalogs = null)
|
||||
{
|
||||
if (!$catalogs) {
|
||||
$catalogs = self::get_catalogs();
|
||||
}
|
||||
|
||||
$results = array();
|
||||
foreach ($catalogs as $catalog_id) {
|
||||
$catalog = Catalog::create_from_id($catalog_id);
|
||||
$podcast_ids = $catalog->get_podcast_ids();
|
||||
foreach ($podcast_ids as $podcast_id) {
|
||||
$results[] = new Podcast($podcast_id);
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_newest_podcasts_ids
|
||||
*
|
||||
* This returns an array of ids of latest podcast episodes in this catalog
|
||||
* @return int[]
|
||||
*/
|
||||
public function get_newest_podcasts_ids()
|
||||
{
|
||||
$results = array();
|
||||
|
||||
$sql = 'SELECT `podcast_episode`.`id` FROM `podcast_episode` ' .
|
||||
'INNER JOIN `podcast` ON `podcast`.`id` = `podcast_episode`.`podcast` ' .
|
||||
'WHERE `podcast`.`catalog` = ? ' .
|
||||
'ORDER BY `podcast_episode`.`pubdate` DESC';
|
||||
$db_results = Dba::read($sql, array($this->id));
|
||||
while ($r = Dba::fetch_assoc($db_results)) {
|
||||
$results[] = $r['id'];
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int[]|null $catalogs
|
||||
* @return \Podcast_Episode[]
|
||||
*/
|
||||
public static function get_newest_podcasts($catalogs = null)
|
||||
{
|
||||
if (!$catalogs) {
|
||||
$catalogs = self::get_catalogs();
|
||||
}
|
||||
|
||||
$results = array();
|
||||
foreach ($catalogs as $catalog_id) {
|
||||
$catalog = Catalog::create_from_id($catalog_id);
|
||||
$episode_ids = $catalog->get_newest_podcasts_ids();
|
||||
foreach ($episode_ids as $episode_id) {
|
||||
$results[] = new Podcast_Episode($episode_id);
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $type
|
||||
|
@ -1381,7 +1494,7 @@ abstract class Catalog extends database_object
|
|||
|
||||
foreach ($songs as $song_id) {
|
||||
$song = new Song($song_id);
|
||||
$info = self::update_media_from_tags($song, '', '');
|
||||
$info = self::update_media_from_tags($song);
|
||||
|
||||
if ($info['change']) {
|
||||
$file = scrub_out($song->file);
|
||||
|
@ -1411,7 +1524,7 @@ abstract class Catalog extends database_object
|
|||
* @param string $rename_pattern
|
||||
* @return array
|
||||
*/
|
||||
public static function update_media_from_tags($media, $sort_pattern='', $rename_pattern='')
|
||||
public static function update_media_from_tags($media, $gather_types = array('music'), $sort_pattern='', $rename_pattern='')
|
||||
{
|
||||
// Check for patterns
|
||||
if (!$sort_pattern or !$rename_pattern) {
|
||||
|
@ -1422,7 +1535,7 @@ abstract class Catalog extends database_object
|
|||
|
||||
debug_event('tag-read', 'Reading tags from ' . $media->file, 5);
|
||||
|
||||
$vainfo = new vainfo($media->file, array('music'), '', '', '', $sort_pattern, $rename_pattern);
|
||||
$vainfo = new vainfo($media->file, $gather_types, '', '', '', $sort_pattern, $rename_pattern);
|
||||
$vainfo->get_info();
|
||||
|
||||
$key = vainfo::get_tag_type($vainfo->tags);
|
||||
|
@ -1509,6 +1622,17 @@ abstract class Catalog extends database_object
|
|||
/* Since we're doing a full compare make sure we fill the extended information */
|
||||
$song->fill_ext_info();
|
||||
|
||||
if (Song::isCustomMetadataEnabled()) {
|
||||
$ctags = self::get_clean_metadata($song, $results);
|
||||
if (method_exists($song, 'updateOrInsertMetadata') && $song::isCustomMetadataEnabled()) {
|
||||
$ctags = array_diff_key($ctags, array_flip($song->getDisabledMetadataFields()));
|
||||
foreach ($ctags as $tag => $value) {
|
||||
$field = $song->getField($tag);
|
||||
$song->updateOrInsertMetadata($field, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$info = Song::compare_song_information($song, $new_song);
|
||||
if ($info['change']) {
|
||||
debug_event('update', "$song->file : differences found, updating database", 5);
|
||||
|
@ -1543,13 +1667,92 @@ abstract class Catalog extends database_object
|
|||
debug_event('update', "$song->file : no differences found", 5);
|
||||
}
|
||||
|
||||
// If song rating tag exists and is well formed (array user=>rating), update it
|
||||
if ($song->id && array_key_exists('rating', $results) && is_array($results['rating'])) {
|
||||
// For each user's ratings, call the function
|
||||
foreach ($results['rating'] as $user => $rating) {
|
||||
debug_event('Rating', "Updating rating for Song " . $song->id . " to $rating for user $user", 5);
|
||||
$o_rating = new Rating($song->id, 'song');
|
||||
$o_rating->set_rating($rating, $user);
|
||||
}
|
||||
}
|
||||
return $info;
|
||||
} // update_song_from_tags
|
||||
|
||||
public function update_video_from_tags($results, Video $video)
|
||||
public static function update_video_from_tags($results, Video $video)
|
||||
{
|
||||
// TODO: implement this
|
||||
return null;
|
||||
/* Setup the vars */
|
||||
$new_video = new Video();
|
||||
$new_video->file = $results['file'];
|
||||
$new_video->title = $results['title'];
|
||||
$new_video->size = $results['size'];
|
||||
$new_video->video_codec = $results['video_codec'];
|
||||
$new_video->audio_codec = $results['audio_codec'];
|
||||
$new_video->resolution_x = $results['resolution_x'];
|
||||
$new_video->resolution_y = $results['resolution_y'];
|
||||
$new_video->time = $results['time'];
|
||||
$new_video->release_date = $results['release_date'] ?: 0;
|
||||
$new_video->bitrate = $results['bitrate'];
|
||||
$new_video->mode = $results['mode'];
|
||||
$new_video->channels = $results['channels'];
|
||||
$new_video->display_x = $results['display_x'];
|
||||
$new_video->display_y = $results['display_y'];
|
||||
$new_video->frame_rate = $results['frame_rate'];
|
||||
$new_video->video_bitrate = $results['video_bitrate'];
|
||||
$tags = Tag::get_object_tags('video', $video->id);
|
||||
if ($tags) {
|
||||
foreach ($tags as $tag) {
|
||||
$video->tags[] = $tag['name'];
|
||||
}
|
||||
}
|
||||
$new_video->tags = $results['genre'];
|
||||
|
||||
$info = Video::compare_video_information($video, $new_video);
|
||||
if ($info['change']) {
|
||||
debug_event('update', $video->file . " : differences found, updating database", 5);
|
||||
|
||||
$video->update_video($video->id, $new_video);
|
||||
|
||||
if ($video->tags != $new_video->tags) {
|
||||
Tag::update_tag_list(implode(',', $new_video->tags), 'video', $video->id, true);
|
||||
}
|
||||
} else {
|
||||
debug_event('update', $video->file . " : no differences found", 5);
|
||||
}
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rid of all tags found in the libraryItem
|
||||
* @param library_item $libraryItem
|
||||
* @param array $metadata
|
||||
* @return array
|
||||
*/
|
||||
private static function get_clean_metadata(library_item $libraryItem, $metadata)
|
||||
{
|
||||
$tags = array_diff_key(
|
||||
$metadata,
|
||||
get_object_vars($libraryItem),
|
||||
array_flip($libraryItem::$aliases ?: array())
|
||||
);
|
||||
|
||||
return array_filter($tags);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param library_item $libraryItem
|
||||
* @param type $metadata
|
||||
*/
|
||||
public static function add_metadata(library_item $libraryItem, $metadata)
|
||||
{
|
||||
$tags = self::get_clean_metadata($libraryItem, $metadata);
|
||||
|
||||
foreach ($tags as $tag => $value) {
|
||||
$field = $libraryItem->getField($tag);
|
||||
$libraryItem->addMetadata($field, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1589,14 +1792,14 @@ abstract class Catalog extends database_object
|
|||
debug_event('clean', 'Starting on ' . $this->name, 5);
|
||||
|
||||
if (!defined('SSE_OUTPUT')) {
|
||||
require AmpConfig::get('prefix') . '/templates/show_clean_catalog.inc.php';
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_clean_catalog.inc.php');
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
|
||||
$dead_total = $this->clean_catalog_proc();
|
||||
|
||||
debug_event('clean', 'clean finished, ' . $dead_total . ' removed from '. $this->name, 5);
|
||||
debug_event('clean', 'clean finished, ' . $dead_total . ' removed from ' . $this->name, 5);
|
||||
|
||||
// Remove any orphaned artists/albums/etc.
|
||||
self::gc();
|
||||
|
@ -1619,7 +1822,7 @@ abstract class Catalog extends database_object
|
|||
public function verify_catalog()
|
||||
{
|
||||
if (!defined('SSE_OUTPUT')) {
|
||||
require AmpConfig::get('prefix') . '/templates/show_verify_catalog.inc.php';
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_verify_catalog.inc.php');
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
|
@ -1654,10 +1857,15 @@ abstract class Catalog extends database_object
|
|||
Stats::gc();
|
||||
Rating::gc();
|
||||
Userflag::gc();
|
||||
Useractivity::gc();
|
||||
Playlist::gc();
|
||||
Tmp_Playlist::gc();
|
||||
Shoutbox::gc();
|
||||
Tag::gc();
|
||||
|
||||
// TODO: use InnoDB with foreign keys and on delete cascade to get rid of garbage collection
|
||||
\Lib\Metadata\Repository\Metadata::gc();
|
||||
\Lib\Metadata\Repository\MetadataField::gc();
|
||||
debug_event('catalog', 'Database cleanup ended', 5);
|
||||
}
|
||||
|
||||
|
@ -1682,6 +1890,32 @@ abstract class Catalog extends database_object
|
|||
return array('string' => $string, 'prefix' => $prefix);
|
||||
} // trim_prefix
|
||||
|
||||
public static function normalize_year($year)
|
||||
{
|
||||
if (empty($year)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$year = intval($year);
|
||||
if ($year < 0 || $year > 9999) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $year;
|
||||
}
|
||||
|
||||
/**
|
||||
* trim_featuring
|
||||
* Splits artists featuring from the string
|
||||
* @param string $string
|
||||
* @return array
|
||||
*/
|
||||
public static function trim_featuring($string)
|
||||
{
|
||||
$trimmed = array_map('trim', explode(' feat. ', $string));
|
||||
return $trimmed;
|
||||
} // trim_featuring
|
||||
|
||||
/**
|
||||
* check_title
|
||||
* this checks to make sure something is
|
||||
|
@ -1708,7 +1942,7 @@ abstract class Catalog extends database_object
|
|||
public static function import_playlist($playlist)
|
||||
{
|
||||
$data = file_get_contents($playlist);
|
||||
if (substr($playlist, -3, 3) == 'm3u') {
|
||||
if (substr($playlist, -3, 3) == 'm3u' || substr($playlist, -4, 4) == 'm3u8') {
|
||||
$files = self::parse_m3u($data);
|
||||
} elseif (substr($playlist, -3, 3) == 'pls') {
|
||||
$files = self::parse_pls($data);
|
||||
|
@ -1922,8 +2156,9 @@ abstract class Catalog extends database_object
|
|||
|
||||
$catalog = self::create_from_id($catalog_id);
|
||||
|
||||
if (!$catalog->id)
|
||||
if (!$catalog->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM `catalog_' . $catalog->get_type() . '` WHERE catalog_id = ?';
|
||||
$db_results = Dba::write($sql, array($catalog_id));
|
||||
|
@ -1969,8 +2204,8 @@ abstract class Catalog extends database_object
|
|||
$song->format();
|
||||
|
||||
$xml = array();
|
||||
$xml['key']= $results['id'];
|
||||
$xml['dict']['Track ID']= intval($results['id']);
|
||||
$xml['key'] = $results['id'];
|
||||
$xml['dict']['Track ID'] = intval($results['id']);
|
||||
$xml['dict']['Name'] = $song->title;
|
||||
$xml['dict']['Artist'] = $song->f_artist_full;
|
||||
$xml['dict']['Album'] = $song->f_album_full;
|
||||
|
@ -1997,12 +2232,12 @@ abstract class Catalog extends database_object
|
|||
echo '"' . $song->id . '","' .
|
||||
$song->title . '","' .
|
||||
$song->f_artist_full . '","' .
|
||||
$song->f_album_full .'","' .
|
||||
$song->f_album_full . '","' .
|
||||
$song->f_time . '","' .
|
||||
$song->f_track . '","' .
|
||||
$song->year .'","' .
|
||||
$song->year . '","' .
|
||||
date("Y-m-d\TH:i:s\Z", $song->addition_time) . '","' .
|
||||
$song->f_bitrate .'","' .
|
||||
$song->f_bitrate . '","' .
|
||||
$song->played . '","' .
|
||||
$song->file . "\n";
|
||||
}
|
||||
|
@ -2040,11 +2275,11 @@ abstract class Catalog extends database_object
|
|||
protected static function getSongTags($type, $id)
|
||||
{
|
||||
$tags = array();
|
||||
$db_results = Dba::read('SELECT tag.name FROM tag'
|
||||
. ' JOIN tag_map ON tag.id = tag_map.tag_id'
|
||||
. ' JOIN song ON tag_map.object_id = song.id'
|
||||
. ' WHERE song.' . $type . ' = ? AND tag_map.object_type = "song"'
|
||||
. ' GROUP BY tag.id', array($id));
|
||||
$db_results = Dba::read('SELECT `tag`.`name` FROM `tag`'
|
||||
. ' JOIN `tag_map` ON `tag`.`id` = `tag_map`.`tag_id`'
|
||||
. ' JOIN `song` ON `tag_map`.`object_id` = `song`.`id`'
|
||||
. ' WHERE `song`.`' . $type . '` = ? AND `tag_map`.`object_type` = "song"'
|
||||
. ' GROUP BY `tag`.`id`, `tag`.`name`', array($id));
|
||||
while ($row = Dba::fetch_assoc($db_results)) {
|
||||
$tags[] = $row['name'];
|
||||
}
|
||||
|
@ -2057,14 +2292,125 @@ abstract class Catalog extends database_object
|
|||
$user = $GLOBALS['user']->id;
|
||||
}
|
||||
|
||||
if (!$user)
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!AmpConfig::get('delete_from_disk'))
|
||||
if (!AmpConfig::get('delete_from_disk')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (Access::check('interface','75') || ($libitem->get_user_owner() == $user && AmpConfig::get('upload_allow_remove')));
|
||||
}
|
||||
|
||||
public static function process_action($action, $catalogs, $options = null)
|
||||
{
|
||||
if (!$options || !is_array($options)) {
|
||||
$options = array();
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'add_to_all_catalogs':
|
||||
$catalogs = Catalog::get_catalogs();
|
||||
case 'add_to_catalog':
|
||||
if ($catalogs) {
|
||||
foreach ($catalogs as $catalog_id) {
|
||||
$catalog = Catalog::create_from_id($catalog_id);
|
||||
if ($catalog !== null) {
|
||||
$catalog->add_to_catalog($options);
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined('SSE_OUTPUT')) {
|
||||
AmpError::display('catalog_add');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'update_all_catalogs':
|
||||
$catalogs = Catalog::get_catalogs();
|
||||
case 'update_catalog':
|
||||
if ($catalogs) {
|
||||
foreach ($catalogs as $catalog_id) {
|
||||
$catalog = Catalog::create_from_id($catalog_id);
|
||||
if ($catalog !== null) {
|
||||
$catalog->verify_catalog();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'full_service':
|
||||
if (!$catalogs) {
|
||||
$catalogs = Catalog::get_catalogs();
|
||||
}
|
||||
|
||||
/* This runs the clean/verify/add in that order */
|
||||
foreach ($catalogs as $catalog_id) {
|
||||
$catalog = Catalog::create_from_id($catalog_id);
|
||||
if ($catalog !== null) {
|
||||
$catalog->clean_catalog();
|
||||
$catalog->verify_catalog();
|
||||
$catalog->add_to_catalog();
|
||||
}
|
||||
}
|
||||
Dba::optimize_tables();
|
||||
break;
|
||||
case 'clean_all_catalogs':
|
||||
$catalogs = Catalog::get_catalogs();
|
||||
case 'clean_catalog':
|
||||
if ($catalogs) {
|
||||
foreach ($catalogs as $catalog_id) {
|
||||
$catalog = Catalog::create_from_id($catalog_id);
|
||||
if ($catalog !== null) {
|
||||
$catalog->clean_catalog();
|
||||
}
|
||||
} // end foreach catalogs
|
||||
Dba::optimize_tables();
|
||||
}
|
||||
break;
|
||||
case 'update_from':
|
||||
$catalog_id = 0;
|
||||
// First see if we need to do an add
|
||||
if ($options['add_path'] != '/' && strlen($options['add_path'])) {
|
||||
if ($catalog_id = Catalog_local::get_from_path($options['add_path'])) {
|
||||
$catalog = Catalog::create_from_id($catalog_id);
|
||||
if ($catalog !== null) {
|
||||
$catalog->add_to_catalog(array('subdirectory'=>$options['add_path']));
|
||||
}
|
||||
}
|
||||
} // end if add
|
||||
|
||||
// Now check for an update
|
||||
if ($options['update_path'] != '/' && strlen($options['update_path'])) {
|
||||
if ($catalog_id = Catalog_local::get_from_path($options['update_path'])) {
|
||||
$songs = Song::get_from_path($options['update_path']);
|
||||
foreach ($songs as $song_id) {
|
||||
Catalog::update_single_item('song',$song_id);
|
||||
}
|
||||
}
|
||||
} // end if update
|
||||
|
||||
if ($catalog_id <= 0) {
|
||||
AmpError::add('general', T_("This subdirectory is not part of an existing catalog. Update cannot be processed."));
|
||||
}
|
||||
break;
|
||||
case 'gather_media_art':
|
||||
if (!$catalogs) {
|
||||
$catalogs = Catalog::get_catalogs();
|
||||
}
|
||||
|
||||
// Iterate throught the catalogs and gather as needed
|
||||
foreach ($catalogs as $catalog_id) {
|
||||
$catalog = Catalog::create_from_id($catalog_id);
|
||||
if ($catalog !== null) {
|
||||
require AmpConfig::get('prefix') . UI::find_template('show_gather_art.inc.php');
|
||||
flush();
|
||||
$catalog->gather_art();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// end of catalog class
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -59,7 +59,9 @@ class Channel extends database_object implements media, library_item
|
|||
*/
|
||||
public function __construct($id=0)
|
||||
{
|
||||
if (!$id) { return true; }
|
||||
if (!$id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Get the information from the db */
|
||||
$info = $this->get_info($id);
|
||||
|
@ -182,7 +184,7 @@ class Channel extends database_object implements media, library_item
|
|||
echo Ajax::button('?page=index&action=start_channel&id=' . $this->id,'run', T_('Start Channel'),'channel_start_' . $this->id);
|
||||
echo " " . Ajax::button('?page=index&action=stop_channel&id=' . $this->id,'stop', T_('Stop Channel'),'channel_stop_' . $this->id);
|
||||
echo " <a id=\"edit_channel_ " . $this->id . "\" onclick=\"showEditDialog('channel_row', '" . $this->id . "', 'edit_channel_" . $this->id . "', '" . T_('Channel edit') . "', 'channel_row_', 'refresh_channel')\">" . UI::get_icon('edit', T_('Edit')) . "</a>";
|
||||
echo " <a href=\"" . AmpConfig::get('web_path') . "/channel.php?action=show_delete&id=" . $this->id ."\">" . UI::get_icon('delete', T_('Delete')) . "</a>";
|
||||
echo " <a href=\"" . AmpConfig::get('web_path') . "/channel.php?action=show_delete&id=" . $this->id . "\">" . UI::get_icon('delete', T_('Delete')) . "</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -423,8 +425,9 @@ class Channel extends database_object implements media, library_item
|
|||
}
|
||||
|
||||
if (is_resource($this->transcoder['handle'])) {
|
||||
if (ftell($this->transcoder['handle']) == 0)
|
||||
if (ftell($this->transcoder['handle']) == 0) {
|
||||
$this->header_chunk = '';
|
||||
}
|
||||
$chunk = fread($this->transcoder['handle'], $this->chunk_size);
|
||||
$this->media_bytes_streamed += strlen($chunk);
|
||||
|
||||
|
@ -453,13 +456,15 @@ class Channel extends database_object implements media, library_item
|
|||
$ogg_sum_segm_laces += hexdec(substr($hex, 27*2 + $segm*2, 2));
|
||||
}
|
||||
$this->header_chunk .= substr($clchunk, 0, 27 + $ogg_nr_of_segments + $ogg_sum_segm_laces);
|
||||
if (strlen($clchunk) < (27 + $ogg_nr_of_segments + $ogg_sum_segm_laces))
|
||||
if (strlen($clchunk) < (27 + $ogg_nr_of_segments + $ogg_sum_segm_laces)) {
|
||||
$this->header_chunk_remainder = (int) (27 + $ogg_nr_of_segments + $ogg_sum_segm_laces - strlen($clchunk));
|
||||
}
|
||||
$clchunk = substr($clchunk, 27 + $ogg_nr_of_segments + $ogg_sum_segm_laces);
|
||||
} else //no more interesting headers
|
||||
} else { //no more interesting headers
|
||||
$clchunk = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
//debug_event('channel', 'File handle pointer: ' . ftell($this->transcoder['handle']) ,'5');
|
||||
//debug_event('channel', 'CHUNK : ' . $chunk, '5');
|
||||
//debug_event('channel', 'Chunk size: ' . strlen($chunk) ,'5');
|
||||
|
@ -531,15 +536,15 @@ class Channel extends database_object implements media, library_item
|
|||
|
||||
public static function gc()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private function strtohex($x)
|
||||
{
|
||||
$s='';
|
||||
foreach(str_split($x) as $c) $s.=sprintf("%02X",ord($c));
|
||||
foreach (str_split($x) as $c) {
|
||||
$s.=sprintf("%02X",ord($c));
|
||||
}
|
||||
return($s);
|
||||
}
|
||||
|
||||
|
||||
} // end of channel class
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -44,7 +44,6 @@ class Clip extends Video
|
|||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // Constructor
|
||||
|
||||
/**
|
||||
|
@ -70,7 +69,6 @@ class Clip extends Video
|
|||
Dba::write($sql, array($data['id'], $data['artist'], $data['song']));
|
||||
|
||||
return $data['id'];
|
||||
|
||||
} // create
|
||||
|
||||
/**
|
||||
|
@ -83,7 +81,6 @@ class Clip extends Video
|
|||
Dba::write($sql, array($data['artist'], $data['song'], $this->id));
|
||||
|
||||
return $this->id;
|
||||
|
||||
} // update
|
||||
|
||||
/**
|
||||
|
@ -110,7 +107,6 @@ class Clip extends Video
|
|||
}
|
||||
|
||||
return true;
|
||||
|
||||
} //format
|
||||
|
||||
/**
|
||||
|
@ -137,5 +133,5 @@ class Clip extends Video
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
} // Clip class
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -36,7 +36,6 @@ class Core
|
|||
private function __construct()
|
||||
{
|
||||
return false;
|
||||
|
||||
} // construction
|
||||
|
||||
/**
|
||||
|
@ -48,39 +47,79 @@ class Core
|
|||
*/
|
||||
public static function autoload($class)
|
||||
{
|
||||
$possiblePaths = array();
|
||||
if (strpos($class, '\\') === false) {
|
||||
$file = AmpConfig::get('prefix') . '/lib/class/' .
|
||||
strtolower($class) . '.class.php';
|
||||
$possiblePaths = self::getNonNamespacedPaths($class);
|
||||
} else {
|
||||
$possiblePaths = self::getNamespacedPaths($class);
|
||||
}
|
||||
|
||||
if (Core::is_readable($file)) {
|
||||
require_once $file;
|
||||
foreach ($possiblePaths as $path) {
|
||||
if (is_file($path) && Core::is_readable($path)) {
|
||||
require_once($path);
|
||||
self::executeAutoCall($class);
|
||||
} else {
|
||||
debug_event('autoload', "'$class' not found!", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Call _auto_init if it exists
|
||||
/**
|
||||
* Execute _auto_init if availlable
|
||||
* @param string $class
|
||||
*/
|
||||
private static function executeAutoCall($class)
|
||||
{
|
||||
$autocall = array($class, '_auto_init');
|
||||
if (is_callable($autocall)) {
|
||||
call_user_func($autocall);
|
||||
}
|
||||
} else {
|
||||
debug_event('autoload', "'$class' not found!", 1);
|
||||
}
|
||||
} else {
|
||||
// Class with namespace are not used by Ampache but probably by modules
|
||||
$split = explode('\\', $class);
|
||||
$path = AmpConfig::get('prefix') . '/modules';
|
||||
for ($i = 0; $i < count($split); ++$i) {
|
||||
$path .= '/' . $split[$i];
|
||||
if ($i != count($split)-1) {
|
||||
if (!is_dir($path)) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$path .= '.php';
|
||||
if (Core::is_readable($path)) {
|
||||
require_once $path;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Place a new key on a specific position in array
|
||||
* @param array $array
|
||||
* @param integer $position
|
||||
* @param array $add
|
||||
* @return array
|
||||
*/
|
||||
private static function insertInArray(array $array, $position, array $add)
|
||||
{
|
||||
return array_slice($array, 0, $position, true) +
|
||||
$add +
|
||||
array_slice($array, $position, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get possible filepaths of namespaced classes
|
||||
* @param string $class
|
||||
* @return string
|
||||
*/
|
||||
private static function getNamespacedPaths($class)
|
||||
{
|
||||
$possiblePaths = array();
|
||||
$namespaceParts = explode('\\', $class);
|
||||
$possiblePaths[] = AmpConfig::get('prefix') . '/modules/' . implode('/', $namespaceParts) . '.php';
|
||||
|
||||
$classedPath = array('path' => AmpConfig::get('prefix')) +
|
||||
self::insertInArray($namespaceParts, 1, array('add' => 'class'));
|
||||
$possiblePaths[] = implode('/', $classedPath) . '.php';
|
||||
|
||||
return $possiblePaths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get possible filepaths of non namespaced classes
|
||||
* @param string $class
|
||||
* @return string
|
||||
*/
|
||||
private static function getNonNamespacedPaths($class)
|
||||
{
|
||||
$possiblePaths = array();
|
||||
$possiblePaths[] = AmpConfig::get('prefix') . '/lib/class/' .
|
||||
strtolower($class) . '.class.php';
|
||||
|
||||
return $possiblePaths;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +149,6 @@ class Core
|
|||
} // end switch on type
|
||||
|
||||
return $string;
|
||||
|
||||
} // form_register
|
||||
|
||||
/**
|
||||
|
@ -160,7 +198,6 @@ class Core
|
|||
// OMG HAX0RZ
|
||||
debug_event('Core', "$type form $sid failed consistency check, rejecting request", 2);
|
||||
return false;
|
||||
|
||||
} // form_verify
|
||||
|
||||
/**
|
||||
|
@ -171,19 +208,24 @@ class Core
|
|||
*/
|
||||
public static function image_dimensions($image_data)
|
||||
{
|
||||
if (!function_exists('ImageCreateFromString')) { return false; }
|
||||
if (!function_exists('ImageCreateFromString')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$image = ImageCreateFromString($image_data);
|
||||
|
||||
if (!$image) { return false; }
|
||||
if (!$image) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$width = imagesx($image);
|
||||
$height = imagesy($image);
|
||||
|
||||
if (!$width || !$height) { return false; }
|
||||
if (!$width || !$height) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return array('width'=>$width,'height'=>$height);
|
||||
|
||||
} // image_dimensions
|
||||
|
||||
/*
|
||||
|
@ -326,3 +368,4 @@ class Core
|
|||
return $options;
|
||||
}
|
||||
} // Core
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
<?php
|
||||
|
||||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* of the License.
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -26,11 +26,47 @@
|
|||
*
|
||||
* This class wrap Ampache to DAAP API functions. See https://github.com/andytinycat/daapdocs/blob/master/daapdocs.txt
|
||||
* These are all static calls.
|
||||
*
|
||||
*/
|
||||
class Daap_Api
|
||||
{
|
||||
const AMPACHEID_SMARTPL = 400000000;
|
||||
const BASE_LIBRARY = 0;
|
||||
|
||||
public static $metas = array(
|
||||
'dmap.itemid',
|
||||
'dmap.itemname',
|
||||
'dmap.itemkind',
|
||||
'dmap.persistentid',
|
||||
'daap.songalbum',
|
||||
'daap.songartist',
|
||||
'daap.songbitrate',
|
||||
'daap.songbeatsperminute',
|
||||
'daap.songcomment',
|
||||
'daap.songcompilation',
|
||||
'daap.songcomposer',
|
||||
'daap.songdateadded',
|
||||
'daap.songdatemodified',
|
||||
'daap.songdisccount',
|
||||
'daap.songdiscnumber',
|
||||
'daap.songdisabled',
|
||||
'daap.songeqpreset',
|
||||
'daap.songformat',
|
||||
'daap.songgenre',
|
||||
'daap.songdescription',
|
||||
'daap.songrelativevolume',
|
||||
'daap.songsamplerate',
|
||||
'daap.songsize',
|
||||
'daap.songstarttime',
|
||||
'daap.songstoptime',
|
||||
'daap.songtime',
|
||||
'daap.songtrackcount',
|
||||
'daap.songtracknumber',
|
||||
'daap.songuserrating',
|
||||
'daap.songyear',
|
||||
'daap.songdatakind',
|
||||
'daap.songdataurl',
|
||||
'com.apple.itunes.norm-volume'
|
||||
);
|
||||
|
||||
public static $tags = array();
|
||||
|
||||
|
@ -61,8 +97,14 @@ class Daap_Api
|
|||
CURLOPT_HEADER => false,
|
||||
CURLOPT_RETURNTRANSFER => false,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_WRITEFUNCTION => array('Daap_Api', 'output_body'),
|
||||
CURLOPT_HEADERFUNCTION => array('Daap_Api', 'output_header'),
|
||||
CURLOPT_WRITEFUNCTION => array(
|
||||
'Daap_Api',
|
||||
'output_body'
|
||||
),
|
||||
CURLOPT_HEADERFUNCTION => array(
|
||||
'Daap_Api',
|
||||
'output_header'
|
||||
),
|
||||
// Ignore invalid certificate
|
||||
// Default trusted chain is crap anyway and currently no custom CA option
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
|
@ -89,7 +131,7 @@ class Daap_Api
|
|||
{
|
||||
$rheader = trim($header);
|
||||
$rhpart = explode(':', $rheader);
|
||||
if (!empty($rheader) && count($rhpart) > 1) {
|
||||
if (! empty($rheader) && count($rhpart) > 1) {
|
||||
if ($rhpart[0] != "Transfer-Encoding") {
|
||||
header($rheader);
|
||||
}
|
||||
|
@ -99,7 +141,6 @@ class Daap_Api
|
|||
|
||||
/**
|
||||
* server_info
|
||||
*
|
||||
*/
|
||||
public static function server_info($input)
|
||||
{
|
||||
|
@ -124,7 +165,6 @@ class Daap_Api
|
|||
|
||||
/**
|
||||
* content_codes
|
||||
*
|
||||
*/
|
||||
public static function content_codes($input)
|
||||
{
|
||||
|
@ -132,7 +172,7 @@ class Daap_Api
|
|||
foreach (self::$tags as $name => $tag) {
|
||||
$entry = self::tlv('dmap.contentcodesname', $name);
|
||||
$pcode = str_split($tag['code']);
|
||||
$icode = (ord($pcode[0])<<24) + (ord($pcode[1])<<16) + (ord($pcode[2])<<8) + ord($pcode[3]);
|
||||
$icode = (ord($pcode[0]) << 24) + (ord($pcode[1]) << 16) + (ord($pcode[2]) << 8) + ord($pcode[3]);
|
||||
$entry .= self::tlv('dmap.contentcodesnumber', $icode);
|
||||
$entry .= self::tlv('dmap.contentcodestype', self::get_type_id($tag['type']));
|
||||
$o .= self::tlv('dmap.dictionary', $entry);
|
||||
|
@ -144,7 +184,6 @@ class Daap_Api
|
|||
|
||||
/**
|
||||
* login
|
||||
*
|
||||
*/
|
||||
public static function login($input)
|
||||
{
|
||||
|
@ -152,7 +191,9 @@ class Daap_Api
|
|||
|
||||
// Create a new daap session
|
||||
$sql = "INSERT INTO `daap_session` (`creationdate`) VALUES (?)";
|
||||
Dba::write($sql, array(time()));
|
||||
Dba::write($sql, array(
|
||||
time()
|
||||
));
|
||||
$sid = Dba::insert_id();
|
||||
|
||||
$o = self::tlv('dmap.status', 200);
|
||||
|
@ -166,16 +207,19 @@ class Daap_Api
|
|||
{
|
||||
// Purge expired sessions
|
||||
$sql = "DELETE FROM `daap_session` WHERE `creationdate` < ?";
|
||||
Dba::write($sql, array(time() - 1800));
|
||||
Dba::write($sql, array(
|
||||
time() - 1800
|
||||
));
|
||||
|
||||
self::check_auth($code);
|
||||
|
||||
if (!isset($_GET['session-id'])) {
|
||||
if (! isset($_GET['session-id'])) {
|
||||
debug_event('daap', 'Missing session id.', '');
|
||||
} else {
|
||||
|
||||
$sql = "SELECT * FROM `daap_session` WHERE `id` = ?";
|
||||
$db_results = Dba::read($sql, array($_GET['session-id']));
|
||||
$db_results = Dba::read($sql, array(
|
||||
$_GET['session-id']
|
||||
));
|
||||
|
||||
if (Dba::num_rows($db_results) == 0) {
|
||||
debug_event('daap', 'Unknown session id `' . $_GET['session-id'] . '`.', '4');
|
||||
|
@ -188,7 +232,7 @@ class Daap_Api
|
|||
$authenticated = false;
|
||||
$pass = AmpConfig::get('daap_pass');
|
||||
// DAAP password specified, need to authenticate the client
|
||||
if (!empty($pass)) {
|
||||
if (! empty($pass)) {
|
||||
$headers = apache_request_headers();
|
||||
$auth = $headers['Authorization'];
|
||||
if (strpos(strtolower($auth), 'basic') === 0) {
|
||||
|
@ -204,9 +248,9 @@ class Daap_Api
|
|||
$authenticated = true;
|
||||
}
|
||||
|
||||
if (!$authenticated) {
|
||||
if (! $authenticated) {
|
||||
debug_event('daap', 'Authentication failed. Wrong DAAP password?', '5');
|
||||
if (!empty($code)) {
|
||||
if (! empty($code)) {
|
||||
self::createApiError($code, 403);
|
||||
}
|
||||
}
|
||||
|
@ -214,14 +258,15 @@ class Daap_Api
|
|||
|
||||
/**
|
||||
* logout
|
||||
*
|
||||
*/
|
||||
public static function logout($input)
|
||||
{
|
||||
self::check_auth();
|
||||
|
||||
$sql = "DELETE FROM `daap_session` WHERE `id` = ?";
|
||||
Dba::write($sql, array($input['session-id']));
|
||||
Dba::write($sql, array(
|
||||
$input['session-id']
|
||||
));
|
||||
|
||||
self::setHeaders();
|
||||
header("HTTP/1.0 204 Logout Successful", true, 204);
|
||||
|
@ -229,7 +274,6 @@ class Daap_Api
|
|||
|
||||
/**
|
||||
* update
|
||||
*
|
||||
*/
|
||||
public static function update($input)
|
||||
{
|
||||
|
@ -242,39 +286,9 @@ class Daap_Api
|
|||
self::apiOutput($o);
|
||||
}
|
||||
|
||||
/**
|
||||
* update
|
||||
*
|
||||
*/
|
||||
public static function databases($input)
|
||||
private static function catalog_songs()
|
||||
{
|
||||
//$revision = $_GET['revision-number'];
|
||||
|
||||
$o = '';
|
||||
// Database list
|
||||
if (count($input) == 0) {
|
||||
self::check_session('daap.serverdatabases');
|
||||
|
||||
$o = self::tlv('dmap.status', 200);
|
||||
$o .= self::tlv('dmap.updatetype', 0);
|
||||
$o .= self::tlv('dmap.specifiedtotalcount', 1);
|
||||
$o .= self::tlv('dmap.returnedcount', 1);
|
||||
|
||||
$r = self::tlv('dmap.itemid', 1);
|
||||
$r .= self::tlv('dmap.itemname', 'Ampache');
|
||||
$counts = Catalog::count_medias();
|
||||
$r .= self::tlv('dmap.itemcount', $counts['songs']);
|
||||
$r .= self::tlv('dmap.containercount', count(Playlist::get_playlists()));
|
||||
$r = self::tlv('dmap.listingitem', $r);
|
||||
$o .= self::tlv('dmap.listing', $r);
|
||||
|
||||
$o = self::tlv('daap.serverdatabases', $o);
|
||||
} elseif (count($input) == 2) {
|
||||
if ($input[1] == 'items') {
|
||||
// Songs list
|
||||
self::check_session('daap.playlistsongs');
|
||||
|
||||
//$type = $_GET['type'];
|
||||
// $type = $_GET['type'];
|
||||
$meta = explode(',', strtolower($_GET['meta']));
|
||||
$o = self::tlv('dmap.status', 200);
|
||||
$o .= self::tlv('dmap.updatetype', 0);
|
||||
|
@ -290,7 +304,42 @@ class Daap_Api
|
|||
$o .= self::tlv('dmap.returnedcount', count($songs));
|
||||
$o .= self::tlv('dmap.listing', self::tlv_songs($songs, $meta));
|
||||
|
||||
$o = self::tlv('daap.playlistsongs', $o);
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* databases
|
||||
*/
|
||||
public static function databases($input)
|
||||
{
|
||||
// $revision = $_GET['revision-number'];
|
||||
$o = '';
|
||||
// Database list
|
||||
if (count($input) == 0) {
|
||||
self::check_session('daap.serverdatabases');
|
||||
|
||||
$o = self::tlv('dmap.status', 200);
|
||||
$o .= self::tlv('dmap.updatetype', 0);
|
||||
$o .= self::tlv('dmap.specifiedtotalcount', 1);
|
||||
$o .= self::tlv('dmap.returnedcount', 1);
|
||||
|
||||
$r = self::tlv('dmap.itemid', 1);
|
||||
$r .= self::tlv('dmap.persistentid', 1);
|
||||
$r .= self::tlv('dmap.itemname', 'Ampache');
|
||||
$counts = Catalog::count_medias();
|
||||
$r .= self::tlv('dmap.itemcount', $counts['songs']);
|
||||
$r .= self::tlv('dmap.containercount', count(Playlist::get_playlists()));
|
||||
$r = self::tlv('dmap.listingitem', $r);
|
||||
$o .= self::tlv('dmap.listing', $r);
|
||||
|
||||
$o = self::tlv('daap.serverdatabases', $o);
|
||||
} elseif (count($input) == 2) {
|
||||
if ($input[1] == 'items') {
|
||||
// Songs list
|
||||
self::check_session('daap.databasesongs');
|
||||
|
||||
$o = self::catalog_songs();
|
||||
$o = self::tlv('daap.databasesongs', $o);
|
||||
} elseif ($input[1] == 'containers') {
|
||||
// Playlist list
|
||||
self::check_session('daap.databaseplaylists');
|
||||
|
@ -300,10 +349,10 @@ class Daap_Api
|
|||
|
||||
$playlists = Playlist::get_playlists();
|
||||
$searches = Search::get_searches();
|
||||
$o .= self::tlv('dmap.specifiedtotalcount', count($playlists) + count($searches));
|
||||
$o .= self::tlv('dmap.returnedcount', count($playlists) + count($searches));
|
||||
$o .= self::tlv('dmap.specifiedtotalcount', count($playlists) + count($searches) + 1);
|
||||
$o .= self::tlv('dmap.returnedcount', count($playlists) + count($searches) + 1);
|
||||
|
||||
$l = '';
|
||||
$l = self::base_library();
|
||||
foreach ($playlists as $playlist_id) {
|
||||
$playlist = new Playlist($playlist_id);
|
||||
$playlist->format();
|
||||
|
@ -329,13 +378,13 @@ class Daap_Api
|
|||
$params = '';
|
||||
$headers = apache_request_headers();
|
||||
$client = $headers['User-Agent'];
|
||||
if (!empty($client)) {
|
||||
if (! empty($client)) {
|
||||
$params .= '&client=' . $client;
|
||||
}
|
||||
$params .= '&transcode_to=' . $type;
|
||||
$url = Song::play_url($id, $params, 'api', true);
|
||||
self::follow_stream($url);
|
||||
exit;
|
||||
exit();
|
||||
}
|
||||
}
|
||||
} elseif (count($input) == 4) {
|
||||
|
@ -345,6 +394,10 @@ class Daap_Api
|
|||
|
||||
self::check_session('daap.playlistsongs');
|
||||
|
||||
if ($id == Daap_Api::BASE_LIBRARY) {
|
||||
$o = self::catalog_songs();
|
||||
$o = self::tlv('daap.playlistsongs', $o);
|
||||
} else {
|
||||
if ($id > Daap_Api::AMPACHEID_SMARTPL) {
|
||||
$id -= Daap_Api::AMPACHEID_SMARTPL;
|
||||
$playlist = new Search($id, 'song');
|
||||
|
@ -374,18 +427,22 @@ class Daap_Api
|
|||
$o .= self::tlv('dmap.returnedcount', count($songs));
|
||||
$o .= self::tlv('dmap.listing', self::tlv_songs($songs, $meta));
|
||||
|
||||
$o = self::tlv('daap.databaseplaylists', $o);
|
||||
$o = self::tlv('daap.playlistsongs', $o);
|
||||
} else {
|
||||
self::createApiError('daap.playlistsongs', 500, 'Invalid playlist id: ' . $id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self::apiOutput($o);
|
||||
}
|
||||
|
||||
private static function tlv_songs($songs, $meta)
|
||||
{
|
||||
if (array_search('all', $meta) > - 1) {
|
||||
$meta = self::$metas;
|
||||
}
|
||||
$lo = '';
|
||||
foreach ($songs as $song) {
|
||||
$song->format();
|
||||
|
@ -397,9 +454,10 @@ class Daap_Api
|
|||
case 'dmap.itemname':
|
||||
$o .= self::tlv($m, $song->f_title);
|
||||
break;
|
||||
/*case 'dmap.persistentid':
|
||||
case 'dmap.containeritemid':
|
||||
/* case 'dmap.persistentid': */
|
||||
$o .= self::tlv($m, $song->id);
|
||||
break;*/
|
||||
break;
|
||||
case 'daap.songalbum':
|
||||
$o .= self::tlv($m, $song->f_album);
|
||||
break;
|
||||
|
@ -458,13 +516,26 @@ class Daap_Api
|
|||
return $lo;
|
||||
}
|
||||
|
||||
public static function base_library()
|
||||
{
|
||||
$p = self::tlv('dmap.itemid', Daap_Api::BASE_LIBRARY);
|
||||
$p .= self::tlv('dmap.persistentid', Daap_Api::BASE_LIBRARY);
|
||||
$p .= self::tlv('dmap.itemname', 'Music');
|
||||
$p .= self::tlv('daap.baseplaylist', 1);
|
||||
$stats = Catalog::count_medias();
|
||||
$p .= self::tlv('dmap.itemcount', $stats['songs']);
|
||||
return self::tlv('dmap.listingitem', $p);
|
||||
}
|
||||
|
||||
public static function tlv_playlist($playlist)
|
||||
{
|
||||
$isSmart = false;
|
||||
if (strtolower(get_class($playlist)) == 'search') {
|
||||
$isSmart = true;
|
||||
}
|
||||
$p = self::tlv('dmap.itemid', (($isSmart) ? Daap_Api::AMPACHEID_SMARTPL : 0) + $playlist->id);
|
||||
$id = (($isSmart) ? Daap_Api::AMPACHEID_SMARTPL : 0) + $playlist->id;
|
||||
$p = self::tlv('dmap.itemid', $id);
|
||||
$p .= self::tlv('dmap.persistentid', $id);
|
||||
$p .= self::tlv('dmap.itemname', $playlist->f_name);
|
||||
$p .= self::tlv('dmap.itemcount', count($playlist->get_items()));
|
||||
if ($isSmart) {
|
||||
|
@ -517,31 +588,31 @@ class Daap_Api
|
|||
// Need to split value into two 32-bit integer because php pack function doesn't support 64-bit integer...
|
||||
$highMap = 0xffffffff00000000;
|
||||
$lowMap = 0x00000000ffffffff;
|
||||
$higher = ($value & $highMap) >>32;
|
||||
$higher = ($value & $highMap) >> 32;
|
||||
$lower = $value & $lowMap;
|
||||
return $tag . "\0\0\0\8" . pack("NN", $higher, $lower);
|
||||
return $tag . "\x00\x00\x00\x08" . pack("NN", $higher, $lower);
|
||||
}
|
||||
|
||||
private static function tlv_int($tag, $value)
|
||||
{
|
||||
return $tag . "\0\0\0\4" . pack("N", $value);
|
||||
return $tag . "\x00\x00\x00\x04" . pack("N", $value);
|
||||
}
|
||||
|
||||
private static function tlv_short($tag, $value)
|
||||
{
|
||||
return $tag . "\0\0\0\2" . pack("n", $value);
|
||||
return $tag . "\x00\x00\x00\x02" . pack("n", $value);
|
||||
}
|
||||
|
||||
private static function tlv_byte($tag, $value)
|
||||
{
|
||||
return $tag . "\0\0\0\1" . pack("C", $value);
|
||||
return $tag . "\x00\x00\x00\x01" . pack("C", $value);
|
||||
}
|
||||
|
||||
private static function tlv_version($tag, $value)
|
||||
{
|
||||
$v = explode('.', $value);
|
||||
if (count($v) == 4) {
|
||||
return $tag . "\0\0\0\4" . pack("C", $v[0]) . pack("C", $v[1]) . pack("C", $v[2]) . pack("C", $v[3]);
|
||||
return $tag . "\x00\x00\x00\x04" . pack("C", $v[0]) . pack("C", $v[1]) . pack("C", $v[2]) . pack("C", $v[3]);
|
||||
} else {
|
||||
debug_event('daap', 'Malformed `' . $tag . '` version `' . $value . '`.', '5');
|
||||
}
|
||||
|
@ -649,7 +720,8 @@ class Daap_Api
|
|||
|
||||
private static function add_dict($code, $type, $name)
|
||||
{
|
||||
self::$tags[$name] = array('type' => $type,
|
||||
self::$tags[$name] = array(
|
||||
'type' => $type,
|
||||
'code' => $code
|
||||
);
|
||||
}
|
||||
|
@ -721,17 +793,17 @@ class Daap_Api
|
|||
break;
|
||||
}
|
||||
header("Content-type: text/html", true);
|
||||
header("HTTP/1.0 ". $code . " " . $error, true, $code);
|
||||
header("HTTP/1.0 " . $code . " " . $error, true, $code);
|
||||
|
||||
$html = "<html><head><title>" . $error . "</title></head><body><h1>" . $code . " " . $error . "</h1></body></html>";
|
||||
self::apiOutput($html);
|
||||
exit();
|
||||
}
|
||||
|
||||
public static function createApiError($tag, $code, $msg='')
|
||||
public static function createApiError($tag, $code, $msg = '')
|
||||
{
|
||||
$o = self::tlv('dmap.status', $code);
|
||||
if (!empty($msg)) {
|
||||
if (! empty($msg)) {
|
||||
$o .= self::tlv('dmap.statusstring', $msg);
|
||||
}
|
||||
$o = self::tlv($tag, $o);
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -45,7 +45,9 @@ abstract class database_object
|
|||
$table_name = $table_name ? Dba::escape($table_name) : Dba::escape(strtolower(get_class($this)));
|
||||
|
||||
// Make sure we've got a real id
|
||||
if (!is_numeric($id)) { return array(); }
|
||||
if (!is_numeric($id)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if (self::is_cached($table_name,$id)) {
|
||||
return self::get_from_cache($table_name,$id);
|
||||
|
@ -54,14 +56,15 @@ abstract class database_object
|
|||
$sql = "SELECT * FROM `$table_name` WHERE `id`='$id'";
|
||||
$db_results = Dba::read($sql);
|
||||
|
||||
if (!$db_results) { return array(); }
|
||||
if (!$db_results) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$row = Dba::fetch_assoc($db_results);
|
||||
|
||||
self::add_to_cache($table_name,$id,$row);
|
||||
|
||||
return $row;
|
||||
|
||||
} // get_info
|
||||
|
||||
/**
|
||||
|
@ -79,10 +82,11 @@ abstract class database_object
|
|||
public static function is_cached($index, $id)
|
||||
{
|
||||
// Make sure we've got some parents here before we dive below
|
||||
if (!isset(self::$object_cache[$index])) { return false; }
|
||||
if (!isset(self::$object_cache[$index])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset(self::$object_cache[$index][$id]);
|
||||
|
||||
} // is_cached
|
||||
|
||||
/**
|
||||
|
@ -98,7 +102,6 @@ abstract class database_object
|
|||
}
|
||||
|
||||
return false;
|
||||
|
||||
} // get_from_cache
|
||||
|
||||
/**
|
||||
|
@ -107,11 +110,12 @@ abstract class database_object
|
|||
*/
|
||||
public static function add_to_cache($index, $id, $data)
|
||||
{
|
||||
if (!self::$_enabled) { return false; }
|
||||
if (!self::$_enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$value = is_null($data) ? false : $data;
|
||||
self::$object_cache[$index][$id] = $value;
|
||||
|
||||
} // add_to_cache
|
||||
|
||||
/**
|
||||
|
@ -124,7 +128,6 @@ abstract class database_object
|
|||
if (isset(self::$object_cache[$index]) && isset(self::$object_cache[$index][$id])) {
|
||||
unset(self::$object_cache[$index][$id]);
|
||||
}
|
||||
|
||||
} // remove_from_cache
|
||||
|
||||
/**
|
||||
|
@ -134,7 +137,6 @@ abstract class database_object
|
|||
public static function _auto_init()
|
||||
{
|
||||
self::$_enabled = AmpConfig::get('memory_cache');
|
||||
|
||||
} // _auto_init
|
||||
|
||||
} // end database_object
|
||||
|
||||
|
|
|
@ -2,26 +2,28 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Make sure they aren't directly accessing it */
|
||||
if (!defined('INIT_LOADED') || INIT_LOADED != '1') { exit; }
|
||||
if (!defined('INIT_LOADED') || INIT_LOADED != '1') {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dba Class
|
||||
|
@ -48,7 +50,6 @@ class Dba
|
|||
private function __construct()
|
||||
{
|
||||
// Rien a faire
|
||||
|
||||
} // construct
|
||||
|
||||
/**
|
||||
|
@ -93,13 +94,15 @@ class Dba
|
|||
self::$_error = json_encode($dbh->errorInfo());
|
||||
debug_event('Dba', 'Error: ' . json_encode($dbh->errorInfo()), 1);
|
||||
self::disconnect();
|
||||
} else if ($stmt->errorCode() && $stmt->errorCode() != '00000') {
|
||||
} else {
|
||||
if ($stmt->errorCode() && $stmt->errorCode() != '00000') {
|
||||
self::$_error = json_encode($stmt->errorInfo());
|
||||
debug_event('Dba', 'Error: ' . json_encode($stmt->errorInfo()), 1);
|
||||
self::finish($stmt);
|
||||
self::disconnect();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $stmt;
|
||||
}
|
||||
|
@ -185,6 +188,24 @@ class Dba
|
|||
return $result;
|
||||
}
|
||||
|
||||
public static function fetch_object($resource, $class = 'stdClass', $finish = true)
|
||||
{
|
||||
if (!$resource) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$result = $resource->fetchObject($class);
|
||||
|
||||
if (!$result) {
|
||||
if ($finish) {
|
||||
self::finish($resource);
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* num_rows
|
||||
*
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -52,14 +52,15 @@ class Democratic extends Tmp_Playlist
|
|||
*/
|
||||
public function __construct($id='')
|
||||
{
|
||||
if (!$id) { return false; }
|
||||
if (!$id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$info = $this->get_info($id);
|
||||
|
||||
foreach ($info as $key=>$value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
|
||||
} // constructor
|
||||
|
||||
/**
|
||||
|
@ -68,7 +69,9 @@ class Democratic extends Tmp_Playlist
|
|||
*/
|
||||
public static function build_vote_cache($ids)
|
||||
{
|
||||
if (!is_array($ids) || !count($ids)) { return false; }
|
||||
if (!is_array($ids) || !count($ids)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$idlist = '(' . implode(',', $ids) . ')';
|
||||
|
||||
|
@ -83,7 +86,6 @@ class Democratic extends Tmp_Playlist
|
|||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // build_vote_cache
|
||||
|
||||
/**
|
||||
|
@ -93,10 +95,11 @@ class Democratic extends Tmp_Playlist
|
|||
*/
|
||||
public function is_enabled()
|
||||
{
|
||||
if ($this->tmp_playlist) { return true; }
|
||||
if ($this->tmp_playlist) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
} // is_enabled
|
||||
|
||||
/**
|
||||
|
@ -113,8 +116,6 @@ class Democratic extends Tmp_Playlist
|
|||
$row = Dba::fetch_assoc($db_results);
|
||||
|
||||
$this->tmp_playlist = $row['id'];
|
||||
|
||||
|
||||
} // set_parent
|
||||
|
||||
/**
|
||||
|
@ -141,7 +142,6 @@ class Democratic extends Tmp_Playlist
|
|||
Preference::update_all($play_method,'clear');
|
||||
|
||||
return true;
|
||||
|
||||
} // set_user_preferences
|
||||
|
||||
/**
|
||||
|
@ -170,7 +170,6 @@ class Democratic extends Tmp_Playlist
|
|||
$this->f_level = T_('Admin');
|
||||
break;
|
||||
}
|
||||
|
||||
} // format
|
||||
|
||||
/**
|
||||
|
@ -190,7 +189,6 @@ class Democratic extends Tmp_Playlist
|
|||
}
|
||||
|
||||
return $results;
|
||||
|
||||
} // get_playlists
|
||||
|
||||
/**
|
||||
|
@ -214,7 +212,6 @@ class Democratic extends Tmp_Playlist
|
|||
$object = new Democratic($democratic_id);
|
||||
|
||||
return $object;
|
||||
|
||||
} // get_current_playlist
|
||||
|
||||
/**
|
||||
|
@ -259,7 +256,6 @@ class Democratic extends Tmp_Playlist
|
|||
}
|
||||
|
||||
return $results;
|
||||
|
||||
} // get_items
|
||||
|
||||
/**
|
||||
|
@ -271,7 +267,6 @@ class Democratic extends Tmp_Playlist
|
|||
$link = Stream::get_base_url() . 'uid=' . scrub_out($GLOBALS['user']->id) . '&demo_id=' . scrub_out($this->id);
|
||||
|
||||
return Stream_URL::format($link);
|
||||
|
||||
} // play_url
|
||||
|
||||
/**
|
||||
|
@ -306,7 +301,6 @@ class Democratic extends Tmp_Playlist
|
|||
$results = Dba::fetch_assoc($db_results);
|
||||
return $results['id'];
|
||||
}
|
||||
|
||||
} // get_next_object
|
||||
|
||||
/**
|
||||
|
@ -327,7 +321,6 @@ class Democratic extends Tmp_Playlist
|
|||
$row = Dba::fetch_assoc($db_results);
|
||||
|
||||
return $row['id'];
|
||||
|
||||
} // get_uid_from_object_id
|
||||
|
||||
/**
|
||||
|
@ -343,7 +336,6 @@ class Democratic extends Tmp_Playlist
|
|||
$song_ids = Stats::get_object_history($GLOBALS['user']->id, $cool_time);
|
||||
|
||||
return $song_ids;
|
||||
|
||||
} // get_cool_songs
|
||||
|
||||
/**
|
||||
|
@ -363,7 +355,6 @@ class Democratic extends Tmp_Playlist
|
|||
$this->_add_vote($object_id, $type);
|
||||
}
|
||||
} // end foreach
|
||||
|
||||
} // vote
|
||||
|
||||
/**
|
||||
|
@ -396,7 +387,6 @@ class Democratic extends Tmp_Playlist
|
|||
}
|
||||
|
||||
return false;
|
||||
|
||||
} // has_vote
|
||||
|
||||
/**
|
||||
|
@ -457,7 +447,6 @@ class Democratic extends Tmp_Playlist
|
|||
self::prune_tracks();
|
||||
|
||||
return true;
|
||||
|
||||
} // remove_vote
|
||||
|
||||
/**
|
||||
|
@ -475,7 +464,6 @@ class Democratic extends Tmp_Playlist
|
|||
Dba::write($sql);
|
||||
|
||||
return true;
|
||||
|
||||
} // delete_votes
|
||||
|
||||
/**
|
||||
|
@ -488,10 +476,11 @@ class Democratic extends Tmp_Playlist
|
|||
if ($row_id) {
|
||||
debug_event('Democratic','Removing Votes for ' . $oid . ' of type ' . $object_type,'5');
|
||||
$this->delete_votes($row_id);
|
||||
} else { debug_event('Democratic','Unable to find Votes for ' . $oid . ' of type ' . $object_type,'3'); }
|
||||
} else {
|
||||
debug_event('Democratic','Unable to find Votes for ' . $oid . ' of type ' . $object_type,'3');
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // delete_from_oid
|
||||
|
||||
/**
|
||||
|
@ -511,7 +500,6 @@ class Democratic extends Tmp_Playlist
|
|||
self::prune_tracks();
|
||||
|
||||
return true;
|
||||
|
||||
} // delete
|
||||
|
||||
/**
|
||||
|
@ -531,7 +519,6 @@ class Democratic extends Tmp_Playlist
|
|||
Dba::write($sql, array($name, $base, $cool, $default, $level, $id));
|
||||
|
||||
return true;
|
||||
|
||||
} // update
|
||||
|
||||
/**
|
||||
|
@ -562,7 +549,6 @@ class Democratic extends Tmp_Playlist
|
|||
}
|
||||
|
||||
return $db_results;
|
||||
|
||||
} // create
|
||||
|
||||
/**
|
||||
|
@ -580,7 +566,6 @@ class Democratic extends Tmp_Playlist
|
|||
Dba::write($sql);
|
||||
|
||||
return true;
|
||||
|
||||
} // prune_tracks
|
||||
|
||||
/**
|
||||
|
@ -607,7 +592,6 @@ class Democratic extends Tmp_Playlist
|
|||
self::clear_votes();
|
||||
|
||||
return true;
|
||||
|
||||
} // clear_playlist
|
||||
|
||||
/**
|
||||
|
@ -622,7 +606,6 @@ class Democratic extends Tmp_Playlist
|
|||
Dba::write($sql);
|
||||
|
||||
return true;
|
||||
|
||||
} // clear_votes
|
||||
|
||||
/**
|
||||
|
@ -642,7 +625,6 @@ class Democratic extends Tmp_Playlist
|
|||
$results = Dba::fetch_assoc($db_results);
|
||||
parent::add_to_cache('democratic_vote', $id, $results['count']);
|
||||
return $results['count'];
|
||||
|
||||
} // get_vote
|
||||
|
||||
/**
|
||||
|
@ -666,6 +648,5 @@ class Democratic extends Tmp_Playlist
|
|||
parent::add_to_cache('democratic_vote', $object_id, $voters);
|
||||
return $voters;
|
||||
} // get_voters
|
||||
|
||||
|
||||
} // Democratic class
|
||||
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -24,10 +24,9 @@ class Graph
|
|||
{
|
||||
public function __construct()
|
||||
{
|
||||
require_once AmpConfig::get('prefix') . '/modules/pChart/pData.class.php';
|
||||
require_once AmpConfig::get('prefix') . '/modules/pChart/pDraw.class.php';
|
||||
require_once AmpConfig::get('prefix') . '/modules/pChart/pImage.class.php';
|
||||
|
||||
require_once AmpConfig::get('prefix') . '/lib/vendor/szymach/c-pchart/src/Classes/pData.php';
|
||||
require_once AmpConfig::get('prefix') . '/lib/vendor/szymach/c-pchart/src/Classes/pDraw.php';
|
||||
require_once AmpConfig::get('prefix') . '/lib/vendor/szymach/c-pchart/src/Classes/pImage.php';
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -35,7 +34,7 @@ class Graph
|
|||
{
|
||||
switch ($zoom) {
|
||||
case 'hour':
|
||||
$df = "DATE_FORMAT(FROM_UNIXTIME(" . $field ."), '%Y-%m-%d %H:00:00')";
|
||||
$df = "DATE_FORMAT(FROM_UNIXTIME(" . $field . "), '%Y-%m-%d %H:00:00')";
|
||||
break;
|
||||
case 'year':
|
||||
$df = "DATE_FORMAT(FROM_UNIXTIME(" . $field . "), '%Y-01-01')";
|
||||
|
@ -132,7 +131,7 @@ class Graph
|
|||
return $values;
|
||||
}
|
||||
|
||||
protected function get_all_pts($fct, pData $MyData, $id = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day', $show_total = true)
|
||||
protected function get_all_pts($fct, CpChart\Classes\pData $MyData, $id = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day', $show_total = true)
|
||||
{
|
||||
$values = $this->get_all_type_pts($fct, $id, $object_type, $object_id, $start_date, $end_date, $zoom);
|
||||
foreach ($values as $date => $value) {
|
||||
|
@ -144,7 +143,7 @@ class Graph
|
|||
return $values;
|
||||
}
|
||||
|
||||
protected function get_user_all_pts($fct, pData $MyData, $user = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
|
||||
protected function get_user_all_pts($fct, CpChart\Classes\pData $MyData, $user = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
|
||||
{
|
||||
$values = $this->get_all_pts($fct, $MyData, $user, $object_type, $object_id, $start_date, $end_date, $zoom);
|
||||
|
||||
|
@ -167,7 +166,7 @@ class Graph
|
|||
}
|
||||
}
|
||||
|
||||
protected function get_catalog_all_pts($fct, pData $MyData, $catalog = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
|
||||
protected function get_catalog_all_pts($fct, CpChart\Classes\pData $MyData, $catalog = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
|
||||
{
|
||||
$values = $this->get_all_pts($fct, $MyData, $catalog, $object_type, $object_id, $start_date, $end_date, $zoom, false);
|
||||
|
||||
|
@ -289,7 +288,7 @@ class Graph
|
|||
return $pts;
|
||||
}
|
||||
|
||||
protected function render_graph($title, pData $MyData, $zoom, $width = 0, $height = 0)
|
||||
protected function render_graph($title, CpChart\Classes\pData $MyData, $zoom, $width = 0, $height = 0)
|
||||
{
|
||||
// Check graph size sanity
|
||||
$width = intval($width);
|
||||
|
@ -319,10 +318,10 @@ class Graph
|
|||
}
|
||||
|
||||
/* Create the pChart object */
|
||||
$myPicture = new pImage($width,$height,$MyData);
|
||||
$myPicture = new CpChart\Classes\pImage($width,$height,$MyData);
|
||||
|
||||
/* Turn of Antialiasing */
|
||||
$myPicture->Antialias = FALSE;
|
||||
$myPicture->Antialias = false;
|
||||
|
||||
/* Draw a background */
|
||||
$Settings = array("R"=>90, "G"=>90, "B"=>90, "Dash"=>1, "DashR"=>120, "DashG"=>120, "DashB"=>120);
|
||||
|
@ -336,25 +335,26 @@ class Graph
|
|||
/* Add a border to the picture */
|
||||
$myPicture->drawRectangle(0,0,$width-1,$height-1,array("R"=>0,"G"=>0,"B"=>0));
|
||||
|
||||
$font_path = AmpConfig::get('prefix') . "/lib/vendor/szymach/c-pchart/src/Resources/fonts";
|
||||
/* Write the chart title */
|
||||
$myPicture->setFontProperties(array("FontName"=>AmpConfig::get('prefix')."/modules/pChart/fonts/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));
|
||||
|
||||
/* Set the default font */
|
||||
$myPicture->setFontProperties(array("FontName"=>AmpConfig::get('prefix')."/modules/pChart/fonts/pf_arma_five.ttf","FontSize"=>6));
|
||||
$myPicture->setFontProperties(array("FontName"=>$font_path . "/pf_arma_five.ttf","FontSize"=>6));
|
||||
|
||||
/* Define the chart area */
|
||||
$myPicture->setGraphArea(60,40,$width-20,$height-50);
|
||||
|
||||
/* 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);
|
||||
$myPicture->drawScale($scaleSettings);
|
||||
|
||||
/* Turn on Antialiasing */
|
||||
$myPicture->Antialias = TRUE;
|
||||
$myPicture->Antialias = true;
|
||||
|
||||
/* Draw the line chart */
|
||||
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
|
||||
$myPicture->setShadow(true,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
|
||||
$myPicture->drawLineChart();
|
||||
|
||||
/* Write a label over the chart */
|
||||
|
@ -370,7 +370,7 @@ class Graph
|
|||
|
||||
public function render_user_hits($user = 0, $object_type, $object_id, $start_date = null, $end_date = null, $zoom = 'day', $width = 0, $height = 0)
|
||||
{
|
||||
$MyData = new pData();
|
||||
$MyData = new CpChart\Classes\pData();
|
||||
$this->get_user_all_pts('get_user_hits_pts', $MyData, $user, $object_type, $object_id, $start_date, $end_date, $zoom);
|
||||
|
||||
$MyData->setAxisName(0, "Hits");
|
||||
|
@ -381,7 +381,7 @@ class Graph
|
|||
|
||||
public function render_user_bandwidth($user = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day', $width = 0, $height = 0)
|
||||
{
|
||||
$MyData = new pData();
|
||||
$MyData = new CpChart\Classes\pData();
|
||||
$this->get_user_all_pts('get_user_bandwidth_pts', $MyData, $user, $object_type, $object_id, $start_date, $end_date, $zoom);
|
||||
|
||||
$MyData->setAxisName(0, "Bandwidth");
|
||||
|
@ -425,7 +425,7 @@ class Graph
|
|||
|
||||
public function render_catalog_files($catalog = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day', $width = 0, $height = 0)
|
||||
{
|
||||
$MyData = new pData();
|
||||
$MyData = new CpChart\Classes\pData();
|
||||
$this->get_catalog_all_pts('get_catalog_files_pts', $MyData, $catalog, $object_type, $object_id, $start_date, $end_date, $zoom);
|
||||
|
||||
$MyData->setAxisName(0, "Files");
|
||||
|
@ -436,7 +436,7 @@ class Graph
|
|||
|
||||
public function render_catalog_size($catalog = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day', $width = 0, $height = 0)
|
||||
{
|
||||
$MyData = new pData();
|
||||
$MyData = new CpChart\Classes\pData();
|
||||
$this->get_catalog_all_pts('get_catalog_size_pts', $MyData, $catalog, $object_type, $object_id, $start_date, $end_date, $zoom);
|
||||
|
||||
$MyData->setAxisName(0, "Size");
|
||||
|
@ -462,12 +462,22 @@ class Graph
|
|||
|
||||
public static function display_from_request()
|
||||
{
|
||||
if (!Access::check('interface','50')) {
|
||||
$object_type = $_REQUEST['object_type'];
|
||||
$object_id = $_REQUEST['object_id'];
|
||||
|
||||
$libitem = null;
|
||||
$owner_id = 0;
|
||||
if ($object_id) {
|
||||
if (Core::is_library_item($object_type)) {
|
||||
$libitem = new $object_type($object_id);
|
||||
$owner_id = $libitem->get_user_owner();
|
||||
}
|
||||
}
|
||||
|
||||
if (($owner_id <= 0 || $owner_id != $GLOBALS['user']->id) && !Access::check('interface','50')) {
|
||||
UI::access_denied();
|
||||
} else {
|
||||
$user_id = $_REQUEST['user_id'];
|
||||
$object_type = $_REQUEST['object_type'];
|
||||
$object_id = $_REQUEST['object_id'];
|
||||
$end_date = $_REQUEST['end_date'] ? strtotime($_REQUEST['end_date']) : time();
|
||||
$f_end_date = date("Y-m-d H:i", $end_date);
|
||||
$start_date = $_REQUEST['start_date'] ? strtotime($_REQUEST['start_date']) : ($end_date - 864000);
|
||||
|
@ -485,21 +495,20 @@ class Graph
|
|||
}
|
||||
|
||||
$blink = '';
|
||||
if ($object_id) {
|
||||
if (Core::is_library_item($object_type)) {
|
||||
$libitem = new $object_type($object_id);
|
||||
if ($libitem !== null) {
|
||||
$libitem->format();
|
||||
if (isset($libitem->f_link)) {
|
||||
$blink = $libitem->f_link;
|
||||
}
|
||||
}
|
||||
} else if ($user_id) {
|
||||
} else {
|
||||
if ($user_id) {
|
||||
$u = new User($user_id);
|
||||
$u->format();
|
||||
$blink = $u->f_link;
|
||||
}
|
||||
}
|
||||
|
||||
require_once AmpConfig::get('prefix') . '/templates/show_graphs.inc.php';
|
||||
require_once AmpConfig::get('prefix') . UI::find_template('show_graphs.inc.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* LICENSE: GNU Affero General Public License, version 3 (AGPLv3)
|
||||
* Copyright 2001 - 2015 Ampache.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License v2
|
||||
* as published by the Free Software Foundation.
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -85,7 +85,9 @@ class Label extends database_object implements library_item
|
|||
*/
|
||||
public function __construct($id=null)
|
||||
{
|
||||
if (!$id) { return false; }
|
||||
if (!$id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$info = $this->get_info($id);
|
||||
foreach ($info as $key=>$value) {
|
||||
|
@ -201,13 +203,15 @@ class Label extends database_object implements library_item
|
|||
$user = $GLOBALS['user']->id;
|
||||
}
|
||||
|
||||
if (!$user)
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AmpConfig::get('upload_allow_edit')) {
|
||||
if ($this->user !== null && $user == $this->user)
|
||||
if ($this->user !== null && $user == $this->user) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return Access::check('interface', 50, $user);
|
||||
}
|
||||
|
@ -336,7 +340,6 @@ class Label extends database_object implements library_item
|
|||
}
|
||||
|
||||
return $results;
|
||||
|
||||
} // get_songs
|
||||
|
||||
public function remove()
|
||||
|
@ -348,6 +351,7 @@ class Label extends database_object implements library_item
|
|||
Userflag::gc('label', $this->id);
|
||||
Rating::gc('label', $this->id);
|
||||
Shoutbox::gc('label', $this->id);
|
||||
Useractivity::gc('label', $this->id);
|
||||
}
|
||||
|
||||
return $deleted;
|
||||
|
@ -383,7 +387,9 @@ class Label extends database_object implements library_item
|
|||
*/
|
||||
public static function get_display($labels, $link=false)
|
||||
{
|
||||
if (!is_array($labels)) { return ''; }
|
||||
if (!is_array($labels)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$results = '';
|
||||
|
||||
|
@ -402,7 +408,6 @@ class Label extends database_object implements library_item
|
|||
$results = rtrim($results, ', ');
|
||||
|
||||
return $results;
|
||||
|
||||
} // get_display
|
||||
|
||||
/**
|
||||
|
@ -411,7 +416,7 @@ class Label extends database_object implements library_item
|
|||
*/
|
||||
public static function update_label_list($labels_comma, $artist_id, $overwrite)
|
||||
{
|
||||
debug_event('label.class', 'Updating labels for values {'.$labels_comma.'} artist {'.$artist_id.'}', '5');
|
||||
debug_event('label.class', 'Updating labels for values {' . $labels_comma . '} artist {' . $artist_id . '}', '5');
|
||||
|
||||
$clabels = Label::get_labels($artist_id);
|
||||
$editedLabels = explode(",", $labels_comma);
|
||||
|
@ -420,7 +425,7 @@ class Label extends database_object implements library_item
|
|||
foreach ($clabels as $clid => $clv) {
|
||||
if ($clid) {
|
||||
$clabel = new Label($clid);
|
||||
debug_event('label.class', 'Processing label {'.$clabel->name.'}...', '5');
|
||||
debug_event('label.class', 'Processing label {' . $clabel->name . '}...', '5');
|
||||
$found = false;
|
||||
|
||||
foreach ($editedLabels as $lk => $lv) {
|
||||
|
@ -433,18 +438,20 @@ class Label extends database_object implements library_item
|
|||
if ($found) {
|
||||
debug_event('label.class', 'Already found. Do nothing.', '5');
|
||||
unset($editedLabels[$lk]);
|
||||
} else if ($overwrite) {
|
||||
} else {
|
||||
if ($overwrite) {
|
||||
debug_event('label.class', 'Not found in the new list. Delete it.', '5');
|
||||
$clabel->remove_artist_assoc($artist_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Look if we need to add some new labels
|
||||
foreach ($editedLabels as $lk => $lv) {
|
||||
if ($lv != '') {
|
||||
debug_event('label.class', 'Adding new label {'.$lv.'}', '5');
|
||||
debug_event('label.class', 'Adding new label {' . $lv . '}', '5');
|
||||
$label_id = Label::lookup(array('name' => $lv));
|
||||
if ($label_id === 0) {
|
||||
debug_event('label.class', 'Creating a label directly from artist editing is not allowed.', '5');
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue